Class ReadableArchiveAdapter
- java.lang.Object
-
- org.glassfish.api.deployment.archive.ReadableArchiveAdapter
-
- All Implemented Interfaces:
Archive
,ReadableArchive
- Direct Known Subclasses:
ScatteredArchive
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 void
addArchiveMetaData(String metaDataKey, Object metaData)
void
close()
closes this archive and releases all resourcesboolean
delete()
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.boolean
exists()
<T> T
getArchiveMetaData(String metaDataKey, Class<T> metadataType)
long
getArchiveSize()
Returns the size of the archive.Collection<String>
getDirectories()
Returns the enumeration of first level directories in this archivelong
getEntrySize(String arg0)
Returns the entry size for a given entry name or 0 if not known<U> U
getExtraData(Class<U> dataType)
Returns any data that could have been calculated as part of the descriptor loading.ReadableArchive
getParentArchive()
get the parent archive of this archiveReadableArchive
getSubArchive(String arg0)
Returns an instance of this archive abstraction for an embedded archive within this archive.boolean
isDirectory(String name)
Returns true if the entry is a directory or a plain filevoid
open(URI arg0)
Open an abstract archivevoid
removeArchiveMetaData(String metaDataKey)
<U> void
removeExtraData(Class<U> dataType)
boolean
renameTo(String arg0)
rename the archive<U> void
setExtraData(Class<U> dataType, U instance)
void
setParentArchive(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:ReadableArchive
Returns the entry size for a given entry name or 0 if not known- Specified by:
getEntrySize
in interfaceReadableArchive
- Parameters:
arg0
- the entry name- Returns:
- the entry size
-
open
public void open(URI arg0) throws IOException
Description copied from interface:ReadableArchive
Open an abstract archive- Specified by:
open
in interfaceReadableArchive
- Parameters:
arg0
- path to the archive- Throws:
IOException
-
getSubArchive
public ReadableArchive getSubArchive(String arg0) throws IOException
Description copied from interface:ReadableArchive
Returns an instance of this archive abstraction for an embedded archive within this archive.- Specified by:
getSubArchive
in 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:ReadableArchive
deletes the archive- Specified by:
delete
in interfaceReadableArchive
-
renameTo
public boolean renameTo(String arg0)
Description copied from interface:ReadableArchive
rename the archive- Specified by:
renameTo
in interfaceReadableArchive
- Parameters:
arg0
- the archive name
-
close
public void close() throws IOException
Description copied from interface:Archive
closes this archive and releases all resources- Specified by:
close
in interfaceArchive
- Throws:
IOException
-
getArchiveSize
public long getArchiveSize() throws SecurityException
Description copied from interface:Archive
Returns the size of the archive.- Specified by:
getArchiveSize
in interfaceArchive
- Returns:
- long indicating the size of the archive
- Throws:
SecurityException
-
exists
public boolean exists()
- Specified by:
exists
in interfaceReadableArchive
- Returns:
- true if this archive exists
-
entries
public Enumeration<String> entries()
Description copied from interface:Archive
Returns 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:Archive
Returns 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:Archive
Returns the enumeration of first level directories in this archive- Specified by:
getDirectories
in interfaceArchive
- Returns:
- enumeration of directories under the root of this archive
- Throws:
IOException
-
isDirectory
public boolean isDirectory(String name)
Description copied from interface:Archive
Returns true if the entry is a directory or a plain file- Specified by:
isDirectory
in 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:ReadableArchive
set the parent archive for this archive- Specified by:
setParentArchive
in interfaceReadableArchive
- Parameters:
parentArchive
- the parent archive
-
getParentArchive
public ReadableArchive getParentArchive()
Description copied from interface:ReadableArchive
get the parent archive of this archive- Specified by:
getParentArchive
in interfaceReadableArchive
- Returns:
- the parent archive
-
getExtraData
public <U> U getExtraData(Class<U> dataType)
Description copied from interface:ReadableArchive
Returns any data that could have been calculated as part of the descriptor loading.- Specified by:
getExtraData
in 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:
setExtraData
in interfaceReadableArchive
-
removeExtraData
public <U> void removeExtraData(Class<U> dataType)
- Specified by:
removeExtraData
in interfaceReadableArchive
-
addArchiveMetaData
public void addArchiveMetaData(String metaDataKey, Object metaData)
- Specified by:
addArchiveMetaData
in interfaceReadableArchive
-
getArchiveMetaData
public <T> T getArchiveMetaData(String metaDataKey, Class<T> metadataType)
- Specified by:
getArchiveMetaData
in interfaceReadableArchive
-
removeArchiveMetaData
public void removeArchiveMetaData(String metaDataKey)
- Specified by:
removeArchiveMetaData
in interfaceReadableArchive
-
-