You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by he...@apache.org on 2005/02/10 08:01:21 UTC
svn commit: r153183 [1/2] - in
webservices/axis/trunk/java/dev/scratch/prototype2/src:
java/org/apache/axis/clientapi/ java/org/apache/axis/deployment/
java/org/apache/axis/deployment/listener/
java/org/apache/axis/deployment/repository/utill/
java/org/apache/axis/description/ java/org/apache/axis/encoding/
java/org/apache/axis/om/impl/llom/ java/org/apache/axis/om/impl/llom/builder/
java/org/apache/axis/om/impl/llom/serialize/
java/org/apache/axis/om/impl/llom/util/ java/org/apache/axis/providers/
samples/encoding/sample1/src/ samples/encoding/sample1/src/org/
test/org/apache/axis/description/ test/org/apache/axis/encoding/
test/org/apache/axis/engine/ test/org/apache/axis/integration/
test/org/apache/axis/om/builder/ test/org/apache/axis/om/builder/dummy/
test/org/apache/axis/testUtils/
Author: hemapani
Date: Wed Feb 9 23:01:07 2005
New Revision: 153183
URL: http://svn.apache.org/viewcvs?view=rev&rev=153183
Log:
initial refactoring of the code accroding to the IRC chat
Added:
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoImpl.java (with props)
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoProvider.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStruct.java (with props)
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStructEncoder.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadIncreaseTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/Sampler.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ArrayTypeEncoder.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/Encoder.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ObjectToOMBuilder.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleJavaProvider.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncoder.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncodingUtils.java
Removed:
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/builder/ObjectToOMBuilder.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/util/
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/providers/SimpleJavaProvider.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/org/
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Call.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Correlator.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Invoker.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/listener/RepositoryListenerImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/UnZipJAR.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/WSInfoList.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisGlobal.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisTransport.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/FlowImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/HandlerMetaData.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesInclude.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesIncludeImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/SimpleAxisOperationImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/OMElementImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/description/RegistryTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/encoding/EncodingTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/EchoTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Call.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Call.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Call.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Call.java Wed Feb 9 23:01:07 2005
@@ -1,5 +1,10 @@
package org.apache.axis.clientapi;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.MessageContext;
import org.apache.axis.description.AxisGlobal;
@@ -12,11 +17,6 @@
import org.apache.axis.om.SOAPEnvelope;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Correlator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Correlator.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Correlator.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Correlator.java Wed Feb 9 23:01:07 2005
@@ -1,6 +1,5 @@
package org.apache.axis.clientapi;
-import java.util.Hashtable;
import java.util.HashMap;
/**
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Invoker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Invoker.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Invoker.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/clientapi/Invoker.java Wed Feb 9 23:01:07 2005
@@ -11,13 +11,13 @@
* governing permissions and limitations under the License.
*/
-import org.apache.axis.context.MessageContext;
-import org.apache.axis.engine.AxisEngine;
-import org.apache.axis.engine.EngineRegistry;
-
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
+
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.engine.AxisEngine;
+import org.apache.axis.engine.EngineRegistry;
public class Invoker extends AbstractCall implements Runnable {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java Wed Feb 9 23:01:07 2005
@@ -1,5 +1,21 @@
package org.apache.axis.deployment;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
import org.apache.axis.deployment.repository.utill.HDFileItem;
import org.apache.axis.deployment.repository.utill.UnZipJAR;
import org.apache.axis.deployment.repository.utill.WSInfo;
@@ -20,17 +36,6 @@
import org.apache.axis.phaseresolver.PhaseResolver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Iterator;
-import java.util.Vector;
-import java.util.ArrayList;
-import java.util.List;
/**
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/listener/RepositoryListenerImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/listener/RepositoryListenerImpl.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/listener/RepositoryListenerImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/listener/RepositoryListenerImpl.java Wed Feb 9 23:01:07 2005
@@ -1,13 +1,12 @@
package org.apache.axis.deployment.listener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.axis.deployment.DeploymentConstants;
import org.apache.axis.deployment.DeploymentEngine;
import org.apache.axis.deployment.repository.utill.WSInfoList;
-
-import java.io.File;
-import java.util.Vector;
-import java.util.List;
-import java.util.ArrayList;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/UnZipJAR.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/UnZipJAR.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/UnZipJAR.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/UnZipJAR.java Wed Feb 9 23:01:07 2005
@@ -16,16 +16,16 @@
* limitations under the License.
*/
+import java.io.FileInputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
import org.apache.axis.deployment.DeploymentConstants;
import org.apache.axis.deployment.DeploymentEngine;
import org.apache.axis.deployment.DeploymentException;
import org.apache.axis.deployment.DeploymentParser;
import org.apache.axis.description.AxisModule;
import org.apache.axis.description.AxisService;
-
-import java.io.FileInputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
public class UnZipJAR implements DeploymentConstants {
//final int BUFFER = 2048;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/WSInfoList.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/WSInfoList.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/WSInfoList.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/repository/utill/WSInfoList.java Wed Feb 9 23:01:07 2005
@@ -1,13 +1,12 @@
package org.apache.axis.deployment.repository.utill;
-import org.apache.axis.deployment.DeploymentConstants;
-import org.apache.axis.deployment.DeploymentEngine;
-
import java.io.File;
+import java.util.ArrayList;
import java.util.Iterator;
-import java.util.Vector;
import java.util.List;
-import java.util.ArrayList;
+
+import org.apache.axis.deployment.DeploymentConstants;
+import org.apache.axis.deployment.DeploymentEngine;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisGlobal.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisGlobal.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisGlobal.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisGlobal.java Wed Feb 9 23:01:07 2005
@@ -15,12 +15,13 @@
*/
package org.apache.axis.description;
-import org.apache.axis.engine.AxisFault;
-
-import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.engine.AxisFault;
/**
* <p>This holds the information shown in the global scope. The information are all
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisTransport.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisTransport.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisTransport.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/AxisTransport.java Wed Feb 9 23:01:07 2005
@@ -15,10 +15,11 @@
*/
package org.apache.axis.description;
-import org.apache.axis.engine.AxisFault;
+import java.util.ArrayList;
import javax.xml.namespace.QName;
-import java.util.ArrayList;
+
+import org.apache.axis.engine.AxisFault;
/**
* Represents a transport deployed in AXis2
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/FlowImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/FlowImpl.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/FlowImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/FlowImpl.java Wed Feb 9 23:01:07 2005
@@ -17,9 +17,8 @@
package org.apache.axis.description;
-import java.util.Vector;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
public class FlowImpl implements Flow {
protected List list;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/HandlerMetaData.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/HandlerMetaData.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/HandlerMetaData.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/HandlerMetaData.java Wed Feb 9 23:01:07 2005
@@ -15,9 +15,9 @@
*/
package org.apache.axis.description;
-import org.apache.axis.engine.Handler;
-
import javax.xml.namespace.QName;
+
+import org.apache.axis.engine.Handler;
/**
* represent the deployment information about the handler
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesInclude.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesInclude.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesInclude.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesInclude.java Wed Feb 9 23:01:07 2005
@@ -15,9 +15,9 @@
*/
package org.apache.axis.description;
-import org.apache.axis.engine.AxisFault;
-
import java.util.ArrayList;
+
+import org.apache.axis.engine.AxisFault;
public interface PhasesInclude {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesIncludeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesIncludeImpl.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesIncludeImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/PhasesIncludeImpl.java Wed Feb 9 23:01:07 2005
@@ -15,10 +15,10 @@
*/
package org.apache.axis.description;
+import java.util.ArrayList;
+
import org.apache.axis.engine.AxisFault;
import org.apache.axis.engine.EngineRegistry;
-
-import java.util.ArrayList;
/**
* Util class to implements the Phases include with delegation
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/SimpleAxisOperationImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/SimpleAxisOperationImpl.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/SimpleAxisOperationImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/description/SimpleAxisOperationImpl.java Wed Feb 9 23:01:07 2005
@@ -15,15 +15,16 @@
*/
package org.apache.axis.description;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
import org.apache.wsdl.MessageReference;
import org.apache.wsdl.WSDLFeature;
import org.apache.wsdl.WSDLOperation;
import org.apache.wsdl.WSDLProperty;
import org.apache.wsdl.impl.WSDLOperationImpl;
-
-import javax.xml.namespace.QName;
-import java.util.HashMap;
-import java.util.List;
public class SimpleAxisOperationImpl implements AxisOperation {
protected WSDLOperation wsdlOperation;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/OMElementImpl.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/OMElementImpl.java Wed Feb 9 23:01:07 2005
@@ -17,10 +17,10 @@
import org.apache.axis.om.OMNode;
import org.apache.axis.om.OMText;
import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
import org.apache.axis.om.impl.llom.serialize.StreamingOMSerializer;
import org.apache.axis.om.impl.llom.traverse.OMChildrenIterator;
import org.apache.axis.om.impl.llom.traverse.OMChildrenQNameIterator;
-import org.apache.axis.om.impl.llom.util.StreamWriterToContentHandlerConverter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,124 @@
+package org.apache.axis.om.impl.llom.serialize;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public class StreamWriterToContentHandlerConverter implements ContentHandler {
+ private Log log = LogFactory.getLog(getClass());
+ private XMLStreamWriter writer;
+
+ public StreamWriterToContentHandlerConverter(XMLStreamWriter writer) {
+ this.writer = writer;
+ }
+
+ public void endDocument() throws SAXException {
+ //do nothing
+ }
+
+ public void startDocument() throws SAXException {
+ //
+ }
+
+ public void characters(char ch[], int start, int length) throws SAXException {
+ try {
+ writer.writeCharacters(ch, start, length);
+ } catch (XMLStreamException e) {
+ throw new SAXException(e);
+ }
+ }
+
+ public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
+ //throw new UnsupportedOperationException();
+ }
+
+ public void endPrefixMapping(String prefix) throws SAXException {
+ //throw new UnsupportedOperationException();
+ }
+
+ public void skippedEntity(String name) throws SAXException {
+ //throw new UnsupportedOperationException();
+ }
+
+ public void setDocumentLocator(Locator locator) {
+ //throw new UnsupportedOperationException();
+ }
+
+ public void processingInstruction(String target, String data) throws SAXException {
+ // throw new UnsupportedOperationException();
+ }
+
+ public void startPrefixMapping(String prefix, String uri) throws SAXException {
+ try {
+ writer.writeNamespace(prefix,uri);
+ writer.setPrefix(prefix,uri);
+ } catch (XMLStreamException e) {
+ throw new SAXException(e);
+ }
+ }
+
+ public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
+ try {
+ writer.writeEndElement();
+ } catch (XMLStreamException e) {
+ throw new SAXException(e);
+ }
+ }
+
+ private String getPrefix(String qName){
+ if (qName!=null){
+ return qName.substring(0,qName.indexOf(":"));
+ }
+ return null;
+ }
+
+
+
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
+ try {
+ log.info("writing element {"+namespaceURI+'}'+ localName +" directly to stream ");
+
+ String prefix = getPrefix(qName);
+ //it is only the prefix we want to learn from the QName! so we can get rid of the
+ //spliting QName
+ if (prefix ==null){
+ writer.writeStartElement(namespaceURI,localName);
+ }else{
+ writer.writeStartElement(prefix,localName,namespaceURI);
+ }
+ if (atts!=null){
+ int attCount = atts.getLength();
+ for (int i = 0; i < attCount; i++) {
+
+ writer.writeAttribute(atts.getURI(i),
+ localName,
+ atts.getValue(i));
+ }
+ }
+ } catch (XMLStreamException e) {
+ throw new SAXException(e);
+ }
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoImpl.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoImpl.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoImpl.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,24 @@
+/**
+ * Echo.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.2RC1 Sep 29, 2004 (08:29:40 EDT) WSDL2Java emitter.
+ */
+
+public class EchoImpl {
+ public EchoImpl(){}
+ public java.lang.String echoString(java.lang.String in) {
+ return in;
+ }
+ public java.lang.String[] echoStringArray(java.lang.String[] in) {
+ return in;
+ }
+ public EchoStruct echoEchoStruct(
+ EchoStruct in) {
+ return in;
+ }
+ public EchoStruct[] echoEchoStructArray(
+ EchoStruct[] in) {
+ return in;
+ }
+}
Propchange: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoImpl.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoProvider.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoProvider.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoProvider.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,166 @@
+/*
+ * Created on Jan 29, 2005
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+import java.lang.reflect.Method;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.description.AxisOperation;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.testUtils.ArrayTypeEncoder;
+import org.apache.axis.testUtils.Encoder;
+import org.apache.axis.testUtils.ObjectToOMBuilder;
+import org.apache.axis.testUtils.SimpleJavaProvider;
+import org.apache.axis.testUtils.SimpleTypeEncoder;
+import org.apache.axis.testUtils.SimpleTypeEncodingUtils;
+
+public class EchoProvider extends SimpleJavaProvider {
+
+ public Object[] deserializeParameters(
+ MessageContext msgContext,
+ Method method)
+ throws AxisFault {
+ // org.TimeRecorder.BEFORE_DESERALIZE = System.currentTimeMillis();
+ XMLStreamReader xpp =
+ msgContext.getSoapOperationElement().getPullParser(true);
+ Class[] parms = method.getParameterTypes();
+ Object[] objs = new Object[parms.length];
+
+ try {
+ int event = xpp.next();
+ while (XMLStreamConstants.START_ELEMENT != event
+ && XMLStreamConstants.END_ELEMENT != event) {
+ event = xpp.next();
+ }
+ //now we are at the opearion element event
+ event = xpp.next();
+ while (XMLStreamConstants.START_ELEMENT != event
+ && XMLStreamConstants.END_ELEMENT != event) {
+ event = xpp.next();
+ }
+ // now we are at the parameter element event
+
+ if (XMLStreamConstants.END_ELEMENT == event) {
+ return null;
+ } else {
+ for (int i = 0; i < parms.length; i++) {
+ if (int.class.equals(parms[i])) {
+ objs[i] =
+ new Integer(
+ SimpleTypeEncodingUtils.deserializeInt(xpp));
+ } else if (String.class.equals(parms[i])) {
+ objs[i] =
+ SimpleTypeEncodingUtils.deserializeString(xpp);
+ } else if (String[].class.equals(parms[i])) {
+ objs[i] =
+ SimpleTypeEncodingUtils.deserializeStringArray(xpp);
+ } else if (EchoStruct.class.equals(parms[i])) {
+ Encoder en = new EchoStructEncoder(null);
+ objs[i] = en.deSerialize(xpp);
+ } else if (EchoStruct[].class.equals(parms[i])) {
+ Encoder encoder = new ArrayTypeEncoder(new EchoStructEncoder(null));
+ objs[i] = encoder.deSerialize(xpp);
+ } else {
+ throw new UnsupportedOperationException("Only int,String and String[] is supported yet");
+ }
+ }
+ return objs;
+
+ }
+ } catch (Exception e) {
+ throw new AxisFault("Exception",e);
+ }
+ }
+
+ public MessageContext invoke(MessageContext msgContext) throws AxisFault {
+ try {
+ //get the implementation class for the Web Service
+ Object obj = getTheImplementationObject(msgContext);
+
+ //find the WebService method
+ Class ImplClass = obj.getClass();
+ AxisOperation op = msgContext.getOperation();
+ String methodName = op.getName().getLocalPart();
+
+
+ Method[] methods = ImplClass.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals(methodName)) {
+ this.method = methods[i];
+ break;
+ }
+ }
+ //deserialize (XML-> java)
+ Object[] parms = deserializeParameters(msgContext, method);
+ //invoke the WebService
+
+ EchoImpl echo = (EchoImpl)obj;
+ Object result = null;
+ if("echoEchoStruct".equals(methodName)) {
+ result = echo.echoEchoStruct((EchoStruct)parms[0]);
+ }else if ("echoString".equals(methodName)) {
+ result = echo.echoString((String)parms[0]);
+ }else if ("echoStringArray".equals(methodName)) {
+ result = echo.echoStringArray((String[])parms[0]);
+ }else if ("echoEchoStructArray".equals(methodName)) {
+ Object[] parmsIn = (Object[])parms[0];
+ EchoStruct[] structs = new EchoStruct[parmsIn.length];
+ for (int i = 0; i < structs.length; i++) {
+ structs[i] = (EchoStruct) parmsIn[i];
+
+ }
+ result = echo.echoEchoStructArray(structs);
+ }
+ Encoder outobj = null;
+
+ if (result instanceof String || result instanceof String[]) {
+ outobj = new SimpleTypeEncoder(result);
+ } else if (result instanceof EchoStruct) {
+ outobj = new EchoStructEncoder((EchoStruct) result);
+ } else if (result instanceof EchoStruct[]) {
+ outobj =
+ new ArrayTypeEncoder(
+ (EchoStruct[]) result,
+ new EchoStructEncoder(null));
+ }
+
+ OMFactory fac = OMFactory.newInstance();
+ SOAPEnvelope responseEnvelope = fac.getDefaultEnvelope();
+
+ OMNamespace ns = fac.createOMNamespace("http://soapenc/", "res");
+ OMElement responseMethodName =
+ fac.createOMElement(methodName + "Response", ns);
+ responseEnvelope.getBody().addChild(responseMethodName);
+ OMElement returnelement =
+ fac.createOMElement(methodName + "Return", ns);
+ responseMethodName.addChild(returnelement);
+ returnelement.setBuilder(
+ new ObjectToOMBuilder(returnelement, outobj));
+ returnelement.declareNamespace(
+ OMConstants.ARRAY_ITEM_NSURI,
+ "arrays");
+ returnelement.declareNamespace(
+ "http://axis.apache.org",
+ "s");
+
+ msgContext.setEnvelope(responseEnvelope);
+
+ return msgContext;
+ } catch (SecurityException e) {
+ throw AxisFault.makeFault(e);
+ } catch (IllegalArgumentException e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStruct.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStruct.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStruct.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStruct.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,317 @@
+/**
+ * EchoStruct.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.2RC1 Sep 29, 2004 (08:29:40 EDT) WSDL2Java emitter.
+ */
+
+public class EchoStruct implements java.io.Serializable {
+ private java.lang.String value1;
+ private java.lang.String value10;
+ private java.lang.String value11;
+ private java.lang.String value12;
+ private java.lang.String value13;
+ private java.lang.String value2;
+ private int value3;
+ private java.lang.String value4;
+ private java.lang.String value5;
+ private java.lang.String value6;
+ private java.lang.String value7;
+ private java.lang.String value8;
+ private java.lang.String value9;
+
+ public EchoStruct() {
+ }
+
+ public EchoStruct(
+ java.lang.String value1,
+ java.lang.String value10,
+ java.lang.String value11,
+ java.lang.String value12,
+ java.lang.String value13,
+ java.lang.String value2,
+ int value3,
+ java.lang.String value4,
+ java.lang.String value5,
+ java.lang.String value6,
+ java.lang.String value7,
+ java.lang.String value8,
+ java.lang.String value9) {
+ this.value1 = value1;
+ this.value10 = value10;
+ this.value11 = value11;
+ this.value12 = value12;
+ this.value13 = value13;
+ this.value2 = value2;
+ this.value3 = value3;
+ this.value4 = value4;
+ this.value5 = value5;
+ this.value6 = value6;
+ this.value7 = value7;
+ this.value8 = value8;
+ this.value9 = value9;
+ }
+
+ /**
+ * Gets the value1 value for this EchoStruct.
+ *
+ * @return value1
+ */
+ public java.lang.String getValue1() {
+ return value1;
+ }
+
+ /**
+ * Sets the value1 value for this EchoStruct.
+ *
+ * @param value1
+ */
+ public void setValue1(java.lang.String value1) {
+ this.value1 = value1;
+ }
+
+ /**
+ * Gets the value10 value for this EchoStruct.
+ *
+ * @return value10
+ */
+ public java.lang.String getValue10() {
+ return value10;
+ }
+
+ /**
+ * Sets the value10 value for this EchoStruct.
+ *
+ * @param value10
+ */
+ public void setValue10(java.lang.String value10) {
+ this.value10 = value10;
+ }
+
+ /**
+ * Gets the value11 value for this EchoStruct.
+ *
+ * @return value11
+ */
+ public java.lang.String getValue11() {
+ return value11;
+ }
+
+ /**
+ * Sets the value11 value for this EchoStruct.
+ *
+ * @param value11
+ */
+ public void setValue11(java.lang.String value11) {
+ this.value11 = value11;
+ }
+
+ /**
+ * Gets the value12 value for this EchoStruct.
+ *
+ * @return value12
+ */
+ public java.lang.String getValue12() {
+ return value12;
+ }
+
+ /**
+ * Sets the value12 value for this EchoStruct.
+ *
+ * @param value12
+ */
+ public void setValue12(java.lang.String value12) {
+ this.value12 = value12;
+ }
+
+ /**
+ * Gets the value13 value for this EchoStruct.
+ *
+ * @return value13
+ */
+ public java.lang.String getValue13() {
+ return value13;
+ }
+
+ /**
+ * Sets the value13 value for this EchoStruct.
+ *
+ * @param value13
+ */
+ public void setValue13(java.lang.String value13) {
+ this.value13 = value13;
+ }
+
+ /**
+ * Gets the value2 value for this EchoStruct.
+ *
+ * @return value2
+ */
+ public java.lang.String getValue2() {
+ return value2;
+ }
+
+ /**
+ * Sets the value2 value for this EchoStruct.
+ *
+ * @param value2
+ */
+ public void setValue2(java.lang.String value2) {
+ this.value2 = value2;
+ }
+
+ /**
+ * Gets the value3 value for this EchoStruct.
+ *
+ * @return value3
+ */
+ public int getValue3() {
+ return value3;
+ }
+
+ /**
+ * Sets the value3 value for this EchoStruct.
+ *
+ * @param value3
+ */
+ public void setValue3(int value3) {
+ this.value3 = value3;
+ }
+
+ /**
+ * Gets the value4 value for this EchoStruct.
+ *
+ * @return value4
+ */
+ public java.lang.String getValue4() {
+ return value4;
+ }
+
+ /**
+ * Sets the value4 value for this EchoStruct.
+ *
+ * @param value4
+ */
+ public void setValue4(java.lang.String value4) {
+ this.value4 = value4;
+ }
+
+ /**
+ * Gets the value5 value for this EchoStruct.
+ *
+ * @return value5
+ */
+ public java.lang.String getValue5() {
+ return value5;
+ }
+
+ /**
+ * Sets the value5 value for this EchoStruct.
+ *
+ * @param value5
+ */
+ public void setValue5(java.lang.String value5) {
+ this.value5 = value5;
+ }
+
+ /**
+ * Gets the value6 value for this EchoStruct.
+ *
+ * @return value6
+ */
+ public java.lang.String getValue6() {
+ return value6;
+ }
+
+ /**
+ * Sets the value6 value for this EchoStruct.
+ *
+ * @param value6
+ */
+ public void setValue6(java.lang.String value6) {
+ this.value6 = value6;
+ }
+
+ /**
+ * Gets the value7 value for this EchoStruct.
+ *
+ * @return value7
+ */
+ public java.lang.String getValue7() {
+ return value7;
+ }
+
+ /**
+ * Sets the value7 value for this EchoStruct.
+ *
+ * @param value7
+ */
+ public void setValue7(java.lang.String value7) {
+ this.value7 = value7;
+ }
+
+ /**
+ * Gets the value8 value for this EchoStruct.
+ *
+ * @return value8
+ */
+ public java.lang.String getValue8() {
+ return value8;
+ }
+
+ /**
+ * Sets the value8 value for this EchoStruct.
+ *
+ * @param value8
+ */
+ public void setValue8(java.lang.String value8) {
+ this.value8 = value8;
+ }
+
+ /**
+ * Gets the value9 value for this EchoStruct.
+ *
+ * @return value9
+ */
+ public java.lang.String getValue9() {
+ return value9;
+ }
+
+ /**
+ * Sets the value9 value for this EchoStruct.
+ *
+ * @param value9
+ */
+ public void setValue9(java.lang.String value9) {
+ this.value9 = value9;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof EchoStruct) {
+ EchoStruct val = (EchoStruct) obj;
+ if (value1.equals(val.value1)
+ && value2.equals(val.value2)
+ && (value3 == val.value3)
+ && value4.equals(val.value4)
+ && value5.equals(val.value5)
+ && value6.equals(val.value6)
+ && value7.equals(val.value7)
+ && value8.equals(val.value8)
+ && value9.equals(val.value9)
+ && value10.equals(val.value10)
+ && value11.equals(val.value11)
+ && value12.equals(val.value12)
+ && value13.equals(val.value13)) {
+ return true;
+
+
+ }
+
+ }
+ return false;
+
+ }
+}
Propchange: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStruct.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStructEncoder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStructEncoder.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStructEncoder.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/EchoStructEncoder.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,362 @@
+/*
+ * Created on Jan 29, 2005
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+import java.io.IOException;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMException;
+import org.apache.axis.testUtils.Encoder;
+import org.apache.axis.testUtils.SimpleTypeEncodingUtils;
+import org.xml.sax.ContentHandler;
+
+public class EchoStructEncoder implements Encoder {
+
+ private static final int VALUE1 = -823812896;
+ private static final int VALUE2 = -823812895;
+ private static final int VALUE3 = -823812894;
+ private static final int VALUE4 = -823812893;
+ private static final int VALUE5 = -823812892;
+ private static final int VALUE6 = -823812891;
+ private static final int VALUE7 = -823812890;
+ private static final int VALUE8 = -823812889;
+ private static final int VALUE9 = -823812888;
+ private static final int VALUE10 = 231604048;
+ private static final int VALUE11 = 231604049;
+ private static final int VALUE12 = 231604050;
+ private static final int VALUE13 = 231604051;
+
+ private ContentHandler contentHandler;
+ private EchoStruct struct;
+
+
+ public EchoStructEncoder() {
+ }
+
+ public EchoStructEncoder(EchoStruct struct) {
+ this.struct = struct;
+ }
+
+ public Object deSerialize(XMLStreamReader xpp) throws AxisFault {
+ EchoStruct struct = new EchoStruct();
+
+ try {
+ int event = xpp.next();
+ while (true) {
+ if (XMLStreamConstants.START_ELEMENT == event) {
+ String localName = xpp.getLocalName();
+ int nameCode = localName.hashCode();
+ switch (nameCode) {
+ case VALUE1 :
+ struct.setValue1(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE2 :
+ struct.setValue2(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE3 :
+ struct.setValue3(
+ SimpleTypeEncodingUtils.deserializeInt(xpp));
+ break;
+ case VALUE4 :
+ struct.setValue4(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE5 :
+ struct.setValue5(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE6 :
+ struct.setValue6(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE7 :
+ struct.setValue7(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE8 :
+ struct.setValue8(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE9 :
+ struct.setValue9(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE10 :
+ struct.setValue10(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE11 :
+ struct.setValue11(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE12 :
+ struct.setValue12(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ case VALUE13 :
+ struct.setValue13(
+ SimpleTypeEncodingUtils.deserializeString(xpp));
+ break;
+ default:
+ throw new AxisFault("Unknown elemnt "+ localName);
+ }
+ }
+ if (XMLStreamConstants.END_ELEMENT == event) {
+ break;
+ }
+ if (XMLStreamConstants.END_DOCUMENT == event) {
+ throw new AxisFault("premature and of file");
+ }
+ event = xpp.next();
+ }
+
+ return struct;
+ } catch (XMLStreamException e) {
+ throw AxisFault.makeFault(e);
+ }
+
+ }
+
+ public void serialize(XMLStreamWriter writer)
+ throws IOException, XMLStreamException {
+ writer.writeStartElement("value1");
+
+ writer.writeEndElement();
+ }
+
+ public void serialize(ContentHandler contentHandler)
+ throws OMException {
+ if (contentHandler == null) {
+ throw new OMException("Please set the content Handler");
+ }
+ try {
+ String value = "value1";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value1",
+ null);
+ String strVal = struct.getValue1();
+ char[] str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value1");
+
+ value = "value2";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value2",
+ null);
+ strVal = struct.getValue2();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value2");
+
+ value = "value3";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value3",
+ null);
+ int intVal = struct.getValue3();
+ str = String.valueOf(intVal).toCharArray();
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value3");
+
+ value = "value4";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value4",
+ null);
+ strVal = struct.getValue4();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value4");
+
+ value = "value5";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value5",
+ null);
+ strVal = struct.getValue5();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value5");
+
+ value = "value6";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value6",
+ null);
+ strVal = struct.getValue6();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value6");
+
+ value = "value7";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value7",
+ null);
+ strVal = struct.getValue7();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value7");
+
+ value = "value8";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value8",
+ null);
+ strVal = struct.getValue8();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value8");
+
+ value = "value9";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value9",
+ null);
+ strVal = struct.getValue9();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value9");
+
+ value = "value10";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value10",
+ null);
+ strVal = struct.getValue10();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value10");
+
+ value = "value11";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value11",
+ null);
+ strVal = struct.getValue11();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value11");
+
+ value = "value12";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value12",
+ null);
+ strVal = struct.getValue12();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value12");
+
+ value = "value13";
+ contentHandler.startElement(
+ "http://axis.apache.org",
+ value,
+ "s:value13",
+ null);
+ strVal = struct.getValue13();
+ str = ((strVal == null) ? new char[] {
+ }
+ : strVal.toCharArray());
+ contentHandler.characters(str, 0, str.length);
+ contentHandler.endElement(
+ "http://axis.apache.org",
+ value,
+ "s:value13");
+
+ } catch (Exception e) {
+ throw new OMException(e);
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis.encoding.Encoder#setObject(java.lang.Object)
+ */
+ public void setObject(Object obj) {
+ this.struct = (EchoStruct) obj;
+
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadIncreaseTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadIncreaseTest.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadIncreaseTest.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadIncreaseTest.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,30 @@
+/*
+ * Created on Feb 9, 2005
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+/**
+ * @author hemapani
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class LoadIncreaseTest {
+ public static void main(String[] args) {
+ int count = 0;
+ while(true) {
+ count = count + 1000;
+ System.out.print("Invoke ="+ count + " |");
+
+ Sampler sampler = new Sampler(count);
+ try {
+ sampler.invokeService();
+ } catch (Exception e) {
+ System.out.println("Failed at the size " + count);
+ e.printStackTrace();
+ break;
+ }
+ }
+ }
+}
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadTest.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadTest.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/LoadTest.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,48 @@
+/*
+ * Created on Feb 9, 2005
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+/**
+ * @author hemapani
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class LoadTest implements Runnable {
+ private int sizeOfArray = 10;
+ private int numberOfRequests = 100;
+ private int no;
+
+ public LoadTest(int no){
+ this.no = no;
+ }
+
+ public static void main(String[] args) {
+ for (int i = 0; i < 100; i++) {
+ System.out.println("Thread "+i+ " started");
+ Thread thread = new Thread(new LoadTest(i));
+ thread.start();
+ }
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+
+ for (int i = 0; i < numberOfRequests; i++) {
+
+ try {
+ Sampler sampler = new Sampler(sizeOfArray);
+ sampler.invokeService();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+
+ }
+ System.out.println("Thread "+no+ " stop");
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/Sampler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/Sampler.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/Sampler.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample1/src/Sampler.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,114 @@
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.Call;
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.SOAPBody;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.testUtils.ArrayTypeEncoder;
+import org.apache.axis.testUtils.ObjectToOMBuilder;
+
+public class Sampler {
+ private int count;
+ public Sampler(int count){
+ this.count = count;
+ }
+
+
+ public void invokeService() throws Exception {
+ long start = System.currentTimeMillis();
+ OMFactory fac = OMFactory.newInstance();
+ OMNamespace ns =
+ fac.createOMNamespace(
+ "http://apache.ws.apache.org/samples",
+ "samples");
+ OMNamespace arrayNs =
+ fac.createOMNamespace(
+ OMConstants.ARRAY_ITEM_NSURI,
+ OMConstants.ARRAY_ITEM_NS_PREFIX);
+ OMNamespace targetNs =
+ fac.createOMNamespace("http://axis.apache.org", "s");
+
+ EchoStruct[] objs = new EchoStruct[count];
+
+ for (int i = 0; i < objs.length; i++) {
+ objs[i] = new EchoStruct();
+ objs[i].setValue1("Ruy Lopez"+i);
+ objs[i].setValue2("Kings Gambit"+i);
+ objs[i].setValue3(345);
+ objs[i].setValue4("Kings Indian Defence"+i);
+ objs[i].setValue5("Musio Gambit"+i);
+ objs[i].setValue6("Benko Gambit"+i);
+ objs[i].setValue7("Secillian Defance"+i);
+ objs[i].setValue8("Queens Gambit"+i);
+ objs[i].setValue9("Queens Indian Defense"+i);
+ objs[i].setValue10("Alekine's Defense"+i);
+ objs[i].setValue11("Perc Defense"+i);
+ objs[i].setValue12("Scotch Gambit");
+ objs[i].setValue13("English Opening"+i);
+ }
+
+ OMElement returnelement = fac.createOMElement("param1", ns);
+ EchoStructEncoder encoder = new EchoStructEncoder();
+ ArrayTypeEncoder arrayEncoder = new ArrayTypeEncoder(objs, encoder);
+
+ ObjectToOMBuilder builder =
+ new ObjectToOMBuilder(returnelement, arrayEncoder);
+
+ returnelement.setBuilder(builder);
+ returnelement.declareNamespace(arrayNs);
+ returnelement.declareNamespace(targetNs);
+
+ SOAPEnvelope envelope = fac.getDefaultEnvelope();
+ OMElement responseMethodName =
+ fac.createOMElement("echoEchoStructArray", ns);
+ envelope.getBody().addChild(responseMethodName);
+ responseMethodName.addChild(returnelement);
+
+ EndpointReference targetEPR =
+ new EndpointReference(
+ AddressingConstants.WSA_TO,
+ "http://127.0.0.1:8080/axis2/services/echo");
+ Call call = new Call();
+ call.setTo(targetEPR);
+ SOAPEnvelope responseEnv = call.sendReceive(envelope);
+
+ SOAPBody body = responseEnv.getBody();
+ if (body.hasFault()) {
+ throw body.getFault().getException();
+ }
+ XMLStreamReader xpp = body.getPullParser(true);
+
+ int event = xpp.next();
+ while (event != XMLStreamConstants.START_ELEMENT) {
+ event = xpp.next();
+ }
+ event = xpp.next();
+ while (event != XMLStreamConstants.START_ELEMENT) {
+ event = xpp.next();
+ }
+ event = xpp.next();
+ while (event != XMLStreamConstants.START_ELEMENT) {
+ event = xpp.next();
+ }
+
+ Object obj = arrayEncoder.deSerialize(xpp);
+ long end = System.currentTimeMillis();
+ Object[] structs = (Object[]) obj;
+
+ for (int i = 0; i < structs.length; i++) {
+ TestCase.assertTrue(structs[i].equals(objs[i]));
+
+ }
+
+ System.out.println(end -start);
+
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/description/RegistryTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/description/RegistryTest.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/description/RegistryTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/description/RegistryTest.java Wed Feb 9 23:01:07 2005
@@ -25,7 +25,7 @@
import org.apache.axis.engine.Handler;
import org.apache.axis.handlers.AbstractHandler;
import org.apache.axis.providers.RawXMLProvider;
-import org.apache.axis.providers.SimpleJavaProvider;
+import org.apache.axis.testUtils.SimpleJavaProvider;
public class RegistryTest extends AbstractTestCase{
private EngineRegistry reg;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/encoding/EncodingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/encoding/EncodingTest.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/encoding/EncodingTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/encoding/EncodingTest.java Wed Feb 9 23:01:07 2005
@@ -27,6 +27,7 @@
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMFactory;
import org.apache.axis.om.OMNamespace;
+import org.apache.axis.testUtils.SimpleTypeEncodingUtils;
public class EncodingTest extends AbstractTestCase {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java Wed Feb 9 23:01:07 2005
@@ -24,7 +24,7 @@
import org.apache.axis.description.AxisOperation;
import org.apache.axis.description.AxisService;
import org.apache.axis.description.SimpleAxisOperationImpl;
-import org.apache.axis.providers.SimpleJavaProvider;
+import org.apache.axis.testUtils.SimpleJavaProvider;
import org.apache.axis.transport.http.SimpleHTTPReceiver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java Wed Feb 9 23:01:07 2005
@@ -29,7 +29,7 @@
import org.apache.axis.description.HandlerMetaData;
import org.apache.axis.description.MockFlow;
import org.apache.axis.description.SimpleAxisOperationImpl;
-import org.apache.axis.providers.SimpleJavaProvider;
+import org.apache.axis.testUtils.SimpleJavaProvider;
import org.apache.axis.transport.http.SimpleHTTPReceiver;
public class EngineUtils {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java Wed Feb 9 23:01:07 2005
@@ -34,7 +34,7 @@
import org.apache.axis.description.MockFlow;
import org.apache.axis.description.SimpleAxisOperationImpl;
import org.apache.axis.integration.UtilServer;
-import org.apache.axis.providers.SimpleJavaProvider;
+import org.apache.axis.testUtils.SimpleJavaProvider;
import org.apache.axis.transport.http.SimpleHTTPReceiver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/EchoTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/EchoTest.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/EchoTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/EchoTest.java Wed Feb 9 23:01:07 2005
@@ -31,10 +31,6 @@
import org.apache.axis.addressing.AddressingConstants;
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.clientapi.Call;
-import org.apache.axis.encoding.ArrayTypeEncoder;
-import org.apache.axis.encoding.Encoder;
-import org.apache.axis.encoding.SimpleTypeEncoder;
-import org.apache.axis.encoding.SimpleTypeEncodingUtils;
import org.apache.axis.engine.EngineUtils;
import org.apache.axis.om.OMConstants;
import org.apache.axis.om.OMElement;
@@ -42,7 +38,11 @@
import org.apache.axis.om.OMNamespace;
import org.apache.axis.om.SOAPBody;
import org.apache.axis.om.SOAPEnvelope;
-import org.apache.axis.om.impl.llom.builder.ObjectToOMBuilder;
+import org.apache.axis.testUtils.ArrayTypeEncoder;
+import org.apache.axis.testUtils.Encoder;
+import org.apache.axis.testUtils.ObjectToOMBuilder;
+import org.apache.axis.testUtils.SimpleTypeEncoder;
+import org.apache.axis.testUtils.SimpleTypeEncodingUtils;
public class EchoTest extends TestCase {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java Wed Feb 9 23:01:07 2005
@@ -9,14 +9,14 @@
import junit.framework.TestCase;
-import org.apache.axis.encoding.Encoder;
import org.apache.axis.om.OMConstants;
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMFactory;
import org.apache.axis.om.OMNamespace;
import org.apache.axis.om.OMNode;
import org.apache.axis.om.builder.dummy.DummyOutObject;
-import org.apache.axis.om.impl.llom.builder.ObjectToOMBuilder;
+import org.apache.axis.testUtils.Encoder;
+import org.apache.axis.testUtils.ObjectToOMBuilder;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java?view=diff&r1=153182&r2=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java Wed Feb 9 23:01:07 2005
@@ -7,9 +7,9 @@
import javax.xml.parsers.SAXParserFactory;
import javax.xml.stream.XMLStreamReader;
-import org.apache.axis.encoding.Encoder;
import org.apache.axis.engine.AxisFault;
import org.apache.axis.om.OMException;
+import org.apache.axis.testUtils.Encoder;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ArrayTypeEncoder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ArrayTypeEncoder.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ArrayTypeEncoder.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ArrayTypeEncoder.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2003,2004 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.testUtils;
+
+import java.util.ArrayList;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis.engine.AxisFault;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMException;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+public class ArrayTypeEncoder implements Encoder{
+ private Object[] obj = null;
+ private Encoder arrayTypeEncoder;
+
+ public ArrayTypeEncoder(Object[] obj,Encoder arrayTypeEncoder){
+ this.obj = obj;
+ this.arrayTypeEncoder = arrayTypeEncoder;
+ }
+
+ public ArrayTypeEncoder(Encoder arrayTypeEncoder){
+ this.arrayTypeEncoder = arrayTypeEncoder;
+ }
+
+
+ public void serialize(ContentHandler cHandler) throws OMException {
+ try {
+ for(int i = 0;i<obj.length;i++){
+ cHandler.startElement(OMConstants.ARRAY_ITEM_NSURI,OMConstants.ARRAY_ITEM_LOCALNAME,OMConstants.ARRAY_ITEM_QNAME,null);
+ arrayTypeEncoder.setObject(obj[i]);
+ arrayTypeEncoder.serialize(cHandler);
+ cHandler.endElement(OMConstants.ARRAY_ITEM_NSURI,OMConstants.ARRAY_ITEM_LOCALNAME,OMConstants.ARRAY_ITEM_QNAME);
+ }
+ } catch (SAXException e) {
+ throw new OMException(e);
+ }
+
+ }
+
+ /**
+ * @return
+ */
+ public Encoder getArrayTypeEncoder() {
+ return arrayTypeEncoder;
+ }
+
+ /**
+ * @param encoder
+ */
+ public void setArrayTypeEncoder(Encoder encoder) {
+ arrayTypeEncoder = encoder;
+ }
+
+ public Object deSerialize(XMLStreamReader xpp) throws AxisFault {
+ ArrayList objs = new ArrayList();
+
+ try {
+ int event = xpp.next();
+ while (XMLStreamConstants.START_ELEMENT != event
+ && XMLStreamConstants.END_ELEMENT != event) {
+ event = xpp.next();
+ }
+ if (XMLStreamConstants.END_ELEMENT == event) {
+ return null;
+ }
+
+// event = xpp.next();
+ while (true) {
+ if (XMLStreamConstants.START_ELEMENT == event) {
+ objs.add(arrayTypeEncoder.deSerialize(xpp));
+ } else if (XMLStreamConstants.END_ELEMENT == event) {
+ break;
+ } else if (XMLStreamConstants.END_DOCUMENT == event) {
+ throw new AxisFault("premature and of file");
+ }
+ event = xpp.next();
+ }
+ Object[] vals = new Object[objs.size()];
+ for (int i = 0; i < objs.size(); i++) {
+ vals[i] = objs.get(i);
+ }
+ return vals;
+ } catch (XMLStreamException e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis.encoding.Encoder#setObject(java.lang.Object)
+ */
+ public void setObject(Object obj) {
+ this.obj = (Object[])obj;
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/Encoder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/Encoder.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/Encoder.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/Encoder.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2001-2004 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.testUtils;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMException;
+
+import org.xml.sax.ContentHandler;
+
+
+public interface Encoder{
+ public Object deSerialize(XMLStreamReader xpp)throws AxisFault;
+ public void setObject(Object obj);
+ public void serialize(ContentHandler contentHandler)throws OMException ;
+}
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ObjectToOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ObjectToOMBuilder.java?view=auto&rev=153183
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ObjectToOMBuilder.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/ObjectToOMBuilder.java Wed Feb 9 23:01:07 2005
@@ -0,0 +1,255 @@
+package org.apache.axis.testUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMText;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>`
+ */
+public class ObjectToOMBuilder implements OMXMLParserWrapper, ContentHandler {
+ private Log log = LogFactory.getLog(getClass());
+ private Encoder outObject;
+ private OMElement startElement;
+ private OMFactory omFactory;
+ private boolean buildStarted = false;
+ private boolean cache = true;
+ private ContentHandler externalContentHandler;
+
+ // ============= For content handler ============
+ private OMNode lastNode;
+ private List nameSpaces = new ArrayList();
+ // ==============================================
+
+
+ /**
+ * This external content handler is used to switch between the actual stream and the
+ * object bulding content handler
+ */
+
+ public ContentHandler getExternalContentHandler() {
+ return externalContentHandler;
+ }
+
+
+
+ /**
+ * @param startElement - this refers to the element the object should come under.
+ * Most of the time this will be a OMBodyBlock element
+ * @param outObject
+ */
+
+ public ObjectToOMBuilder(OMElement startElement, Encoder outObject) {
+ startElement.setComplete(false);
+ this.outObject = outObject;
+ this.startElement = startElement;
+ lastNode = startElement;
+ startElement.setBuilder(this);
+ omFactory = OMFactory.newInstance();
+ }
+
+ public int next() throws OMException {
+
+ // next can not be called more than once at one instance. and next can not be called within
+ // another next
+ synchronized (this) {
+ if (!buildStarted) {
+ buildStarted = true;
+ //if not to be cached then switch the contenthandler
+ if (!cache) {
+ if (externalContentHandler == null) {
+ throw new IllegalStateException("Cannot have no cache with an empty content handler");
+ }
+ outObject.serialize(externalContentHandler);
+ }else{
+ outObject.serialize(this);
+ }
+
+ this.startElement.setComplete(true);
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * This has no meaning in this context, as one will basically not be able to stop and build again.
+ * This is not useful for SAX event processing.
+ *
+ * @param el
+ * @throws OMException
+ */
+ public void discard(OMElement el) throws OMException {
+ throw new UnsupportedOperationException(); //TODO implement this
+ }
+
+ /**
+ * Caching will be accomplished by the content handler.
+ *
+ * @param b
+ * @throws OMException
+ */
+ public void setCache(boolean b) throws OMException {
+ if (!cache && b) {
+ throw new UnsupportedOperationException("cache cannot be reset once set");
+ }
+ cache = b;
+ }
+
+ public Object getParser() {
+ throw new UnsupportedOperationException(); //TODO implement this
+ }
+
+ public boolean isCompleted() {
+ throw new UnsupportedOperationException(); //TODO implement this
+ }
+
+ public OMElement getDocumentElement() {
+ throw new UnsupportedOperationException(); //TODO implement this
+ }
+
+ // ==================== ContentHandler Implementations ========================
+ public void endDocument() throws SAXException {
+ lastNode.setComplete(true);
+ }
+
+ public void startDocument() throws SAXException {
+ lastNode = this.startElement;
+ }
+
+ public void characters(char ch[], int start, int length) throws SAXException {
+ OMText text = omFactory.createText(null, (new StringBuffer().append(ch, start, length).toString()));
+ addNewNode(text, lastNode);
+ text.setComplete(true);
+ lastNode = text;
+ }
+
+ public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
+ }
+
+ public void endPrefixMapping(String prefix) throws SAXException {
+ }
+
+ public void skippedEntity(String name) throws SAXException {
+ }
+
+ public void setDocumentLocator(Locator locator) {
+ }
+
+ public void processingInstruction(String target, String data) throws SAXException {
+ }
+
+ public void startPrefixMapping(String prefix, String uri) throws SAXException {
+ nameSpaces.add(omFactory.createOMNamespace(uri, prefix));
+ }
+
+ public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
+ if (lastNode.isComplete()) {
+ OMElement parent = lastNode.getParent();
+ parent.setComplete(true);
+ lastNode = parent;
+ } else {
+ lastNode.setComplete(true);
+ }
+ }
+
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
+ log.info("Building OM for Element {"+namespaceURI+'}'+ localName +" for the ObjectPusher");
+ if (localName.length() == 0)
+ localName = qName;
+
+ //todo In-insert this if needed!!!!!!
+// if (qName.indexOf(':') >= 0 && namespaceURI.length() == 0) {
+// throw new SAXException("Use of undefined namespace prefix: " +
+// qName.substring(0, qName.indexOf(':')));
+// }
+
+ String prefix = (qName.indexOf(':') >= 0) ? qName.substring(0, qName.indexOf(':')) : "";
+ OMNamespace namespace = omFactory.createOMNamespace(namespaceURI, prefix);
+ OMElement element = omFactory.createOMElement(localName, namespace, null, this);
+
+ addNewNode(element, lastNode);
+
+ for (int i = 0; i < nameSpaces.size(); i++) {
+ OMNamespace ns = (OMNamespace) nameSpaces.get(i);
+ element.declareNamespace(ns);
+ }
+ nameSpaces.clear();
+
+ String attrUri = "";
+ String attrPrefix = "";
+ OMNamespace ns = null;
+ if(atts != null){
+ for (int i = 0; i < atts.getLength(); i++) {
+
+ attrUri = atts.getURI(i);
+ String attrQName = atts.getQName(i);
+ attrPrefix = (attrQName.indexOf(':') >= 0) ? attrQName.substring(0, attrQName.indexOf(':')) : "";
+
+ if (attrUri.hashCode() != 0)
+ ns = element.findInScopeNamespace(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.setComplete(false);
+ lastNode = element;
+
+ }
+
+ private void addNewNode(OMNode currentNode, OMNode lastNode) {
+
+ if (lastNode.isComplete()) {
+ lastNode.setNextSibling(currentNode);
+ currentNode.setParent(lastNode.getParent());
+ } else {
+ ((OMElement) lastNode).addChild(currentNode);
+ }
+ }
+
+ public short getBuilderType() {
+ return OMConstants.PUSH_TYPE_BUILDER;
+ }
+
+ public void registerExternalContentHandler(Object obj) {
+ if (obj instanceof ContentHandler)
+ this.externalContentHandler = (ContentHandler)obj;
+ else
+ throw new IllegalArgumentException("Attempt to register wrong type of content handler");
+ }
+
+ public Object getRegisteredContentHandler() {
+ return this.externalContentHandler;
+ }
+}