Runtime

## Package org.eclipse.gmf.runtime.common.core.service

Provides the base interfaces for all service providers.

See:
Description

Interface Summary
IOperation: The interface for all service provider operations.
IProvider: The interface for all service providers.
IProviderChangeListener: An interface for types that listen to service provider changes.
IProviderPolicy: The interface for all service providers lightweight's implementation.

Class Summary
AbstractProvider: The abstract parent of all service providers.
AbstractProviderConfiguration: Concrete subclasses can be used to assist in parsing service provider descriptors to filter out and delay loading of service providers that do not apply.
AbstractProviderConfiguration.ObjectDescriptor: A descriptor for an XML configuration element that identifies a class by name and optionally its methods.
ExecutionStrategy: An enumeration of provider execution strategies.
ProviderChangeEvent: An event that indicates when a provider changes.
ProviderPriority: An enumeration of service provider priorities.
Service: A `Service` does some specific piece of work for clients by delegating the actual work done to one or more service providers.
Service.ProviderDescriptor: A descriptor for providers defined by a configuration element.

## Package org.eclipse.gmf.runtime.common.core.service Description

Provides the base interfaces for all service providers. The following examples are some of the services in the modeling platform:

- Layout Service
- Property Service
- Decorator Service

The modeling platform consists of a set of services whose requests are fulfilled by service providers that implement `IProvider`. Each service exposes an extension-point that providers extend to be discovered and used. This package contains classes that define the abstract contract for service providers.

## Package Specification

When it receives a client request, a service typically embeds the request information in an `IOperation` and then evaluates the extensions of its defined extension-point to find potential providers for the request. To determine to which providers to delegate a request, a service uses two sequential filters:

1. The service evaluates the information in each provider's extension descriptor. The service extension-point schema typically filters out most providers in this step and prevents the unnecessary loading of a provider.
2. The service requests information from each provider about whether it can support the request. The provider's `IProvider.provides` implementation performs this action.

Typically, the service sorts the providers that passed the filters according to the priority that the service provider extension descriptor defines. Depending on the service and the request, the service might request one or more providers to perform the operation. After the required providers are defined, the service delegates the execution of the request for each provider to the operation's `IOperation.execute` implementation. Each service provides its own IOperation subclass that subsequently delegates to the provider.

Most services expose an abstract class implementing IProvider that providers should subclass. The abstract class specifies the contract between the service and its providers since it specifies the API to perform requests. The abstract class usually extends `AbstractProvider` to leverage the notification support of this class.

Some services require notification from a provider if the provider's state changes. This notification occurs through the `IProviderChangeListener` interface. These types of service connect to their provider using `addProviderChangeListener` and disconnect using `removeProviderChangeListener`. Services often provide their own derived `ProviderChangeEvent` classes to convey more service-specific information about the state change.

Sometimes, it is impossible to provide enough information in a service provider extension descriptor to avoid the unnecessary loading of the provider plug-in. When the cost of loading a provider plug-in is high, it might be preferable to move the implementation of `IProvider.provides` to a lightweight plug-in. To do this, a service provider extension descriptor should include a "Policy" subelement with a class attribute that references a class that implements `IProviderPolicy`. This interface is a subset of IProvider that only includes the `IProviderPolicy.provides` member.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.