Element node = (Element) contextNode; if (namespaceURI == null) { return node.getChildren(localName).iterator(); return node.getChildren(localName, Namespace.getNamespace(namespacePrefix, namespaceURI)).iterator(); if (!Namespace.getNamespace(namespacePrefix, namespaceURI).equals(el.getNamespace())) { return JaxenConstants.EMPTY_ITERATOR; else if(el.getNamespace() != Namespace.NO_NAMESPACE) { return JaxenConstants.EMPTY_ITERATOR;
Namespace ns = current.getNamespace(); Iterator additional = current.getAdditionalNamespaces().iterator(); while ( additional.hasNext() ) { ns = (Namespace)additional.next(); if ( !nsMap.containsKey(ns.getPrefix()) ) nsMap.put( ns.getPrefix(), new XPathNamespace(elem, ns) ); Iterator attributes = current.getAttributes().iterator(); while ( attributes.hasNext() ) { Attribute attribute = (Attribute)attributes.next();
/** * Return the sharelib name for the action. * * @return returns <code>streaming</code> if mapreduce-streaming action, <code>NULL</code> otherwise. * @param actionXml */ @Override protected String getDefaultShareLibName(Element actionXml) { Namespace ns = actionXml.getNamespace(); return (actionXml.getChild("streaming", ns) != null) ? "mapreduce-streaming" : null; }
/** * Erhält die noch nicht modifizierte Beschreibung des BPELProzesses als * XML-Element. Alle für die Instrumentierung benötigten Elemente der * Prozessbeschreibung werden gespeichert * * @param process * noch nicht modifiziertes BPEL-Prozess */ public void setOriginalBPELProcess(Element process) { elementsOfBPEL = new ArrayList<Element>(); Iterator<Element> iter = process .getDescendants(new ElementFilter(LinkMetricHandler.LINK_TAG, process.getNamespace())); while (iter.hasNext()) { elementsOfBPEL.add(iter.next()); } }
/** * Materialize data properties defined in <action> tag. it includes dataIn(<DS>) and dataOut(<DS>) it creates a list * of files that will be needed. * * @param eAction action element * @param conf action configuration * @throws Exception thrown if failed to resolve data properties * @update modify 'Action' element with appropriate list of files. */ @SuppressWarnings("unchecked") static void materializeDataProperties(Element eAction, Configuration conf, ELEvaluator eval) throws Exception { Element configElem = eAction.getChild("action", eAction.getNamespace()).getChild("workflow", eAction.getNamespace()).getChild("configuration", eAction.getNamespace()); if (configElem != null) { for (Element propElem : (List<Element>) configElem.getChildren("property", configElem.getNamespace())) { resolveTagContents("value", propElem, eval); } } }
@SuppressWarnings("unchecked") static List<org.jdom.Element> getChildren(org.jdom.Element e, String name) { if (e == null) { return null; } Namespace ns = e.getNamespace(); return e.getChildren(name, ns); }
private ActionDependency getUnResolvedDependency(CoordinatorActionBean coordAction, Element event) throws JDOMException, URIHandlerException { String tmpUnresolved = event.getChildTextTrim(CoordCommandUtils.UNRESOLVED_INSTANCES_TAG, event.getNamespace()); StringBuilder nonResolvedList = new StringBuilder(); CoordCommandUtils.getResolvedList(getMissingDependencies(), new StringBuilder(), nonResolvedList); ActionDependency dependency = new ActionDependency(); if (nonResolvedList.length() > 0) { Element eDataset = event.getChild("dataset", event.getNamespace()); dependency.setUriTemplate(eDataset.getChild("uri-template", eDataset.getNamespace()).getTextTrim()); dependency.getMissingDependencies().add(tmpUnresolved); } return dependency; }
protected java.util.List decodeHistory (final org.jdom.Element elt) { java.util.List history = new java.util.ArrayList(7); org.jdom.Element hElt = elt.getChild(HISTORY, elt.getNamespace()); if (hElt == null) return history; java.util.Iterator it = hElt .getChildren(HISTORY_ITEM, elt.getNamespace()) .iterator(); while (it.hasNext()) history.add(decodeHistoryItem((org.jdom.Element)it.next())); return history; }
/** * Gets the unmodified bpel process as xml element. * * <br />All elements needed for instrumentating will be saved * * @param unmodified bpel process */ public void setOriginalBPELProcess(Element process) { ElementFilter filter = new ElementFilter(process.getNamespace()); elementsOfBPEL = new ArrayList<Element>(); for (@SuppressWarnings("unchecked") Iterator<Element> iter = process.getDescendants(filter); iter .hasNext();) { Element basicActivity = iter.next(); if (activitiesToRespect.contains(basicActivity.getName())) { elementsOfBPEL.add(basicActivity); } } }
/** * Resolve datasets using job configuration. * * @param eAppXml : Job Element XML * @throws Exception thrown if failed to resolve datasets */ @SuppressWarnings("unchecked") private void resolveDataSets(Element eAppXml) throws Exception { Element datasetList = eAppXml.getChild("datasets", eAppXml.getNamespace()); if (datasetList != null) { List<Element> dsElems = datasetList.getChildren("dataset", eAppXml.getNamespace()); resolveDataSets(dsElems); resolveTagContents("app-path", eAppXml.getChild("action", eAppXml.getNamespace()).getChild("workflow", eAppXml.getNamespace()), evalNofuncs); } }
protected final org.jdom.Element findElement(org.jdom.Element parent, String name) { List<org.jdom.Element> childs = parent.getChildren("element", parent.getNamespace()); //NOI18N for (org.jdom.Element el : childs) { if (name.equals(el.getAttributeValue("name"))) { //NOI18N return el; } } return null; }
protected final org.jdom.Element findNonTypedContent(org.jdom.Element root) { org.jdom.Element complex = root.getChild("complexType", root.getNamespace()); //NOI18N if (complex != null) { complex = complex.getChild("sequence", root.getNamespace()); //NOI18N } return complex; }
public List getAny() { List any = new ArrayList(); for (Iterator iter = element.getChildren().iterator(); iter.hasNext();) { Element elem = (Element) iter.next(); if (!element.getNamespace().equals(elem.getNamespace())) { any.add(elem); } } return any; }
protected Content i18nFilterAnnotations(Element content) throws JDOMException { Locale locale = rl.getLocale(); Map<String, Element> documentElements = new Hashtable<String, Element>(); filterElements(documentElements, content, null); filterElements(documentElements, content, locale.getLanguage()); filterElements(documentElements, content, locale.getLanguage() + "_" + locale.getCountry()); filterElements(documentElements, content, locale.getLanguage() + "_" + locale.getCountry() + "_" + locale.getVariant()); Element returned = (Element) content.clone(); returned.removeChildren("documentation", content.getNamespace()); for (Iterator<Element> i=documentElements.values().iterator();i.hasNext();) { returned.addContent((Content) i.next().clone()); } return returned; }
/** * Resolve datasets using job configuration. * * @param eAppXml : Job Element XML * @throws Exception thrown if failed to resolve datasets */ @SuppressWarnings("unchecked") private void resolveDataSets(Element eAppXml) throws Exception { Element datasetList = eAppXml.getChild("datasets", eAppXml.getNamespace()); if (datasetList != null) { List<Element> dsElems = datasetList.getChildren("dataset", eAppXml.getNamespace()); resolveDataSets(dsElems); resolveTagContents("app-path", eAppXml.getChild("action", eAppXml.getNamespace()).getChild("workflow", eAppXml.getNamespace()), evalNofuncs); } }
@SuppressWarnings("unchecked") static org.jdom.Element getChildWithGivenAttributeValue(org.jdom.Element e, String childName, String attributeName, String attributeValue) { // for instance e="mbook-meta" could be null if (e == null) { return null; } Namespace ns = e.getNamespace(); List<org.jdom.Element> children = e.getChildren(childName, ns); org.jdom.Element found = null; for (org.jdom.Element el : children) { String attr = el.getAttributeValue(attributeName); if (attr != null && attr.equals(attributeValue)) { found = el; } } return found; }
/** * Return the sharelib name for the action. * * @return returns <code>streaming</code> if mapreduce-streaming action, <code>NULL</code> otherwise. * @param actionXml */ @Override protected String getDefaultShareLibName(Element actionXml) { Namespace ns = actionXml.getNamespace(); return (actionXml.getChild("streaming", ns) != null) ? "mapreduce-streaming" : null; }
protected java.util.List decodeEntryList (org.jdom.Element filterElt) { java.util.List result = new java.util.ArrayList(); java.util.Iterator it = filterElt .getChildren(FIELD, filterElt.getNamespace()) .iterator(); while (it.hasNext()) { org.jdom.Element elt = (org.jdom.Element)it.next(); String fieldRegex = elt.getAttributeValue(REGEX).trim(); String permissions = elt.getAttributeValue(PERMISSIONS).trim(); //String type = elt.getAttributeValue(TYPE); FilterEntry entry = new FilterEntry(fieldRegex, permissions/*, type*/); result.add(entry); } return result; }
/** * Erhält die noch nicht modifizierte Beschreibung des BPELProzesses als * XML-Element. Alle für die Instrumentierung benötigten Elemente der * Prozessbeschreibung werden gespeichert * * @param process * noch nicht modifiziertes BPEL-Prozess * @see net.bpelunit.framework.coverage.annotation.metrics.IMetric#setOriginalBPELProcess(org.jdom.Element) */ public void setOriginalBPELProcess(Element process) { Element nextElement; Iterator<Element> iter = process .getDescendants(new ElementFilter(process .getNamespace())); elementsOfBPEL = new ArrayList<Element>(); while (iter.hasNext()) { nextElement = iter.next(); if (isStructuredActivity(nextElement)) { elementsOfBPEL.add(nextElement); } } }
private void checkForNoLongerSupported(Element root) throws Exception { Namespace namespace = root.getNamespace(); List<Element> children = root.getChildren("service", namespace); for (Element child : children) { Element typeChild = child.getChild("type", namespace); String type = typeChild.getText(); if (type.equals("management.snmp")) { throw new Exception("snmp management type is no longer supported."); } else if (type.equals("session")) { throw new Exception("session service type is no longer supported."); } } }