net.grinder.console.model
Class ConsoleProperties

java.lang.Object
  extended by net.grinder.console.model.ConsoleProperties

public final class ConsoleProperties
extends Object

Class encapsulating the console options.

Adds fixed interface and listener mechanism, but delegates to GrinderProperties for storage.

Implements the read-only part of Map<String, Object>.

Author:
Philip Aston

Field Summary
static String COLLECT_SAMPLES_PROPERTY
          Property name.
static String CONSOLE_HOST_PROPERTY
          Property name.
static String CONSOLE_PORT_PROPERTY
          Property name.
static String DEFAULT_DISTRIBUTION_FILE_FILTER_EXPRESSION
          Default regular expression for filtering distribution files.
static String DISTRIBUTE_ON_START_ASK_PROPERTY
          Property name.
static String DISTRIBUTION_DIRECTORY_PROPERTY
          Property name.
static String DISTRIBUTION_FILE_FILTER_EXPRESSION_PROPERTY
          Property name.
static String EXTERNAL_EDITOR_ARGUMENTS_PROPERTY
          Property name.
static String EXTERNAL_EDITOR_COMMAND_PROPERTY
          Property name.
static String FRAME_BOUNDS_PROPERTY
          Property name.
static String HTTP_HOST_PROPERTY
          Property name.
static String HTTP_PORT_PROPERTY
          Property name.
static String IGNORE_SAMPLES_PROPERTY
          Property name.
static String LOOK_AND_FEEL_PROPERTY
          Property name.
static String PROPERTIES_FILE_PROPERTY
          Property name.
static String PROPERTIES_NOT_SET_ASK_PROPERTY
          Property name.
static String RESET_CONSOLE_WITH_PROCESSES_ASK_PROPERTY
          Property name.
static String RESET_CONSOLE_WITH_PROCESSES_PROPERTY
          Property name.
static String SAMPLE_INTERVAL_PROPERTY
          Property name.
static String SAVE_TOTALS_WITH_RESULTS_PROPERTY
          Property name.
static String SCAN_DISTRIBUTION_FILES_PERIOD_PROPERTY
          Property name.
static String SIG_FIG_PROPERTY
          Property name.
static String START_WITH_UNSAVED_BUFFERS_ASK_PROPERTY
          Property name.
static String STOP_PROCESSES_ASK_PROPERTY
          Property name.
 
Constructor Summary
ConsoleProperties(ConsoleProperties properties)
          Copy constructor.
ConsoleProperties(Resources resources, File file)
          Construct a ConsoleProperties backed by the given file.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a PropertyChangeListener.
 void addPropertyChangeListener(String property, PropertyChangeListener listener)
          Add a PropertyChangeListener which listens to a particular property.
 int getCollectSampleCount()
          Get the number of samples to collect.
 String getConsoleHost()
          Get the console host as a string.
 int getConsolePort()
          Get the console port.
 boolean getDistributeOnStartAsk()
          Get whether the user wants to distribute files automatically when starting processes.
 Directory getDistributionDirectory()
          Get the script distribution directory.
 String getDistributionFileFilterExpression()
          Get the distribution file filter pattern.
 Pattern getDistributionFileFilterPattern()
          Get the distribution file filter pattern.
 String getExternalEditorArguments()
          Get the external editor arguments.
 File getExternalEditorCommand()
          Get the external editor command.
 Rectangle getFrameBounds()
          Get the location and size of the console frame.
 String getHttpHost()
          Get the HTTP host as a string.
 int getHttpPort()
          Get the HTTP port.
 int getIgnoreSampleCount()
          Get the number of samples to ignore.
 String getLookAndFeel()
          Get the name of the Look and Feel.
 File getPropertiesFile()
          Get the selected properties file.
 boolean getPropertiesNotSetAsk()
          Get whether the user wants to be asked if console should be reset with the worker processes.
 boolean getResetConsoleWithProcesses()
          Get whether the console should be reset with the worker processes.
 boolean getResetConsoleWithProcessesAsk()
          Get whether the user wants to be asked if console should be reset with the worker processes.
 int getSampleInterval()
          Get the sample interval.
 boolean getSaveTotalsWithResults()
          Get whether saved results files should include the Totals line.
 int getScanDistributionFilesPeriod()
          Get the period at which the distribution files should be scanned.
 int getSignificantFigures()
          Get the number of significant figures.
 boolean getStartWithUnsavedBuffersAsk()
          Get whether the user wants to be warned when starting processes with unsaved buffers.
 boolean getStopProcessesAsk()
          Get whether the user wants to be asked to confirm that processes should be stopped.
 void save()
          Save to the associated file.
 void set(ConsoleProperties properties)
          Assignment.
 void setAndSaveDistributionDirectory(Directory distributionDirectory)
          Set and save the script distribution directory.
 void setAndSaveFrameBounds(Rectangle bounds)
          Set and save the location and size of the console frame.
 void setAndSavePropertiesFile(File propertiesFile)
          Set and save the properties file.
 void setCollectSampleCount(int n)
          Set the number of samples to collect.
 void setConsoleHost(String s)
          Set the console host.
 void setConsolePort(int i)
          Set the console port.
 void setDistributeOnStartAsk(boolean value)
          Set and save whether the user wants to distribute files automatically when starting processes.
 void setDistributionDirectory(Directory distributionDirectory)
          Set and save the script distribution directory.
 void setDistributionFileFilterExpression(String expression)
          Set the distribution file filter regular expression.
 void setExternalEditorArguments(String arguments)
          Set the external editor arguments.
 void setExternalEditorCommand(File command)
          Set the external editor command.
 void setFrameBounds(Rectangle bounds)
          Set and save the location and size of the console frame.
 void setHttpHost(String s)
          Set the HTTP host.
 void setHttpPort(int i)
          Set the HTTP port.
 void setIgnoreSampleCount(int n)
          Set the number of samples to collect.
 void setLookAndFeel(String lookAndFeel)
          Set the name of the Look and Feel.
 void setPropertiesFile(File propertiesFile)
          Set and save the selected properties file.
 void setPropertiesNotSetAsk(boolean value)
          Set and save whether the user wants to be asked if console should be reset with the worker processes.
 void setResetConsoleWithProcesses(boolean b)
          Set whether the console should be reset with the worker processes.
 void setResetConsoleWithProcessesAsk(boolean value)
          Set and save whether the user wants to be asked if console should be reset with the worker processes.
 void setSampleInterval(int interval)
          Set the sample interval.
 void setSaveTotalsWithResults(boolean b)
          Set whether saved results files should include the Totals line.
 void setScanDistributionFilesPeriod(int i)
          Set the period at which the distribution files should be scanned.
 void setSignificantFigures(int n)
          Set the number of significant figures.
 void setStartWithUnsavedBuffersAsk(boolean value)
          Set and save whether the user wants to be warned when starting processes with unsaved buffers.
 void setStopProcessesAsk(boolean value)
          Set and save whether the user wants to be asked to confirm that processes should be stopped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLLECT_SAMPLES_PROPERTY

public static final String COLLECT_SAMPLES_PROPERTY
Property name.

See Also:
Constant Field Values

IGNORE_SAMPLES_PROPERTY

public static final String IGNORE_SAMPLES_PROPERTY
Property name.

See Also:
Constant Field Values

SAMPLE_INTERVAL_PROPERTY

public static final String SAMPLE_INTERVAL_PROPERTY
Property name.

See Also:
Constant Field Values

SIG_FIG_PROPERTY

public static final String SIG_FIG_PROPERTY
Property name.

See Also:
Constant Field Values

CONSOLE_HOST_PROPERTY

public static final String CONSOLE_HOST_PROPERTY
Property name.

See Also:
Constant Field Values

CONSOLE_PORT_PROPERTY

public static final String CONSOLE_PORT_PROPERTY
Property name.

See Also:
Constant Field Values

HTTP_HOST_PROPERTY

public static final String HTTP_HOST_PROPERTY
Property name.

See Also:
Constant Field Values

HTTP_PORT_PROPERTY

public static final String HTTP_PORT_PROPERTY
Property name.

See Also:
Constant Field Values

RESET_CONSOLE_WITH_PROCESSES_PROPERTY

public static final String RESET_CONSOLE_WITH_PROCESSES_PROPERTY
Property name.

See Also:
Constant Field Values

RESET_CONSOLE_WITH_PROCESSES_ASK_PROPERTY

public static final String RESET_CONSOLE_WITH_PROCESSES_ASK_PROPERTY
Property name.

See Also:
Constant Field Values

PROPERTIES_NOT_SET_ASK_PROPERTY

public static final String PROPERTIES_NOT_SET_ASK_PROPERTY
Property name.

See Also:
Constant Field Values

START_WITH_UNSAVED_BUFFERS_ASK_PROPERTY

public static final String START_WITH_UNSAVED_BUFFERS_ASK_PROPERTY
Property name.

See Also:
Constant Field Values

STOP_PROCESSES_ASK_PROPERTY

public static final String STOP_PROCESSES_ASK_PROPERTY
Property name.

See Also:
Constant Field Values

DISTRIBUTE_ON_START_ASK_PROPERTY

public static final String DISTRIBUTE_ON_START_ASK_PROPERTY
Property name.

See Also:
Constant Field Values

PROPERTIES_FILE_PROPERTY

public static final String PROPERTIES_FILE_PROPERTY
Property name.

See Also:
Constant Field Values

DISTRIBUTION_DIRECTORY_PROPERTY

public static final String DISTRIBUTION_DIRECTORY_PROPERTY
Property name.

See Also:
Constant Field Values

DISTRIBUTION_FILE_FILTER_EXPRESSION_PROPERTY

public static final String DISTRIBUTION_FILE_FILTER_EXPRESSION_PROPERTY
Property name.

See Also:
Constant Field Values

DEFAULT_DISTRIBUTION_FILE_FILTER_EXPRESSION

public static final String DEFAULT_DISTRIBUTION_FILE_FILTER_EXPRESSION
Default regular expression for filtering distribution files.

See Also:
Constant Field Values

SCAN_DISTRIBUTION_FILES_PERIOD_PROPERTY

public static final String SCAN_DISTRIBUTION_FILES_PERIOD_PROPERTY
Property name.

See Also:
Constant Field Values

LOOK_AND_FEEL_PROPERTY

public static final String LOOK_AND_FEEL_PROPERTY
Property name.

See Also:
Constant Field Values

EXTERNAL_EDITOR_COMMAND_PROPERTY

public static final String EXTERNAL_EDITOR_COMMAND_PROPERTY
Property name.

See Also:
Constant Field Values

EXTERNAL_EDITOR_ARGUMENTS_PROPERTY

public static final String EXTERNAL_EDITOR_ARGUMENTS_PROPERTY
Property name.

See Also:
Constant Field Values

FRAME_BOUNDS_PROPERTY

public static final String FRAME_BOUNDS_PROPERTY
Property name.

See Also:
Constant Field Values

SAVE_TOTALS_WITH_RESULTS_PROPERTY

public static final String SAVE_TOTALS_WITH_RESULTS_PROPERTY
Property name.

See Also:
Constant Field Values
Constructor Detail

ConsoleProperties

public ConsoleProperties(Resources resources,
                         File file)
                  throws ConsoleException
Construct a ConsoleProperties backed by the given file.

Parameters:
resources - Console resources.
file - The properties file.
Throws:
ConsoleException - If the properties file cannot be read or the properties file contains invalid data.

ConsoleProperties

public ConsoleProperties(ConsoleProperties properties)
Copy constructor. Does not copy property change listeners.

Parameters:
properties - The properties to copy.
Method Detail

set

public void set(ConsoleProperties properties)
Assignment. Does not copy property change listeners, nor the associated file.

Parameters:
properties - The properties to copy.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener.

Parameters:
listener - The listener.

addPropertyChangeListener

public void addPropertyChangeListener(String property,
                                      PropertyChangeListener listener)
Add a PropertyChangeListener which listens to a particular property.

Parameters:
property - The property.
listener - The listener.

save

public void save()
          throws ConsoleException
Save to the associated file.

Throws:
ConsoleException - If an error occurs.

getCollectSampleCount

public int getCollectSampleCount()
Get the number of samples to collect.

Returns:
The number.

setCollectSampleCount

public void setCollectSampleCount(int n)
                           throws ConsoleException
Set the number of samples to collect.

Parameters:
n - The number. 0 => forever.
Throws:
ConsoleException - If the number is negative.

getIgnoreSampleCount

public int getIgnoreSampleCount()
Get the number of samples to ignore.

Returns:
The number.

setIgnoreSampleCount

public void setIgnoreSampleCount(int n)
                          throws ConsoleException
Set the number of samples to collect.

Parameters:
n - The number. Must be positive.
Throws:
ConsoleException - If the number is negative or zero.

getSampleInterval

public int getSampleInterval()
Get the sample interval.

Returns:
The interval in milliseconds.

setSampleInterval

public void setSampleInterval(int interval)
                       throws ConsoleException
Set the sample interval.

Parameters:
interval - The interval in milliseconds.
Throws:
ConsoleException - If the number is negative or zero.

getSignificantFigures

public int getSignificantFigures()
Get the number of significant figures.

Returns:
The number of significant figures.

setSignificantFigures

public void setSignificantFigures(int n)
                           throws ConsoleException
Set the number of significant figures.

Parameters:
n - The number of significant figures.
Throws:
ConsoleException - If the number is negative.

getConsoleHost

public String getConsoleHost()
Get the console host as a string.

Returns:
The address.

setConsoleHost

public void setConsoleHost(String s)
                    throws ConsoleException
Set the console host.

Parameters:
s - Either a machine name or the IP address.
Throws:
ConsoleException - If the address is not valid.

getConsolePort

public int getConsolePort()
Get the console port.

Returns:
The port.

setConsolePort

public void setConsolePort(int i)
                    throws ConsoleException
Set the console port.

Parameters:
i - The port number.
Throws:
ConsoleException - If the port number is not sensible.

getHttpHost

public String getHttpHost()
Get the HTTP host as a string.

Returns:
The address.

setHttpHost

public void setHttpHost(String s)
                 throws ConsoleException
Set the HTTP host.

Parameters:
s - Either a machine name or the IP address.
Throws:
ConsoleException - If the address is not valid.

getHttpPort

public int getHttpPort()
Get the HTTP port.

Returns:
The port.

setHttpPort

public void setHttpPort(int i)
                 throws ConsoleException
Set the HTTP port.

Parameters:
i - The port number.
Throws:
ConsoleException - If the port number is not sensible.

getResetConsoleWithProcesses

public boolean getResetConsoleWithProcesses()
Get whether the console should be reset with the worker processes.

Returns:
true => the console should be reset with the worker processes.

setResetConsoleWithProcesses

public void setResetConsoleWithProcesses(boolean b)
Set whether the console should be reset with the worker processes.

Parameters:
b - true => the console should be reset with the worker processes.

getResetConsoleWithProcessesAsk

public boolean getResetConsoleWithProcessesAsk()
Get whether the user wants to be asked if console should be reset with the worker processes.

Returns:
true => the user wants to be asked.

setResetConsoleWithProcessesAsk

public void setResetConsoleWithProcessesAsk(boolean value)
                                     throws ConsoleException
Set and save whether the user wants to be asked if console should be reset with the worker processes.

Parameters:
value - true => the user wants to be asked.
Throws:
ConsoleException - If the property couldn't be persisted

getPropertiesNotSetAsk

public boolean getPropertiesNotSetAsk()
Get whether the user wants to be asked if console should be reset with the worker processes.

Returns:
true => the user wants to be asked.

setPropertiesNotSetAsk

public void setPropertiesNotSetAsk(boolean value)
                            throws ConsoleException
Set and save whether the user wants to be asked if console should be reset with the worker processes.

Parameters:
value - true => the user wants to be asked.
Throws:
ConsoleException - If the property couldn't be persisted.

getStartWithUnsavedBuffersAsk

public boolean getStartWithUnsavedBuffersAsk()
Get whether the user wants to be warned when starting processes with unsaved buffers.

Returns:
true => the user wants to be warned.

setStartWithUnsavedBuffersAsk

public void setStartWithUnsavedBuffersAsk(boolean value)
                                   throws ConsoleException
Set and save whether the user wants to be warned when starting processes with unsaved buffers.

Parameters:
value - true => the user wants to be warned.
Throws:
ConsoleException - If the property couldn't be persisted.

getStopProcessesAsk

public boolean getStopProcessesAsk()
Get whether the user wants to be asked to confirm that processes should be stopped.

Returns:
true => the user wants to be asked.

setStopProcessesAsk

public void setStopProcessesAsk(boolean value)
                         throws ConsoleException
Set and save whether the user wants to be asked to confirm that processes should be stopped.

Parameters:
value - true => the user wants to be asked.
Throws:
ConsoleException - If the property couldn't be persisted.

getDistributeOnStartAsk

public boolean getDistributeOnStartAsk()
Get whether the user wants to distribute files automatically when starting processes.

Returns:
true => the user wants automatic distribution.

setDistributeOnStartAsk

public void setDistributeOnStartAsk(boolean value)
                             throws ConsoleException
Set and save whether the user wants to distribute files automatically when starting processes.

Parameters:
value - true => the user wants automatic distribution.
Throws:
ConsoleException - If the property couldn't be persisted.

getPropertiesFile

public File getPropertiesFile()
Get the selected properties file.

Returns:
The properties file. null => No file selected.

setPropertiesFile

public void setPropertiesFile(File propertiesFile)
Set and save the selected properties file.

Parameters:
propertiesFile - The properties file. null => No file selected.

setAndSavePropertiesFile

public void setAndSavePropertiesFile(File propertiesFile)
                              throws ConsoleException
Set and save the properties file.

Parameters:
propertiesFile - The properties file. null => No file set.
Throws:
ConsoleException
ConsoleException - If the property could not be saved.

getDistributionDirectory

public Directory getDistributionDirectory()
Get the script distribution directory.

Returns:
The directory.

setDistributionDirectory

public void setDistributionDirectory(Directory distributionDirectory)
Set and save the script distribution directory.

Parameters:
distributionDirectory - The directory.

setAndSaveDistributionDirectory

public void setAndSaveDistributionDirectory(Directory distributionDirectory)
                                     throws ConsoleException
Set and save the script distribution directory.

Parameters:
distributionDirectory - The directory.
Throws:
ConsoleException - If the property could not be saved.

getDistributionFileFilterPattern

public Pattern getDistributionFileFilterPattern()
Get the distribution file filter pattern.

The original regular expression can be obtained with getDistributionFileFilterPattern().

Returns:
The pattern.
See Also:
setDistributionFileFilterExpression(java.lang.String)

getDistributionFileFilterExpression

public String getDistributionFileFilterExpression()
Get the distribution file filter pattern.

The original regular expression can be obtained with getDistributionFileFilterPattern().getPattern().

Returns:
The pattern.
See Also:
setDistributionFileFilterExpression(java.lang.String)

setDistributionFileFilterExpression

public void setDistributionFileFilterExpression(String expression)
                                         throws ConsoleException
Set the distribution file filter regular expression.

Files and directory names (not full paths) that match the regular expression are not distributed. Directory names are distinguished by a trailing '/'. The expression is in Perl 5 format.

Parameters:
expression - A Perl 5 format expression. null => use default pattern.
Throws:
ConsoleException - If the pattern is invalid.

getScanDistributionFilesPeriod

public int getScanDistributionFilesPeriod()
Get the period at which the distribution files should be scanned.

Returns:
The period, in milliseconds.

setScanDistributionFilesPeriod

public void setScanDistributionFilesPeriod(int i)
                                    throws ConsoleException
Set the period at which the distribution files should be scanned.

Parameters:
i - The port number.
Throws:
ConsoleException - If the period is negative.

getLookAndFeel

public String getLookAndFeel()
Get the name of the Look and Feel. It is up to the UI implementation how this is interpreted.

Returns:
The Look and Feel name. null => use default.

setLookAndFeel

public void setLookAndFeel(String lookAndFeel)
Set the name of the Look and Feel.

Parameters:
lookAndFeel - The Look and Feel name. null => use default.

getExternalEditorCommand

public File getExternalEditorCommand()
Get the external editor command.

Returns:
The path to the process to be used for external editing. null => no external editor set.

setExternalEditorCommand

public void setExternalEditorCommand(File command)
Set the external editor command.

Parameters:
command - The path to the process to be used for external editing. null => no external editor set.

getExternalEditorArguments

public String getExternalEditorArguments()
Get the external editor arguments.

Returns:
The arguments to be used with the external editor.

setExternalEditorArguments

public void setExternalEditorArguments(String arguments)
Set the external editor arguments.

Parameters:
arguments - The arguments to be used with the external editor.

getFrameBounds

public Rectangle getFrameBounds()
Get the location and size of the console frame.

Returns:
The console frame bounds.

setFrameBounds

public void setFrameBounds(Rectangle bounds)
Set and save the location and size of the console frame.

Parameters:
bounds - The console frame bounds.

setAndSaveFrameBounds

public void setAndSaveFrameBounds(Rectangle bounds)
                           throws ConsoleException
Set and save the location and size of the console frame.

Parameters:
bounds - The console frame bounds.
Throws:
ConsoleException - If the property couldn't be persisted.

getSaveTotalsWithResults

public boolean getSaveTotalsWithResults()
Get whether saved results files should include the Totals line.

Returns:
true => results files should include totals.

setSaveTotalsWithResults

public void setSaveTotalsWithResults(boolean b)
                              throws ConsoleException
Set whether saved results files should include the Totals line.

Parameters:
b - true => results files should include totals.
Throws:
ConsoleException - If the property couldn't be persisted.


Copyright © 2000-2013. All Rights Reserved.