use of org.apache.catalina.deploy.NamingResources in project tomcat70 by apache.
the class NamingResourcesMBean method removeResource.
/**
* Remove any resource reference with the specified name.
*
* @param resourceName Name of the resource reference to remove
*/
public void removeResource(String resourceName) {
resourceName = ObjectName.unquote(resourceName);
NamingResources nresources = (NamingResources) this.resource;
if (nresources == null) {
return;
}
ContextResource resource = nresources.findResource(resourceName);
if (resource == null) {
throw new IllegalArgumentException("Invalid resource name '" + resourceName + "'");
}
nresources.removeResource(resourceName);
}
use of org.apache.catalina.deploy.NamingResources in project tomcat70 by apache.
the class NamingResourcesMBean method getEnvironments.
// ------------------------------------------------------------- Attributes
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs = ((NamingResources) this.resource).findEnvironments();
ArrayList<String> results = new ArrayList<String>();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException("Cannot create object name for environment " + envs[i]);
iae.initCause(e);
throw iae;
}
}
return results.toArray(new String[results.size()]);
}
use of org.apache.catalina.deploy.NamingResources in project tomcat70 by apache.
the class NamingResourcesMBean method getResources.
/**
* Return the MBean Names of all the defined resource references for this
* application.
*/
public String[] getResources() {
ContextResource[] resources = ((NamingResources) this.resource).findResources();
ArrayList<String> results = new ArrayList<String>();
for (int i = 0; i < resources.length; i++) {
try {
ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), resources[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException("Cannot create object name for resource " + resources[i]);
iae.initCause(e);
throw iae;
}
}
return results.toArray(new String[results.size()]);
}
use of org.apache.catalina.deploy.NamingResources in project tomcat70 by apache.
the class ContextEnvironmentMBean method setAttribute.
// ----------------------------------------------------- Instance Variables
// ------------------------------------------------------------- Attributes
/**
* Set the value of a specific attribute of this MBean.
*
* @param attribute The identification of the attribute to be set
* and the new value
*
* @exception AttributeNotFoundException if this attribute is not
* supported by this MBean
* @exception MBeanException if the initializer of an object
* throws an exception
* @exception ReflectionException if a Java reflection exception
* occurs when invoking the getter
*/
@Override
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, MBeanException, ReflectionException {
super.setAttribute(attribute);
ContextEnvironment ce = null;
try {
ce = (ContextEnvironment) getManagedResource();
} catch (InstanceNotFoundException e) {
throw new MBeanException(e);
} catch (InvalidTargetObjectTypeException e) {
throw new MBeanException(e);
}
// cannot use side-effects. It's removed and added back each time
// there is a modification in a resource.
NamingResources nr = ce.getNamingResources();
nr.removeEnvironment(ce.getName());
nr.addEnvironment(ce);
}
use of org.apache.catalina.deploy.NamingResources in project Payara by payara.
the class StandardContext method setNamingResources.
/**
* Set the naming resources for this web application.
*
* @param namingResources The new naming resources
*/
@Override
public void setNamingResources(NamingResources namingResources) {
// Process the property setting change
NamingResources oldNamingResources = this.namingResources;
this.namingResources = namingResources;
support.firePropertyChange("namingResources", oldNamingResources, this.namingResources);
}
Aggregations