ContextAccessController.setReadOnly(namingContextListener.getName());
}
}
public void mergeRef(NamingResources naming, ResourceEnvReferenceInfo ref) {
ContextResourceEnvRef resourceEnv = naming.findResourceEnvRef(ref.resourceEnvRefName);
boolean addEntry = false;
if (resourceEnv == null) {
resourceEnv = new ContextResourceEnvRef();
resourceEnv.setName(ref.resourceEnvRefName);
addEntry = true;
}
if (UserTransaction.class.getName().equals(ref.resourceEnvRefType)) {
resourceEnv.setProperty(Constants.FACTORY, UserTransactionFactory.class.getName());
resourceEnv.setType(ref.resourceEnvRefType);
} else {
resourceEnv.setProperty(Constants.FACTORY, ResourceFactory.class.getName());
resourceEnv.setProperty(NAME, ref.resourceEnvRefName);
resourceEnv.setType(ref.resourceEnvRefType);
if (ref.resourceID != null) {
resourceEnv.setProperty(RESOURCE_ID, ref.resourceID);
}
if (ref.location != null) {
resourceEnv.setProperty(JNDI_NAME, ref.location.jndiName);
resourceEnv.setProperty(JNDI_PROVIDER_ID, ref.location.jndiProviderId);
}
}
if (addEntry) {
naming.addResourceEnvRef(resourceEnv);
}
if (replaceEntry) {
ContextAccessController.setWritable(namingContextListener.getName(), standardContext);
if (!addEntry) namingContextListener.removeResourceEnvRef(resourceEnv.getName());
namingContextListener.addResourceEnvRef(resourceEnv);
ContextAccessController.setReadOnly(namingContextListener.getName());
}
}