de.fh_mannheim.mm.dms.framework
Class Config

java.lang.Object
  extended byde.fh_mannheim.mm.dms.framework.Config
All Implemented Interfaces:
IElement, IProducer

public class Config
extends java.lang.Object
implements IProducer

Stores configuration and loads xml files.

Version:
$Revision: 1.44 $
Author:
Jan Löffler, mail@jlsoft.de

Field Summary
static int BOOKMARK_COMPARE_USER_LIMIT
           
static int BOOKMARK_LAST_SEEN_LIMIT
           
static int BOOKMARK_MOST_SEEN_BY_OTHER_USERS_LIMIT
           
static int BOOKMARK_MOST_SEEN_LIMIT
          Bookmark limits
static int[] CUT_OFF_POINTS
          Cut-Off points for indexing
static java.lang.String DBCategories
          Database tables
static java.lang.String DBContents
           
static java.lang.String DBFiles
           
static java.lang.String DBIndex
           
static java.lang.String DBKeywords
           
static java.lang.String DBQuery
           
static java.lang.String DBStopwords
           
static java.lang.String DBUserCategories
           
static java.lang.String DBUserFavorites
           
static java.lang.String DBUserHits
           
static java.lang.String DBUsers
           
static java.lang.String DELIMITERS
          Not changeable config
static java.lang.String DELIMITERS_QUERY
           
static int SEARCH_CATEGORY_LANGUAGE
           
static int SEARCH_CATEGORY_LIMIT
           
static boolean SEARCH_CATEGORY_WEB
           
static int SEARCH_FILETYPE
           
static int SEARCH_LANGUAGE
           
static int SEARCH_LIMIT
          Default values for search
static long SEARCH_MAXAGE
           
static boolean SEARCH_WEB
           
static java.lang.String VERSION
          Version
 
Constructor Summary
Config()
          Constructor.
Config(java.lang.String strFilename)
          Constructor.
 
Method Summary
static Config getConfig()
          Aquire the instance, create if not existing; so we do implizit creation.
 java.lang.String getConfigFilename()
          Get config filename.
 java.lang.String getDBAddress()
          Get database address.
 java.lang.String getDBDriver()
          Get database driver.
 java.lang.String getDBPassword()
          Get database password.
 java.lang.String getDBUsername()
          Get database username.
 MailAccount getEmailAccount()
          Get email account for sending emails.
 int getEngineSleepTime()
          Get time where engine sleep until next lookup.
 FileSize getEngineSpeed()
          Get speed of indexing.
 java.lang.String getGoogleLicenseKey()
          Get the license key for google search.
 java.lang.String getImportPath()
          Get path for imports.
 java.lang.String getLogfileURL()
          Get url for logfile.
 java.lang.String getLogPath()
          Get path for logger.
 FileSize getMaxFileSize()
          Get max size for uploads.
 int getMaxWordLength()
          Get max word length.
 java.lang.String getServletPath()
          Get servletpath for uploads.
 java.lang.String getServletURL()
          Get url for servlet.
 java.lang.String getUploadPath()
          Get path for uploads.
 java.lang.String getUploadURL()
          Get url for uploads.
 java.lang.String getXSLDownloadReport()
          Get filename for reportstylesheet.
 java.lang.String getXSLIndexReport()
          Get filename for reportstylesheet.
 java.lang.String getXSLSearchReport()
          Get filename for reportstylesheet.
 boolean hasDataChanged()
          Checks if the data has changed.
 boolean isAutostartEngineEnabled()
          Should engine be started automaticly.
 boolean isNotifyMailEnabled()
          Should a notify email be send, when indexer has finished work.
 boolean isResetLanguageEnabled()
          Should language be parsed again.
 boolean loadConfigFile()
          Load a xml configfile.
 boolean loadConfigFile(java.lang.String strFilename)
          Load a xml configfile.
 void loadDefaultConfig()
          Load default config.
 org.w3c.dom.Document produceReport()
          Generate the config as xml document.
 boolean saveConfigFile()
          Save a xml configfile.
 boolean saveConfigFile(java.lang.String strFilename)
          Save a xml configfile.
 void setAutostartEngine(boolean bEnabled)
          Should engine start automaticly.
 void setDBAddress(java.lang.String strAddress)
          Set database address.
 void setDBDriver(java.lang.String strDriver)
          Set database driver.
 void setDBPassword(java.lang.String strPassword)
          Set database password.
 void setDBUsername(java.lang.String strName)
          Set database username.
 void setEmailAccount(MailAccount account)
          Set mail account for sending emails.
 void setEngineSleepTime(int nSeconds)
          Set time where engine sleep until next lookup.
 void setEngineSpeed(FileSize size)
          Set speed of indexing.
 void setEngineSpeed(int nBytes)
          Set speed of indexing.
 void setGoogleLicenseKey(java.lang.String strKey)
          Set the license key for google search.
 void setImportPath(java.lang.String strPath)
          Set path for imports.
 void setLogPath(java.lang.String strPath)
          Set path for logger.
 void setMaxFileSize(FileSize size)
          Set max size for uploads.
 void setMaxFileSize(int nBytes)
          Set max size for uploads.
 void setMaxWordLength(int nChars)
          Set max word length.
 void setNotifyMail(boolean bEnabled)
          Should a notify email be send, when indexer has finished work.
 void setResetLanguage(boolean bEnabled)
          Should language be parsed again.
 void setServletPath(java.lang.String strPath)
          Set servletpath for uploads.
 void setServletURL(java.lang.String strPath)
          Set url for servlet.
 void setUploadPath(java.lang.String strPath)
          Set path for uploads.
 void setXSLDownloadReport(java.lang.String strFilename)
          Set filename for xslstypesheet.
 void setXSLIndexReport(java.lang.String strFilename)
          Set filename for xslstypesheet.
 void setXSLSearchReport(java.lang.String strFilename)
          Set filename for xslstypesheet.
 org.w3c.dom.Element toElement(org.w3c.dom.Document doc)
          Write information of config in a xml element.
 org.w3c.dom.Element toElement(org.w3c.dom.Element element, org.w3c.dom.Document doc)
          Write information of config in a xml element.
 java.lang.String toString()
          Write config to output.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
Version

See Also:
Constant Field Values

DBCategories

public static final java.lang.String DBCategories
Database tables

See Also:
Constant Field Values

DBContents

public static final java.lang.String DBContents
See Also:
Constant Field Values

DBFiles

public static final java.lang.String DBFiles
See Also:
Constant Field Values

DBIndex

public static final java.lang.String DBIndex
See Also:
Constant Field Values

DBKeywords

public static final java.lang.String DBKeywords
See Also:
Constant Field Values

DBQuery

public static final java.lang.String DBQuery
See Also:
Constant Field Values

DBStopwords

public static final java.lang.String DBStopwords
See Also:
Constant Field Values

DBUsers

public static final java.lang.String DBUsers
See Also:
Constant Field Values

DBUserCategories

public static final java.lang.String DBUserCategories
See Also:
Constant Field Values

DBUserFavorites

public static final java.lang.String DBUserFavorites
See Also:
Constant Field Values

DBUserHits

public static final java.lang.String DBUserHits
See Also:
Constant Field Values

DELIMITERS

public static final java.lang.String DELIMITERS
Not changeable config

See Also:
Constant Field Values

DELIMITERS_QUERY

public static final java.lang.String DELIMITERS_QUERY
See Also:
Constant Field Values

BOOKMARK_MOST_SEEN_LIMIT

public static final int BOOKMARK_MOST_SEEN_LIMIT
Bookmark limits

See Also:
Constant Field Values

BOOKMARK_LAST_SEEN_LIMIT

public static final int BOOKMARK_LAST_SEEN_LIMIT
See Also:
Constant Field Values

BOOKMARK_COMPARE_USER_LIMIT

public static final int BOOKMARK_COMPARE_USER_LIMIT
See Also:
Constant Field Values

BOOKMARK_MOST_SEEN_BY_OTHER_USERS_LIMIT

public static final int BOOKMARK_MOST_SEEN_BY_OTHER_USERS_LIMIT
See Also:
Constant Field Values

SEARCH_LIMIT

public static final int SEARCH_LIMIT
Default values for search

See Also:
Constant Field Values

SEARCH_LANGUAGE

public static final int SEARCH_LANGUAGE
See Also:
Constant Field Values

SEARCH_FILETYPE

public static final int SEARCH_FILETYPE
See Also:
Constant Field Values

SEARCH_CATEGORY_LIMIT

public static final int SEARCH_CATEGORY_LIMIT
See Also:
Constant Field Values

SEARCH_CATEGORY_LANGUAGE

public static final int SEARCH_CATEGORY_LANGUAGE
See Also:
Constant Field Values

SEARCH_MAXAGE

public static final long SEARCH_MAXAGE

SEARCH_CATEGORY_WEB

public static final boolean SEARCH_CATEGORY_WEB
See Also:
Constant Field Values

SEARCH_WEB

public static final boolean SEARCH_WEB
See Also:
Constant Field Values

CUT_OFF_POINTS

public static final int[] CUT_OFF_POINTS
Cut-Off points for indexing

Constructor Detail

Config

public Config()
Constructor.


Config

public Config(java.lang.String strFilename)
Constructor.

Parameters:
strFilename - Filename of xml configfile
Method Detail

getConfig

public static Config getConfig()
Aquire the instance, create if not existing; so we do implizit creation.

Returns:
Config

getConfigFilename

public java.lang.String getConfigFilename()
Get config filename.

Returns:
filename

getDBAddress

public java.lang.String getDBAddress()
Get database address.

Returns:
database address

getDBDriver

public java.lang.String getDBDriver()
Get database driver.

Returns:
database driver name

getDBPassword

public java.lang.String getDBPassword()
Get database password.

Returns:
database password

getDBUsername

public java.lang.String getDBUsername()
Get database username.

Returns:
database username

getEngineSleepTime

public int getEngineSleepTime()
Get time where engine sleep until next lookup.

Returns:
seconds

getEngineSpeed

public FileSize getEngineSpeed()
Get speed of indexing.

Returns:
bytes per min

getGoogleLicenseKey

public java.lang.String getGoogleLicenseKey()
Get the license key for google search.

Returns:
key

getLogPath

public java.lang.String getLogPath()
Get path for logger.

Returns:
path

getMaxFileSize

public FileSize getMaxFileSize()
Get max size for uploads.

Returns:
size

getMaxWordLength

public int getMaxWordLength()
Get max word length.

Returns:
Number of chars

getServletPath

public java.lang.String getServletPath()
Get servletpath for uploads.

Returns:
path

getImportPath

public java.lang.String getImportPath()
Get path for imports.

Returns:
path

getEmailAccount

public MailAccount getEmailAccount()
Get email account for sending emails.

Returns:
email account

getUploadPath

public java.lang.String getUploadPath()
Get path for uploads.

Returns:
path

getServletURL

public java.lang.String getServletURL()
Get url for servlet.

Returns:
path

getUploadURL

public java.lang.String getUploadURL()
Get url for uploads.

Returns:
path

getLogfileURL

public java.lang.String getLogfileURL()
Get url for logfile.

Returns:
path

getXSLSearchReport

public java.lang.String getXSLSearchReport()
Get filename for reportstylesheet.

Returns:
filename

getXSLDownloadReport

public java.lang.String getXSLDownloadReport()
Get filename for reportstylesheet.

Returns:
filename

getXSLIndexReport

public java.lang.String getXSLIndexReport()
Get filename for reportstylesheet.

Returns:
filename

loadConfigFile

public boolean loadConfigFile()
Load a xml configfile.

Returns:
true, if successful

loadConfigFile

public boolean loadConfigFile(java.lang.String strFilename)
Load a xml configfile.

Parameters:
strFilename - Filename of xml configfile
Returns:
true, if successful

loadDefaultConfig

public void loadDefaultConfig()
Load default config.


hasDataChanged

public boolean hasDataChanged()
Checks if the data has changed.

Returns:
true, if data has changed

isNotifyMailEnabled

public boolean isNotifyMailEnabled()
Should a notify email be send, when indexer has finished work.

Returns:
true, if email should be send

isResetLanguageEnabled

public boolean isResetLanguageEnabled()
Should language be parsed again.

Returns:
true, if language should be reseted

isAutostartEngineEnabled

public boolean isAutostartEngineEnabled()
Should engine be started automaticly.

Returns:
true, if engine should be started automaticly

produceReport

public org.w3c.dom.Document produceReport()
Generate the config as xml document.

Specified by:
produceReport in interface IProducer
Returns:
xml document

setNotifyMail

public void setNotifyMail(boolean bEnabled)
Should a notify email be send, when indexer has finished work.

Parameters:
bEnabled - if email should be send

setResetLanguage

public void setResetLanguage(boolean bEnabled)
Should language be parsed again.

Parameters:
bEnabled - if language should be reseted

saveConfigFile

public boolean saveConfigFile()
                       throws java.io.IOException
Save a xml configfile.

Returns:
true, if successful
Throws:
java.io.IOException - When file could not be saved

saveConfigFile

public boolean saveConfigFile(java.lang.String strFilename)
                       throws java.io.IOException
Save a xml configfile.

Parameters:
strFilename - Filename of xml configfile
Returns:
true, if successful
Throws:
java.io.IOException - When file could not be saved

setAutostartEngine

public void setAutostartEngine(boolean bEnabled)
Should engine start automaticly.

Parameters:
bEnabled - if engine should be started

setDBAddress

public void setDBAddress(java.lang.String strAddress)
Set database address.

Parameters:
strAddress - Address

setDBDriver

public void setDBDriver(java.lang.String strDriver)
Set database driver.

Parameters:
strDriver - Driver

setDBPassword

public void setDBPassword(java.lang.String strPassword)
Set database password.

Parameters:
strPassword - Password

setDBUsername

public void setDBUsername(java.lang.String strName)
Set database username.

Parameters:
strName - Username

setEngineSleepTime

public void setEngineSleepTime(int nSeconds)
Set time where engine sleep until next lookup.

Parameters:
nSeconds - Time in seconds

setEngineSpeed

public void setEngineSpeed(int nBytes)
Set speed of indexing.

Parameters:
nBytes - Bytes per minute

setEngineSpeed

public void setEngineSpeed(FileSize size)
Set speed of indexing.

Parameters:
size - Bytes per minute

setGoogleLicenseKey

public void setGoogleLicenseKey(java.lang.String strKey)
Set the license key for google search.

Parameters:
strKey - Key

setLogPath

public void setLogPath(java.lang.String strPath)
Set path for logger.

Parameters:
strPath - Path

setMaxFileSize

public void setMaxFileSize(FileSize size)
Set max size for uploads.

Parameters:
size - Max file size

setMaxFileSize

public void setMaxFileSize(int nBytes)
Set max size for uploads.

Parameters:
nBytes - Max file size

setMaxWordLength

public void setMaxWordLength(int nChars)
Set max word length.

Parameters:
nChars - Number of chars as maximum

setServletPath

public void setServletPath(java.lang.String strPath)
Set servletpath for uploads.

Parameters:
strPath - Path

setEmailAccount

public void setEmailAccount(MailAccount account)
Set mail account for sending emails.

Parameters:
account - Mailaccount

setImportPath

public void setImportPath(java.lang.String strPath)
Set path for imports.

Parameters:
strPath - Path

setUploadPath

public void setUploadPath(java.lang.String strPath)
Set path for uploads.

Parameters:
strPath - Path

setServletURL

public void setServletURL(java.lang.String strPath)
Set url for servlet.

Parameters:
strPath - Path

setXSLSearchReport

public void setXSLSearchReport(java.lang.String strFilename)
Set filename for xslstypesheet.

Parameters:
strFilename - Filename

setXSLDownloadReport

public void setXSLDownloadReport(java.lang.String strFilename)
Set filename for xslstypesheet.

Parameters:
strFilename - Filename

setXSLIndexReport

public void setXSLIndexReport(java.lang.String strFilename)
Set filename for xslstypesheet.

Parameters:
strFilename - Filename

toElement

public org.w3c.dom.Element toElement(org.w3c.dom.Document doc)
Write information of config in a xml element.

Specified by:
toElement in interface IElement
Parameters:
doc - XML Document
Returns:
element

toElement

public org.w3c.dom.Element toElement(org.w3c.dom.Element element,
                                     org.w3c.dom.Document doc)
Write information of config in a xml element.

Specified by:
toElement in interface IElement
Parameters:
element - Root element
doc - XML Document
Returns:
element

toString

public java.lang.String toString()
Write config to output.

Specified by:
toString in interface IElement
Returns:
string