org.apache.hivemind.internal
Interface RegistryInfrastructure

All Known Implementing Classes:
RegistryImpl

public interface RegistryInfrastructure

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

Author:
Howard Lewis Ship

Method Summary
 java.lang.String expandSymbols(java.lang.String input, Location location)
          Expands any substitution symbols in the input string, replacing each symbol with the symbols value (if known).
 java.util.List getConfiguration(java.lang.String configurationId)
          Returns the converted items contributed to the configuration point.
 ConfigurationPoint getConfigurationPoint(java.lang.String configurationId)
          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.
 java.lang.Object getService(java.lang.String serviceId, java.lang.Class serviceInterface)
          Obtains a service from the registry.
 ServiceModelFactory getServiceModelFactory(java.lang.String name)
          Returns a named service-model factory
 ServicePoint getServicePoint(java.lang.String serviceId)
          Returns the identified service extension point.
 Translator getTranslator(java.lang.String translator)
          Gets a Translator instance.
 

Method Detail

getService

public 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

getConfiguration

public java.util.List getConfiguration(java.lang.String configurationId)
Returns the converted items contributed to the configuration point.

Parameters:
configurationId - the fully qualified id of the configuration
Throws:
ApplicationRuntimeException - if no such configuration extension point exists

getConfigurationPoint

public ConfigurationPoint getConfigurationPoint(java.lang.String configurationId)
Returns the configuration point.

Parameters:
configurationId - the fully qualified id of the configuration
Returns:
ConfigurationPoint matching the configuration id
Throws:
ApplicationRuntimeException - if the configurationId does not exist

getServicePoint

public ServicePoint getServicePoint(java.lang.String serviceId)
Returns the identified service extension point.

Parameters:
serviceId - fully qualified id of the service point
Throws:
ApplicationRuntimeException - if no such service extension point exists

expandSymbols

public java.lang.String expandSymbols(java.lang.String input,
                                      Location location)
Expands any substitution symbols in the input string, replacing each symbol with the symbols value (if known). If a symbol is unknown, then the symbol is passed through unchanged (complete with the ${ and } delimiters) and an error is logged.

Parameters:
input - input string to be converted, which may (or may not) contain any symbols.
location - the location from which the string was obtained, used if an error is logged.

getServiceModelFactory

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


getTranslator

public Translator getTranslator(java.lang.String translator)
Gets a Translator instance. The Translator may be a shared, cached instance (Translators should be stateless). Translators are identified by a constructor, which may be the name of a translator defined in the hivemind.Translators extension point (a single builtin translator, class, is hardcoded). Alternately, the name may consist of a translator name, a comma, and an initializer string for the service (example: int,min=5).

Returns:
a Translator instance
Throws:
ApplicationRuntimeException - if the translator can not be constructed (i.e., the name is not known)

getLocale

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


getErrorHander

public ErrorHandler getErrorHander()
Returns the ErrorHandler for this Registry.