You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/04/26 09:43:11 UTC
svn commit: r164761 [1/2] - in /webservices/axis/trunk/java/modules:
core/html/ core/samples/deployment/OutService/org/apache/axis/services/
core/src/org/apache/axis/engine/
core/src/org/apache/axis/handlers/addressing/
core/src/org/apache/axis/transport/
core/src/org/apache/axis/transport/http/ samples/src/encoding/sample1/
samples/src/encoding/sample2/benchMark/ samples/src/interop/doclit/
samples/src/org/apache/axis/testUtils/ samples/src/userguide/sample1/
samples/test/org/apache/axis/clientapi/
samples/test/org/apache/axis/encoding/ samples/test/org/apache/axis/engine/
samples/test/org/apache/axis/integration/
samples/test/org/apache/axis/om/builder/ xml/src/org/apache/axis/om/
xml/src/org/apache/axis/om/impl/llom/
xml/src/org/apache/axis/om/impl/llom/builder/
xml/src/org/apache/axis/om/impl/llom/serialize/
xml/src/org/apache/axis/om/impl/llom/traverse/
xml/src/org/apache/axis/om/impl/llom/util/ xml/test/org/apache/axis/om/
xml/test/org/apache/axis/om/factory/
xml/test/org/apache/axis/om/impl/serializer/
xml/test/org/apache/axis/om/impl/streamwrapper/
xml/test/org/apache/axis/om/util/
Author: ajith
Date: Tue Apr 26 00:43:08 2005
New Revision: 164761
URL: http://svn.apache.org/viewcvs?rev=164761&view=rev
Log:
Did a refactoring of the OM API. There can be build failures!
Modified:
webservices/axis/trunk/java/modules/core/html/HappyAxis.jsp
webservices/axis/trunk/java/modules/core/samples/deployment/OutService/org/apache/axis/services/OutService.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/ServiceHandlersChainBuilder.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java
webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java
webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoStub.java
webservices/axis/trunk/java/modules/samples/src/encoding/sample1/Sampler.java
webservices/axis/trunk/java/modules/samples/src/encoding/sample2/benchMark/BenchProvider.java
webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropProvider.java
webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropRequestHandler.java
webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropStub.java
webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/ObjectToOMBuilder.java
webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/SimpleJavaProvider.java
webservices/axis/trunk/java/modules/samples/src/userguide/sample1/AsynchronousClient.java
webservices/axis/trunk/java/modules/samples/src/userguide/sample1/ClientEchoCallbackHandler.java
webservices/axis/trunk/java/modules/samples/src/userguide/sample1/SynchronousClient.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/encoding/EncodingTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/EchoTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMSerializer.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMText.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPBodyImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPEnvelopeImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPFaultImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPHeaderBlockImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/builder/SAXOMBuilder.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/builder/StAXBuilder.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/builder/StAXSOAPModelBuilder.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/traverse/OMChildrenWithSpecificAttributeIterator.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/util/XMLComparator.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMBodyTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMElementTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMNavigatorTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/SOAPFaultTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/StaxParserTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/factory/OMLinkedListImplFactoryTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/ElementSerializerTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/NoNamespaceSerializerTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/OMSerailizerTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/util/XMLComparator.java
Modified: webservices/axis/trunk/java/modules/core/html/HappyAxis.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/html/HappyAxis.jsp?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/html/HappyAxis.jsp (original)
+++ webservices/axis/trunk/java/modules/core/html/HappyAxis.jsp Tue Apr 26 00:43:08 2005
@@ -366,7 +366,7 @@
if(body.hasFault()){
throw body.getFault().getException();
}
- XMLStreamReader xpp = body.getPullParser(true);
+ XMLStreamReader xpp = body.getXMLStreamReader(true);
int event = xpp.next();
while (event != XMLStreamConstants.START_ELEMENT) {
Modified: webservices/axis/trunk/java/modules/core/samples/deployment/OutService/org/apache/axis/services/OutService.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/samples/deployment/OutService/org/apache/axis/services/OutService.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/samples/deployment/OutService/org/apache/axis/services/OutService.java (original)
+++ webservices/axis/trunk/java/modules/core/samples/deployment/OutService/org/apache/axis/services/OutService.java Tue Apr 26 00:43:08 2005
@@ -29,7 +29,7 @@
SOAPEnvelope env = omFactory.getDefaultEnvelope();
OMNode testNode = omFactory.createText("This is auto generated messge by the server at " + new Date());
env.getBody().addChild(testNode);
- log.info("Generated Message" + env.getBody().getFirstChild().getValue());
+ log.info("Generated Message" + env.getBody().getFirstChild());
/*EndpointReference targetEPR = null;
String action = null;
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java Tue Apr 26 00:43:08 2005
@@ -1,18 +1,18 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.axis.engine;
import javax.xml.namespace.QName;
@@ -34,7 +34,7 @@
* Field NAME
*/
public static final QName NAME =
- new QName("http://axis.ws.apache.org", "AddressingBasedDispatcher");
+ new QName("http://axis.ws.apache.org", "AddressingBasedDispatcher");
private AxisService service;
/**
@@ -71,19 +71,17 @@
} else {
throw new AxisFault("No service found under the " + toEPR.getAddress());
}
- if (msgctx.getoperationConfig() == null) {
- String action = (String) msgctx.getWSAAction();
- QName operationName = new QName(action);
- AxisOperation op = service.getOperation(operationName);
- if (op != null) {
- msgctx.setOperationConfig(op);
- } else {
- throw new AxisFault("Operation not found");
- }
-
+
+ } else if (msgctx.getoperationConfig() == null) {
+ String action = (String) msgctx.getWSAAction();
+ QName operationName = new QName(action);
+ AxisOperation op = service.getOperation(operationName);
+ if (op != null) {
+ msgctx.setOperationConfig(op);
+ } else {
+ throw new AxisFault("Operation not found");
}
- } else {
- // TODO client side service Dispatch ,, What this really mean?
}
+
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/ServiceHandlersChainBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/ServiceHandlersChainBuilder.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/ServiceHandlersChainBuilder.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/ServiceHandlersChainBuilder.java Tue Apr 26 00:43:08 2005
@@ -46,6 +46,7 @@
if (serviceContext != null) {
AxisOperation axisOp = msgContext.getoperationConfig();
+
Parameter param = axisOp.getParameter(DefinedParameters.PARM_MEP);
String mepVal = null;
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java Tue Apr 26 00:43:08 2005
@@ -97,7 +97,7 @@
messageInformationHeadersCollection.setAction(soapHeaderBlock.getText());
} else if (AddressingConstants.WSA_RELATES_TO.equals(soapHeaderBlock.getLocalName())) {
String address = soapHeaderBlock.getText();
- OMAttribute relationshipType = soapHeaderBlock.getAttributeWithQName(new QName(AddressingConstants.WSA_NAMESPACE, AddressingConstants.WSA_RELATES_TO_RELATIONSHIP_TYPE));
+ OMAttribute relationshipType = soapHeaderBlock.getFirstAttribute(new QName(AddressingConstants.WSA_NAMESPACE, AddressingConstants.WSA_RELATES_TO_RELATIONSHIP_TYPE));
RelatesTo relatesTo = new RelatesTo(address, relationshipType == null ? "wsa:Reply" : relationshipType.getValue());
messageInformationHeadersCollection.setRelatesTo(relatesTo);
}
@@ -108,7 +108,7 @@
private void extractEPRInformation(SOAPHeaderBlock headerBlock, EndpointReference epr) {
- OMElement address = (OMElement) headerBlock.getChildWithName(new QName(AddressingConstants.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS));
+ OMElement address = (OMElement) headerBlock.getFirstChildWithName(new QName(AddressingConstants.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS));
if (address != null) {
epr.setAddress(address.getText());
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java Tue Apr 26 00:43:08 2005
@@ -85,7 +85,7 @@
soapHeader);
if (relatesToHeader != null
&& !"".equals(relatesTo.getRelationshipType())) {
- relatesToHeader.insertAttribute(
+ relatesToHeader.addAttribute(
WSA_RELATES_TO_RELATIONSHIP_TYPE,
relatesTo.getRelationshipType(),
addressingNamespace);
@@ -123,7 +123,7 @@
EPR_ADDRESS,
addressingNamespace);
soapHeaderBlock.addChild(addressElement);
- addressElement.setValue(address);
+ addressElement.setText(address);
}
@@ -142,7 +142,7 @@
soapHeader.addHeaderBlock(
EPR_SERVICE_NAME,
addressingNamespace);
- soapHeaderBlock.insertAttribute(
+ soapHeaderBlock.addAttribute(
EPR_SERVICE_NAME_PORT_NAME,
serviceName.getPortName(),
addressingNamespace);
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java Tue Apr 26 00:43:08 2005
@@ -94,7 +94,7 @@
try {
outputWriter =
XMLOutputFactory.newInstance().createXMLStreamWriter(out);
- envelope.serialize(outputWriter, false);
+ envelope.serializeWithCache(outputWriter);
outputWriter.flush();
out.flush();
} catch (Exception e) {
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java Tue Apr 26 00:43:08 2005
@@ -101,9 +101,9 @@
String requestURI = (String) map.get(HTTPConstants.REQUEST_URI);
msgContext.setTo(
- new EndpointReference(
- AddressingConstants.WSA_TO,
+ new EndpointReference(AddressingConstants.WSA_TO,
requestURI));
+ //getServiceLookUp(requestURI)));
// TODO see is it a Service request e.g. WSDL, list ....
// TODO take care of the other HTTPHeaders
@@ -425,7 +425,7 @@
// String serviceStr = null;
// if (index > 0) {
// serviceStr = filePart.substring(index + URI_ID_STRING.length() + 1);
-// return serviceStr;
+// return serviceStr;
//
// } else {
// throw new AxisFault("Both the URI and SOAP_ACTION are Null");
Modified: webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java Tue Apr 26 00:43:08 2005
@@ -41,8 +41,8 @@
MessageContext msgContext,
Method method)
throws AxisFault {
- XMLStreamReader xpp = msgContext.getEnvelope().getBody().getFirstElement().getPullParser(true);
-
+ XMLStreamReader xpp =
+ msgContext.getEnvelope().getBody().getFirstElement().getXMLStreamReader();
Class[] parms = method.getParameterTypes();
Object[] objs = new Object[parms.length];
Modified: webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoStub.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoStub.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoStub.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoStub.java Tue Apr 26 00:43:08 2005
@@ -72,7 +72,7 @@
if (body.hasFault()) {
throw body.getFault().getException();
}
- XMLStreamReader xpp = body.getPullParser(true);
+ XMLStreamReader xpp = body.getXMLStreamReader();
int event = xpp.next();
while (event != XMLStreamConstants.START_ELEMENT) {
Modified: webservices/axis/trunk/java/modules/samples/src/encoding/sample1/Sampler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/encoding/sample1/Sampler.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/encoding/sample1/Sampler.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/encoding/sample1/Sampler.java Tue Apr 26 00:43:08 2005
@@ -102,7 +102,7 @@
if (body.hasFault()) {
throw body.getFault().getException();
}
- XMLStreamReader xpp = body.getPullParser(true);
+ XMLStreamReader xpp = body.getXMLStreamReader();
int event = xpp.next();
while (event != XMLStreamConstants.START_ELEMENT) {
Modified: webservices/axis/trunk/java/modules/samples/src/encoding/sample2/benchMark/BenchProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/encoding/sample2/benchMark/BenchProvider.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/encoding/sample2/benchMark/BenchProvider.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/encoding/sample2/benchMark/BenchProvider.java Tue Apr 26 00:43:08 2005
@@ -48,7 +48,7 @@
Method method)
throws AxisFault {
XMLStreamReader xpp =
- msgContext.getEnvelope().getBody().getFirstElement().getPullParser(true);
+ msgContext.getEnvelope().getBody().getFirstElement().getXMLStreamReader();
Class[] parms = method.getParameterTypes();
Object[] objs = new Object[parms.length];
Modified: webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropProvider.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropProvider.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropProvider.java Tue Apr 26 00:43:08 2005
@@ -86,7 +86,7 @@
try {
if (WSDLService.STYLE_DOC.equals(msgContext.getMessageStyle())) {
SOAPBody body = msgContext.getEnvelope().getBody();
- XMLStreamReader xpp = body.getPullParser(true);
+ XMLStreamReader xpp = body.getXMLStreamReader();
int event = xpp.next();
while (XMLStreamConstants.START_ELEMENT != event
Modified: webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropRequestHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropRequestHandler.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropRequestHandler.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropRequestHandler.java Tue Apr 26 00:43:08 2005
@@ -96,7 +96,7 @@
private String writeStringFromEnvelope(SOAPEnvelope env) throws XMLStreamException {
ByteArrayOutputStream output = new ByteArrayOutputStream(100);
XMLStreamWriter writer = writerFactory.createXMLStreamWriter(output);
- env.serialize(writer, true);
+ env.serializeWithCache(writer);
writer.flush();
return new String(output.toByteArray());
}
Modified: webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropStub.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropStub.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropStub.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/interop/doclit/InteropStub.java Tue Apr 26 00:43:08 2005
@@ -107,13 +107,13 @@
throw new AxisFault("SOAP Fault",SOAPBody.getFault().getException());
}
- OMElement elt = (OMElement)SOAPBody.getChildWithName(new QName(INTEROP_NS_URI,"echoStructReturn"));
+ OMElement elt = (OMElement)SOAPBody.getFirstChildWithName(new QName(INTEROP_NS_URI,"echoStructReturn"));
if (elt==null){
throw new AxisFault("Return element not found");
}
- XMLStreamReader pullParser = elt.getPullParser(false);
+ XMLStreamReader pullParser = elt.getXMLStreamReaderWithoutCaching();
pullParser.next();
SOAPStruct soapStructure = (SOAPStruct)new SOAPStructEncoder().deSerialize(pullParser);
@@ -147,12 +147,12 @@
throw new AxisFault("SOAP Fault",SOAPBody.getFault().getException());
}
- OMElement elt = (OMElement)SOAPBody.getChildWithName(new QName(INTEROP_NS_URI,"echoStringArrayReturn"));
+ OMElement elt = (OMElement)SOAPBody.getFirstChildWithName(new QName(INTEROP_NS_URI,"echoStringArrayReturn"));
if (elt==null){
throw new AxisFault("Return element not found");
}
- return SimpleTypeEncodingUtils.deserializeStringArray(elt.getPullParser(false));
+ return SimpleTypeEncodingUtils.deserializeStringArray(elt.getXMLStreamReaderWithoutCaching());
@@ -176,12 +176,12 @@
throw new AxisFault("SOAP Fault",SOAPBody.getFault().getException());
}
- OMElement elt = (OMElement)SOAPBody.getChildWithName(new QName(INTEROP_NS_URI,"echoStringReturn"));
+ OMElement elt = (OMElement)SOAPBody.getFirstChildWithName(new QName(INTEROP_NS_URI,"echoStringReturn"));
if (elt==null){
throw new AxisFault("Return element not found");
}
- return elt.getFirstChild().getValue();
+ return elt.getText();
}
Modified: webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/ObjectToOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/ObjectToOMBuilder.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/ObjectToOMBuilder.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/ObjectToOMBuilder.java Tue Apr 26 00:43:08 2005
@@ -212,13 +212,13 @@
attrPrefix = (attrQName.indexOf(':') >= 0) ? attrQName.substring(0, attrQName.indexOf(':')) : "";
if (attrUri.hashCode() != 0)
- ns = element.findInScopeNamespace(attrUri, attrPrefix);
+ ns = element.findNamespace(attrUri, attrPrefix);
if (ns == null)
//todo this needs to be fixed!!!!!
// throw new OMException("All elements must be namespace qualified!");
- element.insertAttribute(atts.getLocalName(i), atts.getValue(i), ns);
+ element.addAttribute(atts.getLocalName(i), atts.getValue(i), ns);
}
}
Modified: webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/SimpleJavaProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/SimpleJavaProvider.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/SimpleJavaProvider.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/org/apache/axis/testUtils/SimpleJavaProvider.java Tue Apr 26 00:43:08 2005
@@ -54,7 +54,8 @@
public Object[] deserializeParameters(MessageContext msgContext,
Method method)
throws AxisFault {
- XMLStreamReader xpp = msgContext.getEnvelope().getBody().getFirstElement().getPullParser(true);
+ XMLStreamReader xpp =
+ msgContext.getEnvelope().getBody().getFirstElement().getXMLStreamReader();
Class[] parms = method.getParameterTypes();
Object[] objs = new Object[parms.length];
Modified: webservices/axis/trunk/java/modules/samples/src/userguide/sample1/AsynchronousClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/sample1/AsynchronousClient.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/sample1/AsynchronousClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/sample1/AsynchronousClient.java Tue Apr 26 00:43:08 2005
@@ -60,7 +60,7 @@
System.out.println("Sending the Async message ....");
XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
- requestEnvelop.serialize(writer,true);
+ requestEnvelop.serializeWithCache(writer);
writer.flush();
System.out.println();
Modified: webservices/axis/trunk/java/modules/samples/src/userguide/sample1/ClientEchoCallbackHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/sample1/ClientEchoCallbackHandler.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/sample1/ClientEchoCallbackHandler.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/sample1/ClientEchoCallbackHandler.java Tue Apr 26 00:43:08 2005
@@ -32,7 +32,7 @@
try {
XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
- result.getResponseEnvelope().serialize(writer,true);
+ result.getResponseEnvelope().serializeWithCache(writer);
writer.flush();
} catch (XMLStreamException e) {
System.out.println("Error occured after responce is received");
Modified: webservices/axis/trunk/java/modules/samples/src/userguide/sample1/SynchronousClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/sample1/SynchronousClient.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/sample1/SynchronousClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/sample1/SynchronousClient.java Tue Apr 26 00:43:08 2005
@@ -59,12 +59,12 @@
System.out.println("Sending request...");
XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
- requestEnvelop.serialize(writer,true);
+ requestEnvelop.serializeWithCache(writer);
writer.flush();
System.out.println();
SOAPEnvelope responceEnvelop = call.sendReceiveSync(requestEnvelop);
System.out.println("Responce received ...");
- responceEnvelop.serialize(writer,true);
+ responceEnvelop.serializeWithCache(writer);
writer.flush();
} catch (AxisFault e1) {
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java Tue Apr 26 00:43:08 2005
@@ -93,9 +93,8 @@
Call call = new Call();
call.setTo(targetEPR);
SOAPEnvelope responseEnv = call.sendReceiveSync(envelope);
- responseEnv.serialize(
- XMLOutputFactory.newInstance().createXMLStreamWriter(System.out),
- true);
+ responseEnv.serializeWithCache(
+ XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
}
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java Tue Apr 26 00:43:08 2005
@@ -114,10 +114,9 @@
public void onComplete(AsyncResult result) {
try {
- result.getResponseEnvelope().serialize(
+ result.getResponseEnvelope().serializeWithCache(
XMLOutputFactory.newInstance().createXMLStreamWriter(
- System.out),
- true);
+ System.out));
} catch (XMLStreamException e) {
reportError(e);
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/encoding/EncodingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/encoding/EncodingTest.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/encoding/EncodingTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/encoding/EncodingTest.java Tue Apr 26 00:43:08 2005
@@ -47,7 +47,7 @@
OMElement omel = omfac.createOMElement("value", omNs);
omel.addChild(omfac.createText("1234"));
- deserialize(method, omel.getPullParser(false));
+ deserialize(method, omel.getXMLStreamReaderWithoutCaching());
}
@@ -58,7 +58,7 @@
OMElement omel = omfac.createOMElement("value", omNs);
omel.addChild(omfac.createText("1234"));
- deserialize(method, omel.getPullParser(false));
+ deserialize(method, omel.getXMLStreamReaderWithoutCaching());
}
@@ -74,7 +74,7 @@
omel.addChild(temp);
}
- deserialize(method, omel.getPullParser(false));
+ deserialize(method, omel.getXMLStreamReaderWithoutCaching());
}
public void testDeserializingStringArrayVal() throws SecurityException, NoSuchMethodException, AxisFault, XMLStreamException, FactoryConfigurationError {
@@ -88,8 +88,8 @@
omel.addChild(temp);
}
- omel.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out), true);
- XMLStreamReader xpp = omel.getPullParser(false);
+ omel.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
+ XMLStreamReader xpp = omel.getXMLStreamReaderWithoutCaching();
String[] strs = SimpleTypeEncodingUtils.deserializeStringArray(xpp);
for (int i = 0; i < strs.length; i++) {
System.out.println(strs[i]);
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java Tue Apr 26 00:43:08 2005
@@ -73,7 +73,7 @@
OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
OMElement method = fac.createOMElement("echoOMElement", omNs);
OMElement value = fac.createOMElement("myValue", omNs);
- value.setValue("Isaac Assimov, the foundation Sega");
+ value.addChild(fac.createText(value,"Isaac Assimov, the foundation Sega"));
method.addChild(value);
reqEnv.getBody().addChild(method);
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java Tue Apr 26 00:43:08 2005
@@ -83,13 +83,7 @@
public void testEchoXMLSync() throws Exception {
OMFactory fac = OMFactory.newInstance();
- SOAPEnvelope reqEnv = fac.getDefaultEnvelope();
- OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
- OMElement method = fac.createOMElement("echoOMElement", omNs);
- OMElement value = fac.createOMElement("myValue", omNs);
- value.setValue("Isaac Assimov, the foundation Sega");
- method.addChild(value);
- reqEnv.getBody().addChild(method);
+ SOAPEnvelope reqEnv = createEnvelope(fac);
org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
@@ -98,21 +92,26 @@
call.setAction(operationName.getLocalPart());
SOAPEnvelope resEnv = call.sendReceiveSync(reqEnv);
- resEnv.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out), true);
+ resEnv.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
OMNode omNode = resEnv.getBody().getFirstChild();
assertNotNull(omNode);
}
- public void testEchoXMLASync() throws Exception {
- OMFactory fac = OMFactory.newInstance();
-
+ private SOAPEnvelope createEnvelope(OMFactory fac) {
SOAPEnvelope reqEnv = fac.getDefaultEnvelope();
OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
OMElement method = fac.createOMElement("echoOMElement", omNs);
OMElement value = fac.createOMElement("myValue", omNs);
- value.setValue("Isaac Assimov, the foundation Sega");
+ value.addChild(fac.createText(value,"Isaac Assimov, the foundation Sega"));
method.addChild(value);
reqEnv.getBody().addChild(method);
+ return reqEnv;
+ }
+
+ public void testEchoXMLASync() throws Exception {
+ OMFactory fac = OMFactory.newInstance();
+
+ SOAPEnvelope reqEnv = createEnvelope(fac);
org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
@@ -122,8 +121,8 @@
Callback callback = new Callback() {
public void onComplete(AsyncResult result) {
try {
- result.getResponseEnvelope().serialize(XMLOutputFactory.newInstance()
- .createXMLStreamWriter(System.out), true);
+ result.getResponseEnvelope().serializeWithCache(XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(System.out));
} catch (XMLStreamException e) {
reportError(e);
} finally {
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java Tue Apr 26 00:43:08 2005
@@ -45,9 +45,16 @@
public class HandlerFailureTest extends TestCase {
private Log log = LogFactory.getLog(getClass());
- private EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO, "http://127.0.0.1:" + (UtilServer.TESTING_PORT) + "/axis/services/EchoXMLService");
- private QName serviceName = new QName("", targetEPR.getAddress());
- private QName operationName = new QName("echoOMElement");
+ private static final String SERVICE_NAME = "EchoXMLService";
+ private static final String OPERATION_NAME = "echoOMElement";
+ private static final String ADDRESS = "http://127.0.0.1:" + (UtilServer.TESTING_PORT) +
+ "/axis/services/" + SERVICE_NAME + "/" +OPERATION_NAME;
+// private static final String ADDRESS = "http://127.0.0.1:8080/axis/services/" + SERVICE_NAME;
+ private EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO, ADDRESS);
+ private QName serviceName = new QName("", SERVICE_NAME);
+ //private QName serviceName = new QName("", targetEPR.getAddress());
+
+ private QName operationName = new QName(OPERATION_NAME);
private MessageContext mc;
@@ -139,7 +146,7 @@
OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
OMElement method = fac.createOMElement("echoOMElement", omNs);
OMElement value = fac.createOMElement("myValue", omNs);
- value.setValue("Isaac Assimov, the foundation Sega");
+ value.setText("Isaac Assimov, the foundation Sega");
method.addChild(value);
reqEnv.getBody().addChild(method);
@@ -151,7 +158,6 @@
call.setAction(operationName.getLocalPart());
SOAPEnvelope resEnv = call.sendReceiveSync(reqEnv);
-
SOAPBody sb = resEnv.getBody();
if (sb.hasFault()) {
@@ -160,6 +166,7 @@
}
fail("the test must fail due to bad service Name");
} catch (AxisFault e) {
+ System.out.println("e.getMessage() = " + e.getMessage());
assertTrue((e.getMessage().indexOf(UtilServer.FAILURE_MESSAGE)) > 0);
return;
}
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/EchoTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/EchoTest.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/EchoTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/EchoTest.java Tue Apr 26 00:43:08 2005
@@ -92,7 +92,7 @@
if (body.hasFault()) {
throw body.getFault().getException();
}
- XMLStreamReader xpp = body.getPullParser(true);
+ XMLStreamReader xpp = body.getXMLStreamReader();
int event = xpp.next();
while (event != XMLStreamConstants.START_ELEMENT) {
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java Tue Apr 26 00:43:08 2005
@@ -64,7 +64,7 @@
}
public void testSerialization() throws Exception {
- element.serialize(writer, true);
+ element.serializeWithCache(writer);
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java Tue Apr 26 00:43:08 2005
@@ -1,18 +1,18 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.axis.om;
import javax.xml.namespace.QName;
@@ -52,7 +52,7 @@
* @return
* @throws OMException
*/
- public OMNode getChildWithName(QName elementQName) throws OMException;
+ public OMNode getFirstChildWithName(QName elementQName) throws OMException;
/**
* This returns a collection of this element.
@@ -87,27 +87,16 @@
* @return
* @throws OMException
*/
- public OMNamespace findInScopeNamespace(String uri, String prefix)
+ public OMNamespace findNamespace(String uri, String prefix)
throws OMException;
/**
- * This will ckeck for the namespace <B>only</B> in the current Element
*
- * @param uri
- * @param prefix
* @return
* @throws OMException
*/
- public OMNamespace findDeclaredNamespace(String uri, String prefix)
- throws OMException;
+ public Iterator getAllDeclaredNamespaces() throws OMException;
- /**
- * This will provide a list of namespace defined within this Element <B>only</B>
- *
- * @return
- * @throws OMException
- */
- public Iterator getAllDeclaredNamespaces();
/**
* This will help to search for an attribute with a given QName within this Element
@@ -116,7 +105,7 @@
* @return
* @throws OMException
*/
- public OMAttribute getAttributeWithQName(QName qname) throws OMException;
+ public OMAttribute getFirstAttribute(QName qname) throws OMException;
/**
* This will return a List of OMAttributes
@@ -132,7 +121,7 @@
* @param attr
* @return
*/
- public OMAttribute insertAttribute(OMAttribute attr);
+ public OMAttribute addAttribute(OMAttribute attr);
/**
* @param attributeName
@@ -141,8 +130,8 @@
* must be declared in the parent element of this attribute or ancestors of the parent element of the attribute
* @return
*/
- public OMAttribute insertAttribute(String attributeName, String value,
- OMNamespace ns);
+ public OMAttribute addAttribute(String attributeName, String value,
+ OMNamespace ns);
/**
* Method removeAttribute
@@ -178,30 +167,39 @@
* @return
*/
public OMNode getFirstChild();
-
+
/**
* Convenience extension of the getFirstChild
* @return
*/
-
+
public OMElement getFirstElement();
+
+
/**
- * Convenience extension of the getNextSibling
- * @return
- */
- public OMElement getNextSiblingElement() throws OMException;
+ * Returns the pull parser that will generate the pull
+ * events relevant to THIS element. Caching is on
+ *
+ * @return
+ */
+ public XMLStreamReader getXMLStreamReader();
/**
* Returns the pull parser that will generate the pull
- * events relevant to THIS element
+ * events relevant to THIS element.caching is off
+ *
*
- * @param cacheOff
* @return
*/
- public XMLStreamReader getPullParser(boolean cacheOff);
+ public XMLStreamReader getXMLStreamReaderWithoutCaching();
/**
+ *
+ * @param text
+ */
+ public void setText(String text);
+ /**
* This will return the non-empty text children as a String
* @return
*/
@@ -222,33 +220,22 @@
public void setLocalName(String localName);
/**
- * Method getNamespace
- *
- * @return
+ * @return the OMNamespace object associated with this element
* @throws OMException
*/
public OMNamespace getNamespace() throws OMException;
/**
- * Method getNamespaceName
- *
- * @return
- */
- public String getNamespaceName();
-
- /**
- * Method setNamespace
- *
+ * sets the Namespace
* @param namespace
*/
public void setNamespace(OMNamespace namespace);
+ /**
+ * Get the Qname of this node
+ * @return
+ */
public QName getQName();
- /**
- * This will completely parse this node and build the object structure in the memory
- * @throws OMException
- */
- public void populateYourSelf() throws OMException ;
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java Tue Apr 26 00:43:08 2005
@@ -1,18 +1,18 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.axis.om;
import javax.xml.stream.XMLStreamException;
@@ -28,11 +28,6 @@
public static final short ELEMENT_NODE = 1;
/**
- * The node is an <code>Attr</code>.
- */
- public static final short ATTRIBUTE_NODE = 2;
-
- /**
* The node is a <code>Text</code> node.
*/
public static final short TEXT_NODE = 3;
@@ -47,10 +42,6 @@
*/
public static final short COMMENT_NODE = 8;
- /**
- * The node is a <code>Document</code>.
- */
- public static final short DOCUMENT_NODE = 9;
/**
* This method should return the immediate parent of the node.
@@ -84,24 +75,6 @@
public void setNextSibling(OMNode node);
/**
- * This will return the literal value of the node.
- * OMText --> the text
- * OMElement --> local name of the element in String format
- * OMAttribute --> the value of the attribue
- *
- * @return
- * @throws OMException
- */
- public String getValue() throws OMException;
-
- /**
- * Method setValue
- *
- * @param value
- */
- public void setValue(String value);
-
- /**
* this will indicate whether parser has parsed this information item completely or not.
* If somethings info are not available in the item, one has to check this attribute to make sure that, this
* item has been parsed completely or not.
@@ -118,15 +91,22 @@
public void setComplete(boolean state);
/**
- * This will remove this information item and its children, from the model completely
- *
+ * This will remove this information item and its children, from the model completely.
+ * Important to note that this method will detach the OMNode once it is fully built.
+ * Half built nodes are not to be detached!
* @throws OMException
*/
- public void detach() throws OMException;
+ public OMNode detach() throws OMException;
+
+ /**
+ * Discards a Node. Discrad goes to the parser level and if the element is not
+ * completely built, then it will be completely skipped at the parser level
+ * @throws OMException
+ */
+ public void discard() throws OMException;
/**
* This will insert a sibling just after the current information item.
- *
* @param sibling
* @throws OMException
*/
@@ -142,43 +122,51 @@
/**
* This is to get the type of node, as this is the super class of all the nodes
- *
* @return
* @throws OMException
*/
- public short getType() throws OMException;
+ public int getType() throws OMException;
/**
* Method setType
- *
* @param nodeType
* @throws OMException
*/
- public void setType(short nodeType) throws OMException;
+ public void setType(int nodeType) throws OMException;
/**
* get the previous sibling
- *
* @return
*/
public OMNode getPreviousSibling();
/**
* Set the previous sibling
- *
* @param previousSibling
*/
public void setPreviousSibling(OMNode previousSibling);
/**
+ * Serialize the node with caching
+ * @see #serializeWithCache(javax.xml.stream.XMLStreamWriter)
* @param writer
- * @param cache
* @throws XMLStreamException
*/
- public void serialize(XMLStreamWriter writer, boolean cache)
+ public void serializeWithCache(XMLStreamWriter writer)
throws XMLStreamException;
+ /**
+ * Serilaize the node without caching
+ * @see #serialize(javax.xml.stream.XMLStreamWriter)
+ * @param writer
+ * @throws XMLStreamException
+ */
public void serialize(XMLStreamWriter writer)
throws XMLStreamException;
+
+ /**
+ * Builds itself
+ */
+ public void build();
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMSerializer.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMSerializer.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMSerializer.java Tue Apr 26 00:43:08 2005
@@ -23,7 +23,7 @@
*/
public interface OMSerializer {
/**
- * Method serialize
+ * Method serializeWithCache
*
* @param obj
* @param writer
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMText.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMText.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMText.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMText.java Tue Apr 26 00:43:08 2005
@@ -20,17 +20,20 @@
*/
public interface OMText extends OMNode {
/**
- * We use the OMText class to hold comments, text, characterData, CData, etc.,
- * The codes are found in OMNode class
- *
- * @param type
+ * Returns the text value of this node
+ * @return
*/
- public void setTextType(short type);
+ String getText();
+
+ /*
+ * Re think about this
+ */
+ //DataHandler getDataHandler();
/**
- * Method getTextType
*
- * @return
+ * @return boolean flag saying whether the node contains
+ * an optimized text or not
*/
- public short getTextType();
+ boolean isOptimized();
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java Tue Apr 26 00:43:08 2005
@@ -1,18 +1,18 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.axis.om.impl.llom;
import org.apache.axis.om.*;
@@ -47,10 +47,7 @@
*/
protected OMNode firstChild;
- /**
- * Field builder
- */
- protected OMXMLParserWrapper builder;
+
/**
* Field namespaces
@@ -141,7 +138,7 @@
// first try to find a namespace from the scope
String namespaceURI = qname.getNamespaceURI();
if (!"".equals(namespaceURI)) {
- ns = findInScopeNamespace(qname.getNamespaceURI(),
+ ns = findNamespace(qname.getNamespaceURI(),
qname.getPrefix());
} else {
if (parent != null) {
@@ -179,7 +176,7 @@
* @return
*/
private OMNamespace handleNamespace(OMNamespace ns) {
- OMNamespace namespace = findInScopeNamespace(ns.getName(),
+ OMNamespace namespace = findNamespace(ns.getName(),
ns.getPrefix());
if (namespace == null) {
namespace = declareNamespace(ns);
@@ -213,16 +210,16 @@
}
/**
- * Method getChildWithName
+ * Method getFirstChildWithName
*
* @param elementQName
* @return
* @throws OMException
*/
- public OMNode getChildWithName(QName elementQName) throws OMException {
+ public OMNode getFirstChildWithName(QName elementQName) throws OMException {
OMChildrenQNameIterator omChildrenQNameIterator =
- new OMChildrenQNameIterator((OMNodeImpl) getFirstChild(),
- elementQName);
+ new OMChildrenQNameIterator((OMNodeImpl) getFirstChild(),
+ elementQName);
OMNode omNode = null;
if (omChildrenQNameIterator.hasNext()) {
omNode = (OMNode) omChildrenQNameIterator.next();
@@ -288,15 +285,6 @@
return declareNamespace(ns);
}
- /**
- * Method setValue
- *
- * @param value
- */
- public void setValue(String value) {
- OMText txt = OMFactory.newInstance().createText(value);
- this.addChild(txt);
- }
/**
* @param namespace
@@ -321,7 +309,7 @@
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public OMNamespace findInScopeNamespace(String uri, String prefix)
+ public OMNamespace findNamespace(String uri, String prefix)
throws OMException {
// check in the current element
@@ -332,7 +320,7 @@
// go up to check with ancestors
if (parent != null) {
- return parent.findInScopeNamespace(uri, prefix);
+ return parent.findNamespace(uri, prefix);
}
return null;
}
@@ -346,7 +334,7 @@
* @return
* @throws OMException
*/
- public OMNamespace findDeclaredNamespace(String uri, String prefix)
+ private OMNamespace findDeclaredNamespace(String uri, String prefix)
throws OMException {
if (namespaces == null) {
return null;
@@ -386,7 +374,7 @@
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public OMAttribute getAttributeWithQName(QName qname) throws OMException {
+ public OMAttribute getFirstAttribute(QName qname) throws OMException {
if (attributes == null) {
return null;
}
@@ -426,7 +414,7 @@
* @param attr
* @return
*/
- public OMAttribute insertAttribute(OMAttribute attr) {
+ public OMAttribute addAttribute(OMAttribute attr) {
if (attributes == null) {
this.attributes = new HashMap(5);
}
@@ -446,27 +434,27 @@
}
/**
- * Method insertAttribute
+ * Method addAttribute
*
* @param attributeName
* @param value
* @param ns
* @return
*/
- public OMAttribute insertAttribute(String attributeName, String value,
- OMNamespace ns) {
+ public OMAttribute addAttribute(String attributeName, String value,
+ OMNamespace ns) {
OMNamespace namespace = null;
if (ns != null) {
- namespace = findInScopeNamespace(ns.getName(), ns.getPrefix());
+ namespace = findNamespace(ns.getName(), ns.getPrefix());
if (namespace == null) {
throw new OMException(
"Given OMNamespace(" + ns.getName() + ns.getPrefix()
- + ") for "
- + "this attribute is not declared in the scope of this element. First declare the namespace"
- + " and then use it with the attribute");
+ + ") for "
+ + "this attribute is not declared in the scope of this element. First declare the namespace"
+ + " and then use it with the attribute");
}
}
- return insertAttribute(new OMAttributeImpl(attributeName, ns, value));
+ return addAttribute(new OMAttributeImpl(attributeName, ns, value));
}
/**
@@ -521,12 +509,13 @@
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public void detach() throws OMException {
- if (done) {
+ public OMNode detach() throws OMException {
+ if (!done){
+ build();
+ }else{
super.detach();
- } else {
- builder.discard(this);
}
+ return this;
}
/**
@@ -539,48 +528,78 @@
}
/**
- * This will return the literal value of the node.
- * OMText --> the text
- * OMElement --> local name of the element in String format
- * OMAttribute --> the value of the attribue
+ * This is to get the type of node, as this is the super class of all the nodes
*
* @return
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public String getValue() throws OMException {
- throw new UnsupportedOperationException();
+ public int getType() throws OMException {
+ return OMNode.ELEMENT_NODE;
}
/**
- * This is to get the type of node, as this is the super class of all the nodes
- *
+ * @see org.apache.axis.om.OMElement#getXMLStreamReader()
* @return
- * @throws org.apache.axis.om.OMException
- * @throws OMException
*/
- public short getType() throws OMException {
- return OMNode.ELEMENT_NODE;
+ public XMLStreamReader getXMLStreamReader() {
+ return getXMLStreamReader(true);
}
/**
- * @param cacheOff
+ * @see org.apache.axis.om.OMElement#getXMLStreamReaderWithoutCaching()
* @return
*/
- public XMLStreamReader getPullParser(boolean cacheOff) {
- if ((builder == null) && cacheOff) {
+ public XMLStreamReader getXMLStreamReaderWithoutCaching() {
+ return getXMLStreamReader(false);
+ }
+
+ /**
+ * @param cache
+ * @return
+ */
+ private XMLStreamReader getXMLStreamReader(boolean cache) {
+ if ((builder == null) && !cache) {
throw new UnsupportedOperationException(
"This element was not created in a manner to be switched");
}
- return new OMStAXWrapper(builder, this, cacheOff);
+ return new OMStAXWrapper(builder, this, cache);
}
+ /**
+ * Sets the text of the given element.
+ * caution - This method will wipe out all the text elements (and hence any
+ * moxed content) before setting the text
+ * @param text
+ */
+ public void setText(String text) {
+
+ OMNode child = this.getFirstChild();
+ while(child != null){
+ if(child.getType() == OMNode.TEXT_NODE){
+ child.detach();
+ }
+ child = child.getNextSibling();
+ }
+
+ this.addChild(OMFactory.newInstance().createText(this,text));
+ }
+
+ /**
+ * select all the text children and concat them to a single string
+ * @return
+ */
public String getText() {
String childText = "";
OMNode child = this.getFirstChild();
+ OMText textNode = null;
+
while(child != null){
- if(child.getType() == OMNode.TEXT_NODE && child.getValue() != null && !"".equals(child.getValue().trim())){
- childText += child.getValue().trim();
+ if(child.getType() == OMNode.TEXT_NODE){
+ textNode = (OMText)child;
+ if( textNode.getText() != null && !"".equals(textNode.getText().trim())){
+ childText += textNode.getText().trim();
+ }
}
child = child.getNextSibling();
}
@@ -589,14 +608,16 @@
}
/**
- * Method serialize
+ * Method serializeWithCache
*
* @param writer
- * @param cache
* @throws XMLStreamException
*/
- public void serialize(XMLStreamWriter writer, boolean cache)
- throws XMLStreamException {
+ public void serializeWithCache(XMLStreamWriter writer) throws XMLStreamException {
+ serialize(writer,true);
+ }
+ private void serialize(XMLStreamWriter writer,boolean cache)throws XMLStreamException {
+
boolean firstElement = false;
short builderType = PULL_TYPE_BUILDER; // default is pull type
if (builder != null) {
@@ -611,13 +632,13 @@
}
// Special case for the pull type building with cache off
- // The getPullParser method returns the current elements itself.
+ // The getXMLStreamReader method returns the current elements itself.
if (!cache) {
if ((firstChild == null) && (nextSibling == null) && !isComplete()
&& (builderType == PULL_TYPE_BUILDER)) {
StreamingOMSerializer streamingOMSerializer =
- new StreamingOMSerializer();
- streamingOMSerializer.serialize(this.getPullParser(!cache),
+ new StreamingOMSerializer();
+ streamingOMSerializer.serialize(this.getXMLStreamReader(!cache),
writer);
return;
}
@@ -625,12 +646,12 @@
if (!cache) {
if (isComplete()) {
- // serialize own normally
+ // serializeWithCache own normally
serializeNormal(writer, cache);
if (nextSibling != null) {
// serilize next sibling
- nextSibling.serialize(writer, cache);
+ nextSibling.serializeWithCache(writer);
} else {
if (parent == null) {
return;
@@ -647,8 +668,8 @@
} else if (firstChild != null) {
serializeStartpart(writer);
log.info("Serializing the Element from " + localName
- + " the generated OM tree");
- firstChild.serialize(writer, cache);
+ + " the generated OM tree");
+ firstChild.serializeWithCache(writer);
serializeEndpart(writer);
} else {
@@ -661,14 +682,14 @@
}
} else {
- // serialize own normally
+ // serializeWithCache own normally
serializeNormal(writer, cache);
- // serialize the siblings if this is not the first element
+ // serializeWithCache the siblings if this is not the first element
if (!firstElement) {
OMNode nextSibling = this.getNextSibling();
if (nextSibling != null) {
- nextSibling.serialize(writer, cache);
+ nextSibling.serializeWithCache(writer);
}
}
}
@@ -676,13 +697,14 @@
/**
* This was requested during the second Axis2 summit. When one call this method, this will
- * serialise without building the object structure in the memory. Misuse of this method will cause loss of data.
- * So its adviced to use populateYourSelf() method, before this, if you want to preserve data in the stream.
+ * serialise without building the object structure in the memory. Misuse of this method will
+ * cause loss of data.So its adviced to use populateYourSelf() method, before this,
+ * if you want to preserve data in the stream.
* @param writer
* @throws XMLStreamException
*/
public void serialize(XMLStreamWriter writer) throws XMLStreamException {
- this.serialize(writer, false);
+ this. serialize(writer,false);
}
@@ -770,7 +792,11 @@
serializeStartpart(writer);
OMNode firstChild = getFirstChild();//todo
if (firstChild != null) {
- firstChild.serialize(writer, cache);
+ if (cache){
+ firstChild.serializeWithCache(writer);
+ }else{
+ firstChild.serialize(writer);
+ }
}
serializeEndpart(writer);
}
@@ -848,20 +874,20 @@
return null;
}
- /* (non-Javadoc)
- * @see org.apache.axis.om.OMElement#getNextSiblingElement()
- */
- public OMElement getNextSiblingElement() throws OMException {
- OMNode node = getNextSibling();
- while(node != null){
- if(node.getType() == OMNode.ELEMENT_NODE){
- return (OMElement)node;
- }else{
- node = node.getNextSibling();
- }
- }
- return null;
- }
+// /* (non-Javadoc)
+// * @see org.apache.axis.om.OMElement#getNextSiblingElement()
+// */
+// public OMElement getNextSiblingElement() throws OMException {
+// OMNode node = getNextSibling();
+// while(node != null){
+// if(node.getType() == OMNode.ELEMENT_NODE){
+// return (OMElement)node;
+// }else{
+// node = node.getNextSibling();
+// }
+// }
+// return null;
+// }
/**
@@ -898,17 +924,6 @@
return ns;
}
- /**
- * Method getNamespaceName
- *
- * @return
- */
- public String getNamespaceName() {
- if (ns != null) {
- return ns.getName();
- }
- return null;
- }
/**
* @param namespace
@@ -934,13 +949,14 @@
}
/**
- * This will completely parse this node and build the object structure in the memory
+ * Discard implementation for
* @throws OMException
*/
- public void populateYourSelf() throws OMException {
- while(!done){
- builder.next();
+ public void discard() throws OMException {
+ if (done){
+ this.detach();
+ }else{
+ builder.discard(this);
}
}
-
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java Tue Apr 26 00:43:08 2005
@@ -1,23 +1,24 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.axis.om.impl.llom;
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMException;
import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMXMLParserWrapper;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
@@ -40,12 +41,11 @@
* Field previousSibling
*/
protected OMNodeImpl previousSibling;
-
- /**
- * Field value
+ /**
+ * Field builder
*/
- protected String value;
-
+ protected OMXMLParserWrapper builder;
+
/**
* Field done
*/
@@ -54,7 +54,7 @@
/**
* Field nodeType
*/
- protected short nodeType;
+ protected int nodeType;
/**
* Constructor OMNodeImpl
@@ -96,7 +96,7 @@
return;
}
- if (element instanceof OMNodeImpl) {
+ if (element instanceof OMNodeImpl) {//todo fix me
if(this.parent != null){
this.detach();
}
@@ -127,28 +127,6 @@
this.nextSibling = (OMNodeImpl) node;
}
- /**
- * This will return the literal value of the node.
- * OMText --> the text
- * OMElement --> local name of the element in String format
- * OMAttribute --> the value of the attribue
- *
- * @return
- * @throws org.apache.axis.om.OMException
- * @throws OMException
- */
- public String getValue() throws OMException {
- return value;
- }
-
- /**
- * Method setValue
- *
- * @param value
- */
- public void setValue(String value) {
- this.value = value;
- }
/**
* this will indicate whether parser has parsed this information item completely or not.
@@ -158,7 +136,7 @@
* @return
*/
public boolean isComplete() {
- return true;
+ return done;
}
/**
@@ -176,7 +154,7 @@
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public void detach() throws OMException {
+ public OMNode detach() throws OMException {
if (parent == null) {
throw new OMException(
"Elements that doesn't have a parent can not be detached");
@@ -190,6 +168,8 @@
if (nextSibling != null) {
nextSibling.setPreviousSibling(previousSibling);
}
+
+ return this;
}
/**
@@ -250,7 +230,7 @@
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public short getType() throws OMException {
+ public int getType() throws OMException {
return nodeType;
}
@@ -260,7 +240,7 @@
* @param nodeType
* @throws OMException
*/
- public void setType(short nodeType) throws OMException {
+ public void setType(int nodeType) throws OMException {
this.nodeType = nodeType;
}
@@ -282,13 +262,21 @@
this.previousSibling = (OMNodeImpl) previousSibling;
}
- /**
- * Method serialize
- *
- * @param writer
- * @param cache
- * @throws XMLStreamException
+
+
+ /**
+ * This will completely parse this node and build the object structure in the memory.
+ * However a programmatically created node will have done set to true by default and will cause
+ * populateyourself not to work properly!
+ * @throws OMException
*/
+ public void build() throws OMException {
+ while(!done){
+ builder.next();
+ }
+ }
+
+
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java Tue Apr 26 00:43:08 2005
@@ -170,10 +170,10 @@
*
* @param builder
* @param startNode
- * @param cacheOff
+ * @param cache
*/
OMStAXWrapper(OMXMLParserWrapper builder, OMElement startNode,
- boolean cacheOff) {
+ boolean cache) {
// create a navigator
this.navigator = new OMNavigator(startNode);
@@ -185,7 +185,7 @@
// returns the starting node at the first call to it
currentNode = navigator.next();
updateNextNode();
- switchingAllowed = cacheOff;
+ switchingAllowed = !cache;
}
/**
@@ -297,7 +297,7 @@
returnLength = parser.getTextLength();
} else {
OMText textNode = (OMText) lastNode;
- returnLength = textNode.getValue().length();
+ returnLength = textNode.getText().length();
}
return returnLength;
}
@@ -353,7 +353,7 @@
} else {
if (hasText()) {
OMText textNode = (OMText) lastNode;
- String str = textNode.getValue();
+ String str = textNode.getText();
returnArray = str.toCharArray();
}
}
@@ -371,7 +371,7 @@
} else {
if (hasText()) {
OMText textNode = (OMText) lastNode;
- returnString = textNode.getValue();
+ returnString = textNode.getText();
}
}
return returnString;
@@ -1012,7 +1012,7 @@
case OMNode.ELEMENT_NODE:
OMElement element = (OMElement) node;
log.info("Generating events from element {"
- + element.getNamespaceName() + '}'
+ + element.getNamespace().getName() + '}'
+ element.getLocalName() + " Generated OM tree");
returnEvent = generateElementEvents(element);
break;
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java?rev=164761&r1=164760&r2=164761&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java Tue Apr 26 00:43:08 2005
@@ -28,9 +28,8 @@
* Class OMTextImpl
*/
public class OMTextImpl extends OMNodeImpl implements OMText, OMConstants {
- /**
- * Field textType
- */
+
+ protected String value;
protected short textType = TEXT_NODE;
/**
@@ -41,7 +40,7 @@
*/
public OMTextImpl(OMElement parent, String text) {
super(parent);
- setValue(text);
+ this.value = text;
done = true;
}
@@ -51,69 +50,25 @@
* @param s
*/
public OMTextImpl(String s) {
- setValue(s);
+ this.value = s;
}
- /**
- * We use the OMText class to hold comments, text, characterData, CData, etc.,
- * The codes are found in OMNode class
- *
- * @param type
- */
- public void setTextType(short type) {
- if ((type == TEXT_NODE) || (type == COMMENT_NODE)
- || (type == CDATA_SECTION_NODE)) {
- this.textType = type;
- } else {
- throw new UnsupportedOperationException(
- "Attempt to set wrong type");
- }
- }
- /**
- * Method getTextType
- *
- * @return
- */
- public short getTextType() {
- return textType;
- }
-
- /**
- * Method getFirstChild
- *
- * @return
- * @throws OMException
- */
- public OMNode getFirstChild() throws OMException {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Method setFirstChild
- *
- * @param node
- * @throws OMException
- */
- public void setFirstChild(OMNode node) throws OMException {
- throw new UnsupportedOperationException();
- }
/**
* @return
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public short getType() throws OMException {
+ public int getType() throws OMException {
return textType;
}
/**
* @param writer
- * @param cache
* @throws XMLStreamException
*/
- public void serialize(XMLStreamWriter writer, boolean cache)
+ public void serializeWithCache(XMLStreamWriter writer)
throws XMLStreamException {
if (textType == TEXT_NODE) {
writer.writeCharacters(this.value);
@@ -124,11 +79,35 @@
}
OMNode nextSibling = this.getNextSibling();
if (nextSibling != null) {
- nextSibling.serialize(writer, cache);
+ nextSibling.serializeWithCache(writer);
}
}
public void serialize(XMLStreamWriter writer) throws XMLStreamException {
- this.serialize(writer, false);
+ this.serializeWithCache(writer);
+ }
+
+ /**
+ * Slightly different implementation of the discard method
+ * @throws OMException
+ */
+ public void discard() throws OMException {
+ if (done){
+ this.detach();
+ }else{
+ builder.discard(this.parent);
+ }
+ }
+
+ /**
+ * Returns the value
+ * @return
+ */
+ public String getText() {
+ return this.value;
+ }
+
+ public boolean isOptimized() {
+ return false; //Todo
}
}