Class ContainerBase<T extends Archive<T>>

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  ContainerBase.GetTcclAction
      Obtains the Thread Context ClassLoader
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ContainerBase​(java.lang.Class<T> actualType, Archive<?> archive)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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.
      T add​(Asset asset, java.lang.String name)
      Adds the specified resource under the context denoted by the specified target
      T add​(Asset asset, java.lang.String target, java.lang.String name)
      Adds the specified asset under the specified target (directory) using the specified name.
      T add​(Asset asset, ArchivePath target)
      Adds the specified asset under the specified path into the target context
      T add​(Asset asset, ArchivePath path, java.lang.String name)
      Adds the specified asset under the specified target (directory) using the specified name.
      T add​(NamedAsset namedAsset)
      Adds the asset encapsulated within the specified NamedAsset under the encapsulated name and target (directory)
      T addAsDirectories​(java.lang.String... paths)
      Adds the specified directories.
      T addAsDirectories​(ArchivePath... paths)
      Adds the specified directories.
      T addAsDirectory​(java.lang.String path)
      Adds the specified directory.
      T addAsDirectory​(ArchivePath path)
      Adds the specified directory.
      T addAsLibraries​(java.io.File... resources)
      Add multiple File to this Archive as libraries to the container, returning the container itself.
      T addAsLibraries​(java.lang.String... resourceNames)
      Add multiple resources to this Archive as libraries to the container, returning the container itself.
      T addAsLibraries​(java.util.Collection<? extends Archive<?>> archives)
      Add multiple Archives to this Archive as libraries to the container, returning the container itself.
      T addAsLibraries​(Archive<?>... archives)
      Add multiple Archives to this Archive as libraries to the container, returning the container itself.
      T addAsLibraries​(Archive<?>[]... archives)
      Add multiple Archives to this Archive as libraries to the container, returning the container itself.
      T addAsLibrary​(java.io.File resource)
      Adds the File as a library to the container, returning the container itself.
      T addAsLibrary​(java.io.File resource, java.lang.String target)
      Adds the File as a library to the container, returning the container itself.
      T addAsLibrary​(java.io.File resource, ArchivePath target)
      Adds the File as a library to the container, returning the container itself.
      T addAsLibrary​(java.lang.String resourceName)
      Adds the resource as a library to the container, returning the container itself.
      T addAsLibrary​(java.lang.String resourceName, java.lang.String target)
      Adds the resource as a library to the container, returning the container itself.
      T addAsLibrary​(java.lang.String resourceName, ArchivePath target)
      Adds the resource as a library to the container, returning the container itself.
      T addAsLibrary​(java.net.URL resource, java.lang.String target)
      Adds the URL as a library to the container, returning the container itself.
      T addAsLibrary​(java.net.URL resource, ArchivePath target)
      Adds the URL as a library to the container, returning the container itself.
      T addAsLibrary​(Archive<?> archive)
      Add another Archive to this Archive as a library to the container, returning the container itself.
      T addAsLibrary​(Asset resource, java.lang.String target)
      Adds the Asset as a library to the container, returning the container itself.
      T addAsLibrary​(Asset resource, ArchivePath target)
      Adds the Asset as a library to the container, returning the container itself.
      T addAsManifestResource​(java.io.File resource)
      Adds the File as a Manifest resource to the container, returning the container itself.
      T addAsManifestResource​(java.io.File resource, java.lang.String target)
      Adds the File as a Manifest resource to the container, returning the container itself.
      T addAsManifestResource​(java.io.File resource, ArchivePath target)
      Adds the File as a Manifest resource to the container, returning the container itself.
      T addAsManifestResource​(java.lang.Package resourcePackage, java.lang.String resourceName)
      Adds the resource as a resource to the container, returning the container itself.
      T addAsManifestResource​(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.
      T addAsManifestResource​(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.
      T addAsManifestResource​(java.lang.String resourceName)
      Adds the resource as a Manifest resource to the container, returning the container itself.
      T addAsManifestResource​(java.lang.String resourceName, java.lang.String target)
      Adds the resource as a Manifest resource to the container, returning the container itself.
      T addAsManifestResource​(java.lang.String resourceName, ArchivePath target)
      Adds the resource as a Manifest resource to the container, returning the container itself.
      T addAsManifestResource​(java.net.URL resource, java.lang.String target)
      Adds the URL as a Manifest resource to the container, returning the container itself.
      T addAsManifestResource​(java.net.URL resource, ArchivePath target)
      Adds the URL as a Manifest resource to the container, returning the container itself.
      T addAsManifestResource​(Asset resource, java.lang.String target)
      Adds the Asset as a Manifest resource to the container, returning the container itself.
      T addAsManifestResource​(Asset resource, ArchivePath target)
      Adds the Asset as a Manifest resource to the container, returning the container itself.
      T addAsManifestResources​(java.lang.Package resourcePackage, java.lang.String... resourceNames)
      Adds the resources inside the package as multiple resources to the container, returning the container itself.
      T addAsResource​(java.io.File resource)
      Adds the File as a resource to the container, returning the container itself.
      T addAsResource​(java.io.File resource, java.lang.String target)
      Adds the File as a resource to the container, returning the container itself.
      T addAsResource​(java.io.File resource, ArchivePath target)
      Adds the File as a resource to the container, returning the container itself.
      T addAsResource​(java.lang.Package resourcePackage, java.lang.String resourceName)
      Adds the resource as a resource to the container, returning the container itself.
      T addAsResource​(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.
      T addAsResource​(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.
      T addAsResource​(java.lang.String resourceName)
      Adds the resource as a resource to the container, returning the container itself.
      T addAsResource​(java.lang.String resourceName, java.lang.String target)
      Adds the resource as a resource to the container, returning the container itself.
      T addAsResource​(java.lang.String resourceName, ArchivePath target)
      Adds the resource with the specified name to the container, returning the container itself.
      T addAsResource​(java.lang.String resourceName, ArchivePath target, java.lang.ClassLoader classLoader)
      Adds the resource as a resource to the container, returning the container itself.
      T addAsResource​(java.net.URL resource, java.lang.String target)
      Adds the URL as a resource to the container, returning the container itself.
      T addAsResource​(java.net.URL resource, ArchivePath target)
      Adds the URL as a resource to the container, returning the container itself.
      T addAsResource​(Asset resource, java.lang.String target)
      Adds the Asset as a resource to the container, returning the container itself.
      T addAsResource​(Asset resource, ArchivePath target)
      Adds the Asset as a resource to the container, returning the container itself.
      T addAsResources​(java.lang.Package resourcePackage, java.lang.String... resourceNames)
      Adds the resources inside the package as multiple resources to the container, returning the container itself.
      T addAsServiceProvider​(java.lang.Class<?> serviceInterface, java.lang.Class<?>... serviceImpls)
      Adds a META-INF/services/ServiceInterfaceName Asset representing this service.
      T addAsServiceProvider​(java.lang.String serviceInterface, java.lang.String... serviceImpls)
      Adds a META-INF/services/ServiceInterfaceName Asset representing this service.
      T addAsServiceProviderAndClasses​(java.lang.Class<?> serviceInterface, java.lang.Class<?>... serviceImpls)
      Adds a META-INF/services/ServiceInterfaceName Asset and the classes related to the service to the archive.
      T addClass​(java.lang.Class<?> clazz)
      Adds the Class, and all member (inner) Classes to the Archive.
      T addClass​(java.lang.String fullyQualifiedClassName)
      Adds the Class, and all member (inner) Classes, with the specified fully-qualified name, loaded by the Thread Context ClassLoader, to the Archive.
      T addClass​(java.lang.String fullyQualifiedClassName, java.lang.ClassLoader cl)
      Adds the Class, and all member (inner) @link{Class}es, with the specified fully-qualified name, loaded by the specified ClassLoader, to the Archive.
      T addClasses​(java.lang.Class<?>... classes)
      Adds the Classes, and all member (inner) Classes to the Archive.
      T addDefaultPackage()
      Adds all classes in the default Package to the Archive.
      T addHandlers​(ArchiveEventHandler... handlers)
      Add an array of listeners for call back based.
      T addManifest()
      Adds a default generated MANIFEST.MF manifest to the current archive.
      private T addNestedJarFileResource​(java.io.File resource, ArchivePath target, ArchivePath base)
      Adds the specified File resource (a nested JAR File form) to the current archive, returning the archive itself
      private void addPackage​(boolean recursive, Filter<ArchivePath> filter, java.lang.ClassLoader classLoader, java.lang.String packageName)  
      T addPackage​(java.lang.Package pack)
      Adds all classes in the specified Package to the Archive.
      T addPackage​(java.lang.String pack)
      Adds all classes in the specified Package to the Archive.
      T addPackages​(boolean recursive, java.lang.Package... packages)
      Adds all classes in the specified Packages to the Archive.
      T addPackages​(boolean recursive, java.lang.String... packages)
      Adds all classes in the specified Packages to the Archive.
      private T addPackages​(boolean recursive, Filter<ArchivePath> filter, java.lang.ClassLoader cl, java.lang.Package... packages)  
      private T addPackages​(boolean recursive, Filter<ArchivePath> filter, java.lang.ClassLoader classLoader, java.lang.String... packageNames)  
      T addPackages​(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages)
      Adds all classes accepted by the filter in the specified Packages to the Archive.
      T addPackages​(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packageNames)
      Adds all classes accepted by the filter in the specified Packages to the Archive.
      boolean contains​(java.lang.String path)
      Denotes whether this archive contains a resource at the specified path
      boolean contains​(ArchivePath path)
      Denotes whether this archive contains a resource at the specified path
      protected T covarientReturn()  
      Node delete​(java.lang.String archivePath)
      Removes the Node in the Archive at the ArchivePath indicated by the specified String archivePath.
      Node delete​(ArchivePath path)
      Removes the Node in the Archive at the specified ArchivePath.
      T deleteClass​(java.lang.Class<?> clazz)
      Deletes the Class, and all member (inner) Classes from the Archive.
      T deleteClass​(java.lang.String fullyQualifiedClassName)
      Deletes the Class, and all member (inner) Classes, with the specified fully-qualified name, loaded by the Thread Context ClassLoader, from the Archive.
      T deleteClasses​(java.lang.Class<?>... classes)
      Deletes the Classes, and all member (inner) Classes from the Archive.
      T deleteDefaultPackage()
      Deletes all classes in the default Package from the Archive.
      private void deletePackage​(boolean recursive, Filter<ArchivePath> filter, java.lang.String packageName, java.lang.ClassLoader classLoader)  
      T deletePackage​(java.lang.Package pack)
      Deletes all classes in the specified Package from the Archive.
      T deletePackage​(java.lang.String pack)
      Deletes all classes in the specified Package from the Archive.
      T deletePackages​(boolean recursive, java.lang.Package... packages)
      Deletes all classes in the specified Packages from the Archive.
      T deletePackages​(boolean recursive, java.lang.String... packages)
      Delete all classes in the specified Packages from the Archive.
      T deletePackages​(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages)
      Deletes all classes accepted by the filter in the specified Packages from the Archive.
      T deletePackages​(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packages)
      Delete all classes accepted by the filter in the specified Packages from the Archive.
      boolean equals​(java.lang.Object obj)
      private java.io.File fileFromResource​(java.lang.String resourceName)
      Gets a resource from the TCCL and returns its file path.
      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).
      Node get​(java.lang.String path)
      Obtains the Node located at the specified path
      Node get​(ArchivePath path)
      Obtains the Node located at the specified path
      protected java.lang.Class<T> getActualClass()  
      private java.lang.Iterable<java.lang.ClassLoader> getArchiveClassLoaders()  
      ArchiveFormat getArchiveFormat()  
      <X extends Archive<X>>
      X
      getAsType​(java.lang.Class<X> type, java.lang.String path)
      Get a nested Archive as a specific type.

      The found Archives must have been added as a Archive, no import is performed.
      <X extends Archive<X>>
      X
      getAsType​(java.lang.Class<X> type, java.lang.String path, ArchiveFormat archiveCompression)
      Get a nested Archive as a specific type using the specify ArchiveFormat
      <X extends Archive<X>>
      X
      getAsType​(java.lang.Class<X> type, ArchivePath path)
      Get a nested Archive as a specific type.

      The found Archives must have been added as a Archive, no import is performed.
      <X extends Archive<X>>
      X
      getAsType​(java.lang.Class<X> type, ArchivePath path, ArchiveFormat archiveCompression)
      Get a nested Archive located in a ArchivePath as a specific type using the specify ArchiveFormat
      <X extends Archive<X>>
      java.util.Collection<X>
      getAsType​(java.lang.Class<X> type, Filter<ArchivePath> filter)
      Get all nested Archive 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>>
      java.util.Collection<X>
      getAsType​(java.lang.Class<X> type, Filter<ArchivePath> filter, ArchiveFormat archiveCompression)
      Get all nested Archive matching the filter as a specific type using the specify ArchiveFormat.
      protected abstract ArchivePath getClassesPath()
      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.String getId()
      Obtains a globally-unique identifier for this Archive
      private java.util.Set<ArchivePath> getInnerClasses​(ArchivePath path)  
      protected abstract ArchivePath getLibraryPath()
      Should be implemented to set the path for Library related resources.
      protected abstract ArchivePath getManifestPath()
      Should be implemented to set the path for Manifest related resources.
      java.lang.String getName()
      Obtains the name of this archive (ie.
      protected abstract ArchivePath getResourcePath()
      Should be implemented to set the path for Resource related resources.
      int hashCode()
      T merge​(Archive<?> source)
      Merge the contents from an existing archive without maintaining the archive name in the context path.
      T merge​(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.
      T merge​(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.
      T 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.
      T 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.
      T merge​(Archive<?> source, Filter<ArchivePath> filter)
      Merge the contents from an existing archive without maintaining the archive name in the context path.
      T move​(java.lang.String source, java.lang.String target)
      Moves the asset under the source path to the target path.
      T move​(ArchivePath source, ArchivePath target)
      Moves the asset under the source path to the target path.
      private java.lang.String resourceAdjustedPath​(java.io.File resource)  
      T setManifest​(java.io.File resource)
      Adds the File as MANIFEST.FM to the container, returning the container itself.
      T setManifest​(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.
      T setManifest​(java.lang.String resourceName)
      Adds the resource as MANIFEST.FM to the container, returning the container itself.
      T setManifest​(java.net.URL resource)
      Adds the URL as MANIFEST.FM to the container, returning the container itself.
      T setManifest​(Asset resource)
      Adds the Asset as MANIFEST.FM to the container, returning the container itself.
      Archive<T> shallowCopy()
      Creates a shallow copy of this Archive.
      Archive<T> shallowCopy​(Filter<ArchivePath> filter)
      Creates a shallow copy of this Archive based on given filter.Assets from this archive are made available under the same paths.
      java.lang.String toString()
      Acts as a shorthand for Archive.toString(Formatter) where the Formatters.SIMPLE is leveraged.
      java.lang.String toString​(boolean verbose)
      If "true" is specified, acts as a shorthand for Archive.toString(Formatter) where the Formatters.VERBOSE is leveraged.
      java.lang.String toString​(Formatter formatter)
      Returns a view of this Archive as returned from the specified Formatter.
      void writeTo​(java.io.OutputStream outputStream, Formatter formatter)
      Prints the content of this Archive to the specified OutputStream on the format defined by the specified Formatter.
      • 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
      • actualType

        private final java.lang.Class<T extends Archive<T>> actualType
        The exposed archive type.
    • Constructor Detail

      • ContainerBase

        protected ContainerBase​(java.lang.Class<T> actualType,
                                Archive<?> archive)
    • Method Detail

      • 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:
        add in interface Archive<T extends Archive<T>>
        target - The context directory under which to add the asset
        name - 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 specified NamedAsset under the encapsulated name and target (directory)
        Specified by:
        add in interface Archive<T extends Archive<T>>
        Returns:
      • addAsDirectories

        public T addAsDirectories​(java.lang.String... paths)
                           throws java.lang.IllegalArgumentException
        Adds the specified directories.
        Specified by:
        addAsDirectories in interface Archive<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​(java.lang.String path)
                         throws java.lang.IllegalArgumentException
        Adds the specified directory.
        Specified by:
        addAsDirectory in interface Archive<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:
        addHandlers in interface Archive<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.
        Specified by:
        merge in interface Archive<T extends Archive<T>>
        Parameters:
        source - Archive to add contents from
        Returns:
        Throws:
        java.lang.IllegalArgumentException - If the existing archive is not specified
        See Also:
        Archive.merge(org.jboss.shrinkwrap.api.Archive)
      • 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:
        merge in interface Archive<T extends Archive<T>>
        Parameters:
        source - Archive to add contents from
        path - 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​(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:
        move in interface Archive<T extends Archive<T>>
        Parameters:
        source - The context under which to remove the assets
        target - 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 specified
        IllegalArchivePathException - If the source path is invalid.
        See Also:
        Archive.move(java.lang.String, java.lang.String)
      • contains

        public boolean contains​(java.lang.String path)
                         throws java.lang.IllegalArgumentException
        Denotes whether this archive contains a resource at the specified path
        Specified by:
        contains in interface Archive<T extends Archive<T>>
        Returns:
        Throws:
        java.lang.IllegalArgumentException - If the path is not specified
        See Also:
        Archive.contains(java.lang.String)
      • get

        public Node get​(java.lang.String path)
                 throws java.lang.IllegalArgumentException
        Obtains the Node located at the specified path
        Specified by:
        get in interface Archive<T extends Archive<T>>
        Returns:
        The Node, or null if nothing is found at the Path
        Throws:
        java.lang.IllegalArgumentException - If the path is not specified
        See Also:
        Archive.get(java.lang.String)
      • getAsType

        public <X extends Archive<X>> X getAsType​(java.lang.Class<X> type,
                                                  java.lang.String path)
        Get a nested Archive as a specific type.

        The found Archives must have been added as a Archive, no import is performed.
        Specified by:
        getAsType in interface Archive<T extends Archive<T>>
        Parameters:
        type - The Type to return the Archive as
        path - The location of the Archive
        Returns:
        The found Archive as given type or null if none found at given path
        See Also:
        Archive.getAsType(java.lang.Class, java.lang.String)
      • shallowCopy

        public Archive<T> shallowCopy()
        Creates a shallow copy of this Archive. 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 interface Archive<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 this Archive 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 interface Archive<T extends Archive<T>>
        Returns:
        a new archive with a copy of the pointers to the assets
        See Also:
        Archive.shallowCopy(Filter)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.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.
        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        setManifest in interface ManifestContainer<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 the File as MANIFEST.FM to the container, returning the container itself.
        Specified by:
        setManifest in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resource - File resource 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 the URL as MANIFEST.FM to the container, returning the container itself.
        Specified by:
        setManifest in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resource - URL resource 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​(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.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        setManifest in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resourcePackage - The package of the resource
        resourceName - 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.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsManifestResource in interface ManifestContainer<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 the File as a Manifest resource to the container, returning the container itself.
        The File will be placed into the Container Manifest path under File.getName().
        Specified by:
        addAsManifestResource in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resource - resource to add
        Returns:
        This virtual archive
        Throws:
        java.lang.IllegalArgumentException - if File resource 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.
        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsManifestResource in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resourceName - resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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 the File as a Manifest resource to the container, returning the container itself.
        Specified by:
        addAsManifestResource in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resource - File resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: ManifestContainer
        Adds the URL as a Manifest resource to the container, returning the container itself.
        Specified by:
        addAsManifestResource in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resource - URL resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: ManifestContainer
        Adds the resource as a Manifest resource to the container, returning the container itself.
        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsManifestResource in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resourceName - resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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 specified File resource (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​(Asset resource,
                                       ArchivePath target)
                                throws java.lang.IllegalArgumentException
        Description copied from interface: ManifestContainer
        Adds the Asset as a Manifest resource to the container, returning the container itself.
        Specified by:
        addAsManifestResource in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resource - Asset resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: ManifestContainer
        Adds the resources inside the package as multiple resources to the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsManifestResources in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resourcePackage - The package of the resources
        resourceNames - 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: ManifestContainer
        Adds the resource as a resource to the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsManifestResource in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resourcePackage - The package of the resource
        resourceName - 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: ManifestContainer
        Adds the resource as a resource to a specific path inside the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsManifestResource in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resourcePackage - The package of the resource
        resourceName - The name of the resource inside resoucePackage
        target - The target location inside the container
        Returns:
        This virtual archive
        Throws:
        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: ManifestContainer
        Adds the resource as a resource to a specific path inside the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsManifestResource in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        resourcePackage - The package of the resource
        resourceName - The name of the resource inside resoucePackage
        target - The target location inside the container
        Returns:
        This virtual archive
        Throws:
        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:
        addManifest in interface ManifestContainer<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: ManifestContainer
        Adds a META-INF/services/ServiceInterfaceName Asset representing this service. Warning: this method does not add the specified classes to the archive.
        Specified by:
        addAsServiceProvider in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        serviceInterface - The Service Interface class
        serviceImpls - 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: ManifestContainer
        Adds a META-INF/services/ServiceInterfaceName Asset representing this service.
        Specified by:
        addAsServiceProvider in interface ManifestContainer<T extends Archive<T>>
        Parameters:
        serviceInterface - The Service Interface class name
        serviceImpls - 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: ServiceProviderContainer
        Adds a META-INF/services/ServiceInterfaceName Asset and the classes related to the service to the archive.
        Specified by:
        addAsServiceProviderAndClasses in interface ServiceProviderContainer<T extends Archive<T>>
        Parameters:
        serviceInterface - The Service Interface class
        serviceImpls - 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: 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.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResource in interface ResourceContainer<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: ResourceContainer
        Adds the File as a resource to the container, returning the container itself.
        The File will be placed into the Container Library path under File.getName().
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resource - File resource 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: ResourceContainer
        Adds the resource as a resource to the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resourceName - resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives resource path.
        Returns:
        This virtual archive
        Throws:
        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: ResourceContainer
        Adds the File as a resource to the container, returning the container itself.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resource - File resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives resource path.
        Returns:
        This virtual archive
        Throws:
        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: ResourceContainer
        Adds the URL as a resource to the container, returning the container itself.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resource - URL resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives resource path.
        Returns:
        This virtual archive
        Throws:
        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: ResourceContainer
        Adds the Asset as a resource to the container, returning the container itself.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resource - Asset resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives resource path.
        Returns:
        This virtual archive
        Throws:
        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: ResourceContainer
        Adds the resource with the specified name to the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resourceName - Name of the ClassLoader resource to add
        target - 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: ResourceContainer
        Adds the resource as a resource to the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resourceName - resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives resource path.
        Returns:
        This virtual archive
        Throws:
        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: ResourceContainer
        Adds the File as a resource to the container, returning the container itself.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resource - File resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives resource path.
        Returns:
        This virtual archive
        Throws:
        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: ResourceContainer
        Adds the URL as a resource to the container, returning the container itself.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resource - URL resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives resource path.
        Returns:
        This virtual archive
        Throws:
        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: ResourceContainer
        Adds the Asset as a resource to the container, returning the container itself.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resource - Asset resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives resource path.
        Returns:
        This virtual archive
        Throws:
        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: ResourceContainer
        Adds the resources inside the package as multiple resources to the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResources in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resourcePackage - The package of the resources
        resourceNames - 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: ResourceContainer
        Adds the resource as a resource to the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resourcePackage - The package of the resource
        resourceName - 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: ResourceContainer
        Adds the resource as a resource to a specific path inside the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resourcePackage - The package of the resource
        resourceName - The name of the resource inside resoucePackage
        target - The target location inside the container
        Returns:
        This virtual archive
        Throws:
        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: ResourceContainer
        Adds the resource as a resource to a specific path inside the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResource in interface ResourceContainer<T extends Archive<T>>
        Parameters:
        resourcePackage - The package of the resource
        resourceName - The name of the resource inside resoucePackage
        target - The target location inside the container
        Returns:
        This virtual archive
        Throws:
        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
        Adds the Class, and all member (inner) Classes to the Archive.
        Specified by:
        addClass in interface ClassContainer<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 the Class, and all member (inner) Classes, with the specified fully-qualified name, loaded by the Thread Context ClassLoader, to the Archive.
        Specified by:
        addClass in interface ClassContainer<T extends Archive<T>>
        Parameters:
        fullyQualifiedClassName - The name of the Class to 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 the Class, and all member (inner) @link{Class}es, with the specified fully-qualified name, loaded by the specified ClassLoader, to the Archive.
        Specified by:
        addClass in interface ClassContainer<T extends Archive<T>>
        Parameters:
        fullyQualifiedClassName - The name of the Class to add
        cl - The ClassLoader used 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
        Adds the Classes, and all member (inner) Classes to the Archive.
        Specified by:
        addClasses in interface ClassContainer<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
        Adds all classes in the specified Package to the Archive.
        SubPackages are excluded.
        Specified by:
        addPackage in interface ClassContainer<T extends Archive<T>>
        Parameters:
        pack - The Package to 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: ClassContainer
        Adds all classes in the specified Packages to the Archive.
        Specified by:
        addPackages in interface ClassContainer<T extends Archive<T>>
        Parameters:
        recursive - Should the sub packages be added
        packages - 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: ClassContainer
        Adds all classes accepted by the filter in the specified Packages to the Archive.
        The ArchivePath returned to the filter is the ArchivePath 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 interface ClassContainer<T extends Archive<T>>
        Parameters:
        recursive - Should the sub packages be added
        filter - filter out specific classes
        packages - 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
        Adds all classes in the specified Package to the Archive.
        SubPackages are excluded.
        Specified by:
        addPackage in interface ClassContainer<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...)
      • addPackages

        public T addPackages​(boolean recursive,
                             java.lang.String... packages)
                      throws java.lang.IllegalArgumentException
        Description copied from interface: ClassContainer
        Adds all classes in the specified Packages to the Archive.
        Specified by:
        addPackages in interface ClassContainer<T extends Archive<T>>
        Parameters:
        recursive - Should the sub packages be added
        packages - 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: ClassContainer
        Adds all classes accepted by the filter in the specified Packages to the Archive.
        The ArchivePath returned to the filter is the ArchivePath 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 interface ClassContainer<T extends Archive<T>>
        Parameters:
        recursive - Should the sub packages be added
        filter - filter out specific classes
        packageNames - 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
        Deletes the Class, and all member (inner) Classes from the Archive.
        Specified by:
        deleteClass in interface ClassContainer<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: ClassContainer
        Deletes the Class, and all member (inner) Classes, with the specified fully-qualified name, loaded by the Thread Context ClassLoader, from the Archive.
        Specified by:
        deleteClass in interface ClassContainer<T extends Archive<T>>
        Parameters:
        fullyQualifiedClassName - The name of the Class to 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
        Deletes the Classes, and all member (inner) Classes from the Archive.
        Specified by:
        deleteClasses in interface ClassContainer<T extends Archive<T>>
        Parameters:
        classes - The classes to be removed from the Archive
        Returns:
        This archive
        Throws:
        java.lang.IllegalArgumentException - If no classes were specified
      • deletePackage

        public T deletePackage​(java.lang.String pack)
                        throws java.lang.IllegalArgumentException
        Description copied from interface: ClassContainer
        Deletes all classes in the specified Package from the Archive.
        SubPackages are excluded.
        Specified by:
        deletePackage in interface ClassContainer<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...)
      • deletePackages

        public T deletePackages​(boolean recursive,
                                java.lang.Package... packages)
                         throws java.lang.IllegalArgumentException
        Description copied from interface: ClassContainer
        Deletes all classes in the specified Packages from the Archive.
        Specified by:
        deletePackages in interface ClassContainer<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: ClassContainer
        Delete all classes in the specified Packages from the Archive.
        Specified by:
        deletePackages in interface ClassContainer<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: ClassContainer
        Deletes all classes accepted by the filter in the specified Packages from the Archive.
        The ArchivePath returned to the filter is the ArchivePath 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 interface ClassContainer<T extends Archive<T>>
        Parameters:
        recursive - Should the sub packages be deleted?
        filter - filter out specific classes
        packages - 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: ClassContainer
        Delete all classes accepted by the filter in the specified Packages from the Archive.
        The ArchivePath returned to the filter is the ArchivePath 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 interface ClassContainer<T extends Archive<T>>
        Parameters:
        recursive - Should the sub packages be deleted?
        filter - filter out specific classes
        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 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​(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.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsLibrary in interface LibraryContainer<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 the File as a library to the container, returning the container itself.
        The File will be placed into the Container Library path under File.getName().
        Specified by:
        addAsLibrary in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resource - File resource 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.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsLibrary in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resourceName - resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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 the File as a library to the container, returning the container itself.
        Specified by:
        addAsLibrary in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resource - File resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: LibraryContainer
        Adds the URL as a library to the container, returning the container itself.
        Specified by:
        addAsLibrary in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resource - URL resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: LibraryContainer
        Adds the Asset as a library to the container, returning the container itself.
        Specified by:
        addAsLibrary in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resource - Asset resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: LibraryContainer
        Adds the resource as a library to the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsLibrary in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resourceName - resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: LibraryContainer
        Adds the File as a library to the container, returning the container itself.
        Specified by:
        addAsLibrary in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resource - File resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: LibraryContainer
        Adds the URL as a library to the container, returning the container itself.
        Specified by:
        addAsLibrary in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resource - URL resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: LibraryContainer
        Adds the Asset as a library to the container, returning the container itself.
        Specified by:
        addAsLibrary in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resource - Asset resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives 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: LibraryContainer
        Add multiple resources to this Archive 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.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsLibraries in interface LibraryContainer<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: LibraryContainer
        Add multiple File to this Archive as libraries to the container, returning the container itself.
        The Files will be placed into the Container Library path under File.getName().
        Specified by:
        addAsLibraries in interface LibraryContainer<T extends Archive<T>>
        Parameters:
        resources - File resources to add
        Returns:
        This virtual archive
        Throws:
        java.lang.IllegalArgumentException - if File resources are null or empty
        See Also:
        LibraryContainer.addAsLibrary(File)
      • writeTo

        public void writeTo​(java.io.OutputStream outputStream,
                            Formatter formatter)
                     throws java.lang.IllegalArgumentException
        Prints the content of this Archive to the specified OutputStream on the format defined by the specified Formatter. The caller is responsible for opening, flushing and eventually closing the stream.
        Specified by:
        writeTo in interface Archive<T extends Archive<T>>
        Parameters:
        outputStream - the stream to print the archive contents to
        formatter - the output format
        Throws:
        java.lang.IllegalArgumentException - if an exceptions occur when writing the archive contents.
      • covarientReturn

        protected T covarientReturn()
      • getActualClass

        protected java.lang.Class<T> getActualClass()
      • fileFromResource

        private java.io.File fileFromResource​(java.lang.String resourceName)
                                       throws java.lang.IllegalArgumentException
        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:
        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()