/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 Association for Decentralized Information Management
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
package org.simantics.db;
import java.util.Collection;
+import java.util.function.Consumer;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.procedure.AsyncListener;
* @see MergingGraphRequestProcessor
* @see AsyncRequestProcessor
*/
-public interface RequestProcessorSpecific extends AsyncRequestProcessor {
+public interface RequestProcessorSpecific {
/**
* Synchronously determines and returns the result of the given {@link Read}
* @param request an instance of {@link MultiRead}.
* @param procedure an instance of {@link AsyncMultiListener}.
*/
- <T> Collection<T> syncRequest(MultiRead<T> request, AsyncMultiListener<T> procedure) throws DatabaseException;
+ //<T> Collection<T> syncRequest(MultiRead<T> request, AsyncMultiListener<T> procedure) throws DatabaseException;
/**
* Synchronously registers the given {@link SyncMultiListener} (as
* @param request an instance of {@link MultiRead}.
* @param procedure an instance of {@link AsyncMultiProcedure}.
*/
- <T> Collection<T> syncRequest(MultiRead<T> request, AsyncMultiProcedure<T> procedure) throws DatabaseException;
+ //<T> Collection<T> syncRequest(MultiRead<T> request, AsyncMultiProcedure<T> procedure) throws DatabaseException;
/**
* Synchronously supplies the result determined from the given
* @param request an instance of {@link Write}.
*/
<T> T syncRequest(WriteOnlyResult<T> r) throws DatabaseException;
-
+
+ /**
+ * Asynchronously performs the given {@link Write}. The outcome of the
+ * request will be lost.
+ *
+ * @param request an instance of {@link Write}.
+ */
+ void asyncRequest(Write request);
+
+ /**
+ * Asynchronously performs the given {@link Write}. The outcome of the
+ * request will be reported to given {@link Consumer} in the form of a
+ * DatabaseException raised during request processing or null upon success.
+ *
+ * @param request an instance of {@link Write}.
+ * @param request an instance of {@link Consumer}.
+ */
+ void asyncRequest(Write request, Consumer<DatabaseException> callback);
+
+ <T> void asyncRequest(WriteResult<T> r, Procedure<T> procedure);
+
+
+ /**
+ * Asynchronously performs the given {@link WriteOnly}. The outcome of the
+ * request will be lost.
+ *
+ * @param request an instance of {@link Write}.
+ */
+ void asyncRequest(DelayedWrite request);
+
+ /**
+ * Asynchronously performs the given {@link WriteOnly}. The outcome of the
+ * request will be reported to given {@link Consumer} in the form of a
+ * DatabaseException raised during request processing or null upon success.
+ *
+ * @param request an instance of {@link WriteOnly}.
+ * @param request an instance of {@link Consumer}.
+ */
+ void asyncRequest(DelayedWrite request, Consumer<DatabaseException> callback);
+
+ <T> void asyncRequest(DelayedWriteResult<T> r, Procedure<T> procedure);
+
+ /**
+ * Asynchronously performs the given {@link WriteOnly}. The outcome of the
+ * request will be lost.
+ *
+ * @param request an instance of {@link Write}.
+ */
+ void asyncRequest(WriteOnly r);
+
+ /**
+ * Asynchronously performs the given {@link WriteOnly}. The outcome of the
+ * request will be reported to given {@link Consumer} in the form of a
+ * DatabaseException raised during request processing or null upon success.
+ *
+ * @param request an instance of {@link WriteOnly}.
+ * @param request an instance of {@link Consumer}.
+ */
+ void asyncRequest(WriteOnly r, Consumer<DatabaseException> callback);
+
+ <T> void asyncRequest(WriteOnlyResult<T> r, Procedure<T> procedure);
+
}