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

All Superinterfaces:
Assignable
All Known Subinterfaces:
EnterpriseArchive, JavaArchive, ResourceAdapterArchive, WebArchive

public interface Archive<T extends Archive<T>>
extends Assignable

Archive Represents a collection of resources which may be constructed declaratively / programmatically.

Version:
$Revision: $
Author:
ALR

Method Summary
 T add(Archive<?> archive, Path path)
          Add an archive under a specific context and maintain the archive name as context path.
 T add(Asset asset, Path target)
          Adds the specified asset under the specified path into the target context
 T add(Asset asset, Path target, String name)
          Adds the specified asset under the specified target (directory) using the specified name.
 T add(Asset asset, String target)
          Adds the specified resource under the context denoted by the specified target
 boolean contains(Path path)
          Denotes whether this archive contains a resource at the specified path
 boolean delete(Path path)
          Removes the asset in the archive at the specified Path.
 Asset get(Path path)
          Obtains the asset located at the specified path
 Asset get(String path)
          Obtains the asset located at the specified path
 Map<Path,Asset> getContent()
          Obtains all assets in this archive, along with its respective Path.
 Map<Path,Asset> getContent(Filter<Path> filter)
          Obtains all assets matching given filter in this archive, along with its respective Path.
 String getName()
          Obtains the name of this archive (ie. myLibrary.jar)
 T merge(Archive<?> source)
          Merge the contents from an existing archive without maintaining the archive name in the context path.
 T merge(Archive<?> source, Filter<Path> filter)
          Merge the contents from an existing archive without maintaining the archive name in the context path.
 T merge(Archive<?> source, Path 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, Path path, Filter<Path> filter)
          Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.
 String toString()
          Acts as a shorthand for toString(Formatter) where the SimpleFormatter is leveraged.
 String toString(boolean verbose)
          If "true" is specified, acts as a shorthand for toString(Formatter) where the VerboseFormatter is leveraged.
 String toString(Formatter formatter)
          Returns a view of this Archive as returned from the specified Formatter.
 
Methods inherited from interface org.jboss.shrinkwrap.api.Assignable
as
 

Method Detail

getName

String getName()
Obtains the name of this archive (ie. myLibrary.jar)


add

T add(Asset asset,
      Path target)
                         throws IllegalArgumentException
Adds the specified asset under the specified path into the target context

Parameters:
target - The context under which to add the assets
asset -
Returns:
Throws:
IllegalArgumentException - If no target or assets were specified

add

T add(Asset asset,
      Path target,
      String name)
                         throws 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.

Parameters:
target - The context directory under which to add the asset
name - The name to assign the assent under the target namespace
asset -
Returns:
Throws:
IllegalArgumentException - If the target, name, or asset was not specified

add

T add(Asset asset,
      String target)
                         throws IllegalArgumentException
Adds the specified resource under the context denoted by the specified target

Parameters:
target -
asset -
Returns:
Throws:
IllegalArgumentException - If either the target or asset is not specified

get

Asset get(Path path)
          throws IllegalArgumentException
Obtains the asset located at the specified path

Parameters:
path -
Returns:
The asset, or null if nothing is found at the Path
Throws:
IllegalArgumentException - If the path is not specified

get

Asset get(String path)
          throws IllegalArgumentException
Obtains the asset located at the specified path

Parameters:
path -
Returns:
The asset, or null if nothing is found at the Path
Throws:
IllegalArgumentException - If the path is not specified

contains

boolean contains(Path path)
                 throws IllegalArgumentException
Denotes whether this archive contains a resource at the specified path

Parameters:
path -
Returns:
Throws:
IllegalArgumentException - If the path is not specified

delete

boolean delete(Path path)
               throws IllegalArgumentException
Removes the asset in the archive at the specified Path. If the path is a directory, recursively removes all contents.

Parameters:
path -
Returns:
Whether or not a deletion was made
Throws:
IllegalArgumentException

getContent

Map<Path,Asset> getContent()
Obtains all assets in this archive, along with its respective Path. The returned Map will be an immutable view.

Returns:

getContent

Map<Path,Asset> getContent(Filter<Path> filter)
Obtains all assets matching given filter in this archive, along with its respective Path. The returned Map will be an immutable view.

Returns:

add

T add(Archive<?> archive,
      Path path)
                         throws IllegalArgumentException
Add an archive under a specific context and maintain the archive name as context path.

Parameters:
path - to use
archive - to add
Returns:
Throws:
IllegalArgumentException - If the path or archive are not specified

merge

T merge(Archive<?> source)
                           throws IllegalArgumentException
Merge the contents from an existing archive without maintaining the archive name in the context path.

Parameters:
source - Archive to add contents from
Returns:
Throws:
IllegalArgumentException - If the existing archive is not specified

merge

T merge(Archive<?> source,
        Filter<Path> filter)
                           throws IllegalArgumentException
Merge the contents from an existing archive without maintaining the archive name in the context path. The filter control which Paths to include form the source Archive.

Parameters:
source - Archive to add contents from
Returns:
Throws:
IllegalArgumentException - If the existing archive is not specified

merge

T merge(Archive<?> source,
        Path path)
                           throws IllegalArgumentException
Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path.

Parameters:
source - Archive to add contents from
path - Path to add contents to
Returns:
Throws:
IllegalArgumentException - If the path or existing archive is not specified

merge

T merge(Archive<?> source,
        Path path,
        Filter<Path> filter)
                           throws IllegalArgumentException
Merge the contents from an existing archive in a specific path without maintaining the archive name in the context path. The filter control which Paths to include form the source Archive.

Parameters:
source - Archive to add contents from
path - Path to add contents to
filter - Filter to use for including Assets in the merge.
Returns:
Throws:
IllegalArgumentException - If the path or existing archive is not specified

toString

String toString()
Acts as a shorthand for toString(Formatter) where the SimpleFormatter is leveraged.

Overrides:
toString in class Object
Returns:

toString

String toString(boolean verbose)
If "true" is specified, acts as a shorthand for toString(Formatter) where the VerboseFormatter is leveraged. Otherwise the SimpleFormatter will be used (equivalent to toString()).

Returns:

toString

String toString(Formatter formatter)
                throws IllegalArgumentException
Returns a view of this Archive as returned from the specified Formatter. Common options may be to use the predefined formatters located in Formatters

Parameters:
formatter -
Returns:
Throws:
IllegalArgumentException - If the formatter is not specified


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