com.sun.enterprise.deployment.deploy.shared
Class JarArchive

java.lang.Object
  extended by com.sun.enterprise.deployment.deploy.shared.JarArchive
All Implemented Interfaces:
Archive
Direct Known Subclasses:
DeploymentPlanArchive, InputJarArchive, MemoryMappedArchive, OutputJarArchive

public abstract class JarArchive
extends Object
implements Archive

This abstract class contains all common implementation of the Archive/WritableArchive interfaces for Jar files

Author:
Jerome Dochez

Field Summary
protected  Map<Class<?>,Object> extraData
           
protected  ReadableArchive parentArchive
           
 
Constructor Summary
JarArchive()
           
 
Method Summary
 Enumeration<String> entries(String prefix)
          Returns an enumeration of the module file entries with the specified prefix.
 boolean exists(String name)
          Returns the existence of the given entry name The file name must be relative to the root of the module.
<U> U
getExtraData(Class<U> dataType)
          Returns any data that could have been calculated as part of the descriptor loading.
protected abstract  JarEntry getJarEntry(String entryName)
           
 String getName()
          Returns the name portion of the archive's URI.
 ReadableArchive getParentArchive()
          get the parent archive of this archive
 boolean isDirectory(String name)
          Returns true if the entry is a directory or a plain file
<U> void
removeExtraData(Class<U> dataType)
           
<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
close, entries, getArchiveSize, getDirectories, getManifest, getURI
 

Field Detail

parentArchive

protected ReadableArchive parentArchive

extraData

protected Map<Class<?>,Object> extraData
Constructor Detail

JarArchive

public JarArchive()
Method Detail

entries

public Enumeration<String> entries(String prefix)
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.

getName

public String getName()
Returns the name portion of the archive's URI.

For JarArhive the name is all of the path that follows the last slash up to but not including the last dot.

Here are some example archive names for the specified JarArchive paths:

Specified by:
getName in interface Archive
Returns:
the name of the archive

getJarEntry

protected abstract JarEntry getJarEntry(String entryName)

exists

public boolean exists(String name)
               throws IOException
Returns 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. * @return the existence the given entry name.
Throws:
IOException

isDirectory

public boolean isDirectory(String name)
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)
set the parent archive for this archive

Parameters:
parentArchive - the parent archive

getParentArchive

public ReadableArchive getParentArchive()
get the parent archive of this archive

Returns:
the parent archive

getExtraData

public <U> U getExtraData(Class<U> dataType)
Returns any data that could have been calculated as part of the descriptor loading.

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)

removeExtraData

public <U> void removeExtraData(Class<U> dataType)


Copyright © 2012. All Rights Reserved.