org.apache.hivemind.internal
Interface RegistryInfrastructure

All Known Implementing Classes:
RegistryInfrastructureImpl

public interface RegistryInfrastructure

Extension of Registry provided by some internals of HiveMind to faciliate the creation of services and configurations.

Author:
Howard Lewis Ship

Method Summary
 void cleanupThread()
          Convienience for invoking ThreadEventNotifier.fireThreadCleanup().
 boolean containsConfiguration(java.lang.String configurationId, Module module)
          Returns true if a configuration for the specified id exists (and is visible to the specified module).
 boolean containsService(java.lang.Class serviceInterface, Module module)
          Returns true if a single service exists which implements the specified service interface and is visible to the given module.
 boolean containsService(java.lang.String serviceId, java.lang.Class serviceInterface, Module module)
          Returns true if a single service with the given id exists which implements the specified service interface and is visible to the given module.
 java.lang.Object getConfiguration(java.lang.Class configurationType, Module module)
          Finds a configuration of the specified type.
 java.lang.Object getConfiguration(java.lang.String configurationId, Module module)
          Returns the specified configuration.
 ConfigurationPoint getConfigurationPoint(java.lang.String configurationId, Module module)
          Returns the configuration point.
 ErrorHandler getErrorHander()
          Returns the ErrorHandler for this Registry.
 java.util.Locale getLocale()
          Returns the locale for which the registry was created.
 Module getModule(java.lang.String moduleId)
          Returns the module with the corresponding module id.
 java.lang.Object getService(java.lang.Class serviceInterface, Module module)
          Finds a service that implements the provided interface.
 java.lang.Object getService(java.lang.String serviceId, java.lang.Class serviceInterface, Module module)
          Obtains a service from the registry.
 java.util.List getServiceIds(java.lang.Class serviceInterface)
           
 ServiceModelFactory getServiceModelFactory(java.lang.String name)
          Returns a named service-model factory
 ServicePoint getServicePoint(java.lang.String serviceId, Module module)
          Returns the identified service extension point.
 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.
 void startup()
          Invoked once, just after the registry infrastructure is constructed.
 

Method Detail

getService

java.lang.Object getService(java.lang.String serviceId,
                            java.lang.Class serviceInterface,
                            Module module)
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
module - the referencing module, used for visibility checks (null means no module, which requires that the service be public)
Returns:
the service
Throws:
ApplicationRuntimeException - if the service does not exist (or is not visible), or if it can't be cast to the specified service interface

getService

java.lang.Object getService(java.lang.Class serviceInterface,
                            Module module)
Finds a service that implements the provided interface. Exactly one such service may exist or an exception is thrown.

Parameters:
serviceInterface - used to locate the service
module - the referencing module, used for visibility checks. If null, then only public service points will be considered.
Throws:
ApplicationRuntimeException - if either 0, or more than 1, service point is visible to the module

getConfiguration

java.lang.Object getConfiguration(java.lang.String configurationId,
                                  Module module)
Returns the specified configuration.

Parameters:
configurationId - the fully qualified id of the configuration
module - the referencing module, used for visibility checks (null means no module, which requires that the configuration be public)
Returns:
the configuration
Throws:
ApplicationRuntimeException - if no such configuration extension point exists (or visible)

getConfiguration

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

Parameters:
configurationType - the configuration type
module - the referencing module, used for visibility checks (null means no module, which requires that the configuration be public)
Returns:
the configuration
Throws:
ApplicationRuntimeException - if no such configuration extension point exists (or visible)

getConfigurationPoint

ConfigurationPoint getConfigurationPoint(java.lang.String configurationId,
                                         Module module)
Returns the configuration point.

Parameters:
configurationId - the fully qualified id of the configuration
module - the referencing module, used for visibility checks (null means no module, which requires that the configuration be public)
Returns:
ConfigurationPoint matching the configuration id
Throws:
ApplicationRuntimeException - if the configurationId does not exist (or is not visible)

getServicePoint

ServicePoint getServicePoint(java.lang.String serviceId,
                             Module module)
Returns the identified service extension point.

Parameters:
serviceId - fully qualified id of the service point
module - the referencing module, used for visibility checks (null means no module, which requires that the service be public)
Throws:
ApplicationRuntimeException - if no such service extension point exists (or is visible to the module)

getServiceModelFactory

ServiceModelFactory getServiceModelFactory(java.lang.String name)
Returns a named service-model factory


getLocale

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


getErrorHander

ErrorHandler getErrorHander()
Returns the ErrorHandler for this Registry.


containsConfiguration

boolean containsConfiguration(java.lang.String configurationId,
                              Module module)
Returns true if a configuration for the specified id exists (and is visible to the specified module).

Parameters:
configurationId - to search for
module - the configuration must be visible to, or null for no module (the application's view
Returns:
true if a configuration for the specified id exists (and is visible to the module)
Since:
1.1

containsService

boolean containsService(java.lang.Class serviceInterface,
                        Module module)
Returns true if a single service exists which implements the specified service interface and is visible to the given module.

Parameters:
serviceInterface -
module - the service must be visible to the module (or null for the application's view)
Returns:
true if a single visible service for the specified service interface exists
Since:
1.1

containsService

boolean containsService(java.lang.String serviceId,
                        java.lang.Class serviceInterface,
                        Module module)
Returns true if a single service with the given id exists which implements the specified service interface and is visible to the given module.

Parameters:
serviceId -
serviceInterface -
module - the service must be visible to the module (or null for the application's view)
Returns:
true if a single visible service for the specified service id and service interface exists
Since:
1.1

startup

void startup()
Invoked once, just after the registry infrastructure is constructed. One time startup operations occur, including execution of any contributions to hivemind.Startup.

Since:
1.1

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.

Since:
1.1

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

Since:
1.1

getServiceIds

java.util.List getServiceIds(java.lang.Class serviceInterface)
Parameters:
serviceInterface -

getModule

Module getModule(java.lang.String moduleId)
Returns the module with the corresponding module id.

Parameters:
moduleId -
Returns:
the module with the corresponding module id


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