org.apache.hivemind.impl
Class RegistryImpl

java.lang.Object
  extended by org.apache.hivemind.impl.RegistryImpl
All Implemented Interfaces:
Registry

public class RegistryImpl
extends java.lang.Object
implements Registry

Implementation of Registry that delegates to an instance of RegistryInfrastructure.

Since:
1.1

Constructor Summary
RegistryImpl(RegistryInfrastructure infrastructure)
           
 
Method Summary
 void cleanupThread()
          Convienience for invoking ThreadEventNotifier.fireThreadCleanup().
 boolean containsConfiguration(java.lang.String configurationId)
          Returns true if a configuration for the specified id exists.
 boolean containsService(java.lang.Class serviceInterface)
          Returns true if a single service for the specified service interface class exists.
 boolean containsService(java.lang.String serviceId, java.lang.Class serviceInterface)
          Returns true if a service for the specified service id and service interface exists.
 java.lang.Object getConfiguration(java.lang.Class configurationType)
          Finds a configuration of the specified type.
 java.lang.Object getConfiguration(java.lang.String configurationId)
          Returns the container of the configuration point.
 java.util.Locale getLocale()
          Returns the locale for which the registry was created.
 Messages getModuleMessages(java.lang.String moduleId)
          Returns the Messages object for the specified module.
 java.lang.Object getService(java.lang.Class serviceInterface)
          Convenience method to obtain a service with a single implementation from the registry.
 java.lang.Object getService(java.lang.String serviceId, java.lang.Class serviceInterface)
          Obtains a service from the registry.
 java.util.List getServiceIds(java.lang.Class serviceInterface)
          Returns a list of service ids for service points which implement the desired service interface.
 void setupThread()
          To be invoked at the start of each request in a multi-threaded environment.
 void shutdown()
          Shuts down the registry; this notifies all RegistryShutdownListener services and objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegistryImpl

public RegistryImpl(RegistryInfrastructure infrastructure)
Method Detail

containsConfiguration

public boolean containsConfiguration(java.lang.String configurationId)
Description copied from interface: Registry
Returns true if a configuration for the specified id exists.

Specified by:
containsConfiguration in interface Registry
Returns:
true if a configuration for the specified id exists

containsService

public boolean containsService(java.lang.Class serviceInterface)
Description copied from interface: Registry
Returns true if a single service for the specified service interface class exists.

Specified by:
containsService in interface Registry
Returns:
true if a single service for the specified service interface exists

containsService

public boolean containsService(java.lang.String serviceId,
                               java.lang.Class serviceInterface)
Description copied from interface: Registry
Returns true if a service for the specified service id and service interface exists.

Specified by:
containsService in interface Registry
Returns:
true if a service for the specified service id and service interface exists

getConfiguration

public java.lang.Object getConfiguration(java.lang.Class configurationType)
Description copied from interface: Registry
Finds a configuration of the specified type. Exactly one such configuration may exist or an exception is thrown.

Specified by:
getConfiguration in interface Registry
Parameters:
configurationType - the configuration type
Returns:
the configuration

getConfiguration

public java.lang.Object getConfiguration(java.lang.String configurationId)
Description copied from interface: Registry
Returns the container of the configuration point.

Specified by:
getConfiguration in interface Registry
Parameters:
configurationId - the fully qualified id of the configuration to obtain
Returns:
the configuration

getService

public java.lang.Object getService(java.lang.String serviceId,
                                   java.lang.Class serviceInterface)
Description copied from interface: Registry
Obtains a service from the registry. Typically, what's returned is a proxy, but that's irrelevant to the caller, which simply will invoke methods of the service interface.

Specified by:
getService in interface Registry
Parameters:
serviceId - the fully qualified id of the service to obtain
serviceInterface - the class to which the service will be cast
Returns:
the service

getService

public java.lang.Object getService(java.lang.Class serviceInterface)
Description copied from interface: Registry
Convenience method to obtain a service with a single implementation from the registry. Exactly one service point must implement the service.

Specified by:
getService in interface Registry
Parameters:
serviceInterface - the class to which the service will be cast.
Returns:
the service implementing the given interface.
See Also:
Registry.getService(String, Class)

getLocale

public java.util.Locale getLocale()
Description copied from interface: Registry
Returns the locale for which the registry was created.

Specified by:
getLocale in interface Registry

shutdown

public void shutdown()
Description copied from interface: Registry
Shuts down the registry; this notifies all RegistryShutdownListener services and objects. Once the registry is shutdown, it is no longer valid to obtain new services or configurations, or even use existing services and configurations.

Specified by:
shutdown in interface Registry

cleanupThread

public void cleanupThread()
Description copied from interface: Registry
Convienience for invoking ThreadEventNotifier.fireThreadCleanup().

Specified by:
cleanupThread in interface Registry

setupThread

public void setupThread()
Description copied from interface: Registry
To be invoked at the start of each request in a multi-threaded environment. Ensures that the receiving Registry will be used if any service proxies are de-serialized.

Specified by:
setupThread in interface Registry
Since:
1.1
See Also:
ServiceSerializationHelper, ServiceSerializationSupport

getServiceIds

public java.util.List getServiceIds(java.lang.Class serviceInterface)
Description copied from interface: Registry
Returns a list of service ids for service points which implement the desired service interface.

Specified by:
getServiceIds in interface Registry
Returns:
Returns an empty List if no matching service points exist.
Since:
1.1

getModuleMessages

public Messages getModuleMessages(java.lang.String moduleId)
Description copied from interface: Registry
Returns the Messages object for the specified module.

Specified by:
getModuleMessages in interface Registry
Parameters:
moduleId - the module id
Returns:
the Messages object for the specified module.
Since:
1.1


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.