de.janrufmonitor.util.io
Class PathResolver

java.lang.Object
  extended by de.janrufmonitor.util.io.PathResolver

public class PathResolver
extends Object

This class provides resolving of directory variables like %userhome%, %imagepath%, %installpath%

Author:
Thilo Brandt

Method Summary
 String encode(String path)
          Encodes the path with the variables if possible
 String getConfigDirectory()
          Gets the config directory of the application.
 String getDataDirectory()
          Gets the data directory of the application.
 String getImageDirectory()
          Gets the image directory of the application.
 String getInstallDirectory()
          Gets the install directory of the application.
static PathResolver getInstance()
          Gets an instance of the PathResolver without runtime dependency.
static PathResolver getInstance(IRuntime runtime)
          Gets an instance of the PathResolver depending on the runtime.
 String getLibDirectory()
          Gets the lib directory of the application.
 String getLogDirectory()
          Gets the log directory of the application.
 String getPhotoDirectory()
          Gets the central photo directory of the application.
 String getTempDirectory()
          Gets the temporary directory.
 String getUserhomeDirectory()
          Gets the userhome directory.
 void initialize()
          Initializes the path variables.
 String resolve(String path)
          Resolves the path to a valid String obejct.
 String toFilePath(String filename, boolean create)
          Transforms a file string into an OS compliant filename string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static PathResolver getInstance(IRuntime runtime)
Gets an instance of the PathResolver depending on the runtime.

Parameters:
runtime - the current runtime.
Returns:
a valif PathResolver object

getInstance

public static PathResolver getInstance()
Gets an instance of the PathResolver without runtime dependency.

Parameters:
runtime - the current runtime.
Returns:
a valif PathResolver object

initialize

public void initialize()
Initializes the path variables.


resolve

public String resolve(String path)
Resolves the path to a valid String obejct.


encode

public String encode(String path)
Encodes the path with the variables if possible

Parameters:
path - path to encode
Returns:
encoded path

getInstallDirectory

public String getInstallDirectory()
Gets the install directory of the application.

Returns:
install directory

getLibDirectory

public String getLibDirectory()
Gets the lib directory of the application.

Returns:
lib directory

getImageDirectory

public String getImageDirectory()
Gets the image directory of the application.

Returns:
image directory

getUserhomeDirectory

public String getUserhomeDirectory()
Gets the userhome directory.

Returns:
userhome directory

getTempDirectory

public String getTempDirectory()
Gets the temporary directory.

Returns:
temporary directory

getDataDirectory

public String getDataDirectory()
Gets the data directory of the application.

Returns:
data directory

getConfigDirectory

public String getConfigDirectory()
Gets the config directory of the application.

Returns:
config directory

getPhotoDirectory

public String getPhotoDirectory()
Gets the central photo directory of the application.

Returns:
central photo directory

getLogDirectory

public String getLogDirectory()
Gets the log directory of the application.

Returns:
log directory

toFilePath

public String toFilePath(String filename,
                         boolean create)
Transforms a file string into an OS compliant filename string.

Parameters:
filename - a filename
Returns:
an OS compliant filename string


Copyright © 2010 by Thilo Brandt. All Rights Reserved.