The following sections describe development and deployment for user-created receivers and handlers.
The receiver and receiver handler development API relies on classes and interfaces from two packages:
These packages are part of the bcgsdk.jar file, which is found among the installable WebSphere Partner Gateway files in the following directories:
In all deployed instances, the bcgsdk.jar file is installed in the application server classpath.
For development, the bcgsdk.jar file must be included in the build path of the project that contains the user exit classes, that is, in the classpath.
All user-created code needs to be made available to the run-time environment. Package and deploy user-created code in one of the following ways for use during runtime:
Adding the JAR or class files to the run-time environment makes them available only if the transport or handler is configured to be used by the run-time library. Receiver transports and handlers are configured for use like the other product-provided transports and handlers. In order to configure them you must first make them known to the Community Console. You do this by importing their definitions into the Community Console by means of an XML descriptor file.
To import a Receiver transport, click Hub Admin > Hub Configuration > Targets > Manage Transport Types.
To import a Receiver transport handler, click Hub Admin > Hub Configuration > Handlers > Target > Import. One of the descriptors is the Handler Type. Only defined Handler Types are allowed and are based on the transport target configuration points. For user-defined transports, the transport descriptor file must be imported first in order to provide the handler type.
The receiver transport descriptor file uses the bcgtarget.xsd schema. Following is a brief outline for each of the elements in the descriptor file based on the following example:
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2004 IBM Corp. - All Rights Reserved.--> <!-- IBM makes no representations or warranties about the suitability of --> <!-- this program, either express or implied, including but not limited to --> <!-- the implied warranties of merchantability, fitness for a particular --> <!-- purpose, or non-infringement. --> <tns:TargetDefinition xmlns:tns="http://www.ibm.com/websphere/bcg/2004/v0.1/import/external" xmlns:tns2="http://www.ibm.com/websphere/bcg/2004/v0.1/import/external/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/websphere/bcg/2004/v0.1/import/external bcgtarget.xsd http://www.ibm.com/websphere/bcg/2004/v0.1/import/external/types bcgimport.xsd"> <tns:TargetClassName>com.mycompany.MyHTTPTransport</tns:TargetClassName> <tns:Description>My company HTTP Transport</tns:Description> <tns:TransportTypeName>MYHTTP</tns:TransportTypeName><tns:TransportAttributes> <tns2:ComponentAttribute> <tns2:AttributeName>URI</tns2:AttributeName> <tns2:AttributeDefaultValue>localhost</tns2:AttributeDefaultValue> </tns2:ComponentAttribute> <tns2:ComponentAttribute> <tns2:AttributeName>Timeout</tns2:AttributeName> </tns2:ComponentAttribute> </tns:TransportAttributes> <tns:TargetConfigurationPoints> <tns:Preprocess>RECEIVER.PREPROCESS.MYHTTP</tns:Preprocess> <tns:SyncCheck>RECEIVER.SYNCCHECK.MYHTTP</tns:SyncCheck> </tns:TargetConfigurationPoints> </tns:TargetDefinition>
A description of the XML elements follows:
Any handlers defined for this receiver transport must match one of these TargetConfigurationPoints values.
The receiver transport handler descriptor file uses the bcghandler.xsd schema. Following is a brief outline for each of the elements in the descriptor file based on the following example:
<?xml version="1.0" encoding="UTF-8"?> <tns:HandlerDefinition xmlns:tns="http://www.ibm.com/websphere/bcg/2004/v0.1/import/external" xmlns:tns2="http://www.ibm.com/websphere/bcg/2004/v0.1/import/external/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/websphere/bcg/2004/v0.1/import/external bcghandler.xsd http://www.ibm.com/websphere/bcg/2004/v0.1/import/external/types bcgimport.xsd "> <tns:HandlerClassName>com.mycompany.RecvHandler</tns:HandlerClassName> <tns:Description>My companies handler for my business protocol and multiple transports.</tns:Description> <tns:HandlerTypes> <tns:HandlerTypeValue>RECEIVER.PREPROCESS.MYHTTP</tns:HandlerTypeValue> <tns:HandlerTypeValue>RECEIVER.PREPROCESS.JMS</tns:HandlerTypeValue> </tns:HandlerTypes> <tns:HandlerAttributes> <tns2:ComponentAttribute> <tns2:AttributeName>Attribute 1</tns2:AttributeName> </tns2:ComponentAttribute> <tns2:ComponentAttribute> <tns2:AttributeName>Attribute 2</tns2:AttributeName> <tns2:AttributeDefaultValue>Attribute2DefaultValue</tns2:AttributeDefaultValue> </tns2:ComponentAttribute> </tns:HandlerAttributes> </tns:HandlerDefinition>
A description of the XML elements follows:
Every target configuration has the following two reserved attribute names: