Class ServiceInformation
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 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.
A service may be exported whether it is local or remote, a remote one depending on the
communication service used for exporting it, and exportServiceInstances is present
for every exported service.
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 be exported, depending on the communication service used for exporting it, in which case service export instances are set
- the service is 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 Summary
FieldsModifier and TypeFieldDescriptionprotected final String[]A list of service names that export this service or an empty list in case of a remote service.protected final booleanWhether a local service that is exported is to be published.protected final URIThe service URI of the service ornullin case of a local or indirectly addressed service.Fields inherited from class de.aristaflow.adept2.base.registry.AbstractRegistry.InstanceInformation
componentType, implementation, implementationClass, implInitialised, instantiationMode -
Method Summary
Modifier and TypeMethodDescriptionprotected static ServiceInformationcreateExportedLocalService(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.protected static ServiceInformationcreateExportedLocalServiceForObject(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.protected static ServiceInformationcreateExportedPrivateRemoteService(String serviceType, URI serviceURI, String[] exportServiceInstances) Creates a new service information instance for an exported private remote service with the designated attributes.protected static ServiceInformationcreateExportedPublicRemoteService(String serviceType, String[] exportServiceInstances) Creates a new service information instance for an exported public remote service with the designated attributes.protected static ServiceInformationcreateNonExportedLocalService(String serviceType, AbstractRegistry.InstantiationMode instantiationMode, String implementationClass) Creates a new service information instance for a non-exported local service with the designated attributes.protected static ServiceInformationcreateNonExportedLocalServiceForObject(String serviceType, ADEPT2Service implementation) Creates a new service information instance for a non-exported local service provided as object with the designated attributes.protected static ServiceInformationcreatePrivateRemoteService(String serviceType, URI serviceURI) Creates a new service information instance for a private remote service with the designated attributes.protected static ServiceInformationcreatePublicRemoteService(String serviceType) Creates a new service information instance for a public remote service with the designated attributes.protected ComponentInstanceDeclarationgetDeclaration(String simpleInstanceName, String hierarchicalInstanceName) Gets the declaration of the designated service instance, which this information describes, with the services exporting it and whether it is published.protected booleanGets whether this is an exported service (either local or remote).protected booleanDeprecated, for removal: This API element is subject to removal in a future version.protected booleanisPublic()Returns whether this is a public remote service (instead of a private remote or a local service).protected booleanisRemote()Returns whether this is a remote service (instead of a local service).Methods inherited from class de.aristaflow.adept2.base.registry.AbstractRegistry.InstanceInformation
getImplementationClass, instantiatedInitialised, instantiatedInitRequired, isInstantiated
-
Field Details
-
serviceURI
The service URI of the service ornullin case of a local or indirectly addressed service. -
exportServiceInstances
A list of service names that export this service or an empty list in case of a remote service. -
publish
protected final boolean publishWhether a local service that is exported is to be published.
-
-
Method Details
-
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:-
serviceTypea 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 forADEPT2ServiceExports -
publish:TRUEorFALSE
- Parameters:
serviceType- The name of the service (component) type.instantiationMode- The instantiation mode of the service. This is usuallyAbstractRegistry.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 typeADEPT2ServiceExport.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:-
serviceTypea 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 forADEPT2ServiceExports -
publish:TRUEorFALSE
- 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 typeADEPT2ServiceExport.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:-
serviceTypea 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 usuallyAbstractRegistry.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:-
serviceTypea 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
Creates a new service information instance for a public remote service with the designated attributes. The following combinations are used:-
serviceTypea 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:serviceTypea valid name for a registered interface (c. f.AbstractRegistry.InstanceInformation.componentType)instantiationMode: InstantiationMode.SINGLETONimplementationClass: nullimplementation: nullserviceURI: nullexportServiceInstances: instance names forADEPT2ServiceExportspublish:FALSE
- Parameters:
serviceType- The name of the service (component) type.exportServiceInstances- The name of service instances of typeADEPT2ServiceExport.- Returns:
- A service information object for a public remote with the designated parameter values.
-
createPrivateRemoteService
Creates a new service information instance for a private remote service with the designated attributes. The following combinations are used:-
serviceTypea 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:serviceTypea valid name for a registered interface (c. f.AbstractRegistry.InstanceInformation.componentType)instantiationMode: InstantiationMode.SINGLETONimplementationClass: nullimplementation: nullserviceURI: a valid URI of a serviceexportServiceInstances: nullexportServiceInstances: instance names forADEPT2ServiceExportspublish: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 typeADEPT2ServiceExport.- 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, for removal: This API element is subject to removal in a future version.UseisExported()andisRemote()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).
-
getDeclaration
protected ComponentInstanceDeclaration getDeclaration(String simpleInstanceName, String hierarchicalInstanceName) Gets the declaration of the designated service instance, which this information describes, with the services exporting it and whether it is published.- Overrides:
getDeclarationin classAbstractRegistry.InstanceInformation- Parameters:
simpleInstanceName- The simple name of the service instance.hierarchicalInstanceName- The hierarchical name of the service instance.- Returns:
- The declaration of the designated service instance. This will never be
null.
-
isExported()andisRemote()instead.