Class OSGiArchiveHandler
- java.lang.Object
-
- org.glassfish.internal.deployment.GenericHandler
-
- org.glassfish.extras.osgicontainer.OSGiArchiveHandler
-
- All Implemented Interfaces:
ArchiveHandler
,CompositeHandler
@Service(name="osgi") @Singleton public class OSGiArchiveHandler extends GenericHandler implements CompositeHandler
Archive Handler for OSGi modules. This understands a special deployment property called UriScheme. The value of this property must be a url scheme for which there is a URL handler currently registered in the JVM. Any other deployment properties are treated as query parameters. The rules are pretty much same as what's the case for webbundle url handler as defined in OSGi Web Application spec except that the solution here is not limited to webbundle scheme. Since the deployment properties are used as query parameters, they must be encoded such that they conform to URL RFC 1738.- Author:
- Jerome Dochez, TangYong([email protected]), [email protected]
-
-
Field Summary
Fields Modifier and Type Field Description static String
DECORATED_URL
static String
RB_NAME
-
Fields inherited from class org.glassfish.internal.deployment.GenericHandler
habitat
-
-
Constructor Summary
Constructors Constructor Description OSGiArchiveHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(ReadableArchive source, String entryName)
void
expand(ReadableArchive source, WritableArchive target, DeploymentContext context)
Overriding the expand method of base class(GenericHandler) in order to support allowing wrapping of non-OSGi bundles when --type=osgi option is used in deploy command or GUI.String
getArchiveType()
This method is semantically equivalent toArchiveDetector.getArchiveType()
except that this method returns string equivalent of ArchiveType because of backward compatibility reasons.ClassLoader
getClassLoader(ClassLoader parent, DeploymentContext context)
Creates a classloader that can load code from inside the archive.String
getDefaultApplicationName(ReadableArchive archive, DeploymentContext context)
boolean
handles(ReadableArchive archive)
Returns true if this handler understands the specified archive and can process it.void
initCompositeMetaData(DeploymentContext context)
boolean
requiresAnnotationScanning(ReadableArchive archive)
Returns whether this archive requires annotation scanning.-
Methods inherited from class org.glassfish.internal.deployment.GenericHandler
getClassPathURIs, getDefaultApplicationName, getDefaultApplicationName, getDefaultApplicationNameFromArchiveName, getManifest, getVersionIdentifier
-
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
getClassPathURIs, getDefaultApplicationName, getDefaultApplicationName, getManifest, getVersionIdentifier
-
-
-
-
Field Detail
-
RB_NAME
public static final String RB_NAME
- See Also:
- Constant Field Values
-
DECORATED_URL
public static final String DECORATED_URL
- See Also:
- Constant Field Values
-
-
Method Detail
-
getArchiveType
public String getArchiveType()
Description copied from interface:ArchiveHandler
This method is semantically equivalent toArchiveDetector.getArchiveType()
except that this method returns string equivalent of ArchiveType because of backward compatibility reasons.- Specified by:
getArchiveType
in interfaceArchiveHandler
- Returns:
- the type of the archive or deployment unit handled by this handler
- See Also:
ArchiveDetector.getArchiveType()
-
accept
public boolean accept(ReadableArchive source, String entryName)
- Specified by:
accept
in interfaceCompositeHandler
-
initCompositeMetaData
public void initCompositeMetaData(DeploymentContext context)
- Specified by:
initCompositeMetaData
in interfaceCompositeHandler
-
handles
public boolean handles(ReadableArchive archive) throws IOException
Description copied from interface:ArchiveHandler
Returns true if this handler understands the specified archive and can process it.- Specified by:
handles
in interfaceArchiveHandler
- 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
public ClassLoader getClassLoader(ClassLoader parent, DeploymentContext context)
Description copied from interface:ArchiveHandler
Creates a classloader that can load code from inside the archive.- Specified by:
getClassLoader
in interfaceArchiveHandler
- 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
-
getDefaultApplicationName
public String getDefaultApplicationName(ReadableArchive archive, DeploymentContext context)
- Specified by:
getDefaultApplicationName
in interfaceArchiveHandler
- Overrides:
getDefaultApplicationName
in classGenericHandler
-
expand
public void expand(ReadableArchive source, WritableArchive target, DeploymentContext context) throws IOException
Overriding the expand method of base class(GenericHandler) in order to support allowing wrapping of non-OSGi bundles when --type=osgi option is used in deploy command or GUI. Pl. see [GLASSFISH-16651]- Specified by:
expand
in interfaceArchiveHandler
- Overrides:
expand
in classGenericHandler
- Parameters:
source
- of the expandingtarget
- of the expandingcontext
- deployment context- Throws:
IOException
- when the archive is corrupted
-
requiresAnnotationScanning
public boolean requiresAnnotationScanning(ReadableArchive archive)
Returns whether this archive requires annotation scanning.- Specified by:
requiresAnnotationScanning
in interfaceArchiveHandler
- Overrides:
requiresAnnotationScanning
in classGenericHandler
- Parameters:
archive
- file- Returns:
- whether this archive requires annotation scanning
-
-