org.apache.hivemind
Interface Registry

All Known Implementing Classes:
RegistryImpl

public interface Registry

The HiveMind registry; primarily this is used to gain access to services.

Author:
Howard Lewis Ship

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.
 

Method Detail

containsConfiguration

boolean containsConfiguration(java.lang.String configurationId)
Returns true if a configuration for the specified id exists.

Parameters:
configurationId -
Returns:
true if a configuration for the specified id exists

containsService

boolean containsService(java.lang.Class serviceInterface)
Returns true if a single service for the specified service interface class exists.

Parameters:
serviceInterface -
Returns:
true if a single service for the specified service interface exists

containsService

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

Parameters:
serviceId -
serviceInterface -
Returns:
true if a service for the specified service id and service interface exists

getConfiguration

java.lang.Object getConfiguration(java.lang.String configurationId)
Returns the container of the configuration point.

Parameters:
configurationId - the fully qualified id of the configuration to obtain
Returns:
the configuration
Throws:
ApplicationRuntimeException - if the configuration does not exist, etc.

getConfiguration

java.lang.Object getConfiguration(java.lang.Class configurationType)
Finds a configuration of the specified type. Exactly one such configuration may exist or an exception is thrown.

Parameters:
configurationType - the configuration type
Returns:
the configuration
Throws:
ApplicationRuntimeException - if no such configuration extension point exists (or visible)

getService

java.lang.Object getService(java.lang.String serviceId,
                            java.lang.Class serviceInterface)
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.

Parameters:
serviceId - the fully qualified id of the service to obtain
serviceInterface - the class to which the service will be cast
Returns:
the service
Throws:
ApplicationRuntimeException - if the service does not exist, or if it can't be cast to the specified service interface

getService

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

Parameters:
serviceInterface - the class to which the service will be cast.
Returns:
the service implementing the given interface.
Throws:
ApplicationRuntimeException - if there are no service extension points implementing the given interface, or if there multiple service points implementing it.
See Also:
getService(String, Class)

getLocale

java.util.Locale getLocale()
Returns the locale for which the registry was created.


shutdown

void shutdown()
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.


setupThread

void setupThread()
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.

Since:
1.1
See Also:
ServiceSerializationHelper, ServiceSerializationSupport

cleanupThread

void cleanupThread()
Convienience for invoking ThreadEventNotifier.fireThreadCleanup().


getServiceIds

java.util.List getServiceIds(java.lang.Class serviceInterface)
Returns a list of service ids for service points which implement the desired service interface.

Returns:
Returns an empty List if no matching service points exist.
Since:
1.1

getModuleMessages

Messages getModuleMessages(java.lang.String moduleId)
Returns the Messages object for the specified module.

Parameters:
moduleId - the module id
Returns:
the Messages object for the specified module.


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