Class FamilyServiceStub
- java.lang.Object
-
- de.iip_ecosphere.platform.services.environment.AbstractService
-
- de.iip_ecosphere.platform.services.environment.DefaultServiceImpl
-
- de.iip_ecosphere.platform.services.environment.FamilyServiceStub
-
- All Implemented Interfaces:
ParameterConfigurerProvider,Service,ServiceBase
public class FamilyServiceStub extends DefaultServiceImpl
Family service implementations are supposed to delegate their operations to the (alternative) active family member. Thus, there may not be a fully fledged service implementation for the family and management operations may just not work. This class is a basis for a no-operation service (stub) that delegates relevant operations to its active service. To not further interfere with the switching mechanism, the active service is provided via a supplier. Currently, not all management operations are supported, e.g., migrate, switch etc. are missing (in theServiceBaseinterface).- Author:
- Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Supplier<ServiceBase>active-
Fields inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
APPLICATION_SEPARATOR, DEFAULT_APPLICATION_INSTANCE_ID
-
-
Constructor Summary
Constructors Constructor Description FamilyServiceStub(java.lang.String serviceId, java.io.InputStream ymlFile)Creates a family service stub from a service id and a YAML artifact.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceStategetState()Returns the state the service is currently in.voidsetActiveMemberSupplier(java.util.function.Supplier<ServiceBase> active)Changes the active service member.voidsetState(ServiceState state)Changes the state.-
Methods inherited from class de.iip_ecosphere.platform.services.environment.DefaultServiceImpl
migrate, switchTo, update
-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractService
activate, addConfigurer, addConfigurer, addConfigurer, createInstance, createInstance, createInstance, getDescription, getId, getKind, getName, getNetMgtKeyAddress, getResourceAsStream, getVersion, initializeFrom, isDeployable, isTopLevel, notifyReconfigured, passivate, reconf, reconfigure, reconfigure, rollbackReconfigurationOnFailure, setLibJars, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.iip_ecosphere.platform.services.environment.Service
getParameterConfigurer, getParameterNames
-
-
-
-
Field Detail
-
active
private java.util.function.Supplier<ServiceBase> active
-
-
Constructor Detail
-
FamilyServiceStub
public FamilyServiceStub(java.lang.String serviceId, java.io.InputStream ymlFile)Creates a family service stub from a service id and a YAML artifact.- Parameters:
serviceId- the service idymlFile- the YML file containing the YAML artifact with the service descriptor
-
-
Method Detail
-
setActiveMemberSupplier
public void setActiveMemberSupplier(java.util.function.Supplier<ServiceBase> active)
Changes the active service member.- Parameters:
active- the new active member
-
setState
public void setState(ServiceState state) throws java.util.concurrent.ExecutionException
Description copied from class:AbstractServiceChanges the state. [R133c]- Specified by:
setStatein interfaceServiceBase- Overrides:
setStatein classAbstractService- Parameters:
state- the new state- Throws:
java.util.concurrent.ExecutionException- if changing the state fails for some reason- See Also:
AbstractService.start(),AbstractService.stop()
-
getState
public ServiceState getState()
Description copied from interface:ServiceBaseReturns the state the service is currently in. [R4c]- Specified by:
getStatein interfaceServiceBase- Overrides:
getStatein classAbstractService- Returns:
- the state
-
-