Class JarArchive
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description protected Map<String,Object>
archiveMetaData
protected Map<Class<?>,Object>
extraData
protected ReadableArchive
parentArchive
-
Constructor Summary
Constructors Constructor Description JarArchive()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addArchiveMetaData(String metaDataKey, Object metaData)
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.<T> T
getArchiveMetaData(String metaDataKey, Class<T> metadataType)
<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 archiveboolean
isDirectory(String name)
Returns true if the entry is a directory or a plain filevoid
removeArchiveMetaData(String metaDataKey)
<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
-
-
-
-
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.
-
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:
- /a/b/c/d.jar -> d
- /a/b/c/d -> d
- /x/y/z.html -> z
-
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 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)
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)
-
removeArchiveMetaData
public void removeArchiveMetaData(String metaDataKey)
-
-