]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/src/org/simantics/databoard/channel/ServiceRequest.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / channel / ServiceRequest.java
diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/channel/ServiceRequest.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/channel/ServiceRequest.java
new file mode 100644 (file)
index 0000000..68dd5c7
--- /dev/null
@@ -0,0 +1,59 @@
+package org.simantics.databoard.channel;\r
+\r
+import org.simantics.databoard.binding.Binding;\r
+\r
+/**\r
+ * This interface is intended to be used by service handler implementations.\r
+ *\r
+ * @author Toni Kalajainen <toni.kalajainen@iki.fi>\r
+ */\r
+public interface ServiceRequest {\r
+       \r
+       /**\r
+        * Context is an idetification of the requester. The actual implementation\r
+        * depends on the implementation of the channel. \r
+     *   \r
+     * For example: TCP based implementation can publish user identification, \r
+     * security policy, application instance certificate, session identifier, \r
+     * socket address, etc..\r
+        * \r
+     * Application local implementation may carry no data. <p>\r
+        * \r
+        * @return client context\r
+        */\r
+       Object getClientContext();\r
+       \r
+       /**\r
+        * Get the command specification of the request.\r
+        *  \r
+        * The identifier of the spec is a well-known id of the requested service.\r
+        * \r
+        * @return command specification\r
+        */\r
+       CommandSpec getCommandSpec();\r
+       \r
+       /**\r
+        * Get an access to the request object.\r
+        * \r
+        * @param binding \r
+        * @return access to request\r
+        */\r
+       Object getRequest(Binding binding);\r
+       \r
+       /**\r
+        * Send a successful result. Result can be sent from any thread but only once.\r
+        * \r
+        * @param binding\r
+        * @param result\r
+        */\r
+       void sendResult( Binding binding, Object result );\r
+       \r
+       /**\r
+        * Send an error result. Result can be sent from any thread but only once. \r
+        * \r
+        * @param binding\r
+        * @param error\r
+        */\r
+       void sendError( Binding binding, Object error );                \r
+               \r
+}\r