if (name == null)
throw new RuntimeOperationsException
(new IllegalArgumentException("Attribute name is null"),
"Attribute name is null");
ContextResourceLink crl = null;
try {
crl = (ContextResourceLink) getManagedResource();
} catch (InstanceNotFoundException e) {
throw new MBeanException(e);
} catch (InvalidTargetObjectTypeException e) {
throw new MBeanException(e);
}
if ("global".equals(name)) {
crl.setGlobal((String)value);
} else if ("description".equals(name)) {
crl.setDescription((String)value);
} else if ("name".equals(name)) {
crl.setName((String)value);
} else if ("type".equals(name)) {
crl.setType((String)value);
} else {
crl.setProperty(name, ""+value);
}
// cannot use side-effects. It's removed and added back each time
// there is a modification in a resource.
NamingResources nr = crl.getNamingResources();
nr.removeResourceLink(crl.getName());
nr.addResourceLink(crl);
}