org.glassfish.internal.deployment
Class GenericHandler

java.lang.Object
  extended by org.glassfish.internal.deployment.GenericHandler
All Implemented Interfaces:
ArchiveHandler

public abstract class GenericHandler
extends Object
implements ArchiveHandler

Pretty generic implementation of some ArchiveHandler methods

Author:
Jerome Dochez

Field Summary
protected  org.jvnet.hk2.component.Habitat habitat
           
 
Constructor Summary
GenericHandler()
           
 
Method Summary
 void expand(ReadableArchive source, WritableArchive target, DeploymentContext context)
          Prepares the jar file to a format the ApplicationContainer is expecting.
 String getDefaultApplicationName(ReadableArchive archive)
           
 String getDefaultApplicationName(ReadableArchive archive, DeploymentContext context)
          Returns the default application name usable for identifying the archive.
 Manifest getManifest(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(ReadableArchive archive)
          Returns the default value for versionIdentifier.
 
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.ArchiveHandler
getArchiveType, getClassLoader, handles
 

Field Detail

habitat

protected org.jvnet.hk2.component.Habitat habitat
Constructor Detail

GenericHandler

public GenericHandler()
Method Detail

expand

public void expand(ReadableArchive source,
                   WritableArchive target,
                   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 ArchiveHandler
Parameters:
source - of the expanding
target - of the expanding
context - deployment context
Throws:
IOException - when the archive is corrupted

getDefaultApplicationName

public String getDefaultApplicationName(ReadableArchive archive,
                                        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 ArchiveHandler
Parameters:
archive - the archive for which the default name is needed
context - deployment context
Returns:
the default application name for the specified archive

getDefaultApplicationName

public String getDefaultApplicationName(ReadableArchive archive)
Specified by:
getDefaultApplicationName in interface ArchiveHandler

getVersionIdentifier

public String getVersionIdentifier(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 ArchiveHandler
Returns:
null

getManifest

public Manifest getManifest(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 ArchiveHandler
Parameters:
archive - file
Returns:
manifest instance or null if this archive has no manifest
Throws:
IOException


Copyright © 2012 GlassFish Community. All Rights Reserved.