Class ContainerBase<T extends Archive<T>>
java.lang.Object
org.jboss.shrinkwrap.impl.base.AssignableBase<Archive<?>>
org.jboss.shrinkwrap.impl.base.container.ContainerBase<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
Archive<T>
,Assignable
,ClassContainer<T>
,LibraryContainer<T>
,ManifestContainer<T>
,ResourceContainer<T>
,ServiceProviderContainer<T>
,ArchiveFormatAssociable
- Direct Known Subclasses:
EnterpriseContainerBase
,GenericArchiveImpl
,JavaArchiveImpl
,ResourceAdapterContainerBase
,WebContainerBase
public abstract class ContainerBase<T extends Archive<T>>
extends AssignableBase<Archive<?>>
implements Archive<T>, ManifestContainer<T>, ServiceProviderContainer<T>, ResourceContainer<T>, ClassContainer<T>, LibraryContainer<T>, ArchiveFormatAssociable
ContainerBase
Abstract class that helps implement the Archive, ManifestContainer, ResourceContainer, ClassContainer and
LibraryContainer.
- Version:
- $Revision: $
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionThe exposed archive type.private static final String
private static final String
Fields inherited from interface org.jboss.shrinkwrap.api.container.ManifestContainer
DEFAULT_MANIFEST_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(Archive<?> archive, String path, Class<? extends StreamExporter> exporter) Add an archive under a specific context and maintain the archive name as context path.add
(Archive<?> archive, ArchivePath path, Class<? extends StreamExporter> exporter) Add an archive under a specific context and maintain the archive name as context path.Adds the specified resource under the context denoted by the specified targetAdds the specified asset under the specified target (directory) using the specified name.add
(Asset asset, ArchivePath target) Adds the specified asset under the specified path into the target contextadd
(Asset asset, ArchivePath path, String name) Adds the specified asset under the specified target (directory) using the specified name.add
(NamedAsset namedAsset) Adds the asset encapsulated within the specifiedNamedAsset
under the encapsulated name and target (directory)addAsDirectories
(String... paths) Adds the specified directories.addAsDirectories
(ArchivePath... paths) Adds the specified directories.addAsDirectory
(String path) Adds the specified directory.addAsDirectory
(ArchivePath path) Adds the specified directory.addAsLibraries
(File... resources) addAsLibraries
(String... resourceNames) Add multiple resources to thisArchive
as libraries to the container, returning the container itself.addAsLibraries
(Collection<? extends Archive<?>> archives) addAsLibraries
(Archive<?>... archives) addAsLibraries
(Archive<?>[]... archives) addAsLibrary
(File resource) Adds theFile
as a library to the container, returning the container itself.addAsLibrary
(File resource, String target) Adds theFile
as a library to the container, returning the container itself.addAsLibrary
(File resource, ArchivePath target) Adds theFile
as a library to the container, returning the container itself.addAsLibrary
(String resourceName) Adds the resource as a library to the container, returning the container itself.addAsLibrary
(String resourceName, String target) Adds the resource as a library to the container, returning the container itself.addAsLibrary
(String resourceName, ArchivePath target) Adds the resource as a library to the container, returning the container itself.addAsLibrary
(URL resource, String target) Adds theURL
as a library to the container, returning the container itself.addAsLibrary
(URL resource, ArchivePath target) Adds theURL
as a library to the container, returning the container itself.addAsLibrary
(Archive<?> archive) addAsLibrary
(Asset resource, String target) Adds theAsset
as a library to the container, returning the container itself.addAsLibrary
(Asset resource, ArchivePath target) Adds theAsset
as a library to the container, returning the container itself.addAsManifestResource
(File resource) Adds theFile
as a Manifest resource to the container, returning the container itself.addAsManifestResource
(File resource, String target) Adds theFile
as a Manifest resource to the container, returning the container itself.addAsManifestResource
(File resource, ArchivePath target) Adds theFile
as a Manifest resource to the container, returning the container itself.addAsManifestResource
(Package resourcePackage, String resourceName) Adds the resource as a resource to the container, returning the container itself.addAsManifestResource
(Package resourcePackage, String resourceName, String target) Adds the resource as a resource to a specific path inside the container, returning the container itself.addAsManifestResource
(Package resourcePackage, String resourceName, ArchivePath target) Adds the resource as a resource to a specific path inside the container, returning the container itself.final T
addAsManifestResource
(String resourceName) Adds the resource as a Manifest resource to the container, returning the container itself.addAsManifestResource
(String resourceName, String target) Adds the resource as a Manifest resource to the container, returning the container itself.addAsManifestResource
(String resourceName, ArchivePath target) Adds the resource as a Manifest resource to the container, returning the container itself.addAsManifestResource
(URL resource, String target) Adds theURL
as a Manifest resource to the container, returning the container itself.addAsManifestResource
(URL resource, ArchivePath target) Adds theURL
as a Manifest resource to the container, returning the container itself.addAsManifestResource
(Asset resource, String target) Adds theAsset
as a Manifest resource to the container, returning the container itself.addAsManifestResource
(Asset resource, ArchivePath target) Adds theAsset
as a Manifest resource to the container, returning the container itself.addAsManifestResources
(Package resourcePackage, String... resourceNames) Adds the resources inside the package as multiple resources to the container, returning the container itself.final T
addAsResource
(File resource) Adds theFile
as a resource to the container, returning the container itself.addAsResource
(File resource, String target) Adds theFile
as a resource to the container, returning the container itself.addAsResource
(File resource, ArchivePath target) Adds theFile
as 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.final T
addAsResource
(String resourceName) Adds the resource as a resource to the container, returning the container itself.final T
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 theURL
as a resource to the container, returning the container itself.addAsResource
(URL resource, ArchivePath target) Adds theURL
as a resource to the container, returning the container itself.addAsResource
(Asset resource, String target) Adds theAsset
as a resource to the container, returning the container itself.addAsResource
(Asset resource, ArchivePath target) Adds theAsset
as 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.addAsServiceProvider
(Class<?> serviceInterface, Class<?>... serviceImpls) Adds a META-INF/services/ServiceInterfaceNameAsset
representing this service.addAsServiceProvider
(String serviceInterface, String... serviceImpls) Adds a META-INF/services/ServiceInterfaceNameAsset
representing this service.addAsServiceProviderAndClasses
(Class<?> serviceInterface, Class<?>... serviceImpls) Adds a META-INF/services/ServiceInterfaceNameAsset
and the classes related to the service to the archive.Adds theClass
, and all member (inner)Class
es, with the specified fully-qualified name, loaded by the Thread ContextClassLoader
, to theArchive
.addClass
(String fullyQualifiedClassName, ClassLoader cl) Adds theClass
, and all member (inner) @link{Class}es, with the specified fully-qualified name, loaded by the specifiedClassLoader
, to theArchive
.addClasses
(Class<?>... classes) addHandlers
(ArchiveEventHandler... handlers) Add an array of listeners for call back based.Adds a default generated MANIFEST.MF manifest to the current archive.private T
addNestedJarFileResource
(File resource, ArchivePath target, ArchivePath base) Adds the specifiedFile
resource (a nested JAR File form) to the current archive, returning the archive itselfprivate void
addPackage
(boolean recursive, Filter<ArchivePath> filter, ClassLoader classLoader, String packageName) addPackage
(Package pack) addPackage
(String pack) addPackages
(boolean recursive, Package... packages) addPackages
(boolean recursive, String... packages) private T
addPackages
(boolean recursive, Filter<ArchivePath> filter, ClassLoader cl, Package... packages) private T
addPackages
(boolean recursive, Filter<ArchivePath> filter, ClassLoader classLoader, String... packageNames) addPackages
(boolean recursive, Filter<ArchivePath> filter, Package... packages) addPackages
(boolean recursive, Filter<ArchivePath> filter, String... packageNames) boolean
Denotes whether this archive contains a resource at the specified pathboolean
contains
(ArchivePath path) Denotes whether this archive contains a resource at the specified pathprotected T
delete
(ArchivePath path) deleteClass
(Class<?> clazz) deleteClass
(String fullyQualifiedClassName) Deletes theClass
, and all member (inner)Class
es, with the specified fully-qualified name, loaded by the Thread ContextClassLoader
, from theArchive
.deleteClasses
(Class<?>... classes) private void
deletePackage
(boolean recursive, Filter<ArchivePath> filter, String packageName, ClassLoader classLoader) deletePackage
(Package pack) deletePackage
(String pack) deletePackages
(boolean recursive, Package... packages) deletePackages
(boolean recursive, String... packages) deletePackages
(boolean recursive, Filter<ArchivePath> filter, Package... packages) deletePackages
(boolean recursive, Filter<ArchivePath> filter, String... packages) boolean
private File
fileFromResource
(String resourceName) Gets a resource from the TCCL and returns its file path.filter
(Filter<ArchivePath> filter) Obtains all assets matching given filter in this archive as a new Archive.
This is an alias for shallowCopy(Filter).Obtains theNode
located at the specified pathget
(ArchivePath path) Obtains theNode
located at the specified pathprivate Iterable
<ClassLoader> <X extends Archive<X>>
XGet a nestedArchive
as a specific type.
The found Archives must have been added as a Archive, no import is performed.<X extends Archive<X>>
XgetAsType
(Class<X> type, String path, ArchiveFormat archiveCompression) Get a nestedArchive
as a specific type using the specifyArchiveFormat
<X extends Archive<X>>
XgetAsType
(Class<X> type, ArchivePath path) Get a nestedArchive
as a specific type.
The found Archives must have been added as a Archive, no import is performed.<X extends Archive<X>>
XgetAsType
(Class<X> type, ArchivePath path, ArchiveFormat archiveCompression) <X extends Archive<X>>
Collection<X> getAsType
(Class<X> type, Filter<ArchivePath> filter) Get all nestedArchive
matching the filter as a specific type.
The found Archives must have been added as a Archive, no import is performed.<X extends Archive<X>>
Collection<X> getAsType
(Class<X> type, Filter<ArchivePath> filter, ArchiveFormat archiveCompression) Get all nestedArchive
matching the filter as a specific type using the specifyArchiveFormat
.protected abstract ArchivePath
Should be implemented to set the path for Class related resources.Obtains all assets in this archive, along with their respective paths.getContent
(Filter<ArchivePath> filter) Obtains all assets matching given filter in this archive, along with its respective Path.getId()
Obtains a globally-unique identifier for thisArchive
private Set
<ArchivePath> getInnerClasses
(ArchivePath path) protected abstract ArchivePath
Should be implemented to set the path for Library related resources.protected abstract ArchivePath
Should be implemented to set the path for Manifest related resources.getName()
Obtains the name of this archive (ie.protected abstract ArchivePath
Should be implemented to set the path for Resource related resources.int
hashCode()
Merge the contents from an existing archive without maintaining the archive name in the context path.Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.merge
(Archive<?> source, String path, Filter<ArchivePath> filter) Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.merge
(Archive<?> source, ArchivePath path) Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.merge
(Archive<?> source, ArchivePath path, Filter<ArchivePath> filter) Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.merge
(Archive<?> source, Filter<ArchivePath> filter) Merge the contents from an existing archive without maintaining the archive name in the context path.Moves the asset under the source path to the target path.move
(ArchivePath source, ArchivePath target) Moves the asset under the source path to the target path.private String
resourceAdjustedPath
(File resource) setManifest
(File resource) Adds theFile
as MANIFEST.FM to the container, returning the container itself.setManifest
(Package resourcePackage, String resourceName) Adds the resource inside the package as a MANIFEST.MF to the container, returning the container itself.final T
setManifest
(String resourceName) Adds the resource as MANIFEST.FM to the container, returning the container itself.setManifest
(URL resource) Adds theURL
as MANIFEST.FM to the container, returning the container itself.setManifest
(Asset resource) Adds theAsset
as MANIFEST.FM to the container, returning the container itself.Creates a shallow copy of thisArchive
.shallowCopy
(Filter<ArchivePath> filter) Creates a shallow copy of thisArchive
based on given filter.Assets from this archive are made available under the same paths.toString()
Acts as a shorthand forArchive.toString(Formatter)
where theFormatters.SIMPLE
is leveraged.toString
(boolean verbose) If "true" is specified, acts as a shorthand forArchive.toString(Formatter)
where theFormatters.VERBOSE
is leveraged.void
writeTo
(OutputStream outputStream, Formatter formatter) Prints the content of thisArchive
to the specifiedOutputStream
on the format defined by the specifiedFormatter
.Methods inherited from class org.jboss.shrinkwrap.impl.base.AssignableBase
as, getArchive
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jboss.shrinkwrap.api.Assignable
as
-
Field Details
-
DEFAULT_MANIFEST
- See Also:
-
DEFAULT_PACKAGE_NAME
- See Also:
-
actualType
The exposed archive type.
-
-
Constructor Details
-
ContainerBase
-
-
Method Details
-
getArchiveFormat
- Specified by:
getArchiveFormat
in interfaceArchiveFormatAssociable
-
add
Add an archive under a specific context and maintain the archive name as context path. -
add
Add an archive under a specific context and maintain the archive name as context path. -
add
Adds the specified asset under the specified path into the target context -
add
Adds the specified asset under the specified target (directory) using the specified name. The resultant path will be treating the specified path as a prefix namespace, then appending the name. -
add
Adds the specified asset under the specified target (directory) using the specified name. The resultant path will be treating the specified path as a prefix namespace, then appending the name.- Specified by:
add
in interfaceArchive<T extends Archive<T>>
- Parameters:
asset
-target
- The context directory under which to add the assetname
- The name to assign the assent under the target namespace- Returns:
- Throws:
IllegalArgumentException
- If the target, name, or asset was not specified- See Also:
-
add
Adds the asset encapsulated within the specifiedNamedAsset
under the encapsulated name and target (directory) -
addAsDirectories
Adds the specified directories.- Specified by:
addAsDirectories
in interfaceArchive<T extends Archive<T>>
- Parameters:
paths
- The paths to add- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no paths were specified- See Also:
-
addAsDirectories
Adds the specified directories.- Specified by:
addAsDirectories
in interfaceArchive<T extends Archive<T>>
- Parameters:
paths
- The paths to add- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no paths were specified- See Also:
-
addAsDirectory
Adds the specified directory.- Specified by:
addAsDirectory
in interfaceArchive<T extends Archive<T>>
- Parameters:
path
- The path to add- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no path was specified- See Also:
-
addAsDirectory
Adds the specified directory.- Specified by:
addAsDirectory
in interfaceArchive<T extends Archive<T>>
- Parameters:
path
- The path to add- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no path was specified- See Also:
-
addHandlers
Add an array of listeners for call back based.- Specified by:
addHandlers
in interfaceArchive<T extends Archive<T>>
- Returns:
- This archive
- See Also:
-
merge
Merge the contents from an existing archive without maintaining the archive name in the context path. -
merge
Merge the contents from an existing archive without maintaining the archive name in the context path. The filter control whichArchivePath
s to include form the sourceArchive
. -
merge
Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path. -
merge
public T merge(Archive<?> source, ArchivePath path, Filter<ArchivePath> filter) throws IllegalArgumentException Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path. The filter control whichArchivePath
s to include form the sourceArchive
.- Specified by:
merge
in interfaceArchive<T extends Archive<T>>
- Parameters:
source
- Archive to add contents frompath
- Path to add contents tofilter
- Filter to use for includingAsset
s in the merge.- Returns:
- Throws:
IllegalArgumentException
- If the path or existing archive is not specified- See Also:
-
merge
public T merge(Archive<?> source, String path, Filter<ArchivePath> filter) throws IllegalArgumentException Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path. The filter control whichArchivePath
s to include form the sourceArchive
.- Specified by:
merge
in interfaceArchive<T extends Archive<T>>
- Parameters:
source
- Archive to add contents frompath
- Path to add contents tofilter
- Filter to use for includingAsset
s in the merge.- Returns:
- Throws:
IllegalArgumentException
- If the path or existing archive is not specified- See Also:
-
merge
Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path. -
move
public T move(ArchivePath source, ArchivePath target) throws IllegalArgumentException, IllegalArchivePathException Moves the asset under the source path to the target path.- Specified by:
move
in interfaceArchive<T extends Archive<T>>
- Parameters:
source
- The context under which to remove the assetstarget
- The context under which to add the moved assets- Returns:
- the resulting archive with the moved assets
- Throws:
IllegalArgumentException
- If any of the paths is not specifiedIllegalArchivePathException
- If the source path is invalid.- See Also:
-
move
public T move(String source, String target) throws IllegalArgumentException, IllegalArchivePathException Moves the asset under the source path to the target path.- Specified by:
move
in interfaceArchive<T extends Archive<T>>
- Parameters:
source
- The context under which to remove the assetstarget
- The context under which to add the moved assets- Returns:
- the resulting archive with the moved assets
- Throws:
IllegalArgumentException
- If any of the paths is not specifiedIllegalArchivePathException
- If the source path is invalid.- See Also:
-
add
Adds the specified resource under the context denoted by the specified target -
contains
Denotes whether this archive contains a resource at the specified path -
contains
Denotes whether this archive contains a resource at the specified path -
delete
Removes theNode
in theArchive
at the specifiedArchivePath
. If the path is a directory, recursively removes all contents. If the path does not exist, return null. -
delete
Removes theNode
in theArchive
at theArchivePath
indicated by the specified String archivePath. If the path is a directory, recursively removes all contents. If the path does not exist, return null. -
get
Obtains theNode
located at the specified path -
get
Obtains theNode
located at the specified path -
getAsType
Get a nestedArchive
as a specific type.
The found Archives must have been added as a Archive, no import is performed. -
getAsType
Get a nestedArchive
as a specific type.
The found Archives must have been added as a Archive, no import is performed. -
getAsType
Get all nestedArchive
matching the filter as a specific type.
The found Archives must have been added as a Archive, no import is performed.- Specified by:
getAsType
in interfaceArchive<T extends Archive<T>>
- Type Parameters:
X
-- Parameters:
type
- The Type to return the Archive asfilter
- Filter to match result- Returns:
- A
Collection
of found Archives matching given filter or emptyCollection
if non found. - See Also:
-
getAsType
public <X extends Archive<X>> X getAsType(Class<X> type, String path, ArchiveFormat archiveCompression) Get a nestedArchive
as a specific type using the specifyArchiveFormat
-
getAsType
public <X extends Archive<X>> X getAsType(Class<X> type, ArchivePath path, ArchiveFormat archiveCompression) -
getAsType
public <X extends Archive<X>> Collection<X> getAsType(Class<X> type, Filter<ArchivePath> filter, ArchiveFormat archiveCompression) Get all nestedArchive
matching the filter as a specific type using the specifyArchiveFormat
.- Specified by:
getAsType
in interfaceArchive<T extends Archive<T>>
- Type Parameters:
X
-- Parameters:
type
- The Type to return the Archive asfilter
- Filter to match resultarchiveCompression
- The archive format- Returns:
- A
Collection
of found Archives matching given filter or emptyCollection
if non found. - See Also:
-
filter
Obtains all assets matching given filter in this archive as a new Archive.
This is an alias for shallowCopy(Filter). -
getContent
Obtains all assets in this archive, along with their respective paths. The returned Map will be an immutable view.- Specified by:
getContent
in interfaceArchive<T extends Archive<T>>
- Returns:
- See Also:
-
getContent
Obtains all assets matching given filter in this archive, along with its respective Path. The returned Map will be an immutable view.- Specified by:
getContent
in interfaceArchive<T extends Archive<T>>
- Returns:
- See Also:
-
getName
Obtains the name of this archive (ie. myLibrary.jar) -
getId
Obtains a globally-unique identifier for thisArchive
-
shallowCopy
Creates a shallow copy of thisArchive
. Assets from this archive are made available under the same paths. However, removing old assets or adding new assets on this archive affects does not affect the new archive.- Specified by:
shallowCopy
in interfaceArchive<T extends Archive<T>>
- Returns:
- a new archive with a copy of the pointers to the assets
- See Also:
-
shallowCopy
Creates a shallow copy of thisArchive
based on given filter.Assets from this archive are made available under the same paths. However, removing old assets or adding new assets on this archive affects does not affect the new archive.- Specified by:
shallowCopy
in interfaceArchive<T extends Archive<T>>
- Returns:
- a new archive with a copy of the pointers to the assets
- See Also:
-
toString
Acts as a shorthand forArchive.toString(Formatter)
where theFormatters.SIMPLE
is leveraged. -
toString
If "true" is specified, acts as a shorthand forArchive.toString(Formatter)
where theFormatters.VERBOSE
is leveraged. Otherwise theFormatters.SIMPLE
will be used (equivalent toArchive.toString()
). -
toString
Returns a view of thisArchive
as returned from the specifiedFormatter
. Common options may be to use the predefined formatters located inFormatters
-
hashCode
public int hashCode() -
equals
-
getManifestPath
Should be implemented to set the path for Manifest related resources.- Returns:
- Base Path for the ManifestContainer resources
-
setManifest
Adds the resource as MANIFEST.FM to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
setManifest
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to add- Returns:
- This virtual archive
- See Also:
-
setManifest
Adds theFile
as MANIFEST.FM to the container, returning the container itself.- Specified by:
setManifest
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is null- See Also:
-
setManifest
Adds theURL
as MANIFEST.FM to the container, returning the container itself.- Specified by:
setManifest
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
-URL
resource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is null- See Also:
-
setManifest
Adds theAsset
as MANIFEST.FM to the container, returning the container itself.- Specified by:
setManifest
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is null- See Also:
-
setManifest
Adds the resource inside the package as a MANIFEST.MF to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
setManifest
in interfaceManifestContainer<T extends Archive<T>>
- 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- See Also:
-
addAsManifestResource
Adds the resource as a Manifest resource to the container, returning the container itself.
The resource will be placed into the Container Manifest path under the same context from which it was retrieved.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to add- Returns:
- This virtual archive
- See Also:
-
addAsManifestResource
Adds theFile
as a Manifest resource to the container, returning the container itself.
TheFile
will be placed into the Container Manifest path underFile.getName()
.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
- resource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- ifFile
resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsManifestResource
Adds the resource as a Manifest resource to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s manifest path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resourceName is nullIllegalArgumentException
- if target is null- See Also:
-
addAsManifestResource
Adds theFile
as a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s manifest path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsManifestResource
Description copied from interface:ManifestContainer
Adds theURL
as a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
-URL
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s manifest path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsManifestResource
Description copied from interface:ManifestContainer
Adds theAsset
as a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
-Asset
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s manifest path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsManifestResource
public T addAsManifestResource(String resourceName, ArchivePath target) throws IllegalArgumentException Description copied from interface:ManifestContainer
Adds the resource as a Manifest resource to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s manifest path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resourceName is nullIllegalArgumentException
- if target is null- See Also:
-
addNestedJarFileResource
private T addNestedJarFileResource(File resource, ArchivePath target, ArchivePath base) throws IllegalArgumentException Adds the specifiedFile
resource (a nested JAR File form) to the current archive, returning the archive itself- Parameters:
resource
-target
-- Returns:
- Throws:
IllegalArgumentException
-
resourceAdjustedPath
-
addAsManifestResource
Description copied from interface:ManifestContainer
Adds theFile
as a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s manifest path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsManifestResource
Description copied from interface:ManifestContainer
Adds theURL
as a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
-URL
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s manifest path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsManifestResource
Description copied from interface:ManifestContainer
Adds theAsset
as a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
resource
-Asset
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s manifest path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null
-
addAsManifestResources
public T addAsManifestResources(Package resourcePackage, String... resourceNames) throws IllegalArgumentException Description copied from interface:ManifestContainer
Adds the resources inside the package as multiple resources to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsManifestResources
in interfaceManifestContainer<T extends Archive<T>>
- 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
-
addAsManifestResource
public T addAsManifestResource(Package resourcePackage, String resourceName) throws IllegalArgumentException Description copied from interface:ManifestContainer
Adds the resource as a resource to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- 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
-
addAsManifestResource
public T addAsManifestResource(Package resourcePackage, String resourceName, String target) throws IllegalArgumentException Description copied from interface:ManifestContainer
Adds the resource as a resource to a specific path inside the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- 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
-
addAsManifestResource
public T addAsManifestResource(Package resourcePackage, String resourceName, ArchivePath target) throws IllegalArgumentException Description copied from interface:ManifestContainer
Adds the resource as a resource to a specific path inside the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsManifestResource
in interfaceManifestContainer<T extends Archive<T>>
- 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
-
addManifest
Adds a default generated MANIFEST.MF manifest to the current archive.- Specified by:
addManifest
in interfaceManifestContainer<T extends Archive<T>>
- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if serviceInterface is null
-
addAsServiceProvider
public T addAsServiceProvider(Class<?> serviceInterface, Class<?>... serviceImpls) throws IllegalArgumentException Description copied from interface:ManifestContainer
Adds a META-INF/services/ServiceInterfaceNameAsset
representing this service. Warning: this method does not add the specified classes to the archive.- Specified by:
addAsServiceProvider
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
serviceInterface
- The Service Interface classserviceImpls
- The Service Interface Implementations- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if serviceInterface is nullIllegalArgumentException
- if serviceImpls is null or contain null values
-
addAsServiceProvider
public T addAsServiceProvider(String serviceInterface, String... serviceImpls) throws IllegalArgumentException Description copied from interface:ManifestContainer
Adds a META-INF/services/ServiceInterfaceNameAsset
representing this service.- Specified by:
addAsServiceProvider
in interfaceManifestContainer<T extends Archive<T>>
- Parameters:
serviceInterface
- The Service Interface class nameserviceImpls
- The Service Interface Implementations class names- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if serviceInterface is nullIllegalArgumentException
- if serviceImpls is null or contain null values- See Also:
-
addAsServiceProviderAndClasses
public T addAsServiceProviderAndClasses(Class<?> serviceInterface, Class<?>... serviceImpls) throws IllegalArgumentException Description copied from interface:ServiceProviderContainer
Adds a META-INF/services/ServiceInterfaceNameAsset
and the classes related to the service to the archive.- Specified by:
addAsServiceProviderAndClasses
in interfaceServiceProviderContainer<T extends Archive<T>>
- Parameters:
serviceInterface
- The Service Interface classserviceImpls
- The Service Interface Implementations- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if serviceInterface is nullIllegalArgumentException
- if serviceImpls is null or contain null values
-
getResourcePath
Should be implemented to set the path for Resource related resources.- Returns:
- Base Path for the ResourceContainer resources
-
addAsResource
Description copied from interface:ResourceContainer
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.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If the resourceName is null- See Also:
-
addAsResource
Description copied from interface:ResourceContainer
Adds theFile
as a resource to the container, returning the container itself.
TheFile
will be placed into the Container Library path underFile.getName()
.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If the resource is null- See Also:
-
addAsResource
Description copied from interface:ResourceContainer
Adds the resource as a resource to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resourceName is nullIllegalArgumentException
- if target is null- See Also:
-
addAsResource
Description copied from interface:ResourceContainer
Adds theFile
as a resource to the container, returning the container itself.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsResource
Description copied from interface:ResourceContainer
Adds theURL
as a resource to the container, returning the container itself.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resource
-URL
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsResource
Description copied from interface:ResourceContainer
Adds theAsset
as a resource to the container, returning the container itself.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resource
-Asset
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsResource
Description copied from interface:ResourceContainer
Adds the resource with the specified name to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resourceName
- Name of theClassLoader
resource 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
public T addAsResource(String resourceName, ArchivePath target, ClassLoader classLoader) throws IllegalArgumentException Description copied from interface:ResourceContainer
Adds the resource as a resource to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resourceName is nullIllegalArgumentException
- if target is null- See Also:
-
addAsResource
Description copied from interface:ResourceContainer
Adds theFile
as a resource to the container, returning the container itself.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsResource
Description copied from interface:ResourceContainer
Adds theURL
as a resource to the container, returning the container itself.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resource
-URL
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsResource
Description copied from interface:ResourceContainer
Adds theAsset
as a resource to the container, returning the container itself.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- Parameters:
resource
-Asset
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s resource path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null
-
addAsResources
public T addAsResources(Package resourcePackage, String... resourceNames) throws IllegalArgumentException Description copied from interface:ResourceContainer
Adds the resources inside the package as multiple resources to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsResources
in interfaceResourceContainer<T extends Archive<T>>
- 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
public T addAsResource(Package resourcePackage, String resourceName) throws IllegalArgumentException Description copied from interface:ResourceContainer
Adds the resource as a resource to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- 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
public T addAsResource(Package resourcePackage, String resourceName, String target) throws IllegalArgumentException Description copied from interface:ResourceContainer
Adds the resource as a resource to a specific path inside the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- 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
public T addAsResource(Package resourcePackage, String resourceName, ArchivePath target) throws IllegalArgumentException Description copied from interface:ResourceContainer
Adds the resource as a resource to a specific path inside the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsResource
in interfaceResourceContainer<T extends Archive<T>>
- 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
-
getClassesPath
Should be implemented to set the path for Class related resources.- Returns:
- Base Path for the ClassContainer resources
-
addClass
Description copied from interface:ClassContainer
- Specified by:
addClass
in interfaceClassContainer<T extends Archive<T>>
- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class were specified
-
addClass
Adds theClass
, and all member (inner)Class
es, with the specified fully-qualified name, loaded by the Thread ContextClassLoader
, to theArchive
.- Specified by:
addClass
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
fullyQualifiedClassName
- The name of theClass
to add- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class name was specifiedIllegalArgumentException
- If theClass
could not be loaded- See Also:
-
addClass
Adds theClass
, and all member (inner) @link{Class}es, with the specified fully-qualified name, loaded by the specifiedClassLoader
, to theArchive
.- Specified by:
addClass
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
fullyQualifiedClassName
- The name of theClass
to addcl
- TheClassLoader
used to load the Class- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class name was specifiedIllegalArgumentException
- If noClassLoader
was specifiedIllegalArgumentException
- If theClass
could not be loaded by the targetClassLoader
- See Also:
-
addClasses
Description copied from interface:ClassContainer
- Specified by:
addClasses
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
classes
- The classes to add to the Archive- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no classes were specified
-
addPackage
Description copied from interface:ClassContainer
- Specified by:
addPackage
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
pack
- ThePackage
to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no package were specified- See Also:
-
addPackages
Description copied from interface:ClassContainer
- Specified by:
addPackages
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
recursive
- Should the sub packages be addedpackages
- All the packages to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no packages were specified- See Also:
-
addPackages
public T addPackages(boolean recursive, Filter<ArchivePath> filter, Package... packages) throws IllegalArgumentException Description copied from interface:ClassContainer
Adds all classes accepted by the filter in the specifiedPackage
s to theArchive
.
TheArchivePath
returned to the filter is theArchivePath
of the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Specified by:
addPackages
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
recursive
- Should the sub packages be addedfilter
- filter out specific classespackages
- All the packages to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no packages were specified
-
addPackages
private T addPackages(boolean recursive, Filter<ArchivePath> filter, ClassLoader cl, Package... packages) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
addPackage
Description copied from interface:ClassContainer
- Specified by:
addPackage
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
pack
- Package to add represented by a String ("my/package")- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no package were specified- See Also:
-
addDefaultPackage
Description copied from interface:ClassContainer
- Specified by:
addDefaultPackage
in interfaceClassContainer<T extends Archive<T>>
- Returns:
- This virtual archive
-
addPackages
Description copied from interface:ClassContainer
- Specified by:
addPackages
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
recursive
- Should the sub packages be addedpackages
- All the packages to add represented by a String ("my/package")- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no packages were specified- See Also:
-
addPackages
public T addPackages(boolean recursive, Filter<ArchivePath> filter, String... packageNames) throws IllegalArgumentException Description copied from interface:ClassContainer
Adds all classes accepted by the filter in the specifiedPackage
s to theArchive
.
TheArchivePath
returned to the filter is theArchivePath
of the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Specified by:
addPackages
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
recursive
- Should the sub packages be addedfilter
- filter out specific classespackageNames
- All the packages to add represented by a String ("my/package")- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no packages were specified
-
addPackages
private T addPackages(boolean recursive, Filter<ArchivePath> filter, ClassLoader classLoader, String... packageNames) -
addPackage
private void addPackage(boolean recursive, Filter<ArchivePath> filter, ClassLoader classLoader, String packageName) -
deleteClass
Description copied from interface:ClassContainer
- Specified by:
deleteClass
in interfaceClassContainer<T extends Archive<T>>
- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class was specified
-
deleteClass
Description copied from interface:ClassContainer
Deletes theClass
, and all member (inner)Class
es, with the specified fully-qualified name, loaded by the Thread ContextClassLoader
, from theArchive
.- Specified by:
deleteClass
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
fullyQualifiedClassName
- The name of theClass
to be deleted- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class name was specifiedIllegalArgumentException
- If theClass
could not be loaded
-
deleteClasses
Description copied from interface:ClassContainer
- Specified by:
deleteClasses
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
classes
- The classes to be removed from theArchive
- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no classes were specified
-
getInnerClasses
-
deletePackage
Description copied from interface:ClassContainer
- Specified by:
deletePackage
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
pack
- ThePackage
to be deleted- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no package was specified- See Also:
-
deletePackage
Description copied from interface:ClassContainer
- Specified by:
deletePackage
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
pack
- Package to be delete represented by a String ("my/package")- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no package was specified- See Also:
-
deleteDefaultPackage
Description copied from interface:ClassContainer
- Specified by:
deleteDefaultPackage
in interfaceClassContainer<T extends Archive<T>>
- Returns:
- This archive
-
deletePackages
Description copied from interface:ClassContainer
- Specified by:
deletePackages
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
recursive
- Should the sub packages be deleted?packages
- All the packages to be deleted- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no packages were specified- See Also:
-
deletePackages
Description copied from interface:ClassContainer
- Specified by:
deletePackages
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
recursive
- Should the sub packages be deleted?packages
- All the packages to be deleted represented by a String ("my/package")- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no packages were specified- See Also:
-
deletePackages
public T deletePackages(boolean recursive, Filter<ArchivePath> filter, Package... packages) throws IllegalArgumentException Description copied from interface:ClassContainer
Deletes all classes accepted by the filter in the specifiedPackage
s from theArchive
.
TheArchivePath
returned to the filter is theArchivePath
of the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Specified by:
deletePackages
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
recursive
- Should the sub packages be deleted?filter
- filter out specific classespackages
- All the packages to be deleted- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no packages were specified or if no filter was specified
-
deletePackages
public T deletePackages(boolean recursive, Filter<ArchivePath> filter, String... packages) throws IllegalArgumentException Description copied from interface:ClassContainer
Delete all classes accepted by the filter in the specifiedPackage
s from theArchive
.
TheArchivePath
returned to the filter is theArchivePath
of the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Specified by:
deletePackages
in interfaceClassContainer<T extends Archive<T>>
- Parameters:
recursive
- Should the sub packages be deleted?filter
- filter out specific classespackages
- All the packages to be deleted represented by a String ("my/package")- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no packages were specified or if no filter was specified
-
deletePackage
private void deletePackage(boolean recursive, Filter<ArchivePath> filter, String packageName, ClassLoader classLoader) -
getLibraryPath
Should be implemented to set the path for Library related resources.- Returns:
- Base Path for the LibraryContainer resources
-
addAsLibrary
Add anotherArchive
to thisArchive
as a library to the container, returning the container itself.
TheArchive
will be placed into the Container Library path underArchive.getName()
.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
archive
-Archive
resource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- ifArchive
is null- See Also:
-
addAsLibrary
Adds the resource as a library to the container, returning the container itself.
The resource will be placed into the Container Library path under the same context from which it was retrieved.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resourceName is null- See Also:
-
addAsLibrary
Adds theFile
as a library to the container, returning the container itself.
TheFile
will be placed into the Container Library path underFile.getName()
.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resourceName is null- See Also:
-
addAsLibrary
Adds the resource as a library to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s library path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resourceName is nullIllegalArgumentException
- if target is null- See Also:
-
addAsLibrary
Adds theFile
as a library to the container, returning the container itself.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s library path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsLibrary
Description copied from interface:LibraryContainer
Adds theURL
as a library to the container, returning the container itself.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resource
-URL
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s library path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsLibrary
Description copied from interface:LibraryContainer
Adds theAsset
as a library to the container, returning the container itself.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resource
-Asset
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s library path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsLibrary
Description copied from interface:LibraryContainer
Adds the resource as a library to the container, returning the container itself.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resourceName
- resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s library path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resourceName is nullIllegalArgumentException
- if target is null- See Also:
-
addAsLibrary
Description copied from interface:LibraryContainer
Adds theFile
as a library to the container, returning the container itself.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resource
-File
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s library path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsLibrary
Description copied from interface:LibraryContainer
Adds theURL
as a library to the container, returning the container itself.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resource
-URL
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s library path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null- See Also:
-
addAsLibrary
Description copied from interface:LibraryContainer
Adds theAsset
as a library to the container, returning the container itself.- Specified by:
addAsLibrary
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resource
-Asset
resource to addtarget
- The target path within the archive in which to add the resource, relative to theArchive
s library path.- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resource is nullIllegalArgumentException
- if target is null
-
addAsLibraries
Description copied from interface:LibraryContainer
Add multiple resources to thisArchive
as libraries to the container, returning the container itself.
The resources will be placed into the Container Library path under the same context from which they were retrieved.
TheClassLoader
used to obtain the resource is up to the implementation.- Specified by:
addAsLibraries
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resourceNames
- resources to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- if resourceNames are null or empty- See Also:
-
addAsLibraries
Description copied from interface:LibraryContainer
Add multipleFile
to thisArchive
as libraries to the container, returning the container itself.
TheFile
s will be placed into the Container Library path underFile.getName()
.- Specified by:
addAsLibraries
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
resources
-File
resources to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- ifFile
resources are null or empty- See Also:
-
addAsLibraries
Description copied from interface:LibraryContainer
Add multipleArchive
s to thisArchive
as libraries to the container, returning the container itself.
TheArchive
s will be placed into the Container Library path underArchive.getName()
.- Specified by:
addAsLibraries
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
archives
-Archive
resources to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- ifArchive
resources are null- See Also:
-
addAsLibraries
Add multipleArchive
s to thisArchive
as libraries to the container, returning the container itself.
TheArchive
s will be placed into the Container Library path underArchive.getName()
.- Specified by:
addAsLibraries
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
archives
-Archive
resources to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- ifCollection
of archives is null- See Also:
-
addAsLibraries
Add multipleArchive
s to thisArchive
as libraries to the container, returning the container itself.
TheArchive
s will be placed into the Container Library path underArchive.getName()
.- Specified by:
addAsLibraries
in interfaceLibraryContainer<T extends Archive<T>>
- Parameters:
archives
-Archive
resources to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- ifCollection
of archives is null- See Also:
-
writeTo
Prints the content of thisArchive
to the specifiedOutputStream
on the format defined by the specifiedFormatter
. The caller is responsible for opening, flushing and eventually closing the stream. -
covarientReturn
-
getActualClass
-
fileFromResource
Gets a resource from the TCCL and returns its file path.- Parameters:
resourceName
- is the name of the resource in the classpath- Returns:
- the file path for resourceName @see
URL.getFile()
- Throws:
IllegalArgumentException
- if resourceName doesn't exist in the classpath or privileges are not granted
-
getArchiveClassLoaders
-