JiBX Opentravel Schema Project

JiBX Opentravel Schema Project is a collection of pre-packaged OSGi bundles for the opentravel.org schema library.

This project has pre-packaged components ready to include into your project. Since the code has already been bound to the schema, you can start using it right now. Just add the maven dependencies to your project and start writing code.

Maven will automatically include all the dependent packages in your project and in your war file. OSGi will only load the modules that are needed, on-demand.

Try it. it's easy:

Step 1: Add this dependency to your project:

<dependency>
  <groupId>org.jibx.schema.org.opentravel._2012B</groupId>
  <artifactId>org.jibx.schema.org.opentravel._2012B.touractivity</artifactId>
  <version>1.1.4</version>
</dependency>

Step 2: Start writing code.

--------------

If you have about five minutes, try this example. You will create a project that will create an opentravel message, convert it to xml, then convert it back to a java object. Here goes!

First, you need java, eclipse, and the eclipse maven plugin (m2eclipse). This is a pretty standard development environment.

From the eclipse menu, select: New -> project -> Maven -> Maven Project

Click 'Next', then click the 'Add archetype' button on the next screen

Fill in the fields with this information:

    groupId: org.jibx.schema.org.opentravel._2012B
    artifactId: opentravel-archetype
    version: 1.1.4
    
Note: The image below contain a different group, artifact and version number (I can't create a new image for every version). Use the preceding values instead.

Archetype

Click 'Next' and fill this screen with whatever you want. I entered:

      groupID: com.company.ota
      artifactId: ota-ping-test
    

Archetype

Click 'Finish' and your project is built.
Now we're ready to run it.

First, right click on your project and select 'Run as' -> 'Maven Install'

Archetype

This compiles your code and retrieves any dependent code from the maven library.

Now, right click your project name and select 'Run as' -> 'Maven build...'
and enter exec:java as the goal
This will run your new program

Archetype

You should see output similar to this:

Archetype

What this program just did was to build an opentravel message, convert it to xml, then convert it back to a java object and retrieve the data. Nice!
Take a look at your source code. It's pretty simple. It's pretty clean.

You may have to sync maven by right clicking your project and select maven -> update project configurations, then maven -> update dependencies. Now right-click and select maven -> download sources, then maven -> download javadocs.

Now the cool part. Open your source code (App.java).
Place a breakpoint at line 69 (ping.setEchoData("Hello World!");)
and right click App.java in the left nav bar and select Debug as -> Java Application.
When it stops, step into the setEchoData method and voila, you see the source for the java class that represents the xml item, with comments straight from the schema. Very Cool!

Archetype

Now that was pretty painless, huh?