Skip to Content
Author's profile photo Eng Swee Yeoh

Demystifying Custom Adapter Development: Part 1b – Cloning the Sample JCA Adapter

The following steps are continued from Demystifying Custom Adapter Development: Part 1a – Cloning the Sample JCA Adapter.

Step 4 – Creating the Adapter Metadata in ESR

Next we will import the Adapter Metadata into the ESR.

i) Update JNDIName in the metadata file

SampleRA.xml is the Adapter Metadata file which was extracted from the XIAF SCA file (in Step 1 – ii).

Update the JNDIName value following the name of the Java Project (in Step 2 – i).

/wp-content/uploads/2016/05/adapter_metadata_946611.png

ii) Create Adapter Metadata object in ESR

Create a new namespace in ESR and then create a new Adapter Metadata object. The combination of adapter name and namespace must match exactly the values used in Step 3 – ii above.

/wp-content/uploads/2016/05/metadata_946612.png

Upon creation of the object, it will provide a default metadata. Overwrite this metadata by importing the modified SampleRA.xml above.

/wp-content/uploads/2016/05/import_946739.png

Activate the new metadata object.

/wp-content/uploads/2016/05/metadata2_946740.png

Step 5 – Building and Deploying the Adapter

We are now ready to build and deploy the adapter!

i) Export JAR file for Java project

Firstly, we export the JAR file of the Java project. The destination of the export will be the connectorModule folder of the RAR project.

/wp-content/uploads/2016/05/export_jar1_946741.png

Once the export is completed, refresh the RAR project and verify that the JAR file is in the connectorModule folder.

/wp-content/uploads/2016/05/export_jar2_1_946742.png

ii) Export RAR file for RAR project

Right click on the RAR project and export it as a RAR file.

/wp-content/uploads/2016/05/exp_rar1_946743.png

The destination will be the root folder of the RAR project itself.

/wp-content/uploads/2016/05/exp_rar2_2_946744.png

Once the export is completed, refresh the RAR project and verify that the RAR file is available.

/wp-content/uploads/2016/05/export_rar1_946745.png

iii) Deploy the RAR file to the SAP AS Java server

Prior to deployment, make sure that the AS Java server is configured under Windows > Preferences > SAP As Java.

Switch to the Deployment perspective. Click Import and select the RAR file from the workspace.

/wp-content/uploads/2016/05/dep_import2_946746.png

/wp-content/uploads/2016/05/import_rar2_946747.png

Click Start to begin deployment of the RAR file.

/wp-content/uploads/2016/05/start_deploy2_946748.png

Upon completion, the following pop up dialog will display the result of the successful deployment.

/wp-content/uploads/2016/05/succ_deploy_946749.png

iv) Verify deployment was successful

We can verify that the deployment was really successful with the following tools.

Go to NWA > Troubleshooting > Logs and Traces > Log Viewer. Check that the following errors are generated – they are just sample messages and can be ignored.

/wp-content/uploads/2016/05/log_viewer_946750.png

Go to NWA > Configuration > Infrastructure > Application Modules. Enter the filters for Type and Application to verify that the resource adapter is available.

/wp-content/uploads/2016/05/apps_946751.png

Go to NWA > Troubleshooting > Java > JNDI Browser. Navigate to the deployedAdapters folder and verify that the JNDI object name is correctly registered. The JNDI name specified in the Adapter Metadata must match this value.

/wp-content/uploads/2016/05/jndi_browser_946752.png

Go to NWA > Operations > System > Start & Stop. Select Java Applications tab and filter by the adapter name. Check that the application status is started.

/wp-content/uploads/2016/05/started_946753.png

Step 6 – Using the Adapter in a Communication Channel

After successful deployment, we can create communication channels using this new adapter.

Select the Adapter from the list of adapter and populate all the mandatory fields.

/wp-content/uploads/2016/05/channel_946754.png

Activate the channel and check that it’s successful in the Communication Channel Monitor.

Ta-daaaa!

/wp-content/uploads/2016/05/monitor_946755.png

This channel can then be used in an integration scenario as per normal configuration. However, usage of this channel which is based on the sample adapter’s behavior will not be covered here.

Conclusion

As shown above, with clear and concise steps, we are able to setup the projects in NWDS correctly to build and deploy a clone copy of the sample JCA adapter. Communication channels can then be created to use this adapter in integration scenarios. The sample JCA adapter provides some simple logic to connect to the file system of the PI system.

This clone adapter forms the basis for the subsequent posts in this series. We will look at the different aspects of the development, and aim to change the logic and behavior of the adapter according for an example requirement.

In the next post we will be examining the source codes of the custom adapter, looking at some of the key classes and methods in order to understand the behavior of the adapter. Watch this space!

Other Parts of this Series

Demystifying Custom Adapter Development: Part 1a – Cloning the Sample JCA Adapter

Demystifying Custom Adapter Development: Part 2 – Examining the Adapter’s Key Classes and Methods

Demystifying Custom Adapter Development: Part 3 – Examining the Deployment and Metadata Files

Demystifying Custom Adapter Development: Part 4 – Modifying the Adapter’s Functionality

Demystifying Custom Adapter Development: Part 5 – Creating an HTTP Poller with OAuth 2.0 authentication

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Aditya Adepu
      Aditya Adepu

      Hello Eng,

      I followed the blog with the required steps. But due to some system settings, I need to deploy from command line on the server. So I copy the rar onto server and run the deploy command. I face following issue :

      ERRORS:
      * Connector Class Existence: managedconnectionfactory-class "com.sap.xpi.tcpip.adapter.ra.SPIManagedConnectionFactory" cannot be loaded. Check loader references., file: com.sap.xpi.tcpip.adapter.rar#META-INF/ra.xml, severity: error]
      Hint: 1) The given archive file is not a valid Java EE or SAP specific application.]

      com.sap.xpi.tcpip.adapter.ra is my modified package name.

      So seeing this I thought I will export  as SAPRAR, but that does not export with required jars or the manifest files. Any suggestions.

       

      Author's profile photo Eng Swee Yeoh
      Eng Swee Yeoh
      Blog Post Author

      It is hard to pinpoint the root cause of the error as Adapter development is a very complex process, and I can't tell what steps you have done or not. I would suggest as a start, to follow exactly the steps and names listed in this blog series. Once you are able to get such a sample adapter built and deployed correctly, then you can venture on to refactoring it to your specific needs.

      Author's profile photo Alexander Apel
      Alexander Apel

      Hi Eng,

       

      after Deploying my adapter i get the following message in communiction channel

      “Non-Administered”

      Any suggestions whats wronge?

       

      regards, Alex