Package org.glassfish.resources.module
Class ResourcesDeployer
- java.lang.Object
-
- org.glassfish.javaee.core.deployment.JavaEEDeployer<ResourcesContainer,ResourcesApplication>
-
- org.glassfish.resources.module.ResourcesDeployer
-
- All Implemented Interfaces:
Deployer<ResourcesContainer,ResourcesApplication>,EventListener,org.glassfish.hk2.api.PostConstruct,org.glassfish.hk2.api.PreDestroy
@Service public class ResourcesDeployer extends JavaEEDeployer<ResourcesContainer,ResourcesApplication> implements org.glassfish.hk2.api.PostConstruct, org.glassfish.hk2.api.PreDestroy, EventListener
ResourcesDeployer to handle "glassfish-resources.xml(s)" bundled in the application.- Author:
- Jagadish Ramu
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.api.event.EventListener
EventListener.Event<T>
-
-
Field Summary
-
Fields inherited from class org.glassfish.javaee.core.deployment.JavaEEDeployer
env, habitat, undeploymentVisitor
-
-
Constructor Summary
Constructors Constructor Description ResourcesDeployer(ResourceFactory resourceFactoryParam, ApplicationRegistry appRegistryParam, jakarta.inject.Provider<ResourceManagerFactory> resourceManagerFactoryProviderParam, ResourcesBinder resourcesBinderParam, Applications applicationsParam)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateResources(DeploymentContext dc, boolean embedded, boolean deployResources)voiddeployResources(String applicationName, boolean postDeployPhase)voiddeployResources(String applicationName, String moduleName, Collection<Resource> resources, boolean postDeployPhase)voiddeployResourcesFromConfiguration(String appName, boolean embedded)voidevent(EventListener.Event event)Event listener to listen to application undeploy validation and if preserveResources flag is set, cache the <resources> config for persisting it in domain.xmlvoidgetResources(ReadableArchive archive, String appName, List<Resource> connectorResources, List<Resource> nonConnectorResources, Map<Resource,ResourcesXMLParser> resourceXmlParsers)Retrieve connector and non-connector resources from the archive.ResourcesApplicationload(ResourcesContainer container, DeploymentContext context)Loads a previously prepared application in its execution environment and return a ContractProvider instance that will identify this environment in future communications with the application's container runtime.voidpopulateResourceConfigInAppInfo(DeploymentContext dc)During "load()" event (eg: app/app-ref enable, server start), populate resource-config in app-info so that it can be used for constructing connector-classloader for the application.voidpostConstruct()voidpreDestroy()voidretainResourceConfig(DeploymentContext dc, Map<String,Resources> allResources)retain old resource configuration for the new archive being deployed.voidretrieveAllResourcesXMLs(Map<String,String> fileNames, ReadableArchive archive, String actualArchiveName)Puts all glassfish-resources.xml files of an archive into a mapvoidunload(ResourcesApplication appContainer, DeploymentContext context)Unload or stop a previously running application identified with the ContractProvider instance.-
Methods inherited from class org.glassfish.javaee.core.deployment.JavaEEDeployer
clean, generateArtifacts, getApplicationFromApplicationInfo, getCommonClassPath, getMetaData, getModuleClassPath, getObjectType, loadMetaData, prepare
-
-
-
-
Constructor Detail
-
ResourcesDeployer
@Inject public ResourcesDeployer(ResourceFactory resourceFactoryParam, ApplicationRegistry appRegistryParam, jakarta.inject.Provider<ResourceManagerFactory> resourceManagerFactoryProviderParam, ResourcesBinder resourcesBinderParam, Applications applicationsParam)
-
-
Method Detail
-
postConstruct
public void postConstruct()
- Specified by:
postConstructin interfaceorg.glassfish.hk2.api.PostConstruct
-
preDestroy
public void preDestroy()
- Specified by:
preDestroyin interfaceorg.glassfish.hk2.api.PreDestroy
-
load
public ResourcesApplication load(ResourcesContainer container, DeploymentContext context)
Loads a previously prepared application in its execution environment and return a ContractProvider instance that will identify this environment in future communications with the application's container runtime.- Specified by:
loadin interfaceDeployer<ResourcesContainer,ResourcesApplication>- Overrides:
loadin classJavaEEDeployer<ResourcesContainer,ResourcesApplication>- Parameters:
container- in which the application will residecontext- of the deployment- Returns:
- an ApplicationContainer instance identifying the running application
-
unload
public void unload(ResourcesApplication appContainer, DeploymentContext context)
Description copied from interface:DeployerUnload or stop a previously running application identified with the ContractProvider instance. The container will be stop upon return from this method.- Specified by:
unloadin interfaceDeployer<ResourcesContainer,ResourcesApplication>- Parameters:
appContainer- instance to be stoppedcontext- of the undeployment
-
getResources
public void getResources(ReadableArchive archive, String appName, List<Resource> connectorResources, List<Resource> nonConnectorResources, Map<Resource,ResourcesXMLParser> resourceXmlParsers)
Retrieve connector and non-connector resources from the archive.- Parameters:
archive- Archieve from which the resources to be retrieved.appName- Name of the applicationconnectorResources- Connector resources will be added to this list.nonConnectorResources- Non connector resources will be added to this list.resourceXmlParsers- Resource xml parsers corresponding to both connector and non connector resources will be stored in this.
-
retainResourceConfig
public void retainResourceConfig(DeploymentContext dc, Map<String,Resources> allResources) throws Exception
retain old resource configuration for the new archive being deployed.- Parameters:
dc- DeploymentContextallResources- all resources (app scoped, module scoped) of old application- Throws:
Exception- when unable to retain old resource configuration.
-
populateResourceConfigInAppInfo
public void populateResourceConfigInAppInfo(DeploymentContext dc)
During "load()" event (eg: app/app-ref enable, server start), populate resource-config in app-info so that it can be used for constructing connector-classloader for the application.- Parameters:
dc- DeploymentContext
-
createResources
public void createResources(DeploymentContext dc, boolean embedded, boolean deployResources) throws jakarta.resource.ResourceException
- Parameters:
dc-embedded-deployResources-- Throws:
jakarta.resource.ResourceException
-
deployResourcesFromConfiguration
public void deployResourcesFromConfiguration(String appName, boolean embedded) throws Exception
- Throws:
Exception
-
deployResources
public void deployResources(String applicationName, boolean postDeployPhase) throws Exception
- Throws:
Exception
-
deployResources
public void deployResources(String applicationName, String moduleName, Collection<Resource> resources, boolean postDeployPhase) throws Exception
- Throws:
Exception
-
retrieveAllResourcesXMLs
public void retrieveAllResourcesXMLs(Map<String,String> fileNames, ReadableArchive archive, String actualArchiveName) throws IOException
Puts all glassfish-resources.xml files of an archive into a mapIf the archive is an ear all sub archives will be searched as well
- Parameters:
fileNames- Map of all glassfish-resources files. All found glassfish-resource files will be added to itarchive- The archive to search for glassfish-resources.xml filesactualArchiveName- The path of the archive- Throws:
IOException
-
event
public void event(EventListener.Event event)
Event listener to listen to application undeploy validation and if preserveResources flag is set, cache the <resources> config for persisting it in domain.xml- Specified by:
eventin interfaceEventListener- Parameters:
event-
-
-