Class RegistryWrapper
- java.lang.Object
- 
- de.aristaflow.adept2.base.registry.RegistryWrapper
 
- 
- All Implemented Interfaces:
- NameResolution,- Registry,- ServiceAccess,- ModelViewerProvider
 
 public class RegistryWrapper extends Object implements Registry A registry wrapper provides access to specific registry methods to a normal component/service. Besides a registry it also wraps the instance name of the component/service instance.
- 
- 
Field SummaryFields Modifier and Type Field Description protected StringclusterNameThe name of the cluster the component/service which uses this wrapper belongs to.protected booleanearlyServiceWhether the component/service using this wrapper is an early service for which initially only the local security manager is available.protected StringhierInstNameThe name of the component/service which uses this wrapper.protected InstanceToInstanceRegistrymodelFactoryRegistryThe model factory registry for this wrapping registry.protected ModelViewerProvidermodelViewerProviderThe provider for retrieving model views.protected StringnodeNameThe unique name of the node this registry and the using service belong to.protected LocalServiceRegistryregistryThe registry to which the requests are forwarded.protected SerialisablePair<String,String>releaseThe release of the bootstrap registry.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedRegistryWrapper(String clusterName, String nodeName, SerialisablePair<String,String> release, 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.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetClusterName()Gets the name of the cluster this registry and the using service belong to.StringgetComponentType(String instName)Returns the name of the component type of the designated component instance as used in configuration files.<T> TgetConfiguredPlugin(SessionToken session, Object usingInstance, String pluginTypeName, Class<T> componentType)Retrieves the default plugin of the designated type which is configured for the designated (using) instance.<T> TgetConfiguredPlugin(SessionToken session, Object usingInstance, String pluginTypeName, Class<T> componentType, 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> Map<String,T>getConfiguredPlugins(SessionToken session, Object usingInstance, String pluginTypeName, Class<T> pluginType)Retrieves all plugin instances (pre-configured and dynamic) of the designated plugin type.Map<String,Class<?>>getConfiguredPluginTypes(SessionToken session)Retrieves all plugin types declared for the instance using this interface.StringgetFormattedSignature(Class<?>[] parameterTypes)Helper method for getting a string describing the parameter types as method signature for use in log messages and exceptions.AtomicLonggetGlobalSequence(String seqName)Gets the sequence of the designated name.StringgetHierarchicalInstanceName(String componentType, String simpleName)Returns a hierarchical instance name containing the component type as well as the instance name.StringgetInstanceName()Gets the hierarchical instance name of the service using this registry.Class<?>getInterfaceForComponentType(String componentType)Returns the class object of the corresponding interface / superclass, if the component type is declared.<T> TgetModelFactory(String modelFactoryName, Class<T> modelFactoryType)Gets the designated model factory registry.Class<?>getModelViewerClass(String pluginID)Gets the model viewer class for the designated plugin ID that allows type-save access to plugin data at model elements.Pair<String,String>getNames(String instName)Gets the component type name and the simple instance name of the designated component instance at once.SerialisablePair<String,String>getRelease()Gets the release of the bootstrap registry, that is, the build version and the build date.SecurityManagergetSecurityManager()Gets the security manager of the system.<T extends ADEPT2Service>
 TgetService(SessionToken session, String serviceName, 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>
 TgetService(SessionToken session, URI[] serviceURIs, 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>
 TgetServiceOfType(SessionToken session, String serviceTypeName, Class<T> serviceType)Returns the service instance of the designated service type which is configured for usage by this (the requesting) service instance.StringgetSimpleInstanceName(String instName)Returns the simple name of the designated component instance as used in configuration files.StringgetUniqueNodeName()Gets the unique name of the node this registry and the using service belong to.booleanisEarlyService()Gets whether the service using this registry is an early service and thus uses the local security manager first.booleanregistryActive()Gets whether the underlying registry is active, that is, it has signalled its start and is not being shut down.
 
- 
- 
- 
Field Detail- 
clusterNameprotected final String clusterName The name of the cluster the component/service which uses this wrapper belongs to.
 - 
nodeNameprotected final String nodeName The unique name of the node this registry and the using service belong to.
 - 
releaseprotected final SerialisablePair<String,String> release The release of the bootstrap registry.
 - 
hierInstNameprotected final String hierInstName The name of the component/service which uses this wrapper.
 - 
earlyServiceprotected final boolean earlyService Whether the component/service using this wrapper is an early service for which initially only the local security manager is available.
 - 
registryprotected final LocalServiceRegistry registry The registry to which the requests are forwarded.
 - 
modelFactoryRegistryprotected final InstanceToInstanceRegistry modelFactoryRegistry The model factory registry for this wrapping registry.
 - 
modelViewerProviderprotected final ModelViewerProvider modelViewerProvider The provider for retrieving model views.
 
- 
 - 
Constructor Detail- 
RegistryWrapperprotected RegistryWrapper(String clusterName, String nodeName, SerialisablePair<String,String> release, 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.- Parameters:
- 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.
 
 
- 
 - 
Method Detail- 
getServiceOfTypepublic <T extends ADEPT2Service> T getServiceOfType(SessionToken session, String serviceTypeName, Class<T> serviceType) throws ServiceNotKnownException Description copied from interface:ServiceAccessReturns the service instance of the designated service type which is configured for usage by this (the requesting) service instance. If no special service instance is configured for usage, the default instance of the requested service type will be returned.- Specified by:
- getServiceOfTypein interface- ServiceAccess
- Type Parameters:
- T- The type which the requested service is expected to be of. This is a subtype of- ADEPT2Serviceand either the registered service type or a super type hereof.
- Parameters:
- session- The session which is used to check for access rights on this method.
- serviceTypeName- The type name of the requested service. Refer to- ComponentTypesand- BaseConstantsfor valid predefined service type names. Other service type names are also valid if the corresponding services are configured appropriately.- ADEPT2Serviceand the interface configured for the service type or a super type hereof.
- serviceType- The type of the requested service. This is a subtype of- ADEPT2Serviceand the interface configured for the service type or a super type hereof.
- Returns:
- The requested service (or a service stub). The object is never null.
- Throws:
- ServiceNotKnownException- If- the service is not configured properly,
- the service cannot be created or started,
- a required service is not configured properly or cannot be started,
- the creation of a required service object fails,
- the service does not fulfil the ADEPT2Service-interface appropriately,
- an exception is thrown while creating or starting a required service,
 - ServiceNotKnownExceptionwill be thrown. This may encapsulate a- ConfigurationExceptionor an- AbortServiceException.
 
 - 
getModelFactorypublic <T> T getModelFactory(String modelFactoryName, Class<T> modelFactoryType) throws ServiceNotKnownException Description copied from interface:ServiceAccessGets the designated model factory registry.- Specified by:
- getModelFactoryin interface- ServiceAccess
- Type Parameters:
- T- The type of the requested model factory registry.
- Parameters:
- 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.
- Returns:
- The requested model factory registry. The object is never null.
- Throws:
- ServiceNotKnownException- If- the requested model factory registry is not configured properly,
- the requested model factory registry cannot be created,
 - ServiceNotKnownExceptionwrapping a- ConfigurationExceptionwill be thrown.
 
 - 
getModelViewerClasspublic Class<?> getModelViewerClass(String pluginID) Description copied from interface:ModelViewerProviderGets the model viewer class for the designated plugin ID that allows type-save access to plugin data at model elements. If there is no model viewer configured for the designated plugin ID,nullwill be returned. This ID usually equals the ID of the (service-) plugin that uses the model viewer.- Specified by:
- getModelViewerClassin interface- ModelViewerProvider
- Parameters:
- pluginID- 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.
- Returns:
- The model viewer class for the designated plugin ID or
         nullin case there is no model viewer for the designated plugin ID configured.
 
 - 
getConfiguredPluginTypespublic Map<String,Class<?>> getConfiguredPluginTypes(SessionToken session) Description copied from interface:ServiceAccessRetrieves all plugin types declared for the instance using this interface.- Specified by:
- getConfiguredPluginTypesin interface- ServiceAccess
- Parameters:
- session- The session which is used to check for access rights on this method.
- Returns:
- All plugin types (names and corresponding classes) declared for the instance using this interface. This map may be empty.
 
 - 
getConfiguredPluginpublic <T> T getConfiguredPlugin(SessionToken session, Object usingInstance, String pluginTypeName, Class<T> componentType) throws ServiceNotKnownException Description copied from interface:ServiceAccessRetrieves the default plugin of the designated type which is configured for the designated (using) instance. This is the same asServiceAccess.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.- Specified by:
- getConfiguredPluginin interface- ServiceAccess
- Type Parameters:
- T- The type of the requested plugin.
- Parameters:
- 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.
- Returns:
- The requested plugin instance. The object is never null.
- Throws:
- ServiceNotKnownException- If- the plugin type is not configured for the designated object,
- the plugin is not configured properly,
- the creation or the initialisation of the plugin instance fails,
 - ServiceNotKnownExceptionwrapping a- ConfigurationExceptionwill be thrown.
 
 - 
getConfiguredPluginspublic <T> Map<String,T> getConfiguredPlugins(SessionToken session, Object usingInstance, String pluginTypeName, Class<T> pluginType) throws ServiceNotKnownException Description copied from interface:ServiceAccessRetrieves all plugin instances (pre-configured and dynamic) of the designated plugin type. A new plugin instance will be created if an instance is not singleton or it has not been instantiated before.- Specified by:
- getConfiguredPluginsin interface- ServiceAccess
- Type Parameters:
- T- The plugin type of the requested instances.
- Parameters:
- 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.
- Returns:
- The requested plugin instances, indexed by their instance id. This map may be empty.
- Throws:
- ServiceNotKnownException- If- the plugin type is not configured for the designated object,
- the configuration of a plugin instance does not provide required configuration values,
- a plugin is not configured properly,
- the creation or the initialisation of a plugin instance fails,
 - ServiceNotKnownExceptionwill be thrown.
 
 - 
getConfiguredPluginpublic <T> T getConfiguredPlugin(SessionToken session, Object usingInstance, String pluginTypeName, Class<T> componentType, String pluginInstanceName) throws ServiceNotKnownException Description copied from interface:ServiceAccessRetrieves the plugin having the designated type and instance name as well as type and which is configured for the designated (using) instance. The designated using instance need to support plugins of the requested type. The plugin may be configured in the server/client configuration or it may be a runtime plugin that is found (together with its configuration) when requested. A new plugin instance will be created if the instance is not singleton or it has not been instantiated before.- Specified by:
- getConfiguredPluginin interface- ServiceAccess
- Type Parameters:
- T- The type of the requested plugin.
- Parameters:
- 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.
- Returns:
- The requested plugin instance. The object is never null.
- Throws:
- ServiceNotKnownException- If- the plugin type is not configured for the designated object,
- the plugin is not configured properly,
- the plugin is to be used as a runtime plugin but the designated object does not allow for runtime plugins,
- the plugin is to be used as a runtime plugin but it is not found,
- the creation or the initialisation of the plugin instance fails,
 - ServiceNotKnownExceptionwrapping a- ConfigurationExceptionwill be thrown.
 
 - 
getServicepublic <T extends ADEPT2Service> T getService(SessionToken session, String serviceName, Class<T> serviceType) throws ServiceNotKnownException Description copied from interface:ServiceAccessReturns 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.- Specified by:
- getServicein interface- ServiceAccess
- Type Parameters:
- T- The type of the requested service. This is a subtype of- ADEPT2Serviceand either interface configured for the service type or a super type hereof.
- Parameters:
- 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- ADEPT2Serviceand the interface configured for the service type or a super type hereof.
- Returns:
- The requested service (or a service stub). The object is never null.
- Throws:
- ServiceNotKnownException- If- the service is not configured properly,
- the service cannot be created or started,
- a required service is not configured properly or cannot be started,
- the creation of a required service object fails,
- the service does not fulfill the ADEPT2Service-interface appropriately,
- an exception is thrown while creating or starting a required service,
 - ServiceNotKnownExceptionwill be thrown. This may encapsulate a- ConfigurationExceptionor an- AbortServiceException.
 
 - 
getServicepublic <T extends ADEPT2Service> T getService(SessionToken session, URI[] serviceURIs, Class<T> serviceType) throws ServiceNotKnownException Description copied from interface:ServiceAccessRetrieves 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. An appropriate URI will be chosen, that is, a URI with a protocol supported by this registry.- Specified by:
- getServicein interface- ServiceAccess
- Type Parameters:
- T- The type of the requested service. This is a subtype of- ADEPT2Serviceand either interface configured for the service type or a super type hereof.
- Parameters:
- 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- ADEPT2Serviceand the interface configured for the service type or a super type hereof.
- Returns:
- The requested service (or a service stub). The object is never null.
- Throws:
- ServiceNotKnownException- If- no appropriate communication service is available for the designated URIs,
- the service is not configured properly,
- the service cannot be created or started,
- a required service is not configured properly or cannot be started,
- the creation of a required service object fails,
- the service does not fulfill the ADEPT2Service-interface appropriately,
- an exception is thrown while creating or starting a required service,
 - ServiceNotKnownExceptionwill be thrown. This may encapsulate a- ConfigurationExceptionor an- AbortServiceException.
 
 - 
getSecurityManagerpublic SecurityManager getSecurityManager() Description copied from interface:RegistryGets the security manager of the system. This allows for authenticating users.- Specified by:
- getSecurityManagerin interface- Registry
- Returns:
- The security manager of the system for authenticating users.
 
 - 
isEarlyServicepublic boolean isEarlyService() Description copied from interface:RegistryGets whether the service using this registry is an early service and thus uses the local security manager first. This means, that the service will have to re-authenticate after the global security manager has been set which in turn means changing the session factory while running.- Specified by:
- isEarlyServicein interface- Registry
- Returns:
- Whether the service using this registry is an early service and thus uses the local security manager first.
 
 - 
getClusterNamepublic String getClusterName() Description copied from interface:RegistryGets the name of the cluster this registry and the using service belong to. Use this name for identification purpose across clusters.- Specified by:
- getClusterNamein interface- Registry
- Returns:
- The name of the cluster this registry and the using service belong to.
 
 - 
getUniqueNodeNamepublic String getUniqueNodeName() Description copied from interface:RegistryGets the unique name of the node this registry and the using service belong to. Use this name for identification across started platforms.- Specified by:
- getUniqueNodeNamein interface- Registry
- Returns:
- The unique name of the node this registry and the using service belong to.
 
 - 
getReleasepublic SerialisablePair<String,String> getRelease() Description copied from interface:RegistryGets the release of the bootstrap registry, that is, the build version and the build date.- Specified by:
- getReleasein interface- Registry
- Returns:
- The build version and the build date of the bootstrap registry.
 
 - 
getInstanceNamepublic String getInstanceName() Description copied from interface:RegistryGets the hierarchical instance name of the service using this registry. Do not use this name for accessing the registry. If you need to do this, you are doing something wrong. Use this name for identification purpose like logging of the service.- Specified by:
- getInstanceNamein interface- Registry
- Returns:
- The hierarchical instance name of the service using this registry for identification purpose like logging.
 
 - 
getGlobalSequencepublic AtomicLong getGlobalSequence(String seqName) Description copied from interface:RegistryGets the sequence of the designated name. This sequence is platform-wide (i. e. bound to the running BPM platform/JVM) and may be shared among several service instances and even service types.- Specified by:
- getGlobalSequencein interface- Registry
- Parameters:
- seqName- The name of the platform-wide sequence. This name is arbitrary but should be shared among the services that share the sequence.
- Returns:
- An atomic long representing the designated sequence.
 
 - 
registryActivepublic boolean registryActive() Description copied from interface:RegistryGets whether the underlying registry is active, that is, it has signalled its start and is not being shut down.- Specified by:
- registryActivein interface- Registry
- Returns:
- Whether the underlying registry is active, that is, it has signalled its start and is not being shut down.
 
 - 
getHierarchicalInstanceNamepublic String getHierarchicalInstanceName(String componentType, String simpleName) Description copied from interface:NameResolutionReturns a hierarchical instance name containing the component type as well as the instance name. The returned string resembles, for instance,/ProcessManager/PM1.- Specified by:
- getHierarchicalInstanceNamein interface- NameResolution
- Parameters:
- componentType- The type of the component to create the hierarchical name for.
- simpleName- The simple name of the component instance as defined in the configuration.
- Returns:
- An instance name containing the component type and the simple component instance name.
 
 - 
getSimpleInstanceNamepublic String getSimpleInstanceName(String instName) Description copied from interface:NameResolutionReturns the simple name of the designated component instance as used in configuration files.- Specified by:
- getSimpleInstanceNamein interface- NameResolution
- Parameters:
- instName- The hierarchical name of a component instance.
- Returns:
- The simple name without the prepending type of the component instance.
 
 - 
getComponentTypepublic String getComponentType(String instName) Description copied from interface:NameResolutionReturns the name of the component type of the designated component instance as used in configuration files.- Specified by:
- getComponentTypein interface- NameResolution
- Parameters:
- instName- The hierarchical name of a component instance.
- Returns:
- The name of the component type.
 
 - 
getNamespublic Pair<String,String> getNames(String instName) Description copied from interface:NameResolutionGets the component type name and the simple instance name of the designated component instance at once.- Specified by:
- getNamesin interface- NameResolution
- Parameters:
- instName- The hierarchical name of a component instance.
- Returns:
- The name of the component type and the simple name of the designated component instance.
 
 - 
getFormattedSignaturepublic String getFormattedSignature(Class<?>[] parameterTypes) Description copied from interface:NameResolutionHelper method for getting a string describing the parameter types as method signature for use in log messages and exceptions.- Specified by:
- getFormattedSignaturein interface- NameResolution
- Parameters:
- parameterTypes- All the parameter types of a method as instances of- Class.
- Returns:
- A string describing the parameter types as method signature (concatenated and surrounded by parenthesis).
 
 - 
getInterfaceForComponentTypepublic Class<?> getInterfaceForComponentType(String componentType) throws ConfigurationException Description copied from interface:ServiceAccessReturns the class object of the corresponding interface / superclass, if the component type is declared. If not, the method throws aConfigurationException. This method must not to be called by clients; it is only for the registry and the communication framework.- Specified by:
- getInterfaceForComponentTypein interface- ServiceAccess
- Parameters:
- componentType- The name of the component type of which to retrieve the configured interface.
- Returns:
- The class object of the corresponding interface / superclass.
- Throws:
- ConfigurationException- If the designated component type is not configured for this registry, a- ConfigurationExceptionwill be thrown.
 
 
- 
 
-