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 aj...@apache.org on 2006/02/01 15:17:36 UTC

svn commit: r374072 [1/3] - in /webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed: ./ rpc/ src/ src/org/ src/org/apache/ src/org/apache/axis2/ src/org/apache/axis2/databinding/ src/org/apache/axis2/databinding/beans/ src/org/apache/axis2/databin...

Author: ajith
Date: Wed Feb  1 06:17:03 2006
New Revision: 374072

URL: http://svn.apache.org/viewcvs?rev=374072&view=rev
Log:
Adding the moved Items

Added:
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest11.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/ArrayTest.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Constants.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationContext.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationTarget.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Deserializer.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializerFactory.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Holder.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/MultiTarget.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializationContext.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Serializer.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializerFactory.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SimpleTarget.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/beans/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/beans/BeanPropertyDescriptor.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/deserializers/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/deserializers/BeanDeserializer.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/deserializers/BeanDeserializerFactory.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/deserializers/CollectionDeserializer.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/deserializers/SimpleDeserializer.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/deserializers/SimpleDeserializerFactory.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/metadata/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/metadata/AttributeDesc.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/metadata/BeanManager.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/metadata/ElementDesc.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/metadata/FieldAccessor.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/metadata/FieldDesc.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/metadata/IndexedAccessorWrapper.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/metadata/IndexedFieldAccessor.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/metadata/TypeDesc.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/serializers/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/serializers/AbstractSerializer.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/serializers/BeanSerializer.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/serializers/CollectionSerializer.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/serializers/SimpleSerializer.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/typemapping/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/typemapping/TypeMappingRegistry.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/rpc/
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/rpc/RPCInOutMessageReceiver.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/rpc/RPCMethod.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/rpc/RPCParameter.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/rpc/RPCRequestElement.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/rpc/RPCResponseElement.java
    webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/rpc/RPCValues.java

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,221 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.rpc;
+
+import junit.framework.TestCase;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.databinding.DeserializationContext;
+import org.apache.axis2.databinding.deserializers.SimpleDeserializerFactory;
+import org.apache.axis2.databinding.serializers.CollectionSerializer;
+import org.apache.axis2.databinding.serializers.SimpleSerializer;
+import org.apache.axis2.description.*;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.transport.local.LocalTransportReceiver;
+import org.apache.wsdl.WSDLConstants;
+
+import javax.xml.namespace.QName;
+import java.lang.reflect.Method;
+
+/**
+ * SimpleTest
+ */
+public class SimpleTest extends TestCase {
+
+    /**
+     * Here's our test service which we'll be calling with the local transport
+     */
+    public static class Test {
+        TestBean echoBean(TestBean bean) {
+            TestBean res = new TestBean();
+            res.setField1(bean.getField1() + " --> " + bean.getField2());
+            return res;
+        }
+
+        String testTwoParams(String param1, int param2) {
+            return param1 + " --> " + param2;
+        }
+
+        String [] echoArray(String [] string) {
+            return string;
+        }
+    }
+
+    /**
+     * Here's a test JavaBean we'll be serializing/deserializing
+     */
+    public static class TestBean {
+        private String field1;
+        private int field2;
+
+        public String getField1() {
+            return field1;
+        }
+
+        public void setField1(String field1) {
+            this.field1 = field1;
+        }
+
+        public int getField2() {
+            return field2;
+        }
+
+        public void setField2(int field2) {
+            this.field2 = field2;
+        }
+    }
+
+    RPCMethod method;
+
+    /**
+     * Get everything (metadata, engine) set up
+     *
+     * @throws Exception
+     */
+    protected void setUp() throws Exception {
+        // Set up method/param metadata
+        AxisService service;
+        String methodName = "echoArray";
+        method = new RPCMethod(new QName(methodName));
+        method.setResponseQName(new QName(methodName + "Response"));
+
+        // Find the right Java method - this will be done by an introspector
+        // class which syncs an entire service description, but for now just
+        // do it manually...
+        Method [] methods = Test.class.getDeclaredMethods();
+        for (int i = 0; i < methods.length; i++) {
+            Method method1 = methods[i];
+            if (method1.getName().equals(methodName)) {
+                method.setJavaMethod(method1);
+                break;
+            }
+        }
+
+        RPCParameter param = new RPCParameter();
+
+        param.setQName(new QName("string"));
+        param.setDeserializerFactory(new SimpleDeserializerFactory(String.class,
+                new QName("xsd", "string")));
+        param.setSerializer(new CollectionSerializer(new QName("string"), false, new SimpleSerializer()));
+        param.setMaxOccurs(-1);
+        param.setDestClass(String [].class);
+        method.addParameter(param);
+
+        param = new RPCParameter();
+        param.setQName(new QName("return"));
+        param.setDeserializerFactory(new SimpleDeserializerFactory(String.class,
+                new QName("xsd", "string")));
+        param.setSerializer(new CollectionSerializer(new QName("return"),
+                false,
+                new SimpleSerializer()));
+        param.setMode(RPCParameter.MODE_OUT);
+        param.setMaxOccurs(-1);
+        param.setDestClass(String [].class);
+        method.addParameter(param);
+
+        // Set up Axis configuration
+
+        AxisConfiguration config = new AxisConfiguration();
+        TransportInDescription tIn = new TransportInDescription(new QName(Constants.TRANSPORT_LOCAL));
+        config.addTransportIn(tIn);
+
+        TransportOutDescription tOut = new TransportOutDescription(new QName(Constants.TRANSPORT_LOCAL));
+        config.addTransportOut(tOut);
+
+
+        LocalTransportReceiver.CONFIG_CONTEXT = new ConfigurationContext(config);
+
+        service = new AxisService("testService");
+        service.addParameter(
+                new ParameterImpl(AbstractMessageReceiver.SERVICE_CLASS,
+                        Test.class.getName()));
+        AxisOperation axisOperation = new InOutAxisOperation(new QName(methodName));
+        axisOperation.setMessageExchangePattern(WSDLConstants.MEP_URI_IN_OUT);
+        axisOperation.setMessageReceiver(new RPCInOutMessageReceiver());
+        service.addOperation(axisOperation);
+        Parameter parameter = new ParameterImpl();
+        parameter.setName(RPCInOutMessageReceiver.RPCMETHOD_PROPERTY);
+        parameter.setValue(method);
+        axisOperation.addParameter(parameter);
+        service.setClassLoader(Thread.currentThread().getContextClassLoader());
+        LocalTransportReceiver.CONFIG_CONTEXT.getAxisConfiguration()
+                .addService(service);
+    }
+
+    public void testRPC() throws Exception {
+//        Call call = new Call("test-resources/xmls");
+        ConfigurationContext configcontext = ConfigurationContextFactory
+                .createConfigurationContextFromFileSystem("test-resources/xmls",
+                        "test-resources/xmls/axis2.xml");
+        ServiceClient client = new ServiceClient(configcontext, null);
+//        Call call = new Call(".");
+
+        // Make the SOAP envelope
+        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope env = factory.createSOAPEnvelope();
+        factory.createSOAPHeader(env);
+        SOAPBody body = factory.createSOAPBody(env);
+
+        // Now set up an RPCRequestElement containing the metadat for our
+        // method and an actual set of instance values to serialize.
+        RPCValues values = new RPCValues();
+        String [] array = new String []{"one", "two"};
+        values.setValue(new QName("string"), array);
+        new RPCRequestElement(method, values, body);
+
+        // Ready to go - set the To address and make the call
+        Options options = new Options();
+        client.setOptions(options);
+        OperationClient opClient = client.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClient.setOptions(options);
+        MessageContext msgConetxt = new MessageContext();
+        msgConetxt.setConfigurationContext(configcontext);
+        options.setTo(new EndpointReference("local://services/testService"));
+
+        msgConetxt.setEnvelope(env);
+        opClient.addMessageContext(msgConetxt);
+        opClient.execute(true);
+        MessageContext resMsgCtx = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+        SOAPEnvelope respEnv = resMsgCtx.getEnvelope();
+        assertNotNull("No response envelope!", respEnv);
+
+        RPCInOutMessageReceiver receiver = new RPCInOutMessageReceiver();
+        // Got a response envelope, let's deserialize it back to Java
+        DeserializationContext dserContext = new DeserializationContext();
+        values = receiver.deserializeRPCElement(dserContext, method, respEnv.getBody().getFirstElement());
+
+        Object ret = method.getResponseParameter().getValue(values);
+        assertNotNull("No return parameter value", ret);
+        assertTrue("Return wasn't a String []", ret instanceof String []);
+        String [] retArray = (String[]) ret;
+        assertEquals("Array was wrong size", 2, retArray.length);
+        for (int i = 0; i < 2; i++) {
+            assertEquals("Value #" + i + " not correct!", array[i], retArray[i]);
+        }
+    }
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest11.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest11.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest11.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/rpc/SimpleTest11.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,209 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.rpc;
+
+import junit.framework.TestCase;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Call;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.databinding.DeserializationContext;
+import org.apache.axis2.databinding.deserializers.SimpleDeserializerFactory;
+import org.apache.axis2.databinding.serializers.CollectionSerializer;
+import org.apache.axis2.databinding.serializers.SimpleSerializer;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOutAxisOperation;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.ParameterImpl;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.transport.local.LocalTransportReceiver;
+
+import javax.xml.namespace.QName;
+import java.lang.reflect.Method;
+
+/**
+ * SimpleTest11
+ */
+public class SimpleTest11 extends TestCase {
+    private AxisService service;
+
+    /**
+     * Here's our test service which we'll be calling with the local transport
+     */
+    public static class Test {
+        TestBean echoBean(TestBean bean) {
+            TestBean res = new TestBean();
+            res.setField1(bean.getField1() + " --> " + bean.getField2());
+            return res;
+        }
+
+        String testTwoParams(String param1, int param2) {
+            return param1 + " --> " + param2;
+        }
+
+        String [] echoArray(String [] string) {
+            return string;
+        }
+    }
+
+    /**
+     * Here's a test JavaBean we'll be serializing/deserializing
+     */
+    public static class TestBean {
+        private String field1;
+        private int field2;
+
+        public String getField1() {
+            return field1;
+        }
+
+        public void setField1(String field1) {
+            this.field1 = field1;
+        }
+
+        public int getField2() {
+            return field2;
+        }
+
+        public void setField2(int field2) {
+            this.field2 = field2;
+        }
+    }
+
+    RPCMethod method;
+
+    /**
+     * Get everything (metadata, engine) set up
+     * @throws Exception
+     */
+    protected void setUp() throws Exception {
+        // Set up method/param metadata
+
+        String methodName = "echoArray";
+        method = new RPCMethod(new QName(methodName));
+        method.setResponseQName(new QName(methodName + "Response"));
+
+        // Find the right Java method - this will be done by an introspector
+        // class which syncs an entire service description, but for now just
+        // do it manually...
+        Method [] methods = Test.class.getDeclaredMethods();
+        for (int i = 0; i < methods.length; i++) {
+            Method method1 = methods[i];
+            if (method1.getName().equals(methodName)) {
+                method.setJavaMethod(method1);
+                break;
+            }
+        }
+
+        RPCParameter param = new RPCParameter();
+
+        param.setQName(new QName("string"));
+        param.setDeserializerFactory(new SimpleDeserializerFactory(String.class,
+                                                                   new QName("xsd", "string")));
+        param.setSerializer(new CollectionSerializer(new QName("string"), false, new SimpleSerializer()));
+        param.setMaxOccurs(-1);
+        param.setDestClass(String [].class);
+        method.addParameter(param);
+
+        param = new RPCParameter();
+        param.setQName(new QName("return"));
+        param.setDeserializerFactory(new SimpleDeserializerFactory(String.class,
+                                                                   new QName("xsd", "string")));
+        param.setSerializer(new CollectionSerializer(new QName("return"),
+                                                     false,
+                                                     new SimpleSerializer()));
+        param.setMode(RPCParameter.MODE_OUT);
+        param.setMaxOccurs(-1);
+        param.setDestClass(String [].class);
+        method.addParameter(param);
+
+        // Set up Axis configuration
+
+        AxisConfiguration config = new AxisConfiguration();
+        TransportInDescription tIn = new TransportInDescription(new QName(Constants.TRANSPORT_LOCAL));
+        config.addTransportIn(tIn);
+
+        TransportOutDescription tOut = new TransportOutDescription(new QName(Constants.TRANSPORT_LOCAL));
+        config.addTransportOut(tOut);
+
+
+        LocalTransportReceiver.CONFIG_CONTEXT = new ConfigurationContext(config);
+
+        service = new AxisService("testService");
+        service.addParameter(
+                new ParameterImpl(AbstractMessageReceiver.SERVICE_CLASS,
+                        Test.class.getName()));
+        AxisOperation axisOperation = new InOutAxisOperation(new QName(methodName));
+        axisOperation.setMessageReceiver(new RPCInOutMessageReceiver());
+        service.addOperation(axisOperation);
+        Parameter parameter = new ParameterImpl();
+        parameter.setName(RPCInOutMessageReceiver.RPCMETHOD_PROPERTY);
+        parameter.setValue(method);
+        axisOperation.addParameter(parameter);
+        service.setClassLoader(Thread.currentThread().getContextClassLoader());
+        LocalTransportReceiver.CONFIG_CONTEXT.getAxisConfiguration()
+                .addService(service);
+    }
+
+    public void testRPC() throws Exception {
+        Call call = new Call("test-resources/xmls");
+//        Call call = new Call(".");
+
+        // Make the SOAP envelope
+        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope env = factory.createSOAPEnvelope();
+        factory.createSOAPHeader(env);
+        SOAPBody body = factory.createSOAPBody(env);
+
+        // Now set up an RPCRequestElement containing the metadat for our
+        // method and an actual set of instance values to serialize.
+        RPCValues values = new RPCValues();
+        String [] array = new String [] { "one", "two" };
+        values.setValue(new QName("string"), array);
+        new RPCRequestElement(method, values, body);
+
+        // Ready to go - set the To address and make the call
+        Options options = new Options();
+        call.setClientOptions(options);
+        options.setTo(new EndpointReference("local://services/testService"));
+        
+        SOAPEnvelope respEnv = call.invokeBlocking("echoArray", env);
+        assertNotNull("No response envelope!", respEnv);
+
+        RPCInOutMessageReceiver receiver = new RPCInOutMessageReceiver();
+        // Got a response envelope, let's deserialize it back to Java
+        DeserializationContext dserContext = new DeserializationContext();
+        values = receiver.deserializeRPCElement(dserContext, method, respEnv.getBody().getFirstElement());
+
+        Object ret = method.getResponseParameter().getValue(values);
+        assertNotNull("No return parameter value", ret);
+        assertTrue("Return wasn't a String []", ret instanceof String []);
+        String [] retArray = (String[])ret;
+        assertEquals("Array was wrong size", 2, retArray.length);
+        for (int i = 0; i < 2; i++) {
+            assertEquals("Value #" + i + " not correct!", array[i], retArray[i]);
+        }
+    }
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/ArrayTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/ArrayTest.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/ArrayTest.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/ArrayTest.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+import junit.framework.TestCase;
+import org.apache.axis2.databinding.metadata.ElementDesc;
+import org.apache.axis2.databinding.metadata.TypeDesc;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+
+/**
+ * ArrayTest
+ */
+public class ArrayTest extends TestCase {
+    public static class TestBean {
+        static TypeDesc typeDesc;
+
+        public static TypeDesc getTypeDesc() {
+            if (typeDesc == null) {
+                typeDesc = new TypeDesc();
+                typeDesc.setJavaClass(ArrayTest.class);
+                ElementDesc desc = new ElementDesc();
+                desc.setFieldName("collection");
+                desc.setQName(new QName("item"));
+                desc.setMaxOccurs(-1);
+                typeDesc.addField(desc);
+            }
+            return typeDesc;
+        }
+
+        ArrayList coll;
+
+        public TestBean() {
+            coll = new ArrayList();
+        }
+
+        public String [] getCollection() {
+            return (String[])(coll.toArray(new String [coll.size()]));
+        }
+
+        public void setCollection(int index, String val) {
+            if (index + 1 > coll.size()) {
+               while (index + 1 > coll.size()) {
+                   coll.add(null);
+               }
+            }
+            coll.set(index, val);
+        }
+
+        public String getCollection(int index) {
+            return (String)coll.get(index);
+        }
+    }
+
+    public void testArray() throws Exception {
+        InputStream is = new FileInputStream("test-resources/xmls/array1.xml");
+        XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(is);
+
+        StAXOMBuilder builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), reader);
+        OMElement el = builder.getDocumentElement();
+        XMLStreamReader omReader = el.getXMLStreamReaderWithoutCaching();
+        omReader.next();
+        DeserializationContext context = new DeserializationContext();
+        Object value = context.deserializeToClass(omReader, TestBean.class);
+
+        assertNotNull(value);
+        assertTrue(value instanceof TestBean);
+        TestBean bean = (TestBean)value;
+        assertEquals("Wrong # of items", 3, bean.coll.size());
+        assertEquals("one", bean.getCollection(0));
+        assertEquals("two", bean.getCollection(1));
+        assertEquals("three", bean.getCollection(2));
+    }
+
+/*
+    public void testMultiDimArray() throws Exception {
+        InputStream is = new FileInputStream("test-resources/xmls/MultiDimArray.xml");
+        XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(is);
+
+        StAXOMBuilder builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), reader);
+        OMElement el = builder.getDocumentElement();
+        XMLStreamReader omReader = el.getXMLStreamReaderWithoutCaching();
+        omReader.next();
+        DeserializationContext context = new DeserializationContext();
+        Object value = context.deserializeToClass(omReader, TestBean.class);
+
+        assertNotNull(value);
+        assertTrue(value instanceof TestBean);
+        TestBean bean = (TestBean)value;
+        assertEquals("Wrong # of items", 3, bean.coll.size());
+        assertEquals("one", bean.getCollection(0));
+        assertEquals("two", bean.getCollection(1));
+        assertEquals("three", bean.getCollection(2));
+    }
+*/
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Constants.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Constants.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Constants.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,696 @@
+/*
+ * 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.axis2.databinding;
+
+
+import org.xml.sax.Attributes;
+
+import javax.xml.namespace.QName;
+
+public class Constants {
+    // Some common Constants that should be used in local handler options
+    // (Not all implementations will have these concepts - for example
+    //  not all Engines will have notion of registries but defining these
+    //  here should allow people to ask if they exist)
+    //////////////////////////////////////////////////////////////////////////
+
+    // Namespace Prefix Constants
+    //////////////////////////////////////////////////////////////////////////
+    public static final String NS_PREFIX_SOAP_ENV   = "soapenv";
+    public static final String NS_PREFIX_SOAP_ENC   = "soapenc";
+    public static final String NS_PREFIX_SCHEMA_XSI = "xsi" ;
+    public static final String NS_PREFIX_SCHEMA_XSD = "xsd" ;
+    public static final String NS_PREFIX_WSDL       = "wsdl" ;
+    public static final String NS_PREFIX_WSDL_SOAP  = "wsdlsoap";
+    public static final String NS_PREFIX_XMLSOAP    = "apachesoap";
+    public static final String NS_PREFIX_XML        = "xml";
+
+    // Axis Namespaces
+    public static final String NS_URI_AXIS = "http://xml.apache.org/axis/";
+    public static final String NS_URI_XMLSOAP = "http://xml.apache.org/xml-soap";
+
+    // Special namespace URI to indicate an "automatically" serialized Java
+    // type.  This allows us to use types without needing explicit mappings,
+    // such that Java classes like "org.foo.Bar" map to QNames like
+    // {http://xml.apache.org/axis/java}org.foo.Bar
+    public static final String NS_URI_JAVA = "http://xml.apache.org/axis/java";
+
+
+    //
+    // SOAP-ENV Namespaces
+    //
+    public static final String URI_SOAP11_ENV =
+                                "http://schemas.xmlsoap.org/soap/envelope/" ;
+    public static final String URI_SOAP12_ENV =
+                                   "http://www.w3.org/2003/05/soap-envelope";
+
+    // fixme: this is unsafe - a client can (accidentaly or on purpose)
+    //  over-write the elemnts of this array. This pattern is used throughout
+    //  this file.
+    public static final String[] URIS_SOAP_ENV = {
+        URI_SOAP11_ENV,
+        URI_SOAP12_ENV,
+    };
+
+    // Constant name of the enterprise-style logging category.
+    // The enterprise category is for stuff that an enterprise product might
+    // want to track, but in a simple environment (like the AXIS build) would
+    // be nothing more than a nuisance.
+    public static final String ENTERPRISE_LOG_CATEGORY = "org.apache.axis.enterprise";
+
+    /**
+     * Time logged stuff.
+     */
+    public static final String TIME_LOG_CATEGORY = "org.apache.axis.TIME";
+
+    /**
+     * Servlet exceptions. Axis faults are logged at debug level here.
+     */
+    public static final String EXCEPTION_LOG_CATEGORY = "org.apache.axis.EXCEPTIONS";
+
+    /** The name of the field which accepts xsd:any content in Beans. */
+    public static final String ANYCONTENT = "_any";
+    /**
+     * Buffer size for http.
+     */
+    public static final int HTTP_TXR_BUFFER_SIZE = 8 * 1024;
+    
+    /** Basic Profile 1.1 compatibility flag */
+    public static final String WSIBP11_COMPAT_PROPERTY = "axis.ws-i.bp11.compatibility";
+
+    /**
+     * Returns true if the string is the SOAP_ENV namespace.
+     *
+     * @param s  the string representation of a URI
+     * @return Returns <code>true</code> if s represents any of the supported soap
+     *              envelope URI strings,false otherwise.
+     */
+    public static boolean isSOAP_ENV(String s) {
+        for (int i=0; i<URIS_SOAP_ENV.length; i++) {
+            if (URIS_SOAP_ENV[i].equals(s)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    public static final String URI_LITERAL_ENC = "";
+
+    //
+    // SOAP-ENC Namespaces
+    //
+    public static final String URI_SOAP11_ENC =
+                                "http://schemas.xmlsoap.org/soap/encoding/" ;
+    public static final String URI_SOAP12_ENC =
+                                   "http://www.w3.org/2003/05/soap-encoding";
+    public static final String URI_SOAP12_NOENC =
+                     "http://www.w3.org/2003/05/soap-envelope/encoding/none";
+
+    public static final String[] URIS_SOAP_ENC = {
+        URI_SOAP12_ENC,
+        URI_SOAP11_ENC,
+    };
+
+    /**
+     * Returns true if SOAP_ENC namespace.
+     *
+     * @param s  a string representing the URI to check
+     * @return Returns true if <code>s</code> matches a SOAP ENCODING namespace URI,
+     *              false otherwise.
+     */
+    public static boolean isSOAP_ENC(String s) {
+        for (int i=0; i<URIS_SOAP_ENC.length; i++) {
+            if (URIS_SOAP_ENC[i].equals(s)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Returns the value of an attribute which might be in one of several namespaces.
+     *
+     * @param attributes the attributes to search.
+     * @param search an array of namespace URI strings to search.
+     * @param localPart is the local part of the attribute name.
+     * @return Returns the value of the attribute or null.
+     */
+    public static String getValue(Attributes attributes,
+                                  String [] search,
+                                  String localPart) {
+        if (attributes == null || search == null || localPart == null) {
+            return null;
+        }
+        
+        int len = attributes.getLength();
+        
+        if (len == 0) {
+            return null;
+        }
+        
+        for (int i=0; i < len; i++) {
+            if (attributes.getLocalName(i).equals(localPart)) {
+                String uri = attributes.getURI(i);
+                for (int j=0; j<search.length; j++) {
+                    if (search[j].equals(uri)) return attributes.getValue(i);
+                }
+            }
+        }
+        
+        return null;
+    }
+
+    /**
+     * Searches an attribute collection for a list of QNames, returning
+     * the value of the first one found, or null if none were found.
+     *
+     * @param attributes
+     * @param search
+     * @return Returns the value of the attribute.
+     */
+    public static String getValue(Attributes attributes,
+                                  QName [] search) {
+        if (attributes == null || search == null)
+            return null;
+
+        if (attributes.getLength() == 0) return null;
+
+        String value = null;
+        for (int i=0; (value == null) && (i < search.length); i++) {
+            value = attributes.getValue(search[i].getNamespaceURI(),
+                                        search[i].getLocalPart());
+        }
+
+        return value;
+    }
+
+    /**
+     * The first QName is the current version of the name.  The second qname is compared
+     * with the first considering all namespace uri versions.
+     * @param first Currently supported QName.
+     * @param second any qname.
+     * @return Returns true if the qnames represent the same qname (paster namespace uri versions considered).
+     */
+    public static boolean equals(QName first, QName second) {
+        if (first == second) {
+            return true;
+        }
+        if (first==null || second==null) {
+            return false;
+        }
+        if (first.equals(second)) {
+            return true;
+        }
+        if (!first.getLocalPart().equals(second.getLocalPart())) {
+            return false;
+        }
+
+        String namespaceURI = first.getNamespaceURI();
+        String[] search = null;
+        if (namespaceURI.equals(URI_DEFAULT_SCHEMA_XSD))
+            search = URIS_SCHEMA_XSD;
+        else if (namespaceURI.equals(URI_DEFAULT_SCHEMA_XSI))
+            search = URIS_SCHEMA_XSI;
+        else
+            search = new String[] {namespaceURI};
+
+        for (int i=0; i < search.length; i++) {
+            if (search[i].equals(second.getNamespaceURI())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // Misc SOAP Namespaces / URIs
+    public static final String URI_SOAP11_NEXT_ACTOR =
+                                     "http://schemas.xmlsoap.org/soap/actor/next" ;
+    public static final String URI_SOAP12_NEXT_ROLE =
+                                     "http://www.w3.org/2003/05/soap-envelope/role/next";
+    /** @deprecated use URI_SOAP12_NEXT_ROLE */
+    public static final String URI_SOAP12_NEXT_ACTOR = URI_SOAP12_NEXT_ROLE;
+
+    public static final String URI_SOAP12_RPC =
+                                     "http://www.w3.org/2003/05/soap-rpc";
+
+    public static final String URI_SOAP12_NONE_ROLE =
+                         "http://www.w3.org/2003/05/soap-envelope/role/none";
+    public static final String URI_SOAP12_ULTIMATE_ROLE =
+             "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver";
+
+    public static final String URI_SOAP11_HTTP =
+                                     "http://schemas.xmlsoap.org/soap/http";
+    public static final String URI_SOAP12_HTTP =
+                                    "http://www.w3.org/2003/05/http";
+
+    public static final String NS_URI_XMLNS =
+                                       "http://www.w3.org/2000/xmlns/";
+
+    public static final String NS_URI_XML =
+                                       "http://www.w3.org/XML/1998/namespace";
+
+    //
+    // Schema XSD Namespaces
+    //
+    public static final String URI_1999_SCHEMA_XSD =
+                                          "http://www.w3.org/1999/XMLSchema";
+    public static final String URI_2000_SCHEMA_XSD =
+                                       "http://www.w3.org/2000/10/XMLSchema";
+    public static final String URI_2001_SCHEMA_XSD =
+                                          "http://www.w3.org/2001/XMLSchema";
+
+    public static final String URI_DEFAULT_SCHEMA_XSD = URI_2001_SCHEMA_XSD;
+
+    public static final String[] URIS_SCHEMA_XSD = {
+        URI_1999_SCHEMA_XSD,
+        URI_2000_SCHEMA_XSD,
+        URI_2001_SCHEMA_XSD
+    };
+
+
+    /**
+     * Returns true if SchemaXSD namespace.
+     *
+     * @param s  the string representing the URI to check
+     * @return Returns true if s represents the Schema XSD namespace, false otherwise.
+     */
+    public static boolean isSchemaXSD(String s) {
+        for (int i=0; i<URIS_SCHEMA_XSD.length; i++) {
+            if (URIS_SCHEMA_XSD[i].equals(s)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    //
+    // Schema XSI Namespaces
+    //
+    public static final String URI_1999_SCHEMA_XSI =
+                                 "http://www.w3.org/1999/XMLSchema-instance";
+    public static final String URI_2000_SCHEMA_XSI =
+                              "http://www.w3.org/2000/10/XMLSchema-instance";
+    public static final String URI_2001_SCHEMA_XSI =
+                                 "http://www.w3.org/2001/XMLSchema-instance";
+    public static final String URI_DEFAULT_SCHEMA_XSI = URI_2001_SCHEMA_XSI;
+
+    public static final String[] URIS_SCHEMA_XSI = {
+        URI_1999_SCHEMA_XSI,
+        URI_2000_SCHEMA_XSI,
+        URI_2001_SCHEMA_XSI,
+    };
+
+    /**
+     * Returns true if SchemaXSI namespace.
+     *
+     * @param s  the string of the URI to check.
+     * @return   Returns true if <code>s</code> is a Schema XSI URI, false otherwise.
+     */
+    public static boolean isSchemaXSI(String s) {
+        for (int i=0; i<URIS_SCHEMA_XSI.length; i++) {
+            if (URIS_SCHEMA_XSI[i].equals(s)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * WSDL namespace.
+     */
+    public static final String NS_URI_WSDL11 =
+                                 "http://schemas.xmlsoap.org/wsdl/";
+
+    public static final String[] NS_URIS_WSDL = {
+        NS_URI_WSDL11,
+    };
+
+    /**
+     * Returns true if this is a WSDL namespace.
+     *
+     * @param s  a string of a URI to check.
+     * @return   Returns true if <code>s</code> is a WSDL namespace URI, false otherwise
+     */
+    public static boolean isWSDL(String s) {
+        for (int i=0; i<NS_URIS_WSDL.length; i++) {
+            if (NS_URIS_WSDL[i].equals(s)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    //
+    // WSDL extensions for SOAP in DIME
+    // (http://gotdotnet.com/team/xml_wsspecs/dime/WSDL-Extension-for-DIME.htm)
+    //
+    public static final String URI_DIME_WSDL =
+                                 "http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/";
+
+    public static final String URI_DIME_CONTENT =
+                                 "http://schemas.xmlsoap.org/ws/2002/04/content-type/";
+
+    public static final String URI_DIME_REFERENCE=
+                                 "http://schemas.xmlsoap.org/ws/2002/04/reference/";
+
+    public static final String URI_DIME_CLOSED_LAYOUT=
+                                 "http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout";
+
+    public static final String URI_DIME_OPEN_LAYOUT=
+                                 "http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout";
+
+    //
+    // WSDL SOAP namespace
+    //
+    public static final String URI_WSDL11_SOAP =
+                                 "http://schemas.xmlsoap.org/wsdl/soap/";
+    public static final String URI_WSDL12_SOAP =
+                                 "http://schemas.xmlsoap.org/wsdl/soap12/";
+
+    public static final String[] NS_URIS_WSDL_SOAP = {
+        URI_WSDL11_SOAP,
+        URI_WSDL12_SOAP
+    };
+
+    /**
+     * Returns true if s is a WSDL SOAP namespace.
+     *
+     * @param s  a string of a URI to check.
+     * @return   Returns true if <code>s</code> matches any of the WSDL SOAP namepace
+     *              URIs, false otherwise.
+     */
+    public static boolean isWSDLSOAP(String s) {
+        for (int i=0; i<NS_URIS_WSDL_SOAP.length; i++) {
+            if (NS_URIS_WSDL_SOAP[i].equals(s)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // Axis Mechanism Type
+    public static final String AXIS_SAX = "Axis SAX Mechanism";
+
+    public static final String ELEM_ENVELOPE = "Envelope" ;
+    public static final String ELEM_HEADER   = "Header" ;
+    public static final String ELEM_BODY     = "Body" ;
+    public static final String ELEM_FAULT    = "Fault" ;
+
+    public static final String ELEM_NOTUNDERSTOOD = "NotUnderstood";
+    public static final String ELEM_UPGRADE           = "Upgrade";
+    public static final String ELEM_SUPPORTEDENVELOPE = "SupportedEnvelope";
+
+    public static final String ELEM_FAULT_CODE   = "faultcode" ;
+    public static final String ELEM_FAULT_STRING = "faultstring" ;
+    public static final String ELEM_FAULT_DETAIL = "detail" ;
+    public static final String ELEM_FAULT_ACTOR  = "faultactor" ;
+
+    public static final String ELEM_FAULT_CODE_SOAP12 = "Code" ;
+    public static final String ELEM_FAULT_VALUE_SOAP12 = "Value" ;
+    public static final String ELEM_FAULT_SUBCODE_SOAP12 = "Subcode" ;
+    public static final String ELEM_FAULT_REASON_SOAP12 = "Reason" ;
+    public static final String ELEM_FAULT_NODE_SOAP12 = "Node" ;
+    public static final String ELEM_FAULT_ROLE_SOAP12 = "Role" ;
+    public static final String ELEM_FAULT_DETAIL_SOAP12 = "Detail" ;
+    public static final String ELEM_TEXT_SOAP12 = "Text" ;
+
+    public static final String ATTR_MUST_UNDERSTAND = "mustUnderstand" ;
+    public static final String ATTR_ENCODING_STYLE  = "encodingStyle" ;
+    public static final String ATTR_ACTOR           = "actor" ;
+    public static final String ATTR_ROLE            = "role" ;
+    public static final String ATTR_RELAY           = "relay" ;
+    public static final String ATTR_ROOT            = "root" ;
+    public static final String ATTR_ID              = "id" ;
+    public static final String ATTR_HREF            = "href" ;
+    public static final String ATTR_REF             = "ref" ;
+    public static final String ATTR_QNAME           = "qname";
+    public static final String ATTR_ARRAY_TYPE      = "arrayType";
+    public static final String ATTR_ITEM_TYPE       = "itemType";
+    public static final String ATTR_ARRAY_SIZE      = "arraySize";
+    public static final String ATTR_OFFSET          = "offset";
+    public static final String ATTR_POSITION        = "position";
+    public static final String ATTR_TYPE            = "type";
+    public static final String ATTR_HANDLERINFOCHAIN = "handlerInfoChain";
+
+    // Fault Codes
+    //////////////////////////////////////////////////////////////////////////
+    public static final String FAULT_CLIENT = "Client";
+
+    public static final String FAULT_SERVER_GENERAL =
+                                                   "Server.generalException";
+
+    public static final String FAULT_SERVER_USER =
+                                                   "Server.userException";
+
+    public static final QName FAULT_VERSIONMISMATCH =
+                                  new QName(URI_SOAP11_ENV, "VersionMismatch");
+
+    public static final QName FAULT_MUSTUNDERSTAND =
+                                  new QName(URI_SOAP11_ENV, "MustUnderstand");
+
+
+    public static final QName FAULT_SOAP12_MUSTUNDERSTAND =
+                                  new QName(URI_SOAP12_ENV, "MustUnderstand");
+
+    public static final QName FAULT_SOAP12_VERSIONMISMATCH =
+                                  new QName(URI_SOAP12_ENV, "VersionMismatch");
+
+    public static final QName FAULT_SOAP12_DATAENCODINGUNKNOWN =
+                                  new QName(URI_SOAP12_ENV, "DataEncodingUnknown");
+
+    public static final QName FAULT_SOAP12_SENDER =
+                                  new QName(URI_SOAP12_ENV, "Sender");
+
+    public static final QName FAULT_SOAP12_RECEIVER =
+                                  new QName(URI_SOAP12_ENV, "Receiver");
+
+    // SOAP 1.2 Fault subcodes
+    public static final QName FAULT_SUBCODE_BADARGS =
+            new QName(URI_SOAP12_RPC, "BadArguments");
+    public static final QName FAULT_SUBCODE_PROC_NOT_PRESENT =
+            new QName(URI_SOAP12_RPC, "ProcedureNotPresent");
+
+    // QNames
+    //////////////////////////////////////////////////////////////////////////
+    public static final QName QNAME_FAULTCODE =
+                                         new QName("", ELEM_FAULT_CODE);
+    public static final QName QNAME_FAULTSTRING =
+                                       new QName("", ELEM_FAULT_STRING);
+    public static final QName QNAME_FAULTACTOR =
+                                        new QName("", ELEM_FAULT_ACTOR);
+    public static final QName QNAME_FAULTDETAILS =
+                                         new QName("", ELEM_FAULT_DETAIL);
+
+    public static final QName QNAME_FAULTCODE_SOAP12 =
+                                         new QName(URI_SOAP12_ENV, ELEM_FAULT_CODE_SOAP12);
+    public static final QName QNAME_FAULTVALUE_SOAP12 =
+                                         new QName(URI_SOAP12_ENV, ELEM_FAULT_VALUE_SOAP12);
+    public static final QName QNAME_FAULTSUBCODE_SOAP12 =
+                                         new QName(URI_SOAP12_ENV, ELEM_FAULT_SUBCODE_SOAP12);
+    public static final QName QNAME_FAULTREASON_SOAP12 =
+                                         new QName(URI_SOAP12_ENV, ELEM_FAULT_REASON_SOAP12);
+    public static final QName QNAME_TEXT_SOAP12 =
+                                         new QName(URI_SOAP12_ENV, ELEM_TEXT_SOAP12);
+
+    public static final QName QNAME_FAULTNODE_SOAP12 =
+                                         new QName(URI_SOAP12_ENV, ELEM_FAULT_NODE_SOAP12);
+    public static final QName QNAME_FAULTROLE_SOAP12 =
+                                         new QName(URI_SOAP12_ENV, ELEM_FAULT_ROLE_SOAP12);
+    public static final QName QNAME_FAULTDETAIL_SOAP12 =
+                                         new QName(URI_SOAP12_ENV, ELEM_FAULT_DETAIL_SOAP12);
+    public static final QName QNAME_NOTUNDERSTOOD =
+                                         new QName(URI_SOAP12_ENV, ELEM_NOTUNDERSTOOD);
+
+    // Define qnames for the all of the XSD and SOAP-ENC encodings
+    public static final QName XSD_STRING = new QName(URI_DEFAULT_SCHEMA_XSD, "string");
+    public static final QName XSD_BOOLEAN = new QName(URI_DEFAULT_SCHEMA_XSD, "boolean");
+    public static final QName XSD_DOUBLE = new QName(URI_DEFAULT_SCHEMA_XSD, "double");
+    public static final QName XSD_FLOAT = new QName(URI_DEFAULT_SCHEMA_XSD, "float");
+    public static final QName XSD_INT = new QName(URI_DEFAULT_SCHEMA_XSD, "int");
+    public static final QName XSD_INTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "integer");
+    public static final QName XSD_LONG = new QName(URI_DEFAULT_SCHEMA_XSD, "long");
+    public static final QName XSD_SHORT = new QName(URI_DEFAULT_SCHEMA_XSD, "short");
+    public static final QName XSD_BYTE = new QName(URI_DEFAULT_SCHEMA_XSD, "byte");
+    public static final QName XSD_DECIMAL = new QName(URI_DEFAULT_SCHEMA_XSD, "decimal");
+    public static final QName XSD_BASE64 = new QName(URI_DEFAULT_SCHEMA_XSD, "base64Binary");
+    public static final QName XSD_HEXBIN = new QName(URI_DEFAULT_SCHEMA_XSD, "hexBinary");
+    public static final QName XSD_ANYSIMPLETYPE = new QName(URI_DEFAULT_SCHEMA_XSD, "anySimpleType");
+    public static final QName XSD_ANYTYPE = new QName(URI_DEFAULT_SCHEMA_XSD, "anyType");
+    public static final QName XSD_ANY = new QName(URI_DEFAULT_SCHEMA_XSD, "any");
+    public static final QName XSD_QNAME = new QName(URI_DEFAULT_SCHEMA_XSD, "QName");
+    public static final QName XSD_DATETIME = new QName(URI_DEFAULT_SCHEMA_XSD, "dateTime");
+    public static final QName XSD_DATE = new QName(URI_DEFAULT_SCHEMA_XSD, "date");
+    public static final QName XSD_TIME = new QName(URI_DEFAULT_SCHEMA_XSD, "time");
+    public static final QName XSD_TIMEINSTANT1999 = new QName(URI_1999_SCHEMA_XSD, "timeInstant");
+    public static final QName XSD_TIMEINSTANT2000 = new QName(URI_2000_SCHEMA_XSD, "timeInstant");
+
+    public static final QName XSD_NORMALIZEDSTRING = new QName(URI_2001_SCHEMA_XSD, "normalizedString");
+    public static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD, "token");
+
+    public static final QName XSD_UNSIGNEDLONG = new QName(URI_2001_SCHEMA_XSD, "unsignedLong");
+    public static final QName XSD_UNSIGNEDINT = new QName(URI_2001_SCHEMA_XSD, "unsignedInt");
+    public static final QName XSD_UNSIGNEDSHORT = new QName(URI_2001_SCHEMA_XSD, "unsignedShort");
+    public static final QName XSD_UNSIGNEDBYTE = new QName(URI_2001_SCHEMA_XSD, "unsignedByte");
+    public static final QName XSD_POSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "positiveInteger");
+    public static final QName XSD_NEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "negativeInteger");
+    public static final QName XSD_NONNEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonNegativeInteger");
+    public static final QName XSD_NONPOSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonPositiveInteger");
+
+    public static final QName XSD_YEARMONTH = new QName(URI_2001_SCHEMA_XSD, "gYearMonth");
+    public static final QName XSD_MONTHDAY = new QName(URI_2001_SCHEMA_XSD, "gMonthDay");
+    public static final QName XSD_YEAR = new QName(URI_2001_SCHEMA_XSD, "gYear");
+    public static final QName XSD_MONTH = new QName(URI_2001_SCHEMA_XSD, "gMonth");
+    public static final QName XSD_DAY = new QName(URI_2001_SCHEMA_XSD, "gDay");
+    public static final QName XSD_DURATION = new QName(URI_2001_SCHEMA_XSD, "duration");
+
+    public static final QName XSD_NAME = new QName(URI_2001_SCHEMA_XSD, "Name");
+    public static final QName XSD_NCNAME = new QName(URI_2001_SCHEMA_XSD, "NCName");
+    public static final QName XSD_NMTOKEN = new QName(URI_2001_SCHEMA_XSD, "NMTOKEN");
+    public static final QName XSD_NMTOKENS = new QName(URI_2001_SCHEMA_XSD, "NMTOKENS");
+    public static final QName XSD_NOTATION = new QName(URI_2001_SCHEMA_XSD, "NOTATION");
+    public static final QName XSD_ENTITY = new QName(URI_2001_SCHEMA_XSD, "ENTITY");
+    public static final QName XSD_ENTITIES = new QName(URI_2001_SCHEMA_XSD, "ENTITIES");
+    public static final QName XSD_IDREF = new QName(URI_2001_SCHEMA_XSD, "IDREF");
+    public static final QName XSD_IDREFS = new QName(URI_2001_SCHEMA_XSD, "IDREFS");
+    public static final QName XSD_ANYURI = new QName(URI_2001_SCHEMA_XSD, "anyURI");
+    public static final QName XSD_LANGUAGE = new QName(URI_2001_SCHEMA_XSD, "language");
+    public static final QName XSD_ID = new QName(URI_2001_SCHEMA_XSD, "ID");
+    public static final QName XSD_SCHEMA = new QName(URI_2001_SCHEMA_XSD, "schema");
+
+    public static final QName XML_LANG = new QName(NS_URI_XML, "lang");
+
+    
+    public static final QName SOAP_COMMON_ATTRS11 = new QName(URI_SOAP11_ENC, "commonAttributes");
+    public static final QName SOAP_COMMON_ATTRS12 = new QName(URI_SOAP12_ENC, "commonAttributes");
+    public static final QName SOAP_ARRAY_ATTRS11 = new QName(URI_SOAP11_ENC, "arrayAttributes");
+    public static final QName SOAP_ARRAY_ATTRS12 = new QName(URI_SOAP12_ENC, "arrayAttributes");
+    public static final QName SOAP_ARRAY12 = new QName(URI_SOAP12_ENC, "Array");
+
+    public static final QName SOAP_MAP = new QName(NS_URI_XMLSOAP, "Map");
+    public static final QName SOAP_ELEMENT = new QName(NS_URI_XMLSOAP, "Element");
+    public static final QName SOAP_DOCUMENT = new QName(NS_URI_XMLSOAP, "Document");
+    public static final QName SOAP_VECTOR = new QName(NS_URI_XMLSOAP, "Vector");
+    public static final QName MIME_IMAGE = new QName(NS_URI_XMLSOAP, "Image");
+    public static final QName MIME_PLAINTEXT = new QName(NS_URI_XMLSOAP, "PlainText");
+    public static final QName MIME_MULTIPART = new QName(NS_URI_XMLSOAP, "Multipart");
+    public static final QName MIME_SOURCE = new QName(NS_URI_XMLSOAP, "Source");
+    public static final QName MIME_OCTETSTREAM = new QName(NS_URI_XMLSOAP, "octet-stream");
+    public static final QName MIME_DATA_HANDLER = new QName(NS_URI_XMLSOAP, "DataHandler");
+
+
+    public static final QName QNAME_LITERAL_ITEM = new QName(URI_LITERAL_ENC,"item");
+    public static final QName QNAME_RPC_RESULT = new QName(URI_SOAP12_RPC,"result");
+
+    /**
+     * QName of stack trace element in an axis fault detail.
+     */
+    public static final QName QNAME_FAULTDETAIL_STACKTRACE = new QName(NS_URI_AXIS,"stackTrace");
+
+    /**
+     * QName of exception name element in an axis fault detail.
+     * Do not use - this is for pre-1.0 server->client exceptions.
+     */
+    public static final QName QNAME_FAULTDETAIL_EXCEPTIONNAME = new QName(NS_URI_AXIS, "exceptionName");
+
+    /**
+     * Flag set if this was a runtime exception, rather than something thrown by the class at the end of the
+     * chain. Axis' logging treats runtime exceptions more seriously.
+     */
+    public static final QName QNAME_FAULTDETAIL_RUNTIMEEXCEPTION = new QName(NS_URI_AXIS, "isRuntimeException");
+
+    /**
+     * QName of HTTP Error code element in an axis fault detail. 
+     */
+    public static final QName QNAME_FAULTDETAIL_HTTPERRORCODE = new QName(NS_URI_AXIS, "HttpErrorCode");
+
+    /**
+     * QName of a nested fault in an axis fault detail.
+     */
+    public static final QName QNAME_FAULTDETAIL_NESTEDFAULT = new QName(NS_URI_AXIS, "nestedFault");
+
+    /**
+     * QName of a hostname in an axis fault detail.
+     */
+    public static final QName QNAME_FAULTDETAIL_HOSTNAME = new QName(NS_URI_AXIS, "hostname");
+
+    //QNames of well known faults
+    /**
+     * The no-service fault value.
+     */
+    public static final QName QNAME_NO_SERVICE_FAULT_CODE
+            = new QName(NS_URI_AXIS, "Server.NoService");
+
+    // Misc Strings
+    //////////////////////////////////////////////////////////////////////////
+
+    // Where to put those pesky JWS classes
+    public static final String MC_JWS_CLASSDIR = "jws.classDir" ;
+    // Where we're rooted
+    public static final String MC_HOME_DIR = "home.dir";
+
+    // Relative path of the request URL (ie. http://.../axis/a.jws = /a.jws
+    public static final String MC_RELATIVE_PATH = "path";
+
+    // MessageContext param for the engine's path
+    public static final String MC_REALPATH = "realpath";
+    // MessageContext param for the location of config files
+    public static final String MC_CONFIGPATH = "configPath";
+    // MessageContext param for the IP of the calling client
+    public static final String MC_REMOTE_ADDR = "remoteaddr";
+    // When invoked from a servlet, per JAX-RPC, we need  a
+    // ServletEndpointContext object.  This is where it lives.
+    public static final String MC_SERVLET_ENDPOINT_CONTEXT = "servletEndpointContext";
+
+    // If we're SOAP 1.2, the default behavior in org.apache.axis.message.BodyBuilder
+    // is to throw a ProcedureNotPresent fault if we can't dispatch to an
+    // OperationDesc during deserialization.  Set this property to any non-null
+    // value to prevent this behavior (only used by test.soap12.
+    public static final String MC_NO_OPERATION_OK = "NoOperationOK";
+
+    // This property indicates we're supporting only a single SOAP version.
+    // If set (by the service or engine), we'll only accept envelopes of the
+    // specified version.  Value should be an org.apache.axis.soap.SOAPConstants
+    public static final String MC_SINGLE_SOAP_VERSION = "SingleSOAPVersion";
+
+    /**
+     * What the extension of JWS files is. If changing this, note that
+     * AxisServlet has an xdoclet declaration in the class javadocs that
+     * also needs updating.
+     */
+    public static final String JWS_DEFAULT_FILE_EXTENSION = ".jws";
+
+    /**
+     * The default timeout for messages.
+     * 
+     * @since Axis1.2
+     */
+    public static final int DEFAULT_MESSAGE_TIMEOUT=60*1000*10;
+
+    /**
+     * MIME Content Types.
+     * 
+     * @since Axis1.2
+     */
+    public static final String MIME_CT_APPLICATION_OCTETSTREAM     = "application/octet-stream";
+    public static final String MIME_CT_TEXT_PLAIN         = "text/plain";
+    public static final String MIME_CT_IMAGE_JPEG        = "image/jpeg";
+    public static final String MIME_CT_IMAGE_GIF        = "image/gif";
+    public static final String MIME_CT_TEXT_XML            = "text/xml";
+    public static final String MIME_CT_APPLICATION_XML        = "application/xml";
+    public static final String MIME_CT_MULTIPART_PREFIX        = "multipart/";
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationContext.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationContext.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationContext.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+import org.apache.axis2.databinding.deserializers.BeanDeserializer;
+import org.apache.axis2.databinding.metadata.BeanManager;
+import org.apache.axis2.databinding.metadata.TypeDesc;
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNode;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * DeserializationContext
+ */
+public class DeserializationContext {
+    public static final String SOAP12_REF_ATTR = "ref";
+    public static final String SOAP11_REF_ATTR = "href";
+
+    private Map idToElementMap = new HashMap();
+
+    Map waitingDescs = new HashMap();
+    String refAttr = SOAP12_REF_ATTR;
+
+    public OMElement getMultiref(String id) {
+        return (OMElement)idToElementMap.get(id);
+    }
+
+    public void addMultiref(String id, OMElement element) {
+        idToElementMap.put(id, element);
+    }
+
+    public void addWaitingDesc(String id, Deserializer dser) {
+        ArrayList descs = (ArrayList)waitingDescs.get(id);
+        if (descs == null) {
+            descs = new ArrayList();
+            waitingDescs.put(id, descs);
+        }
+        descs.add(dser);
+    }
+
+    public void idFound(String id, OMElement element) throws Exception {
+        ArrayList descs = (ArrayList)waitingDescs.get(id);
+        if (descs == null)
+            return; // nobody cares
+        for (Iterator i = descs.iterator(); i.hasNext();) {
+            Deserializer dser = (Deserializer) i.next();
+            dser.deserialize(element.getXMLStreamReader(), this);
+        }
+        waitingDescs.remove(id);
+    }
+
+    public void deserialize(XMLStreamReader reader, Deserializer dser)
+            throws Exception {
+        int event = reader.getEventType();
+        if (event == XMLStreamConstants.START_DOCUMENT) {
+            event = reader.next();
+        }
+        if (event == XMLStreamConstants.START_ELEMENT) {
+            int numAttrs = reader.getAttributeCount();
+            if (numAttrs > 0) {
+                String ref = reader.getAttributeValue("", refAttr);
+                if (ref != null) {
+                    // this is a reference.
+                    if (ref.charAt(0) == '#') {
+                        // It's local
+                        ref = ref.substring(1);
+                    }
+                    OMElement refElement = getMultiref(ref);
+                    if (refElement != null) {
+                        // Deserialize this one
+                        reader = refElement.getXMLStreamReader();
+                    } else {
+                        addWaitingDesc(ref, dser);
+                        return;
+                    }
+                }
+            }
+        }
+
+        dser.deserialize(reader, this);
+    }
+
+    public boolean isIncomplete() {
+        return !waitingDescs.isEmpty();
+    }
+
+    public void processRest(OMElement rpcElement) throws Exception {
+        // The siblings of this should be SOAP 1.1 independent elements
+        OMNode nextElement = rpcElement.getNextOMSibling();
+        while (nextElement != null) {
+            if (nextElement instanceof OMElement) {
+                OMAttribute idAttr =
+                        ((OMElement)nextElement).getAttribute(new QName("id"));
+                if (idAttr != null) {
+                    idFound(idAttr.getAttributeValue(), (OMElement)nextElement);
+                }
+            }
+            nextElement = nextElement.getNextOMSibling();
+        }
+    }
+
+    public Object deserializeToClass(XMLStreamReader reader,
+                                     Class javaClass) throws Exception {
+
+        TypeDesc typeDesc = BeanManager.getTypeDesc(javaClass);
+        Deserializer dser = new BeanDeserializer(typeDesc);
+
+        // Now make sure there's somewhere to put the deserialized object
+        SimpleTarget target = new SimpleTarget();
+        dser.setTarget(target);
+
+        // Good to go.
+        dser.deserialize(reader, this);
+        return target.getValue();
+    }
+
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationTarget.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationTarget.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationTarget.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializationTarget.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+/**
+ * A DeserializationTarget is anything that receives a value from a
+ * Deserializer.  Typical DeserializationTargets are things like RPC parameters,
+ * fields in a JavaBean, and items in an array.
+ * 
+ * Since the deserialization system deals with multirefs that potentially
+ * point to values further forward in the data stream, we always use instances
+ * of this interface to set values.  This allows the deserialization framework
+ * to store the targets and fill them in later if necessary.
+ */
+public interface DeserializationTarget {
+    void setValue(Object value) throws Exception;
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Deserializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Deserializer.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Deserializer.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Deserializer.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Deserializer
+ */
+public interface Deserializer {
+    public void deserialize(XMLStreamReader reader,
+                            DeserializationContext context) throws Exception;
+    public void setTarget(DeserializationTarget target);
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializerFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializerFactory.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializerFactory.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/DeserializerFactory.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+/**
+ * DeserializerFactory
+ */
+public interface DeserializerFactory {
+    public Deserializer getDeserializer();
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Holder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Holder.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Holder.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Holder.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+/**
+ * Interface Holder
+ */
+public interface Holder {
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/MultiTarget.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/MultiTarget.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/MultiTarget.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/MultiTarget.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * A MultiTarget aggregates a bunch of targets into a single one.
+ * This is used, for instance, when multiple targets are waiting for a single SOAP
+ * multiref deserialization.
+ */
+public class MultiTarget implements DeserializationTarget {
+    ArrayList targets = new ArrayList();
+
+    /**
+     * Adds a target to the list of targets which will be updated when
+     * we receive a value.
+     *
+     * @param target
+     */
+    public void addTarget(DeserializationTarget target) {
+        targets.add(target);
+    }
+
+    public void setValue(Object value) throws Exception {
+        for (Iterator i = targets.iterator(); i.hasNext();) {
+            DeserializationTarget target = (DeserializationTarget) i.next();
+            target.setValue(value);
+        }
+    }
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializationContext.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializationContext.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializationContext.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,219 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.commons.schema.constants.Constants;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * SerializationContext
+ */
+public class SerializationContext {
+
+    protected Log log = LogFactory.getLog(getClass());
+
+
+    // Multiref modes
+    public static final int NO_MULTIREFS = 0;
+    public static final int SOAP11_MULTIREFS = 1;
+    public static final int SOAP12_MULTIREFS = 2;
+
+    // Null handling modes
+    public static final int NULL_OMIT = 0;
+    public static final int NULL_NILLABLE = 1;
+
+    static final QName MULTIREF_QNAME = new QName("MultiRef");
+
+    Map multirefObjects;
+    ArrayList multirefsToWrite;
+
+    int multirefs = NO_MULTIREFS;
+    int lastID = 0;
+    boolean writingMultirefs = true;
+
+    class Multiref {
+        Object value;
+        String id;
+        Serializer serializer;
+    }
+
+    XMLStreamWriter writer;
+
+    public SerializationContext(XMLStreamWriter writer) {
+        this.writer = writer;
+    }
+
+    public void setMultirefBehavior(int multiref) {
+        this.multirefs = multiref;
+    }
+
+    public void finish() throws Exception {
+        while (multirefsToWrite != null) {
+            // Writing actual data...
+            writingMultirefs = false;
+
+            ArrayList currentMultirefs = multirefsToWrite;
+            multirefsToWrite = null;
+
+            for (Iterator i = currentMultirefs.iterator(); i.hasNext();) {
+                Multiref ref = (Multiref)i.next();
+                writer.writeStartElement(MULTIREF_QNAME.getNamespaceURI(),
+                                         MULTIREF_QNAME.getLocalPart());
+                writer.writeAttribute("id", ref.id);
+                ref.serializer.serializeData(ref.value, this);
+            }
+        }
+    }
+
+    public void serializeElement(QName qname,
+                                 Object obj,
+                                 Serializer serializer) throws Exception {
+        serializeElement(qname, obj, NULL_OMIT, serializer);
+    }
+
+    public void serializeElement(QName qname,
+                                 Object obj,
+                                 int nullHandlingMode,
+                                 Serializer serializer) throws Exception {
+        if (obj == null) {
+            switch (nullHandlingMode) {
+                case NULL_NILLABLE:
+                    // write xsi:nil
+                    writer.writeStartElement(qname.getNamespaceURI(), qname.getLocalPart());
+                    writer.writeAttribute(Constants.URI_2001_SCHEMA_XSI,
+                                          "nil",
+                                          "true");
+                    writer.writeEndElement();
+                default:
+                    return;
+            }
+
+        }
+
+        writer.writeStartElement(qname.getNamespaceURI(), qname.getLocalPart());
+        serializer.serialize(obj, this);
+    }
+
+    public void serializeData(Object obj, Serializer ser) throws Exception {
+        ser.serialize(obj, this);
+    }
+
+    public boolean checkMultiref(Object obj, Serializer serializer)
+            throws Exception {
+        switch (multirefs) {
+            case SOAP11_MULTIREFS: {
+                String id = getSOAP11IDForObject(obj, serializer);
+                writer.writeAttribute("href", "#" + id);
+                writer.writeEndElement();
+                return true;
+            }
+            case SOAP12_MULTIREFS: {
+                String id = getSOAP12IDForObject(obj);
+                if (id != null) {
+                    writer.writeAttribute("ref", "#" + id);
+                    writer.writeEndElement();
+                    return true;
+                }
+                id = getNewIDForObject(obj, serializer);
+                writer.writeAttribute("id", id);
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Obtains an ID for this object, which will be written (according to the
+     * SOAP 1.1 multiref rules) as an independent element at the end of the
+     * SOAP body
+     *
+     * @param obj
+     * @return Returns an ID, always - either a new one or a previously registered one.
+     */
+    public String getSOAP11IDForObject(Object obj, Serializer serializer) {
+        if (multirefObjects != null) {
+            String id = (String)multirefObjects.get(obj);
+            if (id != null) return id;
+        }
+
+        return getNewIDForObject(obj, serializer);
+    }
+
+    public String getSOAP12IDForObject(Object obj) {
+        if (multirefObjects == null) return null;
+        return (String)multirefObjects.get(obj);
+    }
+
+    public String getNewIDForObject(Object obj, Serializer serializer) {
+        if (multirefObjects == null)
+            multirefObjects = new HashMap();
+        lastID++;
+        String id = "" + lastID;
+        multirefObjects.put(obj, id);
+
+        if (multirefs == SOAP11_MULTIREFS) {
+            if (multirefsToWrite == null)
+                multirefsToWrite = new ArrayList();
+            Multiref ref = new Multiref();
+            ref.id = id;
+            ref.value = obj;
+            ref.serializer = serializer;
+            multirefsToWrite.add(ref);
+        }
+
+        return "" + lastID;
+    }
+
+    public XMLStreamWriter getWriter() {
+        return writer;
+    }
+
+    public String qName2String(QName qname) {
+        return qName2String(qname, true);
+    }
+
+    public String qName2String(QName qname, boolean doDefault) {
+        String ns = qname.getNamespaceURI();
+        try {
+            String prefix = writer.getPrefix(ns);
+            if (prefix != null) {
+                // Got a prefix
+                return prefix + ":" + qname.getLocalPart();
+            } else if ("".equals(prefix)) {
+                if (doDefault) {
+                    // Default namespace, no prefix
+                    return qname.getLocalPart();
+                }
+
+            } else {
+                // need to map this NS
+                writer.writeNamespace(prefix, ns);
+            }
+        } catch (XMLStreamException e) {
+            log.error(e.getMessage(), e);
+        }
+        return null;
+    }
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Serializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Serializer.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Serializer.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/Serializer.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+/**
+ * Serializer
+ */
+public interface Serializer {
+    void serialize(Object object, SerializationContext context)
+            throws Exception;
+    void serializeData(Object object, SerializationContext context)
+            throws Exception;
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializerFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializerFactory.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializerFactory.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SerializerFactory.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.databinding;
+
+/**
+ * SerializerFactory
+ */
+public interface SerializerFactory {
+    public Serializer getSerializer() throws Exception;
+}

Added: webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SimpleTarget.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SimpleTarget.java?rev=374072&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SimpleTarget.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ADB-NotUsed/src/org/apache/axis2/databinding/SimpleTarget.java Wed Feb  1 06:17:03 2006
@@ -0,0 +1,31 @@
+/*
+* Copyright 2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.databinding;
+
+/**
+ * SimpleTarget
+ */
+public class SimpleTarget implements DeserializationTarget {
+    Object value;
+
+    public void setValue(Object value) throws Exception {
+        this.value = value;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+}