org.exist.util
Class Configuration

java.lang.Object
  extended byorg.exist.util.Configuration
All Implemented Interfaces:
org.xml.sax.ErrorHandler

public class Configuration
extends java.lang.Object
implements org.xml.sax.ErrorHandler


Nested Class Summary
static class Configuration.SystemTaskConfig
           
 
Constructor Summary
Configuration()
           
Configuration(java.lang.String configFilename)
           
Configuration(java.lang.String configFilename, java.lang.String existHomeDirname)
           
 
Method Summary
 void error(org.xml.sax.SAXParseException exception)
           
 void fatalError(org.xml.sax.SAXParseException exception)
           
static java.io.File getExistHome()
          Returns a file handle for eXist's home directory.
static java.io.File getExistHome(java.lang.String path)
          Returns a file handle for eXist's home directory.
 int getInteger(java.lang.String name)
           
static java.lang.String getPath()
          Returns the absolute path to the configuration file.
 java.lang.Object getProperty(java.lang.String name)
           
static java.io.File getWebappHome()
          Get folder in which the exist webapplications are found.
 boolean hasProperty(java.lang.String name)
           
static boolean isInWarFile()
          Check wether exist runs in Servlet container (as war file).
static java.io.File lookup(java.lang.String path)
          Returns a file handle for the given path, while path specifies the path to an eXist configuration file or directory.
static java.io.File lookup(java.lang.String path, java.lang.String parent)
          Returns a file handle for the given path, while path specifies the path to an eXist configuration file or directory.
 void setProperty(java.lang.String name, java.lang.Object obj)
           
 void warning(org.xml.sax.SAXParseException exception)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration()
              throws DatabaseConfigurationException

Configuration

public Configuration(java.lang.String configFilename)
              throws DatabaseConfigurationException

Configuration

public Configuration(java.lang.String configFilename,
                     java.lang.String existHomeDirname)
              throws DatabaseConfigurationException
Method Detail

getProperty

public java.lang.Object getProperty(java.lang.String name)

hasProperty

public boolean hasProperty(java.lang.String name)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object obj)

getInteger

public int getInteger(java.lang.String name)

getPath

public static java.lang.String getPath()
Returns the absolute path to the configuration file.

Returns:
the path to the configuration file

lookup

public static java.io.File lookup(java.lang.String path)
Returns a file handle for the given path, while path specifies the path to an eXist configuration file or directory.
Note that relative paths are being interpreted relative to exist.home or the current working directory, in case exist.home was not set.

Parameters:
path - the file path
Returns:
the file handle

lookup

public static java.io.File lookup(java.lang.String path,
                                  java.lang.String parent)
Returns a file handle for the given path, while path specifies the path to an eXist configuration file or directory.
If parent is null, then relative paths are being interpreted relative to exist.home or the current working directory, in case exist.home was not set.

Parameters:
path - path to the file or directory
parent - parent directory used to lookup path
Returns:
the file handle

getExistHome

public static java.io.File getExistHome()
Returns a file handle for eXist's home directory.

If either none of the directories identified by the system properties exist.home and user.home exist or none of them contain a configuration file, this method returns null.

Returns:
the file handle or null

getExistHome

public static java.io.File getExistHome(java.lang.String path)
Returns a file handle for eXist's home directory. Order of tests is designed with the idea, the more precise it is, the more the developper know what he is doing
  1. proposed path : if exists
  2. exist.home : if exists
  3. user.home : if exists, with a conf.xml file
  4. user.dir : if exists, with a conf.xml file

Parameters:
path - path to eXist home directory
Returns:
the file handle or null

isInWarFile

public static boolean isInWarFile()
Check wether exist runs in Servlet container (as war file).

Returns:
TRUE if exist runs in servlet container.

getWebappHome

public static java.io.File getWebappHome()
Get folder in which the exist webapplications are found. For default install ("jar install") and in webcontainer ("war install") the location is different. (EXIST_HOME/webapps vs. TOMCAT/webapps/exist)

Returns:
folder.

error

public void error(org.xml.sax.SAXParseException exception)
           throws org.xml.sax.SAXException
Specified by:
error in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
                throws org.xml.sax.SAXException
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

warning

public void warning(org.xml.sax.SAXParseException exception)
             throws org.xml.sax.SAXException
Specified by:
warning in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException


Copyright (C) Wolfgang Meier. All rights reserved.