ResourceRef resourceRef = (ResourceRef) newDescriptor;
descriptor.getSipApplication().getSunSipDescriptor().
addResourceRef(resourceRef);
try {
ResourceReferenceDescriptor rrd = descriptor.getSipApplication().
getResourceReferenceByName(resourceRef.getResRefName());
if( rrd == null) {
descriptor.getResourceReferenceByName(resourceRef.getResRefName());
}
rrd.setJndiName(resourceRef.getJndiName());
DefaultResourcePrincipal drp = resourceRef.getDefaultResourcePrincipal();
if (drp != null) {
ResourcePrincipal rp = new ResourcePrincipal(drp.getName(),
drp.getPassword());
rrd.setResourcePrincipal(rp);
}
} catch (IllegalArgumentException iae) {
DOLUtils.getDefaultLogger().warning(iae.getMessage());
}
} else if (newDescriptor instanceof ResourceEnvRef) {
ResourceEnvRef resourceEnvRef = (ResourceEnvRef) newDescriptor;
descriptor.getSipApplication().
getSunSipDescriptor().addResourceEnvRef(resourceEnvRef);
try {
JmsDestinationReferenceDescriptor rrd =
descriptor.getSipApplication().
getJmsDestinationReferenceByName(resourceEnvRef.
getResourceEnvRefName());
if(rrd == null ) {
rrd = descriptor.getJmsDestinationReferenceByName(
resourceEnvRef.getResourceEnvRefName());
}
rrd.setJndiName(resourceEnvRef.getJndiName());
} catch (IllegalArgumentException iae) {
DOLUtils.getDefaultLogger().warning(iae.getMessage());
}
} else if (newDescriptor instanceof ServiceReferenceDescriptor) {
descriptor.addServiceReferenceDescriptor((ServiceReferenceDescriptor) newDescriptor);