Besides all the Service Data we might add by ourselves to a Grid Service (such as our MathData), all Grid Services have a set of common Service Data Elements which describe certain characteristics of the Grid Service, such as the GSH of the instance. These SDEs are part of the GridService portType (remember: if we want a portType to be a grid service, it must extend from the GridService portType).
We're going to take a brief look at these SDEs "just for the fun of it", since you probably won't need to access them unless you're writing a program that has to dynamically discover low-level data about the Grid Service. However, since we'll also see a small program which displays all the values of these SDEs, it'll give us a chance to see how to deal with more elaborate Service Data scenarios (such as multivalued SDEs and nillable SDEs).
The following are perhaps the most interesting GridService SDEs:
gridServiceHandle. Multivalued SDE which contains the GridService's GSHs.
factoryLocator. Single valued SDE with the locator for the factory which created this Grid Service. If the Grid Service was not created by a factory, the value of this SDE will be null.
terminationTime. Single valued SDE with information about the termination time of the Grid Service.
serviceDataNames. Multivalued SDE with the names of all the SDEs in the Grid Service.
interfaces. Multivalued SDE with the names of all the interfaces (PortTypes) implemented by this Grid Service.
The GridService PortType does have more SDEs (gridServiceReference, findServiceDataExtensibility, and setServiceDataExtensibility) but they have not been included since this is not intended as an exhaustive text on GridService SDEs. For more details on the remaining SDEs, take a look at the OGSI specification (you can find a link to it in the Related Documents section of the Introduction).
The examples file (available in the tutorial files available in the tutorial website) includes a program which, given a GSH, prints all the GridService SDEs mentioned above. You can find the source code at $TUTORIAL_DIR/org/globus/progtutorial/clients/GridService/PrintGridServiceData.java. We will not review the code here, but feel free to take a close look at it, to see how multivalued SDEs and nillable SDEs are handled.
We're going to try it out with the Grid Service we've written in this section. Of course, you can try the program with any of the Grid Services we've seen so far. The client receives only one parameter: the Grid Service GSH.
javac org/globus/progtutorial/clients/GridService/PrintGridServiceData.java java \ org.globus.progtutorial.clients.GridService.PrintGridServiceData \ http://127.0.0.1:8080/ogsa/services/progtutorial/core/servicedata/MathService
You should see the following on your terminal:
gridServiceHandle: http://127.0.0.1:8080/ogsa/services/progtutorial/core/servicedata/MathService factoryLocator: Not created by a factory! terminationTime (after): The service plans to exist indefinitely terminationTime (before): The service has no plans to terminate. terminationTime (timestamp): Tue Mar 16 18:48:54 CET 2004 serviceDataName: gridServiceHandle serviceDataName: {http://www.globus.org/namespaces/2004/02/progtutorial/MathService_sd}MathData serviceDataName: factoryLocator serviceDataName: serviceDataName serviceDataName: interface serviceDataName: setServiceDataExtensibility serviceDataName: terminationTime serviceDataName: gridServiceReference serviceDataName: findServiceDataExtensibility interface: GridService interface: {http://www.globus.org/namespaces/2004/02/progtutorial/MathService_sd}MathPortType
Notice how, since this service hasn't been deployed following the factory/instance model, this Grid Service has no factory locator (Not created by a factory!). Also, notice how this Grid Service implements the GridService portType and our own MathPortType portType.
As mentioned above, remember we are doing this just "for the fun of it". Try this client with other Grid Services, and notice how the values vary according to the characteristics of the Grid Service. For example, if you try the client with the notification examples we will see in the following section, you'll see that our Grid Service now implements a new PortType: the NotificationSource PortType.