当前位置: 首页>>代码示例>>Java>>正文


Java OMNode类代码示例

本文整理汇总了Java中org.apache.axiom.om.OMNode的典型用法代码示例。如果您正苦于以下问题:Java OMNode类的具体用法?Java OMNode怎么用?Java OMNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OMNode类属于org.apache.axiom.om包,在下文中一共展示了OMNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleMTOMUploads

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
private void handleMTOMUploads(String sessionID, SOAPElement soapElement) throws FileNotFoundException, IOException, SOAPException {
	if (soapElement instanceof org.apache.axis2.saaj.SOAPElementImpl) {
		org.apache.axis2.saaj.SOAPElementImpl el = (org.apache.axis2.saaj.SOAPElementImpl)soapElement;
		final OMNode firstOMChild = el.getElement().getFirstOMChild();
		if (firstOMChild instanceof TextImpl) {
        	TextImpl ti = ((TextImpl)firstOMChild);
        	boolean isBinary = ti.isBinary();
        	boolean isOptimized = ti.isOptimized();
            String contentID = ti.getContentID();
            if (isBinary && isOptimized && contentID != null) {
            	// Write file
            	javax.activation.DataHandler dh = (javax.activation.DataHandler)ti.getDataHandler();
            	String filePath = getUploadFilePath(sessionID, el.getLocalName(), dh.getContentType());
            	dh.writeTo(new FileOutputStream(new File(filePath)));
				
            	// Modify value in soap envelope (replace the base64 encoded value with the filepath value)
            	ti.detach();
				el.addTextNode(filePath);
				
				Engine.logEngine.trace("(WebServiceServlet) File successfully uploaded :"+ filePath);
            }
		}
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:25,代码来源:WebServiceServlet.java

示例2: getValueAsString

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
@Override
public String getValueAsString(String xPath) {
    try {
        Object result = null;
        CarbonXPathImpl carbonXPath = new CarbonXPathImpl(xPath);
        result = carbonXPath.evaluate(omElement);
        StringBuffer sb = new StringBuffer();
        if (result instanceof OMNode) {
            return result.toString();
        } else if (result instanceof List) {
            ((List) result).forEach(re -> sb.append(re.toString()));
            return sb.toString();
        }

    } catch (JaxenException e) {
        LOGGER.error("Error occurred while evaluating xpath", e);
    }
    return null;
}
 
开发者ID:wso2-attic,项目名称:carbon-gateway-framework,代码行数:20,代码来源:CarbonXMLMessageImpl.java

示例3: validate1

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
public void validate1(OMElement root) {
	String localname = root.getLocalName();
	
	if (isIdentifiable(localname)) {

		OMAttribute home_att = root.getAttribute(MetadataSupport.home_qname);

		if (home_att == null) {
			errs += "\nElement of type " + localname + " does not contain a home attribute";
		} else {
			String home1 = home_att.getAttributeValue();
			if (home1 == null) home1 = "";
			if ( !home1.equals(home))
				errs += "\nElement of type " + localname + " has home of [" + home1 + "] which does not match expected value of [" + home + "]"; 
		}
	}

	for (OMNode child=root.getFirstElement(); child != null; child=child.getNextOMSibling()) {
		OMElement child_e = (OMElement) child;
		validate1(child_e);
	}
}
 
开发者ID:jembi,项目名称:openxds,代码行数:23,代码来源:HomeAttribute.java

示例4: add_name_value

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
public OMElement add_name_value(OMElement parent, String name, OMElement value1, OMElement value2, OMElement value3) {
	OMElement ele = MetadataSupport.om_factory.createOMElement(name, null);
	OMNode val1 = value1;
	if (val1 == null)
		val1 = MetadataSupport.om_factory.createOMText("null");
	ele.addChild(val1);
	OMNode val2 = value2;
	if (val2 == null)
		val2 = MetadataSupport.om_factory.createOMText("null");
	ele.addChild(val2);
	OMNode val3 = value3;
	if (val3 == null)
		val3 = MetadataSupport.om_factory.createOMText("null");
	ele.addChild(val3);
	parent.addChild(ele);
	return ele;
}
 
开发者ID:jembi,项目名称:openxds,代码行数:18,代码来源:OmLogger.java

示例5: getStepIds

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
List<String> getStepIds(File testplan) {
	ArrayList<String> ids = new ArrayList<String>();
	OMElement tplan;
	try {
		tplan = Util.parse_xml(testplan);
		AXIOMXPath xpathExpression = new AXIOMXPath ("//TestPlan/TestStep");
		List<OMNode> nodes = xpathExpression.selectNodes(tplan);

		for (int i=0; i<nodes.size(); i++) {
			OMElement testStep = (OMElement) nodes.get(i);
			ids.add(testStep.getAttributeValue(MetadataSupport.id_qname));
		}

	} catch (Exception e) {
		e.printStackTrace();
		System.err.println(ExceptionUtil.exception_details(e));
		System.exit(-1);
	}

	return ids;
}
 
开发者ID:jembi,项目名称:openxds,代码行数:22,代码来源:TestkitStructure.java

示例6: processExpressions

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
static void processExpressions(ITag tag, IParserContext context) {
	if (!(tag instanceof ExpressionTag)) {
		// make sure all text nodes are converted to <expression> tags
		OMElement ele = context.getElement();

		for (OMNode child : AxiomUtils.getNodes(ele)) {
			if (child.getType() == OMNode.TEXT_NODE) {
				OMText textNode = (OMText) child;
				String text = textNode.getText();

				if (StringUtils.isNotBlank(text)) {
					OMElement expTag = createExpressionTag(text, ele.getLineNumber());
					child.insertSiblingAfter(expTag);
					child.detach();
				}
			}
		}
	}
}
 
开发者ID:niuxuetao,项目名称:paxml,代码行数:20,代码来源:AbstractTagFactory.java

示例7: createSoapBody

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
public void createSoapBody(org.apache.axiom.soap.SOAPBody sb, SOAPBody soapBody, Message msgDef,
                           Element message, String rpcWrapper) throws AxisFault {
    OMElement partHolder = isRPC ? soapFactory
            .createOMElement(new QName(soapBody.getNamespaceURI(), rpcWrapper, "odens"), sb) : sb;
    List<Part> parts = msgDef.getOrderedParts(soapBody.getParts());

    for (Part part : parts) {
        Element srcPartEl = DOMUtils.findChildByName(message, new QName(null, part.getName()));
        if (srcPartEl == null) {
            throw new AxisFault("Missing required part in ODE Message");
        }

        OMElement omPart = OMUtils.toOM(srcPartEl, soapFactory);
        if (isRPC) {
            partHolder.addChild(omPart);
        } else {
            for (Iterator<OMNode> i = omPart.getChildren(); i.hasNext(); ) {
                partHolder.addChild(i.next());
            }
        }
    }

}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:24,代码来源:SOAPHelper.java

示例8: processElementforRefs

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
public OMElement processElementforRefs(OMElement elemnts) throws AxisFault {
    Iterator itr = elemnts.getChildElements();
    while (itr.hasNext()) {
        OMElement omElement = (OMElement)itr.next();
        OMAttribute attri = processRefAtt(omElement);
        if (attri != null) {
            String ref = getAttvalue(attri);
            OMElement tempele = getOMElement(ref);
            if (tempele == null) {
                tempele = processOMElementRef(ref);
            }
            OMElement ele2 = elementClone(tempele);
            Iterator itrChild = ele2.getChildren();
            while (itrChild.hasNext()) {
                Object obj = itrChild.next();
                if (obj instanceof OMNode) {
                    omElement.addChild((OMNode)obj);
                }
            }
        }
    }
    return elemnts;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:MultirefHelper.java

示例9: outputTo

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
/**
 * outputTo the writer.
 *
 * @param writer -- the output of the converter
 */
public void outputTo(XMLStreamWriter writer) throws XMLStreamException {
    // Using OM to convert the reader to a writer.  This seems to be
    // the safest way to make the conversion, and it promotes code re-use.
    StAXOMBuilder builder = new StAXOMBuilder(reader);
    OMDocument omDocument = builder.getDocument();
    Iterator it = omDocument.getChildren();
    while (it.hasNext()) {
        OMNode omNode = (OMNode)it.next();
        // TODO Using serialize and consume
        // caused an axiom bug...falling back to serialize
        // (which is less performant due to om caching)
        //omNode.serializeAndConsume(writer);
        omNode.serialize(writer);
    }
    // Close the reader if marked to do so
    if (closeReader) {
        if (log.isDebugEnabled()) {
            log.debug("closing reader, builder: " + JavaUtils.stackToString());
        }
        reader.close();
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:28,代码来源:Reader2Writer.java

示例10: _getChildOMElement

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
/**
 * Get the child om at the indicated index
 *
 * @param om
 * @param index
 * @return child om or null
 */
private static OMElement _getChildOMElement(OMElement om, int index) {
    if (om == null) {
        return null;
    }
    int i = 0;
    for (OMNode child = om.getFirstOMChild();
         child != null;
         child = child.getNextOMSibling()) {
        if (child instanceof OMElement) {
            if (i == index) {
                return (OMElement)child;
            }
            i++;
        }
    }
    return null;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:XMLSpineImpl.java

示例11: addPoliciesToDescriptionElement

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
private void addPoliciesToDescriptionElement(List policies,
		OMElement descriptionElement) throws XMLStreamException,
		FactoryConfigurationError {

	for (int i = 0; i < policies.size(); i++) {
		Policy policy = (Policy) policies.get(i);
		OMElement policyElement = PolicyUtil.getPolicyComponentAsOMElement(
				policy, filter);
		OMNode firstChild = descriptionElement.getFirstOMChild();
		if (firstChild != null) {
			firstChild.insertSiblingBefore(policyElement);
		} else {
			descriptionElement.addChild(policyElement);
		}
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:AxisService2WSDL20.java

示例12: setValue

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
/**
 * If this is a Text node then this method will set its value, otherwise it sets the value of
 * the immediate (Text) child of this node. The value of the immediate child of this node can be
 * set only if, there is one child node and that node is a Text node, or if there are no
 * children in which case a child Text node will be created.
 *
 * @param value the text to set
 * @throws IllegalStateException if the node is not a Text  node and either has more than one
 *                               child node or has a child node that is not a Text node
 */
public void setValue(String value) {
    OMNode firstChild = element.getFirstOMChild();
    if (firstChild == null) {
        try {
            this.addTextNode(value);
        } catch (SOAPException e) {
            throw new RuntimeException("Cannot add text node", e);
        }
    } else if (((org.w3c.dom.Node)firstChild).getNodeType() == javax.xml.soap.Node.TEXT_NODE
            && firstChild.getNextOMSibling() == null) {
        ((org.w3c.dom.Text)firstChild).setData(value);
    } else {
        throw new IllegalStateException("This node is not a Text  node and " +
                "either has more than one child node or has a child " +
                "node that is not a Text node");
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:28,代码来源:SOAPElementImpl.java

示例13: extractIaasProviders

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
private static void extractIaasProviders(OMElement documentElement, List<OMNode> nodeList) {
    List<IaasProvider> iaasProviders = CloudControllerConfig.getInstance().getIaasProviders();

    if (iaasProviders == null) {
        CloudControllerConfig.getInstance().setIaasProviders((iaasProviders = new ArrayList<IaasProvider>()));
    }

    // this is a valid scenario. User can have 0..1 iaas provider elements
    // in cloud-controller xml.
    if (nodeList == null || nodeList.isEmpty()) {
        log.debug("No IaasProvider element found in " + FILE_NAME);
        return;
    }

    for (OMNode node : nodeList) {
        iaasProviders.add(IaasProviderConfigParser.getIaasProvider(FILE_NAME, documentElement, node, null));
    }
}
 
开发者ID:apache,项目名称:stratos,代码行数:19,代码来源:CloudControllerConfigParser.java

示例14: getBinaryNode

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
static OMText getBinaryNode(OMElement document) {
	Iterator<OMNode> childrenIterator = document.getChildren();
	while (childrenIterator.hasNext())
	{
		OMNode container = childrenIterator.next();
		if (container instanceof OMText && StringUtils.isNotBlank(((OMText)container).getText()))
		{
			return (OMText)container;
		}
	}		
	return null;
}
 
开发者ID:jembi,项目名称:openxds,代码行数:13,代码来源:ProvideAndRegisterDocumentSet.java

示例15: set

import org.apache.axiom.om.OMNode; //导入依赖的package包/类
public void set(OMElement root) {
	String localname = root.getLocalName();

	if (isIdentifiable(localname)) 
		root.addAttribute("home", home, null);

	for (OMNode child=root.getFirstElement(); child != null; child=child.getNextOMSibling()) {
		if (child instanceof OMText) {
			continue;				
		}
		OMElement child_e = (OMElement) child;
		set(child_e);
	}
}
 
开发者ID:jembi,项目名称:openxds,代码行数:15,代码来源:HomeAttribute.java


注:本文中的org.apache.axiom.om.OMNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。