org.jboss.shrinkwrap.api.container
Interface ResourceContainer<T extends Archive<T>>

All Known Subinterfaces:
ClassContainer<T>, EnterpriseArchive, JavaArchive, ResourceAdapterArchive, ServiceProviderContainer<T>, WebArchive

public interface ResourceContainer<T extends Archive<T>>

Defines the contract for a component capable of storing a series of ClassLoader, File, and URL-based Assets as resources within an archive.

The actual path to the Resources within the Archive is up to the implementations/specifications.

Version:
$Revision: $
Author:
ALR, Aslak Knutsen

Method Summary
 T addAsResource(Asset resource, ArchivePath target)
          Adds the Asset as a resource to the container, returning the container itself.
 T addAsResource(Asset resource, String target)
          Adds the Asset as a resource to the container, returning the container itself.
 T addAsResource(File resource)
          Adds the File as a resource to the container, returning the container itself.
 T addAsResource(File resource, ArchivePath target)
          Adds the File as a resource to the container, returning the container itself.
 T addAsResource(File resource, String target)
          Adds the File as a resource to the container, returning the container itself.
 T addAsResource(Package resourcePackage, String resourceName)
          Adds the resource as a resource to the container, returning the container itself.
 T addAsResource(Package resourcePackage, String resourceName, ArchivePath target)
          Adds the resource as a resource to a specific path inside the container, returning the container itself.
 T addAsResource(Package resourcePackage, String resourceName, String target)
          Adds the resource as a resource to a specific path inside the container, returning the container itself.
 T addAsResource(String resourceName)
          Adds the resource as a resource to the container, returning the container itself.
 T addAsResource(String resourceName, ArchivePath target)
          Adds the resource with the specified name to the container, returning the container itself.
 T addAsResource(String resourceName, ArchivePath target, ClassLoader classLoader)
          Adds the resource as a resource to the container, returning the container itself.
 T addAsResource(String resourceName, String target)
          Adds the resource as a resource to the container, returning the container itself.
 T addAsResource(URL resource, ArchivePath target)
          Adds the URL as a resource to the container, returning the container itself.
 T addAsResource(URL resource, String target)
          Adds the URL as a resource to the container, returning the container itself.
 T addAsResources(Package resourcePackage, String... resourceNames)
          Adds the resources inside the package as multiple resources to the container, returning the container itself.
 

Method Detail

addAsResource

T addAsResource(String resourceName)
                                   throws IllegalArgumentException
Adds the resource as a resource to the container, returning the container itself.
The resource will be placed into the Container Resource path under the same context from which it was retrieved.

The ClassLoader used to obtain the resource is up to the implementation.

Parameters:
resourceName - resource to add
Returns:
This virtual archive
Throws:
IllegalArgumentException - If the resourceName is null
See Also:
addAsResource(Asset, ArchivePath)

addAsResource

T addAsResource(File resource)
                                   throws IllegalArgumentException
Adds the File as a resource to the container, returning the container itself.
The File will be placed into the Container Library path under File.getName().

Parameters:
resource - File resource to add
Returns:
This virtual archive
Throws:
IllegalArgumentException - If the resource is null
See Also:
addAsResource(Asset, ArchivePath)

addAsResource

T addAsResource(String resourceName,
                String target)
                                   throws IllegalArgumentException
Adds the resource as a resource to the container, returning the container itself.

The ClassLoader used to obtain the resource is up to the implementation.

Parameters:
resourceName - resource to add
target - The target path within the archive in which to add the resource, relative to the Archives resource path.
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resourceName is null
IllegalArgumentException - if target is null
See Also:
addAsResource(Asset, ArchivePath)

addAsResource

T addAsResource(File resource,
                String target)
                                   throws IllegalArgumentException
Adds the File as a resource to the container, returning the container itself.

Parameters:
resource - File resource to add
target - The target path within the archive in which to add the resource, relative to the Archives resource path.
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resource is null
IllegalArgumentException - if target is null
See Also:
addAsResource(Asset, ArchivePath)

addAsResource

T addAsResource(URL resource,
                String target)
                                   throws IllegalArgumentException
Adds the URL as a resource to the container, returning the container itself.

Parameters:
resource - URL resource to add
target - The target path within the archive in which to add the resource, relative to the Archives resource path.
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resource is null
IllegalArgumentException - if target is null
See Also:
addAsResource(Asset, ArchivePath)

addAsResource

T addAsResource(Asset resource,
                String target)
                                   throws IllegalArgumentException
Adds the Asset as a resource to the container, returning the container itself.

Parameters:
resource - Asset resource to add
target - The target path within the archive in which to add the resource, relative to the Archives resource path.
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resource is null
IllegalArgumentException - if target is null
See Also:
addAsResource(Asset, ArchivePath)

addAsResource

T addAsResource(String resourceName,
                ArchivePath target)
                                   throws IllegalArgumentException
Adds the resource with the specified name to the container, returning the container itself.

The ClassLoader used to obtain the resource is up to the implementation.

Parameters:
target - The target within the archive into which we'll place the resource
resourceName - Name of the ClassLoader resource to add
Returns:
This virtual archive
Throws:
IllegalArgumentException - If the target is null
IllegalArgumentException - If the resourceName is null

addAsResource

T addAsResource(String resourceName,
                ArchivePath target,
                ClassLoader classLoader)
                                   throws IllegalArgumentException
Adds the resource as a resource to the container, returning the container itself.

The ClassLoader used to obtain the resource is up to the implementation.

Parameters:
resourceName - resource to add
target - The target path within the archive in which to add the resource, relative to the Archives resource path.
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resourceName is null
IllegalArgumentException - if target is null
See Also:
addAsResource(Asset, ArchivePath)

addAsResource

T addAsResource(File resource,
                ArchivePath target)
                                   throws IllegalArgumentException
Adds the File as a resource to the container, returning the container itself.

Parameters:
resource - File resource to add
target - The target path within the archive in which to add the resource, relative to the Archives resource path.
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resource is null
IllegalArgumentException - if target is null
See Also:
addAsResource(Asset, ArchivePath)

addAsResource

T addAsResource(URL resource,
                ArchivePath target)
                                   throws IllegalArgumentException
Adds the URL as a resource to the container, returning the container itself.

Parameters:
resource - URL resource to add
target - The target path within the archive in which to add the resource, relative to the Archives resource path.
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resource is null
IllegalArgumentException - if target is null
See Also:
addAsResource(Asset, ArchivePath)

addAsResource

T addAsResource(Asset resource,
                ArchivePath target)
                                   throws IllegalArgumentException
Adds the Asset as a resource to the container, returning the container itself.

Parameters:
resource - Asset resource to add
target - The target path within the archive in which to add the resource, relative to the Archives resource path.
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resource is null
IllegalArgumentException - if target is null

addAsResources

T addAsResources(Package resourcePackage,
                 String... resourceNames)
                                    throws IllegalArgumentException
Adds the resources inside the package as multiple resources to the container, returning the container itself.

The ClassLoader used to obtain the resource is up to the implementation.

Parameters:
resourcePackage - The package of the resources
resourceNames - The names of the resources inside resoucePackage
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resourcePackage is null
IllegalArgumentException - if no resourceNames are specified or containing null

addAsResource

T addAsResource(Package resourcePackage,
                String resourceName)
                                   throws IllegalArgumentException
Adds the resource as a resource to the container, returning the container itself.

The ClassLoader used to obtain the resource is up to the implementation.

Parameters:
resourcePackage - The package of the resource
resourceName - The name of the resource inside resoucePackage
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resourcePackage is null
IllegalArgumentException - if resourceName is null

addAsResource

T addAsResource(Package resourcePackage,
                String resourceName,
                String target)
                                   throws IllegalArgumentException
Adds the resource as a resource to a specific path inside the container, returning the container itself.

The ClassLoader used to obtain the resource is up to the implementation.

Parameters:
resourcePackage - The package of the resource
resourceName - The name of the resource inside resoucePackage
target - The target location inside the container
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resourcePackage is null
IllegalArgumentException - if resourceName is null
IllegalArgumentException - if target is null

addAsResource

T addAsResource(Package resourcePackage,
                String resourceName,
                ArchivePath target)
                                   throws IllegalArgumentException
Adds the resource as a resource to a specific path inside the container, returning the container itself.

The ClassLoader used to obtain the resource is up to the implementation.

Parameters:
resourcePackage - The package of the resource
resourceName - The name of the resource inside resoucePackage
target - The target location inside the container
Returns:
This virtual archive
Throws:
IllegalArgumentException - if resourcePackage is null
IllegalArgumentException - if resourceName is null
IllegalArgumentException - if target is null


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.