All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.wizards.builder.resolver.FileResolver
java.lang.Object
|
+----com.sun.wizards.builder.resolver.FileResolver
- public class FileResolver
- extends Object
- implements ResourceResolver
A resolver that can look in a specified path for a resource. Default known-about types are:
"Images" : {.gif, .jpg, .jpeg, .jfif}
"Audio" : {.au, .wav}
"RuntimeClasses" : {.class}
"ArchiveReader" : {.class} - classes of this type are extracted first at runtime.
-
FileResolver(String)
- Create a FileResolver that looks in the specified path (directories separated by the system-dependent
path-separator).
-
addPath(String)
- Adds an entry to the path list to search during resource resolution.
-
resolveResource(String, String, byte[])
- Resolves resources from the local filesystem.
-
searchPath(String, String)
- Utility method to search a path for a file.
-
setExtensions(String, String[])
-
Adds extensions for the specified type.
FileResolver
public FileResolver(String path)
- Create a FileResolver that looks in the specified path (directories separated by the system-dependent
path-separator).
- Parameters:
- path - The path to search during resource resolution.
addPath
public void addPath(String path)
- Adds an entry to the path list to search during resource resolution.
- Parameters:
- path - The path to search during resource resolution.
setExtensions
public void setExtensions(String type,
String extensions[])
- Adds extensions for the specified type. If the type does not
exist, it is created. If the type does exist, the extensions are
added to the list.
- Parameters:
- type - The type of resources to be found using the extensions
- extensions - A list of extensions.
resolveResource
public ResourceInputStream resolveResource(String type,
String name,
byte extData[])
- Resolves resources from the local filesystem. This method
provides the core functionality of the FileResolver. The
resource name is transformed into a relative filename (for
example, on unix, "com.sun.wizards.myImage" of type "Images"
becomes "com/sun/wizards/core/Task{.gif, .jpg, .jpeg,
.jfif}") and the path for "Images" is searched for each
filename until one is found.
- Parameters:
- type - The type of the requested resource
- name - The name of the requested resource in dot notation (i.e. "com.sun.wizards.core.Task")
- extData - Any extra data that was specified for this resource in the ResourceCollection.
This can be ignored in many circumstances, unless an object implementing this
interface is expecting certain extra data during a request, or needs the extra
data to distinguish whether to resolver a particular resource or not.
- Returns:
- The requested resource, or
null if the resource could not be found
searchPath
public static String searchPath(String path,
String filename)
- Utility method to search a path for a file.
- Parameters:
- path - The pathSeparator-separated path to search.
- filename - The relative filename to search for within the supplied
PATH
- Returns:
- The full path to the file
All Packages Class Hierarchy This Package Previous Next Index