com.sdm.quasar.client.core.common.services
Interface ServiceProvider

All Known Subinterfaces:
ServiceManager
All Known Implementing Classes:
DefaultServiceManager

public interface ServiceProvider

Provides Service implementations by accessing them via their Service interface.

This service provider does not support a hierarchy.

Services provide a flexible and extensible mechanism for communication between e.g. dialogs or components (see Service).

A service is identified by a class object: the interface that defines the service. That interface must extend Service. The implementation must be an object that implements that concrete interface.

Note: A service interface that extends another service interface will be considered as a different service.

Note: Implementations of this interface must be threadsafe and be aware that while executing one method the same or any other method may be called again by the same or another thread. Avoid implementations that might deadlock.

Version:
1.0
Author:
Thomas Wolf, Bernd Olleck

Method Summary
 Service getService(java.lang.Class service)
          Returns the service implementation registered with the service manager.
 boolean hasService(java.lang.Class service)
          Tests, whether a service is registered with the service manager.
 

Method Detail

hasService

public boolean hasService(java.lang.Class service)
Tests, whether a service is registered with the service manager.

Parameters:
service - the interface that defines the service
Returns:
true, iff an implementation is registered for the given service.

getService

public Service getService(java.lang.Class service)
Returns the service implementation registered with the service manager.

Parameters:
service - the interface that defines the service
Returns:
the implementation for the service interface.
Throws:
java.lang.IllegalArgumentException - if the service is unknown