com.openexchange.admin.services
Class AdminServiceRegistry

java.lang.Object
  extended by com.openexchange.admin.services.AdminServiceRegistry

public final class AdminServiceRegistry
extends java.lang.Object

AdminServiceRegistry - A registry for services needed by admin.

Author:
Thorben Betten

Method Summary
<S> void
addService(java.lang.Class<? extends S> clazz, S service)
          Adds a service bound to given class to this service registry
 void clearRegistry()
          Clears the whole registry
static AdminServiceRegistry getInstance()
          Gets the admin's service registry
<S> S
getService(java.lang.Class<? extends S> clazz, boolean failOnError)
          Gets the service defined by given class
 void removeService(java.lang.Class<?> clazz)
          Removes a service bound to given class from this service registry
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static AdminServiceRegistry getInstance()
Gets the admin's service registry

Returns:
The admin's service registry

clearRegistry

public void clearRegistry()
Clears the whole registry


removeService

public void removeService(java.lang.Class<?> clazz)
Removes a service bound to given class from this service registry

Parameters:
clazz - The service's class

addService

public <S> void addService(java.lang.Class<? extends S> clazz,
                           S service)
Adds a service bound to given class to this service registry

Parameters:
clazz - The service's class
service - The service itself

getService

public <S> S getService(java.lang.Class<? extends S> clazz,
                        boolean failOnError)
             throws com.openexchange.server.ServiceException
Gets the service defined by given class

Type Parameters:
S - The type of service's class
Parameters:
clazz - The service's class
failOnError - true to throw an appropriate ServiceException if service is missing; otherwise false
Returns:
The service if found; otherwise null or an appropriate ServiceException is thrown dependent on failOnError parameter.
Throws:
com.openexchange.server.ServiceException - If failOnError parameter is set to true and service is missing

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object