Globus Toolkit 4: Programming Java Services

Chapter 7: Singleton Resources

In the previous chapter, we saw how to implement a single-resource stateful web service. We did this the simplest possible way: implementing the service and the resource in the same class. In this chapter, although we will continue to have a single resource, we will learn more about the preferred way of implementing web services in GT4: using a separate class for the service and the resource. To do this, we will learn more about resource homes.

7.1 Splitting Up the Implementation

7.1.1 The Resource, the Home, and the Service

In this chapter, we will split our implementation into three files. We will see that, for the most part, we will simply take code from the previous chapter and divide it among the three files.

  • The resource: $EXAMPLES_DIR/org/globus/examples/services/core/singleton/ impl/MathResource.java

  • The resource home: $EXAMPLES_DIR/org/globus/examples/services/core/ singleton/impl/MathResourceHome.java

  • The service itself: $EXAMPLES_DIR/org/globus/examples/services/core/ singleton/impl/MathService.java


Figure 7.1: Relationships between the Service, the Resource Home, and the Resource

Before looking at the actual Java code, let's make sure we understand how these three implementation files are related.

  • The service is the stateless frontend (the client only interacts with this class, even if there are more classes lurking around in the background). Remember from Chapter 4, WSRF section that, since we're following a "resource approach" to statefulness, the web service will always be stateless. However, we can give the impression of being stateful by retrieving a stateful resource whenever we want to access state information.

  • The resource is the stateful

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Domain Registration Services
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.