本文整理汇总了Java中org.apache.axiom.om.OMDocument类的典型用法代码示例。如果您正苦于以下问题:Java OMDocument类的具体用法?Java OMDocument怎么用?Java OMDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OMDocument类属于org.apache.axiom.om包,在下文中一共展示了OMDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processEvent
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
public void processEvent(Object node, boolean isRoute) {
OMElement namedNode;
if (node instanceof OMDocument) {
namedNode = ((OMDocument) node).getOMDocumentElement();
} else if (node instanceof OMElement) {
namedNode = (OMElement) node;
} else {
throw new EPException("Unexpected AXIOM node of type '" + node.getClass() + "' encountered, please supply a Document or Element node");
}
String rootElementNameRequired = eventType.getConfig().getRootElementName();
String rootElementNameFound = namedNode.getLocalName();
if (!rootElementNameFound.equals(rootElementNameRequired)) {
throw new EPException("Unexpected root element name '" + rootElementNameFound + "' encountered, expected '" + rootElementNameRequired + "'");
}
if (isRoute) {
runtimeEventSender.routeEventBean(new AxiomEventBean(namedNode, eventType));
} else {
runtimeEventSender.processWrappedEvent(new AxiomEventBean(namedNode, eventType));
}
}
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:AxionEventSender.java
示例2: create
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
public EventBean create(Object theEvent, URI resolutionURI) {
// Check event type - only handle the Axiom types of OMDocument and OMElement
OMElement namedNode;
if (theEvent instanceof OMDocument) {
namedNode = ((OMDocument) theEvent).getOMDocumentElement();
} else if (theEvent instanceof OMElement) {
namedNode = (OMElement) theEvent;
} else {
return null; // not the right event type, return null and let others handle it, or ignore
}
// Look up the root element name and map to a known event type
String rootElementName = namedNode.getLocalName();
EventType eventType = types.get(rootElementName);
if (eventType == null) {
return null; // not a root element name, let others handle it
}
return new AxiomEventBean(namedNode, eventType);
}
开发者ID:espertechinc,项目名称:esper,代码行数:21,代码来源:AxionEventBeanFactory.java
示例3: AxisMessage
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
public AxisMessage(MessageContext msgContext) throws Exception {
envelope = msgContext.getEnvelope();
// If possible, build the parent (i.e. the OMDocument) to make sure that the entire message is read.
// If the transport doesn't handle the end of the message properly, then this problem
// will show up here.
OMDocument document = (OMDocument)envelope.getParent();
if (document != null) {
document.build();
} else {
envelope.build();
}
// TODO: quick & dirty hack to force expansion of OMSourceElement payloads
OMElement content = envelope.getBody().getFirstElement();
if (content instanceof OMSourcedElement) {
((OMSourcedElement)content).getFirstOMChild();
((OMSourcedElement)content).build();
}
if (msgContext.isDoingSwA()) {
// Make sure that all attachments are read
attachments = msgContext.getAttachmentMap();
attachments.getAllContentIDs();
}
messageType = (String)msgContext.getProperty(Constants.Configuration.MESSAGE_TYPE);
}
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:27,代码来源:AxisMessage.java
示例4: createMockMessageContext
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
public static MessageContext createMockMessageContext(String payload) throws AxisFault {
MessageContext inMC = new MessageContext();
SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
OMDocument omDoc = OMAbstractFactory.getSOAP11Factory().createOMDocument();
omDoc.addChild(envelope);
envelope.getBody().addChild(TestUtils.createOMElement(payload));
inMC.setEnvelope(envelope);
AxisConfiguration axisConfig = new AxisConfiguration();
AxisService as = new AxisService();
as.setName("ScriptService");
AxisServiceGroup asg = new AxisServiceGroup(axisConfig);
asg.addService(as);
as.addParameter(new Parameter("script.js",
"function invoke(inMC, outMC) { outMC.setPayloadXML(" +
payload + ")}"));
ConfigurationContext cfgCtx = new ConfigurationContext(axisConfig);
ServiceGroupContext sgc = cfgCtx.createServiceGroupContext(asg);
inMC.setAxisService(as);
inMC.setServiceContext(sgc.getServiceContext(as));
return inMC;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:TestUtils.java
示例5: outputTo
import org.apache.axiom.om.OMDocument; //导入依赖的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
示例6: createOMElementFromInputParams
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
private OMElement createOMElementFromInputParams(InternalParamCollection params) {
OMFactory fac = DBUtils.getOMFactory();
OMDocument doc = fac.createOMDocument();
OMElement retEl = fac.createOMElement(new QName(this.getQueryId()));
OMElement scalarEl;
List<OMElement> arrayEl;
ParamValue paramValue;
for (InternalParam param : params.getParams()) {
paramValue = param.getValue();
if (paramValue.getValueType() == ParamValue.PARAM_VALUE_SCALAR ||
paramValue.getValueType() == ParamValue.PARAM_VALUE_UDT) {
scalarEl = fac.createOMElement(new QName(param.getName()));
scalarEl.setText(paramValue.getScalarValue());
retEl.addChild(scalarEl);
} else if (paramValue.getValueType() == ParamValue.PARAM_VALUE_ARRAY) {
arrayEl = this.createOMElementsFromArrayValue(param.getName(), paramValue, fac);
for (OMElement el : arrayEl) {
retEl.addChild(el);
}
}
}
doc.addChild(retEl);
return doc.getOMDocumentElement();
}
开发者ID:wso2,项目名称:carbon-data,代码行数:25,代码来源:Query.java
示例7: createEventMessage
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
private OMElement createEventMessage(DataService dataService, String queryId, OMElement data) {
OMFactory fac = DBUtils.getOMFactory();
OMElement result = fac.createOMElement(
new QName(DBConstants.EventNotification.MESSAGE_WRAPPER));
OMElement serviceNameEl = fac.createOMElement(
new QName(DBConstants.EventNotification.SERVICE_NAME));
serviceNameEl.setText(dataService.getName());
result.addChild(serviceNameEl);
OMElement queryIdEl = fac.createOMElement(
new QName(DBConstants.EventNotification.QUERY_ID));
queryIdEl.setText(queryId);
result.addChild(queryIdEl);
OMElement timeEl = fac.createOMElement(
new QName(DBConstants.EventNotification.TIME));
timeEl.setText(Calendar.getInstance().getTime().toString());
result.addChild(timeEl);
OMElement contentEl = fac.createOMElement(
new QName(DBConstants.EventNotification.CONTENT));
contentEl.addChild(data);
result.addChild(contentEl);
/* clone required, or else the content in 'content' element is missing in result */
result = result.cloneOMElement();
OMDocument doc = fac.createOMDocument();
doc.addChild(result);
return doc.getOMDocumentElement();
}
开发者ID:wso2,项目名称:carbon-data,代码行数:27,代码来源:EventTrigger.java
示例8: invokeOperation
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
/**
* This method invokes a single operation defined in the given data service.
* @param dataService The DataService object which represents the data service.
* @param operationName The name of the operation.
* @param params The parameters destined for the operation.
* @return returns the XML result if it exists.
* @throws DataServiceFault thrown if an error condition occurs in executing the operation.
* @see DSTools#invokeOperation(DataService, String, List)
*/
public static OMElement invokeOperation(DataService dataService,
String operationName, Map<String, ParamValue> params)
throws DataServiceFault {
if (DataServiceRequest.isBoxcarringRequest(operationName)) {
return callBoxcarringOp(dataService, operationName, params);
}
OMElement result = (new SingleDataServiceRequest(dataService, operationName,
params)).dispatch();
if (result == null) {
return null;
}
/* result must have a parent, or there are problems when it comes to XPath expressions etc.. */
OMDocument doc = DBUtils.getOMFactory().createOMDocument();
doc.addChild(result);
return doc.getOMDocumentElement();
}
开发者ID:wso2,项目名称:carbon-data,代码行数:26,代码来源:DSTools.java
示例9: write
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
private void write(OutputStream out) throws IOException, XMLStreamException {
if (targetNamespace == null) {
targetNamespace = detectTargetNamespace();
}
if (targetNamespace == null) {
throw new PaxmlRuntimeException("No @targetNamespace attribute given on <soap> tag,"
+ " and the target namespace cannot be detected from WSDL: " + getWsdlUrl());
}
OMFactory factory = AxiomUtils.getOMFactory();
Map<?, ?> bd = (Map<?, ?>) this.body;
OMNamespace targetNs = factory.createOMNamespace(targetNamespace, "ns");
OMNamespace ns = factory.createOMNamespace(SOAP_NS, "soapenv");
OMDocument doc = AxiomUtils.newDocument();
doc.setXMLEncoding("UTF-8");
OMElement root = factory.createOMElement("Envelope", ns);
doc.addChild(root);
OMElement headerEle = factory.createOMElement("Header", ns);
root.addChild(headerEle);
OMElement bodyEle = factory.createOMElement("Body", ns);
root.addChild(bodyEle);
Iterator<?> it = bd.entrySet().iterator();
if (!it.hasNext()) {
throw new PaxmlRuntimeException("No webservice operation name given!");
}
toXml(bodyEle, bd, targetNs, factory);
doc.serializeAndConsume(out);
}
开发者ID:niuxuetao,项目名称:paxml,代码行数:37,代码来源:SoapTag.java
示例10: serialize
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
public String serialize() throws Exception {
String result = null;
OMDocument document = factory.createOMDocument();
OMElement documentElement = getDocumentElement();
document.addChild(documentElement);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
prettify(documentElement, outputStream);
} catch (Exception e) {
throw new MojoExecutionException("Error serializing",e);
}
result = outputStream.toString();
return result;
}
开发者ID:wso2,项目名称:maven-tools,代码行数:15,代码来源:CAppArtifact.java
示例11: serialize
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
public String serialize() {
String result = null;
OMDocument document = factory.createOMDocument();
OMElement documentElement = getDocumentElement();
document.addChild(documentElement);
try {
result = getPretifiedString(documentElement);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return result;
}
开发者ID:wso2,项目名称:maven-tools,代码行数:14,代码来源:Artifact.java
示例12: getSOAPFactory
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
/**
* Get an axiom SOAPFactory for the specified element
*
* @param e OMElement
* @return SOAPFactory
*/
public static SOAPFactory getSOAPFactory(OMElement e) {
// Getting a factory from a SOAPEnvelope is not straight-forward.
// Please change this code if an easier mechanism is discovered.
OMXMLParserWrapper builder = e.getBuilder();
if (builder instanceof StAXBuilder) {
StAXBuilder staxBuilder = (StAXBuilder)builder;
OMDocument document = staxBuilder.getDocument();
if (document != null) {
OMFactory factory = document.getOMFactory();
if (factory instanceof SOAPFactory) {
return (SOAPFactory)factory;
}
}
}
// Flow to here indicates that the envelope does not have
// an accessible factory. Create a new factory based on the
// protocol.
while (e != null && !(e instanceof SOAPEnvelope)) {
e = (OMElement)e.getParent();
}
if (e instanceof SOAPEnvelope) {
if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.
equals(e.getNamespace().getNamespaceURI())) {
return OMAbstractFactory.getSOAP11Factory();
} else {
return OMAbstractFactory.getSOAP12Factory();
}
}
return null;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:39,代码来源:MessageUtils.java
示例13: getSubreportNames
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
private String[] getSubreportNames(String template) throws XMLStreamException, JaxenException {
InputStream is = new ByteArrayInputStream(template.getBytes());
XMLInputFactory xif = XMLInputFactory.newInstance();
XMLStreamReader reader = xif.createXMLStreamReader(is);
StAXOMBuilder builder = new StAXOMBuilder(reader);
OMDocument document = builder.getDocument();
OMElement documentElement = document.getOMDocumentElement();
AXIOMXPath xpathExpression = new AXIOMXPath("//a:subreport");
xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
List nodeList = xpathExpression.selectNodes(documentElement);
ArrayList<String> repNames = new ArrayList<String>();
if(nodeList == null | nodeList.size()<1){
return null;
}
else {
for(Object obj : nodeList){
if(obj instanceof OMElement){
OMElement subReport = (OMElement)obj;
Iterator iterator = subReport.getChildrenWithLocalName("subreportExpression");
OMElement element = (OMElement)iterator.next();
String reportName = element.getText();
reportName = reportName.replaceAll("\\{", "");
reportName = reportName.replaceAll("\\}", "");
reportName = reportName.replaceAll("\\$P", "");
reportName = reportName.replaceAll("\\$F", "");
repNames.add(reportName);
}
}
String[] names = new String[repNames.size()];
names = repNames.toArray(names);
return names;
}
}
开发者ID:wso2,项目名称:carbon-commons,代码行数:37,代码来源:DBReportingService.java
示例14: serializeOutput
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
private void serializeOutput(HttpServletResponse resp, OMElement element)
throws IOException, ServletException {
OMDocument document = element.getOMFactory().createOMDocument();
document.addChild(element);
document.build();
try {
document.serialize(resp.getOutputStream());
} catch (XMLStreamException e) {
String message = "Unable to serialize Atom Feed";
log.error(message, e);
throw new SRAMPServletException(message, e);
}
}
开发者ID:wso2,项目名称:carbon-governance,代码行数:14,代码来源:SRAMPServlet.java
示例15: wrapBoxCarringResponse
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
public static OMElement wrapBoxCarringResponse(OMElement result) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement wrapperElement = fac.createOMElement(new QName(DBConstants.WSO2_DS_NAMESPACE,
DBConstants.DATA_SERVICE_REQUEST_BOX_RESPONSE_WRAPPER_ELEMENT));
if (result != null) {
wrapperElement.addChild(result);
}
OMDocument doc = fac.createOMDocument();
doc.addChild(wrapperElement);
return doc.getOMDocumentElement();
}
开发者ID:wso2,项目名称:carbon-data,代码行数:12,代码来源:DBUtils.java
示例16: generateRequestSuccessElement
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
private static OMElement generateRequestSuccessElement() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement result = fac.createOMElement(new QName(DBConstants.WSO2_DS_NAMESPACE,
DBConstants.REQUEST_STATUS_WRAPPER_ELEMENT));
result.setText(DBConstants.REQUEST_STATUS_SUCCESSFUL_MESSAGE);
OMDocument doc = fac.createOMDocument();
doc.addChild(result);
return doc.getOMDocumentElement();
}
开发者ID:wso2,项目名称:carbon-data,代码行数:10,代码来源:DataServiceProcessor.java
示例17: accessResource
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
/**
* This method accesses a resource defined in the data service.
* @param dataService The DataService object which represents the data service.
* @param resourcePath The resource path of the data service resource.
* @param params The parameters destined for the resource.
* @param accessMethod The HTTP access method defined in the data service resource.
* @return returns the XML result if it exists.
* @throws DataServiceFault thrown if an error condition occurs in accessing the resource.
*/
public static OMElement accessResource(DataService dataService,
String resourcePath, Map<String, ParamValue> params,
String accessMethod) throws DataServiceFault {
OMElement result = (new SingleDataServiceRequest(dataService, Resource
.generateRequestName(resourcePath, accessMethod),
params)).dispatch();
OMDocument doc = DBUtils.getOMFactory().createOMDocument();
doc.addChild(result);
return doc.getOMDocumentElement();
}
开发者ID:wso2,项目名称:carbon-data,代码行数:20,代码来源:DSTools.java
示例18: getDocument
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
/**
* Parse input stream to get document.
*
* @param in
* input stream
* @return the document
*/
public static OMDocument getDocument(final InputStream in) {
// create the builder
OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(new StAXParserConfiguration() {
@Override
public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) {
return factory;
}
}, in);
// get the root element
OMDocument doc = builder.getDocument();
return doc;
}
开发者ID:niuxuetao,项目名称:paxml,代码行数:26,代码来源:AxiomUtils.java
示例19: getSchemaMap
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
/** @return Returns the schemaMap. */
public HashMap<String, OMDocument> getSchemaMap() {
return schemaMap;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:5,代码来源:WsdlComposite.java
示例20: setSchemaMap
import org.apache.axiom.om.OMDocument; //导入依赖的package包/类
/** @param schemaMap The schemaMap to set. */
public void setSchemaMap(HashMap<String, OMDocument> schemaMap) {
this.schemaMap = schemaMap;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:5,代码来源:WsdlComposite.java
注:本文中的org.apache.axiom.om.OMDocument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论