Class ServiceInformation


  • public class ServiceInformation
    extends AbstractRegistry.InstanceInformation
    Service specific extension to the default instance information of the AbstractRegistry. It encapsulates additional properties from the configuration relevant for a service instance:
    • an (absolute) service URI if the service is remote and directly addressed,
    • a list of names for services which allow to export the service,
    • a flag to indicate whether the service is to be published at the global registry.

    These attributes and the ones from InstanceInformation are closely related and have interdependencies. They are assured when creating information objects via the static factory methods.
    Local services must have a valid implementation class or an implementation object. If an implementation class is configured or the implementation object is provided, no service URI may be present. Contrary, if no implementation class or is configured or implementation object is provided, a service URI may be present but does not have to. If neither an implementation class nor an implementation object nor a service URI is configured, the service is expected to be published at the global registry.
    Only a local service may be exported, therefore exportServiceInstances is only present (!= null) for local services.
    The following constraints are respected when creating the objects via the static factory methods and thus can be relied on when using the object:

    • a service is managed locally:
      • an implementation class is specified or an implementation object is provided
      • no service URI is specified
      • the service may be exported:
        • a list of names of export services is provided
        • the exported service may be published at the global registry
    • a service is only remote and not managed locally:
      • no implementation class may be specified and no implementation object may be provided
      • the service may not be exported thus no service export instances are set
      • the service may not be exported and therefore not published at the global registry
      • the service may be directly addressed:
        • a valid service URI is provided
      • the service may be indirectly addressed (a "public" service):
        • no valid service URI is provided, the global registry will be asked
    • Field Detail

      • serviceURI

        protected final URI serviceURI
        The service URI of the service or null in case of a local or indirectly addressed service.
      • exportServiceInstances

        protected final String[] exportServiceInstances
        A list of service names that export this service or an empty list in case of a remote service.
      • publish

        protected final boolean publish
        Whether a local service that is exported is to be published.
    • Method Detail

      • createExportedLocalService

        protected static ServiceInformation createExportedLocalService​(String serviceType,
                                                                       AbstractRegistry.InstantiationMode instantiationMode,
                                                                       String implementationClass,
                                                                       String[] exportServiceInstances,
                                                                       boolean publish)
        Creates a new service information instance for an exported local service with the designated attributes. The following combinations are used:
        • serviceType a valid name for a registered interface (c. f. AbstractRegistry.InstanceInformation.componentType)
        • instantiationMode: the configuration instantiation mode
        • implementationClass: name of a valid class
        • implementation: null
        • serviceURI: null
        • exportServiceInstances: instance names for ADEPT2ServiceExports
        • publish: TRUE or FALSE
        Parameters:
        serviceType - The name of the service (component) type.
        instantiationMode - The instantiation mode of the service. This is usually AbstractRegistry.InstantiationMode.SINGLETON.
        implementationClass - The implementation (class name) to use for the service instance which conforms to the corresponding service type interface.
        exportServiceInstances - The name of service instances of type ADEPT2ServiceExport.
        publish - Whether the local exported service is to be published.
        Returns:
        A service information object for an exported local service with the designated parameter values.
      • createExportedLocalServiceForObject

        protected static ServiceInformation createExportedLocalServiceForObject​(String serviceType,
                                                                                ADEPT2Service implementation,
                                                                                String[] exportServiceInstances,
                                                                                boolean publish)
        Creates a new service information instance for an exported local service provided as object with the designated attributes. The following combinations are used:
        • serviceType a valid name for a registered interface (c. f. AbstractRegistry.InstanceInformation.componentType)
        • instantiationMode: InstantiationMode.SINGLETON
        • implementationClass: null
        • implementation: the provided object
        • serviceURI: null
        • exportServiceInstances: instance names for ADEPT2ServiceExports
        • publish: TRUE or FALSE
        Parameters:
        serviceType - The name of the service (component) type.
        implementation - The implementation (object) to use for the service instance which conforms to the corresponding service type interface.
        exportServiceInstances - The name of service instances of type ADEPT2ServiceExport.
        publish - Whether the local exported service is to be published.
        Returns:
        A service information object for an exported local service with the designated parameter values.
      • createNonExportedLocalService

        protected static ServiceInformation createNonExportedLocalService​(String serviceType,
                                                                          AbstractRegistry.InstantiationMode instantiationMode,
                                                                          String implementationClass)
        Creates a new service information instance for a non-exported local service with the designated attributes. The following combinations are used:
        • serviceType a valid name for a registered interface (c. f. AbstractRegistry.InstanceInformation.componentType)
        • instantiationMode: the configuration instantiation mode
        • implementationClass: name of a valid class
        • implementation: null
        • serviceURI: null
        • exportServiceInstances: null
        • publish: FALSE
        Parameters:
        serviceType - The name of the service (component) type.
        instantiationMode - The instantiation mode of the service. This is usually AbstractRegistry.InstantiationMode.SINGLETON.
        implementationClass - The implementation (class name) to use for the service instance which conforms to the corresponding service type interface.
        Returns:
        A service information object for a non-exported local service with the designated parameter values.
      • createNonExportedLocalServiceForObject

        protected static ServiceInformation createNonExportedLocalServiceForObject​(String serviceType,
                                                                                   ADEPT2Service implementation)
        Creates a new service information instance for a non-exported local service provided as object with the designated attributes. The following combinations are used:
        • serviceType a valid name for a registered interface (c. f. AbstractRegistry.InstanceInformation.componentType)
        • instantiationMode: the configuration instantiation mode
        • implementationClass: null
        • implementation: the provided object
        • serviceURI: null
        • exportServiceInstances: null
        • publish: FALSE
        Parameters:
        serviceType - The name of the service (component) type.
        implementation - The implementation (object) to use for the service instance which conforms to the corresponding service type interface.
        Returns:
        A service information object for a non-exported local service with the designated parameter values.
      • createPublicRemoteService

        protected static ServiceInformation createPublicRemoteService​(String serviceType)
        Creates a new service information instance for a public remote service with the designated attributes. The following combinations are used:
        • serviceType a valid name for a registered interface (c. f. AbstractRegistry.InstanceInformation.componentType)
        • instantiationMode: InstantiationMode.SINGLETON
        • implementationClass: null
        • implementation: null
        • serviceURI: null
        • exportServiceInstances: null
        • publish: FALSE
        Parameters:
        serviceType - The name of the service (component) type.
        Returns:
        A service information object for a public remote with the designated parameter values.
      • createExportedPublicRemoteService

        protected static ServiceInformation createExportedPublicRemoteService​(String serviceType,
                                                                              String[] exportServiceInstances)
        Creates a new service information instance for an exported public remote service with the designated attributes. The following combinations are used:
        • serviceType a valid name for a registered interface (c. f. AbstractRegistry.InstanceInformation.componentType)
        • instantiationMode: InstantiationMode.SINGLETON
        • implementationClass: null
        • implementation: null
        • serviceURI: null
        • exportServiceInstances: instance names for ADEPT2ServiceExports
        • publish: FALSE
        Parameters:
        serviceType - The name of the service (component) type.
        exportServiceInstances - The name of service instances of type ADEPT2ServiceExport.
        Returns:
        A service information object for a public remote with the designated parameter values.
      • createPrivateRemoteService

        protected static ServiceInformation createPrivateRemoteService​(String serviceType,
                                                                       URI serviceURI)
        Creates a new service information instance for a private remote service with the designated attributes. The following combinations are used:
        • serviceType a valid name for a registered interface (c. f. AbstractRegistry.InstanceInformation.componentType)
        • instantiationMode: InstantiationMode.SINGLETON
        • implementationClass: null
        • implementation: null
        • serviceURI: a valid URI of a service
        • exportServiceInstances: null
        • publish: FALSE
        Parameters:
        serviceType - The name of the service (component) type.
        serviceURI - A valid service URI for a private remote service.
        Returns:
        A service information object for a private remote service with the designated parameter values.
      • createExportedPrivateRemoteService

        protected static ServiceInformation createExportedPrivateRemoteService​(String serviceType,
                                                                               URI serviceURI,
                                                                               String[] exportServiceInstances)
        Creates a new service information instance for an exported private remote service with the designated attributes. The following combinations are used:
        • serviceType a valid name for a registered interface (c. f. AbstractRegistry.InstanceInformation.componentType)
        • instantiationMode: InstantiationMode.SINGLETON
        • implementationClass: null
        • implementation: null
        • serviceURI: a valid URI of a service
        • exportServiceInstances: null
        • exportServiceInstances: instance names for ADEPT2ServiceExports
        • publish: FALSE
        Parameters:
        serviceType - The name of the service (component) type.
        serviceURI - A valid service URI for a private remote service.
        exportServiceInstances - The name of service instances of type ADEPT2ServiceExport.
        Returns:
        A service information object for a private remote service with the designated parameter values.
      • isRemote

        protected boolean isRemote()
        Returns whether this is a remote service (instead of a local service).
        Returns:
        Whether this is a remote service (or a local service).
      • isPublic

        protected boolean isPublic()
        Returns whether this is a public remote service (instead of a private remote or a local service).
        Returns:
        Whether this is a public remote service (or either a private remote or a local service).
      • isExportedLocal

        @Deprecated(since="12.1.0",
                    forRemoval=true)
        protected boolean isExportedLocal()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use isExported() and isRemote() instead.
        Returns whether this is a local and exported service (instead of a remote or a non-exported local service).
        Returns:
        Whether this is an exported local service (or either a non-exported local or a remote service).
      • isExported

        protected boolean isExported()
        Gets whether this is an exported service (either local or remote).
        Returns:
        Whether this is an exported service (either local or remote).