|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Adaptee
org.norther.tammi.core.io.DefaultPathFinder
public class DefaultPathFinder
A default implementation of PathFinder.
| Field Summary | |
|---|---|
static String |
DEFAULT_BINARY
The default binary folder. |
static String |
DEFAULT_CGI_BIN
The default cgi bin folder. |
static String |
DEFAULT_CONFIG
The default config folder. |
static String |
DEFAULT_DATA
The default data folder. |
static String |
DEFAULT_LIBRARY
The default libray folder. |
static String |
DEFAULT_LICENSE
The default license folder. |
static String |
DEFAULT_LOGS
The default logs folder. |
static String |
DEFAULT_MEDIA
The default media folder. |
static String |
DEFAULT_RESOURCE
The default resource folder. |
static String |
DEFAULT_SCRIPT
The default script folder. |
static String |
DEFAULT_SECURITY
The default security folder. |
static String |
DEFAULT_START
The default start folder. |
static String |
DEFAULT_STOP
The default stop folder. |
static String |
DEFAULT_TAMMI
The default tammi folder. |
static String |
DEFAULT_TEMP
The default temp folder. |
static String |
DEFAULT_TEMPLATE
The default template folder. |
| Fields inherited from class org.norther.tammi.core.base.Adaptee |
|---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
| Fields inherited from interface org.norther.tammi.core.io.PathFinder |
|---|
BINARY, CGI_BIN, CONFIG, CONTEXT, CSV_EXTENSION, DATA, DEFAULT_DATA_PROPERTY, DEFAULT_LOGS_PROPERTY, DEFAULT_TEMP_PROPERTY, LIBRARY, LICENSE, LOGS, MEDIA, PROPERTIES_EXTENSION, RESOURCE, SCRIPT, SECURITY, START, STOP, TEMP, TEMPLATE, XML_EXTENSION |
| Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
DefaultPathFinder()
Constructs a new finder. |
|
DefaultPathFinder(String root)
Constructs a new finder with a specified root. |
|
| Method Summary | |
|---|---|
void |
addContextPath(int index,
String path)
Adds a context path to the specified index. |
void |
addContextPath(String path)
Adds a context path if not already specified. |
void |
addFolderPath(String key,
int index,
String path)
Adds a key folder path to the specified index. |
void |
addFolderPath(String key,
String path)
Adds a key folder path if not already specified. |
void |
clearContext()
Clears all context paths. |
void |
clearFolder(String key)
Clears a key folder. |
void |
clearFolders()
Clears all key folders. |
boolean |
deleteFile(File file)
Deletes a file or folder and its contents. |
File |
findFile(String path)
Finds a file relative to the root folder. |
File |
findFile(String key,
String path)
Finds a file relative to a key folder. |
File |
findFile(String key,
String path,
Locale locale)
Finds a localized file relative to a key folder. |
File |
findFile(String key,
String path,
Locale locale,
String variant)
Finds a localized file with an optional variant relative to a key folder. |
OrderedSet |
findFolders(String key)
Finds all existing folders corresponding to the specified key by applying the context paths of this path finder. |
URL |
findResource(String path)
Finds a root resource using a local class loader. |
URL |
findResource(String key,
String path)
Finds a key resource using a local class loader. |
URL |
findResource(String key,
String path,
Locale locale)
Finds a localized key resource using a local class loader. |
URL |
findResource(String key,
String path,
Locale locale,
String variant)
Finds a localized key resource with an optional variant using a local class loader. |
URL |
findURL(String path)
Finds a file relative to the root folder or a root resource using a local class loader. |
URL |
findURL(String key,
String path)
Finds a file relative to a key folder or a key resource using a local class loader. |
URL |
findURL(String key,
String path,
Locale locale)
Finds a localized file relative to a key folder or a localized key resource using a local class loader. |
URL |
findURL(String key,
String path,
Locale locale,
String variant)
Finds a localized file relative to a key folder or a localized key resource, with an optional variant, using a local class loader. |
Set |
folderKeySet()
Returns a read-only set of specified folder keys. |
ClassLoader |
getContextClassLoader()
Gets a context class loader loading resources from context paths of this path finder. |
String[] |
getContextPaths()
Gets the context paths. |
String[] |
getFolderPaths(String key)
Gets the specified key folder paths. |
File |
getRootFolder()
Gets the root folder. |
String |
getRootPath()
Gets the root path. |
File |
getSystemFolder()
Gets the operating system folder. |
boolean |
isNormalizedPaths()
Checks whether requested paths are normalized before search to reject absolute search paths and references outside context paths folders. |
void |
removeContextPath(String path)
Removes a context path. |
void |
removeFolderPath(String key,
String path)
Removes a key folder path. |
void |
setContextPaths(String[] paths)
Sets the context paths.. |
void |
setFolderPaths(String key,
String[] paths)
Sets the specified key folder paths. |
void |
setNormalizedPaths(boolean flag)
Sets whether requested paths are normalized before search to reject absolute search paths and references outside context paths folders. |
void |
setRootPath(String path)
Sets the root path. |
URL |
toURL(String path)
Converts a URL path, local path or jar path relative to the root folder to a URL instance. |
URL |
toURL(String key,
String path)
Converts a URL path, local path or jar path relative to the key folder to a URL instance. |
| Methods inherited from class org.norther.tammi.core.base.Adaptee |
|---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_BINARY
public static final String DEFAULT_LIBRARY
public static final String DEFAULT_LICENSE
public static final String DEFAULT_MEDIA
public static final String DEFAULT_CGI_BIN
public static final String DEFAULT_RESOURCE
public static final String DEFAULT_TEMPLATE
public static final String DEFAULT_START
public static final String DEFAULT_STOP
public static final String DEFAULT_SCRIPT
public static final String DEFAULT_CONFIG
public static final String DEFAULT_SECURITY
public static final String DEFAULT_TEMP
public static final String DEFAULT_DATA
public static final String DEFAULT_LOGS
public static final String DEFAULT_TAMMI
| Constructor Detail |
|---|
public DefaultPathFinder()
public DefaultPathFinder(String root)
root - a root folder.| Method Detail |
|---|
public boolean isNormalizedPaths()
PathFinder
isNormalizedPaths in interface PathFinderpublic void setNormalizedPaths(boolean flag)
PathFinder
setNormalizedPaths in interface PathFinderflag - true if normalized, false otherwise.public File getRootFolder()
PathFinder
getRootFolder in interface PathFinderpublic String getRootPath()
PathFinder
getRootPath in interface PathFinderpublic void setRootPath(String path)
PathFinder
setRootPath in interface PathFinderpath - the root path.public String[] getContextPaths()
PathFinder
getContextPaths in interface PathFinderpublic void setContextPaths(String[] paths)
PathFinder
setContextPaths in interface PathFinderpaths - an array of context paths.public void addContextPath(String path)
PathFinder
addContextPath in interface PathFinderpath - the context path.
public void addContextPath(int index,
String path)
PathFinder
addContextPath in interface PathFinderindex - the path index.path - the context path.public void removeContextPath(String path)
PathFinder
removeContextPath in interface PathFinderpath - the context path.public void clearContext()
PathFinder
clearContext in interface PathFinderpublic String[] getFolderPaths(String key)
PathFinder
getFolderPaths in interface PathFinderkey - the folder key.
public void setFolderPaths(String key,
String[] paths)
PathFinder
setFolderPaths in interface PathFinderkey - the folder key.paths - an array of key folder paths.
public void addFolderPath(String key,
String path)
PathFinder
addFolderPath in interface PathFinderkey - the folder key.path - the key folder path.
public void addFolderPath(String key,
int index,
String path)
PathFinder
addFolderPath in interface PathFinderkey - the folder key.index - the path index.path - the key folder path.
public void removeFolderPath(String key,
String path)
PathFinder
removeFolderPath in interface PathFinderkey - the folder key.path - the key folder path.public void clearFolder(String key)
PathFinder
clearFolder in interface PathFinderkey - the folder key.public void clearFolders()
PathFinder
clearFolders in interface PathFinderpublic Set folderKeySet()
PathFinder
folderKeySet in interface PathFinderpublic boolean deleteFile(File file)
PathFinder
deleteFile in interface PathFinderfile - the file to delete.
public OrderedSet findFolders(String key)
PathFinder
findFolders in interface PathFinderkey - a folder key.
java.io.File instances.public URL findURL(String path)
PathFinder
findURL in interface PathFinderpath - a path to find.
public URL findURL(String key,
String path)
PathFinder
findURL in interface PathFinderkey - a folder key or null for the root.path - a path to find.
public URL findURL(String key,
String path,
Locale locale)
PathFinder
findURL in interface PathFinderkey - a folder key or null for the root.path - a path to find.locale - the locale of the path.
public URL findURL(String key,
String path,
Locale locale,
String variant)
PathFinder
findURL in interface PathFinderkey - a folder key or null for the root.path - a path to find.locale - the locale of the path.variant - a variant to the locale.
public File findFile(String path)
PathFinder
findFile in interface PathFinderpath - a path to find.
public File findFile(String key,
String path)
PathFinder
findFile in interface PathFinderkey - a folder key or null for the root.path - a path to find.
public File findFile(String key,
String path,
Locale locale)
PathFinder
findFile in interface PathFinderkey - a folder key or null for the root.path - a path to find.locale - the locale of the path.
public File findFile(String key,
String path,
Locale locale,
String variant)
PathFinder
findFile in interface PathFinderkey - a folder key or null for the root.path - a path to find.locale - the locale of the path.variant - a variant to the locale.
public URL findResource(String path)
PathFinder
findResource in interface PathFinderpath - a path to find.
public URL findResource(String key,
String path)
PathFinder
findResource in interface PathFinderkey - a folder key or null for the root.path - a path to find.
public URL findResource(String key,
String path,
Locale locale)
PathFinder
findResource in interface PathFinderkey - a folder key or null for the root.path - a path to find.locale - the locale of the path.
public URL findResource(String key,
String path,
Locale locale,
String variant)
PathFinder
findResource in interface PathFinderkey - a folder key or null for the root.path - a path to find.locale - the locale of the path.variant - a variant to the locale.
public URL toURL(String path)
throws MalformedURLException
PathFinder
toURL in interface PathFinderpath - a path to find.
MalformedURLException - for an invalid URL path.
public URL toURL(String key,
String path)
throws MalformedURLException
PathFinder
toURL in interface PathFinderkey - a folder key.path - a path to find.
MalformedURLException - for an invalid URL path.public ClassLoader getContextClassLoader()
PathFinder
getContextClassLoader in interface PathFinderpublic File getSystemFolder()
PathFinder
getSystemFolder in interface PathFinder
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||