public final class Path extends Object
Modifier and Type | Field and Description |
---|---|
static String |
SELECTOR_DELIMITER |
Modifier and Type | Method and Description |
---|---|
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 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)
Deprecated.
since 5.2.2, use
getUniqueLabel(Node, String) instead. |
static String |
getUniqueLabel(HierarchyManager hierarchyManager,
String parent,
String label)
Deprecated.
since 5.2.2, use
getUniqueLabel(Session, String, String) instead. |
static String |
getUniqueLabel(javax.jcr.Node parent,
String label) |
static String |
getUniqueLabel(javax.jcr.Session session,
String parentPath,
String label)
Checks if an item already exists with given name (label) in JCR, and returns a unique name;
if necessary, an increment is appended to the name.
|
static String |
getUniqueLabel(javax.jcr.Session session,
String parentPath,
String label,
String extension)
Checks if an item already exists with given name (label) in JCR, and returns a unique name;
if necessary, an increment is inserted into the name, before the given extension.
|
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 - :
Jackrabbit not allowed 32: [ ] 91: [[] 93: []] 42: [*] 34: ["] 58 [:] 92: [\] 39 :[']
URL not valid {@code 59: [;] 47: [/] 63: [?] |
static boolean |
isAbsolute(String path) |
static boolean |
isCharValid(int charCode,
String charset) |
public static final String SELECTOR_DELIMITER
public static String getCacheDirectoryPath()
public static File getCacheDirectory()
public static String getTempDirectoryPath()
public static File getTempDirectory()
public static String getHistoryFilePath()
public static File getHistoryFile()
public static String getRepositoriesConfigFilePath()
public static File getRepositoriesConfigFile()
public static File getAppRootDir()
public static String getAbsoluteFileSystemPath(String path)
public static String getUniqueLabel(HierarchyManager hierarchyManager, String parent, String label)
getUniqueLabel(Session, String, String)
instead.public static String getUniqueLabel(javax.jcr.Session session, String parentPath, String label) throws javax.jcr.RepositoryException
Given the following tree:
/ ├── a ├── b └── b0 Path.getUniqueLabel(session, "/", "a") = "a0" Path.getUniqueLabel(session, "/", "b") = "b1" Path.getUniqueLabel(session, "/", "b0") = "b1" Path.getUniqueLabel(session, "/", "c") = "c"
javax.jcr.RepositoryException
public static String getUniqueLabel(javax.jcr.Session session, String parentPath, String label, String extension) throws javax.jcr.RepositoryException
Given the following tree:
/ ├── a.txt ├── b.txt └── b0.txt Path.getUniqueLabel(session, "/", "a.txt", "txt") = "a0.txt" Path.getUniqueLabel(session, "/", "b.txt", "txt") = "b1.txt" Path.getUniqueLabel(session, "/", "b0.txt", "txt") = "b1.txt" Path.getUniqueLabel(session, "/", "c.txt", "txt") = "c.txt" Path.getUniqueLabel(session, "/", "a.foo", "txt") = "a.foo" Path.getUniqueLabel(session, "/", "a.txt", "bar") = "a.txt0"
javax.jcr.RepositoryException
public static String getUniqueLabel(Content parent, String label)
getUniqueLabel(Node, String)
instead.public static boolean isAbsolute(String path)
public static String getValidatedLabel(String label)
label
- label to validatepublic static String getValidatedLabel(String label, String charset)
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 [.]
.
public static boolean isCharValid(int charCode, String charset)
charCode
- char codecharset
- charset (ex. UTF-8)Copyright © 2003–2016 Magnolia International Ltd.. All rights reserved.