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 Modifier and Type Class Description private static classContainerBase.GetTcclActionObtains theThreadContextClassLoader
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<T>actualTypeThe exposed archive type.private static java.lang.StringDEFAULT_MANIFESTprivate static java.lang.StringDEFAULT_PACKAGE_NAME-
Fields inherited from interface org.jboss.shrinkwrap.api.container.ManifestContainer
DEFAULT_MANIFEST_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedContainerBase(java.lang.Class<T> actualType, Archive<?> archive)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Tadd(Archive<?> archive, java.lang.String path, java.lang.Class<? extends StreamExporter> exporter)Add an archive under a specific context and maintain the archive name as context path.Tadd(Archive<?> archive, ArchivePath path, java.lang.Class<? extends StreamExporter> exporter)Add an archive under a specific context and maintain the archive name as context path.Tadd(Asset asset, java.lang.String name)Adds the specified resource under the context denoted by the specified targetTadd(Asset asset, java.lang.String target, java.lang.String name)Adds the specified asset under the specified target (directory) using the specified name.Tadd(Asset asset, ArchivePath target)Adds the specified asset under the specified path into the target contextTadd(Asset asset, ArchivePath path, java.lang.String name)Adds the specified asset under the specified target (directory) using the specified name.Tadd(NamedAsset namedAsset)Adds the asset encapsulated within the specifiedNamedAssetunder the encapsulated name and target (directory)TaddAsDirectories(java.lang.String... paths)Adds the specified directories.TaddAsDirectories(ArchivePath... paths)Adds the specified directories.TaddAsDirectory(java.lang.String path)Adds the specified directory.TaddAsDirectory(ArchivePath path)Adds the specified directory.TaddAsLibraries(java.io.File... resources)Add multipleFileto thisArchiveas libraries to the container, returning the container itself.TaddAsLibraries(java.lang.String... resourceNames)Add multiple resources to thisArchiveas libraries to the container, returning the container itself.TaddAsLibraries(java.util.Collection<? extends Archive<?>> archives)TaddAsLibraries(Archive<?>... archives)TaddAsLibraries(Archive<?>[]... archives)TaddAsLibrary(java.io.File resource)Adds theFileas a library to the container, returning the container itself.TaddAsLibrary(java.io.File resource, java.lang.String target)Adds theFileas a library to the container, returning the container itself.TaddAsLibrary(java.io.File resource, ArchivePath target)Adds theFileas a library to the container, returning the container itself.TaddAsLibrary(java.lang.String resourceName)Adds the resource as a library to the container, returning the container itself.TaddAsLibrary(java.lang.String resourceName, java.lang.String target)Adds the resource as a library to the container, returning the container itself.TaddAsLibrary(java.lang.String resourceName, ArchivePath target)Adds the resource as a library to the container, returning the container itself.TaddAsLibrary(java.net.URL resource, java.lang.String target)Adds theURLas a library to the container, returning the container itself.TaddAsLibrary(java.net.URL resource, ArchivePath target)Adds theURLas a library to the container, returning the container itself.TaddAsLibrary(Archive<?> archive)TaddAsLibrary(Asset resource, java.lang.String target)Adds theAssetas a library to the container, returning the container itself.TaddAsLibrary(Asset resource, ArchivePath target)Adds theAssetas a library to the container, returning the container itself.TaddAsManifestResource(java.io.File resource)Adds theFileas a Manifest resource to the container, returning the container itself.TaddAsManifestResource(java.io.File resource, java.lang.String target)Adds theFileas a Manifest resource to the container, returning the container itself.TaddAsManifestResource(java.io.File resource, ArchivePath target)Adds theFileas a Manifest resource to the container, returning the container itself.TaddAsManifestResource(java.lang.Package resourcePackage, java.lang.String resourceName)Adds the resource as a resource to the container, returning the container itself.TaddAsManifestResource(java.lang.Package resourcePackage, java.lang.String resourceName, java.lang.String target)Adds the resource as a resource to a specific path inside the container, returning the container itself.TaddAsManifestResource(java.lang.Package resourcePackage, java.lang.String resourceName, ArchivePath target)Adds the resource as a resource to a specific path inside the container, returning the container itself.TaddAsManifestResource(java.lang.String resourceName)Adds the resource as a Manifest resource to the container, returning the container itself.TaddAsManifestResource(java.lang.String resourceName, java.lang.String target)Adds the resource as a Manifest resource to the container, returning the container itself.TaddAsManifestResource(java.lang.String resourceName, ArchivePath target)Adds the resource as a Manifest resource to the container, returning the container itself.TaddAsManifestResource(java.net.URL resource, java.lang.String target)Adds theURLas a Manifest resource to the container, returning the container itself.TaddAsManifestResource(java.net.URL resource, ArchivePath target)Adds theURLas a Manifest resource to the container, returning the container itself.TaddAsManifestResource(Asset resource, java.lang.String target)Adds theAssetas a Manifest resource to the container, returning the container itself.TaddAsManifestResource(Asset resource, ArchivePath target)Adds theAssetas a Manifest resource to the container, returning the container itself.TaddAsManifestResources(java.lang.Package resourcePackage, java.lang.String... resourceNames)Adds the resources inside the package as multiple resources to the container, returning the container itself.TaddAsResource(java.io.File resource)Adds theFileas a resource to the container, returning the container itself.TaddAsResource(java.io.File resource, java.lang.String target)Adds theFileas a resource to the container, returning the container itself.TaddAsResource(java.io.File resource, ArchivePath target)Adds theFileas a resource to the container, returning the container itself.TaddAsResource(java.lang.Package resourcePackage, java.lang.String resourceName)Adds the resource as a resource to the container, returning the container itself.TaddAsResource(java.lang.Package resourcePackage, java.lang.String resourceName, java.lang.String target)Adds the resource as a resource to a specific path inside the container, returning the container itself.TaddAsResource(java.lang.Package resourcePackage, java.lang.String resourceName, ArchivePath target)Adds the resource as a resource to a specific path inside the container, returning the container itself.TaddAsResource(java.lang.String resourceName)Adds the resource as a resource to the container, returning the container itself.TaddAsResource(java.lang.String resourceName, java.lang.String target)Adds the resource as a resource to the container, returning the container itself.TaddAsResource(java.lang.String resourceName, ArchivePath target)Adds the resource with the specified name to the container, returning the container itself.TaddAsResource(java.lang.String resourceName, ArchivePath target, java.lang.ClassLoader classLoader)Adds the resource as a resource to the container, returning the container itself.TaddAsResource(java.net.URL resource, java.lang.String target)Adds theURLas a resource to the container, returning the container itself.TaddAsResource(java.net.URL resource, ArchivePath target)Adds theURLas a resource to the container, returning the container itself.TaddAsResource(Asset resource, java.lang.String target)Adds theAssetas a resource to the container, returning the container itself.TaddAsResource(Asset resource, ArchivePath target)Adds theAssetas a resource to the container, returning the container itself.TaddAsResources(java.lang.Package resourcePackage, java.lang.String... resourceNames)Adds the resources inside the package as multiple resources to the container, returning the container itself.TaddAsServiceProvider(java.lang.Class<?> serviceInterface, java.lang.Class<?>... serviceImpls)Adds a META-INF/services/ServiceInterfaceNameAssetrepresenting this service.TaddAsServiceProvider(java.lang.String serviceInterface, java.lang.String... serviceImpls)Adds a META-INF/services/ServiceInterfaceNameAssetrepresenting this service.TaddAsServiceProviderAndClasses(java.lang.Class<?> serviceInterface, java.lang.Class<?>... serviceImpls)Adds a META-INF/services/ServiceInterfaceNameAssetand the classes related to the service to the archive.TaddClass(java.lang.Class<?> clazz)TaddClass(java.lang.String fullyQualifiedClassName)Adds theClass, and all member (inner)Classes, with the specified fully-qualified name, loaded by the Thread ContextClassLoader, to theArchive.TaddClass(java.lang.String fullyQualifiedClassName, java.lang.ClassLoader cl)Adds theClass, and all member (inner) @link{Class}es, with the specified fully-qualified name, loaded by the specifiedClassLoader, to theArchive.TaddClasses(java.lang.Class<?>... classes)TaddDefaultPackage()Adds all classes in the defaultPackageto theArchive.TaddHandlers(ArchiveEventHandler... handlers)Add an array of listeners for call back based.TaddManifest()Adds a default generated MANIFEST.MF manifest to the current archive.private TaddNestedJarFileResource(java.io.File resource, ArchivePath target, ArchivePath base)Adds the specifiedFileresource (a nested JAR File form) to the current archive, returning the archive itselfprivate voidaddPackage(boolean recursive, Filter<ArchivePath> filter, java.lang.ClassLoader classLoader, java.lang.String packageName)TaddPackage(java.lang.Package pack)Adds all classes in the specifiedPackageto theArchive.TaddPackage(java.lang.String pack)Adds all classes in the specifiedPackageto theArchive.TaddPackages(boolean recursive, java.lang.Package... packages)Adds all classes in the specifiedPackages to theArchive.TaddPackages(boolean recursive, java.lang.String... packages)Adds all classes in the specifiedPackages to theArchive.private TaddPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.ClassLoader cl, java.lang.Package... packages)private TaddPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.ClassLoader classLoader, java.lang.String... packageNames)TaddPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages)Adds all classes accepted by the filter in the specifiedPackages to theArchive.TaddPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packageNames)Adds all classes accepted by the filter in the specifiedPackages to theArchive.booleancontains(java.lang.String path)Denotes whether this archive contains a resource at the specified pathbooleancontains(ArchivePath path)Denotes whether this archive contains a resource at the specified pathprotected TcovarientReturn()Nodedelete(java.lang.String archivePath)Nodedelete(ArchivePath path)TdeleteClass(java.lang.Class<?> clazz)TdeleteClass(java.lang.String fullyQualifiedClassName)Deletes theClass, and all member (inner)Classes, with the specified fully-qualified name, loaded by the Thread ContextClassLoader, from theArchive.TdeleteClasses(java.lang.Class<?>... classes)TdeleteDefaultPackage()Deletes all classes in the defaultPackagefrom theArchive.private voiddeletePackage(boolean recursive, Filter<ArchivePath> filter, java.lang.String packageName, java.lang.ClassLoader classLoader)TdeletePackage(java.lang.Package pack)Deletes all classes in the specifiedPackagefrom theArchive.TdeletePackage(java.lang.String pack)Deletes all classes in the specifiedPackagefrom theArchive.TdeletePackages(boolean recursive, java.lang.Package... packages)Deletes all classes in the specifiedPackages from theArchive.TdeletePackages(boolean recursive, java.lang.String... packages)Delete all classes in the specifiedPackages from theArchive.TdeletePackages(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages)Deletes all classes accepted by the filter in the specifiedPackages from theArchive.TdeletePackages(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packages)Delete all classes accepted by the filter in the specifiedPackages from theArchive.booleanequals(java.lang.Object obj)private java.io.FilefileFromResource(java.lang.String resourceName)Gets a resource from the TCCL and returns its file path.Tfilter(Filter<ArchivePath> filter)Obtains all assets matching given filter in this archive as a new Archive.
This is an alias for shallowCopy(Filter).Nodeget(java.lang.String path)Obtains theNodelocated at the specified pathNodeget(ArchivePath path)Obtains theNodelocated at the specified pathprotected java.lang.Class<T>getActualClass()private java.lang.Iterable<java.lang.ClassLoader>getArchiveClassLoaders()ArchiveFormatgetArchiveFormat()<X extends Archive<X>>
XgetAsType(java.lang.Class<X> type, java.lang.String path)Get a nestedArchiveas a specific type.
The found Archives must have been added as a Archive, no import is performed.<X extends Archive<X>>
XgetAsType(java.lang.Class<X> type, java.lang.String path, ArchiveFormat archiveCompression)Get a nestedArchiveas a specific type using the specifyArchiveFormat<X extends Archive<X>>
XgetAsType(java.lang.Class<X> type, ArchivePath path)Get a nestedArchiveas a specific type.
The found Archives must have been added as a Archive, no import is performed.<X extends Archive<X>>
XgetAsType(java.lang.Class<X> type, ArchivePath path, ArchiveFormat archiveCompression)<X extends Archive<X>>
java.util.Collection<X>getAsType(java.lang.Class<X> type, Filter<ArchivePath> filter)Get all nestedArchivematching the filter as a specific type.
The found Archives must have been added as a Archive, no import is performed.<X extends Archive<X>>
java.util.Collection<X>getAsType(java.lang.Class<X> type, Filter<ArchivePath> filter, ArchiveFormat archiveCompression)Get all nestedArchivematching the filter as a specific type using the specifyArchiveFormat.protected abstract ArchivePathgetClassesPath()Should be implemented to set the path for Class related resources.java.util.Map<ArchivePath,Node>getContent()Obtains all assets in this archive, along with their respective paths.java.util.Map<ArchivePath,Node>getContent(Filter<ArchivePath> filter)Obtains all assets matching given filter in this archive, along with its respective Path.java.lang.StringgetId()Obtains a globally-unique identifier for thisArchiveprivate java.util.Set<ArchivePath>getInnerClasses(ArchivePath path)protected abstract ArchivePathgetLibraryPath()Should be implemented to set the path for Library related resources.protected abstract ArchivePathgetManifestPath()Should be implemented to set the path for Manifest related resources.java.lang.StringgetName()Obtains the name of this archive (ie.protected abstract ArchivePathgetResourcePath()Should be implemented to set the path for Resource related resources.inthashCode()Tmerge(Archive<?> source)Merge the contents from an existing archive without maintaining the archive name in the context path.Tmerge(Archive<?> source, java.lang.String path)Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.Tmerge(Archive<?> source, java.lang.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.Tmerge(Archive<?> source, ArchivePath path)Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.Tmerge(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.Tmerge(Archive<?> source, Filter<ArchivePath> filter)Merge the contents from an existing archive without maintaining the archive name in the context path.Tmove(java.lang.String source, java.lang.String target)Moves the asset under the source path to the target path.Tmove(ArchivePath source, ArchivePath target)Moves the asset under the source path to the target path.private java.lang.StringresourceAdjustedPath(java.io.File resource)TsetManifest(java.io.File resource)Adds theFileas MANIFEST.FM to the container, returning the container itself.TsetManifest(java.lang.Package resourcePackage, java.lang.String resourceName)Adds the resource inside the package as a MANIFEST.MF to the container, returning the container itself.TsetManifest(java.lang.String resourceName)Adds the resource as MANIFEST.FM to the container, returning the container itself.TsetManifest(java.net.URL resource)Adds theURLas MANIFEST.FM to the container, returning the container itself.TsetManifest(Asset resource)Adds theAssetas MANIFEST.FM to the container, returning the container itself.Archive<T>shallowCopy()Creates a shallow copy of thisArchive.Archive<T>shallowCopy(Filter<ArchivePath> filter)Creates a shallow copy of thisArchivebased on given filter.Assets from this archive are made available under the same paths.java.lang.StringtoString()Acts as a shorthand forArchive.toString(Formatter)where theFormatters.SIMPLEis leveraged.java.lang.StringtoString(boolean verbose)If "true" is specified, acts as a shorthand forArchive.toString(Formatter)where theFormatters.VERBOSEis leveraged.java.lang.StringtoString(Formatter formatter)voidwriteTo(java.io.OutputStream outputStream, Formatter formatter)-
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 Detail
-
DEFAULT_MANIFEST
private static final java.lang.String DEFAULT_MANIFEST
- See Also:
- Constant Field Values
-
DEFAULT_PACKAGE_NAME
private static final java.lang.String DEFAULT_PACKAGE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getArchiveFormat
public ArchiveFormat getArchiveFormat()
- Specified by:
getArchiveFormatin interfaceArchiveFormatAssociable
-
add
public T add(Archive<?> archive, java.lang.String path, java.lang.Class<? extends StreamExporter> exporter)
Add an archive under a specific context and maintain the archive name as context path.- Specified by:
addin interfaceArchive<T extends Archive<T>>- Parameters:
archive- to addpath- to useexporter- Exporter type to use in fulfilling theAsset.openStream()contract for the added (nested) archive.- Returns:
- See Also:
Archive.add(org.jboss.shrinkwrap.api.Archive, java.lang.String, java.lang.Class)
-
add
public T add(Archive<?> archive, ArchivePath path, java.lang.Class<? extends StreamExporter> exporter)
Add an archive under a specific context and maintain the archive name as context path.- Specified by:
addin interfaceArchive<T extends Archive<T>>- Parameters:
archive- to addpath- to useexporter- Exporter type to use in fulfilling theAsset.openStream()contract for the added (nested) archive.- Returns:
- See Also:
Archive.add(org.jboss.shrinkwrap.api.Archive, org.jboss.shrinkwrap.api.ArchivePath, java.lang.Class)
-
add
public T add(Asset asset, ArchivePath target) throws java.lang.IllegalArgumentException
Adds the specified asset under the specified path into the target context- Specified by:
addin interfaceArchive<T extends Archive<T>>target- The context under which to add the assets- Returns:
- Throws:
java.lang.IllegalArgumentException- If no target or assets were specified- See Also:
Archive.add(org.jboss.shrinkwrap.api.asset.Asset, org.jboss.shrinkwrap.api.ArchivePath)
-
add
public T add(Asset asset, ArchivePath path, java.lang.String name)
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:
addin interfaceArchive<T extends Archive<T>>path- The context directory under which to add the assetname- The name to assign the assent under the target namespace- Returns:
- See Also:
Archive.add(org.jboss.shrinkwrap.api.asset.Asset, org.jboss.shrinkwrap.api.ArchivePath, java.lang.String)
-
add
public T add(Asset asset, java.lang.String target, java.lang.String name) throws java.lang.IllegalArgumentException
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:
addin interfaceArchive<T extends Archive<T>>target- The context directory under which to add the assetname- The name to assign the assent under the target namespace- Returns:
- Throws:
java.lang.IllegalArgumentException- If the target, name, or asset was not specified- See Also:
Archive.add(org.jboss.shrinkwrap.api.asset.Asset, java.lang.String, java.lang.String)
-
add
public T add(NamedAsset namedAsset)
Adds the asset encapsulated within the specifiedNamedAssetunder the encapsulated name and target (directory)
-
addAsDirectories
public T addAsDirectories(ArchivePath... paths) throws java.lang.IllegalArgumentException
Adds the specified directories.- Specified by:
addAsDirectoriesin interfaceArchive<T extends Archive<T>>- Parameters:
paths- The paths to add- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no paths were specified- See Also:
Archive.addAsDirectories(org.jboss.shrinkwrap.api.ArchivePath[])
-
addAsDirectories
public T addAsDirectories(java.lang.String... paths) throws java.lang.IllegalArgumentException
Adds the specified directories.- Specified by:
addAsDirectoriesin interfaceArchive<T extends Archive<T>>- Parameters:
paths- The paths to add- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no paths were specified- See Also:
Archive.addAsDirectories(java.lang.String[])
-
addAsDirectory
public T addAsDirectory(ArchivePath path) throws java.lang.IllegalArgumentException
Adds the specified directory.- Specified by:
addAsDirectoryin interfaceArchive<T extends Archive<T>>- Parameters:
path- The path to add- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no path was specified- See Also:
Archive.addAsDirectory(org.jboss.shrinkwrap.api.ArchivePath)
-
addAsDirectory
public T addAsDirectory(java.lang.String path) throws java.lang.IllegalArgumentException
Adds the specified directory.- Specified by:
addAsDirectoryin interfaceArchive<T extends Archive<T>>- Parameters:
path- The path to add- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no path was specified- See Also:
Archive.addAsDirectory(java.lang.String)
-
addHandlers
public T addHandlers(ArchiveEventHandler... handlers)
Add an array of listeners for call back based.- Specified by:
addHandlersin interfaceArchive<T extends Archive<T>>- Returns:
- This archive
- See Also:
org.jboss.shrinkwrap.api.Archive#addHandlers(org.jboss.shrinkwrap.api.Filter, org.jboss.shrinkwrap.api.ArchiveEventHandler)
-
merge
public T merge(Archive<?> source) throws java.lang.IllegalArgumentException
Merge the contents from an existing archive without maintaining the archive name in the context path.
-
merge
public T merge(Archive<?> source, Filter<ArchivePath> filter) throws java.lang.IllegalArgumentException
Merge the contents from an existing archive without maintaining the archive name in the context path. The filter control whichArchivePaths to include form the sourceArchive.
-
merge
public T merge(Archive<?> source, ArchivePath path) throws java.lang.IllegalArgumentException
Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.- Specified by:
mergein interfaceArchive<T extends Archive<T>>- Parameters:
source- Archive to add contents frompath- Path to add contents to- Returns:
- Throws:
java.lang.IllegalArgumentException- If the path or existing archive is not specified- See Also:
Archive.merge(org.jboss.shrinkwrap.api.Archive, org.jboss.shrinkwrap.api.ArchivePath)
-
merge
public T merge(Archive<?> source, ArchivePath path, Filter<ArchivePath> filter) throws java.lang.IllegalArgumentException
Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path. The filter control whichArchivePaths to include form the sourceArchive.- Specified by:
mergein interfaceArchive<T extends Archive<T>>- Parameters:
source- Archive to add contents frompath- Path to add contents tofilter- Filter to use for includingAssets in the merge.- Returns:
- Throws:
java.lang.IllegalArgumentException- If the path or existing archive is not specified- See Also:
Archive.merge(org.jboss.shrinkwrap.api.Archive, org.jboss.shrinkwrap.api.ArchivePath, org.jboss.shrinkwrap.api.Filter)
-
merge
public T merge(Archive<?> source, java.lang.String path, Filter<ArchivePath> filter) throws java.lang.IllegalArgumentException
Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path. The filter control whichArchivePaths to include form the sourceArchive.- Specified by:
mergein interfaceArchive<T extends Archive<T>>- Parameters:
source- Archive to add contents frompath- Path to add contents tofilter- Filter to use for includingAssets in the merge.- Returns:
- Throws:
java.lang.IllegalArgumentException- If the path or existing archive is not specified- See Also:
Archive.merge(org.jboss.shrinkwrap.api.Archive, java.lang.String, org.jboss.shrinkwrap.api.Filter)
-
merge
public T merge(Archive<?> source, java.lang.String path) throws java.lang.IllegalArgumentException
Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.- Specified by:
mergein interfaceArchive<T extends Archive<T>>- Parameters:
source- Archive to add contents frompath- Path to add contents to- Returns:
- Throws:
java.lang.IllegalArgumentException- If the path or existing archive is not specified- See Also:
Archive.merge(org.jboss.shrinkwrap.api.Archive, java.lang.String)
-
move
public T move(ArchivePath source, ArchivePath target) throws java.lang.IllegalArgumentException, IllegalArchivePathException
Moves the asset under the source path to the target path.- Specified by:
movein 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:
java.lang.IllegalArgumentException- If any of the paths is not specifiedIllegalArchivePathException- If the source path is invalid.- See Also:
Archive.move(org.jboss.shrinkwrap.api.ArchivePath, org.jboss.shrinkwrap.api.ArchivePath)
-
move
public T move(java.lang.String source, java.lang.String target) throws java.lang.IllegalArgumentException, IllegalArchivePathException
Moves the asset under the source path to the target path.- Specified by:
movein 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:
java.lang.IllegalArgumentException- If any of the paths is not specifiedIllegalArchivePathException- If the source path is invalid.- See Also:
Archive.move(java.lang.String, java.lang.String)
-
add
public T add(Asset asset, java.lang.String name)
Adds the specified resource under the context denoted by the specified target
-
contains
public boolean contains(ArchivePath path)
Denotes whether this archive contains a resource at the specified path
-
contains
public boolean contains(java.lang.String path) throws java.lang.IllegalArgumentExceptionDenotes whether this archive contains a resource at the specified path
-
delete
public Node delete(ArchivePath path)
Removes theNodein theArchiveat the specifiedArchivePath. If the path is a directory, recursively removes all contents. If the path does not exist, return null.
-
delete
public Node delete(java.lang.String archivePath)
Removes theNodein theArchiveat theArchivePathindicated by the specified String archivePath. If the path is a directory, recursively removes all contents. If the path does not exist, return null.
-
get
public Node get(ArchivePath path)
Obtains theNodelocated at the specified path
-
get
public Node get(java.lang.String path) throws java.lang.IllegalArgumentException
Obtains theNodelocated at the specified path
-
getAsType
public <X extends Archive<X>> X getAsType(java.lang.Class<X> type, java.lang.String path)
Get a nestedArchiveas a specific type.
The found Archives must have been added as a Archive, no import is performed.
-
getAsType
public <X extends Archive<X>> X getAsType(java.lang.Class<X> type, ArchivePath path)
Get a nestedArchiveas a specific type.
The found Archives must have been added as a Archive, no import is performed.- Specified by:
getAsTypein interfaceArchive<T extends Archive<T>>- Parameters:
type- The Type to return the Archive aspath- The location of the Archive- Returns:
- The found Archive as given type or null if none found at given
ArchivePath - See Also:
Archive.getAsType(java.lang.Class, org.jboss.shrinkwrap.api.ArchivePath)
-
getAsType
public <X extends Archive<X>> java.util.Collection<X> getAsType(java.lang.Class<X> type, Filter<ArchivePath> filter)
Get all nestedArchivematching the filter as a specific type.
The found Archives must have been added as a Archive, no import is performed.- Specified by:
getAsTypein interfaceArchive<T extends Archive<T>>- Parameters:
type- The Type to return the Archive asfilter- Filter to match result- Returns:
- A
Collectionof found Archives matching given filter or emptyCollectionif non found. - See Also:
Archive.getAsType(java.lang.Class, org.jboss.shrinkwrap.api.Filter)
-
getAsType
public <X extends Archive<X>> X getAsType(java.lang.Class<X> type, java.lang.String path, ArchiveFormat archiveCompression)
Get a nestedArchiveas a specific type using the specifyArchiveFormat- Specified by:
getAsTypein interfaceArchive<T extends Archive<T>>- Parameters:
type- The Type to return the Archive aspath- The location of the ArchivearchiveCompression- The archive format- Returns:
- The found Archive as given type or null if none found at the given path
- See Also:
Archive.getAsType(java.lang.Class, java.lang.String, org.jboss.shrinkwrap.api.ArchiveFormat)
-
getAsType
public <X extends Archive<X>> X getAsType(java.lang.Class<X> type, ArchivePath path, ArchiveFormat archiveCompression)
- Specified by:
getAsTypein interfaceArchive<T extends Archive<T>>- Parameters:
type- The Type to return the Archive aspath- The location of the ArchivearchiveCompression- The archive format- Returns:
- The found Archive as given type or null if none found at given
ArchivePath - See Also:
Archive.getAsType(java.lang.Class, org.jboss.shrinkwrap.api.ArchivePath, org.jboss.shrinkwrap.api.ArchiveFormat)
-
getAsType
public <X extends Archive<X>> java.util.Collection<X> getAsType(java.lang.Class<X> type, Filter<ArchivePath> filter, ArchiveFormat archiveCompression)
Get all nestedArchivematching the filter as a specific type using the specifyArchiveFormat.- Specified by:
getAsTypein interfaceArchive<T extends Archive<T>>- Parameters:
type- The Type to return the Archive asfilter- Filter to match resultarchiveCompression- The archive format- Returns:
- A
Collectionof found Archives matching given filter or emptyCollectionif non found. - See Also:
Archive.getAsType(java.lang.Class, org.jboss.shrinkwrap.api.Filter, org.jboss.shrinkwrap.api.ArchiveFormat)
-
filter
public T filter(Filter<ArchivePath> filter)
Obtains all assets matching given filter in this archive as a new Archive.
This is an alias for shallowCopy(Filter).
-
getContent
public java.util.Map<ArchivePath,Node> getContent()
Obtains all assets in this archive, along with their respective paths. The returned Map will be an immutable view.- Specified by:
getContentin interfaceArchive<T extends Archive<T>>- Returns:
- See Also:
Archive.getContent()
-
getContent
public java.util.Map<ArchivePath,Node> getContent(Filter<ArchivePath> filter)
Obtains all assets matching given filter in this archive, along with its respective Path. The returned Map will be an immutable view.- Specified by:
getContentin interfaceArchive<T extends Archive<T>>- Returns:
- See Also:
Archive.getContent(org.jboss.shrinkwrap.api.Filter)
-
getName
public java.lang.String getName()
Obtains the name of this archive (ie. myLibrary.jar)
-
getId
public java.lang.String getId()
Obtains a globally-unique identifier for thisArchive
-
shallowCopy
public Archive<T> 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:
shallowCopyin interfaceArchive<T extends Archive<T>>- Returns:
- a new archive with a copy of the pointers to the assets
- See Also:
Archive.shallowCopy()
-
shallowCopy
public Archive<T> shallowCopy(Filter<ArchivePath> filter)
Creates a shallow copy of thisArchivebased 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:
shallowCopyin interfaceArchive<T extends Archive<T>>- Returns:
- a new archive with a copy of the pointers to the assets
- See Also:
Archive.shallowCopy(Filter)
-
toString
public java.lang.String toString()
Acts as a shorthand forArchive.toString(Formatter)where theFormatters.SIMPLEis leveraged.
-
toString
public java.lang.String toString(boolean verbose)
If "true" is specified, acts as a shorthand forArchive.toString(Formatter)where theFormatters.VERBOSEis leveraged. Otherwise theFormatters.SIMPLEwill be used (equivalent toArchive.toString()).
-
toString
public java.lang.String toString(Formatter formatter) throws java.lang.IllegalArgumentException
Returns a view of thisArchiveas returned from the specifiedFormatter. Common options may be to use the predefined formatters located inFormatters
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
getManifestPath
protected abstract ArchivePath getManifestPath()
Should be implemented to set the path for Manifest related resources.- Returns:
- Base Path for the ManifestContainer resources
-
setManifest
public final T setManifest(java.lang.String resourceName)
Adds the resource as MANIFEST.FM to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
setManifestin interfaceManifestContainer<T extends Archive<T>>- Parameters:
resourceName- resource to add- Returns:
- This virtual archive
- See Also:
ManifestContainer.setManifest(java.lang.String)
-
setManifest
public T setManifest(java.io.File resource) throws java.lang.IllegalArgumentException
Adds theFileas MANIFEST.FM to the container, returning the container itself.- Specified by:
setManifestin interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource-Fileresource to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
ManifestContainer.setManifest(java.io.File)
-
setManifest
public T setManifest(java.net.URL resource) throws java.lang.IllegalArgumentException
Adds theURLas MANIFEST.FM to the container, returning the container itself.- Specified by:
setManifestin interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource-URLresource to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
ManifestContainer.setManifest(java.net.URL)
-
setManifest
public T setManifest(Asset resource) throws java.lang.IllegalArgumentException
Adds theAssetas MANIFEST.FM to the container, returning the container itself.- Specified by:
setManifestin interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource-Fileresource to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
ManifestContainer.setManifest(org.jboss.shrinkwrap.api.asset.Asset)
-
setManifest
public T setManifest(java.lang.Package resourcePackage, java.lang.String resourceName) throws java.lang.IllegalArgumentException
Adds the resource inside the package as a MANIFEST.MF to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
setManifestin interfaceManifestContainer<T extends Archive<T>>- Parameters:
resourcePackage- The package of the resourceresourceName- The name of the resource inside resoucePackage- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourcePackage is null- See Also:
ManifestContainer.setManifest(java.lang.Package, java.lang.String)
-
addAsManifestResource
public final T addAsManifestResource(java.lang.String resourceName)
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.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resourceName- resource to add- Returns:
- This virtual archive
- See Also:
ManifestContainer.addAsManifestResource(java.lang.String)
-
addAsManifestResource
public T addAsManifestResource(java.io.File resource) throws java.lang.IllegalArgumentException
Adds theFileas a Manifest resource to the container, returning the container itself.
TheFilewill be placed into the Container Manifest path underFile.getName().- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource- resource to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- ifFileresource is null- See Also:
ManifestContainer.addAsManifestResource(java.io.File)
-
addAsManifestResource
public T addAsManifestResource(java.lang.String resourceName, java.lang.String target) throws java.lang.IllegalArgumentException
Adds the resource as a Manifest resource to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resourceName- resource to addtarget- The target path within the archive in which to add the resource, relative to theArchives manifest path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourceName is null- See Also:
ManifestContainer.addAsManifestResource(java.lang.String, java.lang.String)
-
addAsManifestResource
public T addAsManifestResource(java.io.File resource, java.lang.String target) throws java.lang.IllegalArgumentException
Adds theFileas a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource-Fileresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives manifest path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
ManifestContainer.addAsManifestResource(java.io.File, java.lang.String)
-
addAsManifestResource
public T addAsManifestResource(java.net.URL resource, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds theURLas a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource-URLresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives manifest path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
ManifestContainer.addAsManifestResource(Asset, ArchivePath)
-
addAsManifestResource
public T addAsManifestResource(Asset resource, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds theAssetas a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource-Assetresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives manifest path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
ManifestContainer.addAsManifestResource(Asset, ArchivePath)
-
addAsManifestResource
public T addAsManifestResource(java.lang.String resourceName, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds the resource as a Manifest resource to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resourceName- resource to addtarget- The target path within the archive in which to add the resource, relative to theArchives manifest path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourceName is null- See Also:
ManifestContainer.addAsManifestResource(Asset, ArchivePath)
-
addNestedJarFileResource
private T addNestedJarFileResource(java.io.File resource, ArchivePath target, ArchivePath base) throws java.lang.IllegalArgumentException
Adds the specifiedFileresource (a nested JAR File form) to the current archive, returning the archive itself- Parameters:
resource-target-- Returns:
- Throws:
java.lang.IllegalArgumentException
-
resourceAdjustedPath
private java.lang.String resourceAdjustedPath(java.io.File resource)
-
addAsManifestResource
public T addAsManifestResource(java.io.File resource, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds theFileas a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource-Fileresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives manifest path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
ManifestContainer.addAsManifestResource(Asset, ArchivePath)
-
addAsManifestResource
public T addAsManifestResource(java.net.URL resource, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds theURLas a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource-URLresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives manifest path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
ManifestContainer.addAsManifestResource(Asset, ArchivePath)
-
addAsManifestResource
public T addAsManifestResource(Asset resource, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds theAssetas a Manifest resource to the container, returning the container itself.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resource-Assetresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives manifest path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null
-
addAsManifestResources
public T addAsManifestResources(java.lang.Package resourcePackage, java.lang.String... resourceNames) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds 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.- Specified by:
addAsManifestResourcesin interfaceManifestContainer<T extends Archive<T>>- Parameters:
resourcePackage- The package of the resourcesresourceNames- The names of the resources inside resoucePackage- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourcePackage is null
-
addAsManifestResource
public T addAsManifestResource(java.lang.Package resourcePackage, java.lang.String resourceName) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds the resource as a resource to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsManifestResourcein interfaceManifestContainer<T extends Archive<T>>- Parameters:
resourcePackage- The package of the resourceresourceName- The name of the resource inside resoucePackage- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourcePackage is null
-
addAsManifestResource
public T addAsManifestResource(java.lang.Package resourcePackage, java.lang.String resourceName, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds 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.- Specified by:
addAsManifestResourcein 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:
java.lang.IllegalArgumentException- if resourcePackage is null
-
addAsManifestResource
public T addAsManifestResource(java.lang.Package resourcePackage, java.lang.String resourceName, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds 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.- Specified by:
addAsManifestResourcein 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:
java.lang.IllegalArgumentException- if resourcePackage is null
-
addManifest
public T addManifest() throws java.lang.IllegalArgumentException
Adds a default generated MANIFEST.MF manifest to the current archive.- Specified by:
addManifestin interfaceManifestContainer<T extends Archive<T>>- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if serviceInterface is null
-
addAsServiceProvider
public T addAsServiceProvider(java.lang.Class<?> serviceInterface, java.lang.Class<?>... serviceImpls) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds a META-INF/services/ServiceInterfaceNameAssetrepresenting this service. Warning: this method does not add the specified classes to the archive.- Specified by:
addAsServiceProviderin interfaceManifestContainer<T extends Archive<T>>- Parameters:
serviceInterface- The Service Interface classserviceImpls- The Service Interface Implementations- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if serviceInterface is null
-
addAsServiceProvider
public T addAsServiceProvider(java.lang.String serviceInterface, java.lang.String... serviceImpls) throws java.lang.IllegalArgumentException
Description copied from interface:ManifestContainerAdds a META-INF/services/ServiceInterfaceNameAssetrepresenting this service.- Specified by:
addAsServiceProviderin interfaceManifestContainer<T extends Archive<T>>- Parameters:
serviceInterface- The Service Interface class nameserviceImpls- The Service Interface Implementations class names- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if serviceInterface is null- See Also:
ManifestContainer.addAsServiceProvider(Class, Class...)
-
addAsServiceProviderAndClasses
public T addAsServiceProviderAndClasses(java.lang.Class<?> serviceInterface, java.lang.Class<?>... serviceImpls) throws java.lang.IllegalArgumentException
Description copied from interface:ServiceProviderContainerAdds a META-INF/services/ServiceInterfaceNameAssetand the classes related to the service to the archive.- Specified by:
addAsServiceProviderAndClassesin interfaceServiceProviderContainer<T extends Archive<T>>- Parameters:
serviceInterface- The Service Interface classserviceImpls- The Service Interface Implementations- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if serviceInterface is null
-
getResourcePath
protected abstract ArchivePath getResourcePath()
Should be implemented to set the path for Resource related resources.- Returns:
- Base Path for the ResourceContainer resources
-
addAsResource
public final T addAsResource(java.lang.String resourceName) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds 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.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- Parameters:
resourceName- resource to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If the resourceName is null- See Also:
ResourceContainer.addAsResource(Asset, ArchivePath)
-
addAsResource
public final T addAsResource(java.io.File resource) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds theFileas a resource to the container, returning the container itself.
TheFilewill be placed into the Container Library path underFile.getName().- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- Parameters:
resource-Fileresource to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If the resource is null- See Also:
ResourceContainer.addAsResource(Asset, ArchivePath)
-
addAsResource
public final T addAsResource(java.lang.String resourceName, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds the resource as a resource to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- 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:
java.lang.IllegalArgumentException- if resourceName is null- See Also:
ResourceContainer.addAsResource(Asset, ArchivePath)
-
addAsResource
public T addAsResource(java.io.File resource, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds theFileas a resource to the container, returning the container itself.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- 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:
java.lang.IllegalArgumentException- if resource is null- See Also:
ResourceContainer.addAsResource(Asset, ArchivePath)
-
addAsResource
public T addAsResource(java.net.URL resource, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds theURLas a resource to the container, returning the container itself.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- 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:
java.lang.IllegalArgumentException- if resource is null- See Also:
ResourceContainer.addAsResource(Asset, ArchivePath)
-
addAsResource
public T addAsResource(Asset resource, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds theAssetas a resource to the container, returning the container itself.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- 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:
java.lang.IllegalArgumentException- if resource is null- See Also:
ResourceContainer.addAsResource(Asset, ArchivePath)
-
addAsResource
public T addAsResource(java.lang.String resourceName, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds the resource with the specified name to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- Parameters:
resourceName- Name of theClassLoaderresource to addtarget- The target within the archive into which we'll place the resource- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If the target is null
-
addAsResource
public T addAsResource(java.lang.String resourceName, ArchivePath target, java.lang.ClassLoader classLoader) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds the resource as a resource to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- 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:
java.lang.IllegalArgumentException- if resourceName is null- See Also:
ResourceContainer.addAsResource(Asset, ArchivePath)
-
addAsResource
public T addAsResource(java.io.File resource, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds theFileas a resource to the container, returning the container itself.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- 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:
java.lang.IllegalArgumentException- if resource is null- See Also:
ResourceContainer.addAsResource(Asset, ArchivePath)
-
addAsResource
public T addAsResource(java.net.URL resource, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds theURLas a resource to the container, returning the container itself.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- 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:
java.lang.IllegalArgumentException- if resource is null- See Also:
ResourceContainer.addAsResource(Asset, ArchivePath)
-
addAsResource
public T addAsResource(Asset resource, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds theAssetas a resource to the container, returning the container itself.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- 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:
java.lang.IllegalArgumentException- if resource is null
-
addAsResources
public T addAsResources(java.lang.Package resourcePackage, java.lang.String... resourceNames) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds 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.- Specified by:
addAsResourcesin interfaceResourceContainer<T extends Archive<T>>- Parameters:
resourcePackage- The package of the resourcesresourceNames- The names of the resources inside resoucePackage- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourcePackage is null
-
addAsResource
public T addAsResource(java.lang.Package resourcePackage, java.lang.String resourceName) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds the resource as a resource to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsResourcein interfaceResourceContainer<T extends Archive<T>>- Parameters:
resourcePackage- The package of the resourceresourceName- The name of the resource inside resoucePackage- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourcePackage is null
-
addAsResource
public T addAsResource(java.lang.Package resourcePackage, java.lang.String resourceName, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds 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.- Specified by:
addAsResourcein 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:
java.lang.IllegalArgumentException- if resourcePackage is null
-
addAsResource
public T addAsResource(java.lang.Package resourcePackage, java.lang.String resourceName, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:ResourceContainerAdds 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.- Specified by:
addAsResourcein 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:
java.lang.IllegalArgumentException- if resourcePackage is null
-
getClassesPath
protected abstract ArchivePath getClassesPath()
Should be implemented to set the path for Class related resources.- Returns:
- Base Path for the ClassContainer resources
-
addClass
public T addClass(java.lang.Class<?> clazz) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainer- Specified by:
addClassin interfaceClassContainer<T extends Archive<T>>- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class were specified
-
addClass
public T addClass(java.lang.String fullyQualifiedClassName) throws java.lang.IllegalArgumentException
Adds theClass, and all member (inner)Classes, with the specified fully-qualified name, loaded by the Thread ContextClassLoader, to theArchive.- Specified by:
addClassin interfaceClassContainer<T extends Archive<T>>- Parameters:
fullyQualifiedClassName- The name of theClassto add- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class name was specified- See Also:
ClassContainer.addClass(java.lang.String)
-
addClass
public T addClass(java.lang.String fullyQualifiedClassName, java.lang.ClassLoader cl) throws java.lang.IllegalArgumentException
Adds theClass, and all member (inner) @link{Class}es, with the specified fully-qualified name, loaded by the specifiedClassLoader, to theArchive.- Specified by:
addClassin interfaceClassContainer<T extends Archive<T>>- Parameters:
fullyQualifiedClassName- The name of theClassto addcl- TheClassLoaderused to load the Class- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class name was specified- See Also:
ClassContainer.addClass(java.lang.String, java.lang.ClassLoader)
-
addClasses
public T addClasses(java.lang.Class<?>... classes) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainer- Specified by:
addClassesin interfaceClassContainer<T extends Archive<T>>- Parameters:
classes- The classes to add to the Archive- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no classes were specified
-
addPackage
public T addPackage(java.lang.Package pack) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainer- Specified by:
addPackagein interfaceClassContainer<T extends Archive<T>>- Parameters:
pack- ThePackageto add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If no package were specified- See Also:
ClassContainer.addPackages(boolean, Package...)
-
addPackages
public T addPackages(boolean recursive, java.lang.Package... packages) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainerAdds all classes in the specifiedPackages to theArchive.- Specified by:
addPackagesin interfaceClassContainer<T extends Archive<T>>- Parameters:
recursive- Should the sub packages be addedpackages- All the packages to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If no packages were specified- See Also:
ClassContainer.addPackages(boolean, Filter, Package...)
-
addPackages
public T addPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainerAdds all classes accepted by the filter in the specifiedPackages to theArchive.
TheArchivePathreturned to the filter is theArchivePathof the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Specified by:
addPackagesin 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:
java.lang.IllegalArgumentException- If no packages were specified
-
addPackages
private T addPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.ClassLoader cl, java.lang.Package... packages) throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
-
addPackage
public T addPackage(java.lang.String pack) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainer- Specified by:
addPackagein interfaceClassContainer<T extends Archive<T>>- Parameters:
pack- Package to add represented by a String ("my/package")- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If no package were specified- See Also:
ClassContainer.addPackages(boolean, Package...)
-
addDefaultPackage
public T addDefaultPackage()
Description copied from interface:ClassContainer- Specified by:
addDefaultPackagein interfaceClassContainer<T extends Archive<T>>- Returns:
- This virtual archive
-
addPackages
public T addPackages(boolean recursive, java.lang.String... packages) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainerAdds all classes in the specifiedPackages to theArchive.- Specified by:
addPackagesin 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:
java.lang.IllegalArgumentException- If no packages were specified- See Also:
ClassContainer.addPackages(boolean, Filter, Package...)
-
addPackages
public T addPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packageNames) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainerAdds all classes accepted by the filter in the specifiedPackages to theArchive.
TheArchivePathreturned to the filter is theArchivePathof the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Specified by:
addPackagesin 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:
java.lang.IllegalArgumentException- If no packages were specified
-
addPackages
private T addPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.ClassLoader classLoader, java.lang.String... packageNames)
-
addPackage
private void addPackage(boolean recursive, Filter<ArchivePath> filter, java.lang.ClassLoader classLoader, java.lang.String packageName)
-
deleteClass
public T deleteClass(java.lang.Class<?> clazz) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainer- Specified by:
deleteClassin interfaceClassContainer<T extends Archive<T>>- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class was specified
-
deleteClass
public T deleteClass(java.lang.String fullyQualifiedClassName) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainerDeletes theClass, and all member (inner)Classes, with the specified fully-qualified name, loaded by the Thread ContextClassLoader, from theArchive.- Specified by:
deleteClassin interfaceClassContainer<T extends Archive<T>>- Parameters:
fullyQualifiedClassName- The name of theClassto be deleted- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class name was specified
-
deleteClasses
public T deleteClasses(java.lang.Class<?>... classes) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainer- Specified by:
deleteClassesin interfaceClassContainer<T extends Archive<T>>- Parameters:
classes- The classes to be removed from theArchive- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no classes were specified
-
getInnerClasses
private java.util.Set<ArchivePath> getInnerClasses(ArchivePath path)
-
deletePackage
public T deletePackage(java.lang.Package pack) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainer- Specified by:
deletePackagein interfaceClassContainer<T extends Archive<T>>- Parameters:
pack- ThePackageto be deleted- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no package was specified- See Also:
ClassContainer.deletePackages(boolean, Package...)
-
deletePackage
public T deletePackage(java.lang.String pack) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainer- Specified by:
deletePackagein interfaceClassContainer<T extends Archive<T>>- Parameters:
pack- Package to be delete represented by a String ("my/package")- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no package was specified- See Also:
ClassContainer.deletePackages(boolean, Package...)
-
deleteDefaultPackage
public T deleteDefaultPackage()
Description copied from interface:ClassContainer- Specified by:
deleteDefaultPackagein interfaceClassContainer<T extends Archive<T>>- Returns:
- This archive
-
deletePackages
public T deletePackages(boolean recursive, java.lang.Package... packages) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainerDeletes all classes in the specifiedPackages from theArchive.- Specified by:
deletePackagesin interfaceClassContainer<T extends Archive<T>>- Parameters:
recursive- Should the sub packages be deleted?packages- All the packages to be deleted- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no packages were specified- See Also:
ClassContainer.deletePackages(boolean, Filter, Package...)
-
deletePackages
public T deletePackages(boolean recursive, java.lang.String... packages) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainerDelete all classes in the specifiedPackages from theArchive.- Specified by:
deletePackagesin 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:
java.lang.IllegalArgumentException- If no packages were specified- See Also:
ClassContainer.deletePackages(boolean, Filter, Package...)
-
deletePackages
public T deletePackages(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainerDeletes all classes accepted by the filter in the specifiedPackages from theArchive.
TheArchivePathreturned to the filter is theArchivePathof the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Specified by:
deletePackagesin 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:
java.lang.IllegalArgumentException- If no packages were specified or if no filter was specified
-
deletePackages
public T deletePackages(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packages) throws java.lang.IllegalArgumentException
Description copied from interface:ClassContainerDelete all classes accepted by the filter in the specifiedPackages from theArchive.
TheArchivePathreturned to the filter is theArchivePathof the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Specified by:
deletePackagesin 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:
java.lang.IllegalArgumentException- If no packages were specified or if no filter was specified
-
deletePackage
private void deletePackage(boolean recursive, Filter<ArchivePath> filter, java.lang.String packageName, java.lang.ClassLoader classLoader)
-
getLibraryPath
protected abstract ArchivePath getLibraryPath()
Should be implemented to set the path for Library related resources.- Returns:
- Base Path for the LibraryContainer resources
-
addAsLibrary
public T addAsLibrary(Archive<?> archive) throws java.lang.IllegalArgumentException
Add anotherArchiveto thisArchiveas a library to the container, returning the container itself.
TheArchivewill be placed into the Container Library path underArchive.getName().- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
archive-Archiveresource to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- ifArchiveis null- See Also:
LibraryContainer.addAsLibrary(org.jboss.shrinkwrap.api.Archive)
-
addAsLibrary
public T addAsLibrary(java.lang.String resourceName) throws java.lang.IllegalArgumentException
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.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resourceName- resource to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourceName is null- See Also:
LibraryContainer.addAsLibrary(java.lang.String)
-
addAsLibrary
public T addAsLibrary(java.io.File resource) throws java.lang.IllegalArgumentException
Adds theFileas a library to the container, returning the container itself.
TheFilewill be placed into the Container Library path underFile.getName().- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resource-Fileresource to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourceName is null- See Also:
LibraryContainer.addAsLibrary(java.io.File)
-
addAsLibrary
public T addAsLibrary(java.lang.String resourceName, java.lang.String target) throws java.lang.IllegalArgumentException
Adds the resource as a library to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resourceName- resource to addtarget- The target path within the archive in which to add the resource, relative to theArchives library path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourceName is null- See Also:
LibraryContainer.addAsLibrary(java.lang.String, java.lang.String)
-
addAsLibrary
public T addAsLibrary(java.io.File resource, java.lang.String target) throws java.lang.IllegalArgumentException
Adds theFileas a library to the container, returning the container itself.- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resource-Fileresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives library path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
LibraryContainer.addAsLibrary(java.io.File, java.lang.String)
-
addAsLibrary
public T addAsLibrary(java.net.URL resource, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:LibraryContainerAdds theURLas a library to the container, returning the container itself.- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resource-URLresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives library path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
LibraryContainer.addAsLibrary(Asset, ArchivePath)
-
addAsLibrary
public T addAsLibrary(Asset resource, java.lang.String target) throws java.lang.IllegalArgumentException
Description copied from interface:LibraryContainerAdds theAssetas a library to the container, returning the container itself.- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resource-Assetresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives library path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
LibraryContainer.addAsLibrary(Asset, ArchivePath)
-
addAsLibrary
public T addAsLibrary(java.lang.String resourceName, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:LibraryContainerAdds the resource as a library to the container, returning the container itself.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resourceName- resource to addtarget- The target path within the archive in which to add the resource, relative to theArchives library path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourceName is null- See Also:
LibraryContainer.addAsLibrary(Asset, ArchivePath)
-
addAsLibrary
public T addAsLibrary(java.io.File resource, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:LibraryContainerAdds theFileas a library to the container, returning the container itself.- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resource-Fileresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives library path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
LibraryContainer.addAsLibrary(Asset, ArchivePath)
-
addAsLibrary
public T addAsLibrary(java.net.URL resource, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:LibraryContainerAdds theURLas a library to the container, returning the container itself.- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resource-URLresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives library path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null- See Also:
LibraryContainer.addAsLibrary(Asset, ArchivePath)
-
addAsLibrary
public T addAsLibrary(Asset resource, ArchivePath target) throws java.lang.IllegalArgumentException
Description copied from interface:LibraryContainerAdds theAssetas a library to the container, returning the container itself.- Specified by:
addAsLibraryin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resource-Assetresource to addtarget- The target path within the archive in which to add the resource, relative to theArchives library path.- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resource is null
-
addAsLibraries
public T addAsLibraries(java.lang.String... resourceNames) throws java.lang.IllegalArgumentException
Description copied from interface:LibraryContainerAdd multiple resources to thisArchiveas 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.
TheClassLoaderused to obtain the resource is up to the implementation.- Specified by:
addAsLibrariesin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resourceNames- resources to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- if resourceNames are null or empty- See Also:
LibraryContainer.addAsLibrary(String)
-
addAsLibraries
public T addAsLibraries(java.io.File... resources) throws java.lang.IllegalArgumentException
Description copied from interface:LibraryContainerAdd multipleFileto thisArchiveas libraries to the container, returning the container itself.
TheFiles will be placed into the Container Library path underFile.getName().- Specified by:
addAsLibrariesin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
resources-Fileresources to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- ifFileresources are null or empty- See Also:
LibraryContainer.addAsLibrary(File)
-
addAsLibraries
public T addAsLibraries(Archive<?>... archives) throws java.lang.IllegalArgumentException
Description copied from interface:LibraryContainerAdd multipleArchives to thisArchiveas libraries to the container, returning the container itself.
TheArchives will be placed into the Container Library path underArchive.getName().- Specified by:
addAsLibrariesin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
archives-Archiveresources to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- ifArchiveresources are null- See Also:
LibraryContainer.addAsLibrary(Archive)
-
addAsLibraries
public T addAsLibraries(java.util.Collection<? extends Archive<?>> archives) throws java.lang.IllegalArgumentException
Add multipleArchives to thisArchiveas libraries to the container, returning the container itself.
TheArchives will be placed into the Container Library path underArchive.getName().- Specified by:
addAsLibrariesin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
archives-Archiveresources to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- ifCollectionof archives is null- See Also:
LibraryContainer.addAsLibraries(java.util.Collection)
-
addAsLibraries
public T addAsLibraries(Archive<?>[]... archives) throws java.lang.IllegalArgumentException
Add multipleArchives to thisArchiveas libraries to the container, returning the container itself.
TheArchives will be placed into the Container Library path underArchive.getName().- Specified by:
addAsLibrariesin interfaceLibraryContainer<T extends Archive<T>>- Parameters:
archives-Archiveresources to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- ifCollectionof archives is null- See Also:
LibraryContainer.addAsLibraries(java.util.Collection)
-
writeTo
public void writeTo(java.io.OutputStream outputStream, Formatter formatter) throws java.lang.IllegalArgumentException
-
covarientReturn
protected T covarientReturn()
-
getActualClass
protected java.lang.Class<T> getActualClass()
-
fileFromResource
private java.io.File fileFromResource(java.lang.String resourceName) throws java.lang.IllegalArgumentExceptionGets 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:
java.lang.IllegalArgumentException- if resourceName doesn't exist in the classpath or privileges are not granted
-
getArchiveClassLoaders
private java.lang.Iterable<java.lang.ClassLoader> getArchiveClassLoaders()
-
-