public class RegistryWrapper extends java.lang.Object implements Registry
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
clusterName
The name of the cluster the component/service which uses this wrapper
belongs to.
|
protected boolean |
earlyService
Whether the component/service using this wrapper is an early service for
which initially only the local security manager is available.
|
protected java.lang.String |
hierInstName
The name of the component/service which uses this wrapper.
|
protected InstanceToInstanceRegistry |
modelFactoryRegistry
The model factory registry for this wrapping registry.
|
protected ModelViewerProvider |
modelViewerProvider
The provider for retrieving model views.
|
protected java.lang.String |
nodeName
The unique name of the node this registry and the using service belong to.
|
protected LocalServiceRegistry |
registry
The registry to which the requests are forwarded.
|
protected SerialisablePair<java.lang.String,java.lang.String> |
release
The release of the bootstrap registry.
|
| Modifier | Constructor and Description |
|---|---|
protected |
RegistryWrapper(java.lang.String clusterName,
java.lang.String nodeName,
SerialisablePair<java.lang.String,java.lang.String> release,
java.lang.String hierInstName,
boolean earlyService,
LocalServiceRegistry registry,
InstanceToInstanceRegistry modelFactoryRegistry,
ModelViewerProvider modelViewerProvider)
Creates a new wrapper for wrapping a service registry and the name of a
component/service instance.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getClusterName()
Gets the name of the cluster this registry and the using service belong to.
|
java.lang.String |
getComponentType(java.lang.String instName)
Returns the name of the component type of the designated component
instance as used in configuration files.
|
<T> T |
getConfiguredPlugin(SessionToken session,
java.lang.Object usingInstance,
java.lang.String pluginTypeName,
java.lang.Class<T> componentType)
Retrieves the default plugin of the designated type which is configured for
the designated (using) instance.
|
<T> T |
getConfiguredPlugin(SessionToken session,
java.lang.Object usingInstance,
java.lang.String pluginTypeName,
java.lang.Class<T> componentType,
java.lang.String pluginInstanceName)
Retrieves the plugin having the designated type and instance name as well
as type and which is configured for the designated (using) instance.
|
<T> java.util.Map<java.lang.String,T> |
getConfiguredPlugins(SessionToken session,
java.lang.Object usingInstance,
java.lang.String pluginTypeName,
java.lang.Class<T> pluginType)
Retrieves all plugin instances (pre-configured and dynamic) of the
designated plugin type.
|
java.lang.String |
getFormattedSignature(java.lang.Class<?>[] parameterTypes)
Helper method for getting a string describing the parameter types as method
signature for use in log messages and exceptions.
|
java.util.concurrent.atomic.AtomicLong |
getGlobalSequence(java.lang.String seqName)
Gets the sequence of the designated name.
|
java.lang.String |
getHierarchicalInstanceName(java.lang.String componentType,
java.lang.String simpleName)
Returns a hierarchical instance name containing the component type as well
as the instance name.
|
java.lang.String |
getInstanceName()
Gets the hierarchical instance name of the service using this registry.
|
java.lang.Class<?> |
getInterfaceForComponentType(java.lang.String componentType)
Returns the class object of the corresponding interface / superclass, if
the component type is declared.
|
<T> T |
getModelFactory(java.lang.String modelFactoryName,
java.lang.Class<T> modelFactoryType)
Gets the designated model factory registry.
|
java.lang.Class<?> |
getModelViewerClass(java.lang.String pluginID)
Gets the model viewer class for the designated plugin ID that allows
type-save access to plugin data at model elements.
|
SerialisablePair<java.lang.String,java.lang.String> |
getRelease()
Gets the release of the bootstrap registry, that is, the build version and the build date.
|
SecurityManager |
getSecurityManager()
Gets the security manager of the system.
|
<T extends ADEPT2Service> |
getService(SessionToken session,
java.lang.String serviceName,
java.lang.Class<T> serviceType)
Returns the designated service which is either a local service or a service
stub that is retrieved from the global registry if the service is not known
to this registry but to the global registry.
|
<T extends ADEPT2Service> |
getService(SessionToken session,
java.net.URI[] serviceURIs,
java.lang.Class<T> serviceType)
Retrieves the service described by the URIs which is either a local service
stub that is retrieved from the global registry if the service is not known
to this registry but to the global registry.
|
<T extends ADEPT2Service> |
getServiceOfType(SessionToken session,
java.lang.String serviceTypeName,
java.lang.Class<T> serviceType)
Returns the service instance of the designated service type which is
configured for usage by this (the requesting) service instance.
|
java.lang.String |
getSimpleInstanceName(java.lang.String instName)
Returns the simple name of the designated component instance as used in
configuration files.
|
java.lang.String |
getUniqueNodeName()
Gets the unique name of the node this registry and the using service belong to.
|
boolean |
isEarlyService()
Gets whether the service using this registry is an early service and thus
uses the local security manager first.
|
boolean |
registryActive()
Gets whether the underlying registry is active, that is, it has signalled
its start and is not being shut down.
|
protected final java.lang.String clusterName
protected final java.lang.String nodeName
protected final SerialisablePair<java.lang.String,java.lang.String> release
protected final java.lang.String hierInstName
protected final boolean earlyService
protected final LocalServiceRegistry registry
protected final InstanceToInstanceRegistry modelFactoryRegistry
protected final ModelViewerProvider modelViewerProvider
protected RegistryWrapper(java.lang.String clusterName,
java.lang.String nodeName,
SerialisablePair<java.lang.String,java.lang.String> release,
java.lang.String hierInstName,
boolean earlyService,
LocalServiceRegistry registry,
InstanceToInstanceRegistry modelFactoryRegistry,
ModelViewerProvider modelViewerProvider)
clusterName - The name of the cluster the component/service which uses
this wrapper belongs to.nodeName - The unique name of the node this registry and the using service belong to.release - The release of the bootstrap registry.hierInstName - The name of the component/service which uses this
wrapper.earlyService - Whether the component/service is an early service for
which initially only the local security manager is available.registry - The registry to which the requests are forwarded.modelFactoryRegistry - The model factory registry for this wrapping
registry.modelViewerProvider - The provider for retrieving model views.public <T extends ADEPT2Service> T getServiceOfType(SessionToken session, java.lang.String serviceTypeName, java.lang.Class<T> serviceType) throws ServiceNotKnownException
ServiceAccessgetServiceOfType in interface ServiceAccessT - The type which the requested service is expected to be of. This
is a subtype of ADEPT2Service and either the
registered service type or a super type hereof.session - The session which is used to check for access rights on this
method.serviceTypeName - The type name of the requested service. Refer to
ComponentTypes and
BaseConstants for valid
predefined service type names. Other service type names are also
valid if the corresponding services are configured appropriately.
ADEPT2Service and the interface configured for the
service type or a super type hereof.serviceType - The type of the requested service. This is a subtype of
ADEPT2Service and the interface configured for the
service type or a super type hereof.ServiceNotKnownException - If
ADEPT2Service
-interface appropriately,ServiceNotKnownException will be thrown. This may
encapsulate a ConfigurationException or an
AbortServiceException.public <T> T getModelFactory(java.lang.String modelFactoryName,
java.lang.Class<T> modelFactoryType)
throws ServiceNotKnownException
ServiceAccessgetModelFactory in interface ServiceAccessT - The type of the requested model factory registry.modelFactoryName - The name of the requested model factory. Use the
names declared in
ModelRegistryConstants. No
other model factory registries need to exist.modelFactoryType - The type of the requested model factory registry.ServiceNotKnownException - If
ServiceNotKnownException wrapping a
ConfigurationException will be thrown.public java.lang.Class<?> getModelViewerClass(java.lang.String pluginID)
ModelViewerProvidernull will be
returned. This ID usually equals the ID of the (service-) plugin that uses
the model viewer.getModelViewerClass in interface ModelViewerProviderpluginID - The ID of the plugin for which to retrieve a model viewer,
this ID is usually the same ID as the one of the (service-) plugin
using the plugin data.null in case there is no model viewer for the
designated plugin ID configured.public <T> T getConfiguredPlugin(SessionToken session, java.lang.Object usingInstance, java.lang.String pluginTypeName, java.lang.Class<T> componentType) throws ServiceNotKnownException
ServiceAccessServiceAccess.getConfiguredPlugin(SessionToken, Object, String, Class, String)
except that the default plugin instance is used, that is the first
configured one. Therefore this will not be a runtime plugin.getConfiguredPlugin in interface ServiceAccessT - The type of the requested plugin.session - The session which is used to check for access rights on this
method.usingInstance - The instance which is using the plugin and which is
provided in to the plugin when creating it. This allows the plugin
to access the instance it extends.pluginTypeName - The component type of the plugin instance to be
retrieved for usage. This may neither be null nor the empty
string. The type name is specified in the configuration.componentType - The type of the requested plugin.ServiceNotKnownException - If
ServiceNotKnownException wrapping a
ConfigurationException will be thrown.public <T> java.util.Map<java.lang.String,T> getConfiguredPlugins(SessionToken session, java.lang.Object usingInstance, java.lang.String pluginTypeName, java.lang.Class<T> pluginType) throws ServiceNotKnownException
ServiceAccessgetConfiguredPlugins in interface ServiceAccessT - The plugin type of the requested instances.session - The session which is used to check for access rights on this
method.usingInstance - The instance which is using the plugins and which is
provided to the plugins when creating them. This allows the
plugins to access the instance it extends.pluginTypeName - The component type of the plugin instance to be
retrieved for usage. This may neither be null nor the empty
string. The type name is specified in the configuration.pluginType - The type of the requested plugin.ServiceNotKnownException - If
ServiceNotKnownException wrapping a
ConfigurationException will be thrown.public <T> T getConfiguredPlugin(SessionToken session, java.lang.Object usingInstance, java.lang.String pluginTypeName, java.lang.Class<T> componentType, java.lang.String pluginInstanceName) throws ServiceNotKnownException
ServiceAccessgetConfiguredPlugin in interface ServiceAccessT - The type of the requested plugin.session - The session which is used to check for access rights on this
method.usingInstance - The instance which is using the plugin and which is
provided in to the plugin when creating it. This allows the plugin
to access the instance it extends.pluginTypeName - The component type of the plugin instance to be
retrieved for usage. This may neither be null nor the empty
string. The type name is specified in the configuration.componentType - The type of the requested plugin.pluginInstanceName - The simple name of the plugin instance to
retrieve. This is either configured in the server/client
configuration or in a configuration found at runtime.ServiceNotKnownException - If
ServiceNotKnownException wrapping a
ConfigurationException will be thrown.public <T extends ADEPT2Service> T getService(SessionToken session, java.lang.String serviceName, java.lang.Class<T> serviceType) throws ServiceNotKnownException
ServiceAccessgetService in interface ServiceAccessT - The type of the requested service. This is a subtype of
ADEPT2Service and either interface configured for the
service type or a super type hereof.session - The session which is used to check for access rights on this
method.serviceName - The hierarchical instance name of the service.serviceType - The type of the requested service. This is a subtype of
ADEPT2Service and the interface configured for the
service type or a super type hereof.ServiceNotKnownException - If
ADEPT2Service
-interface appropriately,ServiceNotKnownException will be thrown. This may
encapsulate a ConfigurationException or an
AbortServiceException.public <T extends ADEPT2Service> T getService(SessionToken session, java.net.URI[] serviceURIs, java.lang.Class<T> serviceType) throws ServiceNotKnownException
ServiceAccessgetService in interface ServiceAccessT - The type of the requested service. This is a subtype of
ADEPT2Service and either interface configured for the
service type or a super type hereof.session - The session which is used to check for access rights on this
method.serviceURIs - The URIs of the service to be retrieved, the array has
to contain at least one valid service URI.serviceType - The type of the requested service. This is a subtype of
ADEPT2Service and the interface configured for the
service type or a super type hereof.ServiceNotKnownException - If
ADEPT2Service
-interface appropriately,ServiceNotKnownException will be thrown. This may
encapsulate a ConfigurationException or an
AbortServiceException.public SecurityManager getSecurityManager()
RegistrygetSecurityManager in interface Registrypublic boolean isEarlyService()
RegistryisEarlyService in interface Registrypublic java.lang.String getClusterName()
RegistrygetClusterName in interface Registrypublic java.lang.String getUniqueNodeName()
RegistrygetUniqueNodeName in interface Registrypublic SerialisablePair<java.lang.String,java.lang.String> getRelease()
RegistrygetRelease in interface Registrypublic java.lang.String getInstanceName()
RegistrygetInstanceName in interface Registrypublic java.util.concurrent.atomic.AtomicLong getGlobalSequence(java.lang.String seqName)
RegistrygetGlobalSequence in interface RegistryseqName - The name of the platform-wide sequence. This name is arbitrary but should be
shared among the services that share the sequence.public boolean registryActive()
RegistryregistryActive in interface Registrypublic java.lang.String getHierarchicalInstanceName(java.lang.String componentType,
java.lang.String simpleName)
NameResolution/ProcessManager/PM1.getHierarchicalInstanceName in interface NameResolutioncomponentType - The type of the component to create the hierarchical
name for.simpleName - The simple name of the component instance as defined in
the configuration.public java.lang.String getSimpleInstanceName(java.lang.String instName)
NameResolutiongetSimpleInstanceName in interface NameResolutioninstName - The hierarchical name of a component instance.public java.lang.String getComponentType(java.lang.String instName)
NameResolutiongetComponentType in interface NameResolutioninstName - The hierarchical name of a component instance.public java.lang.String getFormattedSignature(java.lang.Class<?>[] parameterTypes)
NameResolutiongetFormattedSignature in interface NameResolutionparameterTypes - All the parameter types of a method as instances of
Class.public java.lang.Class<?> getInterfaceForComponentType(java.lang.String componentType)
throws ConfigurationException
ServiceAccessConfigurationException. This method must not to be called
by clients; it is only for the registry and the communication framework.getInterfaceForComponentType in interface ServiceAccesscomponentType - The name of the component type of which to retrieve
the configured interface.ConfigurationException - If the designated component type is not
configured for this registry, a
ConfigurationException will be thrown.