info.magnolia.cms.core
Class Path

java.lang.Object
  extended by info.magnolia.cms.core.Path

public final class Path
extends Object

Utility class to retrieve files or directory used by Magnolia. Examples: cache directory, tmp files, ..

Version:
2.0 $Id$

Field Summary
static String SELECTOR_DELIMITER
           
 
Method Summary
static String getAbsoluteFileSystemPath(String path)
          Gets absolute filesystem path, adds application root if path is not absolute.
static String getAbsolutePath(String path)
           
static String getAbsolutePath(String path, String label)
           
static File getAppRootDir()
          Gets the root directory for the magnolia web application.
static File getCacheDirectory()
           
static String getCacheDirectoryPath()
          Gets the cache directory path (cms.cache.startdir) as set with Java options while startup or in web.xml.
static File getHistoryFile()
           
static String getHistoryFilePath()
          Gets cms.exchange.history file location as set with Java options while startup or in web.xml.
static String getNodePath(String path)
          Deprecated. since 4.0 - untested and unused
static String getNodePath(String path, String label)
          Deprecated. since 4.0 - untested and unused
static String getParentPath(String path)
          Deprecated. since 4.0 - untested and unused
static File getRepositoriesConfigFile()
           
static String getRepositoriesConfigFilePath()
          Gets repositories file location as set with Java options while startup or in web.xml.
static File getTempDirectory()
           
static String getTempDirectoryPath()
          Gets the temporary directory path (cms.upload.tmpdir) as set with Java options while startup or in web.xml.
static String getUniqueLabel(Content parent, String label)
           
static String getUniqueLabel(HierarchyManager hierarchyManager, String parent, String label)
           
static String getUniqueLabel(javax.jcr.Session session, String parent, String label)
           
static String getValidatedLabel(String label)
          Replace illegal characters based on system property magnolia.ut8.enabled.
static String getValidatedLabel(String label, String charset)
          If charset equals UTF-8, replaces the following characters with a dash - :
static boolean isAbsolute(String path)
           
static boolean isCharValid(int charCode, String charset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTOR_DELIMITER

public static final String SELECTOR_DELIMITER
See Also:
Constant Field Values
Method Detail

getCacheDirectoryPath

public static String getCacheDirectoryPath()
Gets the cache directory path (cms.cache.startdir) as set with Java options while startup or in web.xml.

Returns:
Cache directory path

getCacheDirectory

public static File getCacheDirectory()

getTempDirectoryPath

public static String getTempDirectoryPath()
Gets the temporary directory path (cms.upload.tmpdir) as set with Java options while startup or in web.xml.

Returns:
Temporary directory path

getTempDirectory

public static File getTempDirectory()

getHistoryFilePath

public static String getHistoryFilePath()
Gets cms.exchange.history file location as set with Java options while startup or in web.xml.

Returns:
exchange history file location

getHistoryFile

public static File getHistoryFile()

getRepositoriesConfigFilePath

public static String getRepositoriesConfigFilePath()
Gets repositories file location as set with Java options while startup or in web.xml.

Returns:
file location

getRepositoriesConfigFile

public static File getRepositoriesConfigFile()

getAppRootDir

public static File getAppRootDir()
Gets the root directory for the magnolia web application.

Returns:
magnolia root dir

getAbsoluteFileSystemPath

public static String getAbsoluteFileSystemPath(String path)
Gets absolute filesystem path, adds application root if path is not absolute.


getUniqueLabel

public static String getUniqueLabel(HierarchyManager hierarchyManager,
                                    String parent,
                                    String label)

getUniqueLabel

public static String getUniqueLabel(javax.jcr.Session session,
                                    String parent,
                                    String label)
                             throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getUniqueLabel

public static String getUniqueLabel(Content parent,
                                    String label)

isAbsolute

public static boolean isAbsolute(String path)

getValidatedLabel

public static String getValidatedLabel(String label)
Replace illegal characters based on system property magnolia.ut8.enabled.

Parameters:
label - label to validate
Returns:
validated label

getValidatedLabel

public static String getValidatedLabel(String label,
                                       String charset)
If charset equals UTF-8, replaces the following characters with a dash - :

Jackrabbit not allowed 32: [ ] 91: [[] 93: []] 42: [*] 34: ["] 58 [:] 92: [\] 39 :[']

URL not valid 59: [;] 47: [/] 63: [?] 43: [+] 37: [%] 33: [!] 35:[#] 94: [^].

Otherwise, replaces illegal characters with a dash - except for [_] [0-9], [A-Z], [a-z], [-], [_], [.].

Please notice that a valid label can not begin with dot or period [.].

Returns:
a validated label for a node.

isCharValid

public static boolean isCharValid(int charCode,
                                  String charset)
Parameters:
charCode - char code
charset - charset (ex. UTF-8)
Returns:
true if char can be used as a content name

getAbsolutePath

public static String getAbsolutePath(String path,
                                     String label)

getAbsolutePath

public static String getAbsolutePath(String path)

getNodePath

@Deprecated
public static String getNodePath(String path,
                                            String label)
Deprecated. since 4.0 - untested and unused


getNodePath

@Deprecated
public static String getNodePath(String path)
Deprecated. since 4.0 - untested and unused


getParentPath

@Deprecated
public static String getParentPath(String path)
Deprecated. since 4.0 - untested and unused



Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.