X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Fchannel%2FServiceRequest.java;fp=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Fchannel%2FServiceRequest.java;h=68dd5c73d6647b84d683810581d0cde2fcfd9a60;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git 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 index 000000000..68dd5c73d --- /dev/null +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/channel/ServiceRequest.java @@ -0,0 +1,59 @@ +package org.simantics.databoard.channel; + +import org.simantics.databoard.binding.Binding; + +/** + * This interface is intended to be used by service handler implementations. + * + * @author Toni Kalajainen + */ +public interface ServiceRequest { + + /** + * Context is an idetification of the requester. The actual implementation + * depends on the implementation of the channel. + * + * For example: TCP based implementation can publish user identification, + * security policy, application instance certificate, session identifier, + * socket address, etc.. + * + * Application local implementation may carry no data.

+ * + * @return client context + */ + Object getClientContext(); + + /** + * Get the command specification of the request. + * + * The identifier of the spec is a well-known id of the requested service. + * + * @return command specification + */ + CommandSpec getCommandSpec(); + + /** + * Get an access to the request object. + * + * @param binding + * @return access to request + */ + Object getRequest(Binding binding); + + /** + * Send a successful result. Result can be sent from any thread but only once. + * + * @param binding + * @param result + */ + void sendResult( Binding binding, Object result ); + + /** + * Send an error result. Result can be sent from any thread but only once. + * + * @param binding + * @param error + */ + void sendError( Binding binding, Object error ); + +}