|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hivemind.impl.RegistryInfrastructureImpl
public final class RegistryInfrastructureImpl
Implementation of RegistryInfrastructure
.
Constructor Summary | |
---|---|
RegistryInfrastructureImpl(ErrorHandler errorHandler,
java.util.Locale locale)
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RegistryInfrastructureImpl(ErrorHandler errorHandler, java.util.Locale locale)
Method Detail |
---|
public java.util.Locale getLocale()
RegistryInfrastructure
getLocale
in interface RegistryInfrastructure
public void addServicePoint(ServicePoint point)
public void addConfigurationPoint(ConfigurationPoint point)
public ServicePoint getServicePoint(java.lang.String serviceId, Module module)
RegistryInfrastructure
getServicePoint
in interface RegistryInfrastructure
serviceId
- 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)
RegistryInfrastructure
getService
in interface RegistryInfrastructure
serviceId
- 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)
RegistryInfrastructure
getService
in interface RegistryInfrastructure
serviceInterface
- 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)
RegistryInfrastructure
getConfigurationPoint
in interface RegistryInfrastructure
configurationId
- 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)
RegistryInfrastructure
getConfiguration
in interface RegistryInfrastructure
configurationId
- 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)
RegistryInfrastructure
retrieved as a Map
.
isConfigurationMappable
in interface RegistryInfrastructure
configurationId
- 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)
RegistryInfrastructure
Map
. It may
be empty, but not null.
getConfigurationAsMap
in interface RegistryInfrastructure
configurationId
- 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.Object
public java.lang.String expandSymbols(java.lang.String text, Location location)
RegistryInfrastructure
${
and }
delimiters) and an error is logged.
expandSymbols
in interface RegistryInfrastructure
text
- 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)
SymbolSource
valueForSymbol
in interface SymbolSource
public void setShutdownCoordinator(ShutdownCoordinator coordinator)
public void shutdown()
ShutdownCoordinator.shutdown()
, then releases the coordinator, modules and
variable sources.
shutdown
in interface RegistryInfrastructure
public 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 RegistryInfrastructure
public ServiceModelFactory getServiceModelFactory(java.lang.String name)
RegistryInfrastructure
getServiceModelFactory
in interface RegistryInfrastructure
public void cleanupThread()
RegistryInfrastructure
ThreadEventNotifier.fireThreadCleanup()
.
cleanupThread
in interface RegistryInfrastructure
public boolean containsConfiguration(java.lang.String configurationId, Module module)
RegistryInfrastructure
containsConfiguration
in interface RegistryInfrastructure
configurationId
- to search formodule
- the configuration must be visible to, or null for no module (the application's
view
public boolean containsService(java.lang.Class serviceInterface, Module module)
RegistryInfrastructure
containsService
in interface RegistryInfrastructure
module
- 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)
RegistryInfrastructure
containsService
in interface RegistryInfrastructure
module
- the service must be visible to the module (or null for the application's view)
public ErrorHandler getErrorHander()
RegistryInfrastructure
ErrorHandler
for this Registry.
getErrorHander
in interface RegistryInfrastructure
public Translator getTranslator(java.lang.String constructor)
RegistryInfrastructure
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
).
getTranslator
in interface RegistryInfrastructure
constructor
- the name and optional initialization of a Translator
Translator
instancepublic java.lang.Object getServiceFromToken(ServiceToken token)
ServiceSerializationSupport
getServiceFromToken
in interface ServiceSerializationSupport
public ServiceToken getServiceTokenForService(java.lang.String serviceId)
ServiceSerializationSupport
ServiceToken
corresponding to the indicated serviceId. A ServiceToken takes
the place of a service (proxy) during serialization.
getServiceTokenForService
in interface ServiceSerializationSupport
public void setupThread()
setupThread
in interface RegistryInfrastructure
ServiceSerializationHelper
,
ServiceSerializationSupport
public Module getModule(java.lang.String moduleId)
RegistryInfrastructure
getModule
in interface RegistryInfrastructure
public java.util.List getServiceIds(java.lang.Class serviceInterface)
getServiceIds
in interface RegistryInfrastructure
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |