Top Description Constructors Methods
org.jboss.modules

public abstract Class AbstractResourceLoader

extends Object
implements ResourceLoader
Class Inheritance
All Implemented Interfaces
org.jboss.modules.ResourceLoader, java.lang.AutoCloseable
Known Direct Subclasses
org.jboss.modules.NativeLibraryResourceLoader, org.jboss.modules.PathResourceLoader, org.jboss.modules.JarFileResourceLoader, org.jboss.modules.ServiceResourceLoader
Imports
java.io.IOException, java.net.URL, java.util.Collection, .Collections, java.util.jar.Attributes, .Manifest

An abstract resource loader implementation.
Authors
Carlo de Wolf, Richard Opalka

Constructor Summary

AccessConstructor and Description
protected
AbstractResourceLoader()

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public ClassSpec
getClassSpec(final String
the fileName of the class, e.g. for the class org.jboss.modules.ResourceLoader the fileName will be org/jboss/modules/ResourceLoader.class
fileName
)

Implements org.jboss.modules.ResourceLoader.getClassSpec.

Get the class specification for the given class name.
private static String
getDefinedAttribute(Attributes.Name name, Attributes entryAttribute, Attributes mainAttribute)

public String
getLibrary(final String
the name
name
)

Implements org.jboss.modules.ResourceLoader.getLibrary.

Get the absolute physical filesystem path for a library with the given name.
protected static PackageSpec

Returns:

the package specification
getPackageSpec
(final String
the (dot-separated) package name
name
,
final Manifest
the Manifest instance
manifest
,
final URL
the code source URL
rootUrl
)

Convenience method to get a package specification from a Manifest.

public PackageSpec
getPackageSpec(final String
the directory name
name
)

Implements org.jboss.modules.ResourceLoader.getPackageSpec.

Get the package specification for the given directory name.
public Collection<String>
getPaths()

Implements org.jboss.modules.ResourceLoader.getPaths.

Get the collection of resource paths.
public Resource
getResource(final String
the resource name
name
)

Implements org.jboss.modules.ResourceLoader.getResource.

Get a resource with the given name.
public String
getRootName()

Overrides default org.jboss.modules.ResourceLoader.getRootName.

Get the name of the root represented by this resource loader.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractResourceLoaderback to summary
protected AbstractResourceLoader()

Construct a new instance.

Method Detail

getClassSpecback to summary
public ClassSpec getClassSpec(final String fileName) throws IOException

Implements org.jboss.modules.ResourceLoader.getClassSpec.

Doc from org.jboss.modules.ResourceLoader.getClassSpec.

Get the class specification for the given class name. If no matching class is found, null is returned.

Parameters
fileName:String

the fileName of the class, e.g. for the class org.jboss.modules.ResourceLoader the fileName will be org/jboss/modules/ResourceLoader.class

Returns:ClassSpec

the class specification, or null if the named class is not found

Exceptions
IOException:
if an I/O error occurs
getDefinedAttributeback to summary
private static String getDefinedAttribute(Attributes.Name name, Attributes entryAttribute, Attributes mainAttribute)
getLibraryback to summary
public String getLibrary(final String name)

Implements org.jboss.modules.ResourceLoader.getLibrary.

Doc from org.jboss.modules.ResourceLoader.getLibrary.

Get the absolute physical filesystem path for a library with the given name. The resultant path should be path-separated using "/" characters.

Parameters
name:String

the name

Returns:String

the path or null if the library is not present

getPackageSpecback to summary
protected static PackageSpec getPackageSpec(final String name, final Manifest manifest, final URL rootUrl)

Convenience method to get a package specification from a Manifest.

Parameters
name:String

the (dot-separated) package name

manifest:Manifest

the Manifest instance

rootUrl:URL

the code source URL

Returns:PackageSpec

the package specification

getPackageSpecback to summary
public PackageSpec getPackageSpec(final String name) throws IOException

Implements org.jboss.modules.ResourceLoader.getPackageSpec.

Doc from org.jboss.modules.ResourceLoader.getPackageSpec.

Get 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.

Parameters
name:String

the directory name

Returns:PackageSpec

the package specification

Exceptions
IOException:
if an I/O error occurs
getPathsback to summary
public Collection<String> getPaths()

Implements org.jboss.modules.ResourceLoader.getPaths.

Doc from org.jboss.modules.ResourceLoader.getPaths.

Get 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.

Returns:Collection<String>

the resource paths

getResourceback to summary
public Resource getResource(final String name)

Implements org.jboss.modules.ResourceLoader.getResource.

Doc from org.jboss.modules.ResourceLoader.getResource.

Get a resource with the given name. If no such resource is available, null is returned. The resource name will always be specified using "/" separators for the directory segments.

Parameters
name:String

the resource name

Returns:Resource

the resource, or null if it is not available

getRootNameback to summary
public String getRootName()

Overrides default org.jboss.modules.ResourceLoader.getRootName.

Doc from org.jboss.modules.ResourceLoader.getRootName.

Get the name of the root represented by this resource loader.

Returns:String

the name of the root