Setting up an OSB project to work with JCA adapters

Since Oracle Service Bus 11g, the JCA adapter's framework is available at runtime, but the definition of the adapters through the wizards is only available in JDeveloper and not in Eclipse OEPE. To be able to use the adapters, JDeveloper with the SOA Suite extension installed needs to be available.

This recipe will show the basis for how to use the JCA adapters together with an OSB project. The idea is to avoid having to copy metadata from one place to the other by nesting the JDeveloper project inside the OSB project. This approach will be used by all other recipes working with the JCA adapters, such as the File, DB and AQ adapter recipes.

Getting ready

In order to use this recipe, both a working Eclipse and JDeveloper IDE needs to be available. In JDeveloper, you also need to install the SOA Suite extension.

How to do it...

First we create an empty OSB project with the correct folder structure. In Eclipse OEPE, perform the following steps:

  1. Create a new OSB project and name it working-with-jca-adapter.
  2. Create an adapter folder in the OSB project.
  3. Right-click on the adapter folder and select Properties from the context window.
  4. Copy the path of the adapter folder under Location into the clipboard. We will need it for the location of the SOA project in JDeveloper.

    Now we switch to JDeveloper and create a SOA project, located inside the adapter folder just created previously. In JDeveloper, perform the following steps:

  5. Click on File | New....
  6. Enter soa into the search field.
  7. Select the SOA Project from the list of items as shown in the following screenshot:
    How to do it...
  8. Click OK.
  9. On the Name your project screen, enter AdapterSOAProject into the Project Name field.
  10. Make sure that the project is placed within the adapter folder of the OSB project. Copy the path from the clipboard (the one copied from the Properties in Eclipse OEPE before) into the Directory field and add AdapterSOAProject to the path.
    How to do it...
  11. Click Next and then choose Empty Composite.
  12. Click Finish.
  13. The SOA project is created and the empty SOA composite window is shown. The composite can now be used to create the adapters. This is not part of this recipe and will be shown in most of the recipes in Chapter 7, Communicating with the Database.
  14. Go back to Eclipse OEPE and do a refresh (F5) on the adapter folder of the OSB project.
    How to do it...

This finishes the basic set up of the AdapterSOAProject nested inside the OSB project. We have not yet created an adapter. This will be shown in many other recipes throughout the book.

How it works...

We have created a SOA project, which is located inside the adapter folder of the OSB project. Whenever something is changed on the adapters in JDeveloper, or a new adapter is added to the composite, all we have to do is refresh the adapter to have all necessary artifacts available in the OSB project and in Eclipse OEPE.

An empty SCA composite has been created as the base, which can now be used to define the adapters. Every composite has three swim lanes or sections, the Exposed Services located on the left, the External References on the right, and the Components section located in the middle of the composite window.

Think of the Components section as the place where the OSB proxy and business services are located. Using that mnemonic trick we can place the adapters in the same way as we are used to from working with SOA Suite 11g. Inbound adapters (file polling, database polling, and de-queuing) should be placed on the Exposed Services swim lane and outbound adapters (file write, database read/write, and enqueuing) should be placed on the External References swim lane.

How it works...

See also

Now with the basic project structure in place, we can start using the JCA adapter for either inbound or outbound communication. Check the recipes in the Chapter 6, Using File and Email Transport for the usage of the File adapter, and in Chapter 7, Communicating with the Database for the usage of the DB and AQ adapters. All of these recipes will reuse the basic setup of this recipe.