]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 package org.simantics.databoard.channel;\r
2 \r
3 import org.simantics.databoard.binding.Binding;\r
4 \r
5 /**\r
6  * This interface is intended to be used by service handler implementations.\r
7  *\r
8  * @author Toni Kalajainen <toni.kalajainen@iki.fi>\r
9  */\r
10 public interface ServiceRequest {\r
11         \r
12         /**\r
13          * Context is an idetification of the requester. The actual implementation\r
14          * depends on the implementation of the channel. \r
15      *   \r
16      * For example: TCP based implementation can publish user identification, \r
17      * security policy, application instance certificate, session identifier, \r
18      * socket address, etc..\r
19          * \r
20      * Application local implementation may carry no data. <p>\r
21          * \r
22          * @return client context\r
23          */\r
24         Object getClientContext();\r
25         \r
26         /**\r
27          * Get the command specification of the request.\r
28          *  \r
29          * The identifier of the spec is a well-known id of the requested service.\r
30          * \r
31          * @return command specification\r
32          */\r
33         CommandSpec getCommandSpec();\r
34         \r
35         /**\r
36          * Get an access to the request object.\r
37          * \r
38          * @param binding \r
39          * @return access to request\r
40          */\r
41         Object getRequest(Binding binding);\r
42         \r
43         /**\r
44          * Send a successful result. Result can be sent from any thread but only once.\r
45          * \r
46          * @param binding\r
47          * @param result\r
48          */\r
49         void sendResult( Binding binding, Object result );\r
50         \r
51         /**\r
52          * Send an error result. Result can be sent from any thread but only once. \r
53          * \r
54          * @param binding\r
55          * @param error\r
56          */\r
57         void sendError( Binding binding, Object error );                \r
58                 \r
59 }\r