Interface Service
- All Superinterfaces:
ParameterConfigurerProvider,ServiceBase
- All Known Subinterfaces:
GenericMultiTypeService,MonitoringService,UpdatingMonitoringService
- All Known Implementing Classes:
AbstractDelegatingMultiService,AbstractDelegatingService,AbstractProcessService,AbstractPythonProcessService,AbstractRestProcessService,AbstractRunnablesService,AbstractService,AbstractStringProcessService,ConnectorServiceWrapper,DefaultServiceImpl,FamilyServiceStub,MockingConnectorServiceWrapper,MockingMultiConnectorServiceWrapper,MultiConnectorServiceWrapper,PythonAsyncProcessService,PythonSyncProcessService,PythonWsProcessService,ServiceStub,TraceToAasService
Defines the (administrative) interface of an IIP-Ecosphere service.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
APPLICATION_SEPARATOR, DEFAULT_APPLICATION_INSTANCE_ID -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the service.default <T> voidaddTypeSubstitution(Class<? super T> cls, Class<T> actCls, Supplier<T> creator) Sets a type mapping, usually a substitution of more generic to more specific output types.default <T> TcreateType(Class<T> cls) Returns an instance a certain (output) type, may be a substitute.default <T> TcreateType(Class<T> cls, Supplier<T> creator) Returns an instance a certain (output) type, may be a substitute.The description of the service.getKind()Returns the service kind.getName()The name of the service.default de.iip_ecosphere.platform.support.ServerAddressReturns the resolved network address of the netMgtKey specified in the service descriptor.default ParameterConfigurer<?> getParameterConfigurer(String paramName) Returns the parameter configurer for a given parameter.The set of parameter names.default <T> Class<? extends T> getSubstitutedType(Class<T> cls) Returns the actual (output) type, may be a substitute.default <T> Supplier<T> getTypeCreator(Class<T> cls, Supplier<T> creator) Returns the creator for a certain (output) type, may be a substitute.Returns the actual (output) type substitutions.de.iip_ecosphere.platform.support.VersionThe version of the service.booleanReturns whether the service is deployable in distributable manner or fixed in deployment location.booleanReturns whether the service is a top-level service.voidMigrates a service.voidPassivates the service.voidreconfigure(Map<String, String> values) Reconfigures the service.voidSwitches to an interface-compatible service.voidUpdates the service by the service in the givenlocation.Methods inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
getId, getState, setState
-
Method Details
-
getName
String getName()The name of the service.- Returns:
- the name
-
getVersion
de.iip_ecosphere.platform.support.Version getVersion()The version of the service.- Returns:
- the version
-
getDescription
String getDescription()The description of the service.- Returns:
- the description, may be empty
-
isDeployable
boolean isDeployable()Returns whether the service is deployable in distributable manner or fixed in deployment location.- Returns:
truefor deployable,falsefor fixed
-
isTopLevel
boolean isTopLevel()Returns whether the service is a top-level service.- Returns:
truefor top-level,falsefor nested
-
getKind
ServiceKind getKind()Returns the service kind.- Returns:
- the service kind
-
getNetMgtKeyAddress
default de.iip_ecosphere.platform.support.ServerAddress getNetMgtKeyAddress()Returns the resolved network address of the netMgtKey specified in the service descriptor.- Returns:
- the resolved address, may be null in particular if no key was specified in the service descriptor
-
migrate
Migrates a service. However, it may be required to migrate/move the containing artifact. [adaptation]- Parameters:
resourceId- the target resource id, e.g., a device- Throws:
ExecutionException- if migration fails
-
update
Updates the service by the service in the givenlocation. This operation is responsible for stopping the running service (if needed), replacing it, starting the new service.- Parameters:
location- the location of the new service, e.g., an URL- Throws:
ExecutionException- if the given service cannot be updated for some reason, e.g., because the replacement service is not an evolved version of the running service
-
switchTo
Switches to an interface-compatible service. This method cares for stopping the old service, performing a handover if adequate, starting thetargetservice. [adaptation]- Parameters:
targetId- the id of the target service- Throws:
ExecutionException- if switching the service cannot be performed for some reason
-
activate
Activates the service. [adaptation]- Throws:
ExecutionException- in case that activating fails, e.g., because the service is already active
-
passivate
Passivates the service. [adaptation]- Throws:
ExecutionException- in case that passivating fails, e.g., because the service is already passive
-
reconfigure
Reconfigures the service. [adaptation]- Parameters:
values- the (service-specific) name-value mapping that shall lead to a reconfiguration of the service; values come either as primitive values or as JSON structures complying with the parameter descriptor. The service is responsible for correct JSON de-serialization according to the respective descriptor.- Throws:
ExecutionException- if reconfiguration fails
-
getParameterConfigurer
Description copied from interface:ParameterConfigurerProviderReturns the parameter configurer for a given parameter. We need this generic approach to ease code generation and initial setting of parameter values.- Specified by:
getParameterConfigurerin interfaceParameterConfigurerProvider- Parameters:
paramName- the name of the parameter- Returns:
- the associated parameter configurer or null if there is none
-
getParameterNames
Description copied from interface:ParameterConfigurerProviderThe set of parameter names.- Specified by:
getParameterNamesin interfaceParameterConfigurerProvider- Returns:
- the parameter names, may be null for none
-
addTypeSubstitution
Sets a type mapping, usually a substitution of more generic to more specific output types.- Type Parameters:
T- the actual type- Parameters:
cls- the original class to apply the mapping foractCls- the actual class that the supplier will create an instance ofcreator- the creator supplier that creates an instance of the substitute
-
getSubstitutedType
Returns the actual (output) type, may be a substitute.- Type Parameters:
T- the actual type- Parameters:
cls- the original class to return the creator for- Returns:
- the type, may be
cls - See Also:
-
getTypeSubstitutions
Returns the actual (output) type substitutions.- Returns:
- the type substitutions
- See Also:
-
createType
Returns an instance a certain (output) type, may be a substitute.- Type Parameters:
T- the actual type- Parameters:
cls- the original class create the type for- Returns:
- a constructor supplier, may be null
- See Also:
-
createType
Returns an instance a certain (output) type, may be a substitute.- Type Parameters:
T- the actual type- Parameters:
cls- the original class create the type forcreator- the default creator supplier if none is registered- Returns:
- a constructor supplier, may be null
- See Also:
-
getTypeCreator
Returns the creator for a certain (output) type, may be a substitute.- Type Parameters:
T- the actual type- Parameters:
cls- the original class to return the creator forcreator- the default creator supplier if none is registered- Returns:
- a constructor supplier or
creatorif there is none - See Also:
-