Class MultiReadableArchive
- java.lang.Object
-
- com.sun.enterprise.deploy.shared.AbstractReadableArchive
-
- com.sun.enterprise.deployment.deploy.shared.MultiReadableArchive
-
- All Implemented Interfaces:
Archive,ReadableArchive
@Service @PerLookup public class MultiReadableArchive extends AbstractReadableArchive
Implements ReadableArchive based on multiple underlying ReadableArchives, each of which will be processed in order when looking up entries, finding the manifest, etc.- Author:
- tjquinn
-
-
Field Summary
-
Fields inherited from class com.sun.enterprise.deploy.shared.AbstractReadableArchive
archiveMetaData, extraData
-
-
Constructor Summary
Constructors Constructor Description MultiReadableArchive()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()closes this archive and releases all resourcesbooleandelete()deletes the archiveEnumeration<String>entries()Returns an enumeration of the module file entries.Enumeration<String>entries(String prefix)Returns an enumeration of the module file entries with the specified prefix.booleanexists()booleanexists(String name)Returns the existence of the given entry name The file name must be relative to the root of the module.longgetArchiveSize()Returns the size of the archive.Collection<String>getDirectories()Returns the enumeration of first level directories in this archiveInputStreamgetEntry(String name)Returns the InputStream for the given entry name The file name must be relative to the root of the module.longgetEntrySize(String name)Returns the entry size for a given entry name or 0 if not knownManifestgetManifest()Returns the manifest information for this archiveStringgetName()Returns the name of the archive.ReadableArchivegetParentArchive()get the parent archive of this archiveReadableArchivegetSubArchive(String name)Returns an instance of this archive abstraction for an embedded archive within this archive.URIgetURI()Returns the path used to create or open the underlying archiveURIgetURI(int slot)booleanisDirectory(String name)Returns true if the entry is a directory or a plain filevoidopen(URI uri)Open an abstract archivevoidopen(URI... uris)booleanrenameTo(String name)rename the archivevoidsetParentArchive(ReadableArchive parentArchive)set the parent archive for this archive-
Methods inherited from class com.sun.enterprise.deploy.shared.AbstractReadableArchive
addArchiveMetaData, getArchiveMetaData, getExtraData, removeArchiveMetaData, removeExtraData, setExtraData
-
-
-
-
Method Detail
-
getEntry
public InputStream getEntry(String name) throws IOException
Description copied from interface:ReadableArchiveReturns the InputStream for the given entry name The file name must be relative to the root of the module.- Parameters:
name- the file name relative to the root of the module.- Returns:
- the InputStream for the given entry name or null if not found.
- Throws:
IOException
-
exists
public boolean exists(String name) throws IOException
Description copied from interface:ReadableArchiveReturns the existence of the given entry name The file name must be relative to the root of the module.- Parameters:
name- the file name relative to the root of the module.- Returns:
- the existence the given entry name.
- Throws:
IOException
-
getEntrySize
public long getEntrySize(String name)
Description copied from interface:ReadableArchiveReturns the entry size for a given entry name or 0 if not known- Parameters:
name- the entry name- Returns:
- the entry size
-
open
public void open(URI uri) throws IOException
Description copied from interface:ReadableArchiveOpen an abstract archive- Parameters:
uri- path to the archive- Throws:
IOException
-
open
public void open(URI... uris) throws IOException
- Throws:
IOException
-
getSubArchive
public ReadableArchive getSubArchive(String name) throws IOException
Description copied from interface:ReadableArchiveReturns an instance of this archive abstraction for an embedded archive within this archive.- Parameters:
name- is the entry name relative to the root for the archive- Returns:
- the Archive instance for this abstraction, or null if no such entry exists.
- Throws:
IOException
-
exists
public boolean exists()
- Returns:
- true if this archive exists
-
delete
public boolean delete()
Description copied from interface:ReadableArchivedeletes the archive
-
renameTo
public boolean renameTo(String name)
Description copied from interface:ReadableArchiverename the archive- Parameters:
name- the archive name
-
setParentArchive
public void setParentArchive(ReadableArchive parentArchive)
Description copied from class:AbstractReadableArchiveset the parent archive for this archive- Specified by:
setParentArchivein interfaceReadableArchive- Overrides:
setParentArchivein classAbstractReadableArchive- Parameters:
parentArchive- the parent archive
-
getParentArchive
public ReadableArchive getParentArchive()
Description copied from class:AbstractReadableArchiveget the parent archive of this archive- Specified by:
getParentArchivein interfaceReadableArchive- Overrides:
getParentArchivein classAbstractReadableArchive- Returns:
- the parent archive
-
close
public void close() throws IOExceptionDescription copied from interface:Archivecloses this archive and releases all resources- Throws:
IOException
-
entries
public Enumeration<String> entries()
Description copied from interface:ArchiveReturns an enumeration of the module file entries. All elements in the enumeration are of type String. Each String represents a file name relative to the root of the module.- Returns:
- an enumeration of the archive file entries.
-
entries
public Enumeration<String> entries(String prefix)
Description copied from interface:ArchiveReturns an enumeration of the module file entries with the specified prefix. All elements in the enumeration are of type String. Each String represents a file name relative to the root of the module.- Parameters:
prefix- the prefix of entries to be included- Returns:
- an enumeration of the archive file entries.
-
getDirectories
public Collection<String> getDirectories() throws IOException
Description copied from interface:ArchiveReturns the enumeration of first level directories in this archive- Returns:
- enumeration of directories under the root of this archive
- Throws:
IOException
-
isDirectory
public boolean isDirectory(String name)
Description copied from interface:ArchiveReturns true if the entry is a directory or a plain file- Parameters:
name- name is one of the entries returned byArchive.entries()- Returns:
- true if the entry denoted by the passed name is a directory
-
getManifest
public Manifest getManifest() throws IOException
Description copied from interface:ArchiveReturns the manifest information for this archive- Returns:
- the manifest info
- Throws:
IOException
-
getURI
public URI getURI()
Description copied from interface:ArchiveReturns the path used to create or open the underlying archiveTODO: abstraction breakage: Several callers, most notably
DeploymentContext.getSourceDir()implementation, assumes that this URI is an URL, and in fact file URL.If this needs to be URL, use of
URIis misleading. And furthermore, if its needs to be a file URL, this should beFile.- Returns:
- the path for this archive.
-
getURI
public URI getURI(int slot)
-
getArchiveSize
public long getArchiveSize() throws SecurityExceptionDescription copied from interface:ArchiveReturns the size of the archive.- Returns:
- long indicating the size of the archive
- Throws:
SecurityException
-
-