Package org.apache.catalina.deploy
Class NamingResourcesImpl
java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.deploy.NamingResourcesImpl
- All Implemented Interfaces:
Serializable
,MBeanRegistration
,JmxEnabled
,Lifecycle
,NamingResources
public class NamingResourcesImpl
extends LifecycleMBeanBase
implements Serializable, NamingResources
Holds and manages the naming resources defined in the J2EE Enterprise Naming Context and their associated JNDI
context.
- Author:
- Remy Maucherat
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
Lifecycle.SingleUse
-
Field Summary
Modifier and TypeFieldDescriptionprotected final PropertyChangeSupport
The property change support for this component.Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase
mserver
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEjb
(ContextEjb ejb) Add an EJB resource reference for this web application.void
addEnvironment
(ContextEnvironment environment) Add an environment entry for this web application.void
Add a local EJB resource reference for this web application.void
Add a message destination reference for this web application.void
Add a property change listener to this component.void
addResource
(ContextResource resource) Add a resource reference for this web application.void
addResourceEnvRef
(ContextResourceEnvRef resource) Add a resource environment reference for this web application.void
addResourceLink
(ContextResourceLink resourceLink) Add a resource link for this web application.void
addService
(ContextService service) Add a web service reference for this web application.protected void
Sub-classes wishing to perform additional clean-up should override this method, ensuring that super.destroyInternal() is the last call in the overriding method.findEjbs()
findEnvironment
(String name) findLocalEjb
(String name) findResource
(String name) findResourceEnvRef
(String name) findResourceLink
(String name) findService
(String name) protected String
Method implemented by sub-classes to identify the domain in which MBeans should be registered.protected String
Allow sub-classes to specify the key properties component of theObjectName
that will be used to register this component.protected void
Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.void
Remove any EJB resource reference with the specified name.void
removeEnvironment
(String name) Remove any environment entry with the specified name.void
removeLocalEjb
(String name) Remove any local EJB resource reference with the specified name.void
Remove any message destination reference with the specified name.void
Remove a property change listener from this component.void
removeResource
(String name) Remove any resource reference with the specified name.void
removeResourceEnvRef
(String name) Remove any resource environment reference with the specified name.void
removeResourceLink
(String name) Remove any resource link with the specified name.void
removeService
(String name) Remove any web service reference with the specified name.void
setContainer
(Object container) Set the container with which the naming resources are associated.void
setTransaction
(ContextTransaction transaction) Set the transaction object.protected void
Sub-classes must ensure that the state is changed toLifecycleState.STARTING
during the execution of this method.protected void
Sub-classes must ensure that the state is changed toLifecycleState.STOPPING
during the execution of this method.Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
-
Field Details
-
support
The property change support for this component.
-
-
Constructor Details
-
NamingResourcesImpl
public NamingResourcesImpl()Create a new NamingResources instance.
-
-
Method Details
-
getContainer
- Specified by:
getContainer
in interfaceNamingResources
- Returns:
- the container with which the naming resources are associated.
-
setContainer
Set the container with which the naming resources are associated.- Parameters:
container
- the associated with the resources
-
setTransaction
Set the transaction object.- Parameters:
transaction
- the transaction descriptor
-
getTransaction
- Returns:
- the transaction object.
-
addEjb
Add an EJB resource reference for this web application.- Parameters:
ejb
- New EJB resource reference
-
addEnvironment
Add an environment entry for this web application.- Specified by:
addEnvironment
in interfaceNamingResources
- Parameters:
environment
- New environment entry
-
addLocalEjb
Add a local EJB resource reference for this web application.- Parameters:
ejb
- New EJB resource reference
-
addMessageDestinationRef
Add a message destination reference for this web application.- Parameters:
mdr
- New message destination reference
-
addPropertyChangeListener
Add a property change listener to this component.- Parameters:
listener
- The listener to add
-
addResource
Add a resource reference for this web application.- Specified by:
addResource
in interfaceNamingResources
- Parameters:
resource
- New resource reference
-
addResourceEnvRef
Add a resource environment reference for this web application.- Parameters:
resource
- The resource
-
addResourceLink
Add a resource link for this web application.- Specified by:
addResourceLink
in interfaceNamingResources
- Parameters:
resourceLink
- New resource link
-
addService
Add a web service reference for this web application.- Parameters:
service
- New web service reference
-
findEjb
- Parameters:
name
- Name of the desired EJB resource reference- Returns:
- the EJB resource reference with the specified name, if any; otherwise, return
null
.
-
findEjbs
- Returns:
- the defined EJB resource references for this application. If there are none, a zero-length array is returned.
-
findEnvironment
- Parameters:
name
- Name of the desired environment entry- Returns:
- the environment entry with the specified name, if any; otherwise, return
null
.
-
findEnvironments
- Returns:
- the set of defined environment entries for this web application. If none have been defined, a zero-length array is returned.
-
findLocalEjb
- Parameters:
name
- Name of the desired EJB resource reference- Returns:
- the local EJB resource reference with the specified name, if any; otherwise, return
null
.
-
findLocalEjbs
- Returns:
- the defined local EJB resource references for this application. If there are none, a zero-length array is returned.
-
findMessageDestinationRef
- Parameters:
name
- Name of the desired message destination reference- Returns:
- the message destination reference with the specified name, if any; otherwise, return
null
.
-
findMessageDestinationRefs
- Returns:
- the defined message destination references for this application. If there are none, a zero-length array is returned.
-
findResource
- Parameters:
name
- Name of the desired resource reference- Returns:
- the resource reference with the specified name, if any; otherwise return
null
.
-
findResourceLink
- Parameters:
name
- Name of the desired resource link- Returns:
- the resource link with the specified name, if any; otherwise return
null
.
-
findResourceLinks
- Returns:
- the defined resource links for this application. If none have been defined, a zero-length array is returned.
-
findResources
- Returns:
- the defined resource references for this application. If none have been defined, a zero-length array is returned.
-
findResourceEnvRef
- Parameters:
name
- Name of the desired resource environment reference- Returns:
- the resource environment reference type for the specified name, if any; otherwise return
null
.
-
findResourceEnvRefs
- Returns:
- the set of resource environment reference names for this web application. If none have been specified, a zero-length array is returned.
-
findService
- Parameters:
name
- Name of the desired web service- Returns:
- the web service reference for the specified name, if any; otherwise return
null
.
-
findServices
- Returns:
- the defined web service references for this application. If none have been defined, a zero-length array is returned.
-
removeEjb
Remove any EJB resource reference with the specified name.- Parameters:
name
- Name of the EJB resource reference to remove
-
removeEnvironment
Remove any environment entry with the specified name.- Specified by:
removeEnvironment
in interfaceNamingResources
- Parameters:
name
- Name of the environment entry to remove
-
removeLocalEjb
Remove any local EJB resource reference with the specified name.- Parameters:
name
- Name of the EJB resource reference to remove
-
removeMessageDestinationRef
Remove any message destination reference with the specified name.- Parameters:
name
- Name of the message destination resource reference to remove
-
removePropertyChangeListener
Remove a property change listener from this component.- Parameters:
listener
- The listener to remove
-
removeResource
Remove any resource reference with the specified name.- Specified by:
removeResource
in interfaceNamingResources
- Parameters:
name
- Name of the resource reference to remove
-
removeResourceEnvRef
Remove any resource environment reference with the specified name.- Parameters:
name
- Name of the resource environment reference to remove
-
removeResourceLink
Remove any resource link with the specified name.- Specified by:
removeResourceLink
in interfaceNamingResources
- Parameters:
name
- Name of the resource link to remove
-
removeService
Remove any web service reference with the specified name.- Parameters:
name
- Name of the web service reference to remove
-
initInternal
Description copied from class:LifecycleMBeanBase
Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.- Overrides:
initInternal
in classLifecycleMBeanBase
- Throws:
LifecycleException
- If the initialisation fails
-
startInternal
Description copied from class:LifecycleBase
Sub-classes must ensure that the state is changed toLifecycleState.STARTING
during the execution of this method. Changing state will trigger theLifecycle.START_EVENT
event. If a component fails to start it may either throw aLifecycleException
which will cause it's parent to fail to start or it can place itself in the error state in which caseLifecycleBase.stop()
will be called on the failed component but the parent component will continue to start normally.- Specified by:
startInternal
in classLifecycleBase
- Throws:
LifecycleException
- Start error occurred
-
stopInternal
Description copied from class:LifecycleBase
Sub-classes must ensure that the state is changed toLifecycleState.STOPPING
during the execution of this method. Changing state will trigger theLifecycle.STOP_EVENT
event.- Specified by:
stopInternal
in classLifecycleBase
- Throws:
LifecycleException
- Stop error occurred
-
destroyInternal
Description copied from class:LifecycleMBeanBase
Sub-classes wishing to perform additional clean-up should override this method, ensuring that super.destroyInternal() is the last call in the overriding method.- Overrides:
destroyInternal
in classLifecycleMBeanBase
- Throws:
LifecycleException
- If the destruction fails
-
getDomainInternal
Description copied from class:LifecycleMBeanBase
Method implemented by sub-classes to identify the domain in which MBeans should be registered.- Specified by:
getDomainInternal
in classLifecycleMBeanBase
- Returns:
- The name of the domain to use to register MBeans.
-
getObjectNameKeyProperties
Description copied from class:LifecycleMBeanBase
Allow sub-classes to specify the key properties component of theObjectName
that will be used to register this component.- Specified by:
getObjectNameKeyProperties
in classLifecycleMBeanBase
- Returns:
- The string representation of the key properties component of the
desired
ObjectName
-