Class ReadableArchiveAdapter
- java.lang.Object
-
- org.glassfish.api.deployment.archive.ReadableArchiveAdapter
-
- All Implemented Interfaces:
Archive,ReadableArchive
public abstract class ReadableArchiveAdapter extends Object implements ReadableArchive
A lot of methods need to be written in order to implement ReadableArchive. The no-op methods are implemented here to make ScatteredWar easier to understand.- Author:
- Byron Nevins
-
-
Constructor Summary
Constructors Constructor Description ReadableArchiveAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArchiveMetaData(String metaDataKey, Object metaData)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()<T> TgetArchiveMetaData(String metaDataKey, Class<T> metadataType)longgetArchiveSize()Returns the size of the archive.Collection<String>getDirectories()Returns the enumeration of first level directories in this archivelonggetEntrySize(String arg0)Returns the entry size for a given entry name or 0 if not known<U> UgetExtraData(Class<U> dataType)Returns any data that could have been calculated as part of the descriptor loading.ReadableArchivegetParentArchive()get the parent archive of this archiveReadableArchivegetSubArchive(String arg0)Returns an instance of this archive abstraction for an embedded archive within this archive.booleanisDirectory(String name)Returns true if the entry is a directory or a plain filevoidopen(URI arg0)Open an abstract archivevoidremoveArchiveMetaData(String metaDataKey)<U> voidremoveExtraData(Class<U> dataType)booleanrenameTo(String arg0)rename the archive<U> voidsetExtraData(Class<U> dataType, U instance)voidsetParentArchive(ReadableArchive parentArchive)set the parent archive for this archive-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.glassfish.api.deployment.archive.Archive
getManifest, getName, getURI
-
Methods inherited from interface org.glassfish.api.deployment.archive.ReadableArchive
exists, getEntry
-
-
-
-
Method Detail
-
getEntrySize
public long getEntrySize(String arg0)
Description copied from interface:ReadableArchiveReturns the entry size for a given entry name or 0 if not known- Specified by:
getEntrySizein interfaceReadableArchive- Parameters:
arg0- the entry name- Returns:
- the entry size
-
open
public void open(URI arg0) throws IOException
Description copied from interface:ReadableArchiveOpen an abstract archive- Specified by:
openin interfaceReadableArchive- Parameters:
arg0- path to the archive- Throws:
IOException
-
getSubArchive
public ReadableArchive getSubArchive(String arg0) throws IOException
Description copied from interface:ReadableArchiveReturns an instance of this archive abstraction for an embedded archive within this archive.- Specified by:
getSubArchivein interfaceReadableArchive- Parameters:
arg0- 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
-
delete
public boolean delete()
Description copied from interface:ReadableArchivedeletes the archive- Specified by:
deletein interfaceReadableArchive
-
renameTo
public boolean renameTo(String arg0)
Description copied from interface:ReadableArchiverename the archive- Specified by:
renameToin interfaceReadableArchive- Parameters:
arg0- the archive name
-
close
public void close() throws IOExceptionDescription copied from interface:Archivecloses this archive and releases all resources- Specified by:
closein interfaceArchive- Throws:
IOException
-
getArchiveSize
public long getArchiveSize() throws SecurityExceptionDescription copied from interface:ArchiveReturns the size of the archive.- Specified by:
getArchiveSizein interfaceArchive- Returns:
- long indicating the size of the archive
- Throws:
SecurityException
-
exists
public boolean exists()
- Specified by:
existsin interfaceReadableArchive- Returns:
- true if this archive exists
-
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.
-
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.
-
getDirectories
public Collection<String> getDirectories() throws IOException
Description copied from interface:ArchiveReturns the enumeration of first level directories in this archive- Specified by:
getDirectoriesin interfaceArchive- 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- Specified by:
isDirectoryin interfaceArchive- Parameters:
name- name is one of the entries returned byArchive.entries()- Returns:
- true if the entry denoted by the passed name is a directory
-
setParentArchive
public void setParentArchive(ReadableArchive parentArchive)
Description copied from interface:ReadableArchiveset the parent archive for this archive- Specified by:
setParentArchivein interfaceReadableArchive- Parameters:
parentArchive- the parent archive
-
getParentArchive
public ReadableArchive getParentArchive()
Description copied from interface:ReadableArchiveget the parent archive of this archive- Specified by:
getParentArchivein interfaceReadableArchive- Returns:
- the parent archive
-
getExtraData
public <U> U getExtraData(Class<U> dataType)
Description copied from interface:ReadableArchiveReturns any data that could have been calculated as part of the descriptor loading.- Specified by:
getExtraDatain interfaceReadableArchive- Parameters:
dataType- the type of the extra data- Returns:
- the extra data or null if there are not an instance of type dataType registered.
-
setExtraData
public <U> void setExtraData(Class<U> dataType, U instance)
- Specified by:
setExtraDatain interfaceReadableArchive
-
removeExtraData
public <U> void removeExtraData(Class<U> dataType)
- Specified by:
removeExtraDatain interfaceReadableArchive
-
addArchiveMetaData
public void addArchiveMetaData(String metaDataKey, Object metaData)
- Specified by:
addArchiveMetaDatain interfaceReadableArchive
-
getArchiveMetaData
public <T> T getArchiveMetaData(String metaDataKey, Class<T> metadataType)
- Specified by:
getArchiveMetaDatain interfaceReadableArchive
-
removeArchiveMetaData
public void removeArchiveMetaData(String metaDataKey)
- Specified by:
removeArchiveMetaDatain interfaceReadableArchive
-
-