Globus Toolkit 4: Programming Java Services

Chapter 8: Multiple Resources

In the previous two chapters we implemented a simple stateful web service that used a single resource to keep stateful information. First, we used the ServiceResourceHome so we could implement the service and the resource in the same class, and then we split up the implementation into a service class, a resource class, and a resource home class.

In this chapter we will learn how to write a service that, using a design pattern known as the factory/instance pattern, will be able to manage multiple resources.

8.1 The WS-Resource Factory Pattern

The factory/instance pattern is a well-known design pattern in software design, and specially in object-oriented languages. In this pattern, we are not allowed to create instances of objects directly, but must do so through a factory that will provide a create operation.

When dealing with multiple resources, the WSRF specs recommend that we follow this pattern, having one service in charge of creating the resources ( "the factory service") and another one to actually access the information contained in the resources ( "the instance service" ).

Figure 8.1 summarizes the relationship between these two services, the resources, and the client. Whenever the client wants to create a new resource, it will contact the factory service, who will take care of creating and initializing a new resource. It is important to see that, in this case, the resource is also assigned a unique key. Since we are no longer dealing with a...

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: Cloud Computing Services
Finish!
Privacy Policy

This is embarrasing...

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