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 ExtendedDeploymentContextpublic void setPhase(ExtendedDeploymentContext.Phase newPhase)
ExtendedDeploymentContextsetPhase in interface ExtendedDeploymentContextpublic ReadableArchive getSource()
DeploymentContextgetSource in interface DeploymentContextpublic void setSource(ReadableArchive source)
ExtendedDeploymentContextsetSource in interface ExtendedDeploymentContextpublic <U extends OpsParams> U getCommandParameters(Class<U> commandParametersType)
DeploymentContextgetCommandParameters in interface DeploymentContextcommandParametersType - expected deployment operation parameters type.public Logger getLogger()
ExecutionContextgetLogger in interface ExecutionContextpublic void preDestroy()
preDestroy in interface org.glassfish.hk2.api.PreDestroypublic ClassLoader getFinalClassLoader()
getFinalClassLoader in interface DeploymentContextpublic ClassLoader getClassLoader()
getClassLoader in interface ApplicationContextpublic void setClassLoader(ClassLoader cloader)
ExtendedDeploymentContextsetClassLoader in interface ExtendedDeploymentContextpublic void createDeploymentClassLoader(ClassLoaderHierarchy clh, ArchiveHandler handler) throws URISyntaxException, MalformedURLException
ExtendedDeploymentContextcreateDeploymentClassLoader in interface ExtendedDeploymentContextclh - the hierarchy of class loader for the parenthandler - the archive handler for the source archiveURISyntaxExceptionMalformedURLExceptionpublic void createApplicationClassLoader(ClassLoaderHierarchy clh, ArchiveHandler handler) throws URISyntaxException, MalformedURLException
ExtendedDeploymentContextcreateApplicationClassLoader in interface ExtendedDeploymentContextclh - the hierarchy of class loader for the parenthandler - the archive handler for the source archiveURISyntaxExceptionMalformedURLExceptionpublic ClassLoader getClassLoader(boolean sharable)
public File getScratchDir(String subDirName)
getScratchDir in interface DeploymentContextsubDirName - the sub directory name of the scratch dirpublic File getSourceDir()
getSourceDir in interface DeploymentContextpublic void addModuleMetaData(Object metaData)
DeploymentContextaddModuleMetaData in interface DeploymentContextmetaData - the meta data itselfpublic <T> T getModuleMetaData(Class<T> metadataType)
DeploymentContextgetModuleMetaData in interface DeploymentContextmetadataType - type of the meta date.public Collection<Object> getModuleMetadata()
DeploymentContextgetModuleMetadata in interface DeploymentContextpublic Map<String,Object> getTransientAppMetadata()
DeploymentContextgetTransientAppMetadata in interface DeploymentContextpublic void addTransientAppMetaData(String metaDataKey, Object metaData)
DeploymentContextaddTransientAppMetaData in interface DeploymentContextmetaDataKey - key of the meta date.metaData - the meta data itselfpublic <T> T getTransientAppMetaData(String key, Class<T> metadataType)
DeploymentContextgetTransientAppMetaData in interface DeploymentContextkey - key of the meta date.metadataType - type of the meta date.public Properties getAppProps()
getAppProps in interface ApplicationContextpublic Properties getModuleProps()
getModuleProps in interface ApplicationContextpublic void addTransformer(ClassFileTransformer transformer)
addTransformer in interface DeploymentContexttransformer - 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 ExtendedDeploymentContextpublic List<URI> getAppLibs() throws URISyntaxException
DeploymentContextgetAppLibs in interface DeploymentContextURISyntaxException - when unable to get the library URIspublic void clean()
clean in interface ExtendedDeploymentContextpublic ArchiveHandler getArchiveHandler()
DeploymentContextgetArchiveHandler in interface DeploymentContextpublic void setArchiveHandler(ArchiveHandler archiveHandler)
ExtendedDeploymentContextsetArchiveHandler in interface ExtendedDeploymentContextpublic ReadableArchive getOriginalSource()
DeploymentContextgetOriginalSource in interface DeploymentContextpublic Map<String,Properties> getModulePropsMap()
getModulePropsMap in interface DeploymentContextpublic void setModulePropsMap(Map<String,Properties> modulePropsMap)
setModulePropsMap in interface ExtendedDeploymentContextmodulePropsMap - public void setParentContext(ExtendedDeploymentContext parentContext)
setParentContext in interface ExtendedDeploymentContextparentContext - public ExtendedDeploymentContext getParentContext()
getParentContext in interface ExtendedDeploymentContextpublic String getModuleUri()
getModuleUri in interface ExtendedDeploymentContextpublic void setModuleUri(String moduleUri)
setModuleUri in interface ExtendedDeploymentContextmoduleUri - public Map<String,ArchiveHandler> getModuleArchiveHandlers()
getModuleArchiveHandlers in interface DeploymentContextpublic Map<String,ExtendedDeploymentContext> getModuleDeploymentContexts()
getModuleDeploymentContexts in interface ExtendedDeploymentContextpublic ActionReport getActionReport()
getActionReport in interface DeploymentContextpublic File getAppInternalDir()
ExtendedDeploymentContextgetAppInternalDir in interface ExtendedDeploymentContextpublic File getAppAltDDDir()
ExtendedDeploymentContextgetAppAltDDDir in interface ExtendedDeploymentContextpublic void setTenant(String tenant, String appName)
ExtendedDeploymentContextsetTenant in interface ExtendedDeploymentContextappName - the name of the applicationpublic String getTenant()
ExtendedDeploymentContextgetTenant in interface ExtendedDeploymentContextpublic File getTenantDir()
ExtendedDeploymentContextgetTenantDir in interface ExtendedDeploymentContextpublic void postDeployClean(boolean isFinalClean)
ExtendedDeploymentContextThis 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 ExtendedDeploymentContextisFinalClean - whether this clean is the final clean or a selective one.public void prepareScratchDirs()
throws IOException
prepareScratchDirs in interface ExtendedDeploymentContextIOExceptionCopyright © 2019. All rights reserved.