org.glassfish.api.deployment.archive
Interface ArchiveHandler

All Known Subinterfaces:
CompositeHandler

@Contract
public interface ArchiveHandler

ArchiveHandlers are handling certain archive type. An archive has a unique type which is usually defines how classes and resources are loaded from the archive. ArchiveHandler should be stateless objects although the implementations of this contract can control that using the scope element of the @Service annotation.

Author:
Jerome Dochez

Method Summary
 void expand(ReadableArchive source, WritableArchive target, DeploymentContext context)
          Prepares the jar file to a format the ApplicationContainer is expecting.
 java.lang.String getArchiveType()
           
 java.lang.ClassLoader getClassLoader(java.lang.ClassLoader parent, DeploymentContext context)
          Creates a classloader that can load code from inside the archive.
 java.lang.String getDefaultApplicationName(ReadableArchive archive)
          Returns the default name by which the specified archive can be identified.
 java.lang.String getDefaultApplicationName(ReadableArchive archive, DeploymentContext context)
           
 java.util.jar.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.
 java.lang.String getVersionIdentifier(ReadableArchive archive)
          Returns the version identifier by which the specified archive can be deployed.
 boolean handles(ReadableArchive archive)
          Returns true if this handler understands the specified archive and can process it.
 

Method Detail

getArchiveType

java.lang.String getArchiveType()

getDefaultApplicationName

java.lang.String getDefaultApplicationName(ReadableArchive archive)
Returns the default name by which the specified archive can be identified.

The default name is used, for example, during deployment if no name was specified explicitly as part of the deployment request.

Parameters:
archive - the archive for which to provide the default name
Returns:
the default name for identifying the specified archive

getDefaultApplicationName

java.lang.String getDefaultApplicationName(ReadableArchive archive,
                                           DeploymentContext context)

getVersionIdentifier

java.lang.String getVersionIdentifier(ReadableArchive archive)
Returns the version identifier by which the specified archive can be deployed.

The version identifier is used during deployment if no version identifier was specified null must be returned

Parameters:
archive - the archive for which to provide the version identifier
Returns:
the version identifier for versioning the deployment archive or null

handles

boolean handles(ReadableArchive archive)
                throws java.io.IOException
Returns true if this handler understands the specified archive and can process it.

Throws:
java.io.IOException - The implementation of this method is expected to interact with the given archive, and if methods on ReadableArchive throws an IOException, it can be simply tunneled to the caller.

getClassLoader

java.lang.ClassLoader getClassLoader(java.lang.ClassLoader parent,
                                     DeploymentContext context)
Creates a classloader that can load code from inside the archive.

Parameters:
parent - The newly created classloader to be returned must eventually delegate to this classloader. (This classloader is capable of resolving APIs and other things that the container
context -

expand

void expand(ReadableArchive source,
            WritableArchive target,
            DeploymentContext context)
            throws java.io.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.

Parameters:
source - of the expanding
target - of the expanding
context -
Throws:
java.io.IOException

getManifest

java.util.jar.Manifest getManifest(ReadableArchive archive)
                                   throws java.io.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.

Parameters:
archive - file
Returns:
manifest instance or null if this archive has no manifest
Throws:
java.io.IOException


Copyright © 2012 GlassFish Community. All Rights Reserved.