Before you can verify that the SimpleApp.java sample runs, you need
to start a catalog server and a container server. After starting these services successfully, you
can then launch the client and run the sample. Additional security features are added incrementally
in the steps of the tutorial to increase the amount of integrated security that is
available.
Before you begin
To successfully complete this step of the tutorial, you should have access to the following files:
- Have access to the compiled sec_sample.jar package. This package contains
the SimpleApp.java program.
- Have access to the necessary configuration files SimpleApp.xml and
SimpleDP.xml.
You should have created these files in
Java SE security tutorial - Step 1 of this
tutorial.
You should also know how to:
- Start and stop a catalog servers and container servers. For more information, see Starting and stopping stand-alone servers.
Deprecated: The
startOgServer and
stopOgServer commands start servers that use the Object Request Broker (ORB) transport mechanism. The ORB is deprecated, but you can continue using these scripts if you were using the ORB in a previous release. The IBM® eXtremeIO (XIO) transport mechanism replaces the ORB. Use the
startXsServer and
stopXsServer scripts to start and stop servers that use the XIO transport.
- Run the xscmd utility in order verify the map size inserted into the data
grid.
Procedure
- In a command line window, go to the wxs_home/bin directory and start the catalog service.
![[Linux]](icons/nglinux.gif)
![[Unix]](icons/ngunix.gif)
./startOgServer.sh catalogServer
![[Windows]](icons/ngwin.gif)
startOgServer.bat catalogServer
![[Linux]](icons/nglinux.gif)
![[Unix]](icons/ngunix.gif)
./startXsServer.sh catalogServer
![[Windows]](icons/ngwin.gif)
startXsServer.bat catalogServer
- Start a container service named
c0:
![[Linux]](icons/nglinux.gif)
![[Unix]](icons/ngunix.gif)
./startOgServer.sh c0 -objectGridFile ../xml/SimpleApp.xml
-deploymentPolicyFile ../xml/SimpleDP.xml -catalogServiceEndPoints localhost:2809
![[Windows]](icons/ngwin.gif)
startOgServer.bat c0 -objectGridFile ..\xml\SimpleApp.xml -
deploymentPolicyFile ..\xml\SimpleDP.xml -catalogServiceEndPoints localhost:2809
![[Linux]](icons/nglinux.gif)
![[Unix]](icons/ngunix.gif)
./startXsServer.sh c0 -objectGridFile
../xml/SimpleApp.xml -deploymentPolicyFile ../xml/SimpleDP.xml -catalogServiceEndPoints
localhost:2809
![[Windows]](icons/ngwin.gif)
startXsServer.bat c0 -objectGridFile
..\xml\SimpleApp.xml -deploymentPolicyFile ..\xml\SimpleDP.xml -catalogServiceEndPoints
localhost:2809
- After the catalog server and container server have been started, run the
sec_sample.jar sample as follows:
![[Unix]](icons/ngunix.gif)
java -classpath ../lib/objectgrid.jar:../applib/sec_sample.jar com.ibm.websphere.objectgrid.security.sample.guide.SimpleApp
![[Windows]](icons/ngwin.gif)
java -classpath ..\lib\objectgrid.jar;..\applib\sec_sample.jar com.ibm.websphere.objectgrid.security.sample.guide.SimpleApp
The output of the sample is:
The customer name for ID 0001 is fName lName The
getObjectGrid method in this class obtains an ObjectGrid, and the run method reads a record from the
customer map and updates the value in the accounting grid.
- Verify the size of the "customer" map inserted into the "accounting" grid, by issuing the
xscmd command utility as follows:
![[Linux]](icons/nglinux.gif)
![[Unix]](icons/ngunix.gif)
./xscmd.sh -c showMapSizes -g accounting -ms mapSet1
![[Windows]](icons/ngwin.gif)
xscmd.bat -c showMapSizes -g accounting -ms mapSet1
- Stop a container server named
c0 with one of the following
scripts:
-
![[Linux]](icons/nglinux.gif)
![[Unix]](icons/ngunix.gif)
./stopOgServer.sh c0 -catalogServiceEndPoints
localhost:2809
-
![[Windows]](icons/ngwin.gif)
stopOgServer.bat c0 -catalogServiceEndPoints
localhost:2809
-
![[Linux]](icons/nglinux.gif)
![[Unix]](icons/ngunix.gif)
./stopXsServer.sh c0 -catalogServiceEndPoints
localhost:2809
-
![[Windows]](icons/ngwin.gif)
stopXsServer.bat c0 -catalogServiceEndPoints
localhost:2809
If the server stopped successfully, then you will see the following message:
CWOBJ2512I: ObjectGrid server c0 stopped.
- Stop the catalog server with one of the following scripts:
-
![[Linux]](icons/nglinux.gif)
![[Unix]](icons/ngunix.gif)
./stopOgServer.sh catalogServer -catalogServiceEndPoints
localhost:2809
-
![[Windows]](icons/ngwin.gif)
stopOgServer.bat catalogServer -catalogServiceEndPoints
localhost:2809
-
![[Linux]](icons/nglinux.gif)
![[Unix]](icons/ngunix.gif)
./stopXsServer.sh catalogServer -catalogServiceEndPoints
localhost:2809
-
![[Windows]](icons/ngwin.gif)
stopXsServer.bat catalogServer -catalogServiceEndPoints
localhost:2809
If the server stopped successfully, then you will see the following message:
CWOBJ2512I: ObjectGrid server catalogServer stopped.