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 classApplicationLifecycle.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 ApplicationsapplicationsApplicationRegistryappRegistryprotected DeploymentLifecycleProbeProviderdeploymentLifecycleProbeProviderprotected Domaindomainprotected Loggerloggerprotected SnifferManagerImplsnifferManager-
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.BuildercreateBuilder(boolean modelUnAnnotatedMembers, Logger logger)ApplicationInfodeploy(Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)ApplicationInfodeploy(ExtendedDeploymentContext context)ExtendedDeploymentContextdisable(UndeployCommandParameters commandParams, Application app, ApplicationInfo appInfo, ActionReport report, Logger logger)ExtendedDeploymentContextenable(String target, Application app, ApplicationRef appRef, ActionReport report, Logger logger)ApplicationInfoget(String appName)ArchiveHandlergetArchiveHandler(ReadableArchive archive)Returns the ArchiveHandler for the passed archive abstraction or null if there are none.ArchiveHandlergetArchiveHandler(ReadableArchive archive, String type)Returns the ArchiveHandler for the passed archive abstraction or null if there are none.Deployment.DeploymentContextBuildergetBuilder(Logger logger, OpsParams params, ActionReport report)ExtendedDeploymentContextgetCurrentDeploymentContext()Returns thread-local deployment, which is the currently-executing deployment context, or null if noneStringgetDefaultTarget(Boolean isClassicStyle)StringgetDefaultTarget(String appName, OpsParams.Origin origin, Boolean isClassicStyle)org.glassfish.hk2.classmodel.reflect.ParsergetDeployableParser(ReadableArchive source, boolean skipScanExternalLibProp, boolean modelUnAnnotatedMembers, StructuredDeploymentTracing tracing, Logger logger)org.glassfish.hk2.classmodel.reflect.ParsergetDeployableParser(ReadableArchive source, boolean skipScanExternalLibProp, boolean modelUnAnnotatedMembers, StructuredDeploymentTracing tracing, Logger logger, DeploymentContext deploymentContext)org.glassfish.hk2.classmodel.reflect.TypesgetDeployableTypes(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()voidinitialize(ApplicationInfo appInfo, Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)booleanisAppEnabled(Application app)booleanisRegistered(String appName)voidpostConstruct()Deployment.ApplicationDeploymentprepare(Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)TransactionprepareAppConfigChanges(DeploymentContext context)ParameterMapprepareInstanceDeployParamMap(DeploymentContext dc)ModuleInfoprepareModule(List<EngineInfo> sortedEngineInfos, String moduleName, DeploymentContext context, ProgressTracker tracker)org.glassfish.hk2.classmodel.reflect.ParserprocessParsing(boolean skipScanExternalLibProp, StructuredDeploymentTracing tracing, org.glassfish.hk2.classmodel.reflect.Parser parser, ReadableArchiveScannerAdapter scannerAdapter, DeploymentSpan mainScanSpan, DeploymentContext deploymentContext)org.glassfish.hk2.classmodel.reflect.ParserprocessParsing(ReadableArchive source, boolean skipScanExternalLibProp, StructuredDeploymentTracing tracing, org.glassfish.hk2.classmodel.reflect.Parser parser, ReadableArchiveScannerAdapter scannerAdapter, DeploymentSpan mainScanSpan)voidregisterAppInDomainXML(ApplicationInfo applicationInfo, DeploymentContext context, Transaction t)voidregisterAppInDomainXML(ApplicationInfo applicationInfo, DeploymentContext context, Transaction t, boolean appRefOnly)voidregisterTenantWithAppInDomainXML(String appName, ExtendedDeploymentContext context)booleanresume(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 booleanstartContainers(Collection<EngineInfo> containersInfo, Logger logger, DeploymentContext context)protected voidstopContainers(EngineInfo[] ctrInfos, Logger logger)booleansuspend(String appName)Suspends this application.voidundeploy(String appName, ExtendedDeploymentContext context)ApplicationInfounload(ApplicationInfo info, ExtendedDeploymentContext context)voidunregisterAppFromDomainXML(String appName, String target)voidunregisterAppFromDomainXML(String appName, String tgt, boolean appRefOnly)voidunregisterTenantWithAppInDomainXML(String appName, String tenantName)voidupdateAppEnabledAttributeInDomainXML(String appName, String target, boolean enabled)voidvalidateDeploymentTarget(String target, String name, boolean isRedeploy)voidvalidateSpecifiedTarget(String target)voidvalidateUndeploymentTarget(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:
postConstructin 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:
getArchiveHandlerin 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:
getArchiveHandlerin 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:
preparein interfaceDeployment
-
initialize
public void initialize(ApplicationInfo appInfo, Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)
- Specified by:
initializein interfaceDeployment
-
deploy
public ApplicationInfo deploy(ExtendedDeploymentContext context)
- Specified by:
deployin interfaceDeployment
-
deploy
public ApplicationInfo deploy(Collection<? extends Sniffer> sniffers, ExtendedDeploymentContext context)
- Specified by:
deployin interfaceDeployment
-
getDeployableTypes
public org.glassfish.hk2.classmodel.reflect.Types getDeployableTypes(DeploymentContext context) throws IOException
Description copied from interface:DeploymentScans 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:
getDeployableTypesin 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:
setupContainerInfosin interfaceDeployment- Throws:
Exception
-
getSniffers
public Collection<? extends Sniffer> getSniffers(ArchiveHandler handler, Collection<? extends Sniffer> sniffers, DeploymentContext context)
- Specified by:
getSniffersin 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:
setupContainerInfosin interfaceDeployment- Parameters:
handler-sniffers-context-- Returns:
- Throws:
Exception
-
getTypeByProvider
public Map<Class,ApplicationMetaDataProvider> getTypeByProvider()
- Specified by:
getTypeByProviderin interfaceDeployment
-
prepareModule
public ModuleInfo prepareModule(List<EngineInfo> sortedEngineInfos, String moduleName, DeploymentContext context, ProgressTracker tracker) throws Exception
- Specified by:
prepareModulein 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:
unloadin interfaceDeployment
-
undeploy
public void undeploy(String appName, ExtendedDeploymentContext context)
- Specified by:
undeployin interfaceDeployment
-
prepareAppConfigChanges
public Transaction prepareAppConfigChanges(DeploymentContext context) throws TransactionFailure
- Specified by:
prepareAppConfigChangesin interfaceDeployment- Throws:
TransactionFailure
-
registerAppInDomainXML
public void registerAppInDomainXML(ApplicationInfo applicationInfo, DeploymentContext context, Transaction t) throws TransactionFailure
- Specified by:
registerAppInDomainXMLin interfaceDeployment- Throws:
TransactionFailure
-
registerAppInDomainXML
public void registerAppInDomainXML(ApplicationInfo applicationInfo, DeploymentContext context, Transaction t, boolean appRefOnly) throws TransactionFailure
- Specified by:
registerAppInDomainXMLin interfaceDeployment- Throws:
TransactionFailure
-
registerTenantWithAppInDomainXML
public void registerTenantWithAppInDomainXML(String appName, ExtendedDeploymentContext context) throws TransactionFailure
- Specified by:
registerTenantWithAppInDomainXMLin interfaceDeployment- Throws:
TransactionFailure
-
unregisterTenantWithAppInDomainXML
public void unregisterTenantWithAppInDomainXML(String appName, String tenantName) throws TransactionFailure, RetryableException
- Specified by:
unregisterTenantWithAppInDomainXMLin interfaceDeployment- Throws:
TransactionFailureRetryableException
-
unregisterAppFromDomainXML
public void unregisterAppFromDomainXML(String appName, String target) throws TransactionFailure
- Specified by:
unregisterAppFromDomainXMLin interfaceDeployment- Throws:
TransactionFailure
-
unregisterAppFromDomainXML
public void unregisterAppFromDomainXML(String appName, String tgt, boolean appRefOnly) throws TransactionFailure
- Specified by:
unregisterAppFromDomainXMLin interfaceDeployment- Throws:
TransactionFailure
-
updateAppEnabledAttributeInDomainXML
public void updateAppEnabledAttributeInDomainXML(String appName, String target, boolean enabled) throws TransactionFailure
- Specified by:
updateAppEnabledAttributeInDomainXMLin interfaceDeployment- Throws:
TransactionFailure
-
isRegistered
public boolean isRegistered(String appName)
- Specified by:
isRegisteredin interfaceDeployment
-
get
public ApplicationInfo get(String appName)
- Specified by:
getin interfaceDeployment
-
getDefaultTarget
public String getDefaultTarget(Boolean isClassicStyle)
- Specified by:
getDefaultTargetin interfaceDeployment
-
getDefaultTarget
public String getDefaultTarget(String appName, OpsParams.Origin origin, Boolean isClassicStyle)
- Specified by:
getDefaultTargetin interfaceDeployment
-
getBuilder
public Deployment.DeploymentContextBuilder getBuilder(Logger logger, OpsParams params, ActionReport report)
- Specified by:
getBuilderin interfaceDeployment
-
prepareInstanceDeployParamMap
public ParameterMap prepareInstanceDeployParamMap(DeploymentContext dc) throws Exception
- Specified by:
prepareInstanceDeployParamMapin interfaceDeployment- Throws:
Exception
-
validateDeploymentTarget
public void validateDeploymentTarget(String target, String name, boolean isRedeploy)
- Specified by:
validateDeploymentTargetin interfaceDeployment
-
validateUndeploymentTarget
public void validateUndeploymentTarget(String target, String name)
- Specified by:
validateUndeploymentTargetin interfaceDeployment
-
validateSpecifiedTarget
public void validateSpecifiedTarget(String target)
- Specified by:
validateSpecifiedTargetin interfaceDeployment
-
isAppEnabled
public boolean isAppEnabled(Application app)
- Specified by:
isAppEnabledin interfaceDeployment
-
disable
public ExtendedDeploymentContext disable(UndeployCommandParameters commandParams, Application app, ApplicationInfo appInfo, ActionReport report, Logger logger) throws Exception
- Specified by:
disablein interfaceDeployment- Throws:
Exception
-
enable
public ExtendedDeploymentContext enable(String target, Application app, ApplicationRef appRef, ActionReport report, Logger logger) throws Exception
- Specified by:
enablein interfaceDeployment- Throws:
Exception
-
getSniffersFromApp
public List<Sniffer> getSniffersFromApp(Application app)
- Specified by:
getSniffersFromAppin interfaceDeployment
-
getCurrentDeploymentContext
public ExtendedDeploymentContext getCurrentDeploymentContext()
Description copied from interface:DeploymentReturns thread-local deployment, which is the currently-executing deployment context, or null if none- Specified by:
getCurrentDeploymentContextin interfaceDeployment- Returns:
- Currently-executing deployment context
-
-