Package org.jboss.modules
Class AbstractResourceLoader
- java.lang.Object
-
- org.jboss.modules.AbstractResourceLoader
-
- All Implemented Interfaces:
java.lang.AutoCloseable,ResourceLoader
- Direct Known Subclasses:
JarFileResourceLoader,NativeLibraryResourceLoader
public abstract class AbstractResourceLoader extends java.lang.Object implements ResourceLoader
An abstract resource loader implementation.
-
-
Constructor Summary
Constructors Constructor Description AbstractResourceLoader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassSpecgetClassSpec(java.lang.String fileName)Get the class specification for the given class name.private static java.lang.StringgetDefinedAttribute(java.util.jar.Attributes.Name name, java.util.jar.Attributes entryAttribute, java.util.jar.Attributes mainAttribute)java.lang.StringgetLibrary(java.lang.String name)Get the absolute physical filesystem path for a library with the given name.PackageSpecgetPackageSpec(java.lang.String name)Get the package specification for the given directory name.protected static PackageSpecgetPackageSpec(java.lang.String name, java.util.jar.Manifest manifest, java.net.URL rootUrl)Convenience method to get a package specification from aManifest.java.util.Collection<java.lang.String>getPaths()Get the collection of resource paths.ResourcegetResource(java.lang.String name)Get a resource with the given name.java.lang.StringgetRootName()Get the name of the root represented by this resource loader.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.modules.ResourceLoader
close, getLocation
-
-
-
-
Method Detail
-
getDefinedAttribute
private static java.lang.String getDefinedAttribute(java.util.jar.Attributes.Name name, java.util.jar.Attributes entryAttribute, java.util.jar.Attributes mainAttribute)
-
getPackageSpec
protected static PackageSpec getPackageSpec(java.lang.String name, java.util.jar.Manifest manifest, java.net.URL rootUrl)
Convenience method to get a package specification from aManifest.- Parameters:
name- the (dot-separated) package namemanifest- theManifestinstancerootUrl- the code source URL- Returns:
- the package specification
-
getRootName
public java.lang.String getRootName()
Description copied from interface:ResourceLoaderGet the name of the root represented by this resource loader.- Specified by:
getRootNamein interfaceResourceLoader- Returns:
- the name of the root
-
getClassSpec
public ClassSpec getClassSpec(java.lang.String fileName) throws java.io.IOException
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- 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:
java.io.IOException- if an I/O error occurs
-
getPackageSpec
public PackageSpec getPackageSpec(java.lang.String name) throws java.io.IOException
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- Parameters:
name- the directory name- Returns:
- the package specification
- Throws:
java.io.IOException- if an I/O error occurs
-
getResource
public Resource getResource(java.lang.String name)
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- Parameters:
name- the resource name- Returns:
- the resource, or
nullif it is not available
-
getLibrary
public java.lang.String getLibrary(java.lang.String name)
Description copied from interface:ResourceLoaderGet the absolute physical filesystem path for a library with the given name. The resultant path should be path-separated using "/" characters.- Specified by:
getLibraryin interfaceResourceLoader- Parameters:
name- the name- Returns:
- the path or
nullif the library is not present
-
getPaths
public java.util.Collection<java.lang.String> 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- Returns:
- the resource paths
-
-