Regain 2.1.0-STABLE API

net.sf.regain.ui.desktop.config
Class XmlDesktopConfig

java.lang.Object
  extended by net.sf.regain.ui.desktop.config.XmlDesktopConfig
All Implemented Interfaces:
DesktopConfig, DesktopConstants

public class XmlDesktopConfig
extends Object
implements DesktopConfig, DesktopConstants

Reads the configuration of the desktop search from a XML file.

Author:
Til Schneider, www.murfman.de

Field Summary
private  String mBrowser
          The executable of the browser.
private  long mConfigFileLastModified
          The timestamp when the config file was last modified.
private  boolean mExternalAccessAllowed
          Flag whether external access is allowed.
private  int mInterval
          The index update interval.
private static org.apache.log4j.Logger mLog
          The logger for this class
private  Map<String,String> mNamespaces
          Namespaces that should be registered for the simple server.
private  int mPort
          The port of the webserver.
private  File mXmlFile
          The XML file to read the configuration from.
 
Fields inherited from interface net.sf.regain.ui.desktop.DesktopConstants
AUTH_PROPS_FILE, CONFIG_DIR, CRAWLER_CONFIG_FILE, DEFAULT_CONFIG_DIR, DEFAULT_CRAWLER_CONFIG_FILE, DEFAULT_DESKTOP_CONFIG_FILE, DEFAULT_INTERVAL, DEFAULT_PORT, DESKTOP_CONFIG_FILE, INDEX_DIR, LASTUPDATE_FILE, LOG_DIR, NEEDSUPDATE_FILE, TAGLIB_DIR
 
Constructor Summary
XmlDesktopConfig(File xmlFile)
          Creates a new instance of XmlDesktopConfig.
 
Method Summary
 String getBrowser()
          Gets the executable of the browser that should be used for showing web pages.
 boolean getExternalAccessAllowed()
          Gets the setting wheter external access to the instance is allowed or not.
 int getInterval()
          Gets the index update interval from the desktop configuration.
 int getPort()
          Gets the port of the webserver.
 Map<String,String> getSimpleNamespaces()
          Gets Tag namespaces that should be registered so they can be used in the JSP-File.
private  void loadConfig()
          Loads the config if the config was not yet loaded or if the file has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mLog

private static org.apache.log4j.Logger mLog
The logger for this class


mXmlFile

private File mXmlFile
The XML file to read the configuration from.


mConfigFileLastModified

private long mConfigFileLastModified
The timestamp when the config file was last modified.


mInterval

private int mInterval
The index update interval.


mPort

private int mPort
The port of the webserver.


mExternalAccessAllowed

private boolean mExternalAccessAllowed
Flag whether external access is allowed.


mBrowser

private String mBrowser
The executable of the browser. Is null if the browser should be auto-detected.


mNamespaces

private Map<String,String> mNamespaces
Namespaces that should be registered for the simple server.

Constructor Detail

XmlDesktopConfig

public XmlDesktopConfig(File xmlFile)
Creates a new instance of XmlDesktopConfig.

Parameters:
xmlFile - The XML file to read the configuration from.
Method Detail

getInterval

public int getInterval()
                throws RegainException
Gets the index update interval from the desktop configuration.

Specified by:
getInterval in interface DesktopConfig
Returns:
The index update interval.
Throws:
RegainException - If loading the config failed.

getPort

public int getPort()
            throws RegainException
Gets the port of the webserver.

Specified by:
getPort in interface DesktopConfig
Returns:
The port of the webserver.
Throws:
RegainException - If loading the config failed.

getBrowser

public String getBrowser()
                  throws RegainException
Gets the executable of the browser that should be used for showing web pages. Returns null if the browser should be auto-detected.

Specified by:
getBrowser in interface DesktopConfig
Returns:
The executable of the browser.
Throws:
RegainException - If loading the config failed.

getExternalAccessAllowed

public boolean getExternalAccessAllowed()
                                 throws RegainException
Gets the setting wheter external access to the instance is allowed or not. pages. Returns FALSE if no config entry exists

Specified by:
getExternalAccessAllowed in interface DesktopConfig
Returns:
the boolean whether external access is allowed or not
Throws:
RegainException - If loading the config failed.

loadConfig

private void loadConfig()
                 throws RegainException
Loads the config if the config was not yet loaded or if the file has changed.

Throws:
RegainException - If loading the config failed.

getSimpleNamespaces

public Map<String,String> getSimpleNamespaces()
                                       throws RegainException
Gets Tag namespaces that should be registered so they can be used in the JSP-File.

Specified by:
getSimpleNamespaces in interface DesktopConfig
Returns:
A map of Alias - Package Name
Throws:
RegainException - If loading the config failed.

Regain 2.1.0-STABLE API

Regain 2.1.0-STABLE, Copyright (C) 2004-2010 Til Schneider, www.murfman.de, Thomas Tesche, www.clustersystems.info