Top Description Methods
org.jboss.modules

public Interface ResourceLoader

extends AutoCloseable
Known Direct Subinterfaces
org.jboss.modules.IterableResourceLoader
Known Direct Implementers
org.jboss.modules.AbstractResourceLoader, org.jboss.modules.FilteredResourceLoader
Imports
java.io.IOException, java.net.URI, java.util.Collection

A loader for resources from a specific resource root within a module.
Authors
David M. Lloyd, Richard Opalka

Method Summary

Modifier and TypeMethod and Description
public default void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.
public default ResourceLoader

Returns:

the resource loader, or null if subloaders are not supported
createSubloader
(String
the relative path
relativePath
,
String
the name of the subloader's root
rootName
)

Create a loader which loads resources under a relative subdirectory relative to this loader.

public ClassSpec

Returns:

the class specification, or null if the named class is not found
getClassSpec
(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
)

Get the class specification for the given class name.

public String

Returns:

the path or null if the library is not present
getLibrary
(String
the name
name
)

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

public default URI

Returns:

the base location of the resources in this loader, or null if not available
getLocation
()

Get the base location of the resources in this loader (if any).

public PackageSpec

Returns:

the package specification
getPackageSpec
(String
the directory name
name
)

Get the package specification for the given directory name.

public Collection<String>

Returns:

the resource paths
getPaths
()

Get the collection of resource paths.

public Resource

Returns:

the resource, or null if it is not available
getResource
(String
the resource name
name
)

Get a resource with the given name.

public default String

Returns:

the name of the root
getRootName
()

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

Method Detail

closeback to summary
public default void close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

createSubloaderback to summary
public default ResourceLoader createSubloader(String relativePath, String rootName)

Create a loader which loads resources under a relative subdirectory relative to this loader. If the resource loader does not support subloaders, null is returned.

Parameters
relativePath:String

the relative path

rootName:String

the name of the subloader's root

Returns:ResourceLoader

the resource loader, or null if subloaders are not supported

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

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
getLibraryback to summary
public String getLibrary(String name)

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

getLocationback to summary
public default URI getLocation()

Get 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, null is returned.

Returns:URI

the base location of the resources in this loader, or null if not available

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

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()

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(String name)

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 default String getRootName()

Deprecated

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

Returns:String

the name of the root

Annotations
@Deprecated