// NOTE - It seems that the Context for global JNDI resources
// is left in read-write mode, so we do not have to change it here
if (name.equals("ejb")) {
if (oldValue != null) {
ContextEjb ejb = (ContextEjb) oldValue;
if (ejb.getName() != null) {
removeEjb(ejb.getName());
}
}
if (newValue != null) {
ContextEjb ejb = (ContextEjb) newValue;
if (ejb.getName() != null) {
addEjb(ejb);
}
}
} else if (name.equals("environment")) {
if (oldValue != null) {
ContextEnvironment env = (ContextEnvironment) oldValue;
if (env.getName() != null) {
removeEnvironment(env.getName());
}
}
if (newValue != null) {
ContextEnvironment env = (ContextEnvironment) newValue;
if (env.getName() != null) {
addEnvironment(env);
}
}
} else if (name.equals("localEjb")) {
if (oldValue != null) {
ContextLocalEjb ejb = (ContextLocalEjb) oldValue;
if (ejb.getName() != null) {
removeLocalEjb(ejb.getName());
}
}
if (newValue != null) {
ContextLocalEjb ejb = (ContextLocalEjb) newValue;
if (ejb.getName() != null) {
addLocalEjb(ejb);
}
}
} else if (name.equals("resource")) {
if (oldValue != null) {
ContextResource resource = (ContextResource) oldValue;
if (resource.getName() != null) {
removeResource(resource.getName());
}
}
if (newValue != null) {
ContextResource resource = (ContextResource) newValue;
if (resource.getName() != null) {
addResource(resource);
}
}
} else if (name.equals("resourceEnvRef")) {
if (oldValue != null) {
String update = (String) oldValue;
int colon = update.indexOf(':');
removeResourceEnvRef(update.substring(0, colon));
}
if (newValue != null) {
String update = (String) newValue;
int colon = update.indexOf(':');
addResourceEnvRef(update.substring(0, colon),
update.substring(colon + 1));
}
} else if (name.equals("resourceLink")) {
if (oldValue != null) {
ContextResourceLink rl = (ContextResourceLink) oldValue;
if (rl.getName() != null) {
removeResourceLink(rl.getName());
}
}
if (newValue != null) {
ContextResourceLink rl = (ContextResourceLink) newValue;
if (rl.getName() != null) {
addResourceLink(rl);
}
}
} else if (name.equals("resourceParams")) {
String resourceParamsName = null;
ResourceParams rp = null;
if (oldValue != null) {
rp = (ResourceParams) oldValue;
}
if (newValue != null) {
rp = (ResourceParams) newValue;
}
if (rp != null) {
resourceParamsName = rp.getName();
}
if (resourceParamsName != null) {
ContextEjb ejb = namingResources.findEjb(resourceParamsName);
if (ejb != null) {
removeEjb(resourceParamsName);
addEjb(ejb);
}
ContextResource resource =