public final class FolderPathResolver extends Object implements Cloneable
It is able to find a PublicObject using the absolute path or a relative path. It understands wildcards, folder delimiters, and illegal characters within an absolute path.
For ease in folder navigation, one can set the "root" and "home" folders.
Modifier and Type | Field and Description |
---|---|
static String |
CURRENT_DIRECTORY_TOKEN
The "current directory" token.
|
static String |
FOLDER_DELIMITER
The default folder path delimiter.
|
protected Folder |
m_CurrentDirectory
The Folder representing the current directory
|
protected String |
m_CurrentPath
The String representing the current directory.
|
protected String |
m_Delim
used to maintain the path Strings as up-to-date as possible
costs one string compare
|
protected boolean |
m_IsRootTopDirectory
Is the Root Folder the top directory?
|
protected IfsObjectResolver |
m_LookupResolver
the lookup handler
|
protected Folder |
m_RootFolder
The Folder representing the root directory.
|
protected LibrarySession |
m_Session
The current session
|
protected Folder |
m_TopDirectory
The Folder representing the top directory
|
protected String |
m_TopPath
The String representing the top directory.
|
static char |
MATCH_ALL
The character used as the wildcard to
match any (0 or more) characters.
|
static char |
MATCH_ONE
The character used as the wildcard to
match any single character.
|
protected static char[] |
s_IllegalCharacterSet
illegal filename chars and legal delimiter chars
|
protected static char[] |
s_LegalDelimiters
legal delimiters
|
static String |
UP_DIRECTORY_TOKEN
The "change directory UP one level" token.
|
Constructor and Description |
---|
FolderPathResolver(LibrarySession session)
default constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
assertLegalDelimiter(String delimiter)
checks to make sure delimiter is a legal delimitier
|
static boolean |
containsWildcard(String s)
Checks whether folder path contains any wildcards.
|
static String |
exchangeDelimiters(String path,
String oldDelim,
String newDelim)
used to adapt paths to a change in the LibrarySession.getFolderPathDelimiter
|
static PublicObject[] |
filterItems(PublicObject[] pos,
String match)
Performs wildcard filtering of Folder.getItems() wildcard matching
|
PublicObject |
findPublicObjectByPath(String path)
Returns the PublicObject for which the path specifies.
|
String |
getAbsolutePath(String relativePath)
Gets the absolute path from a realtive path
|
Folder |
getCurrentDirectory()
Get the current directory in effect.
|
protected static String |
getCurrentLocationEmbedded(String delim)
defaults to "/
|
protected static String |
getCurrentLocationPrefix(String delim)
defaults to "
|
String |
getCurrentPath()
Get the current file path in effect.
|
static char[] |
getIllegalPathCharacters()
Get the illegal path characters.
|
static char[] |
getLegalPathDelimiters()
Get the legal path delimiters.
|
Folder |
getTopDirectory()
Get the top directory in effect.
|
String |
getTopPath()
Get the top file path in effect.
|
static boolean |
isLegalDelimiter(String delimiter)
checks to make sure delimiter is a legal delimitier
|
void |
setCurrentDirectory(Folder folder)
Sets the current path to the specified Folder's path
|
void |
setHomeFolder()
Change current folder to a home folder for the current user.
|
void |
setHomeFolder(DirectoryUser user)
Set current folder to the home folder of a specified
directory user
|
void |
setHomeFolder(String username)
Change current folder to a home folder for a specified user.
|
void |
setHomeFolder(String username,
String anonymousUsername,
boolean robust)
Change current folder to a home folder for a specified user.
|
void |
setRelativePath(String path)
Change current folder to relative path
|
void |
setRootFolder()
Change current folder to the Root Folder
|
void |
setRootFolder(Folder root)
Change current folder to the Root Folder
|
protected static final char[] s_IllegalCharacterSet
protected static final char[] s_LegalDelimiters
public static final String UP_DIRECTORY_TOKEN
public static final String CURRENT_DIRECTORY_TOKEN
public static final String FOLDER_DELIMITER
public static final char MATCH_ALL
public static final char MATCH_ONE
protected String m_Delim
protected LibrarySession m_Session
protected IfsObjectResolver m_LookupResolver
protected String m_CurrentPath
protected String m_TopPath
protected Folder m_RootFolder
protected Folder m_CurrentDirectory
protected Folder m_TopDirectory
protected boolean m_IsRootTopDirectory
public FolderPathResolver(LibrarySession session) throws IfsException
session
- LibrarySession the sessionIfsException
- if operation fails.public static char[] getIllegalPathCharacters()
public static char[] getLegalPathDelimiters()
public String getCurrentPath() throws IfsException
IfsException
- if operation fails.public String getTopPath() throws IfsException
IfsException
- if operation fails.public Folder getCurrentDirectory() throws IfsException
IfsException
- if operation fails.public Folder getTopDirectory() throws IfsException
IfsException
- if operation fails.public void setRootFolder() throws IfsException
IfsException
- if operation fails.public void setRootFolder(Folder root) throws IfsException
root
- Folder that acts as the rootIfsException
- if operation fails.public void setHomeFolder() throws IfsException
IfsException
- if operation fails.public void setHomeFolder(String username) throws IfsException
IfsException
- if operation fails.public void setHomeFolder(DirectoryUser user) throws IfsException
IfsException
- if operation fails.public void setHomeFolder(String username, String anonymousUsername, boolean robust) throws IfsException
IfsException
- if operation fails.public void setCurrentDirectory(Folder folder) throws IfsException
IfsException
- if operation fails.public String getAbsolutePath(String relativePath) throws IfsException
relativePath
- can be absoluteIfsException
public void setRelativePath(String path) throws IfsException
IfsException
- if operation fails.public PublicObject findPublicObjectByPath(String path) throws IfsException
IfsException
- if operation fails.public static boolean containsWildcard(String s) throws IfsException
IfsException
public static PublicObject[] filterItems(PublicObject[] pos, String match) throws IfsException
pos
- PublicObjects the objects to filter throughmatch
- the wildcard string to matchIfsException
public static String exchangeDelimiters(String path, String oldDelim, String newDelim)
protected static String getCurrentLocationPrefix(String delim)
protected static String getCurrentLocationEmbedded(String delim)
public static void assertLegalDelimiter(String delimiter) throws IfsException
IfsException
- if delimiter is not legalpublic static boolean isLegalDelimiter(String delimiter) throws IfsException
if
- operation failsIfsException
Copyright © 2023. All rights reserved.