Interface ResourceContainer<T extends Archive<T>>
- All Known Subinterfaces:
ClassContainer<T>, EnterpriseArchive, JavaArchive, ResourceAdapterArchive, ServiceProviderContainer<T>, WebArchive
- All Known Implementing Classes:
ContainerBase, EnterpriseArchiveImpl, EnterpriseContainerBase, GenericArchiveImpl, JavaArchiveImpl, ResourceAdapterArchiveImpl, ResourceAdapterContainerBase, WebArchiveImpl, WebContainerBase
public interface ResourceContainer<T extends Archive<T>>
Defines the contract for a component capable of storing a series of
The actual path to the Resources within the
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: $
-
Method Summary
Modifier and TypeMethodDescriptionaddAsResource(File resource) Adds theFileas a resource to the container, returning the container itself.addAsResource(File resource, String target) Adds theFileas a resource to the container, returning the container itself.addAsResource(File resource, ArchivePath target) Adds theFileas a resource to the container, returning the container itself.addAsResource(Package resourcePackage, String resourceName) Adds the resource as a resource to the container, returning the container itself.addAsResource(Package resourcePackage, String resourceName, String target) Adds the resource as a resource to a specific path inside the container, returning the container itself.addAsResource(Package resourcePackage, String resourceName, ArchivePath target) Adds the resource as a resource to a specific path inside the container, returning the container itself.addAsResource(String resourceName) Adds the resource as a resource to the container, returning the container itself.addAsResource(String resourceName, String target) Adds the resource as a resource to the container, returning the container itself.addAsResource(String resourceName, ArchivePath target) Adds the resource with the specified name to the container, returning the container itself.addAsResource(String resourceName, ArchivePath target, ClassLoader classLoader) Adds the resource as a resource to the container, returning the container itself.addAsResource(URL resource, String target) Adds theURLas a resource to the container, returning the container itself.addAsResource(URL resource, ArchivePath target) Adds theURLas a resource to the container, returning the container itself.addAsResource(Asset resource, String target) Adds theAssetas a resource to the container, returning the container itself.addAsResource(Asset resource, ArchivePath target) Adds theAssetas a resource to the container, returning the container itself.addAsResources(Package resourcePackage, String... resourceNames) Adds the resources inside the package as multiple resources to the container, returning the container itself.
-
Method Details
-
addAsResource
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.
TheClassLoaderused 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
Adds theFileas a resource to the container, returning the container itself.
TheFilewill be placed into the Container Library path underFile.getName().- Parameters:
resource-Fileresource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- If the resource is null- See Also:
-
addAsResource
Adds the resource as a resource to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Parameters:
resourceName- resource to addtarget- The target path within the archive in which to add the resource, relative to theArchives resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resourceName is nullIllegalArgumentException- if target is null- See Also:
-
addAsResource
Adds theFileas a resource to the container, returning the container itself.- Parameters:
resource-Fileresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resource is nullIllegalArgumentException- if target is null- See Also:
-
addAsResource
Adds theURLas a resource to the container, returning the container itself.- Parameters:
resource-URLresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resource is nullIllegalArgumentException- if target is null- See Also:
-
addAsResource
Adds theAssetas a resource to the container, returning the container itself.- Parameters:
resource-Assetresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resource is nullIllegalArgumentException- if target is null- See Also:
-
addAsResource
Adds the resource with the specified name to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Parameters:
resourceName- Name of theClassLoaderresource to addtarget- The target within the archive into which we'll place the resource- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- If the target is nullIllegalArgumentException- 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.
TheClassLoaderused to obtain the resource is up to the implementation.- Parameters:
resourceName- resource to addtarget- The target path within the archive in which to add the resource, relative to theArchives resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resourceName is nullIllegalArgumentException- if target is null- See Also:
-
addAsResource
Adds theFileas a resource to the container, returning the container itself.- Parameters:
resource-Fileresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resource is nullIllegalArgumentException- if target is null- See Also:
-
addAsResource
Adds theURLas a resource to the container, returning the container itself.- Parameters:
resource-URLresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resource is nullIllegalArgumentException- if target is null- See Also:
-
addAsResource
Adds theAssetas a resource to the container, returning the container itself.- Parameters:
resource-Assetresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resource is nullIllegalArgumentException- if target is null
-
addAsResources
Adds the resources inside the package as multiple resources to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Parameters:
resourcePackage- The package of the resourcesresourceNames- The names of the resources inside resoucePackage- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resourcePackage is nullIllegalArgumentException- if no resourceNames are specified or containing null
-
addAsResource
Adds the resource as a resource to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Parameters:
resourcePackage- The package of the resourceresourceName- The name of the resource inside resoucePackage- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resourcePackage is nullIllegalArgumentException- 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.
TheClassLoaderused to obtain the resource is up to the implementation.- Parameters:
resourcePackage- The package of the resourceresourceName- The name of the resource inside resoucePackagetarget- The target location inside the container- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resourcePackage is nullIllegalArgumentException- if resourceName is nullIllegalArgumentException- 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.
TheClassLoaderused to obtain the resource is up to the implementation.- Parameters:
resourcePackage- The package of the resourceresourceName- The name of the resource inside resoucePackagetarget- The target location inside the container- Returns:
- This virtual archive
- Throws:
IllegalArgumentException- if resourcePackage is nullIllegalArgumentException- if resourceName is nullIllegalArgumentException- if target is null
-