In addition to the script-based getting started sandbox described in the WebSphere eXtreme Scale REST Data Service Getting Started Sample readme, a basic Eclipse project is included to get you started on your own eXtreme Scale REST data service development activities.
After the eclipse project is imported, the scripts that are included in the root of the install_root/restservice/gettingstarted directory automatically pick up any class file changes that are made.
Four different source directories are included with the project. Each source directory builds its classes in an independent /bin directory.
Directories | Description |
---|---|
/client | Includes the source files needed to connect to the grid with a traditional eXtreme Scale EntityManager client. The NorthwindOGClient.java source file includes all of the source code that is required to connect to the server. The client depends on the restclient source directory for the ObjectGrid client override XML configuration files and the common source directory for the entity classes. |
/server | Includes the NorthwindOGServer.java source file that demonstrates how to start a catalog service and container server programmatically in a single process. The NorthwindOGLocal.java source file shows how to create an in-memory, ObjectGrid instance that you can use to validate a configuration and entity model. The server depends on the common source directory for the entity classes. |
/restclient | Includes the configuration files and ObjectGrid client override files that are required by the eXtreme Scale REST data service to talk to the eXtreme Scale grid. The restclient directory depends on the common source directory for the entity classes and the server source directory for access to helper methods in the NorthwindOGLocal class. |
/common | Includes the entity classes that are required by the clients and servers. |
The provided project has been tested with Eclipse Version 3.x and later, and only requires the standard Java development project perspective. The following steps guide you through the setup of your eXtreme Scale development environment.
Substitute install_root with the path to the eXtreme Scale installation root directory or the root file path of the extracted eXtreme Scale trial.
After completing these steps, you should now see the 'WXSRestGettingStarted' project in your workspace. You must resolve some build errors by defining the eXtreme Scale user library, as described in the following steps:
a) Browse and select the objectgrid.jar and cglib.jar files from the install_root/lib directory. Click OK. Substitute install_root with the path to the eXtreme Scale installation root directory or the root file path of the extracted eXtreme Scale trial.
b) To include Javadoc for the ObjectGrid APIs, select Javadoc location for the objectgrid.jar file that you added in the previous step and click Edit.
c) In the Javadoc location path box, type the following URL:http://www.ibm.com/developerworks/wikis/extremescale/docs/api/
Note:The ObjectGrid API documentation archive can also be downloaded from: http://www.ibm.com/developerworks/wikis/x/OgWoBg
The correct classes and libraries are now in the build path, and the project should be error free. You can review and experiment with the source code.
Complete the following steps to run the NorthwindOGServer in Eclipse, which starts the NorthwindGrid eXtreme Scale server. This process is equivalent to running the runcat.sh|bat and runcontainer.sh|bat scripts that are in the root of this project. The catalog service and one container are started in the process.
Note:If you ran the server from the command line, stop the server to avoid port conflicts.
In Eclipse 3.0 - 3.3, select Open Run Dialog...
In Eclipse 3.4 or later, select Run Configurations...
Project:WXSRestGettingtarted
Main class: com.ibm.websphere.sample.xs.northwind.NorthwindOGServer
-Djava.endorsed.dirs=install_root/lib/endorsed
Substitute install_root with the path to the eXtreme Scale installation root directory or the root file path of the extracted eXtreme Scale trial.
When the client has completed inserting the new Customer entity into the grid, the following message is displayed: SUCCESS: Persisted Customer with name RoadRunner and key ACME
For details on starting the service, see Chapter 3 of the WebSphere eXtreme Scale REST data service User Guide.
The previous configuration always inserts a Customer entity with the id: ACME. You can change the program arguments in the run profile to run different operations with different values. The details of the operations and parameters are in the WebSphere eXtreme Scale REST Data Service Getting Started Sample readme.
Ensure that you substitute the correct path to the location where eXtreme Scale is installed or where the trial was extracted (two levels up from the location of this readme file). The previous steps express this location as install_root.
Object Request Broker (ORB) issues are a common setup problem. You might see the following error or a similar error: Caused by: java.lang.RuntimeException: The ORB that comes with the Sun Java implementation does not work with ObjectGrid at this time. Use the IBM ORB until the Sun ORB works. If this error occurs, check the value provided in the VM Arguments field of the run configuration. The path to java.endorsed.dirs must be an absolute path with no variables or shortcuts. Note: A known issue exists with this configuration on the Mac OSX version of Java Version 1.5. Use Java Version 1.6 to avoid any problems.