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 gd...@apache.org on 2005/09/08 04:39:30 UTC

svn commit: r279491 [1/2] - in /webservices/axis2/trunk/java: ./ modules/databinding/ modules/databinding/src/ modules/databinding/src/org/ modules/databinding/src/org/apache/ modules/databinding/src/org/apache/axis2/ modules/databinding/src/org/apache...

Author: gdaniels
Date: Wed Sep  7 19:39:15 2005
New Revision: 279491

URL: http://svn.apache.org/viewcvs?rev=279491&view=rev
Log:
Preliminary support for simple databinding.  See databinding/readme.txt for details.

This is JUST the runtime portion, and relies on something (right now just hardcoding) to set up the metadata which binds XML descriptions to Java objects.  Next steps are to get this hooked in to the WSDL reader and code generator, and enable the soapbuilders RPC tests.


Added:
    webservices/axis2/trunk/java/modules/databinding/
    webservices/axis2/trunk/java/modules/databinding/maven.xml
    webservices/axis2/trunk/java/modules/databinding/project.properties
    webservices/axis2/trunk/java/modules/databinding/project.xml
    webservices/axis2/trunk/java/modules/databinding/readme.txt
    webservices/axis2/trunk/java/modules/databinding/src/
    webservices/axis2/trunk/java/modules/databinding/src/org/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationContext.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationTarget.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Deserializer.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializerFactory.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Holder.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/MultiTarget.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Serializer.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializerFactory.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/beans/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/beans/BeanPropertyDescriptor.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializer.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializerFactory.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/CollectionDeserializer.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializer.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializerFactory.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/AttributeDesc.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/BeanManager.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/ElementDesc.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldAccessor.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldDesc.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedAccessorWrapper.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedFieldAccessor.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/TypeDesc.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/serializers/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/serializers/AbstractSerializer.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/serializers/BeanSerializer.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/serializers/CollectionSerializer.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/serializers/SimpleSerializer.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/typemapping/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/typemapping/TypeMappingRegistry.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/utils/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/utils/Converter.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/rpc/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/rpc/RPCInOutMessageReceiver.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/rpc/RPCMethod.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/rpc/RPCParameter.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/rpc/RPCRequestElement.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/rpc/RPCResponseElement.java
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/util/
    webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/util/MethodCache.java
    webservices/axis2/trunk/java/modules/databinding/test/
    webservices/axis2/trunk/java/modules/databinding/test-resources/
    webservices/axis2/trunk/java/modules/databinding/test-resources/xmls/
    webservices/axis2/trunk/java/modules/databinding/test-resources/xmls/array1.xml
    webservices/axis2/trunk/java/modules/databinding/test/org/
    webservices/axis2/trunk/java/modules/databinding/test/org/apache/
    webservices/axis2/trunk/java/modules/databinding/test/org/apache/axis2/
    webservices/axis2/trunk/java/modules/databinding/test/org/apache/axis2/databinding/
    webservices/axis2/trunk/java/modules/databinding/test/org/apache/axis2/databinding/ArrayTest.java
Modified:
    webservices/axis2/trunk/java/modules/wsdl/project.properties
    webservices/axis2/trunk/java/modules/wsdl/project.xml
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java
    webservices/axis2/trunk/java/project.properties

Added: webservices/axis2/trunk/java/modules/databinding/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/maven.xml?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/maven.xml (added)
+++ webservices/axis2/trunk/java/modules/databinding/maven.xml Wed Sep  7 19:39:15 2005
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Revision: 1.21 $ $Date: 2004-10-27 20:54:09 +0600 (Wed, 27 Oct 2004) $ -->
+
+<project default="jar"
+    xmlns:j="jelly:core"
+    xmlns:maven="jelly:maven"
+    xmlns:deploy="deploy"
+    xmlns:ant="jelly:ant">
+</project>

Added: webservices/axis2/trunk/java/modules/databinding/project.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/project.properties?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/project.properties (added)
+++ webservices/axis2/trunk/java/modules/databinding/project.properties Wed Sep  7 19:39:15 2005
@@ -0,0 +1,18 @@
+# -------------------------------------------------------------------
+# 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.
+# -------------------------------------------------------------------
+
+maven.repo.remote=http://cvs.apache.org/repository/, http://www.ibiblio.org/maven,http://www.apache.org/dist/java-repository/,http://people.apache.org/~gdaniels/maven/
+maven.multiproject.type=jar

Added: webservices/axis2/trunk/java/modules/databinding/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/project.xml?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/project.xml (added)
+++ webservices/axis2/trunk/java/modules/databinding/project.xml Wed Sep  7 19:39:15 2005
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * 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.
+ */
+ -->
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <id>axis2-databinding</id>
+    <name>databinding</name>
+    <description>Simple data binding implementation</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>axis</groupId>
+            <artifactId>axis2-xml</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>axis</groupId>
+            <artifactId>axis2-common</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>axis2</groupId>
+            <artifactId>axis2-core</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
+            <groupId>axis</groupId>
+            <artifactId>XmlSchema</artifactId>
+			<version>SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-activation</artifactId>
+            <version>1.0.2-rc4</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.0.3</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax</artifactId>
+            <version>1.1.1-dev</version>
+            <properties>
+                <module>true</module>
+            </properties>
+            <url>http://dist.codehaus.org/stax/jars/</url>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.8</version>
+            <properties>
+                <module>true</module>
+            </properties>
+            <url>http://dist.codehaus.org/stax/jars/</url>
+        </dependency>
+
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+            <version>1.0</version>
+            <properties>
+                <module>true</module>
+            </properties>
+            <url>http://dist.codehaus.org/stax/jars/</url>
+        </dependency>
+    </dependencies>
+
+    <reports/>
+</project>

Added: webservices/axis2/trunk/java/modules/databinding/readme.txt
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/readme.txt?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/readme.txt (added)
+++ webservices/axis2/trunk/java/modules/databinding/readme.txt Wed Sep  7 19:39:15 2005
@@ -0,0 +1,56 @@
+This module is the runtime portion of a basic XML<->Java databinding system
+for Axis2.  Its features include:
+
+* Metadata-based serialization and deserialization
+* Automatic multi-ref handling for SOAP encoding (SOAP 1.1 / 1.2)
+* RPC style message receiver
+
+SERIALIZING
+
+The SerializationContext (org.apache.axis2.databinding.SerializationContext) is
+the main entry point class for serializing Java to XML.  A SerializationContext
+is associated with a StAX XMLStreamWriter at construction time:
+
+  SerializationContext sc = new SerializationContext(writer);
+
+The most important externally-accessible method is "serializeElement(qname,
+value, serializer)".  This method will use the passed Serializer to write
+the passed value to the XML writer, using the passed QName as the element name.
+A Serializer is a class implementing org.apache.axis2.databinding.Serializer,
+whose responsibility is to write well-known kinds of data to a
+SerializationContext/XMLStreamWriter.
+
+In Axis 1.X, the SerializationContext would choose the Serializer to use
+itself based on an active set of type mappings.  This worked great for many
+cases, but as it turns out there are also context-dependent situations where
+the type mapping isn't good enough - this is particularly common with certain
+kinds of array/collection processing.  In Axis 2, therefore, each serialization
+call allows a reference to the Serializer.
+
+DESERIALIZATION:
+
+As the SerializationContext is the main focus for serializing Java to XML, the
+DeserializationContext is the focus for deserializing XML to Java.
+
+  context.deserialize(xmlStreamReader, deserializer)
+
+The first thing to note is that this method has no return value - so where
+does the deserialized data go?  The deserialization system is based on the
+idea of "targets" - these are "push based" objects whose job in life it is
+to recieve deserialized values from Deserializers.  So once you set up the
+appropriate target in a Deserializer, all you need to do is hand it to the
+DeserializationContext.deserialize() method and your value will be put in
+the appropriate place.
+
+Still TODO:
+
+* Nested collections/arrays
+* SOAP arrayType processing
+* Produce/handle xsi:types
+* Holder implementation for inouts
+* Associate TypeDesc with Java classes via static data
+* The WSDL / Schema portion (translate schemas into generated classes
+   with TypeDescs, and vice versa.  Also handle RPC style stubs/skels.)
+* Tests!
+* Finish this file :) (move a bunch of it to real documentation)
+

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationContext.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationContext.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationContext.java Wed Sep  7 19:39:15 2005
@@ -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 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.getNextSibling();
+        while (nextElement != null) {
+            if (nextElement instanceof OMElement) {
+                OMAttribute idAttr =
+                        ((OMElement)nextElement).getAttribute(new QName("id"));
+                if (idAttr != null) {
+                    idFound(idAttr.getValue(), (OMElement)nextElement);
+                }
+            }
+            nextElement = nextElement.getNextSibling();
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationTarget.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationTarget.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationTarget.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializationTarget.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,30 @@
+/*
+* 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/java/modules/databinding/src/org/apache/axis2/databinding/Deserializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Deserializer.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Deserializer.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Deserializer.java Wed Sep  7 19:39:15 2005
@@ -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;
+
+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/java/modules/databinding/src/org/apache/axis2/databinding/DeserializerFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializerFactory.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializerFactory.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/DeserializerFactory.java Wed Sep  7 19:39:15 2005
@@ -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;
+
+/**
+ * DeserializerFactory
+ */
+public interface DeserializerFactory {
+    public Deserializer getDeserializer();
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Holder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Holder.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Holder.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Holder.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,22 @@
+/*
+* 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;
+
+/**
+ * Holder
+ */
+public interface Holder {
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/MultiTarget.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/MultiTarget.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/MultiTarget.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/MultiTarget.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,45 @@
+/*
+* 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 when multiple targets are waiting for a single SOAP
+ * multiref deserialization, for instance.
+ */
+public class MultiTarget implements DeserializationTarget {
+    ArrayList targets = new ArrayList();
+
+    /**
+     * Add 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/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializationContext.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,193 @@
+/*
+* 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.namespace.QName;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.ArrayList;
+
+/**
+ * SerializationContext
+ */
+public class SerializationContext {
+    public static final int NO_MULTIREFS = 0;
+    public static final int SOAP11_MULTIREFS = 1;
+    public static final int SOAP12_MULTIREFS = 2;
+
+    static final QName MULTIREF_QNAME = new QName("MultiRef");
+
+    Map multirefObjects = null;
+    ArrayList multirefsToWrite = null;
+
+    int multirefs = NO_MULTIREFS;
+    int lastID = 0;
+    boolean writingMultirefs = true;
+
+    class Multiref {
+        Object value;
+        String id;
+        Serializer serializer;
+    }
+
+    XMLStreamWriter writer = null;
+
+    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 {
+        writer.writeStartElement(qname.getNamespaceURI(), qname.getLocalPart());
+//        if (attributes != null) {
+//            for (Iterator i = attributes.keySet().iterator(); i.hasNext();) {
+//                QName attrQName = (QName) i.next();
+//                writer.writeAttribute(attrQName.getNamespaceURI(),
+//                                      attrQName.getLocalPart(),
+//                                      (String)attributes.get(attrQName));
+//            }
+//        }
+        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;
+    }
+
+    /**
+     * Obtain 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 - see finish()).
+     *
+     * @param obj
+     * @return 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();
+        NamespaceContext ctx = writer.getNamespaceContext();
+        try {
+            String prefix = writer.getPrefix(ns);
+            if (prefix != null) {
+                // Got a prefix
+                return prefix + ":" + qname.getLocalPart();
+            } else if (prefix.equals("")) {
+                if (doDefault) {
+                    // Default namespace, no prefix
+                    return qname.getLocalPart();
+                }
+
+            } else {
+                // need to map this NS
+                writer.writeNamespace(prefix, ns);
+            }
+        } catch (XMLStreamException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        return null;
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Serializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Serializer.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Serializer.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/Serializer.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,29 @@
+/*
+* 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.om.OMElement;
+import org.apache.axis2.AxisFault;
+
+/**
+ * Serializer
+ */
+public interface Serializer {
+    void serialize(Object object, SerializationContext context)
+            throws Exception;
+    void serializeData(Object object, SerializationContext context)
+            throws Exception;
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializerFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializerFactory.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializerFactory.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/SerializerFactory.java Wed Sep  7 19:39:15 2005
@@ -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;
+
+/**
+ * SerializerFactory
+ */
+public interface SerializerFactory {
+    public Serializer getSerializer() throws Exception;
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/beans/BeanPropertyDescriptor.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/beans/BeanPropertyDescriptor.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/beans/BeanPropertyDescriptor.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/beans/BeanPropertyDescriptor.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,84 @@
+/*
+* 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.beans;
+
+import org.apache.axis2.databinding.metadata.FieldAccessor;
+import org.apache.axis2.databinding.metadata.IndexedFieldAccessor;
+
+import java.lang.reflect.Method;
+
+/**
+ * BeanPropertyDescriptor
+ */
+public class BeanPropertyDescriptor implements FieldAccessor, IndexedFieldAccessor {
+    Method readMethod;
+    Method writeMethod;
+    Method indexedReadMethod;
+    Method indexedWriteMethod;
+
+    public Method getReadMethod() {
+        return readMethod;
+    }
+
+    public void setReadMethod(Method readMethod) {
+        this.readMethod = readMethod;
+    }
+
+    public Method getWriteMethod() {
+        return writeMethod;
+    }
+
+    public void setWriteMethod(Method writeMethod) {
+        this.writeMethod = writeMethod;
+    }
+
+    public Method getIndexedReadMethod() {
+        return indexedReadMethod;
+    }
+
+    public void setIndexedReadMethod(Method indexedReadMethod) {
+        this.indexedReadMethod = indexedReadMethod;
+    }
+
+    public Method getIndexedWriteMethod() {
+        return indexedWriteMethod;
+    }
+
+    public void setIndexedWriteMethod(Method indexedWriteMethod) {
+        this.indexedWriteMethod = indexedWriteMethod;
+    }
+
+    public Object getValue(Object targetObject) throws Exception {
+        return readMethod.invoke(targetObject, null);
+    }
+
+    public void setValue(Object targetObject, Object value) throws Exception {
+        writeMethod.invoke(targetObject, new Object [] { value });
+    }
+    
+    public Object getIndexedValue(Object targetObject, int index)
+            throws Exception {
+        return indexedReadMethod.invoke(targetObject,
+                                        new Object [] { new Integer(index) });
+    }
+
+    public void setIndexedValue(Object targetObject,
+                                Object value,
+                                int index) throws Exception {
+        indexedWriteMethod.invoke(targetObject,
+                                  new Object [] { new Integer(index), value });
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializer.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializer.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializer.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,101 @@
+/*
+* 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.deserializers;
+
+import org.apache.axis2.databinding.DeserializationContext;
+import org.apache.axis2.databinding.Deserializer;
+import org.apache.axis2.databinding.DeserializationTarget;
+import org.apache.axis2.databinding.metadata.TypeDesc;
+import org.apache.axis2.databinding.metadata.AttributeDesc;
+import org.apache.axis2.databinding.metadata.ElementDesc;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * BeanDeserializer
+ */
+public class BeanDeserializer implements Deserializer {
+    private DeserializationTarget target;
+
+    TypeDesc typeDesc;
+    Object targetObject;
+    Class javaClass;
+
+    public BeanDeserializer(TypeDesc typeDesc) {
+        this.typeDesc = typeDesc;
+        this.javaClass = typeDesc.getJavaClass();
+    }
+
+    public void deserialize(XMLStreamReader reader,
+                            DeserializationContext context) throws Exception {
+        targetObject = createTargetObject();
+        Map elementCounts = new HashMap();
+
+        // Get the attributes
+        for (Iterator i = typeDesc.getAttributeDescs(); i.hasNext();) {
+            AttributeDesc attrDesc = (AttributeDesc)i.next();
+            QName qname = attrDesc.getQName();
+            String val = reader.getAttributeValue(qname.getNamespaceURI(),
+                                                  qname.getLocalPart());
+            if (val != null) {
+                Object value =
+                        ((SimpleDeserializer)attrDesc.getDeserializer(0)).
+                        makeValue(val);
+                attrDesc.setValue(targetObject, value);
+            }
+        }
+
+        boolean done = false;
+        while (!done) {
+            int event = reader.next();
+            if (event == XMLStreamConstants.END_ELEMENT) {
+                target.setValue(targetObject);
+                return;
+            }
+            if (event == XMLStreamConstants.END_DOCUMENT) {
+                throw new Exception("Unfinished element!");
+            }
+
+            if (event == XMLStreamConstants.START_ELEMENT) {
+                // Work through the child elements
+                QName elementName = reader.getName();
+                ElementDesc desc = typeDesc.getElementDesc(elementName);
+                if (desc != null) {
+                    Integer count = (Integer)elementCounts.get(elementName);
+                    if (count == null) count = new Integer(0);
+                    elementCounts.put(elementName,
+                                      new Integer(count.intValue() + 1));
+                    Deserializer dser =
+                            desc.getDeserializer(count.intValue(), targetObject);
+                    context.deserialize(reader, dser);
+                }
+            }
+        }
+    }
+
+    private Object createTargetObject() throws Exception {
+        return javaClass.newInstance();
+    }
+
+    public void setTarget(DeserializationTarget target) {
+        this.target = target;
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializerFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializerFactory.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializerFactory.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/BeanDeserializerFactory.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,35 @@
+/*
+* 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.deserializers;
+
+import org.apache.axis2.databinding.DeserializerFactory;
+import org.apache.axis2.databinding.Deserializer;
+import org.apache.axis2.databinding.metadata.TypeDesc;
+
+/**
+ * BeanDeserializerFactory
+ */
+public class BeanDeserializerFactory implements DeserializerFactory {
+    TypeDesc typeDesc;
+
+    public BeanDeserializerFactory(TypeDesc typeDesc) {
+        this.typeDesc = typeDesc;
+    }
+
+    public Deserializer getDeserializer() {
+        return new BeanDeserializer(typeDesc);
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/CollectionDeserializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/CollectionDeserializer.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/CollectionDeserializer.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/CollectionDeserializer.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,41 @@
+/*
+* 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.deserializers;
+
+import org.apache.axis2.databinding.Deserializer;
+import org.apache.axis2.databinding.DeserializationContext;
+import org.apache.axis2.databinding.DeserializationTarget;
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * CollectionDeserializer
+ */
+public class CollectionDeserializer implements Deserializer {
+    Deserializer itemDeserializer;
+
+    public void deserialize(XMLStreamReader reader, DeserializationContext context) throws Exception {
+        // strip the wrapper element.
+        reader.next();
+
+        // Now deserialize each inner element
+        itemDeserializer.deserialize(reader, context);
+    }
+
+    public void setTarget(DeserializationTarget target) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializer.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializer.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializer.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,351 @@
+/*
+* 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.deserializers;
+
+import org.apache.axis2.databinding.DeserializationTarget;
+import org.apache.axis2.databinding.DeserializationContext;
+import org.apache.axis2.databinding.Deserializer;
+import org.apache.axis2.databinding.metadata.TypeDesc;
+import org.apache.axis2.i18n.Messages;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamConstants;
+import java.lang.reflect.Constructor;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.GregorianCalendar;
+import java.text.SimpleDateFormat;
+
+/**
+ * SimpleDeserializer
+ */
+public class SimpleDeserializer implements Deserializer {
+    private static SimpleDateFormat zulu =
+            new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+    //  0123456789 0 123456789
+
+    static {
+        zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
+    }
+
+    private static final Class[] STRING_STRING_CLASS =
+        new Class [] {String.class, String.class};
+
+    public static final Class[] STRING_CLASS =
+        new Class [] {String.class};
+
+    Class javaType;
+    QName xmlType;
+    Constructor constructor;
+    XMLStreamReader reader;
+    TypeDesc typeDesc;
+    DeserializationTarget target;
+
+    public SimpleDeserializer(Class javaType, QName xmlType) {
+        this.javaType = javaType;
+        this.xmlType = xmlType;
+    }
+
+    public void setTypeDesc(TypeDesc typeDesc) {
+        this.typeDesc = typeDesc;
+    }
+
+    public void setTarget(DeserializationTarget target) {
+        this.target = target;
+    }
+
+    public void deserialize(XMLStreamReader reader,
+                            DeserializationContext context) throws Exception {
+        this.reader = reader;
+        // We're expecting text and then an end element.
+        int eventType;
+        String text = new String();
+        while ((eventType = reader.next()) != XMLStreamConstants.END_DOCUMENT) {
+            if (eventType == XMLStreamConstants.START_ELEMENT) {
+                int numAttrs = reader.getAttributeCount();
+                eventType = reader.next();
+                System.out.println("There are " + numAttrs + " attr(s)");
+            }
+            if (eventType == XMLStreamConstants.CHARACTERS) {
+                text = text.concat(reader.getText());
+            }
+            if (eventType == XMLStreamConstants.END_ELEMENT) {
+                // End of element
+                target.setValue(makeValue(text));
+                return;
+            }
+        }
+        throw new Exception("End of document reached prematurely!");
+    }
+
+    /**
+     * Convert the string that has been accumulated into an Object.  Subclasses
+     * may override this.  Note that if the javaType is a primitive, the returned
+     * object is a wrapper class.
+     * @param source the serialized value to be deserialized
+     * @throws Exception any exception thrown by this method will be wrapped
+     */
+    public Object makeValue(String source) throws Exception
+    {
+        if (javaType == java.lang.String.class) {
+            return source;
+        }
+
+        // Trim whitespace if non-String
+        source = source.trim();
+
+        if (source.length() == 0) {
+            return null;
+        }
+
+        // if constructor is set skip all basic java type checks
+        if (this.constructor == null) {
+            Object value = makeBasicValue(source);
+            if (value != null) {
+                return value;
+            }
+        }
+
+        Object [] args = null;
+
+        boolean isQNameSubclass = QName.class.isAssignableFrom(javaType);
+
+        if (isQNameSubclass) {
+            int colon = source.lastIndexOf(":");
+            String namespace = colon < 0 ? "" :
+                reader.getNamespaceURI(source.substring(0, colon));
+            String localPart = colon < 0 ? source : source.substring(colon + 1);
+            args = new Object [] {namespace, localPart};
+        }
+
+        if (constructor == null) {
+            try {
+                if (isQNameSubclass) {
+                    constructor =
+                        javaType.getDeclaredConstructor(STRING_STRING_CLASS);
+                } else {
+                    constructor =
+                        javaType.getDeclaredConstructor(STRING_CLASS);
+                }
+            } catch (Exception e) {
+                return null;
+            }
+        }
+
+        if(constructor.getParameterTypes().length==0){
+            try {
+                Object obj = constructor.newInstance(new Object[]{});
+                obj.getClass().getMethod("set_value", new Class[]{String.class})
+                        .invoke(obj, new Object[]{source});
+                return obj;
+            } catch (Exception e){
+                //Ignore exception
+            }
+        }
+        if (args == null) {
+            args = new Object[]{source};
+        }
+        return constructor.newInstance(args);
+    }
+
+    private Object makeBasicValue(String source) throws Exception {
+        // If the javaType is a boolean, except a number of different sources
+        if (javaType == boolean.class ||
+            javaType == Boolean.class) {
+            // This is a pretty lame test, but it is what the previous code did.
+            switch (source.charAt(0)) {
+                case '0': case 'f': case 'F':
+                    return Boolean.FALSE;
+
+                case '1': case 't': case 'T':
+                    return Boolean.TRUE;
+
+                default:
+                    throw new NumberFormatException("Bad boolean expression");
+                }
+
+        }
+
+        // If expecting a Float or a Double, need to accept some special cases.
+        if (javaType == float.class ||
+            javaType == java.lang.Float.class) {
+            if (source.equals("NaN")) {
+                return new Float(Float.NaN);
+            } else if (source.equals("INF")) {
+                return new Float(Float.POSITIVE_INFINITY);
+            } else if (source.equals("-INF")) {
+                return new Float(Float.NEGATIVE_INFINITY);
+            } else {
+                return new Float(source);
+            }
+        }
+
+        if (javaType == double.class ||
+            javaType == java.lang.Double.class) {
+            if (source.equals("NaN")) {
+                return new Double(Double.NaN);
+            } else if (source.equals("INF")) {
+                return new Double(Double.POSITIVE_INFINITY);
+            } else if (source.equals("-INF")) {
+                return new Double(Double.NEGATIVE_INFINITY);
+            } else {
+                return new Double(source);
+            }
+        }
+
+        if (javaType == int.class ||
+            javaType == java.lang.Integer.class) {
+            return new Integer(source);
+        }
+
+        if (javaType == short.class ||
+            javaType == java.lang.Short.class) {
+            return new Short(source);
+        }
+
+        if (javaType == long.class ||
+            javaType == java.lang.Long.class) {
+            return new Long(source);
+        }
+
+        if (javaType == byte.class ||
+            javaType == java.lang.Byte.class) {
+            return new Byte(source);
+        }
+
+/*
+        if (javaType == org.apache.axis.types.URI.class) {
+            return new org.apache.axis.types.URI(source);
+        }
+*/
+
+        if (javaType == Calendar.class) {
+            return makeCalendar(source, false);
+        }
+
+        return null;
+    }
+
+    public static Object makeCalendar(String source, boolean returnDate) {
+        Calendar calendar = Calendar.getInstance();
+        Date date;
+        boolean bc = false;
+
+        // validate fixed portion of format
+        if (source == null || source.length() == 0) {
+            throw new NumberFormatException(
+                    Messages.getMessage("badDateTime00"));
+        }
+        if (source.charAt(0) == '+') {
+            source = source.substring(1);
+        }
+        if (source.charAt(0) == '-') {
+            source = source.substring(1);
+            bc = true;
+        }
+        if (source.length() < 19) {
+            throw new NumberFormatException(
+                    Messages.getMessage("badDateTime00"));
+        }
+        if (source.charAt(4) != '-' || source.charAt(7) != '-' ||
+                source.charAt(10) != 'T') {
+            throw new NumberFormatException(Messages.getMessage("badDate00"));
+        }
+        if (source.charAt(13) != ':' || source.charAt(16) != ':') {
+            throw new NumberFormatException(Messages.getMessage("badTime00"));
+        }
+        // convert what we have validated so far
+        try {
+            synchronized (zulu) {
+                date = zulu.parse(source.substring(0, 19) + ".000Z");
+            }
+        } catch (Exception e) {
+            throw new NumberFormatException(e.toString());
+        }
+        int pos = 19;
+
+        // parse optional milliseconds
+        if (pos < source.length() && source.charAt(pos) == '.') {
+            int milliseconds = 0;
+            int start = ++pos;
+            while (pos < source.length() &&
+                    Character.isDigit(source.charAt(pos))) {
+                pos++;
+            }
+            String decimal = source.substring(start, pos);
+            if (decimal.length() == 3) {
+                milliseconds = Integer.parseInt(decimal);
+            } else if (decimal.length() < 3) {
+                milliseconds = Integer.parseInt((decimal + "000")
+                        .substring(0, 3));
+            } else {
+                milliseconds = Integer.parseInt(decimal.substring(0, 3));
+                if (decimal.charAt(3) >= '5') {
+                    ++milliseconds;
+                }
+            }
+
+            // add milliseconds to the current date
+            date.setTime(date.getTime() + milliseconds);
+        }
+
+        // parse optional timezone
+        if (pos + 5 < source.length() &&
+                (source.charAt(pos) == '+' || (source.charAt(pos) == '-'))) {
+            if (!Character.isDigit(source.charAt(pos + 1)) ||
+                    !Character.isDigit(source.charAt(pos + 2)) ||
+                    source.charAt(pos + 3) != ':' ||
+                    !Character.isDigit(source.charAt(pos + 4)) ||
+                    !Character.isDigit(source.charAt(pos + 5))) {
+                throw new NumberFormatException(
+                        Messages.getMessage("badTimezone00"));
+            }
+            int hours = (source.charAt(pos + 1) - '0') * 10
+                    + source.charAt(pos + 2) - '0';
+            int mins = (source.charAt(pos + 4) - '0') * 10
+                    + source.charAt(pos + 5) - '0';
+            int milliseconds = (hours * 60 + mins) * 60 * 1000;
+
+            // subtract milliseconds from current date to obtain GMT
+            if (source.charAt(pos) == '+') {
+                milliseconds = -milliseconds;
+            }
+            date.setTime(date.getTime() + milliseconds);
+            pos += 6;
+        }
+        if (pos < source.length() && source.charAt(pos) == 'Z') {
+            pos++;
+            calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
+        }
+        if (pos < source.length()) {
+            throw new NumberFormatException(Messages.getMessage("badChars00"));
+        }
+        calendar.setTime(date);
+
+        // support dates before the Christian era
+        if (bc) {
+            calendar.set(Calendar.ERA, GregorianCalendar.BC);
+        }
+
+        if (returnDate) {
+            return date;
+        } else {
+            return calendar;
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializerFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializerFactory.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializerFactory.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/deserializers/SimpleDeserializerFactory.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,38 @@
+/*
+* 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.deserializers;
+
+import org.apache.axis2.databinding.DeserializerFactory;
+import org.apache.axis2.databinding.Deserializer;
+
+import javax.xml.namespace.QName;
+
+/**
+ * SimpleDeserializerFactory
+ */
+public class SimpleDeserializerFactory implements DeserializerFactory {
+    QName xmlType;
+    Class javaType;
+
+    public SimpleDeserializerFactory(Class javaType, QName xmlType) {
+        this.xmlType = xmlType;
+        this.javaType = javaType;
+    }
+
+    public Deserializer getDeserializer() {
+        return new SimpleDeserializer(javaType, xmlType);
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/AttributeDesc.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/AttributeDesc.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/AttributeDesc.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/AttributeDesc.java Wed Sep  7 19:39:15 2005
@@ -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.metadata;
+
+import org.apache.axis2.databinding.deserializers.SimpleDeserializer;
+
+/**
+ * AttributeDesc
+ */
+public class AttributeDesc extends FieldDesc {
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/BeanManager.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/BeanManager.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/BeanManager.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/BeanManager.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,127 @@
+/*
+* 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.metadata;
+
+import org.apache.axis2.databinding.beans.BeanPropertyDescriptor;
+import org.apache.axis2.databinding.typemapping.TypeMappingRegistry;
+import org.apache.axis2.databinding.DeserializerFactory;
+import org.apache.axis2.databinding.Serializer;
+
+import javax.xml.namespace.QName;
+import java.beans.Introspector;
+import java.beans.BeanInfo;
+import java.beans.PropertyDescriptor;
+import java.beans.IndexedPropertyDescriptor;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * BeanManager
+ */
+public class BeanManager {
+    static Map class2TypeMap = new HashMap();
+
+    public static TypeDesc getTypeDesc(Class beanClass) {
+        // If we're already done with this class, just return the cached one
+        TypeDesc desc = (TypeDesc)class2TypeMap.get(beanClass);
+        if (desc != null)
+            return desc;
+
+        // OK, nothing cached.  See if the class has supplied some data itself
+        desc = TypeDesc.getTypeDescForClass(beanClass);
+        if (desc == null) {
+            desc = new TypeDesc();
+        }
+
+        class2TypeMap.put(beanClass, desc);
+
+        try {
+            fillInTypeDesc(desc, beanClass);
+        } catch (Exception e) {
+            desc = null;
+            class2TypeMap.remove(beanClass);
+        }
+
+        return desc;
+    }
+
+    private static void fillInTypeDesc(TypeDesc desc, Class beanClass)
+            throws Exception {
+        TypeMappingRegistry tmr = new TypeMappingRegistry();
+
+        desc.setJavaClass(beanClass);
+
+        BeanInfo beanInfo = Introspector.getBeanInfo(beanClass);
+        PropertyDescriptor [] propDescs = beanInfo.getPropertyDescriptors();
+        for (int i = 0; i < propDescs.length; i++) {
+            PropertyDescriptor propDesc = propDescs[i];
+            String name = propDesc.getName();
+
+            if (name.equals("class"))
+                continue;
+
+            BeanPropertyDescriptor beanDesc = new BeanPropertyDescriptor();
+            beanDesc.setReadMethod(propDesc.getReadMethod());
+            beanDesc.setWriteMethod(propDesc.getWriteMethod());
+
+            ElementDesc elDesc = desc.getElementDesc(name);
+            boolean addDesc = true;  // Should we add this (new) element?
+            if (elDesc == null) {
+                elDesc = new ElementDesc();
+                elDesc.setFieldName(name);
+            } else {
+                addDesc = false; // Already present, so don't add it again
+            }
+            Class type;
+            boolean isCollection = false;
+            if (propDesc instanceof IndexedPropertyDescriptor) {
+                IndexedPropertyDescriptor iProp =
+                        (IndexedPropertyDescriptor)propDesc;
+                beanDesc.setIndexedReadMethod(iProp.getIndexedReadMethod());
+                beanDesc.setIndexedWriteMethod(iProp.getIndexedWriteMethod());
+                type = iProp.getIndexedPropertyType();
+                elDesc.setIndexedAccessor(beanDesc);
+                isCollection = true;
+//                elDesc.setItemQName(new QName("http://foo", "item"));
+            } else {
+                type = propDesc.getPropertyType();
+                // TODO : notice if this is a supported collection type
+            }
+
+            if (isCollection && elDesc.getMaxOccurs() == 0)
+                elDesc.setMaxOccurs(-1);
+
+            elDesc.setAccessor(beanDesc);
+
+            if (elDesc.getQName() == null) {
+                elDesc.setQName(new QName(name));
+            }
+
+            if (elDesc.getDeserializerFactory() == null) {
+                DeserializerFactory dser = tmr.getDeserializerFactory(type);
+                elDesc.setDeserializerFactory(dser);
+            }
+
+            if (elDesc.getRawSerializer() == null) {
+                Serializer ser = tmr.getSerializer(type);
+                elDesc.setSerializer(ser);
+            }
+
+            if (addDesc)
+                desc.addField(elDesc);
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/ElementDesc.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/ElementDesc.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/ElementDesc.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/ElementDesc.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,117 @@
+/*
+* 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.metadata;
+
+import org.apache.axis2.databinding.Deserializer;
+import org.apache.axis2.databinding.DeserializationTarget;
+import org.apache.axis2.databinding.Serializer;
+import org.apache.axis2.databinding.DeserializerFactory;
+import org.apache.axis2.databinding.serializers.CollectionSerializer;
+
+import javax.xml.namespace.QName;
+
+/**
+ * ElementDesc
+ */
+public class ElementDesc extends FieldDesc {
+    protected IndexedFieldAccessor indexedAccessor;
+    protected QName itemQName;
+
+    class FieldTarget implements DeserializationTarget {
+        Object targetObject;
+        FieldAccessor accessor;
+
+        public FieldTarget(Object targetObject, FieldAccessor accessor) {
+            this.targetObject = targetObject;
+            this.accessor = accessor;
+        }
+
+        public void setValue(Object value) throws Exception {
+            accessor.setValue(targetObject, value);
+        }
+    }
+
+    protected int minOccurs = 0;
+
+    // Might seem strange to default this to zero, but we do it because
+    // we want to be able to tell in BeanManager.fillInTypeDesc() if someone
+    // set this manually or not.  If it's still zero in there (meaning default
+    // values are good) we'll set it to 1 for a normal field and -1 (unbounded)
+    // for a collection field.
+    protected int maxOccurs = 0;
+
+    public int getMinOccurs() {
+        return minOccurs;
+    }
+
+    public void setMinOccurs(int minOccurs) {
+        this.minOccurs = minOccurs;
+    }
+
+    public int getMaxOccurs() {
+        return maxOccurs;
+    }
+
+    public void setMaxOccurs(int maxOccurs) {
+        this.maxOccurs = maxOccurs;
+    }
+
+    public QName getItemQName() {
+        return itemQName;
+    }
+
+    public void setItemQName(QName itemQName) {
+        this.itemQName = itemQName;
+    }
+
+    public Deserializer getDeserializer(int index, Object targetObject) {
+        if (index > maxOccurs && maxOccurs > -1) {
+            throw new RuntimeException("Too many elements (maxOccurs = " +
+                                       maxOccurs + ") called " + qname + " !");
+        }
+
+        Deserializer dser = deserializerFactory.getDeserializer();
+        FieldAccessor accessor;
+        if (maxOccurs > 1 || maxOccurs == -1) {
+            accessor = new IndexedAccessorWrapper(indexedAccessor, index);
+        } else {
+            accessor = this.accessor;
+        }
+
+        dser.setTarget(new FieldTarget(targetObject, accessor));
+
+        return dser;
+    }
+
+    public Serializer getSerializer() {
+        if (maxOccurs > 1 || maxOccurs == -1) {
+            if (itemQName != null) {
+                return new CollectionSerializer(itemQName,
+                                                true,
+                                                super.getSerializer());
+            } else {
+                return new CollectionSerializer(qname,
+                                                false,
+                                                super.getSerializer());
+            }
+        }
+        return super.getSerializer();
+    }
+
+    public void setIndexedAccessor(IndexedFieldAccessor indexedAccessor) {
+        this.indexedAccessor = indexedAccessor;
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldAccessor.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldAccessor.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldAccessor.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldAccessor.java Wed Sep  7 19:39:15 2005
@@ -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.metadata;
+
+/**
+ * FieldAccessor
+ */
+public interface FieldAccessor {
+    public Object getValue(Object targetObject) throws Exception;
+    public void setValue(Object targetObject, Object value) throws Exception;
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldDesc.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldDesc.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldDesc.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/FieldDesc.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,91 @@
+/*
+* 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.metadata;
+
+import org.apache.axis2.databinding.Deserializer;
+import org.apache.axis2.databinding.Serializer;
+import org.apache.axis2.databinding.DeserializerFactory;
+
+import javax.xml.namespace.QName;
+
+/**
+ * FieldDesc
+ */
+public abstract class FieldDesc implements FieldAccessor {
+    protected QName qname;
+    protected FieldAccessor accessor;
+    protected DeserializerFactory deserializerFactory;
+    protected Serializer ser;
+    protected String fieldName;
+
+    public String getFieldName() {
+        return fieldName;
+    }
+
+    public void setFieldName(String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    public QName getQName() {
+        return qname;
+    }
+
+    public void setQName(QName qname) {
+        this.qname = qname;
+    }
+
+    public FieldAccessor getAccessor() {
+        return accessor;
+    }
+
+    public void setAccessor(FieldAccessor accessor) {
+        this.accessor = accessor;
+    }
+
+    public Object getValue(Object targetObject) throws Exception {
+        return accessor.getValue(targetObject);
+    }
+
+    public void setValue(Object targetObject, Object value) throws Exception {
+        accessor.setValue(targetObject, value);
+    }
+
+    public Serializer getSerializer() {
+        return ser;
+    }
+
+    public void setSerializer(Serializer ser) {
+        this.ser = ser;
+    }
+
+    Serializer getRawSerializer() {
+        return ser;
+    }
+
+    public Deserializer getDeserializer(int index) {
+        if (index > 0)
+            throw new RuntimeException("Only one element " + qname + " allowed");
+        return deserializerFactory.getDeserializer();
+    }
+
+    public void setDeserializerFactory(DeserializerFactory deser) {
+        this.deserializerFactory = deser;
+    }
+
+    public DeserializerFactory getDeserializerFactory() {
+        return deserializerFactory;
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedAccessorWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedAccessorWrapper.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedAccessorWrapper.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedAccessorWrapper.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,37 @@
+/*
+* 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.metadata;
+
+/**
+ * IndexedAccessorWrapper
+ */
+public class IndexedAccessorWrapper implements FieldAccessor {
+    IndexedFieldAccessor accessor;
+    int index;
+
+    public IndexedAccessorWrapper(IndexedFieldAccessor accessor, int index) {
+        this.accessor = accessor;
+        this.index = index;
+    }
+
+    public Object getValue(Object targetObject) throws Exception {
+        return accessor.getIndexedValue(targetObject, index);
+    }
+
+    public void setValue(Object targetObject, Object value) throws Exception {
+        accessor.setIndexedValue(targetObject, value, index);
+    }
+}

Added: webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedFieldAccessor.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedFieldAccessor.java?rev=279491&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedFieldAccessor.java (added)
+++ webservices/axis2/trunk/java/modules/databinding/src/org/apache/axis2/databinding/metadata/IndexedFieldAccessor.java Wed Sep  7 19:39:15 2005
@@ -0,0 +1,29 @@
+/*
+* 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.metadata;
+
+/**
+ * IndexedFieldAccessor
+ */
+public interface IndexedFieldAccessor {
+    public Object getIndexedValue(Object targetObject, int index)
+            throws Exception;
+
+    public void setIndexedValue(Object targetObject,
+                                Object value,
+                                int index) throws Exception;
+
+}