if (!(descriptor instanceof SipBundleDescriptor)) {
throw new IllegalArgumentException(getClass() +
" cannot handles descriptors of type " + descriptor.getClass());
}
SipBundleDescriptor bundleDescriptor = (SipBundleDescriptor) descriptor;
Element web = (Element) super.writeDescriptor(parent, descriptor);
SunSipApp sunSipApp = bundleDescriptor.getSipApplication().
getSunSipDescriptor();
// security-role-mapping
SecurityRoleMapping[] roleMappings = sunSipApp.getSecurityRoleMapping();
if ((roleMappings != null) && (roleMappings.length > 0)) {
SecurityRoleMappingNode srmn = new SecurityRoleMappingNode();
for (int i = 0; i < roleMappings.length; i++) {
srmn.writeDescriptor(web,
RuntimeTagNames.SECURITY_ROLE_MAPPING, roleMappings[i]);
}
}
if (sunSipApp.getSessionConfig() != null) {
SessionConfigNode scn = new SessionConfigNode();
scn.writeDescriptor(web, RuntimeTagNames.SESSION_CONFIG,
sunSipApp.getSessionConfig());
}
// ejb-ref*
EjbRef[] ejbRefs = sunSipApp.getEjbRef();
if ((ejbRefs != null) && (ejbRefs.length > 0)) {
EjbRefNode node = new EjbRefNode();
for (int i = 0; i < ejbRefs.length; i++) {
node.writeDescriptor(web, RuntimeTagNames.EJB_REF, ejbRefs[i]);
}
}
// resource-ref*
ResourceRef[] resourceRefs = sunSipApp.getResourceRef();
if ((resourceRefs != null) && (resourceRefs.length > 0)) {
ResourceRefNode node = new ResourceRefNode();
for (int i = 0; i < resourceRefs.length; i++) {
node.writeDescriptor(web, RuntimeTagNames.RESOURCE_REF,
resourceRefs[i]);
}
}
// resource-env-ref*
ResourceEnvRef[] resourceEnvRefs = sunSipApp.getResourceEnvRef();
if ((resourceEnvRefs != null) && (resourceEnvRefs.length > 0)) {
ResourceEnvRefNode node = new ResourceEnvRefNode();
for (int i = 0; i < resourceEnvRefs.length; i++) {
node.writeDescriptor(web, RuntimeTagNames.RESOURCE_ENV_REF,
resourceEnvRefs[i]);
}
}
// service-ref*
if (bundleDescriptor.hasServiceReferenceDescriptors()) {
ServiceRefNode serviceNode = new ServiceRefNode();
for (Iterator serviceItr = bundleDescriptor.getServiceReferenceDescriptors()
.iterator();
serviceItr.hasNext();) {
ServiceReferenceDescriptor next = (ServiceReferenceDescriptor) serviceItr.next();
serviceNode.writeDescriptor(web,
WebServicesTagNames.SERVICE_REF, next);