uCosminexus Service Platform, Reception and Adapter Definition Guide
This section describes the custom adapter development framework APIs provided by Service Platform.
The interfaces and exception classes defined in the custom adapter development framework are stored in the following location:
Service-Platform-installation-directory\CSC\lib\csc_adapter.jar
When compiling a General custom adapter, include this JAR file in the classpath.
public interface CSCMsgCustomProtocolConverter
{
public void start()
throws CSCMsgCustomAdapterException;
public void stop();
public void setCustomAdapterContext(CSCMsgCustomAdapterContext adapterContext);
public void invoke(CSCMsgRequestMessage requestMessage,
CSCMsgResponseMessage responseMessage)
throws CSCMsgCustomAdapterException;
}
| Method name | Description |
|---|---|
| start method | This method is invoked when the General custom adapter is started. This method implements start processing for the protocol converter. This method is invoked only once. |
| stop method | This method is invoked when the General custom adapter ends. This method implements end processing for the protocol converter. This method is invoked only once. |
| setCustomAdapterContext method | This method is invoked when the adapter context is set. This method describes the processing for storing the allocated adapter context in an instance field of the protocol converter. This method is invoked only once. |
| invoke method | This method is invoked when invoking a service component via the General custom adapter. This method describes the processing for invoking a service component. This method is invoked each time there is a request to invoke the service adapter. |
Figure B-1 Order of method invocation from the custom adapter development framework
public void start() throws CSCMsgCustomAdapterException;
public void stop();
public void setCustomAdapterContext(CSCMsgCustomAdapterContext adapterContext);
public void invoke (CSCMsgRequestMessage requestMessage,
CSCMsgResponseMessage responseMessage)
throws CSCMsgCustomAdapterException;
public interface CSCMsgCustomAdapterContext
{
public String getAdapterName();
public Properties getProperties();
public byte[] getResourceAsBytes(String fileName)
throws CSCMsgResourceAccessException;
public java.io.InputStream getResourceAsStream(String fileName)
throws CSCMsgResourceAccessException;
}
| Method name | Description |
|---|---|
| getAdapterName method | Acquires the name of the General custom adapter. |
| getProperties method | Acquires the contents of the custom adapter property file as Properties. |
| getResourceAsBytes method | Acquires the contents of the resource file in binary format. |
| getResourceAsStream method | Acquires the stream for accessing the resource file. |
public String getAdapterName();
public Properties getProperties();
public byte[] getResourceAsBytes(String fileName) throws CSCMsgResourceAccessException;
public java.io.InputStream getResourceAsStream(String fileName) throws CSCMsgResourceAccessException;
The following table lists the interfaces used to exchange messages between the HCSC server and protocol converter:
Table B-1 List of APIs used to work with messages
| Interface name | Description |
|---|---|
| CSCMsgMessageConstant interface | Defines the constants required to work with messages. |
| CSCMsgRequestMessage interface | Provides the methods that acquire the information (such as operation names and messages) required to invoke service components. |
| CSCMsgResponseMessage interface | Provides the methods that store the results of service component invocation (messages or fault information). |
public interface CSCMsgMessageConstant
{
public static final int MESSAGE_TYPE_NONE;
public static final int MESSAGE_TYPE_XML;
public static final int MESSAGE_TYPE_BINARY;
public static final int MESSAGE_TYPE_ANY;
}
public interface CSCMsgRequestMessage
{
public byte[] getBytes()
throws CSCMsgIllegalMessageTypeException,
CSCMsgInvalidMessageException;
public Map getMessageContext();
public int getMessageType();
public String getOperationName();
public org.w3c.dom.Document getXMLDocument()
throws CSCMsgIllegalMessageTypeException,
CSCMsgInvalidMessageException;
public byte[] getXMLBytes()
throws CSCMsgIllegalMessageTypeException,
CSCMsgInvalidMessageException;
}
| Method name | Description |
|---|---|
| getBytes method | Acquires messages in binary format. |
| getMessageContext method | When a General custom adapter is invoked via a business process, this method returns information related to the business process. |
| getMessageType method | Acquires the type of message stored as the request message. |
| getOperationName method | Acquires the name of the operation invoked when invoking the service component. |
| getXMLDocument method | Acquires messages in XML format. |
| getXMLBytes method | Acquires XML messages as a byte array. |
public byte[] getBytes()
throws CSCMsgIllegalMessageTypeException,
CSCMsgInvalidMessageException;
Table B-2 Information acquired by getMessageContext method
| Information type | Map contents | Description | ||
|---|---|---|---|---|
| Element | Value | |||
| Element name | Element type | Value type | ||
| Business process name | CSCMsgCustomAdapterConstant.ContextType.BP_DEFINITION_NAME | enum | java.lang.String | The name of the business process from which the General custom adapter is invoked#1 |
| Business process version | CSCMsgCustomAdapterConstant.ContextType.BP_VERSION | enum | java.lang.String | The version of the business process from which the General custom adapter is invoked#1 |
| Invoke service activity name | CSCMsgCustomAdapterConstant.ContextType.BP_INVOKEACTIVITY_NAME | enum | java.lang.String | The name of the invoke service activity of the business process from which the General custom adapter is invoked#1 |
| Service name of General custom adapter | CSCMsgCustomAdapterConstant.ContextType.BP_INVOKEACTIVITY_CUSTOMADAPTERNAME | enum | java.lang.String | The service name of the General custom adapter invoked from the invoke service activity#1 |
| Operation name | CSCMsgCustomAdapterConstant.ContextType.BP_INVOKEACTIVITY_OPERATIONNAME | enum | java.lang.String | Operation name of invoke service activity#1, #2 |
| Process instance ID | CSCMsgCustomAdapterConstant.ContextType.BP_PROCESSINSTANCEID | enum | java.lang.String | Process instance ID#1 |
| HCSC server name | CSCMsgCustomAdapterConstant.ContextType.SERVERNAME_HCSC | enum | java.lang.String | HCSC server name |
| Cluster name | CSCMsgCustomAdapterConstant.ContextType.SERVERNAME_CLUSTER | enum | java.lang.String | Cluster name |
| J2EE server name | CSCMsgCustomAdapterConstant.ContextType.SERVERNAME_J2EE | enum | java.lang.String | J2EE server name |
public Map getMessageContext();
public int getMessageType();
public String getOperationName();
public org.w3c.dom.Document getXMLDocument()
throws CSCMsgIllegalMessageTypeException,
CSCMsgInvalidMessageException;
public byte[] getXMLBytes()
throws CSCMsgIllegalMessageTypeException,
CSCMsgInvalidMessageException;
public interface CSCMsgResponseMessage
{
public int getMessageType();
public void setBytes(byte[] message)
throws CSCMsgIllegalMessageTypeException,
CSCMsgMultipleMessageInsertionException,
CSCMsgInvalidMessageException;
public void setFault(String faultCode,
String faultString,
String faultActor,
byte[] faultDetail)
throws CSCMsgMultipleMessageInsertionException;
public void setFault(String faultCode,
String faultString,
String faultActor,
org.w3c.dom.Document faultDetail)
throws CSCMsgMultipleMessageInsertionException,
CSCMsgInvalidMessageException;
public void setXMLDocument(org.w3c.dom.Document dom)
throws CSCMsgIllegalMessageTypeException,
CSCMsgMultipleMessageInsertionException,
CSCMsgInvalidMessageException;
public void setXMLBytes(byte[] byte)
throws CSCMsgIllegalMessageTypeException,
CSCMsgMultipleMessageInsertionException,
CSCMsgInvalidMessageException;
}
| Method name | Description |
|---|---|
| getMessageType method | Acquires the type of message to be stored in the response message. |
| setBytes method | Stores binary format messages in response messages. |
| setFault method (format 1) | Stores fault information generated at service component invocation in response messages. |
| setFault method (format 2) | Stores fault information generated at service component invocation in response messages. |
| setXMLDocument method | Stores XML format messages in response messages. |
| setXMLBytes method | Stores XML messages in response messages in binary array format. |
public int getMessageType();
public void setBytes(byte[] message)
throws CSCMsgIllegalMessageTypeException,
CSCMsgMultipleMessageInsertionException,
CSCMsgInvalidMessageException;
public void setFault(String faultCode,
String faultString,
String faultActor,
byte[] faultDetail)
throws CSCMsgMultipleMessageInsertionException;
public void setFault(String faultCode,
String faultString,
String faultActor,
org.w3c.dom.Document faultDetail)
throws CSCMsgMultipleMessageInsertionException,
CSCMsgInvalidMessageException;
public void setXMLDocument(org.w3c.dom.Document dom)
throws CSCMsgIllegalMessageTypeException,
CSCMsgMultipleMessageInsertionException,
CSCMsgInvalidMessageException;
public void setXMLBytes(byte[] byte)
throws CSCMsgIllegalMessageTypeException,
CSCMsgMultipleMessageInsertionException,
CSCMsgInvalidMessageException;
public interface CSCMsgCustomAdapterConstant {
public enum ContextType {
BP_DEFINITION_NAME,
BP_VERSION,
BP_INVOKEACTIVITY_NAME,
BP_INVOKEACTIVITY_CUSTOMADAPTERNAME,
BP_INVOKEACTIVITY_OPERATIONNAME,
BP_PROCESSINSTANCEID,
SERVERNAME_HCSC,
SERVERNAME_CLUSTER,
SERVERNAME_J2EE;
}
}
The following table lists the exception classes generated during protocol converter development:
Table B-3 List of protocol converter exception classes
| Class name | Description |
|---|---|
| CSCMsgCustomAdapterException class | The exception thrown when an exception occurs during processing to initialize the General custom adapter or invoke the service component |
| CSCMsgIllegalMessageTypeException class | The exception thrown when a method is invoked whose message format differs from the message type being acquired or stored |
| CSCMsgMultipleMessageInsertionException class | The exception thrown when a message or fault information is already stored. You cannot set a message or fault information if this information has already been stored. |
| CSCMsgInvalidMessageException class | The exception thrown when the type (format) of a stored request message is invalid. It is also thrown when an invalid message type is specified for the response message. |
| CSCMsgResourceAccessException class | The exception thrown when an error occurs during resource access. This exception occurs in the following situations:
|
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.