container
The GAR file, as mentioned in the previous page, contains all the files and information the web server
needs to deploy the Grid Service. Deployment is also done with the Ant tool, which unpacks the GAR
file and copies the files within (WSDL, compiled stubs, compiled implementation, WSDD) into key locations
in the GT3 directory tree. ****It also reads our deployment descriptor and configures the web server to
take our new Grid Service into account.***
This deployment command must be run from the root of your GT3 installation. Furthermore, you need
to run it with a user that has write permission in that directory.
ant deploy -Dgar.name=
the client:
package org.globus.progtutorial.clients.MathService;
import org.globus.progtutorial.stubs.MathService.service.MathServiceGridLocator;
import org.globus.progtutorial.stubs.MathService.MathPortType;
import java.net.URL;
public class Client
{
Writing Your First Grid Service in 5 Simple
Steps
49
public static void main(String[] args)
{
try
{
// Get command-line arguments
URL GSH = new java.net.URL(args[0]);
int a = Integer.parseInt(args[1]);
// Get a reference to the MathService instance
MathServiceGridLocator mathServiceLocator = new MathServiceGridLocator();
MathPortType math = mathServiceLocator.getMathServicePort(GSH);
// Call remote method 'add'
math.add(a);
System.out.println("Added " + a);
// Get current value through remote method 'getValue'
int value = math.getValue();
System.out.println("Current value: " + value);
}catch(Exception e)
{
System.out.println("ERROR!");
e.printStackTrace();
}
}
}
However, the important point is that,
once we have that reference, we can work with the Grid Service as if it were a local object.
placed. We
need to include this directory in the Classpath so our client can access generated stub classes such as
MathServiceGridLocator. Before running it, we need to to start up the standalone container. Otherwise,
our Grid Service won't be available, and the client will crash. The following command must be run from
the root of your GT3 installation:
globus-start-container
==delegation==
Now we're using this parameter to tell the Grid Services container that GridServiceImpl will provide the
basic functionality of our Grid Service.
===Service data can be used for indexing===
Finally, remember from the What is a Grid Service? page that service data generally falls into two categories:
state information (operation results, intermediate results, runtime information, etc.) and service
metadata (system data, supported interfaces, cost of using the service, etc.). The SystemInfo SDE
would fall into the 'service metadata' category, while the LastResults SDE would fall into the 'state
information' category.
--So... where and how exactly do we define Service Data?
The solution is in the GWSDL. As we'll see in the next page, another of the extensions introduced by
GWSDL (with respect to WSDL) is that we can associate SDEs to a portType, specifying the cardinality
of each SDE along with other properties. The datatype of each SDE is specified in XML Schema
[http://www.w3c.org/XML/Schema], a language originally intended to describe the structure and vocabulary
of XML documents. However, it can also be used to define other types of structures (including
databases, objects, etc.)
The GridService Service Data
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
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.
No comments:
Post a Comment