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. An archive is also known as a module. It represents a unit of deployment.
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, Sanjeeb Sahoo
-
Method Summary
Modifier and TypeMethodDescriptionvoid
expand
(ReadableArchive source, WritableArchive target, DeploymentContext context) Prepares the jar file to a format the ApplicationContainer is expecting.This method is semantically equivalent toArchiveDetector.getArchiveType()
except that this method returns string equivalent of ArchiveType because of backward compatibility reasons.getClassLoader
(ClassLoader parent, DeploymentContext context) Creates a classloader that can load code from inside the archive.getClassPathURIs
(ReadableArchive archive) Returns the classpath URIs for this archive.getDefaultApplicationName
(ReadableArchive archive) Returns the default name by which the specified archive can be identified.getDefaultApplicationName
(ReadableArchive archive, DeploymentContext context) 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.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.boolean
Returns whether this archive requires annotation scanning.
-
Method Details
-
getArchiveType
String getArchiveType()This method is semantically equivalent toArchiveDetector.getArchiveType()
except that this method returns string equivalent of ArchiveType because of backward compatibility reasons.- Returns:
- the type of the archive or deployment unit handled by this handler
- See Also:
-
getDefaultApplicationName
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
-
getVersionIdentifier
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
Returns true if this handler understands the specified archive and can process it.- Throws:
IOException
- The implementation of this method is expected to interact with the given archive, and if methods onReadableArchive
throws anIOException
, it can be simply tunneled to the caller.
-
getClassLoader
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 containercontext
-
-
expand
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.- Parameters:
source
- of the expandingtarget
- of the expandingcontext
-- Throws:
IOException
-
getManifest
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:
IOException
-
getClassPathURIs
Returns the classpath URIs for this archive.- Parameters:
archive
- file- Returns:
- classpath URIs for this archive
-
requiresAnnotationScanning
Returns whether this archive requires annotation scanning.- Parameters:
archive
- file- Returns:
- whether this archive requires annotation scanning
-