Class BaSyxAbstractAasServer
java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx2.server.BaSyxAbstractAasServer
- All Implemented Interfaces:
de.iip_ecosphere.platform.support.aas.AasServer,de.iip_ecosphere.platform.support.Server
- Direct Known Subclasses:
BaSyxLocalServer
abstract class BaSyxAbstractAasServer
extends Object
implements de.iip_ecosphere.platform.support.aas.AasServer
Basic implementation of the the
AasServer.- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classSupports Spring app configuration.static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.springframework.context.ConfigurableApplicationContextprivate org.springframework.context.ConfigurableApplicationContextprivate List<de.iip_ecosphere.platform.support.function.IORunnable> private static final booleanprivate org.springframework.context.ConfigurableApplicationContextprivate org.springframework.context.ConfigurableApplicationContextprivate de.iip_ecosphere.platform.support.aas.SetupSpec -
Constructor Summary
ConstructorsConstructorDescriptionBaSyxAbstractAasServer(de.iip_ecosphere.platform.support.aas.SetupSpec spec, BaSyxAbstractAasServer.ServerType type, String... options) Creates a new BaSyx AAS server. -
Method Summary
Modifier and TypeMethodDescriptionaddActionsAfterStart(List<de.iip_ecosphere.platform.support.function.IORunnable> actions) Adds actions to be executed after starting all servers.(package private) static voidclose(org.springframework.context.ConfigurableApplicationContext ctx, Consumer<de.iip_ecosphere.platform.support.aas.SetupSpec.State> stateConsumer) Closes an application context.(package private) static BaSyxAbstractAasServer.AppConfigurerCreates a default context configurer.(package private) static BaSyxAbstractAasServer.AppConfigurercreateConfigurer(de.iip_ecosphere.platform.support.aas.SetupSpec.ComponentSetup setup) Creates a default context configurer.(package private) static BaSyxAbstractAasServer.AppConfigurercreateConfigurer(org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> initializer) Creates a default context configurer withinitializer.(package private) static BaSyxAbstractAasServer.AppConfigurercreateConfigurer(org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> initializer, de.iip_ecosphere.platform.support.aas.SetupSpec.ComponentSetup setup) Creates a default context configurer withinitializer.protected static org.springframework.context.ConfigurableApplicationContextcreateContext(Class<?> cls, int port) Creates a context.protected static org.springframework.context.ConfigurableApplicationContextcreateContext(Class<?> cls, int port, BaSyxAbstractAasServer.AppConfigurer configurer) Creates a context.protected static org.springframework.context.ConfigurableApplicationContextcreateContext(Class<?> cls, int port, BaSyxAbstractAasServer.AppConfigurer configurer, Consumer<de.iip_ecosphere.platform.support.aas.SetupSpec.State> stateConsumer) Creates a context with initialization.voiddeploy(de.iip_ecosphere.platform.support.aas.Aas aas) voiddeploy(de.iip_ecosphere.platform.support.aas.Aas aas, de.iip_ecosphere.platform.support.aas.Submodel submodel) protected abstract Class<?> Returns the class to use implementing the AAS registry application/server.protected org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> Returns an optional application context initializer for AAS registries.protected abstract Class<?> Returns the class to use implementing the AAS repository application/server.protected org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> Returns an optional application context initializer for AAS repositories.protected abstract Class<?> Returns the class to use implementing the submodel registry application/server.protected org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> Returns an optional application context initializer for submodel registries.protected abstract Class<?> Returns the class to use implementing the submodel repository application/server.protected org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> Returns an optional application context initializer for submodel repositories.static booleanReturns whether this thread is running in Junit.(package private) static booleanshallStart(de.iip_ecosphere.platform.support.aas.SetupSpec.State state) Returns whether a server process shall be started based on the given state.de.iip_ecosphere.platform.support.aas.AasServerstart()voidstop(boolean dispose)
-
Field Details
-
DEBUG
private static final boolean DEBUG- See Also:
-
spec
private de.iip_ecosphere.platform.support.aas.SetupSpec spec -
type
-
aasRepoCtx
private org.springframework.context.ConfigurableApplicationContext aasRepoCtx -
smRepoCtx
private org.springframework.context.ConfigurableApplicationContext smRepoCtx -
aasRegistryCtx
private org.springframework.context.ConfigurableApplicationContext aasRegistryCtx -
smRegistryCtx
private org.springframework.context.ConfigurableApplicationContext smRegistryCtx -
actionsAfterStart
-
-
Constructor Details
-
BaSyxAbstractAasServer
BaSyxAbstractAasServer(de.iip_ecosphere.platform.support.aas.SetupSpec spec, BaSyxAbstractAasServer.ServerType type, String... options) Creates a new BaSyx AAS server.- Parameters:
spec- the setup specificationtype- the server typeoptions- optional server options
-
-
Method Details
-
addActionsAfterStart
public BaSyxAbstractAasServer addActionsAfterStart(List<de.iip_ecosphere.platform.support.function.IORunnable> actions) Adds actions to be executed after starting all servers.- Parameters:
actions- the actions- Returns:
- this for chaining
-
getAasRepositoryAppClass
Returns the class to use implementing the AAS repository application/server.- Returns:
- the class
-
getAasRepositoryAppInitializer
protected org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> getAasRepositoryAppInitializer()Returns an optional application context initializer for AAS repositories.- Returns:
- the initializer, may be null for none
-
getSmRepositoryAppClass
Returns the class to use implementing the submodel repository application/server.- Returns:
- the class
-
getSmRepositoryAppInitializer
protected org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> getSmRepositoryAppInitializer()Returns an optional application context initializer for submodel repositories.- Returns:
- the initializer, may be null for none
-
getAasRegistryAppClass
Returns the class to use implementing the AAS registry application/server.- Returns:
- the class
-
getAasRegistryAppInitializer
protected org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> getAasRegistryAppInitializer()Returns an optional application context initializer for AAS registries.- Returns:
- the initializer, may be null for none
-
getSmRegistryAppClass
Returns the class to use implementing the submodel registry application/server.- Returns:
- the class
-
getSmRegistryAppInitializer
protected org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> getSmRegistryAppInitializer()Returns an optional application context initializer for submodel registries.- Returns:
- the initializer, may be null for none
-
createContext
protected static org.springframework.context.ConfigurableApplicationContext createContext(Class<?> cls, int port) Creates a context.- Parameters:
cls- the class to create the context forport- the server port- Returns:
- the context
-
createContext
protected static org.springframework.context.ConfigurableApplicationContext createContext(Class<?> cls, int port, BaSyxAbstractAasServer.AppConfigurer configurer) Creates a context.- Parameters:
cls- the class to create the context forport- the server port- Returns:
- the context
-
createConfigurer
Creates a default context configurer.- Returns:
- the configurer
-
createConfigurer
static BaSyxAbstractAasServer.AppConfigurer createConfigurer(de.iip_ecosphere.platform.support.aas.SetupSpec.ComponentSetup setup) Creates a default context configurer.- Parameters:
setup- the component setup corresponding to the application, may be null for none- Returns:
- the configurer
-
createConfigurer
static BaSyxAbstractAasServer.AppConfigurer createConfigurer(org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> initializer) Creates a default context configurer withinitializer.- Parameters:
initializer- the initializer, may be null for none- Returns:
- the configurer
-
createConfigurer
static BaSyxAbstractAasServer.AppConfigurer createConfigurer(org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> initializer, de.iip_ecosphere.platform.support.aas.SetupSpec.ComponentSetup setup) Creates a default context configurer withinitializer.- Parameters:
initializer- the initializer, may be null for nonesetup- the component setup corresponding to the application, may be null for none- Returns:
- the configurer
-
isJUnitTest
public static boolean isJUnitTest()Returns whether this thread is running in Junit.- Returns:
truefor junit,falseelse
-
createContext
protected static org.springframework.context.ConfigurableApplicationContext createContext(Class<?> cls, int port, BaSyxAbstractAasServer.AppConfigurer configurer, Consumer<de.iip_ecosphere.platform.support.aas.SetupSpec.State> stateConsumer) Creates a context with initialization.- Parameters:
cls- the class to create the context for (may be null for none)port- the server portconfigurer- the application configurerstateConsumer- a function handling state changes on starting instances- Returns:
- the context (may be null)
-
deploy
- Specified by:
deployin interfacede.iip_ecosphere.platform.support.aas.AasServer- Throws:
IOException
-
deploy
public void deploy(de.iip_ecosphere.platform.support.aas.Aas aas, de.iip_ecosphere.platform.support.aas.Submodel submodel) throws IOException - Specified by:
deployin interfacede.iip_ecosphere.platform.support.aas.AasServer- Throws:
IOException
-
shallStart
static boolean shallStart(de.iip_ecosphere.platform.support.aas.SetupSpec.State state) Returns whether a server process shall be started based on the given state.- Parameters:
state- the state- Returns:
truefor start
-
start
public de.iip_ecosphere.platform.support.aas.AasServer start()- Specified by:
startin interfacede.iip_ecosphere.platform.support.aas.AasServer- Specified by:
startin interfacede.iip_ecosphere.platform.support.Server
-
close
static void close(org.springframework.context.ConfigurableApplicationContext ctx, Consumer<de.iip_ecosphere.platform.support.aas.SetupSpec.State> stateConsumer) Closes an application context.- Parameters:
ctx- the context, may be null (ignored then)stateConsumer- optional state consumer to be called whenctxis closed, may be null
-
stop
public void stop(boolean dispose) - Specified by:
stopin interfacede.iip_ecosphere.platform.support.Server
-