Class AbstractDelegatingService<S extends Service>
java.lang.Object
de.iip_ecosphere.platform.services.environment.AbstractDelegatingService<S>
- Type Parameters:
S- the type of service to delegate to
- All Implemented Interfaces:
ParameterConfigurerProvider,Service,ServiceBase
- Direct Known Subclasses:
AbstractDelegatingMultiService
public abstract class AbstractDelegatingService<S extends Service>
extends Object
implements Service
A service that delegates it's core operations to a nested service.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsFields inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
APPLICATION_SEPARATOR, DEFAULT_APPLICATION_INSTANCE_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the service.protected final voidassignService(YamlService yaml) Assigns the service by callingcreateService(YamlService).protected abstract ScreateService(YamlService yaml) Creates the nested service instance to delegate to.The description of the service.getId()Returns the unique id of the service.getKind()Returns the service kind.getName()The name of the service.protected SReturns the service the operations are delegated to.getState()Returns the state the service is currently in.de.iip_ecosphere.platform.support.VersionThe version of the service.protected voidinitService(YamlService yaml) Assigns the service by callingassignService(YamlService).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.voidsetState(ServiceState state) Changes the state.voidSwitches to an interface-compatible service.voidUpdates the service by the service in the givenlocation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.iip_ecosphere.platform.services.environment.Service
addTypeSubstitution, createType, createType, getNetMgtKeyAddress, getParameterConfigurer, getParameterNames, getSubstitutedType, getTypeCreator, getTypeSubstitutions
-
Field Details
-
service
-
-
Constructor Details
-
AbstractDelegatingService
Creates an instance.- Parameters:
yaml- the service description YAML- See Also:
-
-
Method Details
-
initService
Assigns the service by callingassignService(YamlService). May be overridden to do nothing ifassignService(YamlService)is called later.- Parameters:
yaml- the service description YAML- See Also:
-
assignService
Assigns the service by callingcreateService(YamlService).- Parameters:
yaml- the service description YAML
-
createService
Creates the nested service instance to delegate to.- Parameters:
yaml- the service description YAML- Returns:
- the service instance
-
getName
Description copied from interface:ServiceThe name of the service. -
getVersion
public de.iip_ecosphere.platform.support.Version getVersion()Description copied from interface:ServiceThe version of the service.- Specified by:
getVersionin interfaceService- Returns:
- the version
-
getDescription
Description copied from interface:ServiceThe description of the service.- Specified by:
getDescriptionin interfaceService- Returns:
- the description, may be empty
-
isDeployable
public boolean isDeployable()Description copied from interface:ServiceReturns whether the service is deployable in distributable manner or fixed in deployment location.- Specified by:
isDeployablein interfaceService- Returns:
truefor deployable,falsefor fixed
-
isTopLevel
public boolean isTopLevel()Description copied from interface:ServiceReturns whether the service is a top-level service.- Specified by:
isTopLevelin interfaceService- Returns:
truefor top-level,falsefor nested
-
getKind
Description copied from interface:ServiceReturns the service kind. -
migrate
Description copied from interface:ServiceMigrates a service. However, it may be required to migrate/move the containing artifact. [adaptation]- Specified by:
migratein interfaceService- Parameters:
resourceId- the target resource id, e.g., a device- Throws:
ExecutionException- if migration fails
-
update
Description copied from interface:ServiceUpdates 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.- Specified by:
updatein interfaceService- 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
Description copied from interface:ServiceSwitches to an interface-compatible service. This method cares for stopping the old service, performing a handover if adequate, starting thetargetservice. [adaptation]- Specified by:
switchToin interfaceService- Parameters:
targetId- the id of the target service- Throws:
ExecutionException- if switching the service cannot be performed for some reason
-
activate
Description copied from interface:ServiceActivates the service. [adaptation]- Specified by:
activatein interfaceService- Throws:
ExecutionException- in case that activating fails, e.g., because the service is already active
-
passivate
Description copied from interface:ServicePassivates the service. [adaptation]- Specified by:
passivatein interfaceService- Throws:
ExecutionException- in case that passivating fails, e.g., because the service is already passive
-
reconfigure
Description copied from interface:ServiceReconfigures the service. [adaptation]- Specified by:
reconfigurein interfaceService- 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
-
getId
Description copied from interface:ServiceBaseReturns the unique id of the service. May be a single service id, a service id and a postfixed application id (afterServiceBase.APPLICATION_SEPARATOR) or a service id with application id and postfixed application instance id (afterServiceBase.APPLICATION_SEPARATOR)- Specified by:
getIdin interfaceServiceBase- Returns:
- the unique id
-
getState
Description copied from interface:ServiceBaseReturns the state the service is currently in. [R4c]- Specified by:
getStatein interfaceServiceBase- Returns:
- the state
-
setState
Description copied from interface:ServiceBaseChanges the state. [R133c]- Specified by:
setStatein interfaceServiceBase- Parameters:
state- the new state- Throws:
ExecutionException- if changing the state fails for some reason
-
getService
Returns the service the operations are delegated to.- Returns:
- the service instance
-