Class Service
A Service object is obtained from a Session and contains the Operations (each of which
contains its own schema) and the schema for Events which this Service may produce. A Service
object is also used to create Request objects used with a Session to issue requests.
All data delivered via the API is associated with a service. Before accessing data using the API using either request-reply or subscription, the appropriate Service must be opened and, if necessary, authorized.
-
Method Summary
Modifier and TypeMethodDescriptionabstract StringReturn the name of the Service which must be used in order to authorize access to restricted operations on this Service.abstract EventDeprecated.abstract RequestAn application must populate theRequestbefore using it withSession.sendAuthorizationRequest().abstract EventCreate anEventsuitable for publishing to this Service.abstract RequestcreateRequest(String operationName) Return an empty Request object for the specified operation.abstract EventcreateResponseEvent(CorrelationID correlationId) Create a response Event to answer the request.abstract SchemaElementDefinitiongetEventDefinition(int index) Return theSchemaElementDefinitionof the event of this Service at the specified indexabstract SchemaElementDefinitiongetEventDefinition(Name name) Return theSchemaElementDefinitionof the event of this Service with the specified nameabstract SchemaElementDefinitiongetEventDefinition(String name) Return theSchemaElementDefinitionof the event of this Service with the specified nameabstract OperationgetOperation(int index) Return theOperationof this Service at the specified index.abstract OperationgetOperation(Name name) Return theOperationof this service having the specified nameabstract OperationgetOperation(String name) Return theOperationof this service having the specified nameabstract Stringname()Return a string which contains the name of this Serviceabstract intReturn the number of unsolicited events defined by this Serviceabstract intReturn the number of Operations defined by this Serviceabstract voidprint(OutputStream output) Prints the schema of this service to OutputStream.abstract voidPrints the schema of this service to Writer.
-
Method Details
-
name
Return a string which contains the name of this Service -
numOperations
public abstract int numOperations()Return the number of Operations defined by this Service -
getOperation
Return theOperationof this Service at the specified index.- Throws:
IndexOutOfBoundsException- ifindex >=numOperations()
-
getOperation
Return theOperationof this service having the specified name- Throws:
NotFoundException- if an operation with the specified name cannot be found
-
getOperation
Return theOperationof this service having the specified name- Throws:
NotFoundException- if an operation with the specified name cannot be found
-
numEventDefinitions
public abstract int numEventDefinitions()Return the number of unsolicited events defined by this Service -
getEventDefinition
Return theSchemaElementDefinitionof the event of this Service at the specified index- Throws:
IndexOutOfBoundsException- ifindex >=numEventDefinitions()
-
getEventDefinition
Return theSchemaElementDefinitionof the event of this Service with the specified name- Throws:
NotFoundException- if an event definition with the specified name cannot be found
-
getEventDefinition
Return theSchemaElementDefinitionof the event of this Service with the specified name- Throws:
NotFoundException- if an event definition with the specified name cannot be found
-
authorizationServiceName
Return the name of the Service which must be used in order to authorize access to restricted operations on this Service.If no authorization is required to access operations on this service an empty string is returned. Authorization services never require authorization to use.
-
createRequest
Return an empty Request object for the specified operation.An application must populate the Request before issuing it using
Session.sendRequest()- Throws:
NotFoundException- if an Operation with the specified name could not be found.
-
createAuthorizationRequest
An application must populate theRequestbefore using it withSession.sendAuthorizationRequest().Note that this method can be called only on authorization services. This method will throw a
NotFoundExceptionif thisServicedoes not provide anAuthorizationRequestoperation. The request created by this method can be used for authorizing users to receive data from otherServices that require this authorization.Authorization requests don't have request ids. (
Request.getRequestId()) on an authorization request will returnnull- Throws:
NotFoundException- if this service does not have anAuthorizationRequestOperation.
-
print
Prints the schema of this service to OutputStream.- Throws:
IOException
-
print
Prints the schema of this service to Writer.- Throws:
IOException
-
createPublishEvent
Create anEventsuitable for publishing to this Service. Use anEventFormatterto add Messages to the Event and set fields. -
createAdminEvent
Deprecated.as of 3.7.0, usecreatePublishEvent()instead Create an Admin Event suitable for publishing to this Service. Use an EventFormatter to add Messages to the Event and set fields. -
createResponseEvent
Create a response Event to answer the request. Use an EventFormatter to add a Message to the Event and set fields.
-
createPublishEvent()instead Create an Admin Event suitable for publishing to this Service.