Class GenericHandler

  • All Implemented Interfaces:
    org.glassfish.api.deployment.archive.ArchiveHandler

    public abstract class GenericHandler
    extends Object
    implements org.glassfish.api.deployment.archive.ArchiveHandler
    Pretty generic implementation of some ArchiveHandler methods
    Author:
    Jerome Dochez
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.glassfish.hk2.api.ServiceLocator habitat  
    • Constructor Summary

      Constructors 
      Constructor Description
      GenericHandler()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void expand​(org.glassfish.api.deployment.archive.ReadableArchive source, org.glassfish.api.deployment.archive.WritableArchive target, org.glassfish.api.deployment.DeploymentContext context)
      Prepares the jar file to a format the ApplicationContainer is expecting.
      List<URI> getClassPathURIs​(org.glassfish.api.deployment.archive.ReadableArchive archive)
      Returns the classpath URIs for this archive.
      String getDefaultApplicationName​(org.glassfish.api.deployment.archive.ReadableArchive archive)  
      String getDefaultApplicationName​(org.glassfish.api.deployment.archive.ReadableArchive archive, org.glassfish.api.deployment.DeploymentContext context)
      Returns the default application name usable for identifying the archive.
      String getDefaultApplicationNameFromArchiveName​(org.glassfish.api.deployment.archive.ReadableArchive archive)  
      Manifest getManifest​(org.glassfish.api.deployment.archive.ReadableArchive archive)
      Returns the manifest file for this archive, this file is usually located at the META-INF/MANIFEST location, however, certain archive type can change this default location or use another mean of expressing manifest information.
      String getVersionIdentifier​(org.glassfish.api.deployment.archive.ReadableArchive archive)
      Returns the default value for versionIdentifier.
      boolean requiresAnnotationScanning​(org.glassfish.api.deployment.archive.ReadableArchive archive)
      Returns whether this archive requires annotation scanning.
      • Methods inherited from interface org.glassfish.api.deployment.archive.ArchiveHandler

        getArchiveType, getClassLoader, handles
    • Field Detail

      • habitat

        @Inject
        protected org.glassfish.hk2.api.ServiceLocator habitat
    • Constructor Detail

      • GenericHandler

        public GenericHandler()
    • Method Detail

      • expand

        public void expand​(org.glassfish.api.deployment.archive.ReadableArchive source,
                           org.glassfish.api.deployment.archive.WritableArchive target,
                           org.glassfish.api.deployment.DeploymentContext context)
                    throws IOException
        Prepares the jar file to a format the ApplicationContainer is expecting. This could be just a pure unzipping of the jar or nothing at all.
        Specified by:
        expand in interface org.glassfish.api.deployment.archive.ArchiveHandler
        Parameters:
        source - of the expanding
        target - of the expanding
        context - deployment context
        Throws:
        IOException - when the archive is corrupted
      • getDefaultApplicationName

        public String getDefaultApplicationName​(org.glassfish.api.deployment.archive.ReadableArchive archive,
                                                org.glassfish.api.deployment.DeploymentContext context)
        Returns the default application name usable for identifying the archive.

        This default implementation returns the name portion of the archive's URI. The archive's name depends on the type of archive (FileArchive vs. JarArchive vs. MemoryMappedArchive, for example).

        A concrete subclass can override this method to provide an alternative way of deriving the default application name.

        Specified by:
        getDefaultApplicationName in interface org.glassfish.api.deployment.archive.ArchiveHandler
        Parameters:
        archive - the archive for which the default name is needed
        context - deployment context
        Returns:
        the default application name for the specified archive
      • getDefaultApplicationNameFromArchiveName

        public String getDefaultApplicationNameFromArchiveName​(org.glassfish.api.deployment.archive.ReadableArchive archive)
      • getDefaultApplicationName

        public String getDefaultApplicationName​(org.glassfish.api.deployment.archive.ReadableArchive archive)
        Specified by:
        getDefaultApplicationName in interface org.glassfish.api.deployment.archive.ArchiveHandler
      • getVersionIdentifier

        public String getVersionIdentifier​(org.glassfish.api.deployment.archive.ReadableArchive archive)
        Returns the default value for versionIdentifier. This allows us to override the method only where thhe version-identifier element is supported.
        Specified by:
        getVersionIdentifier in interface org.glassfish.api.deployment.archive.ArchiveHandler
        Returns:
        null
      • getManifest

        public Manifest getManifest​(org.glassfish.api.deployment.archive.ReadableArchive archive)
                             throws IOException
        Returns the manifest file for this archive, this file is usually located at the META-INF/MANIFEST location, however, certain archive type can change this default location or use another mean of expressing manifest information.
        Specified by:
        getManifest in interface org.glassfish.api.deployment.archive.ArchiveHandler
        Parameters:
        archive - file
        Returns:
        manifest instance or null if this archive has no manifest
        Throws:
        IOException
      • getClassPathURIs

        public List<URI> getClassPathURIs​(org.glassfish.api.deployment.archive.ReadableArchive archive)
        Returns the classpath URIs for this archive.
        Specified by:
        getClassPathURIs in interface org.glassfish.api.deployment.archive.ArchiveHandler
        Parameters:
        archive - file
        Returns:
        classpath URIs for this archive
      • requiresAnnotationScanning

        public boolean requiresAnnotationScanning​(org.glassfish.api.deployment.archive.ReadableArchive archive)
        Returns whether this archive requires annotation scanning.
        Specified by:
        requiresAnnotationScanning in interface org.glassfish.api.deployment.archive.ArchiveHandler
        Parameters:
        archive - file
        Returns:
        whether this archive requires annotation scanning