Globus Toolkit 3.0 - Last Updated 10/24/2003
Note this code is still of experimental nature and therefore the required build files and samples are only available in the source distribution of GT3 Core. We have tested all the samples with JBOSS 3.2.1 default server and WebSphere Adanced Single Server Edition v4.0. WebSphere requires an additional step to set up a database manually for the entity bean sample, and those scripts have only been tested on Windows. Both in JBOSS as well as in Websphere you can however customize the database to use as source for the sample yourself, please consult the respective product documentation for more information. We generate a gateway that is hosted by a Grid service container which then delegates to your EJB container of choice. The EJB gateway can run under Tomcat or our standalone container. We have tested the gateway with Tomcat 4.0.6.
For the tool to work you need to point it to a directory where you have extracted the contents of your EJB, and then point the tool to the Remote and Home interfaces through configuration before running the code generator. Below we show how this is done for JBOSS and WebShpere respectively for the provided samples.
ejb.dir - the absolute directory of where the contents of your EJB has been extracted
ejb.home - the class that contains the home interface
ejb.remote - the class that contains the remote interface
ejb.exposeHomeService - allows you to use the EJB Home interface to create services if true. If false you will need to use the standard OGSI interfaces (factory) to create your service.
tomcat.dir - the root of your tomcat installation
Open the ejb.properties file in your ogsa java build root directoy (ogsa/impl/java) and uncomment and/or change the following entries to match your environment:
containerType - should be "jboss"
jboss.deployedJar - the jar that is to be deployed in jboss
jboss.dir - should point to the root of your jboss installation
Open the ejb.properties file in your ogsa java build root directoy (ogsa/impl/java) and uncomment and/or change the following entries to match your environment:
containerType - should be "websphere"
websphere.deployedJar - a jar that was constructed by the WebSphere assembly tool to deploy the beans. Note this jar is only used to get client side stubs, it is not deployed in Websphere by our tools, they assume that this jar is already deployed as an application in the WebSphere server
websphere.dir - should point to the root of your websphere app server installation - typically /Websphere/AppServer
webspere.ejb.db - as noted above for websphere you need to set up the database as a separate step, on windows we automate this process for you if you point this property to an Enhydra instantDB script (the database comes with the WebSphere installation)
websphere.create.db.command - we have customized the samples create db script in Websphere for windows. To pick up our customization point this property to createDB.bat
After configuring your environment of choice and setting up the mapping to the bean you want to expose as described above you only have to run:
ant ejbServiceIf that succeeds you are ready to start up your appserver and tomcat/or the standalone container. To start up the standalone container to host the EJB gateways run:
ant startEJBContainer -Dservice.port=<port>
The port defaults to 8080, which will clash with the default JBOSS port, so please pick another port if you are running JBOSS.
ant -f build-ejb.xml samplesLower Case Conversion Session Bean
If you don't expose the home interface then:
The path part of the url that names the service is the primary key of the entity bean. So if you had a "Person" entity bean you would find and instance with a primary key "123" like this:
java org.globus.ogsa.impl.core.factory.client.CreateService http://127.0.0.1:8080/ogsa/services/org/yourpackage/PersonFactoryService 123If it can't find an entity bean with that key it will try to call
home.create(123);and then you use it like this:
java org.yourpackage.YourClient http://127.0.0.1:8080/ogsa/services/org/yourpackage/PersonFactoryService/123
You can use it like an ordinary ejb:
String serviceUrl = "http://127.0.0.1:8080/ogsa/services/org/yourpackage/PersonHomeFactoryService/myHome"; PersonHome home = (PersonHome) EJBServiceClient.createHomeService("org.yourpackage.PersonHome", "org.yourpackage.Person", serviceUrl); Person remote = home.create(new Integer(123)); or Person someOtherRemote = home.findBySomeMethod(blah, blah); or whatever you wantsee org.globus.ogsa.client.EJBServiceClient for more information
If you have JNDI problems, or if tomcat can't find the home interface then look at the parameters in server-config.wsdd.
If you need to change the wsdl it generated you can run "ant -buildfile build-ejb.xml ejbToTomcat" to redeploy the ejb after changing the wsdl
If you have other problems try "ant ejbClean" and then "ant ejbService" again.