java.lang.Object
com.sun.enterprise.deployment.deploy.shared.JarArchive
All Implemented Interfaces:
AutoCloseable, org.glassfish.api.deployment.archive.Archive
Direct Known Subclasses:
DeploymentPlanArchive, InputJarArchive, MemoryMappedArchive, OutputJarArchive

public abstract class JarArchive extends Object implements org.glassfish.api.deployment.archive.Archive
This abstract class contains all common implementation of the Archive/WritableArchive interfaces for Jar files
Author:
Jerome Dochez
  • Field Details

    • parentArchive

      protected org.glassfish.api.deployment.archive.ReadableArchive parentArchive
    • extraData

      protected Map<Class<?>,Object> extraData
    • archiveMetaData

      protected Map<String,Object> archiveMetaData
  • Constructor Details

    • JarArchive

      public JarArchive()
  • Method Details

    • 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 org.glassfish.api.deployment.archive.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:

      • /a/b/c/d.jar -> d
      • /a/b/c/d -> d
      • /x/y/z.html -> z
      Specified by:
      getName in interface org.glassfish.api.deployment.archive.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 org.glassfish.api.deployment.archive.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(org.glassfish.api.deployment.archive.ReadableArchive parentArchive)
      set the parent archive for this archive
      Parameters:
      parentArchive - the parent archive
    • getParentArchive

      public org.glassfish.api.deployment.archive.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)
    • addArchiveMetaData

      public void addArchiveMetaData(String metaDataKey, Object metaData)
    • getArchiveMetaData

      public <T> T getArchiveMetaData(String metaDataKey, Class<T> metadataType)
    • removeArchiveMetaData

      public void removeArchiveMetaData(String metaDataKey)
    • toString

      public String toString()
      Overrides:
      toString in class Object