public final class RegistryInfrastructureImpl extends java.lang.Object implements RegistryInfrastructure, ServiceSerializationSupport
RegistryInfrastructure.| Constructor and Description |
|---|
RegistryInfrastructureImpl(ErrorHandler errorHandler,
java.util.Locale locale) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConfigurationPoint(ConfigurationPoint point) |
void |
addServicePoint(ServicePoint point) |
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.String |
expandSymbols(java.lang.String text,
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,
Module module)
Returns the converted items contributed to the configuration point.
|
java.util.Map |
getConfigurationAsMap(java.lang.String configurationId,
Module module)
Returns the elements of the given configuration point as an unmodifiable
Map. |
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.lang.Object |
getServiceFromToken(ServiceToken token)
Returns the service (proxy) for the indicated token.
|
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.
|
ServiceToken |
getServiceTokenForService(java.lang.String serviceId)
Returns a
ServiceToken corresponding to the indicated serviceId. |
Translator |
getTranslator(java.lang.String constructor)
Gets a
Translator instance. |
boolean |
isConfigurationMappable(java.lang.String configurationId,
Module module)
Returns true if the elements contributed to the given configuration point can be
retrieved as a Map. |
void |
setShutdownCoordinator(ShutdownCoordinator coordinator) |
void |
setupThread()
Sets the current RI up as the ServiceSerializationSupport.
|
void |
shutdown()
Invokes
ShutdownCoordinator.shutdown(), then releases the coordinator, modules and
variable sources. |
void |
startup()
Starts up the Registry after all service and configuration points have been defined.
|
java.lang.String |
toString() |
java.lang.String |
valueForSymbol(java.lang.String name)
Returns the value for the symbol, if this source can provide one.
|
public RegistryInfrastructureImpl(ErrorHandler errorHandler, java.util.Locale locale)
public java.util.Locale getLocale()
RegistryInfrastructuregetLocale in interface RegistryInfrastructurepublic void addServicePoint(ServicePoint point)
public void addConfigurationPoint(ConfigurationPoint point)
public ServicePoint getServicePoint(java.lang.String serviceId, Module module)
RegistryInfrastructuregetServicePoint in interface RegistryInfrastructureserviceId - fully qualified id of the service pointmodule - the referencing module, used for visibility checks (null means no module, which
requires that the service be public)public java.lang.Object getService(java.lang.String serviceId, java.lang.Class serviceInterface, Module module)
RegistryInfrastructuregetService in interface RegistryInfrastructureserviceId - the fully qualified id of the service to obtainserviceInterface - the class to which the service will be castmodule - the referencing module, used for visibility checks (null means no module, which
requires that the service be public)public java.lang.Object getService(java.lang.Class serviceInterface, Module module)
RegistryInfrastructuregetService in interface RegistryInfrastructureserviceInterface - used to locate the servicemodule - the referencing module, used for visibility checks. If null, then only public
service points will be considered.public ConfigurationPoint getConfigurationPoint(java.lang.String configurationId, Module module)
RegistryInfrastructuregetConfigurationPoint in interface RegistryInfrastructureconfigurationId - the fully qualified id of the configurationmodule - the referencing module, used for visibility checks (null means no module, which
requires that the configuration be public)public java.util.List getConfiguration(java.lang.String configurationId, Module module)
RegistryInfrastructuregetConfiguration in interface RegistryInfrastructureconfigurationId - the fully qualified id of the configurationmodule - the referencing module, used for visibility checks (null means no module, which
requires that the configuration be public)public boolean isConfigurationMappable(java.lang.String configurationId, Module module)
RegistryInfrastructureretrieved as a Map.isConfigurationMappable in interface RegistryInfrastructureconfigurationId - the fully qualified id of the configurationmodule - the referencing module, used for visibility checks (null means no module, which
requires that the configuration be public)Module.isConfigurationMappable(String)public java.util.Map getConfigurationAsMap(java.lang.String configurationId, Module module)
RegistryInfrastructureMap. It may
be empty, but not null.getConfigurationAsMap in interface RegistryInfrastructureconfigurationId - the fully qualified id of the configurationmodule - the referencing module, used for visibility checks (null means no module, which
requires that the configuration be public)Module.getConfigurationAsMap(String),
#isConfigurationMappable(String)public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String expandSymbols(java.lang.String text, Location location)
RegistryInfrastructure${ and } delimiters) and an error is logged.expandSymbols in interface RegistryInfrastructuretext - 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.public java.lang.String valueForSymbol(java.lang.String name)
SymbolSourcevalueForSymbol in interface SymbolSourcepublic void setShutdownCoordinator(ShutdownCoordinator coordinator)
public void shutdown()
ShutdownCoordinator.shutdown(), then releases the coordinator, modules and
variable sources.shutdown in interface RegistryInfrastructurepublic void startup()
This instance is stored into
ServiceSerializationHelper.setServiceSerializationSupport(ServiceSerializationSupport).
This may cause errors (and incorrect behavior) if multiple Registries exist in a single JVM.
In addition, the service hivemind.Startup is obtained and run()
is invoked on it. This allows additional startup, provided in the
hivemind.Startup configuration point, to be executed.
startup in interface RegistryInfrastructurepublic ServiceModelFactory getServiceModelFactory(java.lang.String name)
RegistryInfrastructuregetServiceModelFactory in interface RegistryInfrastructurepublic void cleanupThread()
RegistryInfrastructureThreadEventNotifier.fireThreadCleanup().cleanupThread in interface RegistryInfrastructurepublic boolean containsConfiguration(java.lang.String configurationId, Module module)
RegistryInfrastructurecontainsConfiguration in interface RegistryInfrastructureconfigurationId - to search formodule - the configuration must be visible to, or null for no module (the application's
viewpublic boolean containsService(java.lang.Class serviceInterface, Module module)
RegistryInfrastructurecontainsService in interface RegistryInfrastructuremodule - the service must be visible to the module (or null for the application's view)public boolean containsService(java.lang.String serviceId, java.lang.Class serviceInterface, Module module)
RegistryInfrastructurecontainsService in interface RegistryInfrastructuremodule - the service must be visible to the module (or null for the application's view)public ErrorHandler getErrorHander()
RegistryInfrastructureErrorHandler for this Registry.getErrorHander in interface RegistryInfrastructurepublic Translator getTranslator(java.lang.String constructor)
RegistryInfrastructureTranslator 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).getTranslator in interface RegistryInfrastructureconstructor - the name and optional initialization of a TranslatorTranslator instancepublic java.lang.Object getServiceFromToken(ServiceToken token)
ServiceSerializationSupportgetServiceFromToken in interface ServiceSerializationSupportpublic ServiceToken getServiceTokenForService(java.lang.String serviceId)
ServiceSerializationSupportServiceToken corresponding to the indicated serviceId. A ServiceToken takes
the place of a service (proxy) during serialization.getServiceTokenForService in interface ServiceSerializationSupportpublic void setupThread()
setupThread in interface RegistryInfrastructureServiceSerializationHelper,
ServiceSerializationSupportpublic Module getModule(java.lang.String moduleId)
RegistryInfrastructuregetModule in interface RegistryInfrastructurepublic java.util.List getServiceIds(java.lang.Class serviceInterface)
getServiceIds in interface RegistryInfrastructure