1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.common.processor;
14 import java.util.ArrayList;
15 import java.util.Collection;
16 import java.util.HashMap;
17 import java.util.HashSet;
18 import java.util.LinkedList;
20 import java.util.UUID;
21 import java.util.concurrent.Semaphore;
23 import org.simantics.db.AsyncReadGraph;
24 import org.simantics.db.AsyncRequestProcessor;
25 import org.simantics.db.ReadGraph;
26 import org.simantics.db.RequestProcessor;
27 import org.simantics.db.Resource;
28 import org.simantics.db.Session;
29 import org.simantics.db.VirtualGraph;
30 import org.simantics.db.WriteGraph;
31 import org.simantics.db.common.procedure.adapter.AsyncMultiProcedureAdapter;
32 import org.simantics.db.common.procedure.adapter.ProcedureAdapter;
33 import org.simantics.db.common.procedure.wrapper.NoneToAsyncProcedure;
34 import org.simantics.db.common.request.ReadRequest;
35 import org.simantics.db.common.request.WriteRequest;
36 import org.simantics.db.common.utils.Logger;
37 import org.simantics.db.exception.CancelTransactionException;
38 import org.simantics.db.exception.DatabaseException;
39 import org.simantics.db.procedure.AsyncListener;
40 import org.simantics.db.procedure.AsyncMultiListener;
41 import org.simantics.db.procedure.AsyncMultiProcedure;
42 import org.simantics.db.procedure.AsyncProcedure;
43 import org.simantics.db.procedure.Listener;
44 import org.simantics.db.procedure.MultiListener;
45 import org.simantics.db.procedure.MultiProcedure;
46 import org.simantics.db.procedure.Procedure;
47 import org.simantics.db.procedure.SyncListener;
48 import org.simantics.db.procedure.SyncMultiListener;
49 import org.simantics.db.procedure.SyncMultiProcedure;
50 import org.simantics.db.procedure.SyncProcedure;
51 import org.simantics.db.request.AsyncMultiRead;
52 import org.simantics.db.request.AsyncRead;
53 import org.simantics.db.request.DelayedWrite;
54 import org.simantics.db.request.DelayedWriteResult;
55 import org.simantics.db.request.ExternalRead;
56 import org.simantics.db.request.MultiRead;
57 import org.simantics.db.request.Read;
58 import org.simantics.db.request.ReadInterface;
59 import org.simantics.db.request.UndoTraits;
60 import org.simantics.db.request.Write;
61 import org.simantics.db.request.WriteInterface;
62 import org.simantics.db.request.WriteOnly;
63 import org.simantics.db.request.WriteOnlyResult;
64 import org.simantics.db.request.WriteResult;
65 import org.simantics.utils.DataContainer;
66 import org.simantics.utils.datastructures.Callback;
67 import org.simantics.utils.datastructures.Pair;
69 public class MergingGraphRequestProcessor implements RequestProcessor {
71 private static class SyncWriteRequestAdapter implements Write {
73 private Semaphore semaphore = new Semaphore(0);
74 private Object request;
75 private Throwable exception;
76 SyncWriteRequestAdapter(Write r) {
79 SyncWriteRequestAdapter(WriteOnly r) {
83 // public GraphRequestStatus perform(Graph g) throws Exception {
84 // return perform((ReadGraph)g);
87 public void perform(WriteGraph g) throws DatabaseException, CancelTransactionException {
88 if(request instanceof Write) {
89 ((Write)request).perform(g);
90 } else if(request instanceof DelayedWrite) {
91 ((DelayedWrite)request).perform(g);
93 ((WriteOnly)request).perform(g);
97 // public String getId() {
98 // if(request instanceof WriteGraphRequest) {
99 // return ((WriteGraphRequest)request).getId();
105 // public void requestCompleted(GraphRequestStatus status) {
106 // if(request instanceof WriteGraphRequest) {
107 // ((WriteGraphRequest)request).requestCompleted(status);
112 // public void handleException(Throwable e) {
113 // this.exception = e;
114 // if(request instanceof WriteGraphRequest) {
115 // ((WriteGraphRequest)request).handleException(e);
119 public void throwOrWrapException() {
120 if (exception == null)
122 if (exception instanceof RuntimeException)
123 throw (RuntimeException) exception;
124 if (exception instanceof Error)
125 throw (Error) exception;
126 throw new RuntimeException("See cause for the real exception.", exception);
130 public VirtualGraph getProvider() {
135 // public void fillMetadata(Map<String, String> metadata) {
138 public void acquire() {
141 } catch (InterruptedException e) {
142 Logger.defaultLogError(e);
146 public void release() {
151 public UndoTraits getUndoTraits() {
156 public String toString() {
157 return "SyncWriteRequestAdapter " + request;
162 long transactionKeepalivePeriod;
165 * Synchronization object for implementing {@link #synchronize()}.
166 * {@link Object#notifyAll()} is invoked for this lock object every time a
167 * single transaction is completed, thereby releasing all waiters in
168 * {@link #synchronize()}.
170 Object barrier = new Object();
172 Set<Pair<Object, Object>> requestSet = new HashSet<Pair<Object, Object>>();
173 LinkedList<Pair<Object, Object>> requestQueue = new LinkedList<Pair<Object, Object>>();
174 boolean hasAlreadyRequest = false;
177 * A set of requests which {@link #synchronize()} is depending on at the
178 * moment. Every time a request within this set is completed, some thread in
179 * {@link #synchronize()} should be released.
181 // Set<Object> barrierRequests = new HashSet<Object>();
182 Set<Object> syncRequests = new HashSet<Object>();
186 private AsyncRequestProcessor processor;
188 public MergingGraphRequestProcessor(String name, AsyncRequestProcessor processor, long transactionKeepalivePeriod) {
190 this.processor = processor;
191 this.transactionKeepalivePeriod = transactionKeepalivePeriod;
194 public MergingGraphRequestProcessor(AsyncRequestProcessor processor, long transactionKeepalivePeriod) {
195 this.name = "MergingGraphRequestProcessor" + UUID.randomUUID().toString();
196 this.processor = processor;
197 this.transactionKeepalivePeriod = transactionKeepalivePeriod;
200 @SuppressWarnings({"unchecked", "rawtypes"})
201 protected class MergedRead extends ReadRequest {
203 Pair<Object, Object> currentRequest;
205 // RunnerReadGraphRequest(GraphRequestProcessor processor) {
210 // public void completed(boolean value) {
211 //// System.out.println(this + "MGRP read completed");
212 //// synchronized (MergingGraphRequestProcessor.this) {
213 //// if (requestQueue.isEmpty())
214 //// hasAlreadyRequest = false;
216 //// newTransaction();
221 public void run(ReadGraph graph) {
223 // System.out.println(MergingGraphRequestProcessor.this + " reads");
227 synchronized (MergingGraphRequestProcessor.this) {
229 // Release #synchronize() invokers if necessary.
230 // if (currentRequest != null && barrierRequests.contains(currentRequest)) {
231 // synchronized (barrier) {
232 // barrier.notifyAll();
236 if(requestQueue.isEmpty()) {
237 if (transactionKeepalivePeriod > 0) {
238 // System.out.println("MGRP [" + MergingGraphRequestProcessor.this + "] waits " + transactionKeepalivePeriod + " ms. in " + Thread.currentThread() );
240 MergingGraphRequestProcessor.this.wait(transactionKeepalivePeriod);
241 } catch (InterruptedException e) {
242 Logger.defaultLogError(e);
244 if (requestQueue.isEmpty())
250 Object nextRequest = requestQueue.peekFirst().first;
251 if(nextRequest instanceof Write || nextRequest instanceof DelayedWrite) {
255 currentRequest = requestQueue.remove(0);
256 requestSet.remove(currentRequest);
260 // ReadGraphRequest req = (ReadGraphRequest)currentRequest.first;
262 if( syncRequests.contains(currentRequest.first)) {
266 if(currentRequest.second instanceof AsyncProcedure<?>) {
267 if(currentRequest.first instanceof Read) {
268 Read req = (Read)currentRequest.first;
269 graph.syncRequest(req, (AsyncProcedure<?>)currentRequest.second);
271 AsyncRead req = (AsyncRead)currentRequest.first;
272 graph.syncRequest(req, (AsyncProcedure<?>)currentRequest.second);
275 AsyncMultiRead req = (AsyncMultiRead)currentRequest.first;
276 graph.syncRequest(req, (AsyncMultiProcedure<?>)currentRequest.second);
279 } catch(Throwable t) {
281 Logger.defaultLogError(t);
283 if(currentRequest.second instanceof AsyncProcedure<?>) {
284 ((AsyncProcedure<?>)currentRequest.second).exception(graph, t);
286 ((AsyncMultiProcedure<?>)currentRequest.second).exception(graph, t);
291 synchronized (currentRequest.first) {
292 syncRequests.remove(currentRequest.first);
293 // System.out.println("notifying " + currentRequest.first);
294 currentRequest.first.notify();
302 if(currentRequest.second instanceof AsyncProcedure<?>) {
303 if(currentRequest.first instanceof AsyncRead) {
304 AsyncRead req = (AsyncRead)currentRequest.first;
305 graph.asyncRequest(req, (AsyncProcedure<?>)currentRequest.second);
307 Read req = (Read)currentRequest.first;
308 graph.asyncRequest(req, (AsyncProcedure<?>)currentRequest.second);
311 AsyncMultiRead req = (AsyncMultiRead)currentRequest.first;
312 graph.asyncRequest(req, (AsyncMultiProcedure<?>)currentRequest.second);
315 } catch(Throwable t) {
317 Logger.defaultLogError(t);
319 if(currentRequest.second instanceof AsyncProcedure<?>) {
320 ((AsyncProcedure<?>)currentRequest.second).exception(graph, t);
322 ((AsyncMultiProcedure<?>)currentRequest.second).exception(graph, t);
330 // System.out.println(MergingGraphRequestProcessor.this + " read completed");
332 synchronized (MergingGraphRequestProcessor.this) {
333 if (requestQueue.isEmpty())
334 hasAlreadyRequest = false;
342 public String toString() {
343 return "MergedRead[" + requestQueue.size() + " requests]";
348 protected class RunnerWriteGraphRequest extends WriteRequest {
350 Pair<Object, Object> currentRequest;
351 HashMap<String, String> metadata = new HashMap<String, String>();
354 public void perform(WriteGraph graph) throws DatabaseException {
356 // System.out.println(MergingGraphRequestProcessor.this + " writes");
360 synchronized (MergingGraphRequestProcessor.this) {
362 // Release #synchronize() invokers if necessary.
363 // if (currentRequest != null && barrierRequests.contains(currentRequest)) {
364 // synchronized (barrier) {
365 // barrier.notifyAll();
369 if(requestQueue.isEmpty()) {
370 if (transactionKeepalivePeriod > 0) {
372 MergingGraphRequestProcessor.this.wait(transactionKeepalivePeriod);
373 } catch (InterruptedException e) {
374 Logger.defaultLogError(e);
376 if (requestQueue.isEmpty())
382 Object nextRequest = requestQueue.peekFirst().first;
383 if(nextRequest instanceof AsyncMultiRead || nextRequest instanceof AsyncRead || nextRequest instanceof Read) {
387 currentRequest = requestQueue.remove(0);
388 requestSet.remove(currentRequest);
392 @SuppressWarnings("unchecked")
393 Callback<Throwable> callback = (Callback<Throwable>)currentRequest.second;
395 if (currentRequest.first.getClass().equals(SyncWriteRequestAdapter.class)) {
397 SyncWriteRequestAdapter adapter = (SyncWriteRequestAdapter)currentRequest.first;
400 // System.out.println("merg.sync " + adapter);
401 graph.syncRequest(adapter);
402 if(callback != null) callback.run(null);
403 } catch(Throwable t) {
404 Logger.defaultLogError(t);
405 if(callback != null) callback.run(t);
409 // System.out.println("merg.sync.release " + adapter);
414 if(currentRequest.first instanceof Write) graph.syncRequest((Write)currentRequest.first);
415 else if(currentRequest.first instanceof DelayedWrite) graph.syncRequest((DelayedWrite)currentRequest.first);
416 if(callback != null) callback.run(null);
417 } catch(Throwable t) {
418 Logger.defaultLogError(t);
419 if(callback != null) callback.run(t);
426 // System.out.println(MergingGraphRequestProcessor.this + " write completed");
428 synchronized (MergingGraphRequestProcessor.this) {
429 if (requestQueue.isEmpty())
430 hasAlreadyRequest = false;
439 private void newTransaction() {
441 boolean write = false;
443 synchronized (MergingGraphRequestProcessor.this) {
444 assert(!requestQueue.isEmpty());
445 Object nextRequest = requestQueue.peekFirst().first;
446 write = (nextRequest instanceof Write || nextRequest instanceof DelayedWrite);
450 processor.asyncRequest(new RunnerWriteGraphRequest(), null);
452 processor.asyncRequest(new MergedRead());
458 public <T> void asyncRequest(AsyncMultiRead<T> request, AsyncMultiProcedure<T> procedure) {
460 // System.out.println(this + " asyncRequest(ReadGraphRequest<QueryProcedure4<T>> request, QueryProcedure4<T> procedure)");
462 if (requestSet.contains(request))
465 Pair<Object, Object> pair = new Pair<Object, Object>(request, procedure);
466 requestQueue.add(pair);
467 requestSet.add(pair);
469 if (!hasAlreadyRequest) {
471 hasAlreadyRequest = true;
479 public synchronized <T> void asyncRequest(AsyncRead<T> request, AsyncProcedure<T> procedure) {
481 // System.out.println(this + " asyncRequest(ReadGraphRequest<SingleQueryProcedure4<T>> request, SingleQueryProcedure4<T> procedure) " + this);
483 if (requestSet.contains(request))
486 Pair<Object, Object> pair = new Pair<Object, Object>(request, procedure);
487 requestQueue.add(pair);
488 requestSet.add(pair);
490 if (!hasAlreadyRequest) {
492 hasAlreadyRequest = true;
494 // System.out.println("notify " + this);
501 public synchronized void asyncRequest(Write request, Callback<DatabaseException> callback) {
503 // System.out.println(this + " asyncRequest(WriteGraphRequest request)");
505 if (requestSet.contains(request))
508 Pair<Object, Object> pair = new Pair<Object, Object>(request, callback);
509 requestQueue.add(pair);
510 requestSet.add(pair);
512 if (!hasAlreadyRequest) {
513 // System.out.println("new transaction");
515 hasAlreadyRequest = true;
517 // System.out.println("notify");
524 public synchronized void asyncRequest(DelayedWrite request, Callback<DatabaseException> callback) {
526 // System.out.println(this + " asyncRequest(WriteGraphRequest request)");
528 if (requestSet.contains(request))
531 Pair<Object, Object> pair = new Pair<Object, Object>(request, callback);
532 requestQueue.add(pair);
533 requestSet.add(pair);
535 if (!hasAlreadyRequest) {
536 // System.out.println("new transaction");
538 hasAlreadyRequest = true;
540 // System.out.println("notify");
547 public synchronized void asyncRequest(WriteOnly request, Callback<DatabaseException> callback) {
549 // System.out.println(this + " asyncRequest(WriteGraphRequest request)");
551 if (requestSet.contains(request))
554 Pair<Object, Object> pair = new Pair<Object, Object>(request, callback);
555 requestQueue.add(pair);
556 requestSet.add(pair);
558 if (!hasAlreadyRequest) {
559 // System.out.println("new transaction");
561 hasAlreadyRequest = true;
563 // System.out.println("notify");
570 public <T> Collection<T> syncRequest(AsyncMultiRead<T> request, final AsyncMultiProcedure<T> procedure) {
572 final DataContainer<Throwable> throwable = new DataContainer<Throwable>(null);
574 // Queue the adapter up for execution.
575 synchronized (request) {
576 syncRequests.add(request);
577 asyncRequest(request, procedure);
578 if(syncRequests.contains(request)) {
580 // System.out.println("waiting " + request);
582 } catch (InterruptedException e) {
588 Throwable t = throwable.get();
591 Logger.defaultLogError(t);
592 throw new RuntimeException(t.getMessage());
600 public <T> T syncRequest(AsyncRead<T> request, final AsyncProcedure<T> procedure) {
602 // System.out.println("syncRequest(ReadGraphRequest<SingleQueryProcedure4<T>> request, SingleQueryProcedure4<T> procedure)");
604 final DataContainer<T> result = new DataContainer<T>(null);
605 final DataContainer<Throwable> throwable = new DataContainer<Throwable>(null);
607 // Queue the adapter up for execution.
608 synchronized (request) {
610 syncRequests.add(request);
611 asyncRequest(request, new AsyncProcedure<T>() {
613 public void execute(AsyncReadGraph graph, T t) {
614 synchronized(result) {
617 procedure.execute(graph, t);
621 public void exception(AsyncReadGraph graph, Throwable t) {
626 public String toString() {
627 return procedure.toString();
631 if(syncRequests.contains(request)) {
633 // System.out.println("waiting " + request);
635 } catch (InterruptedException e) {
641 Throwable t = throwable.get();
644 Logger.defaultLogError(t);
645 throw new RuntimeException(t.getMessage());
650 //return result.get();
656 public void syncRequest(Write request) {
658 // System.out.println(MergingGraphRequestProcessor.this + " syncRequest(WriteGraphRequest)");
660 SyncWriteRequestAdapter adapter = new SyncWriteRequestAdapter(request);
662 asyncRequest(adapter, null);
666 // Throw exception if one occurred.
667 adapter.throwOrWrapException();
672 public void syncRequest(WriteOnly request) {
674 // System.out.println(MergingGraphRequestProcessor.this + " syncRequest(WriteGraphRequest)");
676 SyncWriteRequestAdapter adapter = new SyncWriteRequestAdapter(request);
678 // Queue the adapter up for execution.
679 synchronized (adapter) {
680 asyncRequest(adapter, null);
683 } catch (InterruptedException e) {
688 // Throw exception if one occurred.
689 adapter.throwOrWrapException();
694 public Session getSession() {
695 return processor.getSession();
699 public String toString() {
700 return "MergingGraphRequestProcessor[" + name + "]@" + System.identityHashCode(this) + " (based on " + processor + ")";
704 public <T> void asyncRequest(AsyncRead<T> request) {
706 asyncRequest(request, new ProcedureAdapter<T>() {
709 public void exception(Throwable t) {
710 Logger.defaultLogError(t);
718 public <T> void asyncRequest(AsyncRead<T> request, Procedure<T> procedure) {
719 asyncRequest(request, new NoneToAsyncProcedure<T>(procedure));
723 public <T> void asyncRequest(AsyncMultiRead<T> request) {
724 throw new UnsupportedOperationException("Not implemented.");
728 public <T> void asyncRequest(AsyncMultiRead<T> request,
729 MultiProcedure<T> procedure) {
730 throw new UnsupportedOperationException("Not implemented.");
734 public <T> T syncRequest(AsyncRead<T> request) {
736 final DataContainer<Throwable> throwable = new DataContainer<Throwable>(null);
737 final DataContainer<T> result = new DataContainer<T>();
739 syncRequest(request, new AsyncProcedure<T>() {
741 public void execute(AsyncReadGraph graph, T t) {
746 public void exception(AsyncReadGraph graph, Throwable t) {
752 Throwable t = throwable.get();
755 Logger.defaultLogError(t);
756 throw new RuntimeException(t.getMessage());
764 public <T> T syncRequest(AsyncRead<T> request,
765 Procedure<T> procedure) {
766 throw new UnsupportedOperationException("Not implemented.");
770 public <T> Collection<T> syncRequest(AsyncMultiRead<T> request) {
772 final DataContainer<Throwable> throwable = new DataContainer<Throwable>(null);
773 final ArrayList<T> result = new ArrayList<T>();
775 syncRequest(request, new AsyncMultiProcedureAdapter<T>() {
778 public void execute(AsyncReadGraph graph, T t) {
779 synchronized(result) {
785 public void exception(AsyncReadGraph graph, Throwable t) {
791 Throwable t = throwable.get();
794 Logger.defaultLogError(t);
795 throw new RuntimeException(t.getMessage());
803 public <T> Collection<T> syncRequest(AsyncMultiRead<T> request,
804 MultiProcedure<T> procedure) {
805 throw new Error("Not implemented.");
809 public <T> T syncRequest(Read<T> request) {
811 final DataContainer<Throwable> throwable = new DataContainer<Throwable>(null);
812 final DataContainer<T> result = new DataContainer<T>();
815 syncRequest(request, new Procedure<T>() {
817 public void execute(T t) {
822 public void exception(Throwable t) {
828 Throwable t = throwable.get();
831 throw new Error(t.getMessage());
840 public <T> T syncRequest(Read<T> request,
841 final AsyncProcedure<T> procedure) {
843 final DataContainer<T> result = new DataContainer<T>(null);
844 final DataContainer<Throwable> throwable = new DataContainer<Throwable>(null);
846 // Queue the adapter up for execution.
847 synchronized (request) {
849 syncRequests.add(request);
850 asyncRequest(request, new AsyncProcedure<T>() {
852 public void execute(AsyncReadGraph graph, T t) {
853 synchronized(result) {
856 procedure.execute(graph, t);
860 public void exception(AsyncReadGraph graph, Throwable t) {
865 public String toString() {
866 return procedure.toString();
870 if(syncRequests.contains(request)) {
872 // System.out.println("waiting " + request);
874 } catch (InterruptedException e) {
880 Throwable t = throwable.get();
883 throw new RuntimeException("Unexpected exception in MergingGraphRequestProcessor.syncRequest(Read, AsyncProcedure)", t);
891 public <T> void asyncRequest(Read<T> request) {
893 asyncRequest(request, new ProcedureAdapter<T>() {
896 public void exception(Throwable t) {
897 Logger.defaultLogError(t);
905 public synchronized <T> void asyncRequest(Read<T> request,
906 AsyncProcedure<T> procedure) {
908 if (requestSet.contains(request))
911 Pair<Object, Object> pair = new Pair<Object, Object>(request, procedure);
912 requestQueue.add(pair);
913 requestSet.add(pair);
915 if (!hasAlreadyRequest) {
917 hasAlreadyRequest = true;
925 public <T> T syncRequest(Read<T> request, Procedure<T> procedure) {
926 return syncRequest(request, new NoneToAsyncProcedure<T>(procedure));
930 public <T> Collection<T> syncRequest(final MultiRead<T> request) throws DatabaseException {
931 assert(request != null);
933 final ArrayList<T> result = new ArrayList<T>();
934 final DataContainer<Throwable> exception = new DataContainer<Throwable>();
936 syncRequest(request, new AsyncMultiProcedureAdapter<T>() {
939 public void execute(AsyncReadGraph graph, T t) {
940 synchronized(result) {
946 public void exception(AsyncReadGraph graph, Throwable t) {
951 public String toString() {
952 return "syncRequest(MultiRead) -> " + request;
957 Throwable t = exception.get();
959 if(t instanceof DatabaseException) throw (DatabaseException)t;
960 else throw new DatabaseException("Unexpected exception in ReadGraph.syncRequest(Read)", t);
967 public <T> Collection<T> syncRequest(MultiRead<T> request, AsyncMultiProcedure<T> procedure) {
968 throw new UnsupportedOperationException("Not implemented");
972 public <T> Collection<T> syncRequest(MultiRead<T> request, MultiProcedure<T> procedure) {
973 throw new UnsupportedOperationException("Not implemented");
977 public <T> void asyncRequest(Read<T> request, Procedure<T> procedure) {
978 asyncRequest(request, new NoneToAsyncProcedure<T>(procedure));
982 public <T> void asyncRequest(MultiRead<T> request) {
983 throw new UnsupportedOperationException("Not implemented");
987 public <T> void asyncRequest(MultiRead<T> request, AsyncMultiProcedure<T> procedure) {
988 throw new UnsupportedOperationException("Not implemented");
992 public <T> void asyncRequest(MultiRead<T> request, MultiProcedure<T> procedure) {
993 throw new UnsupportedOperationException("Not implemented");
997 public void asyncRequest(Write r) {
998 asyncRequest(r, null);
1002 public void asyncRequest(DelayedWrite r) {
1003 asyncRequest(r, null);
1007 public void asyncRequest(WriteOnly r) {
1008 asyncRequest(r, null);
1012 public <T> T getService(Class<T> api) {
1013 return getSession().getService(api);
1017 public <T> T peekService(Class<T> api) {
1018 return getSession().peekService(api);
1022 public boolean hasService(Class<?> api) {
1023 return getSession().hasService(api);
1027 public <T> void registerService(Class<T> api, T service) {
1028 getSession().registerService(api, service);
1032 // public <T> T syncRequest(Read<T> arg0, AsyncListener<T> arg1) {
1033 // throw new UnsupportedOperationException("Not implemented.");
1037 public <T> T syncRequest(Read<T> arg0, SyncListener<T> arg1) {
1038 throw new UnsupportedOperationException("Not implemented.");
1042 public <T> T syncRequest(Read<T> arg0, Listener<T> arg1) {
1043 throw new UnsupportedOperationException("Not implemented.");
1047 public <T> T syncRequest(Read<T> arg0, SyncProcedure<T> arg1) {
1048 throw new UnsupportedOperationException("Not implemented.");
1052 public <T> T syncRequest(AsyncRead<T> arg0, AsyncListener<T> arg1) {
1053 throw new UnsupportedOperationException("Not implemented.");
1057 public <T> T syncRequest(AsyncRead<T> arg0, SyncListener<T> arg1) {
1058 throw new UnsupportedOperationException("Not implemented.");
1063 public <T> T syncRequest(AsyncRead<T> arg0, Listener<T> arg1) {
1064 throw new UnsupportedOperationException("Not implemented.");
1069 public <T> T syncRequest(AsyncRead<T> arg0, SyncProcedure<T> arg1) {
1070 throw new UnsupportedOperationException("Not implemented.");
1075 public <T> void asyncRequest(Read<T> arg0, AsyncListener<T> arg1) {
1076 throw new UnsupportedOperationException("Not implemented.");
1081 public <T> void asyncRequest(Read<T> arg0, SyncListener<T> arg1) {
1082 throw new UnsupportedOperationException("Not implemented.");
1087 public <T> void asyncRequest(Read<T> arg0, Listener<T> arg1) {
1088 throw new UnsupportedOperationException("Not implemented.");
1093 public <T> void asyncRequest(Read<T> arg0, SyncProcedure<T> arg1) {
1094 throw new UnsupportedOperationException("Not implemented.");
1099 public <T> void asyncRequest(AsyncRead<T> arg0, AsyncListener<T> arg1) {
1100 throw new UnsupportedOperationException("Not implemented.");
1105 public <T> void asyncRequest(AsyncRead<T> arg0, SyncListener<T> arg1) {
1106 throw new UnsupportedOperationException("Not implemented.");
1111 public <T> void asyncRequest(AsyncRead<T> arg0, Listener<T> arg1) {
1112 throw new UnsupportedOperationException("Not implemented.");
1117 public <T> void asyncRequest(AsyncRead<T> arg0, SyncProcedure<T> arg1) {
1118 throw new UnsupportedOperationException("Not implemented.");
1123 public <T> Collection<T> syncRequest(MultiRead<T> arg0, AsyncMultiListener<T> arg1) {
1124 throw new UnsupportedOperationException("Not implemented.");
1129 public <T> Collection<T> syncRequest(MultiRead<T> arg0, SyncMultiListener<T> arg1) {
1130 throw new UnsupportedOperationException("Not implemented.");
1135 public <T> Collection<T> syncRequest(MultiRead<T> arg0, MultiListener<T> arg1) {
1136 throw new UnsupportedOperationException("Not implemented.");
1141 public <T> Collection<T> syncRequest(MultiRead<T> arg0, SyncMultiProcedure<T> arg1) {
1142 throw new UnsupportedOperationException("Not implemented.");
1147 public <T> Collection<T> syncRequest(AsyncMultiRead<T> arg0,
1148 AsyncMultiListener<T> arg1) {
1149 throw new UnsupportedOperationException("Not implemented.");
1154 public <T> Collection<T> syncRequest(AsyncMultiRead<T> arg0, SyncMultiListener<T> arg1) {
1155 throw new UnsupportedOperationException("Not implemented.");
1160 public <T> Collection<T> syncRequest(AsyncMultiRead<T> arg0,
1161 MultiListener<T> arg1) {
1162 throw new UnsupportedOperationException("Not implemented.");
1167 public <T> Collection<T> syncRequest(AsyncMultiRead<T> arg0, SyncMultiProcedure<T> arg1) {
1168 throw new UnsupportedOperationException("Not implemented.");
1173 public <T> void asyncRequest(MultiRead<T> arg0, AsyncMultiListener<T> arg1) {
1174 throw new UnsupportedOperationException("Not implemented.");
1179 public <T> void asyncRequest(MultiRead<T> arg0, SyncMultiListener<T> arg1) {
1180 throw new UnsupportedOperationException("Not implemented.");
1185 public <T> void asyncRequest(MultiRead<T> arg0, MultiListener<T> arg1) {
1186 throw new UnsupportedOperationException("Not implemented.");
1191 public <T> void asyncRequest(MultiRead<T> arg0, SyncMultiProcedure<T> arg1) {
1192 throw new UnsupportedOperationException("Not implemented.");
1197 public <T> void asyncRequest(AsyncMultiRead<T> arg0,
1198 AsyncMultiListener<T> arg1) {
1199 throw new UnsupportedOperationException("Not implemented.");
1203 public <T> void asyncRequest(AsyncMultiRead<T> arg0, SyncMultiListener<T> arg1) {
1204 throw new UnsupportedOperationException("Not implemented.");
1209 public <T> void asyncRequest(AsyncMultiRead<T> arg0,
1210 MultiListener<T> arg1) {
1211 throw new UnsupportedOperationException("Not implemented.");
1216 public <T> void asyncRequest(AsyncMultiRead<T> arg0, SyncMultiProcedure<T> arg1) {
1217 throw new UnsupportedOperationException("Not implemented.");
1221 public <T> void asyncRequest(ExternalRead<T> request, Procedure<T> procedure) {
1222 throw new UnsupportedOperationException("Not implemented.");
1226 public <T> T syncRequest(ExternalRead<T> request) {
1227 throw new UnsupportedOperationException("Not implemented.");
1231 public <T> T syncRequest(ExternalRead<T> request, Listener<T> procedure) {
1232 throw new UnsupportedOperationException("Not implemented.");
1236 public <T> T syncRequest(ExternalRead<T> request, Procedure<T> procedure) {
1237 throw new UnsupportedOperationException("Not implemented.");
1241 public <T> void asyncRequest(ExternalRead<T> request) {
1242 throw new UnsupportedOperationException("Not implemented.");
1246 public <T> void asyncRequest(ExternalRead<T> request, Listener<T> procedure) {
1247 throw new UnsupportedOperationException("Not implemented.");
1251 public void syncRequest(DelayedWrite request) throws DatabaseException {
1252 throw new UnsupportedOperationException("Not implemented.");
1256 public <T> T syncRequest(WriteResult<T> request) throws DatabaseException {
1257 throw new UnsupportedOperationException();
1261 public <T> T syncRequest(DelayedWriteResult<T> request)
1262 throws DatabaseException {
1263 throw new UnsupportedOperationException();
1267 public <T> T syncRequest(WriteOnlyResult<T> r) throws DatabaseException {
1268 throw new UnsupportedOperationException();
1272 public <T> void asyncRequest(WriteResult<T> r, Procedure<T> procedure) {
1273 throw new UnsupportedOperationException();
1277 public <T> void asyncRequest(DelayedWriteResult<T> r, Procedure<T> procedure) {
1278 throw new UnsupportedOperationException();
1282 public <T> void asyncRequest(WriteOnlyResult<T> r, Procedure<T> procedure) {
1283 throw new UnsupportedOperationException();
1287 public Resource getRootLibrary() {
1288 return processor.getRootLibrary();
1292 public <T> void async(ReadInterface<T> r, Procedure<T> procedure) {
1293 throw new UnsupportedOperationException();
1297 public <T> void async(ReadInterface<T> r, AsyncProcedure<T> procedure) {
1298 throw new UnsupportedOperationException();
1302 public <T> void async(ReadInterface<T> r, SyncProcedure<T> procedure) {
1303 throw new UnsupportedOperationException();
1307 public <T> void async(ReadInterface<T> r, Listener<T> procedure) {
1308 throw new UnsupportedOperationException();
1312 public <T> void async(ReadInterface<T> r, AsyncListener<T> procedure) {
1313 throw new UnsupportedOperationException();
1317 public <T> void async(ReadInterface<T> r, SyncListener<T> procedure) {
1318 throw new UnsupportedOperationException();
1322 public <T> T sync(ReadInterface<T> r) throws DatabaseException {
1323 throw new UnsupportedOperationException();
1327 public <T> T sync(WriteInterface<T> r) throws DatabaseException {
1328 throw new UnsupportedOperationException();
1332 public <T> void async(WriteInterface<T> r, Procedure<T> procedure) {
1333 throw new UnsupportedOperationException();
1337 public <T> void async(WriteInterface<T> r) {
1338 throw new UnsupportedOperationException();
1342 public Object getModificationCounter() {
1343 throw new UnsupportedOperationException();