Class CommunicationEngine
java.lang.Object
com.aquima.interactions.communication.impl.CommunicationEngine
- All Implemented Interfaces:
IDomainSchemaRegistry
,ICommunicationEngine
Internal ICommunicationEngine implementation that uses a datasource, metamodel and ruleengine for construction.
- Since:
- 9.0
- Author:
- Arjan Pragt, Jon van Leuven
-
Constructor Summary
ConstructorsConstructorDescriptionCommunicationEngine
(ICommunicationEngineDS datasource, IMetaModel metamodel, IRuleEngine ruleEngine) Construct a communication engine with a datasource. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDataContract
(DomainSchemaDefinition definition) protected void
protected void
protected void
protected void
protected void
composeRestRequest
(IProfile profile, String serviceName, String operationName, String mimeType, ICommunicationEngineHandler handler) This method composes the rest message.composeRestRequest
(IProfile profile, String serviceName, String operationName, String mimeType, ICommunicationEngineHandler handler, Map<String, List<String>> headers) This method composes the rest message.composeRestResponse
(IProfile profile, String serviceName, String operationName, String mimeType, ICommunicationEngineHandler handler) This method composes a rest response message.composeSoapRequest
(IInternalPortalContext context, String serviceName, String operationName, ICommunicationEngineHandler handler) This methods composes a soap request message.composeSoapRequest
(IInternalPortalContext context, String serviceName, String operationName, ISoapMessageHandler[] handlers, ICommunicationEngineHandler handler) This methods composes a soap request message.composeSoapResponse
(IInternalPortalContext context, String serviceName, String operationName, ICommunicationEngineHandler handler) This method composes a soap response message.getDomainSchema
(String name) This method returns the definition of a domain schema for the specified name.getRestService
(String serviceName) This method returns the rest service.String[]
This method returns the available rest service name.getSchemaContract
(String name) Returns the schema contract of a specified name.String[]
Returns the names of the contracts.getSchemaSet
(String name) This method return the definition of a schema set for the specified name.String[]
This method returns the available schema set names.getSoapContract
(String name) Returns the soap contract of a specified name.String[]
Returns the names of the contracts.getSoapService
(String serviceName) This method return the definition of a service for the specified name.String[]
This method returns the available soap service name.matchOperation
(IRestRequestMessage request, String serviceName, ICommunicationEngineHandler handler) This method matches the urn of a request to an operation of the service.void
parseRestRequest
(IRestRequestMessage request, InferenceContext target, String serviceName, String operationName, ICommunicationEngineHandler handler, IDebugger debugger) This method parses a rest request message.void
parseRestResponse
(IRestMessage response, InferenceContext target, String serviceName, String operationName, ICommunicationEngineHandler handler, IDebugger debugger) This method parses a rest response message.void
parseSoapRequest
(ISoapMessage message, InferenceContext target, String serviceName, String operationName, IDebugger debugger) This method parses a soap request message.void
parseSoapResponse
(ISoapMessage message, InferenceContext target, String serviceName, String operationName, IDebugger debugger) This method parses a soap response message.
-
Constructor Details
-
CommunicationEngine
public CommunicationEngine(ICommunicationEngineDS datasource, IMetaModel metamodel, IRuleEngine ruleEngine) Construct a communication engine with a datasource.- Parameters:
datasource
- The datasource to initialize the definitions, may not be null.metamodel
- The metamodel containing definitions that are used by the communication engine, may not be null.ruleEngine
- The rule engine containing definitions that are used by the communication engine, may not be null.- Throws:
InitializationException
- Is thrown when the communication could not be constructed.
-
-
Method Details
-
getRestServiceNames
Description copied from interface:ICommunicationEngine
This method returns the available rest service name.- Specified by:
getRestServiceNames
in interfaceICommunicationEngine
- Returns:
- The names of the rest services that are available, never null, but may be an empty array.
-
getRestService
Description copied from interface:ICommunicationEngine
This method returns the rest service.- Specified by:
getRestService
in interfaceICommunicationEngine
- Parameters:
serviceName
- The name of the service, may not be null.- Returns:
- The definition of the service.
-
getSoapServiceNames
Description copied from interface:ICommunicationEngine
This method returns the available soap service name.- Specified by:
getSoapServiceNames
in interfaceICommunicationEngine
- Returns:
- The names of the soap services that are available, never null, but may be an empty array.
-
getSoapService
Description copied from interface:ICommunicationEngine
This method return the definition of a service for the specified name.- Specified by:
getSoapService
in interfaceICommunicationEngine
- Parameters:
serviceName
- The name of the service that is requested (case insensitive)- Returns:
- The service definition, never null
-
getSchemaSetNames
Description copied from interface:ICommunicationEngine
This method returns the available schema set names.- Specified by:
getSchemaSetNames
in interfaceICommunicationEngine
- Returns:
- The names of the schema sets that are available, never null, but may be an empty array.
-
getSchemaSet
Description copied from interface:ICommunicationEngine
This method return the definition of a schema set for the specified name.- Specified by:
getSchemaSet
in interfaceICommunicationEngine
- Parameters:
name
- The name of the schema set that is requested (case insensitive)- Returns:
- The schema set definition, never null
-
addSoapService
-
addRestService
-
addSchemaSet
-
composeRestRequest
public IRestRequestMessage composeRestRequest(IProfile profile, String serviceName, String operationName, String mimeType, ICommunicationEngineHandler handler) Description copied from interface:ICommunicationEngine
This method composes the rest message.- Specified by:
composeRestRequest
in interfaceICommunicationEngine
- Parameters:
profile
- The used profile during the compose.serviceName
- The name of the rest service.operationName
- The name of the operation.mimeType
- the mime type of the requesthandler
- The handler for custom element composing.- Returns:
- The composed message.
-
composeRestRequest
public IRestRequestMessage composeRestRequest(IProfile profile, String serviceName, String operationName, String mimeType, ICommunicationEngineHandler handler, Map<String, List<String>> headers) Description copied from interface:ICommunicationEngine
This method composes the rest message.- Specified by:
composeRestRequest
in interfaceICommunicationEngine
- Parameters:
profile
- The used profile during the compose.serviceName
- The name of the rest service.operationName
- The name of the operation.mimeType
- the mime type of the requesthandler
- The handler for custom element composing.headers
- the http headers that will be put on the http request- Returns:
- The composed message.
-
matchOperation
public IRestOperationDefinition matchOperation(IRestRequestMessage request, String serviceName, ICommunicationEngineHandler handler) Description copied from interface:ICommunicationEngine
This method matches the urn of a request to an operation of the service.- Specified by:
matchOperation
in interfaceICommunicationEngine
- Parameters:
request
- The incoming rest request message.serviceName
- The name of the rest service, may not be null or empty.handler
- The handler for custom element composing.- Returns:
- The definition of the operation.
-
parseRestRequest
public void parseRestRequest(IRestRequestMessage request, InferenceContext target, String serviceName, String operationName, ICommunicationEngineHandler handler, IDebugger debugger) Description copied from interface:ICommunicationEngine
This method parses a rest request message.- Specified by:
parseRestRequest
in interfaceICommunicationEngine
- Parameters:
request
- The message to parse.target
- The target profile.serviceName
- The name of the rest service.operationName
- The name of the operation.handler
- The handler for custom element composing.debugger
- A debugger instance that is attached, may be null.
-
composeRestResponse
public IRestMessage composeRestResponse(IProfile profile, String serviceName, String operationName, String mimeType, ICommunicationEngineHandler handler) Description copied from interface:ICommunicationEngine
This method composes a rest response message.- Specified by:
composeRestResponse
in interfaceICommunicationEngine
- Parameters:
profile
- The profile used to compose values.serviceName
- The name of the rest service.operationName
- The name of the operation.mimeType
- the mime type of the request.handler
- The handler for custom element composing.- Returns:
- The composed response message.
-
parseRestResponse
public void parseRestResponse(IRestMessage response, InferenceContext target, String serviceName, String operationName, ICommunicationEngineHandler handler, IDebugger debugger) Description copied from interface:ICommunicationEngine
This method parses a rest response message.- Specified by:
parseRestResponse
in interfaceICommunicationEngine
- Parameters:
response
- The response message to parse.target
- The target profile.serviceName
- The name of the rest service.operationName
- The name of the operation.handler
- The handler for custom element composing.debugger
- A debugger instance that is attached, may be null.
-
composeSoapRequest
public ISoapMessage composeSoapRequest(IInternalPortalContext context, String serviceName, String operationName, ICommunicationEngineHandler handler) Description copied from interface:ICommunicationEngine
This methods composes a soap request message.- Specified by:
composeSoapRequest
in interfaceICommunicationEngine
- Parameters:
context
- The context used to compose values.serviceName
- The name of the soap service.operationName
- The name of the operation.handler
- The handler used for custom element composing.- Returns:
- The composed soap message.
-
composeSoapRequest
public ISoapMessage composeSoapRequest(IInternalPortalContext context, String serviceName, String operationName, ISoapMessageHandler[] handlers, ICommunicationEngineHandler handler) Description copied from interface:ICommunicationEngine
This methods composes a soap request message.- Specified by:
composeSoapRequest
in interfaceICommunicationEngine
- Parameters:
context
- The context used to compose values.serviceName
- The name of the soap service.operationName
- The name of the operation.handlers
- an array of soap message handlers, must not be null.handler
- The handler used for custom element composing.- Returns:
- The composed soap message.
-
parseSoapRequest
public void parseSoapRequest(ISoapMessage message, InferenceContext target, String serviceName, String operationName, IDebugger debugger) Description copied from interface:ICommunicationEngine
This method parses a soap request message.- Specified by:
parseSoapRequest
in interfaceICommunicationEngine
- Parameters:
message
- The source message.target
- The target profile.serviceName
- The name of the soap service.operationName
- the name of the operation being called.debugger
- A debugger instance that is attached, may be null.
-
composeSoapResponse
public ISoapMessage composeSoapResponse(IInternalPortalContext context, String serviceName, String operationName, ICommunicationEngineHandler handler) Description copied from interface:ICommunicationEngine
This method composes a soap response message.- Specified by:
composeSoapResponse
in interfaceICommunicationEngine
- Parameters:
context
- The context used to compose values.serviceName
- The name of the soap service.operationName
- The name of the operation.handler
- The handler used for custom element composing.- Returns:
- The composed response message.
-
parseSoapResponse
public void parseSoapResponse(ISoapMessage message, InferenceContext target, String serviceName, String operationName, IDebugger debugger) Description copied from interface:ICommunicationEngine
This method parses a soap response message.- Specified by:
parseSoapResponse
in interfaceICommunicationEngine
- Parameters:
message
- The source message.target
- The target profile.serviceName
- The name of the soap service.operationName
- The name of the operation.debugger
- A debugger instance that is attached, may be null.
-
getSchemaContractNames
Description copied from interface:ICommunicationEngine
Returns the names of the contracts.- Specified by:
getSchemaContractNames
in interfaceICommunicationEngine
- Returns:
- The contract names, not null.
-
getSoapContractNames
Description copied from interface:ICommunicationEngine
Returns the names of the contracts.- Specified by:
getSoapContractNames
in interfaceICommunicationEngine
- Returns:
- The contract names, not null.
-
getSchemaContract
Description copied from interface:ICommunicationEngine
Returns the schema contract of a specified name.- Specified by:
getSchemaContract
in interfaceICommunicationEngine
- Parameters:
name
- The name of the contract, not null.- Returns:
- The schema contract.
-
getDomainSchema
Description copied from interface:IDomainSchemaRegistry
This method returns the definition of a domain schema for the specified name.- Specified by:
getDomainSchema
in interfaceIDomainSchemaRegistry
- Parameters:
name
- The name of the domain schema requested (case insensitive), not null.- Returns:
- The Data contract definition, never null.
-
getSoapContract
Description copied from interface:ICommunicationEngine
Returns the soap contract of a specified name.- Specified by:
getSoapContract
in interfaceICommunicationEngine
- Parameters:
name
- The name of the contract, not null.- Returns:
- The soap contract.
-
addSchemaContract
-
addDataContract
-
addSoapContract
-