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 Classes
    Modifier and Type
    Class
    Description
    protected static class 
    Supports Spring app configuration.
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.springframework.context.ConfigurableApplicationContext
     
    private org.springframework.context.ConfigurableApplicationContext
     
    private List<de.iip_ecosphere.platform.support.function.IORunnable>
     
    private static final boolean
     
    private org.springframework.context.ConfigurableApplicationContext
     
    private org.springframework.context.ConfigurableApplicationContext
     
    private de.iip_ecosphere.platform.support.aas.SetupSpec
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BaSyxAbstractAasServer(de.iip_ecosphere.platform.support.aas.SetupSpec spec, BaSyxAbstractAasServer.ServerType type, String... options)
    Creates a new BaSyx AAS server.
  • Method Summary

    Modifier and Type
    Method
    Description
    addActionsAfterStart(List<de.iip_ecosphere.platform.support.function.IORunnable> actions)
    Adds actions to be executed after starting all servers.
    (package private) static void
    close(org.springframework.context.ConfigurableApplicationContext ctx, Consumer<de.iip_ecosphere.platform.support.aas.SetupSpec.State> stateConsumer)
    Closes an application context.
    (package private) static BaSyxAbstractAasServer.AppConfigurer
    Creates a default context configurer.
    (package private) static BaSyxAbstractAasServer.AppConfigurer
    createConfigurer(de.iip_ecosphere.platform.support.aas.SetupSpec.ComponentSetup setup)
    Creates a default context configurer.
    (package private) static BaSyxAbstractAasServer.AppConfigurer
    createConfigurer(org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext> initializer)
    Creates a default context configurer with initializer.
    (package private) 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 with initializer.
    protected static org.springframework.context.ConfigurableApplicationContext
    createContext(Class<?> cls, int port)
    Creates a context.
    protected static org.springframework.context.ConfigurableApplicationContext
    Creates a context.
    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.
    void
    deploy(de.iip_ecosphere.platform.support.aas.Aas aas)
     
    void
    deploy(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 boolean
    Returns whether this thread is running in Junit.
    (package private) 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.
    de.iip_ecosphere.platform.support.aas.AasServer
     
    void
    stop(boolean dispose)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      private List<de.iip_ecosphere.platform.support.function.IORunnable> 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 specification
      type - the server type
      options - 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

      protected abstract Class<?> 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

      protected abstract Class<?> 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

      protected abstract Class<?> 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

      protected abstract Class<?> 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 for
      port - 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 for
      port - the server port
      Returns:
      the context
    • createConfigurer

      static BaSyxAbstractAasServer.AppConfigurer 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 with initializer.
      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 with initializer.
      Parameters:
      initializer - the initializer, may be null for none
      setup - 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:
      true for junit, false else
    • 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 port
      configurer - the application configurer
      stateConsumer - a function handling state changes on starting instances
      Returns:
      the context (may be null)
    • deploy

      public void deploy(de.iip_ecosphere.platform.support.aas.Aas aas) throws IOException
      Specified by:
      deploy in interface de.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:
      deploy in interface de.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:
      true for start
    • start

      public de.iip_ecosphere.platform.support.aas.AasServer start()
      Specified by:
      start in interface de.iip_ecosphere.platform.support.aas.AasServer
      Specified by:
      start in interface de.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 when ctx is closed, may be null
    • stop

      public void stop(boolean dispose)
      Specified by:
      stop in interface de.iip_ecosphere.platform.support.Server