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