Skip to Content

How to develop a JAVA Based adapter in PI

Step1: *Modifying the Java and Metadata Files*:

 

Change the file contents of all the files in sample_ra.jar,the sample_ra adapter’s java programs will be given a different adapter name and type, Package name, JNDI name, trace and log file locations, and the metadata describing the configuration parameters. So we will have to change them to our own package/path names.

 

            1.1   Change package name from com.sap.aii.af.sample.adapter.ra to com.test. JMSMQMD.adapter.ra.

            1.2   Change package path for log and trace file locations from com/sap/aii/af/sample/adapter/ra                                             to com/test/zip/adapter/ra.

            1.3   Change adapter guid from http://sap.com/xi/XI/sample/JCA to http://sap.com/xi/XI/zip/JCA .

            1.4   Change adapter namespace from http://sap.com/xi/XI/sample to http://sap.com/xi/XI/zip .

            1.5   Rename the file from SampleRA.xml to ZipRA.xml.

            1.6   Create a java project in NWDS/Eclipse “AdapterZIP”.

            1.7   Create a package in the project: com.GSK.JMSMQMD.adapter.ra, copy ZipRA.xml into root of project directory and remaining files in to project directory, into sub-directory com/test/zip/adapter/ra.

            1.8    Change JNDI Name in Ra.xml from deployedAdapters/sample_ra/shareable/sample_ra to deployedAdapters/mqmd_ra/shareable/MQMD_ra,actually Ra.xml contains the metadata for the adapter, like  configuration parameters .

Step2:* *Modifying the Configuration Files for RAR* </p><p> </p><p>            2.1 In NWDS, create project AdapterYOURADAPTERNAME_RAR.</p><p class=”sapxdpparagraph”>            2.2 Extract and copy the META-INF directories to the appropriate project  directories.</p><p class=”sapxdpparagraph”>+                    2.2.1  +Change the namespace from com.sap.aii.af.sample.adapter.ra to com.test.YourAdapterName.adapter.ra .<em> </em></p><p class=”sapxdpparagraph”>                    2.2.2 Change the adapter display file name references from sample_ra to YourAdapterName_ra. More information: Stand-Alone Deployment as RAR</p><p class=”sapxdpparagraph”>            2.3  Change the content of the ra.xml file. Change the adapter type from JCA to YOURADAPTERNAMEFile</p><p class=”sapxdpparagraph”>                     2.3.1  Change the adapter namespace from: http://sap.com/xi/XI/sample to http://sap.com/xi/XI/YourAdapterName</p><p class=”sapxdpparagraph”>                     2.3.2  Change the adapter display name from sample_ra to YourAdapterName_ra. More information: Stand-Alone Deployment as RAR</p><p class=”sapxdpparagraph”>             2.4  Rename file from com.sap.aii.af.sample.adapter.ra-dd.xml to com.test.YourAdapterName.adapter.ra-dd.xml. Verify that the reference in SAP_MANIFEST.MF has also been changed from com.sap.aii.af.sample.adapter.ra-dd.xml to com.test.YourAdapterName.adapter.ra-dd.xml. (This should have already been done with step 3.1 above.) More information: Stand-Alone Deployment as RAR</p><p class=”sapxdpparagraph”>             2.5    Refresh the projects in NWDS.</p><p class=”sapxdpparagraph”> </p><p> </p><p>Step3: Creating and Deploying the Adapter.</p><p> </p><p class=”sapxdpparagraph”>                3.1 Create the RAR file and deploy it to the AS Java.</p><p class=”sapxdpparagraph”>                3.2 Load the adapter metadata.</p><p class=”sapxdpparagraph”>                       3.2.1 Load the metadata file, ra.xml, to PCK.</p><p class=”sapxdpparagraph”>             In a browser, enter URL http://<host>:<port>/CPACache/schemaupload.jsp.</p><p class=”sapxdpparagraph”>                   Enter the user ID and password when prompted.</p><p>                   Enter the following:</p><p class=”sapxdpparagraph”>                  The location of the YourAdapterNameRA.xml</p><p class=”sapxdpparagraph”>         Adapter type: YOURADAPTERNAMEFile</p><p class=”sapxdpparagraph”>         Adapter namespace: http://sap.com/xi/XI/YourAdapterName</p><p class=”sapxdpparagraph”>         Adapter version: 1.0</p><ol><li>Locate the YourAdapterNameRA.xml</li><li>Select Upload Adapter Metadata.</li></ol><p class=”sapxdpparagraph”>More information: Loading Adapter Metadata </p><p class=”sapxdpparagraph”>3.3 Verify the adapter.</p><p class=”sapxdpparagraph”> </p><p class=”sapxdpparagraph”>After deploying and loading the adapter metadata, the adapter is available in PCK. To verify the existence of the adapter, use the URL, http://<host>:<port>/pck/start/index.jsp and select Adapter Monitor. </p><p class=”sapxdpparagraph”> </p><p>Step4: Where to Add JAVA code.</p><p> </p><p>Sample_ra adapter have sample code and different JAVA classes</p><p>So If you are developing Sender Adapter then add your java code in SPIManagedConnectionFactory class file, Search and replace the method getOutFileName with the your code.</p><p> </p><p>In Case receiver adapter add java code in CCIInteraction class, Search and replace the method Send with the code.</p><p>    </p><p>Reference:</p><p> </p><p>http://help.sap.com/saphelp_nwpi711/helpdata/en/69/e1e6667710415a9c331ec2e0715561/content.htm *</p>

1 Comment
You must be Logged on to comment or reply to a post.