org.exist.util
Class ConfigurationHelper

java.lang.Object
  extended by org.exist.util.ConfigurationHelper

public class ConfigurationHelper
extends Object


Constructor Summary
ConfigurationHelper()
           
 
Method Summary
static String decodeUserHome(String path)
          Resolves the given path by means of eventually replacing ~ with the users home directory, taken from the system property user.home.
static File getExistHome()
          Returns a file handle for eXist's home directory.
static File lookup(String path)
          Returns a file handle for the given path, while path specifies the path to an eXist configuration file or directory.
static File lookup(String path, String parent)
          Returns a file handle for the given path, while path specifies the path to an eXist configuration file or directory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationHelper

public ConfigurationHelper()
Method Detail

getExistHome

public static File getExistHome()
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. Brokerpool : if eXist was already configured.
  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
  5. classpath entry : if exists, with a conf.xml file

Returns:
the file handle or null

lookup

public static File lookup(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 File lookup(String path,
                          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

decodeUserHome

public static String decodeUserHome(String path)
Resolves the given path by means of eventually replacing ~ with the users home directory, taken from the system property user.home.

Parameters:
path - the path to resolve
Returns:
the resolved path


Copyright (C) Wolfgang Meier. All rights reserved.