Class AbstractTestServer

java.lang.Object
test.de.iip_ecosphere.platform.transport.AbstractTestServer
All Implemented Interfaces:
de.iip_ecosphere.platform.support.Server
Direct Known Subclasses:
TestServerPluginDescriptor.JvmTestServer

public abstract class AbstractTestServer extends Object implements de.iip_ecosphere.platform.support.Server
A basic abstract server for testing/experiments.
Author:
Holger Eichelberger, SSE
  • Field Details

    • configDir

      private static File configDir
  • Constructor Details

    • AbstractTestServer

      public AbstractTestServer()
  • Method Details

    • setConfigDir

      public static final File setConfigDir(File directory)
      Defines the server configuration directory.
      Parameters:
      directory - the directory (may be null, leads to the given default value in getConfigDir(File))
      Returns:
      Directory
    • getConfigDir

      public static File getConfigDir(String deflt)
      Returns the server configuration directory.
      Parameters:
      deflt - the default value if setConfigDir(File) was not called before
      Returns:
      the server configuration directory
    • getConfigDir

      public static File getConfigDir(File deflt)
      Returns the server configuration directory.
      Parameters:
      deflt - the default value if setConfigDir(File) was not called before
      Returns:
      the server configuration directory
    • extractConfiguration

      public static void extractConfiguration(String location, String dfltConfigDir) throws IOException
      Extracts a server configuration from a resource from the actual class loader.
      Parameters:
      location - the location within the resource
      dfltConfigDir - the default configuration dir for getConfigDir(String)
      Throws:
      IOException - if something I/O related fails
    • extractConfiguration

      public static void extractConfiguration(ClassLoader loader, String location, String dfltConfigDir) throws IOException
      Extracts a server configuration from a resource.
      Parameters:
      loader - the class loader holding the resource
      location - the location within the resource
      dfltConfigDir - the default configuration dir for getConfigDir(String)
      Throws:
      IOException - if something I/O related fails
    • runsFromJar

      public static boolean runsFromJar()
      Returns whether this class is/we ware running from a JAR file.
      Returns:
      true for execution from JAR, false
    • getInteger

      public static int getInteger(String[] args, int dflt)
      Returns the integer number from the first argument in (command line) {code args}.
      Parameters:
      args - the arguments
      dflt - the default value if no argument is available
      Returns:
      the integer number
      See Also:
    • getInteger

      public static int getInteger(String[] args, int argIndex, int dflt)
      Returns the integer argument given in (command line) {code args} at argIndex.
      Parameters:
      args - the arguments
      argIndex - the 0-based argument index to read from
      dflt - the default value if no argument is available
      Returns:
      the integer argument
    • getString

      public static String getString(String[] args, int argIndex, String dflt)
      Returns the string argument given in (command line) {code args} at argIndex.
      Parameters:
      args - the arguments
      argIndex - the 0-based argument index to read from
      dflt - the default value if no argument is available
      Returns:
      the string argument
    • applyBaseDir

      public static File applyBaseDir(String[] args, int argIndex, String suffix)
      Applies the base directory from the (command line) {code args} at argIndex. If there is no argument or the given argument is not an existing directory, the default is used.
      Parameters:
      args - the arguments
      argIndex - the 0-based argument index to read from
      Returns:
      the base directory