Author: veithen
Date: Wed Feb  3 23:56:06 2016
New Revision: 1728392

URL: http://svn.apache.org/viewvc?rev=1728392&view=rev
Log:
Remove the code introduced by AXIS2-4509 to implement an optimization that is 
only supported by a proprietary StAX implementation (presumably XLXP on 
WebSphere). Reasons:
- The optimization needs to be enabled explicitly by registering a 
ParsedEntityReader, but no implementation of that interface for any StAX 
implementation is available. That means that no user of the (Open Source 
version) of Axis2 benefits from that optimization. Presumably the code is only 
enabled in IBM's fork of Axis2 used in WebSphere.
- The corresponding unit test (which uses a dummy ParsedEntityReader 
implementation) sporadically fails.
- The code would require maintenance because some of the APIs that it uses will 
change in Axiom 1.3.

Removed:
    
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/listener/
    
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/ParsedEntityReader.java
    
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/ParsedEntityReaderImpl.java
    
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/factory/ParsedEntityReaderFactory.java
    
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/context/
Modified:
    
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
    
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
    
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
    
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java

Modified: 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java?rev=1728392&r1=1728391&r2=1728392&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
 Wed Feb  3 23:56:06 2016
@@ -19,16 +19,11 @@
 
 package org.apache.axis2.jaxws.dispatch;
 
-import static com.google.common.truth.Truth.assertThat;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
 import java.io.StringReader;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
@@ -43,16 +38,11 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPModelBuilder;
 import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.message.databinding.ParsedEntityReader;
-import org.apache.axis2.jaxws.message.factory.ParsedEntityReaderFactory;
-import org.apache.axis2.jaxws.registry.FactoryRegistry;
 
 /**
  * This class uses the JAX-WS Dispatch API to test sending and receiving
@@ -70,10 +60,6 @@ public class OMElementDispatchTest exten
         "<test:echoOMElement 
xmlns:test=\"http://org/apache/axis2/jaxws/test/OMELEMENT\";>" +
         "<test:input>SAMPLE REQUEST MESSAGE</test:input>" +
         "</test:echoOMElement>";
-    private static final String testResponse = 
-        "<test:echoOMElement 
xmlns:test=\"http://org/apache/axis2/jaxws/test/OMELEMENT\";>" +
-        "<test:output>TEST RESPONSE MESSAGE</test:output>" +
-        "</test:echoOMElement>";
     private static final String sampleEnvelopeHead = 
         "<soapenv:Envelope 
xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\";>" +
         "<soapenv:Header /><soapenv:Body>";
@@ -325,79 +311,4 @@ public class OMElementDispatchTest exten
         
assertTrue(responseText.contains("http://www.w3.org/2003/05/soap-envelope";));
         
assertTrue(!responseText.contains("http://schemas.xmlsoap.org/soap/envelope";));
     }
-    
-    /**
-     * Test sending a SOAP 1.2 request in MESSAGE mode with
-     * a Parser that can provide the InputStream for the payload
-     */
-    public void testOMElementDispatchWithParsedEntityReader() throws Exception 
{
-        
-        // Subsitute a ParsedEntityReader that will provide the
-        // payload InputStream.  This simulates parsers that provide this
-        // feature.
-        ParsedEntityReaderFactory factory = (ParsedEntityReaderFactory)
-        FactoryRegistry.getFactory(ParsedEntityReaderFactory.class);
-        ParsedEntityReader per = new ParsedEntityReaderTest();
-        factory.setParsetEntityReader(per);
-        
-        try {
-            // Create the JAX-WS client needed to send the request
-            Service service = Service.create(QNAME_SERVICE);
-            service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING, 
URL_ENDPOINT);
-            Dispatch<OMElement> dispatch = service.createDispatch(
-                    QNAME_PORT, OMElement.class, Mode.MESSAGE);
-
-            // Create the OMElement object with the payload contents.  Since
-            // we're in PAYLOAD mode, we don't have to worry about the 
envelope.
-            StringReader sr = new StringReader(sampleEnvelope);
-            SOAPModelBuilder builder = 
OMXMLBuilderFactory.createSOAPModelBuilder(sr); 
-            SOAPEnvelope soap12Envelope = (SOAPEnvelope) 
builder.getDocumentElement();
-
-
-            // Invoke
-            OMElement response = dispatch.invoke(soap12Envelope);
-            
-
-            SOAPEnvelope responseEnv = (SOAPEnvelope) response;
-            SOAPBody responseBody = responseEnv.getBody();
-            OMElement payload = responseBody.getFirstElement();
-
-            // At this point, the payload should be an OMSourcedElement
-            // that was created from the ParsedEntityReader's stream
-            assertThat(payload).isInstanceOf(OMSourcedElement.class);
-
-
-            // Check to make sure the contents of the message are correct
-            String responseText = payload.toStringWithConsume();
-            assertThat(responseText).contains("TEST RESPONSE");
-        } finally {
-            
-            // Uninstall the Test ParsedEntityReader
-            factory.setParsetEntityReader(null);
-        }
-    }
-    
-    /**
-     * The purpose of a ParsedEntityReader is to get the 
-     * InputStream from the parser if it is available.
-     * Woodstox and other parsers don't provide that feature.
-     * To simulate this feature, this ParserEntityReaderTest is
-     * inserted to simulate getting a response from the Parser.
-     */
-    public class ParsedEntityReaderTest implements ParsedEntityReader {
-        private final AtomicInteger count = new AtomicInteger();
-        
-        public boolean isParsedEntityStreamAvailable() {
-            return true;
-        }
-
-        public InputStream readParsedEntityStream(XMLStreamReader reader) {
-            if (count.incrementAndGet() == 2) {
-                return new ByteArrayInputStream(testResponse.getBytes()); 
-            } else  {
-                return null;
-            }
-        }
-
-    }
 }

Modified: 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java?rev=1728392&r1=1728391&r2=1728392&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
 Wed Feb  3 23:56:06 2016
@@ -36,7 +36,6 @@ import org.apache.axis2.jaxws.handler.fa
 import 
org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManagerFactory;
 import org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockFactoryImpl;
 import org.apache.axis2.jaxws.message.databinding.impl.OMBlockFactoryImpl;
-import org.apache.axis2.jaxws.message.databinding.impl.ParsedEntityReaderImpl;
 import 
org.apache.axis2.jaxws.message.databinding.impl.SOAPEnvelopeBlockFactoryImpl;
 import org.apache.axis2.jaxws.message.databinding.impl.SourceBlockFactoryImpl;
 import 
org.apache.axis2.jaxws.message.databinding.impl.XMLStringBlockFactoryImpl;
@@ -45,7 +44,6 @@ import org.apache.axis2.jaxws.message.fa
 import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
 import org.apache.axis2.jaxws.message.factory.MessageFactory;
 import org.apache.axis2.jaxws.message.factory.OMBlockFactory;
-import org.apache.axis2.jaxws.message.factory.ParsedEntityReaderFactory;
 import org.apache.axis2.jaxws.message.factory.SAAJConverterFactory;
 import org.apache.axis2.jaxws.message.factory.SOAPEnvelopeBlockFactory;
 import org.apache.axis2.jaxws.message.factory.SourceBlockFactory;
@@ -126,7 +124,6 @@ public class FactoryRegistry {
         table.put(InvocationControllerFactory.class, new 
InvocationControllerFactoryImpl());
         table.put(HandlerPreInvokerFactory.class, new 
HandlerPreInvokerFactoryImpl());
         table.put(HandlerPostInvokerFactory.class, new 
HandlerPostInvokerFactoryImpl());
-        table.put(ParsedEntityReaderFactory.class, new 
ParsedEntityReaderFactory());
         // register the implementation responsible for both WebServiceContext 
         // injection and the updating of the WebServiceContext instances that
         // have already been injected, we will register these by two different

Modified: 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java?rev=1728392&r1=1728391&r2=1728392&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
 Wed Feb  3 23:56:06 2016
@@ -21,7 +21,6 @@ package org.apache.axis2.jaxws.server.di
 
 import org.apache.axis2.Constants;
 import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.context.listener.ContextListenerUtils;
 import org.apache.axis2.jaxws.context.utils.ContextUtils;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.core.util.MessageContextUtils;
@@ -307,8 +306,6 @@ public class ProviderDispatcher extends
                     }
                 }
                 if (providerType.equals(OMElement.class)) {
-                    //Register the ContextListener for performance.
-                    ContextListenerUtils.registerProviderOMListener(request);
                     // TODO avoid call to message.getValue due to
                     // current unnecessary message transformation in
                     // message.getValue.  Once message.getValue is fixed,

Modified: 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?rev=1728392&r1=1728391&r2=1728392&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
 Wed Feb  3 23:56:06 2016
@@ -52,7 +52,6 @@ import org.apache.axis2.jaxws.client.Pro
 import org.apache.axis2.jaxws.client.dispatch.JAXBDispatch;
 import org.apache.axis2.jaxws.client.dispatch.XMLDispatch;
 import org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler;
-import org.apache.axis2.jaxws.context.listener.ProviderOMContextListener;
 import org.apache.axis2.jaxws.description.DescriptionFactory;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.ServiceDescription;
@@ -335,13 +334,6 @@ public class ServiceDelegate extends jav
 
         if (serviceClient == null)
             serviceClient = getServiceClient(endpointDesc.getPortQName());
-        
-        if(type == OMElement.class) {
-            if (log.isDebugEnabled()) {
-                log.debug("This a Dispatch<OMElement>. The custom builder is 
installed.");
-            }
-            
ProviderOMContextListener.create(serviceClient.getServiceContext());
-        }
 
         dispatch.setServiceClient(serviceClient);
         dispatch.setType(type);
@@ -445,12 +437,6 @@ public class ServiceDelegate extends jav
         if (serviceClient == null)
             serviceClient = getServiceClient(portName);
 
-        if(type == OMElement.class) {
-            if (log.isDebugEnabled()) {
-                log.debug("This a Dispatch<OMElement>. The custom builder is 
installed.");
-            }
-            
ProviderOMContextListener.create(serviceClient.getServiceContext());
-        }
         dispatch.setServiceClient(serviceClient);
         dispatch.setType(type);
         return dispatch;


Reply via email to