Package org.jboss.shrinkwrap.impl.base
Class MemoryMapArchiveBase<T extends Archive<T>>
- java.lang.Object
-
- org.jboss.shrinkwrap.impl.base.ArchiveBase<T>
-
- org.jboss.shrinkwrap.impl.base.MemoryMapArchiveBase<T>
-
- Type Parameters:
T-
- All Implemented Interfaces:
Archive<T>,Assignable,ArchiveFormatAssociable,Configurable,Identifiable
- Direct Known Subclasses:
MemoryMapArchiveImpl
public abstract class MemoryMapArchiveBase<T extends Archive<T>> extends ArchiveBase<T> implements Archive<T>
MemoryMapArchiveBase A base implementation for all MemoryMap archives. Thread-safe.- Version:
- $Revision: $
- Author:
- John Bailey, Aslak Knutsen
-
-
Constructor Summary
Constructors Constructor Description MemoryMapArchiveBase(String archiveName, Configuration configuration)Constructor This constructor will generate anArchivewith the provided name.MemoryMapArchiveBase(Configuration configuration)Constructor This constructor will generate a uniqueArchive.getName()per instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tadd(Archive<?> archive, String path, Class<? extends StreamExporter> exporter)Add an archive under a specific context and maintain the archive name as context path.Tadd(Archive<?> archive, ArchivePath path, Class<? extends StreamExporter> exporter)Add an archive under a specific context and maintain the archive name as context path.Tadd(Asset asset, ArchivePath path)Adds the specified asset under the specified path into the target contextTaddAsDirectory(ArchivePath path)Adds the specified directory.TaddHandlers(ArchiveEventHandler... handlers)Add an array of listeners for call back based.booleancontains(String path)Denotes whether this archive contains a resource at the specified pathbooleancontains(ArchivePath path)Denotes whether this archive contains a resource at the specified pathNodedelete(String archivePath)Nodedelete(ArchivePath path)Nodeget(ArchivePath path)Obtains theNodelocated at the specified pathMap<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.-
Methods inherited from class org.jboss.shrinkwrap.impl.base.ArchiveBase
add, add, add, add, addAsDirectories, addAsDirectories, addAsDirectory, as, covariantReturn, equals, filter, get, getActualClass, getArchiveFormat, getAsType, getAsType, getAsType, getAsType, getAsType, getAsType, getConfiguration, getId, getName, hashCode, merge, merge, merge, merge, merge, merge, move, move, setId, shallowCopy, shallowCopy, toString, toString, toString, writeTo
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jboss.shrinkwrap.api.Archive
add, add, add, add, addAsDirectories, addAsDirectories, addAsDirectory, filter, get, getAsType, getAsType, getAsType, getAsType, getAsType, getAsType, getId, getName, merge, merge, merge, merge, merge, merge, move, move, shallowCopy, shallowCopy, toString, toString, toString, writeTo
-
Methods inherited from interface org.jboss.shrinkwrap.api.Assignable
as
-
-
-
-
Constructor Detail
-
MemoryMapArchiveBase
public MemoryMapArchiveBase(Configuration configuration) throws IllegalArgumentException
Constructor This constructor will generate a uniqueArchive.getName()per instance.- Parameters:
configuration- The configuration for this archive- Throws:
IllegalArgumentException- If the configuration is not specified
-
MemoryMapArchiveBase
public MemoryMapArchiveBase(String archiveName, Configuration configuration) throws IllegalArgumentException
Constructor This constructor will generate anArchivewith the provided name.- Parameters:
archiveName-configuration- The configuration for this archive- Throws:
IllegalArgumentException- If the name or configuration is not specified
-
-
Method Detail
-
add
public T add(Asset asset, ArchivePath path)
Adds the specified asset under the specified path into the target context
-
add
public 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.- Specified by:
addin interfaceArchive<T extends Archive<T>>- Parameters:
archive- to addpath- to useexporter- Exporter type to use in fulfilling theAsset.openStream()contract for the added (nested) archive.- Returns:
- See Also:
Archive.add(org.jboss.shrinkwrap.api.Archive, java.lang.String, java.lang.Class)
-
add
public T add(Archive<?> archive, ArchivePath path, Class<? extends StreamExporter> exporter)
Add an archive under a specific context and maintain the archive name as context path.- Specified by:
addin interfaceArchive<T extends Archive<T>>- Overrides:
addin classArchiveBase<T extends Archive<T>>- Parameters:
archive- to addpath- to useexporter- Exporter type to use in fulfilling theAsset.openStream()contract for the added (nested) archive.- Returns:
- See Also:
ArchiveBase.add(org.jboss.shrinkwrap.api.Archive, org.jboss.shrinkwrap.api.ArchivePath, java.lang.Class)
-
addAsDirectory
public T addAsDirectory(ArchivePath path) throws IllegalArgumentException
Adds the specified directory.- Specified by:
addAsDirectoryin interfaceArchive<T extends Archive<T>>- Parameters:
path- The path to add- Returns:
- This archive
- Throws:
IllegalArgumentException- If no path was specified- See Also:
Archive.addAsDirectory(org.jboss.shrinkwrap.api.ArchivePath)
-
addHandlers
public T addHandlers(ArchiveEventHandler... handlers)
Add an array of listeners for call back based.- Specified by:
addHandlersin interfaceArchive<T extends Archive<T>>- Returns:
- This archive
- See Also:
org.jboss.shrinkwrap.api.Archive#addListener(org.jboss.shrinkwrap.api.Filter, org.jboss.shrinkwrap.api.ArchiveEventHandler)
-
contains
public boolean contains(ArchivePath path)
Denotes whether this archive contains a resource at the specified path
-
contains
public boolean contains(String path) throws IllegalArgumentException
Denotes whether this archive contains a resource at the specified path- Specified by:
containsin interfaceArchive<T extends Archive<T>>- Returns:
- Throws:
IllegalArgumentException- If the path is not specified- See Also:
Archive.contains(java.lang.String)
-
delete
public Node delete(ArchivePath path)
Removes theNodein theArchiveat the specifiedArchivePath. If the path is a directory, recursively removes all contents. If the path does not exist, return null.
-
delete
public Node delete(String archivePath)
Removes theNodein theArchiveat theArchivePathindicated by the specified String archivePath. If the path is a directory, recursively removes all contents. If the path does not exist, return null.
-
get
public Node get(ArchivePath path)
Obtains theNodelocated at the specified path
-
getContent
public Map<ArchivePath,Node> getContent()
Obtains all assets in this archive, along with their respective paths. The returned Map will be an immutable view.- Specified by:
getContentin interfaceArchive<T extends Archive<T>>- Returns:
- See Also:
Archive.getContent()
-
getContent
public Map<ArchivePath,Node> getContent(Filter<ArchivePath> filter)
Obtains all assets matching given filter in this archive, along with its respective Path. The returned Map will be an immutable view.- Specified by:
getContentin interfaceArchive<T extends Archive<T>>- Returns:
- See Also:
Archive.getContent(org.jboss.shrinkwrap.api.Filter)
-
-