Class AbstractAasLifecycleDescriptor
java.lang.Object
de.iip_ecosphere.platform.support.iip_aas.AbstractAasLifecycleDescriptor
- All Implemented Interfaces:
de.iip_ecosphere.platform.support.LifecycleDescriptor
public class AbstractAasLifecycleDescriptor
extends Object
implements de.iip_ecosphere.platform.support.LifecycleDescriptor
Implements the generic lifecycle descriptor for the service manager.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate de.iip_ecosphere.platform.support.Serverprivate static de.iip_ecosphere.platform.support.Serverprivate static de.iip_ecosphere.platform.support.aas.ProtocolServerBuilderprivate Stringstatic final StringExplicitly determine the AAS implementation server port.private Supplier<AasPartRegistry.AasSetup> private Timerprivate static booleanFields inherited from interface de.iip_ecosphere.platform.support.LifecycleDescriptor
AAS_PRIORITY, CMD_LINE_PRIORITY, INIT_PRIORITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAasLifecycleDescriptor(String name, Supplier<AasPartRegistry.AasSetup> setupSupplier) Creates a descriptor instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddeploy(String[] args, Predicate<AasContributor> contributorFilter) Deploys the AAS viaAasPartRegistry.build()and depending on theAasPartRegistry.AasModeAasPartRegistry.register(java.util.List, de.iip_ecosphere.platform.support.Endpoint, String...)orAasPartRegistry.remoteDeploy(java.util.List).protected booleanReturns whether AAS server heartbeat shall be enabled.Returns the AAS setup via the passed in setup supplier.protected Predicate<AasContributor> Allows to dynamically filter the contributors.protected StringReturns the name of a command line/system environment parameter overridingPARAM_IIP_PORT.private static intReturns the port value, either from args or from the system environment.protected booleanReturns whether we have an IIP AAS.intpriority()static booleansetWaitForIipAas(boolean wait) Defines whether we shall wait for the IIP AAs to come up.voidshutdown()voidprotected voidWaits for the AAS server to come up.
-
Field Details
-
PARAM_IIP_PORT
Explicitly determine the AAS implementation server port. If not given, use an ephemeral one.- See Also:
-
AAS_HEARTBEAT_PERIOD
private static final int AAS_HEARTBEAT_PERIOD- See Also:
-
implServer
private static de.iip_ecosphere.platform.support.Server implServer -
implServerBuilder
private static de.iip_ecosphere.platform.support.aas.ProtocolServerBuilder implServerBuilder -
waitForIipAas
private static boolean waitForIipAas -
name
-
setupSupplier
-
aasServer
private de.iip_ecosphere.platform.support.Server aasServer -
timer
-
-
Constructor Details
-
AbstractAasLifecycleDescriptor
protected AbstractAasLifecycleDescriptor(String name, Supplier<AasPartRegistry.AasSetup> setupSupplier) Creates a descriptor instance.- Parameters:
name- the name of the AAS to build for loggingsetupSupplier- theAasPartRegistry.AasSetupsupplier
-
-
Method Details
-
setWaitForIipAas
public static boolean setWaitForIipAas(boolean wait) Defines whether we shall wait for the IIP AAs to come up. [testing]- Parameters:
wait-truefor waiting,falsefor not waiting- Returns:
- the previous value
-
getAasSetup
Returns the AAS setup via the passed in setup supplier.- Returns:
- the actual AAS setup
-
getOverridePortArg
Returns the name of a command line/system environment parameter overridingPARAM_IIP_PORT.- Returns:
- the name of the parameter, null for none (default)
-
getPort
Returns the port value, either from args or from the system environment.- Parameters:
args- the command line argumentsarg- the parameter name to search forinit- the initial value, a already known port if chained, usually-1- Returns:
- the port, may be
-1for none - See Also:
-
getContributorFilter
Allows to dynamically filter the contributors. May rely onAasPartRegistry.contributors()or onAasPartRegistry.contributorClasses().- Returns:
- the filter, by default a function that returns
true
-
startup
- Specified by:
startupin interfacede.iip_ecosphere.platform.support.LifecycleDescriptor
-
deploy
Deploys the AAS viaAasPartRegistry.build()and depending on theAasPartRegistry.AasModeAasPartRegistry.register(java.util.List, de.iip_ecosphere.platform.support.Endpoint, String...)orAasPartRegistry.remoteDeploy(java.util.List).- Parameters:
args- the command line arguments fromstartup(String[])contributorFilter- the AAS contributor filter to apply
-
enableAasHeartbeat
protected boolean enableAasHeartbeat()Returns whether AAS server heartbeat shall be enabled.- Returns:
truefor enabled,falseelse
-
waitForAasServer
protected void waitForAasServer()Waits for the AAS server to come up. -
iipAasExists
protected boolean iipAasExists()Returns whether we have an IIP AAS.- Returns:
truethe AAS exists,falseelse
-
shutdown
public void shutdown()- Specified by:
shutdownin interfacede.iip_ecosphere.platform.support.LifecycleDescriptor
-
getShutdownHook
- Specified by:
getShutdownHookin interfacede.iip_ecosphere.platform.support.LifecycleDescriptor
-
priority
public int priority()- Specified by:
priorityin interfacede.iip_ecosphere.platform.support.LifecycleDescriptor
-