cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r441230 [7/10] - in /incubator/cayenne/soc/trunk/cayenne-ropwsdl: cayenne-axis-dist/ cayenne-axis-server/ cayenne-axis-server/.externalToolBuilders/ cayenne-axis-server/.settings/ cayenne-axis-server/ant/ cayenne-axis-server/ant/lib/ cayenn...
Date Thu, 07 Sep 2006 21:28:15 GMT
Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ExpressionDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ExpressionDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ExpressionDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ExpressionDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,67 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.io.CharArrayWriter;
+
+import org.apache.axis.encoding.DeserializationContext;
+import org.apache.axis.encoding.DeserializerImpl;
+import org.apache.cayenne.exp.Expression;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+public class ExpressionDeserializer extends DeserializerImpl {
+	
+	private static final long serialVersionUID = 7358068777260341281L;
+
+	private CharArrayWriter val;
+	
+
+	@Override	
+	public void characters(char[] chars, int start, int end) throws SAXException {
+		val.write(chars, start, end);
+	}
+
+
+
+	@Override
+	public void onStartElement(String namespace, String localName, String prefix, Attributes attributes, DeserializationContext context) throws SAXException {
+		val = new CharArrayWriter();
+	}
+
+
+
+	@Override
+	public void onEndElement(String namespace, String localName, DeserializationContext context) throws SAXException {
+		if ((val == null) || (val.size() == 0))
+			setValue(null);
+		else {
+			String res = val.toString();
+			setValue(Expression.fromString(res));
+		}
+			
+	}
+	
+		
+	
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ExpressionSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ExpressionSerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ExpressionSerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ExpressionSerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,68 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.SimpleValueSerializer;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.exp.Expression;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class ExpressionSerializer implements SimpleValueSerializer {
+
+	public String getValueAsString(Object value, SerializationContext context) {
+		StringWriter sw = new StringWriter();
+		PrintWriter pw = new PrintWriter(sw);
+		((Expression) value).encodeAsString(pw);
+		return sw.toString();
+	}
+
+	public void serialize(QName name, Attributes attributes, Object value,
+			SerializationContext context) throws IOException {
+		context.startElement(name, attributes);
+		String sExp = getValueAsString(value, context);
+		context.writeSafeString(sExp);
+		context.endElement();
+	}
+
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element elem = types.createElement("simpleType");
+		Element restr = types.createElement("restriction");		
+		restr.setAttribute("base", types.getQNameString(XMLType.XSD_STRING));
+		elem.appendChild(restr);
+		return elem;
+		
+	}
+
+	public String getMechanismType() { return Constants.AXIS_SAX; }
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/FaultDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/FaultDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/FaultDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/FaultDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,52 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.util.Map;
+
+import org.apache.axis.encoding.Target;
+import org.apache.cayenne.Fault;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeDeserializer;
+import org.xml.sax.Attributes;
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class FaultDeserializer extends ComplexTypeDeserializer<Fault> {
+
+	
+
+	@Override
+	protected Fault createValue(String namespace, Attributes attributes) {
+		if (attributes.getValue(namespace, "toMany").equals("true")) {
+			return Fault.getToManyFault();			
+		} else {
+			return Fault.getToOneFault();
+		}
+	}
+
+	@Override
+	protected Map<String, ? extends Target> assignChildTargets() {
+		return null;
+	}
+
+	
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/FaultSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/FaultSerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/FaultSerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/FaultSerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,66 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.Fault;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeSerializer;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class FaultSerializer extends ComplexTypeSerializer {
+
+	@Override
+	protected Attributes fillAttributes(QName name, Attributes attributes,
+			Object value, SerializationContext context) throws IOException {
+		AttributesImpl attrs = new AttributesImpl();
+		if (attributes != null)
+			attrs.setAttributes(attributes);
+		Fault fault = (Fault) value;
+		attrs.addAttribute(name.getNamespaceURI(), "toMany", "", "xsd:boolean", context
+					.getValueAsString(fault.equals(Fault.getToManyFault()), XMLType.XSD_BOOLEAN,
+							boolean.class));
+		
+		return attrs;
+	}
+
+	@Override
+	protected void serializeChildren(QName name, Object value,
+			SerializationContext context) throws IOException {
+	}
+	
+	@Override
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element type = types.createElement("complexType");
+		type.appendChild(types.createAttributeElement("toMany", boolean.class, XMLType.XSD_BOOLEAN, false, type.getOwnerDocument()));		
+		return type;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/GenericResponseDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/GenericResponseDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/GenericResponseDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/GenericResponseDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,92 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.apache.axis.encoding.Callback;
+import org.apache.axis.encoding.CallbackTarget;
+import org.apache.axis.encoding.Target;
+import org.apache.cayenne.util.GenericResponse;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class GenericResponseDeserializer extends
+		QueryResponseDeserializer<GenericResponse> {
+
+	
+	@Override
+	protected Map<String, ? extends Target> assignChildTargets() {
+		Callback callback = new Callback() {
+
+			@SuppressWarnings("unchecked")
+			public void setValue(Object value, Object hint) throws SAXException {
+				Object[][] resultsArray = (Object[][]) value;
+
+				GenericResponse resp = GenericResponseDeserializer.this.getValue();
+				if (resultsArray == null) {
+					throw new SAXException(
+							"GenericResponseDeserializer: array of response results is null.");
+				}
+				for (int i = 0; i < resultsArray.length; i++) {
+					if (resultsArray[i] == null)
+						continue;
+					// TODO Ugly testing for response type (list or not)
+					if ((resultsArray[i].getClass().isArray())
+							&& (((Object[]) resultsArray[i]).length > 0)) {
+						if (Integer.class.isAssignableFrom(resultsArray[i][0]
+								.getClass())) {
+							Object[] updateCount = (Object[]) resultsArray[i];
+							if (updateCount.length > 0)
+								resp.addUpdateCount((Integer) updateCount[0]);
+						} else {
+							Object[] row = (Object[]) resultsArray[i];
+							if (row != null) {
+								LinkedList rowList = new LinkedList();
+								for (int j = 0; j < row.length; j++) {
+									rowList.add(row[j]);
+								}
+								resp.addResultList(rowList);
+							}
+
+						}
+					}
+
+				}
+			}
+
+		};
+		
+		return Collections.singletonMap("results", new CallbackTarget(
+				callback, null));
+	}
+
+	@Override
+	protected GenericResponse createValue(String namespace, Attributes attributes) {
+		return new GenericResponse();
+	}
+
+	
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/GenericResponseSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/GenericResponseSerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/GenericResponseSerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/GenericResponseSerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,46 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.QueryResponse;
+import org.w3c.dom.Element;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class GenericResponseSerializer extends QueryResponseSerializer {
+	@Override
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		types.writeType(Date.class);
+		types.writeType(Calendar.class);
+		Element type = types.createElement("complexType");
+		Element complexContent = types.createElement("complexContent");
+		Element extension = types.createElement("extension");
+		extension.setAttribute("base", types.writeType(QueryResponse.class));
+		complexContent.appendChild(extension);			
+		type.appendChild(complexContent);
+		return type;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ListResponseDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ListResponseDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ListResponseDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ListResponseDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,81 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.axis.encoding.Callback;
+import org.apache.axis.encoding.CallbackTarget;
+import org.apache.axis.encoding.Target;
+import org.apache.cayenne.util.ListResponse;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class ListResponseDeserializer extends
+		QueryResponseDeserializer<ListResponse> {
+
+	@Override
+	protected ListResponse createValue(String namespace, Attributes attributes) {
+		return new ListResponse();
+	}
+
+	@Override
+	protected Map<String, ? extends Target> assignChildTargets() {
+		Callback callback = new Callback() {
+
+			@SuppressWarnings("unchecked")
+			public void setValue(Object value, Object hint) throws SAXException {
+				ListResponse resp = getValue();
+				Object[][] resultsArray = (Object[][]) value;
+				for (int i = 0; i < resultsArray.length; i++) {
+					if (resultsArray[i] == null)
+						continue;
+					// TODO Ugly testing for response type (list or not)
+					if ((resultsArray[i].getClass().isArray())
+							&& (((Object[]) resultsArray[i]).length > 0)) {
+
+						Object[] row = (Object[]) resultsArray[i];
+						if (row != null) {
+							ArrayList rowList = new ArrayList();
+							for (int j = 0; j < row.length; j++) {
+								rowList.add(row[j]);
+							}
+							resp.currentList().addAll(rowList);
+						}
+
+					}
+
+				}
+			}
+
+		};
+
+		return Collections.singletonMap("results", new CallbackTarget(callback,
+				null));
+
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ListResponseSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ListResponseSerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ListResponseSerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ListResponseSerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,41 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.QueryResponse;
+import org.w3c.dom.Element;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class ListResponseSerializer extends QueryResponseSerializer {
+	@Override
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element type = types.createElement("complexType");
+		Element complexContent = types.createElement("complexContent");
+		Element extension = types.createElement("extension");
+		extension.setAttribute("base", types.writeType(QueryResponse.class));
+		complexContent.appendChild(extension);			
+		type.appendChild(complexContent);
+		return type;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ObjectIdDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ObjectIdDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ObjectIdDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ObjectIdDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,93 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.axis.encoding.Base64;
+import org.apache.axis.encoding.Callback;
+import org.apache.axis.encoding.CallbackTarget;
+import org.apache.axis.encoding.Target;
+import org.apache.cayenne.ObjectId;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeDeserializer;
+import org.apache.cayenne.remote.axis.ser.common.FieldAccessor;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class ObjectIdDeserializer extends ComplexTypeDeserializer<ObjectId> {
+
+	@Override
+	protected ObjectId createValue(String namespace, Attributes attributes) {
+		boolean temporary = attributes.getValue(namespace, "temporary").equals(
+				"true");
+		String entityName = attributes.getValue(namespace, "entityName");
+		if (temporary) {
+			byte[] key = Base64.decode(attributes.getValue(namespace, "key"));
+			return new ObjectId(entityName, key);
+		} else {
+			return new ObjectId(entityName, new HashMap());
+		}
+	}
+
+	@Override
+	protected Map<String, ? extends Target> assignChildTargets() {
+		Callback callback = new Callback() {
+
+			@SuppressWarnings("unchecked")
+			public void setValue(Object value, Object hint) throws SAXException {
+				ObjectId objId = ObjectIdDeserializer.this.getValue();
+				Map idMap = (Map) value;
+
+				if (!objId.isTemporary()) {
+
+					// TODO Remove private field access
+
+					if (idMap == null || idMap.size() == 0) {
+
+					} else if (idMap.size() == 1) {
+						Map.Entry e = (Map.Entry) idMap.entrySet().iterator()
+								.next();
+						FieldAccessor.getInstance().setFieldValue(ObjectId.class,
+								"singleKey", objId, String.valueOf(e.getKey()));
+						FieldAccessor.getInstance().setFieldValue(ObjectId.class,
+								"singleValue", objId, e.getValue());
+					} else {
+						FieldAccessor.getInstance().setFieldValue(ObjectId.class,
+								"objectIdKeys", objId, new HashMap(idMap));
+					}
+
+				} else {
+					objId.getReplacementIdMap().putAll(idMap);
+				}
+
+			}
+		};
+
+		return Collections.singletonMap("snapshot", new CallbackTarget(
+				callback, null));
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ObjectIdSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ObjectIdSerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ObjectIdSerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ObjectIdSerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,96 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Hashtable;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.Base64;
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.ObjectId;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeSerializer;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class ObjectIdSerializer extends ComplexTypeSerializer {
+
+	@Override
+	protected Attributes fillAttributes(QName name, Attributes attributes,
+			Object value, SerializationContext context) throws IOException {
+		ObjectId objId = (ObjectId) value;
+		String uri = name.getNamespaceURI();
+
+		AttributesImpl attrs = new AttributesImpl();
+		if (attributes != null)
+			attrs.setAttributes(attributes);
+		attrs.addAttribute(uri, "entityName", "", "xsd:string", objId
+				.getEntityName());
+
+		attrs.addAttribute(uri, "temporary", "", "xsd:boolean", context
+				.getValueAsString(objId.isTemporary(), XMLType.XSD_BOOLEAN,
+						boolean.class));
+
+		if (objId.isTemporary()) {
+
+			attrs.addAttribute(uri, "key", "", "xsd:string", Base64
+					.encode(objId.getKey()));
+
+		}
+
+		return attrs;
+	}
+
+	@Override
+	protected void serializeChildren(QName name, Object value,
+			SerializationContext context) throws IOException {
+		ObjectId objId = (ObjectId) value;
+		QName hashtableQName = context.getQNameForClass(HashMap.class);
+		context.serialize(new QName(name.getNamespaceURI(), "snapshot"), null,
+				objId.getIdSnapshot(), hashtableQName, HashMap.class);
+
+	}
+
+	@Override
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element type = types.createElement("complexType");
+		Element seq = (Element) type.appendChild(types.createElement("sequence"));		
+		seq.appendChild(types.createElement("snapshot", 
+				types.writeType(Hashtable.class), 
+				true, false, type.getOwnerDocument()));
+		
+		type.appendChild(types.createAttributeElement("entityName", String.class, XMLType.XSD_STRING, false, type.getOwnerDocument()));		
+		type.appendChild(types.createAttributeElement("temporary", boolean.class, XMLType.XSD_BOOLEAN, false, type.getOwnerDocument()));		
+		type.appendChild(types.createAttributeElement("key", String.class, XMLType.XSD_STRING, false, type.getOwnerDocument()));		
+		
+		return type;
+	}
+	
+	
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/PersistentDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/PersistentDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/PersistentDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/PersistentDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,109 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.axis.encoding.Callback;
+import org.apache.axis.encoding.CallbackTarget;
+import org.apache.axis.encoding.Target;
+import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.DataObject;
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.ObjectId;
+import org.apache.cayenne.Persistent;
+import org.apache.cayenne.property.ClassDescriptor;
+import org.apache.cayenne.remote.axis.peerdata.PeerDataUser;
+import org.apache.cayenne.remote.axis.peerdata.ServicePeerData;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeDeserializer;
+import org.apache.cayenne.remote.axis.ser.common.FieldAccessor;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class PersistentDeserializer extends ComplexTypeDeserializer<DataObject>
+		implements PeerDataUser {
+	private ServicePeerData peerData;
+
+	public ServicePeerData getPeerData() {
+		return peerData;
+	}
+
+	public void setPeerData(ServicePeerData peerData) {
+		this.peerData = peerData;
+	}
+
+	@Override
+	protected DataObject createValue(String namespace, Attributes attributes) {
+		String entityName = attributes.getValue(namespace, "entityName");
+		ObjectContext context = getPeerData().getContext();
+		ClassDescriptor desc = context.getEntityResolver()
+				.getClassDescriptor(entityName);
+		Persistent obj = (Persistent) desc.createObject();
+		obj.setObjectContext(context);
+		return (DataObject) obj;
+	}
+
+	@Override
+	protected Map<String, ? extends Target> assignChildTargets() {
+		Map<String, CallbackTarget> map = new HashMap<String, CallbackTarget>();
+
+		Callback callback = new Callback() {
+
+			public void setValue(Object value, Object hint) throws SAXException {
+				// TODO Remove private field access
+
+				CayenneDataObject foreignObj = new CayenneDataObject();
+				foreignObj.setObjectId(getValue().getObjectId());
+
+				FieldAccessor.getInstance().setFieldValue(
+						foreignObj.getClass(), "values", foreignObj, value);
+
+				ClassDescriptor desc = getPeerData().getContext().getEntityResolver()
+						.getClassDescriptor(
+								getValue().getObjectId().getEntityName());
+				desc.shallowMerge(foreignObj, getValue());
+				// System.out.println("Properties: " +
+				// objId.getEntityName());
+
+			}
+
+		};
+
+		map.put("properties", new CallbackTarget(callback, null));
+
+		callback = new Callback() {
+
+			public void setValue(Object value, Object hint) throws SAXException {
+				getValue().setObjectId((ObjectId) value);
+			}
+
+		};
+
+		map.put("object-id", new CallbackTarget(callback, null));
+
+		return map;
+
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/PersistentSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/PersistentSerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/PersistentSerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/PersistentSerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,117 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.DataObject;
+import org.apache.cayenne.ObjectId;
+import org.apache.cayenne.remote.axis.client.ClientPersistentObject;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeSerializer;
+import org.apache.cayenne.remote.axis.ser.common.FieldAccessor;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class PersistentSerializer extends ComplexTypeSerializer {
+
+	@Override
+	protected Attributes fillAttributes(QName name, Attributes attributes,
+			Object value, SerializationContext context) throws IOException {
+		if (value instanceof DataObject) {
+			DataObject obj = (DataObject) value;
+			AttributesImpl attrs = new AttributesImpl();
+			if (attributes != null)
+				attrs.setAttributes(attributes);
+			attrs.addAttribute(name.getNamespaceURI(), "persistenceState", "",
+					"xsd:integer", String.valueOf(obj.getPersistenceState()));
+			attrs.addAttribute(name.getNamespaceURI(), "entityName", "",
+					"xsd:string", obj.getObjectId().getEntityName());
+			return attrs;
+		} else {
+			throw new IOException(
+					"Could not serialize object of type "
+							+ value.getClass().getName()
+							+ ". Can serialize only objects of types: CayenneDataObject, ClientPersistentObject.");
+		}
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	protected void serializeChildren(QName name, Object value,
+			SerializationContext context) throws IOException {
+
+		// TODO Remove private field access
+		if ((value instanceof CayenneDataObject)
+				|| (value instanceof ClientPersistentObject)) {
+			DataObject obj = (DataObject) value;
+
+			// Defining map of properties
+			Object values = FieldAccessor.getInstance().getFieldValue(
+					obj.getClass(), "values", obj);
+
+			HashMap<String, Object> properties = new HashMap<String, Object>(
+					(Map<String, Object>) values);
+
+			QName hashtableQName = context.getQNameForClass(HashMap.class);
+			QName objectIdQName = context.getQNameForClass(ObjectId.class);
+			context.serialize(new QName(name.getNamespaceURI(), "object-id"),
+					null, obj.getObjectId(), objectIdQName, ObjectId.class);
+
+			context.serialize(new QName(name.getNamespaceURI(), "properties"),
+					null, properties, hashtableQName, HashMap.class);
+		} else {
+			throw new IOException(
+					"Could not serialize object of type "
+							+ value.getClass().getName()
+							+ ". Can serialize only objects of types: CayenneDataObject, ClientPersistentObject.");
+		}
+
+	}
+
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element type = types.createElement("complexType");
+		type.appendChild(types.createAttributeElement("persistenceState",
+				Integer.class, XMLType.XSD_INTEGER, false, type
+						.getOwnerDocument()));
+		Element seq = (Element) type.appendChild(types
+				.createElement("sequence"));
+		seq.appendChild(types.createElement("object-id", types
+				.writeType(ObjectId.class), true, false, type
+				.getOwnerDocument()));
+		seq.appendChild(types.createElement("properties", types
+				.writeType(Hashtable.class), true, false, type
+				.getOwnerDocument()));
+		return type;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/QueryResponseDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/QueryResponseDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/QueryResponseDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/QueryResponseDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,45 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.util.Map;
+
+import org.apache.axis.encoding.Target;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeDeserializer;
+import org.xml.sax.Attributes;
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class QueryResponseDeserializer<T> extends ComplexTypeDeserializer<T> {
+
+	@Override
+	protected T createValue(String namespace, Attributes attributes) {
+		return null;
+	}
+
+	@Override
+	protected Map<String, ? extends Target> assignChildTargets() {
+		return null;
+	}
+	
+
+	
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/QueryResponseSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/QueryResponseSerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/QueryResponseSerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/QueryResponseSerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,87 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.QueryResponse;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeSerializer;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class QueryResponseSerializer extends ComplexTypeSerializer {
+
+	@Override
+	protected Attributes fillAttributes(QName name, Attributes attributes,
+			Object value, SerializationContext context) throws IOException {
+		return attributes;
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	protected void serializeChildren(QName name, Object value,
+			SerializationContext context) throws IOException {
+		QueryResponse resp = (QueryResponse) value;
+		Object[][] rowsArray = new Object[resp.size()][];
+		resp.reset();
+		if (resp.size() > 0) {
+			int i = 0;
+			while (resp.next()) {
+				if (resp.isList()) {
+					List list = (List) resp
+							.currentList();
+					Object[] rows = new Object[0];
+					rows = list.toArray(rows);
+					rowsArray[i] = rows;					
+				} else {
+					int[] updateCount = resp.currentUpdateCount();
+					Integer[] uc = new Integer[updateCount.length];
+					for (int j = 0; j < updateCount.length; j++) {
+						uc[j] = updateCount[j];						
+					}
+					rowsArray[i] = uc;
+				}
+				i++;
+			}
+		}
+		QName arrayQName = context.getQNameForClass(rowsArray.getClass());
+		context.serialize(new QName(name.getNamespaceURI(), "results"), null,
+				rowsArray, arrayQName, rowsArray.getClass());
+
+	}
+
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element type = types.createElement("complexType");
+		Element seq = (Element) type.appendChild(types
+				.createElement("sequence"));
+		seq.appendChild(types.createElement("results", types
+				.writeType(Object[][].class), true, false, type
+				.getOwnerDocument()));
+		return type;
+	}
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ToManyListDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ToManyListDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ToManyListDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ToManyListDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,83 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.apache.axis.encoding.Callback;
+import org.apache.axis.encoding.CallbackTarget;
+import org.apache.axis.encoding.Target;
+import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.access.ToManyList;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeDeserializer;
+import org.apache.cayenne.remote.axis.ser.common.FieldAccessor;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class ToManyListDeserializer extends ComplexTypeDeserializer<ToManyList> {
+
+	@Override
+	protected ToManyList createValue(String namespace, Attributes attributes) {
+		String relationshipName = attributes.getValue(namespace,
+				"relationship-name");
+		return new ToManyList(new CayenneDataObject(), relationshipName);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	protected Map<String, ? extends Target> assignChildTargets() {
+		Map<String, CallbackTarget> map = new HashMap<String, CallbackTarget>();
+
+		Callback callback = new Callback() {
+
+			public void setValue(Object value, Object hint) throws SAXException {
+				// TODO Remove private field access
+				FieldAccessor.getInstance().setFieldValue(ToManyList.class,
+						"source", getValue(), value);
+
+			}
+
+		};
+
+		map.put("relationship-owner", new CallbackTarget(callback, null));
+
+		callback = new Callback() {
+
+			public void setValue(Object value, Object hint) throws SAXException {
+				LinkedList lst = new LinkedList();
+				lst.addAll(Arrays.asList((Object[]) value));
+				getValue().setObjectList(lst);
+			}
+
+		};
+
+		map.put("targets", new CallbackTarget(callback, null));
+
+		return map;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ToManyListSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ToManyListSerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ToManyListSerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/ToManyListSerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,68 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.cayenne.Persistent;
+import org.apache.cayenne.access.ToManyList;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeSerializer;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class ToManyListSerializer extends ComplexTypeSerializer {
+
+	@Override
+	protected Attributes fillAttributes(QName name, Attributes attributes,
+			Object value, SerializationContext context) throws IOException {
+		AttributesImpl attrs = new AttributesImpl();
+		if (attributes != null)
+			attrs.setAttributes(attributes);
+		
+		attrs.addAttribute(name.getNamespaceURI(), "relationship-name", "", "xsd:string", ((ToManyList) value).getRelationship());
+		return attrs;
+		
+		
+	}
+
+	@Override
+	protected void serializeChildren(QName name, Object value,
+			SerializationContext context) throws IOException {
+		ToManyList lst = (ToManyList) value;
+		context.serialize(
+				new QName(name.getNamespaceURI(), "relationship-owner"), null,
+				lst.getRelationshipOwner(), context.getQNameForClass(Persistent.class), Persistent.class);
+		
+		Object[] targets = new Object[0];
+		targets = lst.toArray(targets);
+				
+		context.serialize(
+				new QName(name.getNamespaceURI(), "targets"), null,
+				targets, context.getQNameForClass(targets.getClass()), targets.getClass());
+
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/ComplexTypeDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/ComplexTypeDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/ComplexTypeDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/ComplexTypeDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,197 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser.common;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.DeserializationContext;
+import org.apache.axis.encoding.Deserializer;
+import org.apache.axis.encoding.DeserializerImpl;
+import org.apache.axis.encoding.Target;
+import org.apache.axis.message.SOAPHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Generic deserializer for complex types.
+ * 
+ * <br>
+ * Subclasses must implement 2 methods:<br>
+ * 
+ * 1. createValue() - to initialize deserialized value.<br>
+ * 
+ * 2. assignChildTargets() - to provide specification for Targets to assign
+ * child element values.<br>
+ * 
+ * <br>
+ * The main purpose of this class is to regulate work for deserializing child
+ * elements and assigning their values to the main element. This class can be
+ * used when we need to deserialize Java classes which are not JavaBeans.<br>
+ * If deserializing type has no constructor without arguments some tricky work
+ * must be done to provide intial value. It is needed because cyclic object
+ * dependences must be avoided in deserializing process.<br>
+ * <br>
+ * 
+ * Example of such dependence:<br>
+ * 
+ * Object A needs object B to be deserialized. Method setValue() in deserializer
+ * of A will be invoked when object B is ready.<br>
+ * 
+ * Object B needs object A to be deserialized. Method setValue() in deserializer
+ * of B will be invoked when object A is ready.<br>
+ * <br>
+ * 
+ * So neither object A not object B can be deserialized.<br>
+ * <br>
+ * 
+ * To avoid this we must remove the dependence in some way and provide object A
+ * or object B without waiting for another object.<br>
+ * 
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+@SuppressWarnings("serial")
+public abstract class ComplexTypeDeserializer<T> extends DeserializerImpl {
+
+	/**
+	 * Subclasses must provide Map of local name - target pairs in this method.
+	 * Deserializer will lookup correct child targets for assigning child
+	 * element values by target's local name.
+	 * 
+	 * @return Map of local name - deserializer target pairs.
+	 */
+	protected abstract Map<String, ? extends Target> assignChildTargets();
+
+	/**
+	 * Subclasses must provide initial deserialized value in this method. Called
+	 * in onStartElement().
+	 * 
+	 * Actually not every complex type can be instantiated at this stage, but
+	 * deserialized value must be set as soon as possible to avoid cyclic
+	 * reference conflicts.
+	 * 
+	 * @param namespace
+	 *            Namespace of the element.
+	 * @param attributes
+	 *            XML attributes of the element.
+	 * @return Initial deserialized value value.
+	 */
+	protected abstract T createValue(String namespace, Attributes attributes);
+
+	/**
+	 * This method sets initial deserialized value returned by createValue(). If
+	 * overriding this method to do some routines before creating value, place
+	 * super.onStartelement(.....) at the end of new method body.
+	 * 
+	 */
+	@Override
+	public void onStartElement(String namespace, String localName,
+			String prefix, Attributes attributes, DeserializationContext context)
+			throws SAXException {
+		super.onStartElement(namespace, localName, prefix, attributes, context);
+		setValue(createValue(namespace, attributes));
+	}
+
+	private Map<String, ? extends Target> cachedChildTargets;
+
+	/**
+	 * 
+	 * @return Cached map of child element deserializer targets.
+	 */
+	protected Map<String, ? extends Target> getChildTargets() {
+		if (cachedChildTargets == null)
+			cachedChildTargets = assignChildTargets();
+		return cachedChildTargets;
+	}
+
+	/**
+	 * Finds deserializer target in map by local name and registers it with
+	 * child deserializer.
+	 */
+	@Override
+	public SOAPHandler onStartChild(String namespace, String localName,
+			String prefix, Attributes attributes, DeserializationContext context)
+			throws SAXException {
+
+		if ((getChildTargets() != null) && (getChildTargets().size() != 0)) {
+			Deserializer dSer = this.getDeserializerFor(namespace, localName,
+					prefix, attributes, context);
+
+			for (Entry<String, ? extends Target> entry : getChildTargets()
+					.entrySet()) {
+				if (entry.getKey().equals(localName))
+					dSer.registerValueTarget(entry.getValue());
+			}
+
+			addChildDeserializer(dSer);
+			return (SOAPHandler) dSer;
+		} else {
+			return null;
+		}
+	}
+
+	/**
+	 * 
+	 * @param namespace
+	 * @param localName
+	 * @param prefix
+	 * @param attributes
+	 * @param context
+	 * @return Most suitable deserializer for type defined in attributes.
+	 */
+	protected Deserializer getDeserializerFor(String namespace,
+			String localName, String prefix, Attributes attributes,
+			DeserializationContext context) {
+		Deserializer dSer = null;
+
+		QName itemType = context.getTypeFromAttributes(namespace, localName,
+				attributes);
+
+		if (itemType != null) {
+			dSer = context.getDeserializerForType(itemType);
+		}
+
+		if (dSer == null) {
+			dSer = new DeserializerImpl();
+		}
+
+		return dSer;
+
+	}
+
+	/**
+	 * Returns deserializer value of specified type.
+	 */
+	@SuppressWarnings("unchecked")
+	@Override
+	public T getValue() {
+		return (T) super.getValue();
+	}
+
+	/**
+	 * Components ready when some deserialized value assigned.
+	 */
+	@Override
+	public boolean componentsReady() {
+		return value != null;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/ComplexTypeSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/ComplexTypeSerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/ComplexTypeSerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/ComplexTypeSerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,76 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser.common;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.Serializer;
+import org.apache.axis.wsdl.fromJava.Types;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * Generic serializer for complex types.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+public abstract class ComplexTypeSerializer implements Serializer {
+
+	/**
+	 * Subclasses can serialize child elements in this method.
+	 * @param name Name of main element.
+	 * @param value Value of main element.
+	 * @param context deserializing context.
+	 * @throws IOException
+	 */
+	protected abstract void serializeChildren(QName name, Object value, SerializationContext context) throws IOException;
+	/**
+	 * Subclasses can fill attributes of main element in this method.
+	 * @param name
+	 * @param attributes
+	 * @param value
+	 * @param context
+	 * @return
+	 * @throws IOException
+	 */
+	protected abstract Attributes fillAttributes(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException;
+	
+	
+	public void serialize(QName name, Attributes attributes, Object value,
+			SerializationContext context) throws IOException {
+		context.startElement(name, fillAttributes(name, attributes, value, context));
+		serializeChildren(name, value, context);
+		context.endElement();
+	}
+
+	/**
+	 * Writes dummy schema for complex type.
+	 */
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element type = types.createElement("complexType");
+		return type;
+	}
+	
+	
+	public String getMechanismType() { return Constants.AXIS_SAX; }
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/FieldAccessor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/FieldAccessor.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/FieldAccessor.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/common/FieldAccessor.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,109 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser.common;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Support class for accessing fields of classes through reflection.
+ * 
+ * Use getInstance() to access singleton instance of the class. FieldAccessor
+ * caches accessed field objects in List and reuses.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+public class FieldAccessor {
+	private static FieldAccessor instance;
+
+	public static FieldAccessor getInstance() {
+		if (instance == null)
+			instance = new FieldAccessor();
+		return instance;
+	}
+
+	private FieldAccessor() {
+		super();
+	}
+
+	private List<Field> cachedFields = new ArrayList<Field>();
+
+	/**
+	 * Finds declared field in specified class by specified name. Tries to find
+	 * field in cachedFields list. If not found, uses getDeclsredfield() method
+	 * of provided class and saves returned value in cache. Sets accessible
+	 * property of returned field to true - so returned private fields are also
+	 * accessible.
+	 * 
+	 * @param clazz
+	 * @param fieldName
+	 * @return
+	 */
+	public Field getFieldFor(Class clazz, String fieldName) {
+		for (Iterator iter = cachedFields.iterator(); iter.hasNext();) {
+			Field element = (Field) iter.next();
+			if ((element.getDeclaringClass().equals(clazz))
+					&& (fieldName.equals(element.getName())))
+				return element;
+		}
+		try {
+			Field field = clazz.getDeclaredField(fieldName);
+			field.setAccessible(true);
+			cachedFields.add(field);
+			return field;
+		} catch (Exception e) {
+			System.out.println("Development error. Field " + fieldName
+					+ " not found in class " + clazz.getName() + ".");
+			// e.printStackTrace();
+			return null;
+		}
+
+	}
+
+	public void setFieldValue(Class clazz, String fieldName,
+			Object ownerObject, Object value) {
+
+		Field field = getFieldFor(clazz, fieldName);
+		try {
+			field.set(ownerObject, value);
+		} catch (Exception e) {
+			System.out.println("Development error. Can not access field "
+					+ fieldName + " in class " + clazz.getName() + ".");
+			// e.printStackTrace();
+			return;
+		}
+
+	}
+
+	public Object getFieldValue(Class clazz, String fieldName,
+			Object ownerObject) {
+		Field field = getFieldFor(clazz, fieldName);
+		try {
+			return field.get(ownerObject);
+		} catch (Exception e) {
+			System.out.println("Development error. Can not access field "
+					+ fieldName + " in class " + clazz.getName() + ".");
+			//e.printStackTrace();
+			return null;
+		}
+
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/AbstractQueryDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/AbstractQueryDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/AbstractQueryDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/AbstractQueryDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,98 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser.query;
+
+import java.util.Map;
+
+import org.apache.axis.encoding.DeserializationContext;
+import org.apache.axis.encoding.Target;
+import org.apache.cayenne.map.EntityResolver;
+import org.apache.cayenne.map.QueryBuilder;
+import org.apache.cayenne.query.Query;
+import org.apache.cayenne.remote.axis.peerdata.PeerDataUser;
+import org.apache.cayenne.remote.axis.peerdata.ServicePeerData;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeDeserializer;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class AbstractQueryDeserializer<T extends Query> extends
+		ComplexTypeDeserializer<T> implements PeerDataUser {
+
+	private ServicePeerData peerData;
+	
+	protected String name;
+
+	protected Object root;
+
+	private Object determineRoot(String rootType, String rootName) {
+
+		Object root = null;
+		EntityResolver resolver = getPeerData().getContext().getEntityResolver();
+
+		if (QueryBuilder.OBJ_ENTITY_ROOT.equals(rootType)) {
+			root = resolver.getObjEntity(rootName);
+		} else if (QueryBuilder.DB_ENTITY_ROOT.equals(rootType)) {
+			root = resolver.getDbEntity(rootName);
+		} else if (QueryBuilder.PROCEDURE_ROOT.equals(rootType)) {
+			root = resolver.getProcedure(rootName);
+		} else if (QueryBuilder.JAVA_CLASS_ROOT.equals(rootType)) {
+			try {
+				root = Class.forName(rootName);
+			} catch (Exception e) {
+			}
+		}
+
+		return root;
+
+	}
+
+	@Override
+	public void onStartElement(String namespace, String localName,
+			String prefix, Attributes attributes, DeserializationContext context)
+			throws SAXException {
+		name = attributes.getValue(namespace, "name");
+		String rootType = attributes.getValue(namespace, "root-type");
+		String rootName = attributes.getValue(namespace, "root-name");
+		root = determineRoot(rootType, rootName);
+		super.onStartElement(namespace, localName, prefix, attributes, context);
+	}
+
+	@Override
+	protected T createValue(String namespace, Attributes attributes) {
+		return null;
+	}
+
+	@Override
+	protected Map<String, ? extends Target> assignChildTargets() {
+		return null;
+	}
+
+	public ServicePeerData getPeerData() {
+		return peerData;
+	}
+
+	public void setPeerData(ServicePeerData peerData) {
+		this.peerData = peerData;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/AbstractQuerySerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/AbstractQuerySerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/AbstractQuerySerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/AbstractQuerySerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,133 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser.query;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.map.Procedure;
+import org.apache.cayenne.map.QueryBuilder;
+import org.apache.cayenne.query.AbstractQuery;
+import org.apache.cayenne.query.Query;
+import org.apache.cayenne.remote.axis.peerdata.PeerDataUser;
+import org.apache.cayenne.remote.axis.peerdata.ServicePeerData;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeSerializer;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class AbstractQuerySerializer extends ComplexTypeSerializer implements
+		PeerDataUser {
+
+	private ServicePeerData peerData;
+
+	public ServicePeerData getPeerData() {
+		return peerData;
+	}
+
+	public void setPeerData(ServicePeerData peerData) {
+		this.peerData = peerData;
+	}
+
+	@Override
+	protected Attributes fillAttributes(QName name, Attributes attributes,
+			Object value, SerializationContext context) throws IOException {
+		AbstractQuery query = (AbstractQuery) value;
+		String nsUri = name.getNamespaceURI();
+
+		AttributesImpl attrs = new AttributesImpl();
+		if (attributes != null)
+			attrs.setAttributes(attributes);
+		if (query.getName() != null) {
+			attrs
+					.addAttribute(nsUri, "name", "", "xsd:string", query
+							.getName());
+		}
+
+		String rootString = null;
+		String rootType = null;
+		Object root = query.getRoot();
+
+		if (root instanceof String) {
+			rootType = QueryBuilder.OBJ_ENTITY_ROOT;
+			rootString = root.toString();
+		} else if (root instanceof ObjEntity) {
+			rootType = QueryBuilder.OBJ_ENTITY_ROOT;
+			rootString = ((ObjEntity) root).getName();
+		} else if (root instanceof DbEntity) {
+			rootType = QueryBuilder.DB_ENTITY_ROOT;
+			rootString = ((DbEntity) root).getName();
+		} else if (root instanceof Procedure) {
+			rootType = QueryBuilder.PROCEDURE_ROOT;
+			rootString = ((Procedure) root).getName();
+		} else if (root instanceof Class) {
+			// Sending ObjEntity instead of Class
+
+			// rootType = QueryBuilder.JAVA_CLASS_ROOT;
+			// rootString = ((Class) root).getName();
+
+			rootType = QueryBuilder.OBJ_ENTITY_ROOT;
+			rootString = getPeerData().getContext().getEntityResolver()
+					.lookupObjEntity((Class) root).getName();
+		}
+
+		attrs.addAttribute(nsUri, "root-type", "", "xsd:string", rootType);
+		attrs.addAttribute(nsUri, "root-name", "", "xsd:string", rootString);
+
+		return attrs;
+	}
+
+	@Override
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element type = types.createElement("complexType");
+		Element complexContent = types.createElement("complexContent");
+		Element extension = types.createElement("extension");
+		extension.setAttribute("base", types.writeType(Query.class));
+		
+		extension.appendChild(types.createAttributeElement("name",
+				String.class, XMLType.XSD_STRING, false, type
+						.getOwnerDocument()));
+		extension.appendChild(types.createAttributeElement("root-type",
+				String.class, XMLType.XSD_STRING, false, type
+						.getOwnerDocument()));
+		extension.appendChild(types.createAttributeElement("root-name",
+				String.class, XMLType.XSD_STRING, false, type
+						.getOwnerDocument()));
+		complexContent.appendChild(extension);
+		type.appendChild(complexContent);
+
+		return type;
+	}
+
+	@Override
+	protected void serializeChildren(QName name, Object value,
+			SerializationContext context) throws IOException {
+	};
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/DeleteQueryDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/DeleteQueryDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/DeleteQueryDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/DeleteQueryDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,40 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser.query;
+
+import org.apache.cayenne.query.DeleteQuery;
+import org.xml.sax.Attributes;
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class DeleteQueryDeserializer extends QualifiedQueryDeserializer<DeleteQuery> {
+
+	@Override
+	protected DeleteQuery createValue(String namespace, Attributes attributes) {
+		DeleteQuery query = new DeleteQuery();
+		query.setRoot(root);	
+		query.setName(name);
+		return query;	
+	}
+
+
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/DeleteQuerySerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/DeleteQuerySerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/DeleteQuerySerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/DeleteQuerySerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,41 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser.query;
+
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.query.QualifiedQuery;
+import org.w3c.dom.Element;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class DeleteQuerySerializer extends QualifiedQuerySerializer {
+	@Override
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element type = types.createElement("complexType");
+		Element complexContent = types.createElement("complexContent");
+		Element extension = types.createElement("extension");
+		extension.setAttribute("base", types.writeType(QualifiedQuery.class));
+		complexContent.appendChild(extension);			
+		type.appendChild(complexContent);
+		return type;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/IndirectQueryDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/IndirectQueryDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/IndirectQueryDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/IndirectQueryDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,59 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser.query;
+
+import java.util.Map;
+
+import org.apache.axis.encoding.DeserializationContext;
+import org.apache.axis.encoding.Target;
+import org.apache.cayenne.query.IndirectQuery;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeDeserializer;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class IndirectQueryDeserializer<T extends IndirectQuery> extends ComplexTypeDeserializer<T> {
+	protected String name;
+
+	@Override
+	public void onStartElement(String namespace, String localName, String prefix, Attributes attributes, DeserializationContext context) throws SAXException {
+		name = attributes.getValue(namespace, "name");
+		super.onStartElement(namespace, localName, prefix, attributes, context);
+	}
+
+	@Override
+	protected Map<String, ? extends Target> assignChildTargets() {
+		return null;
+	}
+
+	@Override
+	protected T createValue(String namespace, Attributes attributes) {
+		return null;
+	}
+	
+	
+	
+	
+	
+	
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/IndirectQuerySerializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/IndirectQuerySerializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/IndirectQuerySerializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/query/IndirectQuerySerializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,83 @@
+/****************************************************************************
+ *  Copyright 2006 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.cayenne.remote.axis.ser.query;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.cayenne.query.IndirectQuery;
+import org.apache.cayenne.query.Query;
+import org.apache.cayenne.remote.axis.ser.common.ComplexTypeSerializer;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * AXIS serializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class IndirectQuerySerializer extends ComplexTypeSerializer {
+
+	@Override
+	protected Attributes fillAttributes(QName name, Attributes attributes,
+			Object value, SerializationContext context) throws IOException {
+		IndirectQuery query = (IndirectQuery) value;
+		String nsUri = name.getNamespaceURI();
+
+		AttributesImpl attrs = new AttributesImpl();
+		if (attributes != null)
+			attrs.setAttributes(attributes);
+		if (query.getName() != null) {
+			attrs
+					.addAttribute(nsUri, "name", "", "xsd:string", query
+							.getName());
+		}
+
+		return attrs;
+	}
+
+	@Override
+	protected void serializeChildren(QName name, Object value,
+			SerializationContext context) throws IOException {
+	}
+
+	@Override
+	public Element writeSchema(Class javaType, Types types) throws Exception {
+		Element type = types.createElement("complexType");
+		Element complexContent = types.createElement("complexContent");
+		Element extension = types.createElement("extension");
+		extension.setAttribute("base", types.writeType(Query.class));
+		
+		extension.appendChild(types.createAttributeElement("name",
+				String.class, XMLType.XSD_STRING, false, type
+						.getOwnerDocument()));
+		
+		
+		complexContent.appendChild(extension);
+		type.appendChild(complexContent);
+
+		
+		return type;
+	}
+
+}



Mime
View raw message