/** * receives notification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { if (element.getQName().equals(RuntimeTagNames.PASS_BY_REFERENCE)) { descriptor.setPassByReference("true".equalsIgnoreCase(value)); } else if (element.getQName().equals(RuntimeTagNames.UNIQUE_ID)) { DOLUtils.getDefaultLogger().finer("Ignoring unique id"); return; } else if (element.getQName().equals(RuntimeTagNames.ARCHIVE_NAME)) { descriptor.setArchiveName(value); } else if (element.getQName().equals(RuntimeTagNames.COMPATIBILITY)) { descriptor.setCompatibility(value); } else if (element.getQName().equals(RuntimeTagNames.WEB_URI)) { currentWebUri = value; } else if (element.getQName().equals(RuntimeTagNames.CONTEXT_ROOT)) { if (currentWebUri != null) { ModuleDescriptor md = descriptor.getModuleDescriptorByUri(currentWebUri); if (md == null) { throw new RuntimeException("No bundle in application with uri " + currentWebUri); } currentWebUri = null; if (md.getModuleType().equals(DOLUtils.warType())) { md.setContextRoot(value); } else { throw new RuntimeException(currentWebUri + " uri does not point to a web bundle"); } } else { throw new RuntimeException("No uri provided for this context-root " + value); } } else if (element.getQName().equals(RuntimeTagNames.KEEP_STATE)) { descriptor.setKeepState(value); } else if (element.getQName().equals(RuntimeTagNames.VERSION_IDENTIFIER)) { } else super.setElementValue(element, value); }
/** * parsed an attribute of an element * * @param the element name * @param the attribute name * @param the attribute value * @return true if the attribute was processed */ protected boolean setAttributeValue( XMLElement elementName, XMLElement attributeName, String value) { RuntimeDescriptor descriptor = (RuntimeDescriptor) getRuntimeDescriptor(); if (descriptor == null) { throw new RuntimeException("Trying to set values on a null descriptor"); } if (attributeName.getQName().equals(RuntimeTagNames.NAME)) { descriptor.setAttributeValue(WebProperty.NAME, value); return true; } else if (attributeName.getQName().equals(RuntimeTagNames.VALUE)) { descriptor.setAttributeValue(WebProperty.VALUE, value); return true; } return false; }
/** * parsed an attribute of an element * * @param elementName the element name * @param attributeName the attribute name * @param value the attribute value * @return true if the attribute was processed */ @Override protected boolean setAttributeValue( XMLElement elementName, XMLElement attributeName, String value) { RuntimeDescriptor descriptor = getDescriptor(); if (attributeName.getQName().equals(RuntimeTagNames.EXTRA_CLASS_PATH)) { descriptor.setAttributeValue(ClassLoader.EXTRA_CLASS_PATH, value); return true; } else if (attributeName.getQName().equals(RuntimeTagNames.DELEGATE)) { descriptor.setAttributeValue(ClassLoader.DELEGATE, value); return true; } else if (attributeName.getQName().equals(RuntimeTagNames.DYNAMIC_RELOAD_INTERVAL)) { descriptor.setAttributeValue(ClassLoader.DYNAMIC_RELOAD_INTERVAL, value); return true; } return false; }
/** * receives notiification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { if (WebTagNames.SERVLET_NAME.equals(element.getQName())) { descriptor.addServletName(value); } else if (WebTagNames.URL_PATTERN.equals(element.getQName())) { if (!URLPattern.isValid(value)) { // try trimming url (in case DD uses extra // whitespace for aligning) String trimmedUrl = value.trim(); // If URL Pattern does not start with "/" then // prepend it (for Servlet2.2 Web apps) Object parent = getParentNode().getDescriptor(); if (parent instanceof WebBundleDescriptor && ((WebBundleDescriptor) parent).getSpecVersion().equals("2.2")) { if (!trimmedUrl.startsWith("/") && !trimmedUrl.startsWith("*.")) { trimmedUrl = "/" + trimmedUrl; } } if (URLPattern.isValid(trimmedUrl)) { // warn user if url included \r or \n if (URLPattern.containsCRorLF(value)) { DOLUtils.getDefaultLogger() .log( Level.WARNING, "enterprise.deployment.backend.urlcontainscrlf", new Object[] {value}); } value = trimmedUrl; } else { throw new IllegalArgumentException( localStrings.getLocalString( "enterprise.deployment.invalidurlpattern", "Invalid URL Pattern: [{0}]", new Object[] {value})); } } descriptor.addURLPattern(value); } else if (WebTagNames.DISPATCHER.equals(element.getQName())) { descriptor.addDispatcher(value); } else super.setElementValue(element, value); }