com.gridsystems.config.modules.jvm
Class JVMConfigModel

java.lang.Object
  extended by com.gridsystems.config.modules.jvm.JVMConfigModel
All Implemented Interfaces:
ConfiguratorModel

public class JVMConfigModel
extends java.lang.Object
implements ConfiguratorModel

Data Model for the JVM Configurator.

Version:
1.0
Author:
Rodrigo Ruiz Aguayo

Field Summary
static java.lang.String DEFAULT_CONFIG_PATH
          Path to the configuration file.
static java.lang.String DEFAULT_DEBUG_MODE
          Default remote debug mode.
static java.lang.String DEFAULT_DEBUG_PORT
          Default remote debug port.
static java.lang.String DEFAULT_DEBUG_SUSPEND
          Default initial suspension flag in debug mode.
static java.lang.String DEFAULT_HEAP_MAX
          Default max heap size.
static java.lang.String DEFAULT_HEAP_MIN
          Default min heap size.
static java.lang.String DEFAULT_PROXY_HOST
          Default proxy host name or IP address.
static java.lang.String DEFAULT_PROXY_PORT
          Default proxy port.
static java.lang.String DEFAULT_STACK_SIZE
          Default thread stack size.
static java.lang.String DEFAULT_USE_PROXY
          Default proxy usage mode.
 
Constructor Summary
JVMConfigModel(java.lang.String configFilePath)
          Creates a new instance.
 
Method Summary
 void addFlags(java.util.Collection<java.lang.String> flags)
          Adds a collection of command-line flags to the current set.
 void apply()
          Performs changes in files external to the model data.
 void copyModel(JVMConfigModel src)
          Copies the specified model data into this instance.
 java.lang.String getDebugEnabled()
          Gets whether debug mode is enabled or not.
 java.lang.String getDebugPort()
          Gets the remote debug port.
 java.lang.String getDebugSuspend()
          Gets whether the server JVM will start suspended.
 java.lang.String getMaxHeap()
          Gets the JVM heap maximum size.
 java.lang.String getMinHeap()
          Gets the JVM heap minimum size.
 java.lang.String getProperty(java.lang.String key, java.lang.String def)
          Gets a system property.
 java.lang.String getProxyHost()
          Gets the proxy host name / IP.
 java.lang.String getProxyPort()
          Gets the proxy port.
 java.lang.String getStackSize()
          Gets the JVM thread-stack size.
 java.lang.String getString(java.lang.String key)
          Gets a localized string.
 java.lang.String getString(java.lang.String key, java.lang.Object[] params)
          Gets a localized string, using the found string as a pattern to be used by a MessageFormat instance.
 java.lang.String getUseProxy()
          Gets whether proxy use is enabled or not.
 java.lang.String getValue(java.lang.String key, java.lang.String def)
          Gets a field value.
 void load()
          Loads the model from persistence layer.
 void setProperty(java.lang.String key, java.lang.String value)
          Sets a system property.
 void setValue(java.lang.String key, java.lang.Object value)
          Sets a field value.
 void store()
          Stores the model in the persistence layer.
 void validate()
          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

DEFAULT_HEAP_MAX

public static final java.lang.String DEFAULT_HEAP_MAX
Default max heap size.

See Also:
Constant Field Values

DEFAULT_HEAP_MIN

public static final java.lang.String DEFAULT_HEAP_MIN
Default min heap size.

See Also:
Constant Field Values

DEFAULT_STACK_SIZE

public static final java.lang.String DEFAULT_STACK_SIZE
Default thread stack size.

See Also:
Constant Field Values

DEFAULT_USE_PROXY

public static final java.lang.String DEFAULT_USE_PROXY
Default proxy usage mode.

See Also:
Constant Field Values

DEFAULT_PROXY_HOST

public static final java.lang.String DEFAULT_PROXY_HOST
Default proxy host name or IP address.

See Also:
Constant Field Values

DEFAULT_PROXY_PORT

public static final java.lang.String DEFAULT_PROXY_PORT
Default proxy port.

See Also:
Constant Field Values

DEFAULT_DEBUG_MODE

public static final java.lang.String DEFAULT_DEBUG_MODE
Default remote debug mode.

See Also:
Constant Field Values

DEFAULT_DEBUG_PORT

public static final java.lang.String DEFAULT_DEBUG_PORT
Default remote debug port.

See Also:
Constant Field Values

DEFAULT_DEBUG_SUSPEND

public static final java.lang.String DEFAULT_DEBUG_SUSPEND
Default initial suspension flag in debug mode.

See Also:
Constant Field Values

DEFAULT_CONFIG_PATH

public static final java.lang.String DEFAULT_CONFIG_PATH
Path to the configuration file.

See Also:
Constant Field Values
Constructor Detail

JVMConfigModel

public JVMConfigModel(java.lang.String configFilePath)
Creates a new instance.

Parameters:
configFilePath - Path to file where read properties.
Method Detail

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets a system property.

Parameters:
key - The system property name
value - The system property value

setValue

public void setValue(java.lang.String key,
                     java.lang.Object value)
Sets a field value.

Parameters:
key - The field name
value - The field value

getValue

public java.lang.String getValue(java.lang.String key,
                                 java.lang.String def)
Gets a field value.

Parameters:
key - The field name
def - The default field value
Returns:
The field value

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String def)
Gets a system property.

Parameters:
key - The system property name
def - The system property default value
Returns:
The system property value

addFlags

public void addFlags(java.util.Collection<java.lang.String> flags)
Adds a collection of command-line flags to the current set.

Parameters:
flags - The flags collection

getMinHeap

public java.lang.String getMinHeap()
Gets the JVM heap minimum size.

Returns:
The JVM heap minimum size

getMaxHeap

public java.lang.String getMaxHeap()
Gets the JVM heap maximum size.

Returns:
The JVM heap maximum size

getStackSize

public java.lang.String getStackSize()
Gets the JVM thread-stack size.

Returns:
The JVM thread-stack size

getUseProxy

public java.lang.String getUseProxy()
Gets whether proxy use is enabled or not.

Returns:
"true" if enabled; "false" if not

getProxyHost

public java.lang.String getProxyHost()
Gets the proxy host name / IP.

Returns:
The proxy host name or IP address

getProxyPort

public java.lang.String getProxyPort()
Gets the proxy port.

Returns:
The proxy port

getDebugEnabled

public java.lang.String getDebugEnabled()
Gets whether debug mode is enabled or not.

Returns:
"true" if remote debugging is enabled; "false" if not

getDebugPort

public java.lang.String getDebugPort()
Gets the remote debug port.

Returns:
The debug port the debugger will connect to

getDebugSuspend

public java.lang.String getDebugSuspend()
Gets whether the server JVM will start suspended.

Returns:
"true" if the JVM will start suspended; "false" if not

copyModel

public void copyModel(JVMConfigModel src)
Copies the specified model data into this instance. Only "editable" fields are copied. The extraFlags set is not included, as it is not directly editable from this configurator views.

Parameters:
src - The source model

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

validate

public void validate()
              throws java.io.IOException
Validate data of this Model.

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

getString

public java.lang.String getString(java.lang.String key)
Gets a localized string.

Parameters:
key - The i18n key
Returns:
The localized string, or null if none found for key
Throws:
java.lang.NullPointerException - if the bundle is not set

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.Object[] params)
Gets a localized string, using the found string as a pattern to be used by a MessageFormat instance.

Parameters:
key - The key for the localized pattern
params - The parameters for pattern substitution
Returns:
The localized / formatter string
Throws:
java.lang.NullPointerException - if the bundle is not set


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