Package org.glassfish.resources.deployer
Class ExternalJndiResourceDeployer
- java.lang.Object
-
- org.glassfish.resources.deployer.ExternalJndiResourceDeployer
-
- All Implemented Interfaces:
ResourceDeployer
@Service @Singleton public class ExternalJndiResourceDeployer extends Object implements ResourceDeployer
Handles external-jndi resource events in the server instance. The external-jndi resource events from the admin instance are propagated to this object. The methods can potentially be called concurrently, therefore implementation need to be synchronized.- Since:
- JDK1.4
- Author:
- Nazrul Islam
-
-
Constructor Summary
Constructors Constructor Description ExternalJndiResourceDeployer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canDeploy(boolean postApplicationDeployment, Collection<Resource> allResources, Resource resource)
A deployer can indicate whether a particular resource can be deployed before application deployment Used in case of application-scoped-resources eg: Embedded RAR resources are created after application (that has embedded .rar) deployment.void
deployResource(Object resource)
Deploy the resource into the server's runtime naming contextvoid
deployResource(Object resource, String applicationName, String moduleName)
Deploy the resource into the server's runtime naming context This API is used in cases where the "config" bean is not yet persisted in domain.xml and is part of the "config" transaction.void
disableResource(Object resource)
Disable the resource in the server's runtime naming contextvoid
enableResource(Object resource)
Enable the resource in the server's runtime naming contextClass[]
getProxyClassesForDynamicReconfiguration()
List of classes which need to be proxied for dynamic-reconfigurationboolean
handles(Object resource)
Indicates whether a particular resource deployer can handle the resource in questionvoid
installExternalJndiResource(ExternalJndiResource extJndiRes, ResourceInfo resourceInfo)
Installs the given external jndi resource.void
redeployResource(Object resource)
Redeploy the resource into the server's runtime naming contextboolean
supportsDynamicReconfiguration()
Indicates whether the resource deployer can handle transparent-dynamic-reconfiguration of resourcestatic JavaEEResource
toExternalJndiJavaEEResource(ExternalJndiResource rbean, ResourceInfo resourceInfo)
Returns a new instance of j2ee external jndi resource from the given config bean.void
undeployResource(Object resource)
Undeploy the resource from the server's runtime naming contextvoid
undeployResource(Object resource, String applicationName, String moduleName)
Undeploy the resource from the server's runtime naming contextvoid
uninstallExternalJndiResource(JavaEEResource resource, ResourceInfo resourceInfo)
Un-installs the external jndi resource.void
validatePreservedResource(Application oldApp, Application newApp, Resource resource, Resources allResources)
-
-
-
Method Detail
-
deployResource
public void deployResource(Object resource, String applicationName, String moduleName) throws Exception
Deploy the resource into the server's runtime naming context This API is used in cases where the "config" bean is not yet persisted in domain.xml and is part of the "config" transaction.- Specified by:
deployResource
in interfaceResourceDeployer
- Parameters:
resource
- a resource object (eg. JmsResource)applicationName
- application-namemoduleName
- module-name- Throws:
Exception
- thrown if fail
-
deployResource
public void deployResource(Object resource) throws Exception
Deploy the resource into the server's runtime naming context- Specified by:
deployResource
in interfaceResourceDeployer
- Parameters:
resource
- a resource object (eg. JmsResource)- Throws:
Exception
- thrown if fail
-
undeployResource
public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception
Undeploy the resource from the server's runtime naming context- Specified by:
undeployResource
in interfaceResourceDeployer
- Parameters:
resource
- a resource object (eg. JmsResource)applicationName
- application-namemoduleName
- module-name- Throws:
Exception
- thrown if fail
-
undeployResource
public void undeployResource(Object resource) throws Exception
Undeploy the resource from the server's runtime naming context- Specified by:
undeployResource
in interfaceResourceDeployer
- Parameters:
resource
- a resource object (eg. JmsResource)- Throws:
Exception
- thrown if fail
-
redeployResource
public void redeployResource(Object resource) throws Exception
Redeploy the resource into the server's runtime naming context- Specified by:
redeployResource
in interfaceResourceDeployer
- Parameters:
resource
- a resource object- Throws:
Exception
- thrown if fail
-
handles
public boolean handles(Object resource)
Indicates whether a particular resource deployer can handle the resource in question- Specified by:
handles
in interfaceResourceDeployer
- Parameters:
resource
- resource that need to be handled- Returns:
- boolean
-
supportsDynamicReconfiguration
public boolean supportsDynamicReconfiguration()
Description copied from interface:ResourceDeployer
Indicates whether the resource deployer can handle transparent-dynamic-reconfiguration of resource- Specified by:
supportsDynamicReconfiguration
in interfaceResourceDeployer
- Returns:
- boolean indicating whether transparent-dynamic-reconfiguration is supported.
-
getProxyClassesForDynamicReconfiguration
public Class[] getProxyClassesForDynamicReconfiguration()
Description copied from interface:ResourceDeployer
List of classes which need to be proxied for dynamic-reconfiguration- Specified by:
getProxyClassesForDynamicReconfiguration
in interfaceResourceDeployer
- Returns:
- list of classes
-
enableResource
public void enableResource(Object resource) throws Exception
Enable the resource in the server's runtime naming context- Specified by:
enableResource
in interfaceResourceDeployer
- Parameters:
resource
- a resource object (eg. JmsResource)- Throws:
Exception
- thrown if fail
-
disableResource
public void disableResource(Object resource) throws Exception
Disable the resource in the server's runtime naming context- Specified by:
disableResource
in interfaceResourceDeployer
- Parameters:
resource
- a resource object (eg. JmsResource)- Throws:
Exception
- thrown if fail
-
installExternalJndiResource
public void installExternalJndiResource(ExternalJndiResource extJndiRes, ResourceInfo resourceInfo)
Installs the given external jndi resource. This method gets called during server initialization and from external jndi resource deployer to handle resource events.- Parameters:
extJndiRes
- external jndi resourceresourceInfo
- Information about the resource
-
uninstallExternalJndiResource
public void uninstallExternalJndiResource(JavaEEResource resource, ResourceInfo resourceInfo)
Un-installs the external jndi resource.- Parameters:
resource
- external jndi resource
-
toExternalJndiJavaEEResource
public static JavaEEResource toExternalJndiJavaEEResource(ExternalJndiResource rbean, ResourceInfo resourceInfo)
Returns a new instance of j2ee external jndi resource from the given config bean. This method gets called from the external resource deployer to convert external-jndi-resource config bean into external-jndi j2ee resource.- Parameters:
rbean
- external-jndi-resource config beanresourceInfo
-- Returns:
- a new instance of j2ee external jndi resource
-
canDeploy
public boolean canDeploy(boolean postApplicationDeployment, Collection<Resource> allResources, Resource resource)
A deployer can indicate whether a particular resource can be deployed before application deployment Used in case of application-scoped-resources eg: Embedded RAR resources are created after application (that has embedded .rar) deployment.- Specified by:
canDeploy
in interfaceResourceDeployer
- Parameters:
postApplicationDeployment
- post-application-deploymentallResources
- resources collection in which the resource being validated is present.resource
- resource to be validated- Returns:
- boolean
-
validatePreservedResource
public void validatePreservedResource(Application oldApp, Application newApp, Resource resource, Resources allResources) throws ResourceConflictException
- Specified by:
validatePreservedResource
in interfaceResourceDeployer
- Throws:
ResourceConflictException
-
-