Foundation Services
Scenario: Local and Remote-accessible Services
To enable other applications to access remote services, one application must deploy the remote
services. (The application that deploys the remote services can then access the services as local services).
Instead of deploying their own set of local services, other applications can access the remote service deployment.
To access the remote service deployment, applications
locate the deploying application's remote Discovery Service in order to locate and access the
deployed remote services.
In addition, these applications can each have their own set of locally deployed services to which each application
has its own exclusive access.
This example is useful when client applications need to have both of the following:
- services deployed locally for exclusive use
- use of the same set of remote services
Note: A foundation service-enabled application can be either
a standard client application or a Web client application that runs in a servlet container.
In this scenario, Application 1 deploys the remote services and
accesses them as local services. Application 2 locates Application 1's remote Discovery Service in order
to access the remote services. Application 2 also deploys local services for its own exclusive use.
To deploy remote services and access these services locally, Application 1 does the following:
- Uses the service loader to query service deployment metadata from either a SAS Metadata Server or an XML file (that contains exported metadata).
- Uses the service loader to instantiate services defined in the metadata and register them with the local
Discovery Service.
Note: These services must be configured for remote access.
- Uses its local Discovery Service to find services based upon their service interfaces and optionally,
service attributes.
To deploy local services and access remote services, Application 2 does the following:
- Uses the service loader to query service deployment metadata from either a SAS Metadata Server or an XML file (that contains exported metadata).
- Uses the service loader to instantiate services defined in the metadata and register them with the local
Discovery Service.
Note: Because these services are only used by Application 2, they are not configured for remote
access.
- Uses the service loader to query service deployment metadata from either a SAS Metadata Server or an XML file (that contains exported metadata).
- Uses the service loader to obtain a binding to the remote Discovery Service instantiated by Application 1.
- Uses its local Discovery Service to find services based upon their service interfaces and optionally,
service attributes.
Note: Application 2 has access to both local services and remote services. When services are located, the local Discovery Service first tries to find a service locally
before it looks for a remote-accessible service.
- When Application 2 no longer needs the services it terminates its local Discovery Service. This will cause its locally instantiated services to be destroyed and its bindings to Application 1's remote services to be terminated.
When Application 1 exits, it terminates
the local Discovery Service; the local Discovery Service then terminates all locally instantiated services.
After all services are terminated, no services are available to any applications.
|