After creating an interface and testing it, create a Java™ component to set the values
for the properties element.
Before you begin
Ensure that you have created an interface that has multiple
input properties to pass the connection properties.
About this task
You must create a Java component
and set the connection-related properties to pass it as input to the
interface on the business graph object. To create a Java component, use the following procedure.
Procedure
- Create a Java component
in the assembly diagram.
- Wire the Java component
to the FTPOutboundInterface import. The Java component
interface, that is, FTPDynamicConnectionInterface is created. To create
the Java component, click the Java
component. Click the 'add an interface' icon
and select the interface, FTPDynamicConnectionInterface.
- Set the connection-related properties, which are sent
as input to the interface on the BusinessGraph object, for the implementation
of the Java component.
The
following sample code is the Java EE component implementation that
sets the connection parameters on the properties business object of
the BusinessGraph:
public DataObject createFTPFile(DataObject createFTPFileWrapperBG,String userName,
String password, String privateKeyFilePath,
String passphrase) {
DataObject prop = createFTPFileWrapperBG.getDataObject("properties");
// check if they already created this child object or not
if(prop == null) {
// Create the "properties" business object
prop = createFTPFileWrapperBG.createDataObject("properties");
}
// Setting the property 'userName' to connectionSpec
// Note that the username property is prefixed by CS
prop.setString("CSuserName", userName);
// Setting the property 'password' to connectionSpec
// Note that the password property is prefixed by CS
prop.setString("CSpassword", password);
//Setting the property ‘privateKeyFilePath' which is used for SFTP protocol to connection spec
prop.setString("CSprivateKeyFilePath", privateKeyFilePath);
//Setting the property ‘passphrase' which is used for SFTP protocol to connection spec
prop.setString("CSpassphrase", passphrase);
// invoke the Adapter
Service serv= locateService_SFTPImportPartner();
Object boReturn= serv.invoke(
"create",
createFTPFileWrapperBG);
// return the result BO that we got back from the FTP Adapter
return ((DataObject)boReturn).get(0);
}
During run time, the connection properties
values are set on the input parameters of the Java component. This in turn is set on the dataobject 'properties'
of the BusinessGraph by the above displayed code. The EIS binding
then passes the connection properties to the adapter which is set
on the dataobject 'properties' by populating it in the ConnectionSpec
bean. The adapter uses the ConnectionSpec properties to get a connection
to the EIS.
For more information about EIS binding, see http://publib.boulder.ibm.com/infocenter/dmndhelp/v7r0mx/index.jsp?topic=/com.ibm.websphere.wesb.doc/doc/cadm_dynamicheader.html. For information about how to configure dynamic
authentication, see http://www.ibm.com/developerworks/websphere/library/techarticles/0608_martinez/0608_martinez.html.
Results
A Java component is
created.
What to do next
Deploy the application onto the
IBM® Business Process Manager and
send an outbound request, which includes the connection parameters
using the
IBM Integration Designer test
client. As a result, the adapter uses these connection parameters
from the request to create the connection. Any value specified in
the Managed Connection Factory properties is ignored by the adapter.