org.PingOO.DLAI.lib.util
Class Config

java.lang.Object
  |
  +--org.PingOO.DLAI.lib.util.Config

public abstract class Config
extends java.lang.Object
implements java.io.Serializable

This is the basic configuration used by all slaves programs.

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)
See Also:
Serialized Form

Field Summary
static java.lang.String BIN_PATH
          Defines the bin directory.
static java.lang.String CURSOR_PATH
          Defines the cursor directory.
private static boolean DEBUG
           
private static boolean DEBUG_EXCEPTION
           
static int DEBUG_EXCEPTION_KEY
           
private static boolean DEBUG_GRAPHIC
           
static int DEBUG_GRAPHIC_KEY
           
static int DEBUG_KEY
           
private static boolean DEBUG_LDAP
           
static int DEBUG_LDAP_KEY
           
private static boolean DEBUG_MESSAGE
           
static int DEBUG_MESSAGE_KEY
           
private static boolean DEBUG_NETWORK
           
static int DEBUG_NETWORK_KEY
           
private static boolean DEBUG_RESOURCE
           
static int DEBUG_RESOURCE_KEY
           
private static java.lang.String DEFAULT_SERVER
          The server's host name
private static java.lang.String DLAI_VERSION
          Default version number.
static java.lang.String EXTENSION_SEPARATOR
          Defines the file extension separator.
static java.lang.String FILE_SEPARATOR
          Defines the file separator.
private static java.awt.Font FONT
          The defaut font used.
static java.lang.String HELP_PATH
          Defines the help directory.
static java.awt.Dimension ICON_BIG
          Defines teh default dimension of small icons.
static java.lang.String ICON_PATH
          Defines the icon directory.
static java.awt.Dimension ICON_SMALL
          Defines the default dimension of big icons.
static java.lang.String IMAGE_PATH
          Defines the image directory.
private static boolean INITIALIZED
          Indicates if the values from the config file have been loaded.
static java.lang.String LIB_PATH
          Defines the lib directory.
private static java.net.InetAddress LOCAL_HOST
          The adresse of the local host.
private static java.util.Locale LOCALE
          The default language used by the PPM and all slaves programs.
private static javax.swing.LookAndFeel LOOK_N_FEEL
          The default look'n feel.
static java.lang.String MINI_ICON_PATH
          Defines the miniicon directory.
static java.lang.String MODULE_SEPARATOR
          Separator to put between the module and the name of the file.
static int MOUSE_AUTO_FOCUS
           
private static int MOUSE_FOCUS
          Current value for mouse focus parameter.
static int MOUSE_FOCUS_ON_CLICK
           
static java.lang.String PACKAGE_PATH
          Defines the package directory.
static java.lang.String PACKAGE_SEPARATOR
          Defines the package separator.
static java.lang.String RESOURCE_PATH
          Defines the localized resource directory.
private static java.lang.String[] SERVER_LIST
          The list of all available servers.
private static int SERVER_PORT
          The port of the server on its host.
private static java.lang.String SESSION_ID
          The sessionID defined by the server, initially is equal to INIT until the server changes this.
static java.lang.String SLAVE_PATH
          Defines the slave directory.
static java.lang.String SOUND_PATH
          Defines the sound directory.
private static java.lang.String TAG_SEPARATOR
          Separator used when parsing config file.
private static java.lang.String[] TOOL_LIST
          Default list of tools.
static java.lang.String TOOL_PATH
          Defines the tool directory.
static java.lang.String URL_SEPARATOR
          Defines the URL separator.
static int WINDOW_AUTO_RAISE
           
private static int WINDOW_RAISE
          Current value for window raising parameter.
static int WINDOW_RAISE_ON_CLICK
           
static java.lang.String WORK_PATH
          Defines the working directory.
static int X_GAP
          Defines the vertical gap between the components.
static int X_INSET
          Defines the width of the right and left borders.
static int Y_GAP
          Defines the horizontal gap between the components.
static int Y_INSET
          Defines the height of the top and bottom borders.
 
Constructor Summary
Config()
           
 
Method Summary
static boolean getDebugValue(int debugKey)
          Return the value associated with a debug property.
static java.lang.String getDefaultServer()
          Returns the server's host name.
static java.awt.Font getFont()
          Return the current font.
static java.util.Locale getLocale()
          Returns the user's language.
static java.lang.String getLocalHost()
          Return the name of the local host.
static javax.swing.LookAndFeel getLookAndFeel()
          Return the current look and feel.
static int getMouseFocus()
          Gets the mouse focus mode.
static java.lang.String[] getServerList()
          Return the list of server.
static int getServerPort()
          Returns the server's port on the host.
static java.lang.String getSessionID()
          Returns the session ID.
static java.lang.String[] getToolList()
          Get the list of available tools (see default.properties file).
static java.lang.String getVersion()
          Return DELAI version.
static int getWindowRaise()
          Gets the window raising mode.
private static void initialize()
          Loads default resources from the configuration file : default.properties.
static void setDebugValue(int debugKey, boolean value)
          Sets a debug value.
static void setDefaultServer(java.lang.String defaultServer)
          Sets the server's host name.
static void setFont(java.awt.Font font)
          Sets the font.
static void setLocale(java.util.Locale locale)
          Sets the user's language.
static void setLookAndFeel(javax.swing.LookAndFeel lookNFeel)
          Sets the current look and feel.
static void setMouseFocus(int value)
          Sets the mouse focus mode.
static void setServerList(java.lang.String[] serverList)
          Sets the server's list.
static void setServerPort(int serverPort)
          Sets the server's port on the host.
static void setServerPort(java.lang.String serverPort)
          Sets the server's port on the host.
static void setSessionID(java.lang.String sessionID)
          Sets this session's ID.
static void setWindowRaise(int value)
          Sets the window raising mode.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

INITIALIZED

private static boolean INITIALIZED
Indicates if the values from the config file have been loaded.

TAG_SEPARATOR

private static java.lang.String TAG_SEPARATOR
Separator used when parsing config file.

DLAI_VERSION

private static java.lang.String DLAI_VERSION
Default version number.
It's very important to keep an old (or incoherent) version number here, so we can get an undammaged package from the server by auto-upgrade.

SESSION_ID

private static java.lang.String SESSION_ID
The sessionID defined by the server, initially is equal to INIT until the server changes this.

LOCAL_HOST

private static java.net.InetAddress LOCAL_HOST
The adresse of the local host.

SERVER_LIST

private static java.lang.String[] SERVER_LIST
The list of all available servers.

DEFAULT_SERVER

private static java.lang.String DEFAULT_SERVER
The server's host name

SERVER_PORT

private static int SERVER_PORT
The port of the server on its host.

TOOL_LIST

private static java.lang.String[] TOOL_LIST
Default list of tools.

LOCALE

private static java.util.Locale LOCALE
The default language used by the PPM and all slaves programs.

FONT

private static java.awt.Font FONT
The defaut font used.

MOUSE_FOCUS_ON_CLICK

public static final int MOUSE_FOCUS_ON_CLICK

MOUSE_AUTO_FOCUS

public static final int MOUSE_AUTO_FOCUS

MOUSE_FOCUS

private static int MOUSE_FOCUS
Current value for mouse focus parameter.

WINDOW_RAISE_ON_CLICK

public static final int WINDOW_RAISE_ON_CLICK

WINDOW_AUTO_RAISE

public static final int WINDOW_AUTO_RAISE

WINDOW_RAISE

private static int WINDOW_RAISE
Current value for window raising parameter.

LOOK_N_FEEL

private static javax.swing.LookAndFeel LOOK_N_FEEL
The default look'n feel.

DEBUG_KEY

public static final int DEBUG_KEY

DEBUG_GRAPHIC_KEY

public static final int DEBUG_GRAPHIC_KEY

DEBUG_NETWORK_KEY

public static final int DEBUG_NETWORK_KEY

DEBUG_LDAP_KEY

public static final int DEBUG_LDAP_KEY

DEBUG_MESSAGE_KEY

public static final int DEBUG_MESSAGE_KEY

DEBUG_RESOURCE_KEY

public static final int DEBUG_RESOURCE_KEY

DEBUG_EXCEPTION_KEY

public static final int DEBUG_EXCEPTION_KEY

DEBUG

private static boolean DEBUG

DEBUG_GRAPHIC

private static boolean DEBUG_GRAPHIC

DEBUG_NETWORK

private static boolean DEBUG_NETWORK

DEBUG_LDAP

private static boolean DEBUG_LDAP

DEBUG_MESSAGE

private static boolean DEBUG_MESSAGE

DEBUG_RESOURCE

private static boolean DEBUG_RESOURCE

DEBUG_EXCEPTION

private static boolean DEBUG_EXCEPTION

ICON_SMALL

public static final java.awt.Dimension ICON_SMALL
Defines the default dimension of big icons.

ICON_BIG

public static final java.awt.Dimension ICON_BIG
Defines teh default dimension of small icons.

X_INSET

public static int X_INSET
Defines the width of the right and left borders.

Y_INSET

public static int Y_INSET
Defines the height of the top and bottom borders.

X_GAP

public static int X_GAP
Defines the vertical gap between the components.

Y_GAP

public static int Y_GAP
Defines the horizontal gap between the components.

PACKAGE_SEPARATOR

public static final java.lang.String PACKAGE_SEPARATOR
Defines the package separator.

EXTENSION_SEPARATOR

public static final java.lang.String EXTENSION_SEPARATOR
Defines the file extension separator.

MODULE_SEPARATOR

public static final java.lang.String MODULE_SEPARATOR
Separator to put between the module and the name of the file.

URL_SEPARATOR

public static final java.lang.String URL_SEPARATOR
Defines the URL separator.
Used when accessing datas inside a JAR file instead of FILE_SEPARATOR (the '\' under Windows made the files unreadable inside the archive).

FILE_SEPARATOR

public static final java.lang.String FILE_SEPARATOR
Defines the file separator.

WORK_PATH

public static final java.lang.String WORK_PATH
Defines the working directory.

BIN_PATH

public static final java.lang.String BIN_PATH
Defines the bin directory.

LIB_PATH

public static final java.lang.String LIB_PATH
Defines the lib directory.

PACKAGE_PATH

public static final java.lang.String PACKAGE_PATH
Defines the package directory.

SLAVE_PATH

public static final java.lang.String SLAVE_PATH
Defines the slave directory.

TOOL_PATH

public static final java.lang.String TOOL_PATH
Defines the tool directory.

ICON_PATH

public static final java.lang.String ICON_PATH
Defines the icon directory.

MINI_ICON_PATH

public static final java.lang.String MINI_ICON_PATH
Defines the miniicon directory.

RESOURCE_PATH

public static final java.lang.String RESOURCE_PATH
Defines the localized resource directory.

IMAGE_PATH

public static final java.lang.String IMAGE_PATH
Defines the image directory.

SOUND_PATH

public static final java.lang.String SOUND_PATH
Defines the sound directory.

CURSOR_PATH

public static final java.lang.String CURSOR_PATH
Defines the cursor directory.

HELP_PATH

public static final java.lang.String HELP_PATH
Defines the help directory.
Constructor Detail

Config

public Config()
Method Detail

initialize

private static final void initialize()
Loads default resources from the configuration file : default.properties.
If the file does not exists, or if there are missing values, Config will try to use hard-coded values.
If the version number does not exists Config will use an older version in order to provoke the start of the auto-update process.

getLocalHost

public static final java.lang.String getLocalHost()
Return the name of the local host.
Returns:
The name of the local host.

getDefaultServer

public static final java.lang.String getDefaultServer()
Returns the server's host name.
Returns:
The server's host name or null if no server defined.

getServerList

public static final java.lang.String[] getServerList()
Return the list of server.
Returns:
The list of server or an empty array if no server defined.

getServerPort

public static final int getServerPort()
Returns the server's port on the host.
Returns:
The server's port.

setServerList

public static final void setServerList(java.lang.String[] serverList)
Sets the server's list.
Parameters:
serverList - The new list of server.

setDefaultServer

public static final void setDefaultServer(java.lang.String defaultServer)
Sets the server's host name.
Parameters:
defaultServer - The new default server.

setServerPort

public static final void setServerPort(java.lang.String serverPort)
Sets the server's port on the host.
Parameters:
serverPort - The new server's port.

setServerPort

public static final void setServerPort(int serverPort)
Sets the server's port on the host.

setLocale

public static final void setLocale(java.util.Locale locale)
Sets the user's language.
Parameters:
locale - If null, the system's locale will be used.

getLocale

public static final java.util.Locale getLocale()
Returns the user's language.
Returns:
The user's language.

setSessionID

public static final void setSessionID(java.lang.String sessionID)
Sets this session's ID.
Warning use with caution !
Parameters:
sessionID - Cant't be null.

getSessionID

public static final java.lang.String getSessionID()
Returns the session ID.
Returns:
The session ID.

getFont

public static final java.awt.Font getFont()
Return the current font.
Returns:
The current font.

setFont

public static final void setFont(java.awt.Font font)
Sets the font.
Parameters:
font - The new font.

getLookAndFeel

public static final javax.swing.LookAndFeel getLookAndFeel()
Return the current look and feel.
Returns:
The current look and feel.

setLookAndFeel

public static final void setLookAndFeel(javax.swing.LookAndFeel lookNFeel)
Sets the current look and feel.
Parameters:
lookNFeel - The new look and feel to be set.

getMouseFocus

public static final int getMouseFocus()
Gets the mouse focus mode.
Returns:
MOUSE_AUTO_FOCUS or WINDOW_RAISE_ON_CLICK.

setMouseFocus

public static final void setMouseFocus(int value)
Sets the mouse focus mode.
Parameters:
value - The new value. Either MOUSE_AUTO_FOCUS or WINDOW_RAISE_ON_CLICK.

getWindowRaise

public static final int getWindowRaise()
Gets the window raising mode.
Returns:
WINDOW_AUTO_RAISE or WINDOW_RAISE_ON_CLICK.

setWindowRaise

public static final void setWindowRaise(int value)
Sets the window raising mode.
Parameters:
value - The new value. EitherWINDOW_AUTO_RAISE or WINDOW_RAISE_ON_CLICK.

getDebugValue

public static final boolean getDebugValue(int debugKey)
Return the value associated with a debug property.
Parameters:
debugKey -  
Returns:
A boolean value for the current key.

setDebugValue

public static final void setDebugValue(int debugKey,
                                       boolean value)
Sets a debug value.
Parameters:
debugKey -  
value - The new value.

getVersion

public static final java.lang.String getVersion()
Return DELAI version.
Returns:
DELAI version.

getToolList

public static final java.lang.String[] getToolList()
Get the list of available tools (see default.properties file).
Returns:
A string array containing the complete list of available tools.