Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.acs.damsel.srvr
Class Config  view Config download Config.java

java.lang.Object
  extended byorg.acs.damsel.srvr.Config
All Implemented Interfaces:
java.io.Serializable

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

Title: Config

Description: Config is a singleton class that stores the configuration information for the application. It also provides a means to save the configuration to a disk. When the Config class is first created, it loads the saved configuration information from disk.

Version:
1.0

Field Summary
private static boolean allowRegistration
           
private static java.lang.String assetDBConnection
           
private static java.lang.String assetDBDriverClass
           
private static java.lang.String assetDBPassword
           
private static java.lang.String assetDBUserName
           
private static java.lang.String assetPrefix
           
private static java.lang.String configFileName
           
private static Config instance
           
private static org.apache.log4j.Logger log
           
private static java.lang.String logPropertiesFileName
           
private static java.lang.String prefix
           
private static java.lang.String uploadPrefix
           
 
Constructor Summary
Config()
          This default constructor is only here because Castor's Unmarshaller requires it.
 
Method Summary
 java.lang.String getAssetDBConnection()
           
 java.lang.String getAssetDBDriverClass()
           
 java.lang.String getAssetDBPassword()
           
 java.lang.String getAssetDBUserName()
           
 java.lang.String getAssetPrefix()
           
 java.lang.String getConfigFileName()
           
 java.lang.String getLogPropertiesFileName()
           
 java.lang.String getPrefix()
           
 java.lang.String getUploadPrefix()
           
static Config instance()
          The instance() method is used instead of a constructor to get a handle on the Config object.
static Config instance(java.io.File f)
          The instance(File) method is like the instance() method except that it will load the configuration from the specified file if the Config object has yet to be initialized.
 void invalidate()
          The invalidate() method sets the Config object instance to null.
 boolean isAllowRegistration()
           
private static Config newConfigFromFile(java.io.File f)
          The newConfigFromFile method is used instead of a constructor to load the configuration data from the file specified in configFileName.
 void save(java.io.File f)
          The save method writes the current configuration to the XML file specified in configFileName.
 void setAllowRegistration(boolean allowRegistration)
           
 void setAssetDBConnection(java.lang.String assetDBConnection)
           
 void setAssetDBDriverClass(java.lang.String assetDBDriverClass)
           
 void setAssetDBPassword(java.lang.String assetDBPassword)
           
 void setAssetDBUserName(java.lang.String assetDBUserName)
           
 void setAssetPrefix(java.lang.String assetPrefix)
           
 void setConfigFileName(java.lang.String configFileName)
           
 void setLogPropertiesFileName(java.lang.String logPropertiesFileName)
           
 void setPrefix(java.lang.String prefix)
           
 void setUploadPrefix(java.lang.String uploadPrefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefix

private static java.lang.String prefix

logPropertiesFileName

private static java.lang.String logPropertiesFileName

uploadPrefix

private static java.lang.String uploadPrefix

configFileName

private static java.lang.String configFileName

assetPrefix

private static java.lang.String assetPrefix

allowRegistration

private static boolean allowRegistration

assetDBDriverClass

private static java.lang.String assetDBDriverClass

assetDBConnection

private static java.lang.String assetDBConnection

assetDBUserName

private static java.lang.String assetDBUserName

assetDBPassword

private static java.lang.String assetDBPassword

log

private static org.apache.log4j.Logger log

instance

private static Config instance
Constructor Detail

Config

public Config()
This default constructor is only here because Castor's Unmarshaller requires it. Generally, one should use the instance() method.

Method Detail

instance

public static Config instance()
The instance() method is used instead of a constructor to get a handle on the Config object. If the Config object has not yet been initialized, it will load from the default config.xml file specified above.


instance

public static Config instance(java.io.File f)
The instance(File) method is like the instance() method except that it will load the configuration from the specified file if the Config object has yet to be initialized.


newConfigFromFile

private static Config newConfigFromFile(java.io.File f)
The newConfigFromFile method is used instead of a constructor to load the configuration data from the file specified in configFileName. If loading fails for whatever reason, the default constructor is used as a failsafe.


save

public void save(java.io.File f)
          throws java.io.IOException
The save method writes the current configuration to the XML file specified in configFileName.


getConfigFileName

public java.lang.String getConfigFileName()

setConfigFileName

public void setConfigFileName(java.lang.String configFileName)

getPrefix

public java.lang.String getPrefix()

setPrefix

public void setPrefix(java.lang.String prefix)

getAssetPrefix

public java.lang.String getAssetPrefix()

setAssetPrefix

public void setAssetPrefix(java.lang.String assetPrefix)

invalidate

public void invalidate()
The invalidate() method sets the Config object instance to null. Because Config is a singleton and is used by many other parts of the system, use this only for unit-testing or if you are ABSOLUTELY SURE of what you're doing!


getAssetDBConnection

public java.lang.String getAssetDBConnection()

getAssetDBDriverClass

public java.lang.String getAssetDBDriverClass()

setAssetDBConnection

public void setAssetDBConnection(java.lang.String assetDBConnection)

setAssetDBDriverClass

public void setAssetDBDriverClass(java.lang.String assetDBDriverClass)

getAssetDBUserName

public java.lang.String getAssetDBUserName()

setAssetDBUserName

public void setAssetDBUserName(java.lang.String assetDBUserName)

getLogPropertiesFileName

public java.lang.String getLogPropertiesFileName()

setLogPropertiesFileName

public void setLogPropertiesFileName(java.lang.String logPropertiesFileName)

getUploadPrefix

public java.lang.String getUploadPrefix()

setUploadPrefix

public void setUploadPrefix(java.lang.String uploadPrefix)

getAssetDBPassword

public java.lang.String getAssetDBPassword()

setAssetDBPassword

public void setAssetDBPassword(java.lang.String assetDBPassword)

isAllowRegistration

public boolean isAllowRegistration()

setAllowRegistration

public void setAllowRegistration(boolean allowRegistration)