org.glassfish.api.deployment
Interface DeploymentContext

All Superinterfaces:
ApplicationContext, ExecutionContext

public interface DeploymentContext
extends ApplicationContext, ExecutionContext

Useful services for Deployer service implementation

Author:
Jerome Dochez

Method Summary
 void addModuleMetaData(java.lang.Object metaData)
          Stores a descriptor for the module in the context so other deployer's can have access to it.
 void addTransformer(java.lang.instrument.ClassFileTransformer transformer)
          Add a new ClassFileTransformer to the context.
 void addTransientAppMetaData(java.lang.String metaDataKey, java.lang.Object metaData)
          Stores application level metadata in the context so other deployer's can have access to it.
 ActionReport getActionReport()
          Gets the action report for this context
 java.util.List<java.net.URI> getAppLibs()
          gets the app-libs specified for this archive
This list includes --libraries as well EXTENSION_LIST specified in the manifest entries
 ArchiveHandler getArchiveHandler()
          Returns the archive handler that's associated with this context
<U extends OpsParams>
U
getCommandParameters(java.lang.Class<U> opsParamsType)
          Returns the DeployCommand parameters
 java.lang.ClassLoader getFinalClassLoader()
          During the prepare phase, when a deployer need to have access to the class loader that will be used to load the application in the runtime container, it can call this API during the prepare phase.
 java.util.Map<java.lang.String,ArchiveHandler> getModuleArchiveHandlers()
          Gets the archive handlers for modules
 java.util.Collection<java.lang.Object> getModuleMetadata()
          Returns all the metadata associated with this deployment
<T> T
getModuleMetaData(java.lang.Class<T> metadataType)
          Returns the meta data associated with a module type.
 java.util.Map<java.lang.String,java.util.Properties> getModulePropsMap()
          Gets the module properties for modules
 ReadableArchive getOriginalSource()
          Gets the original source archive In case of archive deployment, this will return the archive before expanding.
 java.io.File getScratchDir(java.lang.String subDirName)
          Returns a scratch directory that can be used to store things in.
 ReadableArchive getSource()
          Application bits, at the raw level.
 java.io.File getSourceDir()
          Returns the directory where the original applications bits should be stored.
 java.util.Map<java.lang.String,java.lang.Object> getTransientAppMetadata()
          Returns all the transient app metadata associated with this deployment
<T> T
getTransientAppMetaData(java.lang.String metaDataKey, java.lang.Class<T> metadataType)
          Returns the meta data for the given key
 
Methods inherited from interface org.glassfish.api.deployment.ApplicationContext
getAppProps, getClassLoader, getModuleProps
 
Methods inherited from interface org.glassfish.api.ExecutionContext
getLogger
 

Method Detail

getSource

ReadableArchive getSource()
Application bits, at the raw level. Deployer's should avoid using such low level access as it binds the deployer to a particular directory layout. Instead Deployers should use the class loader obtained via the getClassLoader() API

Returns:
Abstraction to the application's source archive.

getFinalClassLoader

java.lang.ClassLoader getFinalClassLoader()
During the prepare phase, when a deployer need to have access to the class loader that will be used to load the application in the runtime container, it can call this API during the prepare phase. Otherswise, deployers should use the getClassLoader API. If a deployers needs to have access to the classloader during the prepare phase

Returns:
the final class loader

getCommandParameters

<U extends OpsParams> U getCommandParameters(java.lang.Class<U> opsParamsType)
Returns the DeployCommand parameters

Parameters:
opsParamsType - expected deployment operation parameters type.
Returns:
the command parameters

getScratchDir

java.io.File getScratchDir(java.lang.String subDirName)
Returns a scratch directory that can be used to store things in. The scratch directory will be persisted accross server restart but not accross redeployment of the same application

Parameters:
subDirName - the sub directory name of the scratch dir
Returns:
the specific scratch subdirectory for this application based on passed in subDirName. Returns the root scratch dir if the passed in value is null.

getSourceDir

java.io.File getSourceDir()
Returns the directory where the original applications bits should be stored. This is useful when users deploy an archive file that need to be unzipped somewhere for the container to work with.

Returns:
the source directory for this application

addModuleMetaData

void addModuleMetaData(java.lang.Object metaData)
Stores a descriptor for the module in the context so other deployer's can have access to it. Module meta-data is usual not persistent which mean that any modification to it will not be available at the next server restart and will need to be reset.

Parameters:
metaData - the meta data itself

getModuleMetaData

<T> T getModuleMetaData(java.lang.Class<T> metadataType)
Returns the meta data associated with a module type.

Parameters:
metadataType - type of the meta date.
Returns:
instance of T or null

getModuleArchiveHandlers

java.util.Map<java.lang.String,ArchiveHandler> getModuleArchiveHandlers()
Gets the archive handlers for modules

Returns:
a map containing module archive handlers

addTransientAppMetaData

void addTransientAppMetaData(java.lang.String metaDataKey,
                             java.lang.Object metaData)
Stores application level metadata in the context so other deployer's can have access to it. The transient meta-data is not persistent which mean that any modification to it will not be available at the next server restart and will need to be reset.

Parameters:
metaDataKey - key of the meta date.
metaData - the meta data itself

getTransientAppMetaData

<T> T getTransientAppMetaData(java.lang.String metaDataKey,
                              java.lang.Class<T> metadataType)
Returns the meta data for the given key

Parameters:
metaDataKey - key of the meta date.
metadataType - type of the meta date.
Returns:
instance of T or null

addTransformer

void addTransformer(java.lang.instrument.ClassFileTransformer transformer)
Add a new ClassFileTransformer to the context. Once all the deployers potentially invalidating the application class loader (as indicated by the

Parameters:
transformer - the new class file transformer to register to the new application class loader
Throws:
java.lang.UnsupportedOperationException - if the class loader we use does not support the registration of a ClassFileTransformer. In such case, the deployer should either fail deployment or revert to a mode without the bytecode enhancement feature.

getModuleMetadata

java.util.Collection<java.lang.Object> getModuleMetadata()
Returns all the metadata associated with this deployment

Returns:
collection of metadata added to the context

getTransientAppMetadata

java.util.Map<java.lang.String,java.lang.Object> getTransientAppMetadata()
Returns all the transient app metadata associated with this deployment

Returns:
collection of metadata added to the context

getArchiveHandler

ArchiveHandler getArchiveHandler()
Returns the archive handler that's associated with this context

Returns:
archive handler

getOriginalSource

ReadableArchive getOriginalSource()
Gets the original source archive In case of archive deployment, this will return the archive before expanding. In case of directory deployment, this will return the same thing as getSource()

Returns:
the original source archive

getModulePropsMap

java.util.Map<java.lang.String,java.util.Properties> getModulePropsMap()
Gets the module properties for modules

Returns:
a map containing module properties

getActionReport

ActionReport getActionReport()
Gets the action report for this context

Returns:
an action report

getAppLibs

java.util.List<java.net.URI> getAppLibs()
                                        throws java.net.URISyntaxException
gets the app-libs specified for this archive
This list includes --libraries as well EXTENSION_LIST specified in the manifest entries

Returns:
list of library URIs
Throws:
java.net.URISyntaxException - when unable to get the library URIs


Copyright © 2012 GlassFish Community. All Rights Reserved.