|
ShrinkWrap API 1.1.0-alpha-1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Archive<T extends Archive<T>>
Represents a collection of resources which may be constructed programmatically. In effect this represents a virtual
filesystem.
All Archive types support the addition of Nodes under a designated ArchivePath (context). The
contents of a Node are either a directory or Asset.
Archives are generally created via an ArchiveFactory or via the default configuration shortcut
ShrinkWrap utility class.
Because Archives are Assignable, they may be wrapped in another user "view" used to perform
operations like adding JavaEE Spec-specific resources or exporting in ZIP format.
| Method Summary | ||
|---|---|---|
T |
add(Archive<?> archive,
ArchivePath path,
Class<? extends StreamExporter> exporter)
Add an archive under a specific context and maintain the archive name as context path. |
|
T |
add(Archive<?> archive,
String path,
Class<? extends StreamExporter> exporter)
Add an archive under a specific context and maintain the archive name as context path. |
|
T |
add(Asset asset,
ArchivePath target)
Adds the specified asset under the specified path into the target context |
|
T |
add(Asset asset,
ArchivePath 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 |
|
T |
add(Asset asset,
String target,
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(ArchivePath... paths)
Adds the specified directories. |
|
T |
addAsDirectories(String... paths)
Adds the specified directories. |
|
T |
addAsDirectory(ArchivePath path)
Adds the specified directory. |
|
T |
addAsDirectory(String path)
Adds the specified directory. |
|
T |
addHandlers(ArchiveEventHandler... handlers)
Add an array of listeners for call back based. |
|
boolean |
contains(ArchivePath path)
Denotes whether this archive contains a resource at the specified path |
|
boolean |
contains(String path)
Denotes whether this archive contains a resource at the specified path |
|
Node |
delete(ArchivePath path)
Removes the Node in the Archive at the specified ArchivePath. |
|
Node |
delete(String archivePath)
Removes the Node in the Archive at the ArchivePath indicated by the specified String
archivePath. |
|
Node |
get(ArchivePath path)
Obtains the Node located at the specified path |
|
Node |
get(String path)
Obtains the Node located at the specified path |
|
|
getAsType(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. |
|
|
getAsType(Class<X> type,
ArchivePath path,
ArchiveFormat archiveFormat)
Get a nested Archive located in a ArchivePath as a specific type using the specify
ArchiveFormat |
|
|
getAsType(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. |
|
|
getAsType(Class<X> type,
Filter<ArchivePath> filter,
ArchiveFormat archiveFormat)
Get all nested Archive matching the filter as a specific type using the specify ArchiveFormat. |
|
|
getAsType(Class<X> type,
String path)
Get a nested Archive as a specific type.The found Archives must have been added as a Archive, no import is performed. |
|
|
getAsType(Class<X> type,
String path,
ArchiveFormat archiveFormat)
Get a nested Archive as a specific type using the specify ArchiveFormat |
|
Map<ArchivePath,Node> |
getContent()
Obtains all assets in this archive, along with their respective paths. |
|
Map<ArchivePath,Node> |
getContent(Filter<ArchivePath> filter)
Obtains all assets matching given filter in this archive, along with its respective Path. |
|
String |
getName()
Obtains the name of this archive (ie. |
|
T |
merge(Archive<?> source)
Merge the contents from an existing archive 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 |
merge(Archive<?> source,
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,
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 |
move(ArchivePath source,
ArchivePath target)
Moves the asset under the source path to the target path. |
|
T |
move(String source,
String target)
Moves the asset under the source path to the target path. |
|
Archive<T> |
shallowCopy()
Creates a shallow copy of this Archive. |
|
String |
toString()
Acts as a shorthand for toString(Formatter) where the Formatters.SIMPLE is leveraged. |
|
String |
toString(boolean verbose)
If "true" is specified, acts as a shorthand for toString(Formatter) where the
Formatters.VERBOSE is leveraged. |
|
String |
toString(Formatter formatter)
Returns a view of this Archive as returned from the specified Formatter. |
|
void |
writeTo(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 interface org.jboss.shrinkwrap.api.Assignable |
|---|
as |
| Method Detail |
|---|
String getName()
T add(Asset asset,
ArchivePath target)
throws IllegalArgumentException
target - The context under which to add the assetsasset -
IllegalArgumentException - If no target or assets were specified
IllegalArchivePathException - If the target is invalid.
T add(Asset asset,
ArchivePath target,
String name)
throws IllegalArgumentException
target - The context directory under which to add the assetname - The name to assign the assent under the target namespaceasset -
IllegalArgumentException - If the target, name, or asset was not specified
IllegalArchivePathException - If the target is invalid.
T add(Asset asset,
String target,
String name)
throws IllegalArgumentException
target - The context directory under which to add the assetname - The name to assign the assent under the target namespaceasset -
IllegalArgumentException - If the target, name, or asset was not specified
IllegalArchivePathException - If the target is invalid.
T add(NamedAsset namedAsset)
throws IllegalArgumentException
NamedAsset under the encapsulated name and target
(directory)
namedAsset -
IllegalArgumentException - If either the target or asset is not specified
IllegalArchivePathException - If the target is invalid.
T add(Asset asset,
String target)
throws IllegalArgumentException
target - asset -
IllegalArgumentException - If either the target or asset is not specified
IllegalArchivePathException - If the target is invalid.
T addAsDirectory(String path)
throws IllegalArgumentException
path - The path to add
IllegalArgumentException - If no path was specified
IllegalArchivePathException - If the path is invalid.
T addAsDirectories(String... paths)
throws IllegalArgumentException
paths - The paths to add
IllegalArgumentException - If no paths were specified
IllegalArchivePathException - If at least one path is invalid.
T addAsDirectory(ArchivePath path)
throws IllegalArgumentException
path - The path to add
IllegalArgumentException - If no path was specified
IllegalArchivePathException - If the path is invalid.
T addAsDirectories(ArchivePath... paths)
throws IllegalArgumentException
paths - The paths to add
IllegalArgumentException - If no paths were specified
IllegalArchivePathException - If at least one path is invalid.T addHandlers(ArchiveEventHandler... handlers)
listener - CallBack on add
Node get(ArchivePath path)
throws IllegalArgumentException
Node located at the specified path
path -
Node, or null if nothing is found at the specified path
IllegalArgumentException - If the path is not specified
Node get(String path)
throws IllegalArgumentException
Node located at the specified path
path -
Node, or null if nothing is found at the Path
IllegalArgumentException - If the path is not specified
<X extends Archive<X>> X getAsType(Class<X> type,
String path)
Archive as a specific type.
X - type - The Type to return the Archive aspath - The location of the Archive
IllegalArgumentException - if found Asset is not pointing to a ArchivegetAsType(Class, ArchivePath),
add(Archive, ArchivePath, Class),
add(Archive, String, Class)
<X extends Archive<X>> X getAsType(Class<X> type,
ArchivePath path)
Archive as a specific type.
X - type - The Type to return the Archive aspath - The location of the Archive
ArchivePath
IllegalArgumentException - if found Asset is not pointing to a Archiveadd(Archive, ArchivePath, Class),
add(Archive, String, Class)
<X extends Archive<X>> Collection<X> getAsType(Class<X> type,
Filter<ArchivePath> filter)
Archive matching the filter as a specific type.
X - type - The Type to return the Archive asfilter - Filter to match result
Collection of found Archives matching given filter or empty Collection if non found.
IllegalArgumentException - if found Asset is not pointing to a ArchivegetAsType(Class, ArchivePath),
add(Archive, ArchivePath, Class),
add(Archive, String, Class)
<X extends Archive<X>> X getAsType(Class<X> type,
String path,
ArchiveFormat archiveFormat)
Archive as a specific type using the specify ArchiveFormat
type - The Type to return the Archive aspath - The location of the Archivearchive - The archive format
add(Archive, ArchivePath, Class),
add(Archive, String, Class)
<X extends Archive<X>> X getAsType(Class<X> type,
ArchivePath path,
ArchiveFormat archiveFormat)
Archive located in a ArchivePath as a specific type using the specify
ArchiveFormat
type - The Type to return the Archive aspath - The location of the Archivearchive - The archive format
ArchivePathadd(Archive, ArchivePath, Class),
add(Archive, String, Class)
<X extends Archive<X>> Collection<X> getAsType(Class<X> type,
Filter<ArchivePath> filter,
ArchiveFormat archiveFormat)
Archive matching the filter as a specific type using the specify ArchiveFormat.
X - type - The Type to return the Archive asfilter - Filter to match resultarchive - The archive format
Collection of found Archives matching given filter or empty Collection if non found.Archive#getAsType(Class, ArchivePath, ArchiveFormatStreamBindings),
add(Archive, ArchivePath, Class),
add(Archive, String, Class)
boolean contains(ArchivePath path)
throws IllegalArgumentException
path -
IllegalArgumentException - If the path is not specified
boolean contains(String path)
throws IllegalArgumentException
path -
IllegalArgumentException - If the path is not specified
Node delete(ArchivePath path)
throws IllegalArgumentException
Node in the Archive at the specified ArchivePath. If the path is a directory,
recursively removes all contents. If the path does not exist, return null.
path -
IllegalArgumentException
Node delete(String archivePath)
throws IllegalArgumentException
Node in the Archive at the ArchivePath indicated by the specified String
archivePath. If the path is a directory, recursively removes all contents. If the path does not exist, return
null.
archivePath -
IllegalArgumentExceptiondelete(ArchivePath)Map<ArchivePath,Node> getContent()
Map<ArchivePath,Node> getContent(Filter<ArchivePath> filter)
T add(Archive<?> archive,
ArchivePath path,
Class<? extends StreamExporter> exporter)
throws IllegalArgumentException
path - to usearchive - to addexporter - Exporter type to use in fulfilling the Asset.openStream() contract for the added (nested)
archive.
IllegalArgumentException - If any argument is not specified
T add(Archive<?> archive,
String path,
Class<? extends StreamExporter> exporter)
throws IllegalArgumentException
path - to usearchive - to addexporter - Exporter type to use in fulfilling the Asset.openStream() contract for the added (nested)
archive.
IllegalArgumentException - If the path or archive are not specified
T merge(Archive<?> source)
throws IllegalArgumentException
source - Archive to add contents from
IllegalArgumentException - If the existing archive is not specified
T merge(Archive<?> source,
Filter<ArchivePath> filter)
throws IllegalArgumentException
ArchivePaths to include form the source Archive.
source - Archive to add contents from
IllegalArgumentException - If the existing archive is not specified
T merge(Archive<?> source,
ArchivePath path)
throws IllegalArgumentException
source - Archive to add contents frompath - Path to add contents to
IllegalArgumentException - If the path or existing archive is not specified
T merge(Archive<?> source,
String path)
throws IllegalArgumentException
source - Archive to add contents frompath - Path to add contents to
IllegalArgumentException - If the path or existing archive is not specified
T merge(Archive<?> source,
ArchivePath path,
Filter<ArchivePath> filter)
throws IllegalArgumentException
ArchivePaths to include form the source Archive.
source - Archive to add contents frompath - Path to add contents tofilter - Filter to use for including Assets in the merge.
IllegalArgumentException - If the path or existing archive is not specified
T merge(Archive<?> source,
String path,
Filter<ArchivePath> filter)
throws IllegalArgumentException
ArchivePaths to include form the source Archive.
source - Archive to add contents frompath - Path to add contents tofilter - Filter to use for including Assets in the merge.
IllegalArgumentException - If the path or existing archive is not specified
T move(ArchivePath source,
ArchivePath target)
throws IllegalArgumentException,
IllegalArchivePathException
source - The context under which to remove the assetstarget - The context under which to add the moved assets
IllegalArgumentException - If any of the paths is not specified
IllegalArchivePathException - If the source path is invalid.
T move(String source,
String target)
throws IllegalArgumentException,
IllegalArchivePathException
source - The context under which to remove the assetstarget - The context under which to add the moved assets
IllegalArgumentException - If any of the paths is not specified
IllegalArchivePathException - If the source path is invalid.String toString()
toString(Formatter) where the Formatters.SIMPLE is leveraged.
toString in class ObjectString toString(boolean verbose)
toString(Formatter) where the
Formatters.VERBOSE is leveraged. Otherwise the Formatters.SIMPLE will be used (equivalent to
toString()).
String toString(Formatter formatter)
throws IllegalArgumentException
Archive as returned from the specified Formatter. Common options may be to
use the predefined formatters located in Formatters
formatter -
IllegalArgumentException - If the formatter is not specified
void writeTo(OutputStream outputStream,
Formatter formatter)
throws IllegalArgumentException
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.
outputStream - the stream to print the archive contents toformatter - the output format
IllegalArgumentException - if an exceptions occur when writing the archive contents.Archive<T> shallowCopy()
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.
|
ShrinkWrap API 1.1.0-alpha-1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||