public class DeploymentContextImpl extends Object implements ExtendedDeploymentContext, org.glassfish.hk2.api.PreDestroy
ExtendedDeploymentContext.Phase
Modifier and Type | Field and Description |
---|---|
static Logger |
deplLogger |
IS_TEMP_CLASSLOADER, TRACKER
Constructor and Description |
---|
DeploymentContextImpl(ActionReport actionReport,
Logger logger,
ReadableArchive source,
OpsParams params,
ServerEnvironment env) |
DeploymentContextImpl(ActionReport actionReport,
ReadableArchive source,
OpsParams params,
ServerEnvironment env) |
DeploymentContextImpl(Deployment.DeploymentContextBuilder builder,
ServerEnvironment env)
Creates a new instance of DeploymentContext
|
Modifier and Type | Method and Description |
---|---|
void |
addModuleMetaData(Object metaData)
Stores a descriptor for the module in the context so other deployer's
can have access to it.
|
void |
addTransformer(ClassFileTransformer transformer)
Add a new ClassFileTransformer to the context
|
void |
addTransientAppMetaData(String metaDataKey,
Object metaData)
Stores application level metadata in the context so other deployer's
can have access to it.
|
void |
clean() |
void |
createApplicationClassLoader(ClassLoaderHierarchy clh,
ArchiveHandler handler)
Create the final class loader.
|
void |
createDeploymentClassLoader(ClassLoaderHierarchy clh,
ArchiveHandler handler)
Create the deployment class loader.
|
ActionReport |
getActionReport()
Gets the action report for this context
|
File |
getAppAltDDDir()
Returns the alternate deployment descriptor directory for the
application (used for holding the external alternate deployment
descriptors).
|
File |
getAppInternalDir()
Returns the internal directory for the application (used for holding
the uploaded archive, for example).
|
List<URI> |
getAppLibs()
gets the app-libs specified for this archive
This list includes --libraries as well EXTENSION_LIST specified in the manifest entries |
Properties |
getAppProps()
Returns the application level properties that will be persisted as a
key value pair at then end of deployment.
|
ArchiveHandler |
getArchiveHandler()
Returns the archive handler that's associated with this context
|
ClassLoader |
getClassLoader()
Returns the class loader associated to this deployment request.
|
ClassLoader |
getClassLoader(boolean sharable) |
<U extends OpsParams> |
getCommandParameters(Class<U> commandParametersType)
Returns the DeployCommand parameters
|
ClassLoader |
getFinalClassLoader()
Returns the class loader associated to this deployment request.
|
Logger |
getLogger()
Returns the logger services implementation should use to log useful
information about their execution.
|
Map<String,ArchiveHandler> |
getModuleArchiveHandlers()
Gets the archive handlers for modules
|
Map<String,ExtendedDeploymentContext> |
getModuleDeploymentContexts()
Gets the deployment context for modules
|
Collection<Object> |
getModuleMetadata()
Returns all the metadata associated with this deployment
|
<T> T |
getModuleMetaData(Class<T> metadataType)
Returns the meta data associated with a module type.
|
Properties |
getModuleProps()
Returns the module level properties that will be persisted as a
key value pair at then end of deployment.
|
Map<String,Properties> |
getModulePropsMap()
Gets the module properties for modules
|
String |
getModuleUri()
Gets the module uri for this module context
|
ReadableArchive |
getOriginalSource()
Gets the original source archive
In case of archive deployment, this will return the archive before
expanding.
|
ExtendedDeploymentContext |
getParentContext()
Gets the parent context of the module
|
ExtendedDeploymentContext.Phase |
getPhase() |
File |
getScratchDir(String subDirName)
Returns a scratch directory that can be used to store things in.
|
ReadableArchive |
getSource()
Application bits, at the raw level.
|
File |
getSourceDir()
Returns the directory where the original applications bits should be
stored.
|
String |
getTenant()
Returns the tenant, if one is valid for this DeploymentContext.
|
File |
getTenantDir()
Returns the directory containing the expanded tenant customization archive,
if this DC is for a tenant and if a customization archive was specified
when the tenant was provisioned.
|
List<ClassFileTransformer> |
getTransformers()
Returns the list of transformers registered to this context.
|
Map<String,Object> |
getTransientAppMetadata()
Returns all the transient app metadata associated with this deployment
|
<T> T |
getTransientAppMetaData(String key,
Class<T> metadataType)
Returns the meta data for the given key
|
void |
postDeployClean(boolean isFinalClean)
Performs any clean-up of the deployment context after deployment has
finished.
|
void |
preDestroy() |
void |
prepareScratchDirs()
Prepare the scratch directories, creating the directories
if they do not exist
|
void |
setArchiveHandler(ArchiveHandler archiveHandler)
Sets the archive handler that's associated with this context
|
void |
setClassLoader(ClassLoader cloader)
Sets the classloader
|
void |
setModulePropsMap(Map<String,Properties> modulePropsMap)
Sets the module properties for modules
|
void |
setModuleUri(String moduleUri)
Sets the module uri for this module context
|
void |
setParentContext(ExtendedDeploymentContext parentContext)
Sets the parent context for the module
|
void |
setPhase(ExtendedDeploymentContext.Phase newPhase)
Sets the phase of the deployment activity.
|
void |
setSource(ReadableArchive source)
Sets the source archive
|
void |
setTenant(String tenant,
String appName)
Sets the tenant to which this deployment context applies.
|
public static final Logger deplLogger
public DeploymentContextImpl(Deployment.DeploymentContextBuilder builder, ServerEnvironment env)
public DeploymentContextImpl(ActionReport actionReport, Logger logger, ReadableArchive source, OpsParams params, ServerEnvironment env)
public DeploymentContextImpl(ActionReport actionReport, ReadableArchive source, OpsParams params, ServerEnvironment env)
public ExtendedDeploymentContext.Phase getPhase()
getPhase
in interface ExtendedDeploymentContext
public void setPhase(ExtendedDeploymentContext.Phase newPhase)
ExtendedDeploymentContext
setPhase
in interface ExtendedDeploymentContext
public ReadableArchive getSource()
DeploymentContext
getSource
in interface DeploymentContext
public void setSource(ReadableArchive source)
ExtendedDeploymentContext
setSource
in interface ExtendedDeploymentContext
public <U extends OpsParams> U getCommandParameters(Class<U> commandParametersType)
DeploymentContext
getCommandParameters
in interface DeploymentContext
commandParametersType
- expected deployment operation parameters type.public Logger getLogger()
ExecutionContext
getLogger
in interface ExecutionContext
public void preDestroy()
preDestroy
in interface org.glassfish.hk2.api.PreDestroy
public ClassLoader getFinalClassLoader()
getFinalClassLoader
in interface DeploymentContext
public ClassLoader getClassLoader()
getClassLoader
in interface ApplicationContext
public void setClassLoader(ClassLoader cloader)
ExtendedDeploymentContext
setClassLoader
in interface ExtendedDeploymentContext
public void createDeploymentClassLoader(ClassLoaderHierarchy clh, ArchiveHandler handler) throws URISyntaxException, MalformedURLException
ExtendedDeploymentContext
createDeploymentClassLoader
in interface ExtendedDeploymentContext
clh
- the hierarchy of class loader for the parenthandler
- the archive handler for the source archiveURISyntaxException
MalformedURLException
public void createApplicationClassLoader(ClassLoaderHierarchy clh, ArchiveHandler handler) throws URISyntaxException, MalformedURLException
ExtendedDeploymentContext
createApplicationClassLoader
in interface ExtendedDeploymentContext
clh
- the hierarchy of class loader for the parenthandler
- the archive handler for the source archiveURISyntaxException
MalformedURLException
public ClassLoader getClassLoader(boolean sharable)
public File getScratchDir(String subDirName)
getScratchDir
in interface DeploymentContext
subDirName
- the sub directory name of the scratch dirpublic File getSourceDir()
getSourceDir
in interface DeploymentContext
public void addModuleMetaData(Object metaData)
DeploymentContext
addModuleMetaData
in interface DeploymentContext
metaData
- the meta data itselfpublic <T> T getModuleMetaData(Class<T> metadataType)
DeploymentContext
getModuleMetaData
in interface DeploymentContext
metadataType
- type of the meta date.public Collection<Object> getModuleMetadata()
DeploymentContext
getModuleMetadata
in interface DeploymentContext
public Map<String,Object> getTransientAppMetadata()
DeploymentContext
getTransientAppMetadata
in interface DeploymentContext
public void addTransientAppMetaData(String metaDataKey, Object metaData)
DeploymentContext
addTransientAppMetaData
in interface DeploymentContext
metaDataKey
- key of the meta date.metaData
- the meta data itselfpublic <T> T getTransientAppMetaData(String key, Class<T> metadataType)
DeploymentContext
getTransientAppMetaData
in interface DeploymentContext
key
- key of the meta date.metadataType
- type of the meta date.public Properties getAppProps()
getAppProps
in interface ApplicationContext
public Properties getModuleProps()
getModuleProps
in interface ApplicationContext
public void addTransformer(ClassFileTransformer transformer)
addTransformer
in interface DeploymentContext
transformer
- the new class file transformer to register to the new application
class loaderUnsupportedOperationException
- 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 byteocode enhancement feature.public List<ClassFileTransformer> getTransformers()
getTransformers
in interface ExtendedDeploymentContext
public List<URI> getAppLibs() throws URISyntaxException
DeploymentContext
getAppLibs
in interface DeploymentContext
URISyntaxException
- when unable to get the library URIspublic void clean()
clean
in interface ExtendedDeploymentContext
public ArchiveHandler getArchiveHandler()
DeploymentContext
getArchiveHandler
in interface DeploymentContext
public void setArchiveHandler(ArchiveHandler archiveHandler)
ExtendedDeploymentContext
setArchiveHandler
in interface ExtendedDeploymentContext
public ReadableArchive getOriginalSource()
DeploymentContext
getOriginalSource
in interface DeploymentContext
public Map<String,Properties> getModulePropsMap()
getModulePropsMap
in interface DeploymentContext
public void setModulePropsMap(Map<String,Properties> modulePropsMap)
setModulePropsMap
in interface ExtendedDeploymentContext
modulePropsMap
- public void setParentContext(ExtendedDeploymentContext parentContext)
setParentContext
in interface ExtendedDeploymentContext
parentContext
- public ExtendedDeploymentContext getParentContext()
getParentContext
in interface ExtendedDeploymentContext
public String getModuleUri()
getModuleUri
in interface ExtendedDeploymentContext
public void setModuleUri(String moduleUri)
setModuleUri
in interface ExtendedDeploymentContext
moduleUri
- public Map<String,ArchiveHandler> getModuleArchiveHandlers()
getModuleArchiveHandlers
in interface DeploymentContext
public Map<String,ExtendedDeploymentContext> getModuleDeploymentContexts()
getModuleDeploymentContexts
in interface ExtendedDeploymentContext
public ActionReport getActionReport()
getActionReport
in interface DeploymentContext
public File getAppInternalDir()
ExtendedDeploymentContext
getAppInternalDir
in interface ExtendedDeploymentContext
public File getAppAltDDDir()
ExtendedDeploymentContext
getAppAltDDDir
in interface ExtendedDeploymentContext
public void setTenant(String tenant, String appName)
ExtendedDeploymentContext
setTenant
in interface ExtendedDeploymentContext
appName
- the name of the applicationpublic String getTenant()
ExtendedDeploymentContext
getTenant
in interface ExtendedDeploymentContext
public File getTenantDir()
ExtendedDeploymentContext
getTenantDir
in interface ExtendedDeploymentContext
public void postDeployClean(boolean isFinalClean)
ExtendedDeploymentContext
This method can be invoked either with "true", meaning that this is the final clean-up for the DC, or with "false," meaning that the DC implementation should be selective. (Some data is used, for instance, in the DeployCommand logic after ApplicationLifeCycle.deploy has completed.)
postDeployClean
in interface ExtendedDeploymentContext
isFinalClean
- whether this clean is the final clean or a selective one.public void prepareScratchDirs() throws IOException
prepareScratchDirs
in interface ExtendedDeploymentContext
IOException
Copyright © 2019. All rights reserved.