org.glassfish.api.deployment.archive
Class ReadableArchiveAdapter

java.lang.Object
  extended by org.glassfish.api.deployment.archive.ReadableArchiveAdapter
All Implemented Interfaces:
Archive, ReadableArchive

public abstract class ReadableArchiveAdapter
extends java.lang.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
ReadableArchiveAdapter()
           
 
Method Summary
 void close()
          closes this archive and releases all resources
 boolean delete()
          deletes the archive
 java.util.Enumeration<java.lang.String> entries()
          Returns an enumeration of the module file entries.
 java.util.Enumeration<java.lang.String> entries(java.lang.String prefix)
          Returns an enumeration of the module file entries with the specified prefix.
 boolean exists()
           
 long getArchiveSize()
          Returns the size of the archive.
 java.util.Collection<java.lang.String> getDirectories()
          Returns the enumeration of first level directories in this archive
 long getEntrySize(java.lang.String arg0)
          Returns the entry size for a given entry name or 0 if not known
<U> U
getExtraData(java.lang.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 archive
 ReadableArchive getSubArchive(java.lang.String arg0)
          Returns an instance of this archive abstraction for an embedded archive within this archive.
 boolean isDirectory(java.lang.String name)
          Returns true if the entry is a directory or a plain file
 void open(java.net.URI arg0)
          Open an abstract archive
<U> void
removeExtraData(java.lang.Class<U> dataType)
           
 boolean renameTo(java.lang.String arg0)
          rename the archive
<U> void
setExtraData(java.lang.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.ReadableArchive
exists, getEntry
 
Methods inherited from interface org.glassfish.api.deployment.archive.Archive
getManifest, getName, getURI
 

Constructor Detail

ReadableArchiveAdapter

public ReadableArchiveAdapter()
Method Detail

getEntrySize

public long getEntrySize(java.lang.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 interface ReadableArchive
Parameters:
arg0 - the entry name
Returns:
the entry size

open

public void open(java.net.URI arg0)
          throws java.io.IOException
Description copied from interface: ReadableArchive
Open an abstract archive

Specified by:
open in interface ReadableArchive
Parameters:
arg0 - path to the archive
Throws:
java.io.IOException

getSubArchive

public ReadableArchive getSubArchive(java.lang.String arg0)
                              throws java.io.IOException
Description copied from interface: ReadableArchive
Returns an instance of this archive abstraction for an embedded archive within this archive.

Specified by:
getSubArchive in interface ReadableArchive
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:
java.io.IOException

delete

public boolean delete()
Description copied from interface: ReadableArchive
deletes the archive

Specified by:
delete in interface ReadableArchive

renameTo

public boolean renameTo(java.lang.String arg0)
Description copied from interface: ReadableArchive
rename the archive

Specified by:
renameTo in interface ReadableArchive
Parameters:
arg0 - the archive name

close

public void close()
           throws java.io.IOException
Description copied from interface: Archive
closes this archive and releases all resources

Specified by:
close in interface Archive
Throws:
java.io.IOException

getArchiveSize

public long getArchiveSize()
                    throws java.lang.SecurityException
Description copied from interface: Archive
Returns the size of the archive.

Specified by:
getArchiveSize in interface Archive
Returns:
long indicating the size of the archive
Throws:
java.lang.SecurityException

exists

public boolean exists()
Specified by:
exists in interface ReadableArchive
Returns:
true if this archive exists

entries

public java.util.Enumeration<java.lang.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.

Specified by:
entries in interface Archive
Returns:
an enumeration of the archive file entries.

entries

public java.util.Enumeration<java.lang.String> entries(java.lang.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.

Specified by:
entries in interface Archive
Parameters:
prefix - the prefix of entries to be included
Returns:
an enumeration of the archive file entries.

getDirectories

public java.util.Collection<java.lang.String> getDirectories()
                                                      throws java.io.IOException
Description copied from interface: Archive
Returns the enumeration of first level directories in this archive

Specified by:
getDirectories in interface Archive
Returns:
enumeration of directories under the root of this archive
Throws:
java.io.IOException

isDirectory

public boolean isDirectory(java.lang.String name)
Description copied from interface: Archive
Returns true if the entry is a directory or a plain file

Specified by:
isDirectory in interface Archive
Parameters:
name - name is one of the entries returned by Archive.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 interface ReadableArchive
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 interface ReadableArchive
Returns:
the parent archive

getExtraData

public <U> U getExtraData(java.lang.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 interface ReadableArchive
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(java.lang.Class<U> dataType,
                             U instance)
Specified by:
setExtraData in interface ReadableArchive

removeExtraData

public <U> void removeExtraData(java.lang.Class<U> dataType)
Specified by:
removeExtraData in interface ReadableArchive


Copyright © 2012 GlassFish Community. All Rights Reserved.