Package com.sun.enterprise.v3.server
Class ApplicationLifecycle
- java.lang.Object
-
- com.sun.enterprise.v3.server.ApplicationLifecycle
-
- All Implemented Interfaces:
org.glassfish.hk2.api.PostConstruct
,Deployment
@Service @Singleton public class ApplicationLifecycle extends Object implements Deployment, org.glassfish.hk2.api.PostConstruct
Application Loader is providing useful methods to load applications- Author:
- Jerome Dochez, Sanjeeb Sahoo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ApplicationLifecycle.DeploymentContextBuidlerImpl
-
Nested classes/interfaces inherited from interface org.glassfish.internal.deployment.Deployment
Deployment.ApplicationDeployment, Deployment.DeploymentContextBuilder
-
-
Field Summary
Fields Modifier and Type Field Description protected Applications
applications
ApplicationRegistry
appRegistry
protected DeploymentLifecycleProbeProvider
deploymentLifecycleProbeProvider
protected Domain
domain
protected Logger
logger
protected SnifferManagerImpl
snifferManager
-
Fields inherited from interface org.glassfish.internal.deployment.Deployment
AFTER_APPLICATION_CLASSLOADER_CREATION, AFTER_DEPLOYMENT_CLASSLOADER_CREATION, ALL_APPLICATIONS_LOADED, ALL_APPLICATIONS_PROCESSED, ALL_APPLICATIONS_STOPPED, APPLICATION_CLEANED, APPLICATION_DISABLED, APPLICATION_LOADED, APPLICATION_PREPARED, APPLICATION_STARTED, APPLICATION_STOPPED, APPLICATION_UNLOADED, DEPLOYMENT_BEFORE_CLASSLOADER_CREATION, DEPLOYMENT_COMMAND_FINISH, DEPLOYMENT_FAILURE, DEPLOYMENT_FAILURE_NAME, DEPLOYMENT_START, DEPLOYMENT_SUCCESS, DISABLE_START, INITIAL_CONTEXT_CREATED, MODULE_CLEANED, MODULE_LOADED, MODULE_PREPARED, MODULE_STARTED, MODULE_STOPPED, MODULE_UNLOADED, UNDEPLOYMENT_FAILURE, UNDEPLOYMENT_START, UNDEPLOYMENT_SUCCESS, UNDEPLOYMENT_VALIDATION
-
-
Constructor Summary
Constructors Constructor Description ApplicationLifecycle()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.glassfish.hk2.classmodel.reflect.ParsingContext.Builder
createBuilder(boolean modelUnAnnotatedMembers, Logger logger)
ApplicationInfo
deploy(Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)
ApplicationInfo
deploy(ExtendedDeploymentContext context)
ExtendedDeploymentContext
disable(UndeployCommandParameters commandParams, Application app, ApplicationInfo appInfo, ActionReport report, Logger logger)
ExtendedDeploymentContext
enable(String target, Application app, ApplicationRef appRef, ActionReport report, Logger logger)
ApplicationInfo
get(String appName)
ArchiveHandler
getArchiveHandler(ReadableArchive archive)
Returns the ArchiveHandler for the passed archive abstraction or null if there are none.ArchiveHandler
getArchiveHandler(ReadableArchive archive, String type)
Returns the ArchiveHandler for the passed archive abstraction or null if there are none.Deployment.DeploymentContextBuilder
getBuilder(Logger logger, OpsParams params, ActionReport report)
ExtendedDeploymentContext
getCurrentDeploymentContext()
Returns thread-local deployment, which is the currently-executing deployment context, or null if noneString
getDefaultTarget(Boolean isClassicStyle)
String
getDefaultTarget(String appName, OpsParams.Origin origin, Boolean isClassicStyle)
org.glassfish.hk2.classmodel.reflect.Parser
getDeployableParser(ReadableArchive source, boolean skipScanExternalLibProp, boolean modelUnAnnotatedMembers, StructuredDeploymentTracing tracing, Logger logger)
org.glassfish.hk2.classmodel.reflect.Parser
getDeployableParser(ReadableArchive source, boolean skipScanExternalLibProp, boolean modelUnAnnotatedMembers, StructuredDeploymentTracing tracing, Logger logger, DeploymentContext deploymentContext)
org.glassfish.hk2.classmodel.reflect.Types
getDeployableTypes(DeploymentContext context)
Scans the source of the deployment operation for all types and store the result in the deployment context.Collection<? extends Sniffer>
getSniffers(ArchiveHandler handler, Collection<? extends Sniffer> sniffers, DeploymentContext context)
List<Sniffer>
getSniffersFromApp(Application app)
Map<Class,ApplicationMetaDataProvider>
getTypeByProvider()
void
initialize(ApplicationInfo appInfo, Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)
boolean
isAppEnabled(Application app)
boolean
isRegistered(String appName)
void
postConstruct()
Deployment.ApplicationDeployment
prepare(Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)
Transaction
prepareAppConfigChanges(DeploymentContext context)
ParameterMap
prepareInstanceDeployParamMap(DeploymentContext dc)
ModuleInfo
prepareModule(List<EngineInfo> sortedEngineInfos, String moduleName, DeploymentContext context, ProgressTracker tracker)
org.glassfish.hk2.classmodel.reflect.Parser
processParsing(boolean skipScanExternalLibProp, StructuredDeploymentTracing tracing, org.glassfish.hk2.classmodel.reflect.Parser parser, ReadableArchiveScannerAdapter scannerAdapter, DeploymentSpan mainScanSpan, DeploymentContext deploymentContext)
org.glassfish.hk2.classmodel.reflect.Parser
processParsing(ReadableArchive source, boolean skipScanExternalLibProp, StructuredDeploymentTracing tracing, org.glassfish.hk2.classmodel.reflect.Parser parser, ReadableArchiveScannerAdapter scannerAdapter, DeploymentSpan mainScanSpan)
void
registerAppInDomainXML(ApplicationInfo applicationInfo, DeploymentContext context, Transaction t)
void
registerAppInDomainXML(ApplicationInfo applicationInfo, DeploymentContext context, Transaction t, boolean appRefOnly)
void
registerTenantWithAppInDomainXML(String appName, ExtendedDeploymentContext context)
boolean
resume(String appName)
Resumes this application.protected Collection<EngineInfo>
setupContainer(Sniffer sniffer, Logger logger, DeploymentContext context)
List<EngineInfo>
setupContainerInfos(ArchiveHandler handler, Collection<? extends Sniffer> sniffers, DeploymentContext context)
set up containers and prepare the sorted ModuleInfosList<EngineInfo>
setupContainerInfos(DeploymentContext context)
protected boolean
startContainers(Collection<EngineInfo> containersInfo, Logger logger, DeploymentContext context)
protected void
stopContainers(EngineInfo[] ctrInfos, Logger logger)
boolean
suspend(String appName)
Suspends this application.void
undeploy(String appName, ExtendedDeploymentContext context)
ApplicationInfo
unload(ApplicationInfo info, ExtendedDeploymentContext context)
void
unregisterAppFromDomainXML(String appName, String target)
void
unregisterAppFromDomainXML(String appName, String tgt, boolean appRefOnly)
void
unregisterTenantWithAppInDomainXML(String appName, String tenantName)
void
updateAppEnabledAttributeInDomainXML(String appName, String target, boolean enabled)
void
validateDeploymentTarget(String target, String name, boolean isRedeploy)
void
validateSpecifiedTarget(String target)
void
validateUndeploymentTarget(String target, String name)
-
-
-
Field Detail
-
snifferManager
@Inject protected SnifferManagerImpl snifferManager
-
appRegistry
@Inject public ApplicationRegistry appRegistry
-
applications
@Inject protected Applications applications
-
domain
@Inject protected Domain domain
-
logger
protected Logger logger
-
deploymentLifecycleProbeProvider
protected DeploymentLifecycleProbeProvider deploymentLifecycleProbeProvider
-
-
Method Detail
-
postConstruct
public void postConstruct()
- Specified by:
postConstruct
in interfaceorg.glassfish.hk2.api.PostConstruct
-
getArchiveHandler
public ArchiveHandler getArchiveHandler(ReadableArchive archive) throws IOException
Returns the ArchiveHandler for the passed archive abstraction or null if there are none.- Specified by:
getArchiveHandler
in interfaceDeployment
- Parameters:
archive
- the archive to find the handler for- Returns:
- the archive handler or null if not found.
- Throws:
IOException
- when an error occur
-
getArchiveHandler
public ArchiveHandler getArchiveHandler(ReadableArchive archive, String type) throws IOException
Returns the ArchiveHandler for the passed archive abstraction or null if there are none.- Specified by:
getArchiveHandler
in interfaceDeployment
- Parameters:
archive
- the archive to find the handler fortype
- the type of the archive- Returns:
- the archive handler or null if not found.
- Throws:
IOException
- when an error occur
-
prepare
public Deployment.ApplicationDeployment prepare(Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)
- Specified by:
prepare
in interfaceDeployment
-
initialize
public void initialize(ApplicationInfo appInfo, Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)
- Specified by:
initialize
in interfaceDeployment
-
deploy
public ApplicationInfo deploy(ExtendedDeploymentContext context)
- Specified by:
deploy
in interfaceDeployment
-
deploy
public ApplicationInfo deploy(Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)
- Specified by:
deploy
in interfaceDeployment
-
getDeployableTypes
public org.glassfish.hk2.classmodel.reflect.Types getDeployableTypes(DeploymentContext context) throws IOException
Description copied from interface:Deployment
Scans the source of the deployment operation for all types and store the result in the deployment context. Subsequent calls will return the cached copy from the context- Specified by:
getDeployableTypes
in interfaceDeployment
- Parameters:
context
- deployment context- Returns:
- the types information from the deployment artifacts
- Throws:
IOException
- if the scanning fails due to an I/O exception
-
getDeployableParser
public org.glassfish.hk2.classmodel.reflect.Parser getDeployableParser(ReadableArchive source, boolean skipScanExternalLibProp, boolean modelUnAnnotatedMembers, StructuredDeploymentTracing tracing, Logger logger, DeploymentContext deploymentContext) throws IOException
- Throws:
IOException
-
getDeployableParser
public org.glassfish.hk2.classmodel.reflect.Parser getDeployableParser(ReadableArchive source, boolean skipScanExternalLibProp, boolean modelUnAnnotatedMembers, StructuredDeploymentTracing tracing, Logger logger) throws IOException
- Throws:
IOException
-
processParsing
public org.glassfish.hk2.classmodel.reflect.Parser processParsing(ReadableArchive source, boolean skipScanExternalLibProp, StructuredDeploymentTracing tracing, org.glassfish.hk2.classmodel.reflect.Parser parser, ReadableArchiveScannerAdapter scannerAdapter, DeploymentSpan mainScanSpan) throws IOException
- Throws:
IOException
-
processParsing
public org.glassfish.hk2.classmodel.reflect.Parser processParsing(boolean skipScanExternalLibProp, StructuredDeploymentTracing tracing, org.glassfish.hk2.classmodel.reflect.Parser parser, ReadableArchiveScannerAdapter scannerAdapter, DeploymentSpan mainScanSpan, DeploymentContext deploymentContext) throws IOException
- Throws:
IOException
-
createBuilder
public org.glassfish.hk2.classmodel.reflect.ParsingContext.Builder createBuilder(boolean modelUnAnnotatedMembers, Logger logger)
-
suspend
public boolean suspend(String appName)
Suspends this application.- Parameters:
appName
- the registration application ID- Returns:
- true if suspending was successful, false otherwise.
-
resume
public boolean resume(String appName)
Resumes this application.- Parameters:
appName
- the registration application ID- Returns:
- true if resumption was successful, false otherwise.
-
setupContainerInfos
public List<EngineInfo> setupContainerInfos(DeploymentContext context) throws Exception
- Specified by:
setupContainerInfos
in interfaceDeployment
- Throws:
Exception
-
getSniffers
public Collection<? extends Sniffer> getSniffers(ArchiveHandler handler, Collection<? extends Sniffer> sniffers, DeploymentContext context)
- Specified by:
getSniffers
in interfaceDeployment
-
setupContainerInfos
public List<EngineInfo> setupContainerInfos(ArchiveHandler handler, Collection<? extends Sniffer> sniffers, DeploymentContext context) throws Exception
set up containers and prepare the sorted ModuleInfos- Specified by:
setupContainerInfos
in interfaceDeployment
- Parameters:
handler
-sniffers
-context
-- Returns:
- Throws:
Exception
-
getTypeByProvider
public Map<Class,ApplicationMetaDataProvider> getTypeByProvider()
- Specified by:
getTypeByProvider
in interfaceDeployment
-
prepareModule
public ModuleInfo prepareModule(List<EngineInfo> sortedEngineInfos, String moduleName, DeploymentContext context, ProgressTracker tracker) throws Exception
- Specified by:
prepareModule
in interfaceDeployment
- Throws:
Exception
-
setupContainer
protected Collection<EngineInfo> setupContainer(Sniffer sniffer, Logger logger, DeploymentContext context)
-
startContainers
protected boolean startContainers(Collection<EngineInfo> containersInfo, Logger logger, DeploymentContext context)
-
stopContainers
protected void stopContainers(EngineInfo[] ctrInfos, Logger logger)
-
unload
public ApplicationInfo unload(ApplicationInfo info, ExtendedDeploymentContext context)
- Specified by:
unload
in interfaceDeployment
-
undeploy
public void undeploy(String appName, ExtendedDeploymentContext context)
- Specified by:
undeploy
in interfaceDeployment
-
prepareAppConfigChanges
public Transaction prepareAppConfigChanges(DeploymentContext context) throws TransactionFailure
- Specified by:
prepareAppConfigChanges
in interfaceDeployment
- Throws:
TransactionFailure
-
registerAppInDomainXML
public void registerAppInDomainXML(ApplicationInfo applicationInfo, DeploymentContext context, Transaction t) throws TransactionFailure
- Specified by:
registerAppInDomainXML
in interfaceDeployment
- Throws:
TransactionFailure
-
registerAppInDomainXML
public void registerAppInDomainXML(ApplicationInfo applicationInfo, DeploymentContext context, Transaction t, boolean appRefOnly) throws TransactionFailure
- Specified by:
registerAppInDomainXML
in interfaceDeployment
- Throws:
TransactionFailure
-
registerTenantWithAppInDomainXML
public void registerTenantWithAppInDomainXML(String appName, ExtendedDeploymentContext context) throws TransactionFailure
- Specified by:
registerTenantWithAppInDomainXML
in interfaceDeployment
- Throws:
TransactionFailure
-
unregisterTenantWithAppInDomainXML
public void unregisterTenantWithAppInDomainXML(String appName, String tenantName) throws TransactionFailure, RetryableException
- Specified by:
unregisterTenantWithAppInDomainXML
in interfaceDeployment
- Throws:
TransactionFailure
RetryableException
-
unregisterAppFromDomainXML
public void unregisterAppFromDomainXML(String appName, String target) throws TransactionFailure
- Specified by:
unregisterAppFromDomainXML
in interfaceDeployment
- Throws:
TransactionFailure
-
unregisterAppFromDomainXML
public void unregisterAppFromDomainXML(String appName, String tgt, boolean appRefOnly) throws TransactionFailure
- Specified by:
unregisterAppFromDomainXML
in interfaceDeployment
- Throws:
TransactionFailure
-
updateAppEnabledAttributeInDomainXML
public void updateAppEnabledAttributeInDomainXML(String appName, String target, boolean enabled) throws TransactionFailure
- Specified by:
updateAppEnabledAttributeInDomainXML
in interfaceDeployment
- Throws:
TransactionFailure
-
isRegistered
public boolean isRegistered(String appName)
- Specified by:
isRegistered
in interfaceDeployment
-
get
public ApplicationInfo get(String appName)
- Specified by:
get
in interfaceDeployment
-
getDefaultTarget
public String getDefaultTarget(Boolean isClassicStyle)
- Specified by:
getDefaultTarget
in interfaceDeployment
-
getDefaultTarget
public String getDefaultTarget(String appName, OpsParams.Origin origin, Boolean isClassicStyle)
- Specified by:
getDefaultTarget
in interfaceDeployment
-
getBuilder
public Deployment.DeploymentContextBuilder getBuilder(Logger logger, OpsParams params, ActionReport report)
- Specified by:
getBuilder
in interfaceDeployment
-
prepareInstanceDeployParamMap
public ParameterMap prepareInstanceDeployParamMap(DeploymentContext dc) throws Exception
- Specified by:
prepareInstanceDeployParamMap
in interfaceDeployment
- Throws:
Exception
-
validateDeploymentTarget
public void validateDeploymentTarget(String target, String name, boolean isRedeploy)
- Specified by:
validateDeploymentTarget
in interfaceDeployment
-
validateUndeploymentTarget
public void validateUndeploymentTarget(String target, String name)
- Specified by:
validateUndeploymentTarget
in interfaceDeployment
-
validateSpecifiedTarget
public void validateSpecifiedTarget(String target)
- Specified by:
validateSpecifiedTarget
in interfaceDeployment
-
isAppEnabled
public boolean isAppEnabled(Application app)
- Specified by:
isAppEnabled
in interfaceDeployment
-
disable
public ExtendedDeploymentContext disable(UndeployCommandParameters commandParams, Application app, ApplicationInfo appInfo, ActionReport report, Logger logger) throws Exception
- Specified by:
disable
in interfaceDeployment
- Throws:
Exception
-
enable
public ExtendedDeploymentContext enable(String target, Application app, ApplicationRef appRef, ActionReport report, Logger logger) throws Exception
- Specified by:
enable
in interfaceDeployment
- Throws:
Exception
-
getSniffersFromApp
public List<Sniffer> getSniffersFromApp(Application app)
- Specified by:
getSniffersFromApp
in interfaceDeployment
-
getCurrentDeploymentContext
public ExtendedDeploymentContext getCurrentDeploymentContext()
Description copied from interface:Deployment
Returns thread-local deployment, which is the currently-executing deployment context, or null if none- Specified by:
getCurrentDeploymentContext
in interfaceDeployment
- Returns:
- Currently-executing deployment context
-
-