SourceForge.net Logo
How to use the jGridShift JCA adapter
J2EE Connector Architecture is a technology for connecting to any non-J2EE resource from within a J2EE application. Detailed documentation on the concepts and API are available on the Sun site. This HowTo will just deal with how to use the included adapter.

The JGridShift zip contains all the source and a pre-built Resource ARchive (jgridshift.rar). This archive contains all the classes and container independent ra.xml configuration file. To make it work you will also need a container specific configuration file. The zip contains a jgridshift-service.xml for JBoss 3.2. For JBoss simply edit the service file to identify your grid shift binary file, then drop the jgridshift.rar and edited jgridshift-service.xml in the deployment directory and that's it. The sample session bean au.com.objectix.jgridshift.sample.session.JGridShiftBean (implementing the web service) is very small and illustrates the entire process of using an adapter. First lookup the ConnectionFactory in the InitialContext. Next get a connection from the factory, instatiate and populate a au.com.objectix.jgridshift.jca.GridShiftRecord object for the coordinate to shift and use one of the shift methods on the connection interface au.com.objectix.jgridshift.jca.GridShiftConnection (refer to the sample). You can also use the Common Client Interface execute methods. If you use the CCI methods you will also need to instantiate a au.com.objectix.jgridshift.jca.GridShiftInterationSpec object to specify forward or reverse shift.

The sample web service is quite specific to JBoss, in that it relies on JBoss-Net. JBoss-Net is not included in the default server for 3.2 (it is for 4.0), so you will need to use the All server or add JBoss-Net to the default. Simply add the jgridshift.ear to the deployment directory along with the jgridshift.rar and edited jgridshift-service.xml. The WSDL is available at http://localhost:8080/jboss-net/services/JGridShiftService?wsdl for a default JBoss server. A rudimentary web service client is included that expects the web service at the above location. Supply coordinates in positive east degrees as lat,lon pairs on the command line eg

java au.com.objectix.jgridshift.sample.wsclient.TestClient -37.0,145.0 -22.0,130.8
The client needs most of the Apache Axis 1.1 jars on its classpath.