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(tangyong@cn.fujitsu.com), sanjeeb.sahoo@oracle.com
-
-
Field Summary
Fields Modifier and Type Field Description static StringDECORATED_URLstatic StringRB_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 booleanaccept(ReadableArchive source, String entryName)voidexpand(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.StringgetArchiveType()This method is semantically equivalent toArchiveDetector.getArchiveType()except that this method returns string equivalent of ArchiveType because of backward compatibility reasons.ClassLoadergetClassLoader(ClassLoader parent, DeploymentContext context)Creates a classloader that can load code from inside the archive.StringgetDefaultApplicationName(ReadableArchive archive, DeploymentContext context)booleanhandles(ReadableArchive archive)Returns true if this handler understands the specified archive and can process it.voidinitCompositeMetaData(DeploymentContext context)booleanrequiresAnnotationScanning(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:ArchiveHandlerThis method is semantically equivalent toArchiveDetector.getArchiveType()except that this method returns string equivalent of ArchiveType because of backward compatibility reasons.- Specified by:
getArchiveTypein 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:
acceptin interfaceCompositeHandler
-
initCompositeMetaData
public void initCompositeMetaData(DeploymentContext context)
- Specified by:
initCompositeMetaDatain interfaceCompositeHandler
-
handles
public boolean handles(ReadableArchive archive) throws IOException
Description copied from interface:ArchiveHandlerReturns true if this handler understands the specified archive and can process it.- Specified by:
handlesin interfaceArchiveHandler- Throws:
IOException- The implementation of this method is expected to interact with the given archive, and if methods onReadableArchivethrows anIOException, it can be simply tunneled to the caller.
-
getClassLoader
public ClassLoader getClassLoader(ClassLoader parent, DeploymentContext context)
Description copied from interface:ArchiveHandlerCreates a classloader that can load code from inside the archive.- Specified by:
getClassLoaderin 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:
getDefaultApplicationNamein interfaceArchiveHandler- Overrides:
getDefaultApplicationNamein 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:
expandin interfaceArchiveHandler- Overrides:
expandin 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:
requiresAnnotationScanningin interfaceArchiveHandler- Overrides:
requiresAnnotationScanningin classGenericHandler- Parameters:
archive- file- Returns:
- whether this archive requires annotation scanning
-
-