if (getDocType()==null) { bundleNode = appendChildNS(parent, getXMLRootTag().getQName(), TagNames.J2EE_NAMESPACE); } else { bundleNode = appendChildNS(parent, getXMLRootTag().getQName(), TagNames.JAVAEE_NAMESPACE); addBundleNodeAttributes((Element) bundleNode, descriptor); } else { bundleNode = appendChild(parent, getXMLRootTag().getQName()); appendTextChild(bundleNode, ApplicationTagNames.APPLICATION_NAME, application.getAppName()); } else { appendTextChild(bundleNode, TagNames.MODULE_NAME, descriptor.getModuleDescriptor().getModuleName()); writeDisplayableComponentInfo(bundleNode, descriptor);
bundleNode.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", TagNames.J2EE_NAMESPACE); schemaLocation = TagNames.J2EE_NAMESPACE + " " + getSchemaURL(); } else { bundleNode.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", TagNames.JAVAEE_NAMESPACE); schemaLocation = TagNames.JAVAEE_NAMESPACE + " " + getSchemaURL(); addNamespaceDeclaration(bundleNode, descriptor); String clientSchemaLocation = descriptor.getSchemaLocation(); if (clientSchemaLocation!=null) { bundleNode.setAttribute(TagNames.VERSION, getSpecVersion());
final Map<String, List<Class>> versionUpgrades = new HashMap<String, List<Class>>(); String rootNodeKey = bn.registerBundle(dtdMapping); _mappingStuff.mRootNodesMutable.putIfAbsent(rootNodeKey, bn.getClass()); _mappingStuff.mRootNodesMutable.putAll(bn.registerRuntimeBundle(dtdMapping, versionUpgrades)); Collection<String> c = bn.elementsAllowingEmptyValue(); if (c.size() > 0) { _mappingStuff.mElementsAllowingEmptyValuesMutable.addAll(c); c = bn.elementsPreservingWhiteSpace(); if (c.size() > 0) { _mappingStuff.mElementsPreservingWhiteSpaceMutable.addAll(c);
/** * Adds a new DOL descriptor instance to the descriptor instance associated with * this XMLNode * * @param descriptor the new descriptor */ public void addDescriptor(Object newDescriptor) { if (newDescriptor instanceof EjbReference) { DOLUtils.getDefaultLogger().fine("Adding ejb ref " + newDescriptor); (getDescriptor()).addEjbReferenceDescriptor( (EjbReference) newDescriptor); } else { super.addDescriptor(newDescriptor); } }
/** * Sets the specVersion for this descriptor depending on the docType */ protected void setSpecVersion() { if (docType==null) return; StringTokenizer st = new StringTokenizer(docType, "//"); while (st.hasMoreElements()) { String tmp = st.nextToken(); if (tmp.startsWith("DTD")) { // this is the string we are interested in StringTokenizer versionST = new StringTokenizer(tmp); while (versionST.hasMoreElements()) { String versionStr = versionST.nextToken(); try { Float.valueOf(versionStr); RootDeploymentDescriptor rdd = (RootDeploymentDescriptor) getDescriptor(); rdd.setSpecVersion(versionStr); return; } catch(NumberFormatException nfe) { // ignore, this is just the other info of the publicID } } } } } }
/** * receives notification of the end of an XML element by the Parser * * @param element the xml tag identification * @return true if this node is done processing the XML sub tree */ public boolean endElement(XMLElement element) { if (WebTagNames.DISTRIBUTABLE.equals(element.getQName())) { descriptor.setDistributable(true); return false; } else { boolean allDone = super.endElement(element); if (allDone && servletMappings!=null) { for (Iterator keys = servletMappings.keySet().iterator(); keys.hasNext();) { String servletName = (String) keys.next(); Vector mappings = (Vector) servletMappings.get(servletName); WebComponentDescriptor servlet= descriptor.getWebComponentByCanonicalName(servletName); if (servlet!=null) { for (Iterator mapping = mappings.iterator();mapping.hasNext();) { servlet.addUrlPattern((String) mapping.next()); } } else { throw new RuntimeException("There is no web component by the name of " + servletName + " here."); } } } return allDone; } }
super.addDescriptor(newDescriptor);
Object o = getDescriptor(); if (o instanceof RootDeploymentDescriptor) { ((RootDeploymentDescriptor) o).setSchemaLocation(clientSchemaLocation); Object o = getDescriptor(); if (o instanceof BundleDescriptor) { ((BundleDescriptor) o).setFullAttribute(value);
/** * Adds a new DOL descriptor instance to the descriptor instance associated with * this XMLNode * * @param descriptor the new descriptor */ public void addDescriptor(Object newDescriptor) { if (newDescriptor instanceof EjbDescriptor) { descriptor.addEjb((EjbDescriptor) newDescriptor); } else if (newDescriptor instanceof RelationshipDescriptor) { descriptor.addRelationship((RelationshipDescriptor) newDescriptor); } else if (newDescriptor instanceof MethodPermissionDescriptor) { MethodPermissionDescriptor nd = (MethodPermissionDescriptor) newDescriptor; MethodDescriptor[] array = nd.getMethods(); for (int i=0;i<array.length;i++) { EjbDescriptor target = descriptor.getEjbByName(array[i].getEjbName()); MethodPermission[] mps = nd.getMethodPermissions(); for (int j=0;j<mps.length;j++) { DOLUtils.getDefaultLogger().fine("Adding mp " + mps[j] + " to " + array[i] + " for ejb " + array[i].getEjbName()); target.addPermissionedMethod(mps[j], array[i]); } } } else super.addDescriptor(newDescriptor); }