Methods Summary |
---|
public java.lang.String | addEnvironment(java.lang.String envName, java.lang.String type, java.lang.String value)Add an environment entry for this web application.
NamingResources nresources = (NamingResources) this.resource;
if (nresources == null) {
return null;
}
ContextEnvironment env = nresources.findEnvironment(envName);
if (env != null) {
throw new IllegalArgumentException
("Invalid environment name - already exists '" + envName + "'");
}
env = new ContextEnvironment();
env.setName(envName);
env.setType(type);
env.setValue(value);
nresources.addEnvironment(env);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("ContextEnvironment");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), env);
return (oname.toString());
|
public java.lang.String | addResource(java.lang.String resourceName, java.lang.String type)Add a resource reference for this web application.
NamingResources nresources = (NamingResources) this.resource;
if (nresources == null) {
return null;
}
ContextResource resource = nresources.findResource(resourceName);
if (resource != null) {
throw new IllegalArgumentException
("Invalid resource name - already exists'" + resourceName + "'");
}
resource = new ContextResource();
resource.setName(resourceName);
resource.setType(type);
nresources.addResource(resource);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("ContextResource");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), resource);
return (oname.toString());
|
public java.lang.String | addResourceLink(java.lang.String resourceLinkName, java.lang.String type)Add a resource link reference for this web application.
NamingResources nresources = (NamingResources) this.resource;
if (nresources == null) {
return null;
}
ContextResourceLink resourceLink =
nresources.findResourceLink(resourceLinkName);
if (resourceLink != null) {
throw new IllegalArgumentException
("Invalid resource link name - already exists'" +
resourceLinkName + "'");
}
resourceLink = new ContextResourceLink();
resourceLink.setName(resourceLinkName);
resourceLink.setType(type);
nresources.addResourceLink(resourceLink);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("ContextResourceLink");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), resourceLink);
return (oname.toString());
|
public java.lang.String[] | getEnvironments()Return the MBean Names of the set of defined environment entries for
this web application
// ------------------------------------------------------------- Attributes
ContextEnvironment[] envs =
((NamingResources)this.resource).findEnvironments();
ArrayList results = new ArrayList();
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 ((String[]) results.toArray(new String[results.size()]));
|
public java.lang.String[] | getResourceLinks()Return the MBean Names of all the defined resource link references for
this application.
ContextResourceLink[] resourceLinks =
((NamingResources)this.resource).findResourceLinks();
ArrayList results = new ArrayList();
for (int i = 0; i < resourceLinks.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), resourceLinks[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for resource " + resourceLinks[i]);
iae.initCause(e);
throw iae;
}
}
return ((String[]) results.toArray(new String[results.size()]));
|
public java.lang.String[] | getResources()Return the MBean Names of all the defined resource references for this
application.
ContextResource[] resources =
((NamingResources)this.resource).findResources();
ArrayList results = new ArrayList();
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 ((String[]) results.toArray(new String[results.size()]));
|
public void | removeEnvironment(java.lang.String envName)Remove any environment entry with the specified name.
NamingResources nresources = (NamingResources) this.resource;
if (nresources == null) {
return;
}
ContextEnvironment env = nresources.findEnvironment(envName);
if (env == null) {
throw new IllegalArgumentException
("Invalid environment name '" + envName + "'");
}
nresources.removeEnvironment(envName);
|
public void | removeResource(java.lang.String resourceName)Remove any resource reference with the specified name.
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);
|
public void | removeResourceLink(java.lang.String resourceLinkName)Remove any resource link reference with the specified name.
resourceLinkName = ObjectName.unquote(resourceLinkName);
NamingResources nresources = (NamingResources) this.resource;
if (nresources == null) {
return;
}
ContextResourceLink resourceLink =
nresources.findResourceLink(resourceLinkName);
if (resourceLink == null) {
throw new IllegalArgumentException
("Invalid resource Link name '" + resourceLinkName + "'");
}
nresources.removeResourceLink(resourceLinkName);
|