@Override public void addDescriptor(Object newDescriptor) { if( setValueCalled ) { super.addDescriptor(newDescriptor); } else { // Don't add it to DOL. The env-entry only exists // at runtime if it has been assigned a value. } }
/** * all sub-implementation of this class can use a dispatch table to map xml element to * method name on the descriptor class for setting the element value. * * @return the map with the element name as a key, the setter method as a value */ protected Map getDispatchTable() { // no need to be synchronized for now Map table = super.getDispatchTable(); table.put(ConnectorTagNames.RESOURCE_ADAPTER_CLASS, "setResourceAdapterClass"); return table; }
/** * SAX Parser API implementation, we don't really care for now. */ public void startElement(XMLElement element, Attributes attributes) { //FIXME : remove the foll line once connector stuff works properly //((ConnectionDefDescriptor)getDescriptor()).setOutBoundDefined(true); super.startElement(element, attributes); }
public void appendQNameChild(String elementName, Node parent, String namespaceUri, String localPart, String prefix) { if( prefix == null ) { // @@@ make configurable?? prefix = elementName + "_ns__"; } String elementValue = composeQNameValue(prefix, localPart); Element element = (Element) appendTextChild (parent, elementName, elementValue); // Always set prefix mapping on leaf node. If the DOL was // populated from an existing deployment descriptor it does // not preserve the original node structure of the XML document, // so we can't reliably know what level to place mapping. // Alternatively, if we're writing out a descriptor that was created // by the deploytool, there is no prefix->namespace information in // the first place. setAttributeNS(element, prefix, namespaceUri); } }
/** * 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) { //DOLUtils.getDefaultLogger().finer("ENDELEMENT : " + "in " + getXMLRootTag() + " Node, endElement " + element.getQName()); boolean allDone = element.equals(getXMLRootTag()); if (allDone) { postParsing(); if (getParentNode()!=null && getDescriptor()!=null) { ((DeploymentDescriptorNode) getParentNode()).addNodeDescriptor(this); } } return allDone; }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param descriptor the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, T descriptor) { return writeDescriptor(parent, getXMLRootTag().getQName(), descriptor); }
@Override public void setElementValue(XMLElement element, String value) { if (RuntimeTagNames.IS_CACHE_OVERFLOW_ALLOWED.equals(element.getQName())) { descriptor.setIsCacheOverflowAllowed(Boolean.valueOf(value)); } else super.setElementValue(element, value); }
/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, T descriptor) { Node node = super.writeDescriptor(parent, descriptor); // description, display-name, icons... writeDisplayableComponentInfo(node, descriptor); return node; }
public boolean endElement(XMLElement element) { if (TagNames.ENVIRONMENT_PROPERTY_NAME.equals(element.getQName())) { // name element is always right before value, so initialize // setValueCalled to false when it is processed. setValueCalled = false; } else if( TagNames.ENVIRONMENT_PROPERTY_VALUE.equals (element.getQName()) ) { setValueCalled = true; } return super.endElement(element); }
if (getDescriptor()==null) { addDescriptor(node.getDescriptor()); return; String xmlRootTag = node.getXMLRootTag().getQName(); if (addMethods!=null && addMethods.containsKey(xmlRootTag)) { try { Method toInvoke = getDescriptor().getClass().getMethod( (String) addMethods.get(xmlRootTag), new Class[] { node.getDescriptor().getClass() }); toInvoke.invoke(getDescriptor(), new Object[] {node.getDescriptor()}); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); new Object[]{node.getDescriptor().getClass() , getDescriptor().getClass()}); } else { DOLUtils.getDefaultLogger().log(Level.WARNING, "Error occurred", t); new Object[] {node.getDescriptor().getClass() , getDescriptor().getClass() }); DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.addDescriptorFailure", new Object[]{t.toString(), null}); addDescriptor(node.getDescriptor());
/** * <p> * Append a new text child * </p> * @param parent for the new child element * @param elementName is the new element tag name * @param text the text for the new element * @result the newly create child node */ public static Node appendTextChild(Node parent, String elementName, String text) { if (text == null || text.length()==0) return null; Node child = appendChild(parent, elementName); child.appendChild(getOwnerDocument(child).createTextNode(text)); return child; }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param nodeName name for the root element for this DOM tree fragment * @param descriptor the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, T descriptor) { Node node = appendChild(parent, nodeName); return node; }
/** * <p> * Append a new text child * </p> * @param parent for the new child element * @param elementName is the new element tag name * @param value the int value for the new element * @result the newly create child node */ public static Node appendTextChild(Node parent, String elementName, int value) { return appendTextChild(parent, elementName, String.valueOf(value)); }
/** * 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) { boolean allDone = element.getCompleteName().equals(getXMLRootTag().getCompleteName()) || element.getQName().equals(TagNames.EXTENSION_ELEMENT); if (allDone) { postParsing(); ((DeploymentDescriptorNode) getParentNode()).addNodeDescriptor(this); } return allDone; }
/** * 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) { //DOLUtils.getDefaultLogger().finer("ENDELEMENT : " + "in " + getXMLRootTag() + " Node, endElement " + element.getQName()); boolean allDone = element.equals(getXMLRootTag()); if (allDone) { postParsing(); if (getParentNode()!=null && getDescriptor()!=null) { ((DeploymentDescriptorNode) getParentNode()).addNodeDescriptor(this); } } return allDone; }
@Override public void setElementValue(XMLElement element, String value) { if (EjbTagNames.CONCURRENT_LOCK.equals(element.getQName())) { descriptor.setWriteLock(value.equals(WRITE_LOCK)); } else { super.setElementValue(element, value); } }
@Override public Node writeDescriptor(Node parent, String nodeName, TimeoutValueDescriptor desc) { Node timeoutNode = super.writeDescriptor(parent, nodeName, descriptor); appendTextChild(timeoutNode, EjbTagNames.TIMEOUT_VALUE, Long.toString(desc.getValue())); appendTextChild(timeoutNode, EjbTagNames.TIMEOUT_UNIT, timeUnitToElement.get(desc.getUnit())); return timeoutNode; }
/** * 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 (EjbTagNames.CASCADE_DELETE.equals(element.getQName())) { descriptor.setCascadeDelete(true); } return super.endElement(element); }
if (getDescriptor()==null) { addDescriptor(node.getDescriptor()); return; String xmlRootTag = node.getXMLRootTag().getQName(); if (addMethods!=null && addMethods.containsKey(xmlRootTag)) { try { if((node.getDescriptor() instanceof ResourceDescriptor) && ((ResourceDescriptor)node.getDescriptor()).getResourceType()!=null) { toInvoke = getDescriptor().getClass().getMethod( (String) addMethods.get(xmlRootTag),new Class[] { ResourceDescriptor.class }); toInvoke = getDescriptor().getClass().getMethod( (String) addMethods.get(xmlRootTag),new Class[] { node.getDescriptor().getClass() }); toInvoke.invoke(getDescriptor(), new Object[] {node.getDescriptor()}); new Object[]{node.getDescriptor().getClass() , getDescriptor().getClass()}); } else { DOLUtils.getDefaultLogger().log(Level.WARNING, "Error occurred", t); new Object[] {node.getDescriptor().getClass() , getDescriptor().getClass() }); DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.addDescriptorFailure", new Object[]{t.toString(), null}); addDescriptor(node.getDescriptor());
public void appendQNameChild(String elementName, Node parent, String namespaceUri, String localPart, String prefix) { if( prefix == null ) { // @@@ make configurable?? prefix = elementName + "_ns__"; } String elementValue = composeQNameValue(prefix, localPart); Element element = (Element) appendTextChild (parent, elementName, elementValue); // Always set prefix mapping on leaf node. If the DOL was // populated from an existing deployment descriptor it does // not preserve the original node structure of the XML document, // so we can't reliably know what level to place mapping. // Alternatively, if we're writing out a descriptor that was created // by the deploytool, there is no prefix->namespace information in // the first place. setAttributeNS(element, prefix, namespaceUri); } }