Class GenericHandler
- java.lang.Object
-
- org.glassfish.internal.deployment.GenericHandler
-
- All Implemented Interfaces:
ArchiveHandler
- Direct Known Subclasses:
AbstractArchiveHandler
,OSGiArchiveHandler
public abstract class GenericHandler extends Object implements 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(ReadableArchive source, WritableArchive target, DeploymentContext context)
Prepares the jar file to a format the ApplicationContainer is expecting.List<URI>
getClassPathURIs(ReadableArchive archive)
Returns the classpath URIs for this archive.String
getDefaultApplicationName(ReadableArchive archive)
Returns the default name by which the specified archive can be identified.String
getDefaultApplicationName(ReadableArchive archive, DeploymentContext context)
String
getDefaultApplicationName(ReadableArchive archive, DeploymentContext context, String originalAppName)
Returns the default application name usable for identifying the archive.String
getDefaultApplicationNameFromArchiveName(ReadableArchive 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.boolean
requiresAnnotationScanning(ReadableArchive archive)
Returns whether this archive requires annotation scanning.-
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
-
-
-
-
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 interfaceArchiveHandler
- Parameters:
source
- of the expandingtarget
- of the expandingcontext
- deployment context- Throws:
IOException
- when the archive is corrupted
-
getDefaultApplicationName
public String getDefaultApplicationName(ReadableArchive archive, DeploymentContext context)
- Specified by:
getDefaultApplicationName
in interfaceArchiveHandler
-
getDefaultApplicationName
public String getDefaultApplicationName(ReadableArchive archive, DeploymentContext context, String originalAppName)
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 interfaceArchiveHandler
- Parameters:
archive
- the archive for which the default name is neededcontext
- deployment context- Returns:
- the default application name for the specified archive
-
getDefaultApplicationNameFromArchiveName
public String getDefaultApplicationNameFromArchiveName(ReadableArchive archive)
-
getDefaultApplicationName
public String getDefaultApplicationName(ReadableArchive archive)
Description copied from interface:ArchiveHandler
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.
- Specified by:
getDefaultApplicationName
in interfaceArchiveHandler
- Parameters:
archive
- the archive for which to provide the default name- Returns:
- the default name for identifying the specified archive
-
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 interfaceArchiveHandler
- Parameters:
archive
- the archive for which to provide the version identifier- 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 interfaceArchiveHandler
- Parameters:
archive
- file- Returns:
- manifest instance or null if this archive has no manifest
- Throws:
IOException
-
getClassPathURIs
public List<URI> getClassPathURIs(ReadableArchive archive)
Returns the classpath URIs for this archive.- Specified by:
getClassPathURIs
in interfaceArchiveHandler
- Parameters:
archive
- file- Returns:
- classpath URIs for this archive
-
requiresAnnotationScanning
public boolean requiresAnnotationScanning(ReadableArchive archive)
Returns whether this archive requires annotation scanning.- Specified by:
requiresAnnotationScanning
in interfaceArchiveHandler
- Parameters:
archive
- file- Returns:
- whether this archive requires annotation scanning
-
-