if (isLookupRef(naming, ref)) {
return;
}
ContextEnvironment environment = naming.findEnvironment(ref.referenceName.replaceAll("^comp/env/", ""));
boolean addEntry = false;
if (environment == null) {
environment = new ContextEnvironment();
environment.setName(ref.referenceName.replaceAll("^comp/env/", ""));
addEntry = true;
}
environment.setType(ref.type);
environment.setValue(ref.value);
environment.setOverride(false);
if (addEntry) {
naming.addEnvironment(environment);
}
if (replaceEntry) {
ContextAccessController.setWritable(namingContextListener.getName(), standardContext.getNamingToken());
if (!addEntry) {
namingContextListener.removeEnvironment(environment.getName());
}
namingContextListener.addEnvironment(environment);
ContextAccessController.setReadOnly(namingContextListener.getName());
}
}