edu.ucsb.nceas.morpho.plugins
Class ServiceController

java.lang.Object
  extended byedu.ucsb.nceas.morpho.plugins.ServiceController

public class ServiceController
extends java.lang.Object

The ServiceController handles the registration of services and service lookup for other objects. This is a singleton class because only one instance is ever needed. Plugins that need to utilize a service should call getServiceProvider(). The single instance of ServiceController can be obtained statically using getInstance().

Author:
jones

Method Summary
 void addService(java.lang.Class serviceInterface, ServiceProvider provider)
          This method is called by plugins to register a particular service that the plugin can perform.
 boolean checkForService(java.lang.Class serviceInterface)
          This method is called by plugins to determine if a particular service has been registered and is available.
static ServiceController getInstance()
          Get the single instance of the ServiceController, creating it if needed.
 ServiceProvider getServiceProvider(java.lang.Class serviceInterface)
          This method is called by plugins to get a reference to an object that implements a particular interface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ServiceController getInstance()
Get the single instance of the ServiceController, creating it if needed.

Returns:
the single instance of the ServiceController

getServiceProvider

public ServiceProvider getServiceProvider(java.lang.Class serviceInterface)
                                   throws ServiceNotHandledException
This method is called by plugins to get a reference to an object that implements a particular interface

Parameters:
serviceInterface - the service interface desired
Returns:
ServiceProvider a reference to the object providing the service
Throws:
ServiceNotHandledException - Description of Exception

addService

public void addService(java.lang.Class serviceInterface,
                       ServiceProvider provider)
                throws ServiceExistsException
This method is called by plugins to register a particular service that the plugin can perform. The service is identified by the class of an interface that the service implements.

Parameters:
serviceInterface - the interface representing this service
provider - a reference to the object providing the service
Throws:
ServiceExistsException

checkForService

public boolean checkForService(java.lang.Class serviceInterface)
This method is called by plugins to determine if a particular service has been registered and is available.

Parameters:
serviceInterface - the service interface desired
Returns:
boolean true if the service exists, false otherwise


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.