Class MultiplexingClientService

    • Field Detail

      • sessionServiceMapping

        protected final Map<String,​ADEPT2ClientService> sessionServiceMapping
        Mapping between a user-session-ID and an ADEPT2 client service.
      • activeAgentLock

        protected final ReadWriteLock activeAgentLock
        The lock for synchronising all access concerning the active agent, which is mainly sessionServiceMapping.
    • Constructor Detail

      • MultiplexingClientService

        public MultiplexingClientService​(org.apache.commons.configuration2.Configuration configuration,
                                         Registry registry)
                                  throws ConfigurationException
        Creates a MultiplexingClientService with the designated registry, a logger for this and the designated required services.
        Parameters:
        configuration - The configuration providing the logon credentials for this service.
        registry - The registry to be used for accessing services by this service. This is provided as parameter to the constructor when creating a service.
        Throws:
        ConfigurationException - If the password for this authenticated service cannot be parsed from the configuration, a ConfigurationException will be thrown.
    • Method Detail

      • init

        public void init​(URI[] localExportedUris,
                         URI[] globalExportedUris)
                  throws AbortServiceException
        Description copied from class: AbstractAuthenticatedService
        Copies the designated URI array and stores it internally and authenticates to the system and sets the session factory.
        This method can be called any time in overriding init-methods.

        In case of an early service, this will not authenticate to the system! Such a service need to AbstractAuthenticatedService.authenticateService() later when the security manager is available.

        Specified by:
        init in interface ADEPT2Service
        Overrides:
        init in class AbstractAuthenticatedService
        Parameters:
        localExportedUris - The URIs with which this service is exported locally or a local URI or an empty array for internal services.
        globalExportedUris - The URIs with which this service is published globally or null in case the service is not published.
        Throws:
        AbortServiceException - If authenticating at the security manager fails, an AbortServiceException will be thrown.
      • getAvailableLocales

        public Locale[] getAvailableLocales()
        Gets the locales the client supports, that is, the locales found as resources. This allows the user to choose an appropriate one in case the client does not have the locale the user prefers. The locales are global with respect to all client services, that is there is one array of locales for all user sessions.
        Specified by:
        getAvailableLocales in interface ClientService
        Returns:
        The locales available for the client.
      • getExecutorService

        public ExecutorService getExecutorService()
        Gets an ExecutorService for executing long lasting tasks asynchronously. Please do not start own threads but use this executor service instead otherwise the shutdown of the client will not work correctly since the threads cannot be reached. However, if you do, you will be responsible for terminating the threads correctly when shutting down.
        The returned service must not be shutdown; this is done by implementations of the client service. Additionally, it must not be configured since it is re-used for all users of the client service. The executor service is global with respect to all client services, that is there is only one for all user sessions.
        Specified by:
        getExecutorService in interface ClientService
        Returns:
        An ExecutorService for executing long lasting task asynchronously instead of creating own (local) threads.
      • getScheduledExecutorService

        public LoggingScheduledThreadPoolExecutor getScheduledExecutorService()
        Gets a ScheduledExecutorService for scheduling long lasting tasks asynchronously. Please do not start own threads but use this executor service instead otherwise the shutdown of the client will not work correctly since the threads cannot be reached. However, if you do, you will be responsible for terminating the threads correctly when shutting down.
        The returned service must not be shutdown; this is done by implementations of the client service. Additionally, it must not be configured since it is re-used for all users of the client service. The scheduled executor service is global with respect to all client services, that is there is only one for all user sessions.
        Specified by:
        getScheduledExecutorService in interface ClientService
        Returns:
        A ScheduledExecutorService for scheduling long lasting task asynchronously instead of creating own (local) threads.
      • isConnected

        public boolean isConnected​(String serviceName)
        Description copied from interface: ClientService
        Returns whether this client is connected to the designated service or not. If the client is not connected, the corresponding (AristaFlow-)service (managers) will be available. Components using this service have to adhere to this. A ClientService.connectAll() can be tried, but this need not be successful. If the component could work offline, it should do so without accessing any server logic. Otherwise the component would have to terminate.
        Specified by:
        isConnected in interface ClientService
        Parameters:
        serviceName - The name of the service of which to check whether this client service is connected to.
        Returns:
        Whether this client is connected to the designated AristaFlow-service.
      • connectAll

        public boolean connectAll()
        Description copied from interface: ClientService
        Tries to connect this client service to all AristaFlow-services. Whether connecting has been successful will be indicated by the return value.
        Connecting an online client is a no-op.
        Specified by:
        connectAll in interface ClientService
        Returns:
        Whether connecting to the AristaFlow-services has been successful and the client is online now.
      • disconnectAll

        public void disconnectAll()
        Description copied from interface: ClientService
        Disconnects this client service from the AristaFlow-services. This does all the cleanup necessary when disconnecting, for instance logging off from the appropriate server-side services. However, the client (service) will not be shut down. This is done via the registry and incorporates logging off and shutting down local services.
        Disconnecting an offline client is a no-op.
        Specified by:
        disconnectAll in interface ClientService
      • addServiceStateListener

        public boolean addServiceStateListener​(ADEPT2Service service,
                                               ClientService.ServiceStateListener listener)
        Description copied from interface: ClientService
        Registers a listener to be informed about a change in the availability of an ADEPT2Service.
        Specified by:
        addServiceStateListener in interface ClientService
        Parameters:
        service - The service for which to be informed about its availability.
        listener - The instance which to notify in case the availability of the designated service changes.
        Returns:
        Whether the designated service is currently available.
      • removeServiceStateListener

        public void removeServiceStateListener​(ADEPT2Service service,
                                               ClientService.ServiceStateListener listener)
        Description copied from interface: ClientService
        Removes a listener from further notifications of the designated ADEPT2Service.
        Specified by:
        removeServiceStateListener in interface ClientService
        Parameters:
        service - The service for which to no longer be informed about its availability.
        listener - The instance which to remove from availability notifications.
      • logoff

        public void logoff()
        Logs the agent (that is with all organisational positions) off and invalidates the session factories. Afterwards no session token can be created any more.
        Active agent listeners will be notified with null as active agent. This removes the GUI manager of the current user session and shuts down and removes the corresponding client service.
        Specified by:
        logoff in interface ClientService
      • getSessionToken

        public SessionToken getSessionToken​(Map<String,​String> additionalAttributes)
        Description copied from interface: ClientService
        Gets a session token for currently active agent and the URIs of this client having the designated additional attributes.
        Specified by:
        getSessionToken in interface ClientService
        Parameters:
        additionalAttributes - Additional attributes which are provided by the created session token. This may be null.
        Returns:
        A session token for the currently active agent having the designated additional attributes and the URIs of this client or null in case no agent is active.
        See Also:
        ClientSessionFactory.getSessionToken(Map)
      • getSessionToken

        public SessionToken getSessionToken​(QualifiedAgent agent)
        Description copied from interface: ClientService
        Gets a session token for the designated agent ignoring the currently active agent. If the designated agent is not logged on, an IllegalArgumentException will be thrown.
        Specified by:
        getSessionToken in interface ClientService
        Parameters:
        agent - The agent to retrieve a session token for.
        Returns:
        A session token for the designated agent.
      • getSessionToken

        public SessionToken getSessionToken​(QualifiedAgent agent,
                                            Map<String,​String> additionalAttributes)
        Description copied from interface: ClientService
        Gets a session token for the designated agent ignoring the currently active agent having the designated additional attributes. If the designated agent is not logged on, an IllegalArgumentException will be thrown.
        Specified by:
        getSessionToken in interface ClientService
        Parameters:
        agent - The agent to retrieve a session token for.
        additionalAttributes - Additional attributes which are provided by the created session token. This may be null.
        Returns:
        A session token for the designated agent having the designated additional attributes.
      • setAuthenticatedAgents

        public void setAuthenticatedAgents​(ClientSessionFactory... csf)
        Sets the client session factories for this service which provide the session tokens for the using components. This method must only be called by the component managing the logon/logoff. The session factories have to be the ones provided by the authentication (Authentication.authenticate(String, long, String)). This method is client-session-specific. When setting the agents, a new client service will be created for the current user session and stored internally. All further user-session-specific calls to this service will be forwarded to this client service.
        There has to be a session ID registered before calling this method! Additionally the very same session ID has to be used when retrieving the designated client session factory via Authentication.
        Specified by:
        setAuthenticatedAgents in interface ClientService
        Parameters:
        csf - The client session factories provided when authenticating.
      • agentsChanged

        public RichAgent[] agentsChanged​(QualifiedAgent... agents)
        Description copied from interface: ClientService
        Signals this client service that the designated agents changed. Implementations should do best effort to update the corresponding client session factory. If one of the designated agents is unknown by this client service, it will be ignored.
        Specified by:
        agentsChanged in interface ClientService
        Parameters:
        agents - The agents that have changed on the server.
        Returns:
        The designated agents which have been updated by this client service.
      • setActiveAgent

        public void setActiveAgent​(QualifiedAgent activeAgent)
        Description copied from interface: ClientService
        Sets the currently active agent. This is either determined by a drop-down list or the active worklist if worklists are position-specific. All registered listeners will be notified (asynchronously) about this.
        Specified by:
        setActiveAgent in interface ClientService
        Parameters:
        activeAgent - The currently active agent, this must not be null.
      • guiSelectionChanged

        public void guiSelectionChanged​(SelectedGUIElementChangedEvent selectionChangeEvent)
        Description copied from interface: ClientService
        This method informs all interested listeners about a change in the currently selected graphical representation of a model element, for instance, selecting an instance from a list of instances or the GUI element that displays the user interface of a process step and thus represents a (running) EBP-instance.

        Implementations for the GUI element tracking should respect the order in which events are retrieved. Otherwise it may happen that some UI elements display an old event which has been signalled after a newer event.

        Specified by:
        guiSelectionChanged in interface ClientService
        Parameters:
        selectionChangeEvent - The event containing information like the selected element as well as the source of the event.
      • addGUIListener

        public void addGUIListener​(SelectedGUIElementChangedListener selectedElementChangedListener)
        Description copied from interface: ClientService
        Registers a listener to be informed about a change in the currently selected GUI element representing a model element.
        Specified by:
        addGUIListener in interface ClientService
        Parameters:
        selectedElementChangedListener - The listener to be informed about a change in the currently selected GUI element representing a model element.
      • removeGUIListener

        public void removeGUIListener​(SelectedGUIElementChangedListener selectedElementChangedListener)
        Description copied from interface: ClientService
        Removes a listener from further notifications of the selected GUI element.
        Specified by:
        removeGUIListener in interface ClientService
        Parameters:
        selectedElementChangedListener - The listener not to be informed any more about GUI selection changes.
      • getAuthentication

        public Authentication getAuthentication()
        Description copied from interface: ClientService
        Gets the manager that handles authentication for the users of this client.
        Specified by:
        getAuthentication in interface ClientService
        Returns:
        The manager handling authentication for the users of this client.
      • hasOneCapability

        public boolean hasOneCapability​(SessionToken sessionToken,
                                        String... capabilities)
                                 throws SecurityTokenIntegrityException
        Description copied from interface: CapabilityChecker
        Checks the integrity of the (security token of the) designated session token and returns whether the (security token of the) designated session has at least one of the designated capabilities.
        Specified by:
        hasOneCapability in interface CapabilityChecker
        Parameters:
        sessionToken - The session token of which to check the integrity and to return the capability of.
        capabilities - One ore more strings representing the capability/capabilities of the function the owner of this token wants to perform.
        Returns:
        Whether the (security token of the) designated session has at least one of the designated capabilities.
        Throws:
        SecurityTokenIntegrityException - If the designated session token has no integrity, a SecurityTokenIntegrityException will be thrown.
        See Also:
        Capabilities
      • hasOneTopLevelCapability

        public boolean hasOneTopLevelCapability​(SessionToken sessionToken,
                                                String... capabilities)
                                         throws SecurityTokenIntegrityException
        Description copied from interface: CapabilityChecker
        Checks the integrity of the (security token of the) top-level session of the designated session token and returns whether the (security token of the) top-level session of the designated session has at least one of the designated capabilities.
        Specified by:
        hasOneTopLevelCapability in interface CapabilityChecker
        Parameters:
        sessionToken - The session token of which to check the integrity and to return the capability of the corresponding top-level session token.
        capabilities - One or more strings representing the capability/capabilities of the function the owner of the top-level session token wants to perform.
        Returns:
        Whether the (security token of the) top-level parent session of the designated session has at least one of the designated capabilities.
        Throws:
        SecurityTokenIntegrityException - If the top-level parent session of the designated session token has no integrity, a SecurityTokenIntegrityException will be thrown.
        See Also:
        Capabilities
      • hasAllCapabilities

        public boolean hasAllCapabilities​(SessionToken sessionToken,
                                          String... capabilities)
                                   throws SecurityTokenIntegrityException
        Description copied from interface: CapabilityChecker
        Checks the integrity of the (security token of the) designated session token and returns whether the (security token of the) designated session has all of the designated capabilities.
        Specified by:
        hasAllCapabilities in interface CapabilityChecker
        Parameters:
        sessionToken - The session token of which to check the integrity and to return the capability of.
        capabilities - One ore more strings representing the capability/capabilities of the function the owner of this token wants to perform.
        Returns:
        Whether the (security token of the) designated session has all of the designated capabilities.
        Throws:
        SecurityTokenIntegrityException - If the designated session token has no integrity, a SecurityTokenIntegrityException will be thrown.
        See Also:
        Capabilities
      • hasAllTopLevelCapabilities

        public boolean hasAllTopLevelCapabilities​(SessionToken sessionToken,
                                                  String... capabilities)
                                           throws SecurityTokenIntegrityException
        Description copied from interface: CapabilityChecker
        Checks the integrity of the (security token of the) top-level session of the designated session token and returns whether the (security token of the) top-level session of the designated session has all of the designated capabilities.
        Specified by:
        hasAllTopLevelCapabilities in interface CapabilityChecker
        Parameters:
        sessionToken - The session token of which to check the integrity and to return the capability of the corresponding top-level session token.
        capabilities - One or more strings representing the capability/capabilities of the function the owner of the top-level session token wants to perform.
        Returns:
        Whether the (security token of the) top-level parent session of the designated session has all of the designated capabilities.
        Throws:
        SecurityTokenIntegrityException - If the top-level parent session of the designated session token has no integrity, a SecurityTokenIntegrityException will be thrown.
        See Also:
        Capabilities
      • getLicenceManager

        public LicenceManager getLicenceManager()
                                         throws ServiceNotKnownException
        Gets the licence manager that provides the licence for all AristaFlow-services and products. This method is not user-session-specific and retrieves the licence manager with a special session of this multiplexing client service. This allows to retrieve the licence manager independent from whether a user has been logged on (and retrieved a user-specific client service).
        Specified by:
        getLicenceManager in interface ClientService
        Returns:
        The licence manager providing the licence for all AristaFlow-services and products.
        Throws:
        ServiceNotKnownException - If there are problems retrieving the licence manager, a ServiceNotKnownException will be thrown.
      • getClusterName

        public String getClusterName()
        Description copied from interface: ClientService
        Gets the name of the cluster this service belongs to. Use this name for identification purpose across clusters.
        Specified by:
        getClusterName in interface ClientService
        Returns:
        The name of the cluster this service belongs to.
      • getExecutionManagerForActivity

        public ExecutionManager getExecutionManagerForActivity​(EBPInstanceReference ebpInstanceReference)
        Description copied from interface: LocalExecutionClientService
        Returns a reference to the execution manager that is responsible for the designated activity. If there is no running Execution Manager for the given activity an new one is created and registered with the URI provided by the Activity.
        Specified by:
        getExecutionManagerForActivity in interface LocalExecutionClientService
        Parameters:
        ebpInstanceReference - identifies the activity
        Returns:
        The execution manager which is requested or null in case it could not be retrieved.
      • getProcessManagerForInstanceId

        public ProcessManager getProcessManagerForInstanceId​(UUID instId)
        Description copied from interface: LocalExecutionClientService
        Gets the process manager that is responsible for the instance with the designated (logical) ID.
        Specified by:
        getProcessManagerForInstanceId in interface LocalExecutionClientService
        Parameters:
        instId - The (logical) ID of the instance for which to retrieve the corresponding process manager. This is resolved using the default execution manager.
        Returns:
        The process manager handling the designated instance ID or null in case it could not be retrieved.
      • getProcessManagerForInstanceId

        public ProcessManager getProcessManagerForInstanceId​(URI[] execMgr,
                                                             UUID instId)
        Description copied from interface: LocalExecutionClientService
        Gets the process manager that is responsible for the instance with the designated (logical) ID being executed on the designated execution manager.
        Specified by:
        getProcessManagerForInstanceId in interface LocalExecutionClientService
        Parameters:
        execMgr - The URIs of the execution manager executing the instance with the designated ID.
        instId - The (logical) ID of the instance for which to retrieve the corresponding process manager. This is resolved using the designated execution manager.
        Returns:
        The process manager handling the designated instance ID or null in case it could not be retrieved (or the corresponding execution manager).
      • getProcessManagerForInstanceLogId

        public ProcessManager getProcessManagerForInstanceLogId​(URI[] execMgr,
                                                                UUID instLogId)
        Description copied from interface: LocalExecutionClientService
        Gets the process manager that is responsible for the instance with the designated (internal) ID being executed on the designated execution manager.
        Specified by:
        getProcessManagerForInstanceLogId in interface LocalExecutionClientService
        Parameters:
        execMgr - The URIs of the execution manager executing the instance with the designated ID.
        instLogId - The (internal) ID of the instance for which to retrieve the corresponding process manager. This is resolved using the designated execution manager.
        Returns:
        The process manager handling the designated instance ID or null in case it could not be retrieved (or the corresponding execution manager).
      • getRemoteGUIManager

        public RemoteGUIManager getRemoteGUIManager()
                                             throws ServiceNotKnownException
        Description copied from interface: ExecutionClientService
        Gets the GUI manager for creating local GUI contexts for the GUI contexts that are transferred from a remotely executed activity. This GUI manager creates an appropriate local GUI context and usually handles the closing of this local GUI context which depends on the state of the remotely executed activity.
        Specified by:
        getRemoteGUIManager in interface ExecutionClientService
        Specified by:
        getRemoteGUIManager in interface RemoteExecutionClientService
        Returns:
        The GUI manager for creating local GUI contexts the GUI contexts that are transferred from a remotely executed activity.
        Throws:
        ServiceNotKnownException - If no remote GUI manager is available for this client, a ServicNotKnownException will be thrown. Usually this indicates a wrong configuration or the normal GUI manager of this client being unable to provide such local GUI contexts for remotely executed activities.
      • getWorklistManager

        public WorklistManager getWorklistManager()
        Description copied from interface: WorklistClientService
        Gets the worklist manager for logging on and retrieving a worklist and updates from.
        It may only be called when online.
        Specified by:
        getWorklistManager in interface WorklistClientService
        Returns:
        The worklist manager providing worklist(s) for this client.
      • getRuntimeService

        public RuntimeService getRuntimeService()
        Description copied from interface: LocalExecutionClientService
        Gets the runtime service for this client service allowing to execute activities directly by the caller and not in a runtime manager. The caller has complete responsibility for the execution of the activity!
        Specified by:
        getRuntimeService in interface LocalExecutionClientService
        Specified by:
        getRuntimeService in interface WorklistClientService
        Returns:
        The runtime service for this client service allowing to execute activities directly by the caller and not in a runtime manager.
      • getRuntimeManager

        public RuntimeManager getRuntimeManager()
        Description copied from interface: WorklistClientService
        Gets the runtime manager for this client service, which is usually a local runtime manager. This differs from a runtime manager for specific activities, e. g. HTML-activities.
        Specified by:
        getRuntimeManager in interface WorklistClientService
        Returns:
        The runtime manager for this client service, which is usually a local runtime manager.
      • getGUIManager

        public GUIManager getGUIManager()
        Description copied from interface: LocalExecutionClientService
        Gets the GUI manager responsible for synchronising the currently selected element in the GUI. This allows to for instance to select a worklist entry and the corresponding application is set visible and in the foreground.
        Specified by:
        getGUIManager in interface LocalExecutionClientService
        Returns:
        A GUI manager providing the means to synchronise on the currently selected element.
      • getModelViewerClass

        public 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. If there is no model viewer configured for the designated plugin ID, null will be returned. This ID usually equals the ID of the (service-) plugin that uses the model viewer. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getModelViewerClass in interface ADEPT2ClientService
        Specified by:
        getModelViewerClass in 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 null in case there is no model viewer for the designated plugin ID configured.
      • getModelFactory

        public <T> T getModelFactory​(String modelFactoryName,
                                     Class<T> modelFactoryType)
                              throws ServiceNotKnownException
        Gets the designated model factory registry. This method is not user-session-specific and retrieves the designated model factory globally.
        Specified by:
        getModelFactory in 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,
        a ServiceNotKnownException wrapping a ConfigurationException will be thrown.
      • getConfiguredPluginTypes

        public Map<String,​Class<?>> getConfiguredPluginTypes​(SessionToken session)
        Retrieves all plugin types declared for the instance using this interface. This method is not user-session-specific and retrieves the designated plugins globally.
        Specified by:
        getConfiguredPluginTypes in 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.
      • getServiceOfType

        public <T extends ADEPT2Service> T getServiceOfType​(SessionToken session,
                                                            String typeName,
                                                            Class<T> serviceType)
                                                     throws ServiceNotKnownException
        Returns 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. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getServiceOfType in interface ServiceAccess
        Type Parameters:
        T - 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.
        Parameters:
        session - The session which is used to check for access rights on this method.
        typeName - 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.
        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,
        a ServiceNotKnownException will be thrown. This may encapsulate a ConfigurationException or an AbortServiceException.
      • getConfiguredPlugin

        public <T> T getConfiguredPlugin​(SessionToken session,
                                         Object usingInstance,
                                         String pluginTypeName,
                                         Class<T> pluginType)
                                  throws ServiceNotKnownException
        Retrieves the default plugin of the designated type which is configured for the designated (using) instance. This is the same as ServiceAccess.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. This method is not user-session-specific and retrieves the designated plugin globally.
        Specified by:
        getConfiguredPlugin in 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.
        pluginType - 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,
        a ServiceNotKnownException wrapping a ConfigurationException will be thrown.
      • getConfiguredPlugins

        public <T> Map<String,​T> getConfiguredPlugins​(SessionToken session,
                                                            Object usingInstance,
                                                            String pluginTypeName,
                                                            Class<T> pluginType)
                                                     throws ServiceNotKnownException
        Retrieves 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. This method is not user-session-specific and retrieves the designated plugins globally.
        Specified by:
        getConfiguredPlugins in 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,
        a ServiceNotKnownException will be thrown.
      • getConfiguredPlugin

        public <T> T getConfiguredPlugin​(SessionToken session,
                                         Object usingInstance,
                                         String pluginTypeName,
                                         Class<T> pluginType,
                                         String pluginInstanceName)
                                  throws ServiceNotKnownException
        Retrieves 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. This method is not user-session-specific and retrieves the designated plugin globally.
        Specified by:
        getConfiguredPlugin in 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.
        pluginType - 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,
        a ServiceNotKnownException wrapping a ConfigurationException will be thrown.
      • getService

        public <T extends ADEPT2Service> T getService​(SessionToken session,
                                                      String serviceName,
                                                      Class<T> serviceType)
                                               throws ServiceNotKnownException
        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. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getService in interface ServiceAccess
        Type Parameters:
        T - 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.
        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 ADEPT2Service and 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,
        a ServiceNotKnownException will be thrown. This may encapsulate a ConfigurationException or an AbortServiceException.
      • getService

        public <T extends ADEPT2Service> T getService​(SessionToken session,
                                                      URI[] serviceURIs,
                                                      Class<T> serviceType)
                                               throws ServiceNotKnownException
        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. An appropriate URI will be chosen, that is, a URI with a protocol supported by this registry. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getService in interface ServiceAccess
        Type Parameters:
        T - 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.
        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 ADEPT2Service and 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,
        a ServiceNotKnownException will be thrown. This may encapsulate a ConfigurationException or an AbortServiceException.
      • getHierarchicalInstanceName

        public String getHierarchicalInstanceName​(String componentType,
                                                  String simpleName)
        Returns a hierarchical instance name containing the component type as well as the instance name. The returned string resembles, for instance, /ProcessManager/PM1. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getHierarchicalInstanceName in 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.
      • getSimpleInstanceName

        public String getSimpleInstanceName​(String instanceName)
        Returns the simple name of the designated component instance as used in configuration files. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getSimpleInstanceName in interface NameResolution
        Parameters:
        instanceName - The hierarchical name of a component instance.
        Returns:
        The simple name without the prepending type of the component instance.
      • getComponentType

        public String getComponentType​(String instanceName)
        Returns the name of the component type of the designated component instance as used in configuration files. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getComponentType in interface NameResolution
        Parameters:
        instanceName - The hierarchical name of a component instance.
        Returns:
        The name of the component type.
      • getNames

        public Pair<String,​String> getNames​(String instanceName)
        Gets the component type name and the simple instance name of the designated component instance at once. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getNames in interface NameResolution
        Parameters:
        instanceName - The hierarchical name of a component instance.
        Returns:
        The name of the component type and the simple name of the designated component instance.
      • getFormattedSignature

        public String getFormattedSignature​(Class<?>[] parameterTypes)
        Helper method for getting a string describing the parameter types as method signature for use in log messages and exceptions. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getFormattedSignature in 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).
      • getInterfaceForComponentType

        public Class<?> getInterfaceForComponentType​(String componentType)
                                              throws ConfigurationException
        Returns the class object of the corresponding interface / superclass, if the component type is declared. If not, the method throws a ConfigurationException. This method must not to be called by clients; it is only for the registry and the communication framework. This method is not user-session-specific and retrieves the designated service globally.
        Specified by:
        getInterfaceForComponentType in 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 ConfigurationException will be thrown.
      • getClientServiceOrException

        public ADEPT2ClientService getClientServiceOrException()
        Returns the ADEPT2ClientService which was mapped in addClientService or throws an IllegalStateException if no client session context is available.
        Returns:
        The ADEPT2ClientService of the current user session.
        Throws:
        IllegalStateException - If there is no client service found, an IllegalStateException will be thrown.
      • getClientService

        public ADEPT2ClientService getClientService()
        Returns the ADEPT2ClientService which was mapped in addClientService or null if none was found.
        Returns:
        The ADEPT2ClientService of the current user session or null in case no client service is found for the user session.
        Throws:
        InvalidServiceStateException - If no user session ID is registered (e. g. for the current thread), an InvalidServiceStateException will be thrown.
      • getClientService

        public ADEPT2ClientService getClientService​(SessionToken session)
        This method can be called to receive the ADEPT2ClientService which is mapped to the user session ID in the additionalAttributes of the SessionToken.
        Parameters:
        session - A session token containing the user session ID as an additional attribute.
        Returns:
        ADEPT2ClientService The client service associated to the user session id.
        Throws:
        ServiceAccessControlException - If the agent cannot be determined from the designated session token, a ServiceAccessControlException will be thrown.
        InvalidServiceStateException - If the agent of the designated session token does not have a valid user session ID or there is no client service due to the client session factories not being set properly, an InvalidServiceStateException will be thrown.
      • removeSession

        protected void removeSession​(String sessionID,
                                     boolean emergency)
        Removes the designated session that is the corresponding client service and the GUI manager will be removed. The client service will be shut down.
        Callers must not have the active agent read lock!
        Parameters:
        sessionID - The session ID of which to remove the client service and the GUI manager.
        emergency - Whether the client service should be terminated quickly.
      • getUserSessionID

        protected abstract String getUserSessionID()
        Gets the session identifying the current request. This should usually be bound to the current thread.
        Returns:
        A string identifying the current user session or null in case the current user session cannot be determined.
      • getUsedLocale

        public Locale getUsedLocale​(RichAgent agent)
        Returns the locale which the designated agent has chosen on this client. This may differ from the default locale of the client as well as the default locale for the agent. For instance, the default client locale is fr_FR, the default locale of the user is jp_JP. The client does not support asian languages, but the user can speak English, therefore en_GB is chosen as locale.
        Per default, the locale of the agent is used. This returns the locale of the first client service found for the designated agent. However, note that this agent may be logged on several times with different locales.
        Specified by:
        getUsedLocale in interface RemoteClient
        Parameters:
        agent - The agent for whom to retrieve the configured language.
        Returns:
        The configured language of the designated agent of the client or null in case the designated agent is not logged on.
      • getLoggedOnAgents

        public RichAgent[] getLoggedOnAgents()
        Description copied from interface: RemoteClient
        Returns the agents that are currently logged on this client.
        Specified by:
        getLoggedOnAgents in interface RemoteClient
        Returns:
        An array containing all currently logged on agents on this client.
      • getRuntimeManagerURIs

        public Map<RichAgent,​URI[]> getRuntimeManagerURIs()
        Description copied from interface: RemoteClient
        Returns the runtime managers that are currently available on this client. These are indexed by the agents to which a runtime manager belongs to. The agents are all logged on agents. Since not every agent needs to have a runtime manager, there may be null values in the map.
        Specified by:
        getRuntimeManagerURIs in interface RemoteClient
        Returns:
        A map containing all currently available runtime managers on this client indexed by the corresponding agent.
      • serverShutdown

        public void serverShutdown​(String serverName,
                                   URI[] serverURIs,
                                   long shutdownTime,
                                   long estimatedDowntime)
        Description copied from interface: RemoteClient
        Notifies this client that the designated server will be down in the designated period and for the estimated downtime. The designated URIs are the current URIs of the server, while the designated server name is logical. This allows to shutdown and return with different URIs.
        The estimated downtime allows to client to decide whether to shutdown itself or to keep on running.
        Specified by:
        serverShutdown in interface RemoteClient
        Parameters:
        serverName - The logical name of the server to identify the return of the server.
        serverURIs - The URIs of the server which is shutdown and which are invalid
        shutdownTime - The time period when the server will be shut down. Until then it still accepts requests, for instance to allow clients to logoff.
        estimatedDowntime - The estimated duration for the downtime of the designated server.
        See Also:
        RemoteClient.serverReturned(String, URI[])
      • serverReturned

        public void serverReturned​(String serverName,
                                   URI[] serverURIs)
        Description copied from interface: RemoteClient
        Notifies this client (if it has not shutdown itself) that the designated server is running again. The designated name allows the client to change the URIs and use the new URIs from now on.
        Specified by:
        serverReturned in interface RemoteClient
        Parameters:
        serverName - The logical name of the server to identify the corresponding shutdown.
        serverURIs - The (new) URIs of the server which should be used from now on.