Package org.jboss.modules
Class FileResourceLoader
java.lang.Object
org.jboss.modules.AbstractResourceLoader
org.jboss.modules.NativeLibraryResourceLoader
org.jboss.modules.FileResourceLoader
- All Implemented Interfaces:
AutoCloseable,IterableResourceLoader,ResourceLoader
final class FileResourceLoader
extends NativeLibraryResourceLoader
implements IterableResourceLoader
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.jboss.modules.NativeLibraryResourceLoader
NativeLibraryResourceLoader.Identification -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CodeSourceprivate final AccessControlContextprivate final Manifestprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionFileResourceLoader(String rootName, File root, AccessControlContext context) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbuildIndex(List<String> index, File root, String pathBase) private ClassSpecdoGetClassSpec(String fileName) getClassSpec(String fileName) Get the class specification for the given class name.Get the base location of the resources in this loader (if any).getPackageSpec(String name) Get the package specification for the given directory name.getPaths()Get the collection of resource paths.getResource(String name) Get a resource with the given name.Get the name of the root represented by this resource loader.iterateResources(String startPath, boolean recursive) Enumerate all the resources under the given path.private static ManifestreadManifestFile(File manifestFile) Methods inherited from class org.jboss.modules.NativeLibraryResourceLoader
getArchName, getLibrary, getRootMethods inherited from class org.jboss.modules.AbstractResourceLoader
getPackageSpecMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.modules.ResourceLoader
close, getLibrary
-
Field Details
-
rootName
-
manifest
-
codeSource
-
context
-
-
Constructor Details
-
FileResourceLoader
FileResourceLoader(String rootName, File root, AccessControlContext context)
-
-
Method Details
-
readManifestFile
-
getRootName
Description copied from interface:ResourceLoaderGet the name of the root represented by this resource loader.- Specified by:
getRootNamein interfaceResourceLoader- Overrides:
getRootNamein classAbstractResourceLoader- Returns:
- the name of the root
-
getClassSpec
Description copied from interface:ResourceLoaderGet the class specification for the given class name. If no matching class is found,nullis returned.- Specified by:
getClassSpecin interfaceResourceLoader- Overrides:
getClassSpecin classAbstractResourceLoader- Parameters:
fileName- the fileName of the class, e.g. for the classorg.jboss.modules.ResourceLoaderthe fileName will beorg/jboss/modules/ResourceLoader.class- Returns:
- the class specification, or
nullif the named class is not found - Throws:
IOException- if an I/O error occurs
-
doGetClassSpec
- Throws:
IOException
-
getPackageSpec
Description copied from interface:ResourceLoaderGet the package specification for the given directory name. Always returns a package specification; this method cannot be used to test for the existence of a package. A package spec should always be acquired from the same resource loader which provided the class specification. The directory name will always be specified using "/" separators.- Specified by:
getPackageSpecin interfaceResourceLoader- Overrides:
getPackageSpecin classAbstractResourceLoader- Parameters:
name- the directory name- Returns:
- the package specification
- Throws:
IOException- if an I/O error occurs
-
getResource
Description copied from interface:ResourceLoaderGet a resource with the given name. If no such resource is available,nullis returned. The resource name will always be specified using "/" separators for the directory segments.- Specified by:
getResourcein interfaceResourceLoader- Overrides:
getResourcein classAbstractResourceLoader- Parameters:
name- the resource name- Returns:
- the resource, or
nullif it is not available
-
iterateResources
Description copied from interface:IterableResourceLoaderEnumerate all the resources under the given path. The given path name is relative to the root of the resource loader. If the path "escapes" the root via.., such segments will be consumed. If the path is absolute, it will be converted to a relative path by dropping the leading/.- Specified by:
iterateResourcesin interfaceIterableResourceLoader- Parameters:
startPath- the path to search underrecursive-trueto recursively descend into subdirectories,falseto only read this path- Returns:
- the resource iterator (possibly empty)
-
getPaths
Description copied from interface:ResourceLoaderGet the collection of resource paths. Called one time only when the resource loader is initialized. The paths should use "/" characters to separate the path segments.- Specified by:
getPathsin interfaceResourceLoader- Overrides:
getPathsin classAbstractResourceLoader- Returns:
- the resource paths
-
getLocation
Description copied from interface:ResourceLoaderGet the base location of the resources in this loader (if any). If the location is not known, or the resource loader does not support locations, or the resource loader does not support this method,nullis returned.- Specified by:
getLocationin interfaceResourceLoader- Overrides:
getLocationin classNativeLibraryResourceLoader- Returns:
- the base location of the resources in this loader, or
nullif not available
-
buildIndex
-