Skip Navigation Links | |
Exit Print View | |
Oracle Java CAPS Adapter for Batch Tutorial Java CAPS Documentation |
Oracle Java CAPS Adapter for Batch Tutorial
Importing Non-JBI Based Sample Projects
To Import a Non-JBI Based Sample Project
About the Oracle Java CAPS Business Process Manager Sample Project
Considerations for BPM Projects
Creating the bpBatch_Inbound_LocalFileIn_FTPOut Project
Creating the bpBatch_Inbound_LocalFileIn_FTPOut Business Process
To Create the Business Process
Adding Business Rules to the Design Elements
To Generate the Connectivity Map
Configuring the Adapters' Properties
To Configure the BatchInbound Adapter Properties
To Configure the BatchLocalFile Adapter Properties
Configuring the BatchFTP Adapter Properties
Creating the Deployment Profile
To Create the Deployment Profile
Building and Deploying the Project
prjBatch_Inbound_FTPIn_LocalFileOut
Considerations for JCD Projects
The Adapter for Batch JCD Sample Projects
The prjBatch_Inbound_FTPIn_LocalFileOut Sample Project
Creating the Java Collaboration Definitions
Creating the jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration
To Create the jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration
Using the Java Collaboration Editor
To Create the jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration Business Rules
To Generate the Connectivity Map
Configuring the Adapters Properties
To Configure the BatchInbound Adapter Properties
Configuring the BatchFTP Adapter Properties
Building and Deploying the Project
The prjBatch_Streaming Sample Project
Creating a Java Collaboration Definition
To Create the jcdBatch_Streaming Collaboration
Using the Java Collaboration Editor
To Create the jcdBatch_Streaming Collaboration Business Rules
To Generate the Connectivity Map
Configuring the Adapter Properties
To Configure the BatchInbound Adapter Properties
Configuring the BatchFTP Adapter Properties
Configuring the File Adapter Properties
Building and Deploying the Project
The prjBatch_Record Sample Project
Creating a Java Collaboration Definition
To Create the jcdBatch_Record Collaboration
Using the Java Collaboration Editor
To Create the jcdBatch_Record Collaboration Business Rules
To Generate the Connectivity Map
Configuring the Adapter Properties
To Configure File Adapter Connectivity Map Properties
To Modify the File Adapter Environment properties
To Configure the BatchRecord Adapter Properties
To Modify the BatchRecordParse Adapter Connectivity Map properties
To Modify the BatchRecord Adapter Environment properties
To Create the Deployment Profile
Building and Deploying the Project
The prjBatch_Secure Project Components
The prjBatch_Secure Project Collaboration Definitions
To Create the jcdBatchFTPOverSSL Java Collaboration
To Create the jcdBatchSCP Java Collaboration
To Create the jcdBatchSFTP Java Collaboration
jcdBatchFTPOverSSL Business Rules
jcdBatchFTPOverSSL Java Source File
Completing the prjBatch_Secure Project
Configuring the Adapter Properties
To Configure the File Adapter Connectivity Map properties
To Modify the File Adapter Environment properties
To Modify the Batch/FTP Adapter Connectivity Map Properties
To Modify the BatchFTPoverSSL Adapter Environment Properties
To Create the Sample Directories
To Create the Deployment Profile
This topic provides an overview of the prjBatch_Secure Project, and describes how to run the imported sample.
The prjBatch_Secure Project contains three scenarios that employ three Batch OTDS to enable SSL or SSH secure file transfers.
TheprjBatch_Secure Project uses four External Applications, seven component Adapters, and three Java Collaborations.
The Adapter for Batch performs the following functions
The inbound File Adapters, FileIn_BatchFTPOverSSL, FileIn_BatchSFTP, and FileIn_BatchSCP, act as triggers for the Project. The File Adapters poll an external directory for a specific input file. When the input file is present, the File Adapter triggers the Collaboration.
BatchFTPOverSSL is used by the Collaboration to:
get files from a remote directory and publish them to a local directory
get files from a local directory and publish them to the remote directory
download files from the remote directory to a local directory
upload files from a local directory to a remote directory
create and list remote directories
delete remote directories and list the results
These functions can be seen in the jcdBatchFTPOverSSL Java Collaboration Definition.
BatchSFTP is used by the Collaboration to:
get files from a remote directory and publish them to a local directory
create a new remote directory
change directories to the new directory and publish a file to that directory
rename the published file
delete an unwanted file from the remote directory
These functions can be seen in the jcdBatchSFTP Java Collaboration Definition.
BatchSCP is used by the Collaboration to:
recursively get a file from the remote directory and publish the file to a local directory
recursively put a file from the local directory to a remote directory
These functions can be seen in the jcdBatchSCP Java Collaboration Definition.
The prjBatch_Secure Project includes three Java Collaborations, one for each of the three scenarios provided in the cmBatch_Secure Connectivity Map. The jcdBatchFTPOverSSL, jcdBatchSCP, and jcdBatchSFTP Java Collaboration Definitions are each created using the Collaboration Definition Wizard (Java).
The Java Collaboration Definition Wizard appears.
The Name field now displays receive.
The jcdBatchFTPOverSSL OTD is added to the Selected OTDs field.
The FileClient OTD is added to the Selected OTDs field.
The Java Collaboration Editor opens to the new Collaboration in the right pane of the NetBeans IDE.
The Java Collaboration Business Rules for the Project are separated into three Java Collaborations as seen from the Java Collaboration Editor: jcdBatchFTPOverSSL, jcdBatchSCP, and jcdBatchSFTP. The following images display the business rules for each of the Java Collaboration Definitions along with the Java source code.
package prBatch_Secure; public class jcdBatchFTPOverSSL { public com.stc.codegen.logger.Logger logger; public com.stc.codegen.alerter.Alerter alerter; public com.stc.codegen.util.CollaborationContext collabContext; public com.stc.codegen.util.TypeConverter typeConverter; public void receive( com.stc.connector.appconn.file.FileTextMessage input, com.stc.connector.batchadapter.appconn.ftps.FTPOverSSL BatchFTPOverSSL_1,com.stc.connector.appconn.file.FileApplication FileClient_1 ) throws Throwable { // get and put BatchFTPOverSSL_1.getConfiguration().setLocalFile( "FTPOverSSL_from_remote.txt" ); BatchFTPOverSSL_1.getClient().get(); BatchFTPOverSSL_1.getConfiguration().setRemoteFile( "FTPOverSSL_to_remote.txt" ); BatchFTPOverSSL_1.getClient().put(); // download and upload BatchFTPOverSSL_1.getConfiguration().setLocalDirectory( "c:/BatchSecurity/FTPOverSSL" ); BatchFTPOverSSL_1.getConfiguration().setLocalFile( "FTPOverSSL_from_remote.txt" ); BatchFTPOverSSL_1.getClient().download(); BatchFTPOverSSL_1.getConfiguration().setRemoteDirectory( "BatchSecurity/FTPOverSSL" ); BatchFTPOverSSL_1.getConfiguration().setRemoteFile( "FTPOverSSL_to_remote.txt" ); BatchFTPOverSSL_1.getClient().upload(); // Create and list directories String entryInfo; int entryCnt; for (int i = 1; i < 6; i++) { BatchFTPOverSSL_1.getClient().mkdir( "mydir_" + i ); } BatchFTPOverSSL_1.getClient().listDirLong(); entryCnt = BatchFTPOverSSL_1.getClient().getEntryCount(); entryInfo = "Directory Listing:\n"; for (int i = 0; i < entryCnt; i++) { entryInfo = "[" + BatchFTPOverSSL_1.getClient().getEntry( i ).getDirectory() + "]" + "[" + BatchFTPOverSSL_1.getClient().getEntry( i ).getFile() + "]" + "[" + BatchFTPOverSSL_1.getClient().getEntry( i ). getFileSize() + "]" + "[" + BatchFTPOverSSL_1.getClient().getEntry( i ).isDir() + "]" + "\n"; } FileClient_1.setText( entryInfo ); FileClient_1.write(); // Delete and list directories for (int i = 1; i < 5; i++) { BatchFTPOverSSL_1.getClient().deleteDir( "mydir_" + i ); } BatchFTPOverSSL_1.getClient().listDir(); entryCnt = BatchFTPOverSSL_1.getClient().getEntryCount(); entryInfo = "Directory Listing:\n"; for (int i = 0; i < entryCnt; i++) { entryInfo = "[" + BatchFTPOverSSL_1.getClient().getEntry( i ).getDirectory() + "]" + "\n"; } FileClient_1.setText( entryInfo ); FileClient_1.write(); } }
package prBatch_Secure; public class jcdBatchSCP { public com.stc.codegen.logger.Logger logger; public com.stc.codegen.alerter.Alerter alerter; public com.stc.codegen.util.CollaborationContext collabContext; public com.stc.codegen.util.TypeConverter typeConverter; public void receive( com.stc.connector.appconn.file.FileTextMessage input, com.stc.connector.batchadapter.appconn.scp.SCP BatchSCP_1 ) throws Throwable { // recursive get and put BatchSCP_1.getConfiguration().setLocalDirectory( "C:/BatchSecurity/SCP" ); BatchSCP_1.getConfiguration().setLocalFile( "recursive" ); BatchSCP_1.getClient().getRecursive(); BatchSCP_1.getConfiguration().setRemoteDirectory( "BatchSecurity/SCP" ); BatchSCP_1.getConfiguration().setRemoteFile( "recursive" ); BatchSCP_1.getClient().putRecursive(); } }
package prBatch_Secure; public class jcdBatchSFTP { public com.stc.codegen.logger.Logger logger; public com.stc.codegen.alerter.Alerter alerter; public com.stc.codegen.util.CollaborationContext collabContext; public com.stc.codegen.util.TypeConverter typeConverter; public void receive( com.stc.connector.appconn.file.FileTextMessage input, com.stc.connector.batchadapter.appconn.sftp.SFTP BatchSFTP_1 ) throws Throwable { // get, make directory, change directory, put, rename, delete BatchSFTP_1.getConfiguration().setLocalDirectory( "C:/BatchSecurity/SFTP" ); BatchSFTP_1.getConfiguration().setLocalFile( "SFTP_from_remote.txt" ); BatchSFTP_1.getClient().get(); BatchSFTP_1.getClient().mkdir( "BatchSecurity/new_SFTP" ); BatchSFTP_1.getClient().cd( "BatchSecurity/new_SFTP" ); BatchSFTP_1.getConfiguration().setRemoteDirectory( "" ); BatchSFTP_1.getConfiguration().setRemoteFile( "SFTP_to_remote.txt" ); BatchSFTP_1.getClient().put(); BatchSFTP_1.getClient().rename( "BatchSecurity/new_SFTP/SFTP_to_remote.txt", "BatchSecurity/new_SFTP/renamed_SFTP_to_remote.txt" ); BatchSFTP_1.getClient().delete( "BatchSecurity/useless_SFTP.txt" ); } }
Import the prjBatch_Secure Project described in To Import a Non-JBI Based Sample Project. After the sample Project has been imported and appears in your Project tree, create the Project’s Environment.
Environments include the External Systems, Logical Hosts, Application Servers and Message Servers used by a Project and contain the configuration information for these components.
A new Environment is added to the Services tree.
The esBatchFTPOverSSL window is added to the Environment Editor.
The esBatchSCP window is added to the Environment Editor.
The esBatchSFTP window is added to the Environment Editor.
The esFile window is added to the Environment Editor.
The LogicalHost1 box is added to the Environment and LogicalHost1 is added to the Environment Editor tree.
A new Application Server is added to the Services tree under Localhost1.
The prjBatch_Secure Project uses seven component Adapters, each represented in the Connectivity Map as a node between an External Application and the Service.
The Properties Editor opens to the inbound File Adapter properties.
|
See the following table.
|
See the following table.
|
See the following table.
|
The Properties Editor opens to the File Adapter Environment properties.
|
The Adapter Properties Editor appears.
|
The Properties Editor opens to the BatchFTPoverSSL Adapter Environment properties.
|
Configure the Adapter properties for your system.
The prjBatch_Secure sample Project uses a number of directories.
Target Directory (Inbound File Adapter Environment Properties):
Select a name for your target directory.
Output Directory (Outbound File Adapter Environment Properties):
Select a name for your output directory.
Create these directories on your system, or change the properties to reference your existing directories.
A Deployment Profile is used to assign Collaborations and message destinations to the Application Server and message server. Deployment profiles are created using the Deployment Editor.
The Project’s components are automatically mapped to their respective system windows.
Note - If any of your Project components did not successfully map to an external system, open each of your Adapter’s configuration properties (Connectivity Map and Environment) and click OK to close and save the current configuration, then click Automap again.
The Build process compiles and validates the Project’s Java files and creates the Project EAR file.
If there are any validation errors, a Validation Errors pane will appear at the bottom of the Deployment Editor and displays information regarding the errors.
Before You Begin
Make sure the GlassFish server is started.
The Deploy prompt appears.
A message appears when the project is successfully deployed.
To run your deployed sample Project do the following