Packaging XML facade into JAR

This recipe explains how to prepare a package containing XML facade to be used in BPEL processes and in Java applications in general.

Getting ready

To complete this recipe, we need the XML facade created out of the XML schema. Also, the generated Java classes need to be compiled.

How to do it...

The steps involved for packaging XML façade into JAR are as follows:

  1. We open the Project Properties by right-clicking on the CashflowFacade root node.
  2. From the left-hand side tree, select Deployment and click on the New button. The Create Deployment Profile window opens where we set the name of the archive.
    How to do it...
  3. Click on the OK button. The Edit JAR Deployment Profile Properties dialog opens where you can configure what is going into the JAR archive. We confirm the dialog and deployment profile as we don't need any special configuration.
  4. Now, we right-click on the project root node (CashflowFacade), then select Deploy and CFacade. The window requesting the deployment action appears. We simply confirm it by pressing the Finish button:
    How to do it...
  5. As a result, we can see the generated JAR file created in the deploy folder of the project.

There's more...

In this chapter, we also cover the building of XML facade with the ANT tool. To support an automatic build process, we can also define an ANT target to build the JAR file. We open the build.xml file and define a new target for packaging purposes. With this target, we first recreate the deploy directory and then prepare the package to be utilized in the BPEL process:

<target name="pack" depends="compile">
  <delete dir="deploy"/>
  <mkdir dir="deploy"/>
  <jar destfile="deploy/CFacade.jar"
     basedir="./classes"
     excludes="**/*data*"
  /> 
</target>

To automate the process even further, we define the target to copy generated JAR files to the location of the BPEL process. Usually, this means copying the JAR files to the SCA-INF/lib directory:

<target name="copyLib" depends="pack">
  <copy file="deploy/CFacade.jar" todir="../Banking_BPEL/SCA-INF/lib"/>
</target>

The task depends on the successful creation of a JAR package, and when the JAR package is created, it is copied over to the BPEL process library folder.

See also

Besides the generation, implementation, and packaging of XML facade, it is also a good habit to provide the documentation. This is especially helpful, when the designers of XML facade and the BPEL process are two different developers. To learn how to prepare the Java documents for XML facade, refer to the next recipe—Generating Java documents for XML facade.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset