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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FileapplyBaseDir(String[] args, int argIndex, String suffix) Applies the base directory from the (command line) {code args} atargIndex.static voidextractConfiguration(ClassLoader loader, String location, String dfltConfigDir) Extracts a server configuration from a resource.static voidextractConfiguration(String location, String dfltConfigDir) Extracts a server configuration from a resource from the actual class loader.static FilegetConfigDir(File deflt) Returns the server configuration directory.static FilegetConfigDir(String deflt) Returns the server configuration directory.static intgetInteger(String[] args, int dflt) Returns the integer number from the first argument in (command line) {code args}.static intgetInteger(String[] args, int argIndex, int dflt) Returns the integer argument given in (command line) {code args} atargIndex.static StringReturns the string argument given in (command line) {code args} atargIndex.static booleanReturns whether this class is/we ware running from a JAR file.static final FilesetConfigDir(File directory) Defines the server configuration directory.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.iip_ecosphere.platform.support.Server
start, stop
-
Field Details
-
configDir
-
-
Constructor Details
-
AbstractTestServer
public AbstractTestServer()
-
-
Method Details
-
setConfigDir
Defines the server configuration directory.- Parameters:
directory- the directory (may be null, leads to the given default value ingetConfigDir(File))- Returns:
Directory
-
getConfigDir
Returns the server configuration directory.- Parameters:
deflt- the default value ifsetConfigDir(File)was not called before- Returns:
- the server configuration directory
-
getConfigDir
Returns the server configuration directory.- Parameters:
deflt- the default value ifsetConfigDir(File)was not called before- Returns:
- the server configuration directory
-
extractConfiguration
Extracts a server configuration from a resource from the actual class loader.- Parameters:
location- the location within the resourcedfltConfigDir- the default configuration dir forgetConfigDir(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 resourcelocation- the location within the resourcedfltConfigDir- the default configuration dir forgetConfigDir(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:
truefor execution from JAR,false
-
getInteger
Returns the integer number from the first argument in (command line) {code args}.- Parameters:
args- the argumentsdflt- the default value if no argument is available- Returns:
- the integer number
- See Also:
-
getInteger
Returns the integer argument given in (command line) {code args} atargIndex.- Parameters:
args- the argumentsargIndex- the 0-based argument index to read fromdflt- the default value if no argument is available- Returns:
- the integer argument
-
getString
Returns the string argument given in (command line) {code args} atargIndex.- Parameters:
args- the argumentsargIndex- the 0-based argument index to read fromdflt- the default value if no argument is available- Returns:
- the string argument
-
applyBaseDir
Applies the base directory from the (command line) {code args} atargIndex. If there is no argument or the given argument is not an existing directory, the default is used.- Parameters:
args- the argumentsargIndex- the 0-based argument index to read from- Returns:
- the base directory
-