com.gridsystems.config.modules.tomcat
Class TomcatConfigModel

java.lang.Object
  extended by com.gridsystems.config.modules.tomcat.TomcatConfigModel
All Implemented Interfaces:
ConfiguratorModel

public class TomcatConfigModel
extends java.lang.Object
implements ConfiguratorModel

Data model for the Tomcat configurator.

Version:
1.0
Author:
Rodrigo Ruiz, Xmas

Field Summary
protected static int ALLOWED_IP_TYPE
          Allowed type of the IPs.
static int DEFAULT_HTTP_PORT
          Default HTTP port.
static boolean DEFAULT_HTTPS_ENABLED
          Default HTTPS enabled flag.
static int DEFAULT_HTTPS_PORT
          Default HTTPS port.
static java.lang.String DEFAULT_KEYSTORE_DIR
          Default keystore directory.
static java.lang.String DEFAULT_KEYSTORE_PASS
          Default keystore password.
static int DEFAULT_RESTART_CODE
          Default server restart exit code.
static boolean DEFAULT_RESTART_ENABLED
          Default server restart enabled flag.
static int DEFAULT_SHUTDOWN_CODE
          Default server shutdown exit code.
static int DEFAULT_SHUTDOWN_PORT
          Default shutdown port.
static java.lang.String HOST_IP
          Property key name for the IP Address field.
 
Constructor Summary
TomcatConfigModel()
          Default constructor.
TomcatConfigModel(TomcatConfigModel m)
          Creates a new instance.
 
Method Summary
 void addConnector(Connector c)
          Adds a connector to the list.
 void apply()
          Performs changes in files external to the model data.
 Connector[] getConnectors()
          Gets the list of connectors.
static java.lang.String getCustomizerString(java.lang.String key)
          Gets customizer string value from key.
 int getHttpPort()
          Gets the HTTP port.
 int getHttpsPort()
          Gets the HTTPS port.
 java.lang.String getIp()
          Gets the IP address of the host.
 java.io.File getKeystoreDir()
          Gets the keystore directory.
 java.lang.String getKeystorePassword()
          Gets the keystore password.
protected  java.lang.String getKeystorePath()
          Gets the canonical path to the keystore directory.
 Connector getMaidenPort()
          Gets the port to be used by the Server Maiden.
static java.lang.String getProductName()
          Gets the name of the product to Install.
 int getRestartExitCode()
          Gets the restart exit code.
 int getShutdownExitCode()
          Gets the shutdown exit code.
 int getShutdownPort()
          Gets the shutdown port.
 boolean isHttpsEnabled()
          Gets the "HTTPS enabled" flag value.
 boolean isRestartEnabled()
          Gets the "Restart enabled" flag value.
 void load()
          Loads the model from persistence layer.
 void setConnectors(Connector[] cc)
          Sets the list of connectors.
 void setIp(java.lang.String ip)
          Sets the IP address of the host.
 void setKeystoreDir(java.io.File dir)
          Sets the keystore directory.
 void setKeystorePassword(java.lang.String pass)
          Sets the keystore password.
 void setRestartEnabled(boolean enabled)
          Enables or disables the restart control.
 void setRestartExitCode(int exitCode)
          Sets the exit code that will instruct the daemon to restart the server.
 void setShutdownExitCode(int exitCode)
          Sets the exit code that will instruct the daemon to not restart the server.
 void setShutdownPort(int port)
          Sets the port number for shutdown requests.
 void setShutdownPort(java.lang.String s)
          Sets the port for shutdown requests.
 void store()
          Stores the model in the persistence layer.
 void validate()
          Validate data of this Model.
 void validate(Connector[] conns)
          Validate data of this Model.
 void validate(java.util.List conns)
          Validate data of this Model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOWED_IP_TYPE

protected static final int ALLOWED_IP_TYPE
Allowed type of the IPs.

See Also:
Constant Field Values

HOST_IP

public static final java.lang.String HOST_IP
Property key name for the IP Address field.

See Also:
Constant Field Values

DEFAULT_SHUTDOWN_PORT

public static final int DEFAULT_SHUTDOWN_PORT
Default shutdown port.

See Also:
Constant Field Values

DEFAULT_HTTP_PORT

public static final int DEFAULT_HTTP_PORT
Default HTTP port.

See Also:
Constant Field Values

DEFAULT_HTTPS_PORT

public static final int DEFAULT_HTTPS_PORT
Default HTTPS port.

See Also:
Constant Field Values

DEFAULT_RESTART_CODE

public static final int DEFAULT_RESTART_CODE
Default server restart exit code.

See Also:
Constant Field Values

DEFAULT_SHUTDOWN_CODE

public static final int DEFAULT_SHUTDOWN_CODE
Default server shutdown exit code.

See Also:
Constant Field Values

DEFAULT_RESTART_ENABLED

public static final boolean DEFAULT_RESTART_ENABLED
Default server restart enabled flag.

See Also:
Constant Field Values

DEFAULT_HTTPS_ENABLED

public static final boolean DEFAULT_HTTPS_ENABLED
Default HTTPS enabled flag.

See Also:
Constant Field Values

DEFAULT_KEYSTORE_DIR

public static final java.lang.String DEFAULT_KEYSTORE_DIR
Default keystore directory.

See Also:
Constant Field Values

DEFAULT_KEYSTORE_PASS

public static final java.lang.String DEFAULT_KEYSTORE_PASS
Default keystore password.

See Also:
Constant Field Values
Constructor Detail

TomcatConfigModel

public TomcatConfigModel()
Default constructor.


TomcatConfigModel

public TomcatConfigModel(TomcatConfigModel m)
Creates a new instance.

Parameters:
m - The new model from which the old keystore password must be taken
Method Detail

getProductName

public static java.lang.String getProductName()
Gets the name of the product to Install.

Returns:
Name of the product to Install.

getCustomizerString

public static java.lang.String getCustomizerString(java.lang.String key)
Gets customizer string value from key.

Parameters:
key - Key of String.
Returns:
Value of customizer

getKeystorePath

protected java.lang.String getKeystorePath()
Gets the canonical path to the keystore directory.

Returns:
The canonical path to the keystore directory.

load

public void load()
Description copied from interface: ConfiguratorModel
Loads the model from persistence layer.

Specified by:
load in interface ConfiguratorModel
See Also:
ConfiguratorModel.load()

store

public void store()
           throws java.io.IOException
Stores the model in the persistence layer.

Specified by:
store in interface ConfiguratorModel
Throws:
java.io.IOException - In case of write error

apply

public void apply()
           throws java.io.IOException
Performs changes in files external to the model data.

Specified by:
apply in interface ConfiguratorModel
Throws:
java.io.IOException - In case of write error

getIp

public java.lang.String getIp()
Gets the IP address of the host.

Returns:
a String with the IP address of the host.

setIp

public void setIp(java.lang.String ip)
Sets the IP address of the host.

Parameters:
ip - a String with the IP address of the host.

getHttpPort

public int getHttpPort()
Gets the HTTP port.

Returns:
The HTTP port

getShutdownPort

public int getShutdownPort()
Gets the shutdown port.

Returns:
The shutdown port

getHttpsPort

public int getHttpsPort()
Gets the HTTPS port.

Returns:
The HTTPS port

getMaidenPort

public Connector getMaidenPort()
Gets the port to be used by the Server Maiden. Gets the port to be used by the Server Maiden. It will try to return, by priority:
  1. The "DefaultHTTP" port.
  2. The "DefaultHTTPS" port.
  3. Any other HTTP port.
  4. Any other HTTPS port.

Returns:
the selected port.

isHttpsEnabled

public boolean isHttpsEnabled()
Gets the "HTTPS enabled" flag value.

Returns:
The current "HTTPS enabled" flag value

isRestartEnabled

public boolean isRestartEnabled()
Gets the "Restart enabled" flag value.

Returns:
The current "Restart enabled" flag value

getRestartExitCode

public int getRestartExitCode()
Gets the restart exit code.

Returns:
The restart exit code

getShutdownExitCode

public int getShutdownExitCode()
Gets the shutdown exit code.

Returns:
The shutdown exit code

setShutdownPort

public void setShutdownPort(int port)
Sets the port number for shutdown requests.

Parameters:
port - The port number

setShutdownPort

public void setShutdownPort(java.lang.String s)
Sets the port for shutdown requests.

Parameters:
s - The port number. The default value is 8085. If s is not a valid number, the default value will be set.

setRestartEnabled

public void setRestartEnabled(boolean enabled)
Enables or disables the restart control.

Parameters:
enabled - Whether or not restart control must be enabled

setRestartExitCode

public void setRestartExitCode(int exitCode)
Sets the exit code that will instruct the daemon to restart the server.

Parameters:
exitCode - the exit code for restarts

setShutdownExitCode

public void setShutdownExitCode(int exitCode)
Sets the exit code that will instruct the daemon to not restart the server.

Parameters:
exitCode - The exit code for shutdowns

getKeystoreDir

public java.io.File getKeystoreDir()
Gets the keystore directory.

Returns:
The keystore directory

setKeystoreDir

public void setKeystoreDir(java.io.File dir)
Sets the keystore directory.

Parameters:
dir - The keystore directory

getKeystorePassword

public java.lang.String getKeystorePassword()
Gets the keystore password.

Returns:
The keystore password

setKeystorePassword

public void setKeystorePassword(java.lang.String pass)
Sets the keystore password.

Parameters:
pass - The keystore password

getConnectors

public Connector[] getConnectors()
Gets the list of connectors.

Returns:
the list of connectors

setConnectors

public void setConnectors(Connector[] cc)
                   throws java.lang.Exception
Sets the list of connectors.

Parameters:
cc - the list of connectors
Throws:
java.lang.Exception - If a validation error occurs

addConnector

public void addConnector(Connector c)
Adds a connector to the list.

Parameters:
c - the connector

validate

public void validate(java.util.List conns)
              throws java.lang.Exception
Validate data of this Model.

Parameters:
conns - the list of connectors to validate
Throws:
java.lang.Exception - In case of invalid data

validate

public void validate(Connector[] conns)
              throws java.lang.Exception
Validate data of this Model.

Parameters:
conns - the list of connectors to validate
Throws:
java.lang.Exception - In case of invalid data

validate

public void validate()
              throws java.lang.Exception
Validate data of this Model.

Specified by:
validate in interface ConfiguratorModel
Throws:
java.lang.Exception - In case of invalid data


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.