cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r441230 [6/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/ant/ConfigBasedDbGeneratorTask.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ant/ConfigBasedDbGeneratorTask.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ant/ConfigBasedDbGeneratorTask.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ant/ConfigBasedDbGeneratorTask.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,177 @@
+/****************************************************************************
+ *  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.ant;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.Driver;
+
+import javax.sql.DataSource;
+
+import org.apache.cayenne.access.DbGenerator;
+import org.apache.cayenne.conf.DriverDataSourceFactory;
+import org.apache.cayenne.conn.DriverDataSource;
+import org.apache.cayenne.dba.JdbcAdapter;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.tools.DbGeneratorTask;
+import org.apache.cayenne.util.Util;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+
+/**
+ * Ant task for generating database structure. Extends DbGeneratorTask. Can use
+ * either Cayenne driver configuration file or straight definition of db
+ * connection parameters.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+public class ConfigBasedDbGeneratorTask extends DbGeneratorTask {
+	protected File cayenneDriverXml;
+
+	public File getCayenneDriverXml() {
+		return cayenneDriverXml;
+	}
+
+	public void setCayenneDriverXml(File cayenneDriverXml) {
+		this.cayenneDriverXml = cayenneDriverXml;
+	}
+
+	@Override
+	public void execute() {
+		configureLogging();
+
+		// prepare defaults
+		if (adapter == null) {
+			adapter = new JdbcAdapter();
+		}
+
+		validateAttributes();
+
+		log("Generating database structure...", Project.MSG_VERBOSE);
+		try {
+
+			if (cayenneDriverXml != null) {
+				log("connection settings - [cayenne driver: "
+						+ cayenneDriverXml.getCanonicalPath(),
+						Project.MSG_VERBOSE);
+			} else {
+				log("connection settings - [driver: " + driver + ", url: "
+						+ url + ", username: " + userName + "]",
+						Project.MSG_VERBOSE);
+
+			}
+			log("generator options - [dropTables: " + dropTables + ", dropPK: "
+					+ dropPK + ", createTables: " + createTables
+					+ ", createPK: " + createPK + ", createFK: " + createFK
+					+ "]", Project.MSG_VERBOSE);
+
+			// Load the data map and run the db generator.
+			DataMap dataMap = loadDataMap();
+			log("Loaded DataMap with following entities:", Project.MSG_VERBOSE);
+			for (Object obj : dataMap.getDbEntities()) {
+				DbEntity entity = (DbEntity) obj;
+				log(entity.getName(), Project.MSG_VERBOSE);
+			}
+			DbGenerator generator = new DbGenerator(adapter, dataMap);
+			generator.setShouldCreateFKConstraints(createFK);
+			generator.setShouldCreatePKSupport(createPK);
+			generator.setShouldCreateTables(createTables);
+			generator.setShouldDropPKSupport(dropPK);
+			generator.setShouldDropTables(dropTables);
+
+			DataSource dataSource = getDataSource();
+			generator.runGenerator(dataSource);
+
+			// TODO Work with HSQLDB. Even when "shutdown=true" property set, db
+			// not flushed.
+			Connection con = dataSource.getConnection();
+			DatabaseMetaData metadata = con.getMetaData();
+			log("Db product version: " + metadata.getDatabaseProductName(),
+					Project.MSG_VERBOSE);
+			if (metadata.getDatabaseProductName().contains("HSQL")) {
+				log("Shutdowning HSQL database.", Project.MSG_VERBOSE);
+				con.createStatement().execute("SHUTDOWN");
+			}
+			// ////////////////////////////////////////////
+
+			log("Done.", Project.MSG_VERBOSE);
+		} catch (Exception ex) {
+			log("Exce[ion caught: " + ex.getStackTrace());
+			Throwable th = Util.unwindException(ex);
+
+			String message = "Error generating database";
+
+			if (th.getLocalizedMessage() != null) {
+				message += ": " + th.getLocalizedMessage();
+			}
+
+			super.log(message);
+			throw new BuildException(message, th);
+		}
+	}
+
+	@Override
+	protected void validateAttributes() throws BuildException {
+		StringBuffer error = new StringBuffer("");
+
+		if (map == null) {
+			error.append("The 'map' attribute must be set.\n");
+		}
+
+		if ((driver == null) && (cayenneDriverXml == null)) {
+			error
+					.append("The 'driver' or 'cayenneDriverXml' attribute must be set.\n");
+		}
+
+		if (error.length() > 0) {
+			throw new BuildException(error.toString());
+		}
+
+	}
+
+	protected DataSource getDataSource() throws Exception {
+
+		if (cayenneDriverXml != null) {
+			// Trying to load defined Cayenne driver xml file
+
+			DriverDataSourceFactory factory = new DriverDataSourceFactory() {
+
+				@Override
+				protected InputStream getInputStream(String location) {
+					try {
+						return new FileInputStream(location);
+					} catch (Exception e) {
+						return null;
+					}
+				}
+
+			};
+
+			return factory.getDataSource(cayenneDriverXml.getCanonicalPath());
+		} else {
+			// Trying to use defined driver/url/user/pass attributes
+			return new DriverDataSource((Driver) Class.forName(driver)
+					.newInstance(), url, userName, password);
+		}
+
+	}
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ant/GenerateClientDataMapTask.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ant/GenerateClientDataMapTask.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ant/GenerateClientDataMapTask.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ant/GenerateClientDataMapTask.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,182 @@
+/****************************************************************************
+ *  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.ant;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.EntityResolver;
+import org.apache.cayenne.map.MapLoader;
+import org.apache.cayenne.remote.axis.client.map.ClientDataMapHelper;
+import org.apache.cayenne.tools.CayenneTask;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Path;
+import org.xml.sax.InputSource;
+
+/**
+ * Ant task for generating client-side configuration in format consisting of
+ * object layer definitions only (no db info).
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+public class GenerateClientDataMapTask extends CayenneTask {
+
+	protected File additionalMaps[] = new File[0];
+
+	private File destDir;
+
+	private File srcDataMap;
+
+	public File getDestDir() {
+		return destDir;
+	}
+
+	public void setDestDir(File destDir) {
+		this.destDir = destDir;
+	}
+
+	public File getSrcDataMap() {
+		return srcDataMap;
+	}
+
+	public void setSrcDataMap(File srcDataMap) {
+		this.srcDataMap = srcDataMap;
+	}
+
+	protected DataMap loadDataMap(File mapName) throws Exception {
+		if (mapName == null)
+			throw new Exception("mapName is null.");
+		InputSource in = new InputSource(mapName.getCanonicalPath());
+		return new MapLoader().loadDataMap(in);
+	}
+
+	protected Collection<DataMap> loadDataMaps() throws Exception {
+		Collection<DataMap> res = new ArrayList<DataMap>();
+		res.add(loadDataMap());
+
+		if (null != additionalMaps) {
+
+			for (int i = 0; i < additionalMaps.length; i++) {
+				res.add(loadDataMap(additionalMaps[i]));
+			}
+
+		}
+		return res;
+	}
+
+	protected DataMap loadDataMap() throws Exception {
+		return loadDataMap(srcDataMap);
+	}
+
+	public void setAdditionalMaps(Path additionalMapsPath) {
+		if (additionalMapsPath != null) {
+			String additionalMapFilenames[] = additionalMapsPath.list();
+			this.additionalMaps = new File[additionalMapFilenames.length];
+
+			for (int i = 0; i < additionalMapFilenames.length; i++) {
+				additionalMaps[i] = new File(additionalMapFilenames[i]);
+			}
+		}
+	}
+
+	public File[] getAdditionalMaps() {
+		return additionalMaps;
+	}
+
+	public void processDataMap(DataMap map, EntityResolver resolver)
+			throws Exception {
+
+	}
+
+	/**
+	 * Loads server-side DataMap defined in srcDataMap, converts it to
+	 * client-side and saves to directory destDir.
+	 */
+	@Override
+	public void execute() throws BuildException {
+		try {
+			validateAttributes();
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new BuildException(e);
+		}
+
+		Collection<DataMap> maps;
+
+		try {
+			maps = loadDataMaps();
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new BuildException(e);
+		}
+
+		// Creating EntityResolver with this single DataMap.
+		EntityResolver resolver = new EntityResolver(maps);
+
+		// Converting and saving.
+		for (DataMap map : maps) {
+			DataMap clientMap = ClientDataMapHelper.getClientDataMap(map,
+					resolver);
+
+			File destFile = new File(destDir + "/" + clientMap.getName()
+					+ ".map.xml");
+			try {
+				destFile.createNewFile();
+				PrintWriter writer = new PrintWriter(destFile);
+				clientMap.encodeAsXML(writer);
+				writer.close();
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw new BuildException(e);
+			}
+		}
+
+	}
+
+	public void validateAttributes() throws Exception {
+		if (destDir == null) {
+			throw new Exception("'destDir' attribute is missing.");
+		}
+
+		if (!destDir.isDirectory()) {
+			throw new Exception(destDir.toString() + " is not a directory.");
+		}
+
+		if (!destDir.canWrite()) {
+			throw new Exception("Do not have write permissions for "
+					+ destDir.toString());
+		}
+
+		if (srcDataMap == null) {
+			throw new Exception("'srcDataMap' attribute is missing.");
+		}
+
+		if (!srcDataMap.isFile()) {
+			throw new Exception(srcDataMap.toString() + " is not file.");
+		}
+
+		if (!srcDataMap.canRead()) {
+			throw new Exception("Can not read file " + srcDataMap.toString());
+		}
+
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/AxisConnection.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/AxisConnection.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/AxisConnection.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/AxisConnection.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,131 @@
+/****************************************************************************
+ *  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.client;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.rmi.RemoteException;
+
+import javax.xml.rpc.ServiceException;
+
+import org.apache.cayenne.CayenneException;
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.QueryResponse;
+import org.apache.cayenne.event.EventBridge;
+import org.apache.cayenne.map.EntityResolver;
+import org.apache.cayenne.query.Query;
+import org.apache.cayenne.remote.BootstrapMessage;
+import org.apache.cayenne.remote.ClientConnection;
+import org.apache.cayenne.remote.ClientMessage;
+import org.apache.cayenne.remote.QueryMessage;
+import org.apache.cayenne.remote.SyncMessage;
+import org.apache.cayenne.remote.axis.CayenneROPServiceLocator;
+import org.apache.cayenne.remote.axis.CayenneSoapBindingStub;
+import org.apache.cayenne.remote.axis.peerdata.PeerDataUser;
+import org.apache.cayenne.remote.axis.peerdata.ServicePeerData;
+
+/**
+ * Cayenne-AXIS client connection implementation.
+ * 
+ * One instance of AxisConnection can be used by single CayenneContext only.
+ * Connection needs to know it's client context for assigning it to deserialized
+ * persistent objects.
+ * 
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+public class AxisConnection implements ClientConnection, PeerDataUser {
+	private CayenneSoapBindingStub service;
+
+	/**
+	 * Initialize service with provided connection url.
+	 * 
+	 * @param urlString
+	 * @throws MalformedURLException
+	 * @throws ServiceException
+	 * @throws CayenneException
+	 */
+	public void initSerivce(String urlString) throws MalformedURLException,
+			ServiceException, CayenneException {
+		service = null;
+		CayenneROPServiceLocator locator = new CayenneROPServiceLocator();
+		service = (CayenneSoapBindingStub) locator
+				.getCayenne(new URL(urlString));
+		service.setTimeout(0);
+		service.setMaintainSession(true);
+
+		// Initializing faults for client-side.
+		ClientToManyFault.init();
+		ClientToOneFault.init();
+	}
+
+	public AxisConnection() {
+		super();
+	}
+
+	public AxisConnection(String url) throws MalformedURLException,
+			ServiceException, CayenneException {
+		super();
+		this.initSerivce(url);
+	}
+
+	public EventBridge getServerEventBridge() throws CayenneRuntimeException {
+		return null;
+	}
+
+	public Object sendMessage(ClientMessage message)
+			throws CayenneRuntimeException {
+		if (message instanceof SyncMessage) {
+			SyncMessage sync = (SyncMessage) message;
+			try {
+				return service.processSync(sync.getType(), sync
+						.getSenderChanges());
+			} catch (RemoteException e) {
+				e.printStackTrace();
+			}
+
+		} else if (message instanceof QueryMessage) {
+			Query query = ((QueryMessage) message).getQuery();
+			try {
+				Object res = null;
+				res = (QueryResponse) service.processQuery(query);
+				return res;
+			} catch (RemoteException e) {
+				e.printStackTrace();
+			}
+
+		} else if (message instanceof BootstrapMessage) {
+			try {
+				EntityResolver resolver = service.getEntityResolver();
+				return resolver;
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		return null;
+	}
+
+	public void setPeerData(ServicePeerData value) {
+		service.setPeerData(value);		
+	}
+
+	public ServicePeerData getPeerData() {
+		return service.getPeerData();
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientPersistentObject.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientPersistentObject.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientPersistentObject.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientPersistentObject.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,251 @@
+/****************************************************************************
+ *  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.client;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.DataObject;
+import org.apache.cayenne.Fault;
+import org.apache.cayenne.PersistenceState;
+import org.apache.cayenne.PersistentObject;
+import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.map.EntityResolver;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.map.ObjRelationship;
+import org.apache.cayenne.property.PropertyUtils;
+
+/**
+ * Client-side Persistent object.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ *
+ */
+@SuppressWarnings("serial")
+public class ClientPersistentObject extends PersistentObject implements
+		DataObject {
+	
+	protected long snapshotVersion = DEFAULT_VERSION;
+
+	protected Map<String, Object> values = new HashMap<String, Object>();
+
+	public void fetchFinished() {
+	}
+
+	public DataContext getDataContext() {
+		if (objectContext == null || objectContext instanceof DataContext) {
+			return (DataContext) objectContext;
+		}
+
+		throw new CayenneRuntimeException(
+				"ObjectContext is not a DataContext: " + objectContext);
+	}
+
+	public void setDataContext(DataContext dataContext) {
+		this.objectContext = dataContext;
+
+		if (dataContext == null) {
+			this.persistenceState = PersistenceState.TRANSIENT;
+		}
+	}
+
+	public ObjEntity getObjEntity() {
+		return (getObjectContext() != null) ? getObjectContext()
+				.getEntityResolver().lookupObjEntity(this) : null;
+	}
+
+	public long getSnapshotVersion() {
+		return snapshotVersion;
+	}
+
+	public void setSnapshotVersion(long snapshotVersion) {
+		this.snapshotVersion = snapshotVersion;
+	}
+
+	public Object readNestedProperty(String path) {
+		return PropertyUtils.getProperty(this, path);
+	}
+
+	public Object readProperty(String propName) {
+		if (objectContext != null) {
+			objectContext.prepareForAccess(this, propName);
+		}
+
+		Object object = readPropertyDirectly(propName);
+
+		// must resolve faults immediately
+		if (object instanceof Fault) {
+			object = ((Fault) object).resolveFault(this, propName);
+			writePropertyDirectly(propName, object);
+		}
+
+		return object;
+	}
+
+	public Object readPropertyDirectly(String propertyName) {
+		return values.get(propertyName);
+	}
+
+	public void writeProperty(String propertyName, Object value) {
+		if (objectContext != null) {
+			objectContext.prepareForAccess(this, propertyName);
+			Object oldValue = readPropertyDirectly(propertyName);
+			objectContext.propertyChanged(this, propertyName, oldValue, value);
+		}
+
+		writePropertyDirectly(propertyName, value);
+	}
+
+	public void writePropertyDirectly(String propertyName, Object value) {
+		values.put(propertyName, value);
+	}
+
+	protected void willConnect(String relationshipName, DataObject dataObject) {
+		if (dataObject == null
+				|| this.getObjectContext() == dataObject.getObjectContext()) {
+			return;
+		} else if (this.getObjectContext() == null
+				&& dataObject.getObjectContext() != null) {
+			dataObject.getObjectContext().localObject(getObjectId(), this);
+		} else if (this.getObjectContext() != null
+				&& dataObject.getObjectContext() == null) {
+			this.getObjectContext().localObject(dataObject.getObjectId(),
+					dataObject);
+		} else {
+			throw new CayenneRuntimeException(
+					"Cannot set object as destination of relationship "
+							+ relationshipName
+							+ " because it is in a different DataContext");
+		}
+	}
+
+	protected void setReverseRelationship(String relName, DataObject val) {
+		ObjRelationship rel = (ObjRelationship) objectContext
+				.getEntityResolver().lookupObjEntity(objectId.getEntityName())
+				.getRelationship(relName);
+		ObjRelationship revRel = rel.getReverseRelationship();
+		if (revRel != null) {
+			if (revRel.isToMany())
+				val.addToManyTarget(revRel.getName(), this, false);
+			else
+				val.setToOneTarget(revRel.getName(), this, false);
+		}
+	}
+
+	protected void unsetReverseRelationship(String relName, DataObject val) {
+
+		EntityResolver resolver = objectContext.getEntityResolver();
+		ObjEntity entity = resolver.lookupObjEntity(objectId.getEntityName());
+
+		if (entity == null) {
+			throw new IllegalStateException(
+					"DataObject's entity is unmapped, objectId: " + objectId);
+		}
+
+		ObjRelationship rel = (ObjRelationship) entity.getRelationship(relName);
+		ObjRelationship revRel = rel.getReverseRelationship();
+		if (revRel != null) {
+			if (revRel.isToMany())
+				val.removeToManyTarget(revRel.getName(), this, false);
+			else
+				val.setToOneTarget(revRel.getName(), null, false);
+		}
+	}
+
+	@SuppressWarnings( { "unchecked", "unchecked" })
+	public void addToManyTarget(String relName, DataObject value,
+			boolean setReverse) {
+		if (value == null) {
+			throw new NullPointerException(
+					"Attempt to add null target DataObject.");
+		}
+		willConnect(relName, value);
+
+		List list = (List) readProperty(relName);
+
+		getObjectContext().getGraphManager().arcCreated(this.getObjectId(),
+				value.getObjectId(), "paintings");
+
+		list.add(value);
+
+		if (value != null && setReverse) {
+			setReverseRelationship(relName, value);
+		}
+
+	}
+
+	public void removeToManyTarget(String relName, DataObject value,
+			boolean setReverse) {
+		// Now do the rest of the normal handling (regardless of whether it was
+		// flattened or not)
+		List relList = (List) readProperty(relName);
+
+		getObjectContext().getGraphManager().arcDeleted(this.getObjectId(),
+				value.getObjectId(), relName);
+
+		relList.remove(value);
+		if (persistenceState == PersistenceState.COMMITTED) {
+			persistenceState = PersistenceState.MODIFIED;
+		}
+
+		if (value != null && setReverse) {
+			unsetReverseRelationship(relName, value);
+		}
+
+	}
+
+	public void setToOneTarget(String relationshipName, DataObject value,
+			boolean setReverse) {
+		willConnect(relationshipName, value);
+
+		Object oldTarget = readProperty(relationshipName);
+		if (oldTarget == value) {
+			return;
+		}
+
+		getObjectContext().getGraphManager().arcCreated(this.getObjectId(),
+				value.getObjectId(), relationshipName);
+
+		if (setReverse) {
+			// unset old reverse relationship
+			if (oldTarget instanceof DataObject) {
+				unsetReverseRelationship(relationshipName,
+						(DataObject) oldTarget);
+			}
+
+			// set new reverse relationship
+			if (value != null) {
+				setReverseRelationship(relationshipName, value);
+			}
+		}
+
+		objectContext.prepareForAccess(this, relationshipName);
+		writePropertyDirectly(relationshipName, value);
+
+	}
+
+	@Override
+	public void setPersistenceState(int persistenceState) {
+		super.setPersistenceState(persistenceState);
+		if (persistenceState == PersistenceState.HOLLOW) {
+			values.clear();
+		}
+	}
+	
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientToManyFault.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientToManyFault.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientToManyFault.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientToManyFault.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,43 @@
+/****************************************************************************
+ *  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.client;
+
+import org.apache.cayenne.Fault;
+import org.apache.cayenne.Persistent;
+import org.apache.cayenne.access.ToManyList;
+
+/**
+ * Client-side fault system implementation.
+ * 
+ * Needed because general Fault classes can not be initialized without having
+ * local Configuration.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+@SuppressWarnings("serial")
+public class ClientToManyFault extends Fault {
+
+	public static void init() {
+		Fault.toManyFault = new ClientToManyFault();
+	}
+
+	public Object resolveFault(Persistent sourceObject, String relationshipName) {
+		return new ToManyList(sourceObject, relationshipName);
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientToOneFault.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientToOneFault.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientToOneFault.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/ClientToOneFault.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.client;
+
+import java.util.List;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.Fault;
+import org.apache.cayenne.Persistent;
+import org.apache.cayenne.query.RelationshipQuery;
+
+/**
+ * Client-side fault system implementation.
+ * 
+ * Needed because general Fault classes can not be initialized without having
+ * local Configuration.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+@SuppressWarnings("serial")
+public class ClientToOneFault extends Fault {
+
+	public static void init() {
+		Fault.toOneFault = new ClientToOneFault();
+	}
+
+	public Object resolveFault(Persistent sourceObject, String relationshipName) {
+		Object target = doResolveFault(sourceObject, relationshipName);
+
+		// Did I commented something important for client-side fault
+		// resolving?
+
+		/*
+		 * // must update the diff for the object int state =
+		 * sourceObject.getPersistenceState(); ObjectContext context =
+		 * sourceObject.getObjectContext(); if ((state ==
+		 * PersistenceState.MODIFIED || state == PersistenceState.DELETED) &&
+		 * context instanceof DataContext) {
+		 * 
+		 * context.get
+		 * 
+		 * ObjectDiff diff = (ObjectDiff) ((DataContext) context)
+		 * .getObjectStore() .getChangesByObjectId()
+		 * .get(sourceObject.getObjectId());
+		 * 
+		 * if (diff != null) { diff.updateArcSnapshot(relationshipName,
+		 * (Persistent) target); } }
+		 */
+
+		return target;
+	}
+
+	private Object doResolveFault(Persistent sourceObject,
+			String relationshipName) {
+		RelationshipQuery query = new RelationshipQuery(sourceObject
+				.getObjectId(), relationshipName, false);
+
+		List objects = sourceObject.getObjectContext().performQuery(query);
+
+		if (objects.isEmpty()) {
+			return null;
+		} else if (objects.size() == 1) {
+			return objects.get(0);
+		} else {
+			throw new CayenneRuntimeException("Error resolving to-one fault. "
+					+ "More than one object found. " + "Source Id: "
+					+ sourceObject.getObjectId() + ", relationship: "
+					+ relationshipName);
+		}
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/MutableQueryMetadata.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/MutableQueryMetadata.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/MutableQueryMetadata.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/MutableQueryMetadata.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,182 @@
+/****************************************************************************
+ *  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.client;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.map.Procedure;
+import org.apache.cayenne.query.PrefetchTreeNode;
+import org.apache.cayenne.query.QueryMetadata;
+import org.apache.cayenne.util.Util;
+
+/**
+ * QueryMetadata implementation for carrying actual parameter values with no
+ * dependency from provided db-aware objects. Suitable for use as resulting
+ * object for client-side QueryMetadata deserialization.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+public class MutableQueryMetadata implements QueryMetadata {
+	private String cacheKey = null;
+
+	private String cachePolicy = QueryMetadata.CACHE_POLICY_DEFAULT;
+
+	private int fetchLimit = QueryMetadata.FETCH_LIMIT_DEFAULT;
+
+	private int fetchStartIndex = -1;
+
+	private int pageSize = QueryMetadata.PAGE_SIZE_DEFAULT;
+
+	private boolean fetchingDataRows = QueryMetadata.FETCHING_DATA_ROWS_DEFAULT;
+
+	private boolean refreshingObjects = QueryMetadata.REFRESHING_OBJECTS_DEFAULT;
+
+	private boolean resolvingInherited = QueryMetadata.RESOLVING_INHERITED_DEFAULT;
+
+	private PrefetchTreeNode prefetchTree;
+
+	private transient ObjEntity objEntity;
+
+	private transient DbEntity dbEntity;
+
+	private transient DataMap dataMap;
+
+	private transient Procedure procedure;
+
+	public String getCacheKey() {
+		return cacheKey;
+	}
+
+	public void setCacheKey(String cacheKey) {
+		this.cacheKey = cacheKey;
+	}
+
+	public String getCachePolicy() {
+		return cachePolicy;
+	}
+
+	public void setCachePolicy(String cachePolicy) {
+		this.cachePolicy = cachePolicy;
+	}
+
+	public boolean isFetchingDataRows() {
+		return fetchingDataRows;
+	}
+
+	public void setFetchingDataRows(boolean fetchingDataRows) {
+		this.fetchingDataRows = fetchingDataRows;
+	}
+
+	public int getFetchLimit() {
+		return fetchLimit;
+	}
+
+	public void setFetchLimit(int fetchLimit) {
+		this.fetchLimit = fetchLimit;
+	}
+
+	public int getFetchStartIndex() {
+		return fetchStartIndex;
+	}
+
+	public void setFetchStartIndex(int fetchStartIndex) {
+		this.fetchStartIndex = fetchStartIndex;
+	}
+
+	public int getPageSize() {
+		return pageSize;
+	}
+
+	public void setPageSize(int pageSize) {
+		this.pageSize = pageSize;
+	}
+
+	public boolean isRefreshingObjects() {
+		return refreshingObjects;
+	}
+
+	public void setRefreshingObjects(boolean refreshingObjects) {
+		this.refreshingObjects = refreshingObjects;
+	}
+
+	public boolean isResolvingInherited() {
+		return resolvingInherited;
+	}
+
+	public void setResolvingInherited(boolean resolvingInherited) {
+		this.resolvingInherited = resolvingInherited;
+	}
+
+	public DataMap getDataMap() {
+		return dataMap;
+	}
+
+	public void setDataMap(DataMap dataMap) {
+		this.dataMap = dataMap;
+	}
+
+	public DbEntity getDbEntity() {
+		return dbEntity;
+	}
+
+	public void setDbEntity(DbEntity dbEntity) {
+		this.dbEntity = dbEntity;
+	}
+
+	public ObjEntity getObjEntity() {
+		return objEntity;
+	}
+
+	public void setObjEntity(ObjEntity objEntity) {
+		this.objEntity = objEntity;
+	}
+
+	public PrefetchTreeNode getPrefetchTree() {
+		return prefetchTree;
+	}
+
+	public void setPrefetchTree(PrefetchTreeNode prefetchTree) {
+		if (prefetchTree != null) {
+			// importnat: make a clone to allow modification independent from
+			// the
+			// caller...
+			try {
+				prefetchTree = (PrefetchTreeNode) Util
+						.cloneViaSerialization(prefetchTree);
+			} catch (CayenneRuntimeException e) {
+				throw e;
+			} catch (Exception e) {
+				throw new CayenneRuntimeException(
+						"Error cloning prefetch tree", e);
+			}
+		}
+
+		this.prefetchTree = prefetchTree;
+	}
+
+	public Procedure getProcedure() {
+		return procedure;
+	}
+
+	public void setProcedure(Procedure procedure) {
+		this.procedure = procedure;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientDataMapHelper.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientDataMapHelper.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientDataMapHelper.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientDataMapHelper.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,85 @@
+/****************************************************************************
+ *  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.client.map;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.conf.Configuration;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.EntityResolver;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.map.ObjRelationship;
+import org.apache.cayenne.query.Query;
+
+/**
+ * Helper class for converting server side DataMaps to client side.
+ * 
+ * Replaces all classes containing server-side database relative information
+ * with their client-side (no db info) variants.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+public class ClientDataMapHelper {
+	public static String CLIENT_SUPER_CLASS_NAME = "org.apache.cayenne.remote.axis.client.ClientPersistentObject";
+
+	@SuppressWarnings("unchecked")
+	public static DataMap getClientDataMap(DataMap dataMap,
+			EntityResolver resolver) {
+		dataMap.setClientSupported(true);
+		dataMap.setNamespace(resolver);
+		DataMap res = dataMap.getClientDataMap(resolver);
+
+		List<Query> queries = new ArrayList<Query>(res.getQueries());
+		for (Query query : queries) {
+			res.removeQuery(query.getName());
+		}
+
+		for (Object obj : res.getObjEntities()) {
+			ObjEntity entity = (ObjEntity) obj;
+			if (entity.getSuperClassName() == null)
+				entity.setSuperClassName(CLIENT_SUPER_CLASS_NAME);
+			List<ObjRelationship> relationships = new ArrayList<ObjRelationship>(
+					entity.getRelationships());
+			for (ObjRelationship rel : relationships) {
+				entity.removeRelationship(rel.getName());
+				entity.addRelationship(ClientObjRelationship
+						.createClientObjRelationship(rel));
+			}
+		}
+
+		return res;
+	}
+
+	public static Collection<DataMap> getClientDataMapsFromConfig() {
+		DataContext context = Configuration.getSharedConfiguration()
+				.getDomain().createDataContext();
+
+		Collection serverMaps = context.getEntityResolver().getDataMaps();
+		Collection<DataMap> res = new ArrayList<DataMap>(serverMaps.size());
+		for (Object obj : serverMaps) {
+			DataMap dataMap = (DataMap) obj;
+			res.add(getClientDataMap(dataMap, context.getEntityResolver()));
+		}
+
+		return res;
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientMapLoader.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientMapLoader.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientMapLoader.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientMapLoader.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,380 @@
+/****************************************************************************
+ *  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.client.map;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.DeleteRule;
+import org.apache.cayenne.map.ObjAttribute;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.project.DataMapFile;
+import org.apache.cayenne.util.ResourceLocator;
+import org.apache.cayenne.util.Util;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Loader for DataMap configuration in client-side format.
+ * Mostly taken from original MapLoader class.
+ * 
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ *
+ */
+public class ClientMapLoader extends DefaultHandler {
+
+	final static String _1_2_PACKAGE_PREFIX = "org.objectstyle.cayenne.";
+
+	final static String _2_0_PACKAGE_PREFIX = "org.apache.cayenne.";
+
+	public static final String DATA_MAP_TAG = "data-map";
+
+	public static final String PROPERTY_TAG = "property";
+
+	public static final String OBJ_ENTITY_TAG = "obj-entity";
+
+	public static final String OBJ_ATTRIBUTE_TAG = "obj-attribute";
+
+	public static final String OBJ_RELATIONSHIP_TAG = "obj-relationship";
+
+	public static final String TRUE = "true";
+
+	public static final String FALSE = "false";
+
+	// Reading from XML
+	private DataMap dataMap;
+
+	private ObjEntity objEntity;
+
+	private ClientObjRelationship objRelationship;
+
+	private String currentTag;
+
+	private StringBuffer charactersBuffer;
+
+	private Map<String, String> mapProperties;
+
+	/**
+	 * Loads a DataMap from XML input source.
+	 */
+	public synchronized DataMap loadDataMap(InputSource src)
+			throws CayenneRuntimeException {
+		if (src == null) {
+			throw new NullPointerException("Null InputSource.");
+		}
+
+		try {
+			String mapName = mapNameFromLocation(src.getSystemId());
+			dataMap = new DataMap(mapName);
+			XMLReader parser = Util.createXmlReader();
+
+			parser.setContentHandler(this);
+			parser.setErrorHandler(this);
+			parser.parse(src);
+		} catch (SAXException e) {
+			dataMap = null;
+			throw new CayenneRuntimeException(
+					"Wrong DataMap format, last processed tag: <" + currentTag,
+					Util.unwindException(e));
+		} catch (Exception e) {
+			dataMap = null;
+			throw new CayenneRuntimeException(
+					"Error loading DataMap, last processed tag: <" + currentTag,
+					Util.unwindException(e));
+		}
+		return dataMap;
+	}
+
+	/**
+	 * Loads DataMap from file specified by <code>uri</code> parameter.
+	 * 
+	 * @throws CayenneRuntimeException
+	 *             if source URI does not resolve to a valid map files
+	 */
+	public DataMap loadDataMap(String uri) throws CayenneRuntimeException {
+		// configure resource locator
+		ResourceLocator locator = configLocator();
+		InputStream in = locator.findResourceStream(uri);
+		if (in == null) {
+			throw new CayenneRuntimeException("Can't find data map " + uri);
+		}
+
+		try {
+			InputSource inSrc = new InputSource(in);
+			inSrc.setSystemId(uri);
+			return loadDataMap(inSrc);
+		} finally {
+			try {
+				in.close();
+			} catch (IOException ioex) {
+			}
+		}
+	}
+
+	/**
+	 * Helper method to guess the map name from its location.
+	 */
+	protected String mapNameFromLocation(String location) {
+		if (location == null) {
+			return "Untitled";
+		}
+
+		int lastSlash = location.lastIndexOf('/');
+		if (lastSlash < 0) {
+			lastSlash = location.lastIndexOf('\\');
+		}
+
+		if (lastSlash >= 0 && lastSlash + 1 < location.length()) {
+			location = location.substring(lastSlash + 1);
+		}
+
+		if (location.endsWith(DataMapFile.LOCATION_SUFFIX)) {
+			location = location.substring(0, location.length()
+					- DataMapFile.LOCATION_SUFFIX.length());
+		}
+
+		return location;
+	}
+
+	/**
+	 * Creates, configures and returns ResourceLocator object used to lookup
+	 * DataMap files.
+	 */
+	protected ResourceLocator configLocator() {
+		ResourceLocator locator = new ResourceLocator();
+		locator.setSkipAbsolutePath(true);
+		locator.setSkipClasspath(false);
+		locator.setSkipCurrentDirectory(false);
+		locator.setSkipHomeDirectory(false);
+		return locator;
+	}
+
+	public void startElement(String namespaceUri, String localName,
+			String qName, Attributes attributes) throws SAXException {
+
+		rememberCurrentTag(localName);
+		if (localName.equals(DATA_MAP_TAG)) {
+		} else if (localName.equals(OBJ_ENTITY_TAG)) {
+			processStartObjEntity(attributes);
+		} else if (localName.equals(OBJ_ATTRIBUTE_TAG)) {
+			processStartObjAttribute(attributes);
+		} else if (localName.equals(OBJ_RELATIONSHIP_TAG)) {
+			processStartObjRelationship(attributes);
+		}
+		// properties can belong to query or DataMap
+		else if (localName.equals(PROPERTY_TAG)) {
+			processStartDataMapProperty(attributes);
+		}
+	}
+
+	public void endElement(String namespaceURI, String local_name, String qName)
+			throws SAXException {
+		if (local_name.equals(DATA_MAP_TAG)) {
+			processEndDataMap();
+		} else if (local_name.equals(OBJ_ENTITY_TAG)) {
+			processEndObjEntity();
+		} else if (local_name.equals(OBJ_RELATIONSHIP_TAG)) {
+			processEndObjRelationship();
+		}
+
+		resetCurrentTag();
+		charactersBuffer = null;
+	}
+
+	protected void processStartObjEntity(Attributes atts) {
+		objEntity = new ObjEntity(atts.getValue("", "name"));
+		objEntity.setClassName(atts.getValue("", "className"));
+		objEntity.setClientClassName(atts.getValue("", "clientClassName"));
+
+		String readOnly = atts.getValue("", "readOnly");
+		objEntity.setReadOnly(TRUE.equalsIgnoreCase(readOnly));
+
+		String serverOnly = atts.getValue("", "serverOnly");
+		objEntity.setServerOnly(TRUE.equalsIgnoreCase(serverOnly));
+
+		String lockType = atts.getValue("", "lock-type");
+		if ("optimistic".equals(lockType)) {
+			objEntity.setDeclaredLockType(ObjEntity.LOCK_TYPE_OPTIMISTIC);
+		}
+
+		String superEntityName = atts.getValue("", "superEntityName");
+		if (superEntityName != null) {
+			objEntity.setSuperEntityName(superEntityName);
+		} else {
+			objEntity.setDbEntityName(atts.getValue("", "dbEntityName"));
+			objEntity.setSuperClassName(atts.getValue("", "superClassName"));
+			objEntity.setClientSuperClassName(atts.getValue("",
+					"clientSuperClassName"));
+		}
+
+		dataMap.addObjEntity(objEntity);
+	}
+
+	protected void processStartObjAttribute(Attributes atts) {
+		String name = atts.getValue("", "name");
+		String type = atts.getValue("", "type");
+
+		String lock = atts.getValue("", "lock");
+
+		ObjAttribute oa = new ObjAttribute(name);
+		oa.setType(type);
+		oa.setUsedForLocking(TRUE.equalsIgnoreCase(lock));
+		objEntity.addAttribute(oa);
+		String dbPath = atts.getValue("", "db-attribute-path");
+		if (dbPath == null) {
+			dbPath = atts.getValue("", "db-attribute-name");
+		}
+		oa.setDbAttributePath(dbPath);
+	}
+
+	protected void processStartObjRelationship(Attributes atts)
+			throws SAXException {
+		String name = atts.getValue("", "name");
+		if (null == name) {
+			throw new SAXException("MapLoader::processStartObjRelationship(),"
+					+ " Unable to parse target. Attributes:\n"
+					+ printAttributes(atts).toString());
+		}
+
+		String sourceName = atts.getValue("", "source");
+		if (sourceName == null) {
+			throw new SAXException("MapLoader::processStartObjRelationship(),"
+					+ " Unable to parse source. Attributes:\n"
+					+ printAttributes(atts).toString());
+		}
+
+		ObjEntity source = dataMap.getObjEntity(sourceName);
+		if (source == null) {
+			throw new SAXException("MapLoader::processStartObjRelationship(),"
+					+ " Unable to find source " + sourceName);
+		}
+
+		String deleteRuleName = atts.getValue("", "deleteRule");
+		int deleteRule = (deleteRuleName != null) ? DeleteRule
+				.deleteRuleForName(deleteRuleName) : DeleteRule.NO_ACTION;
+
+		objRelationship = new ClientObjRelationship(name);
+		objRelationship.setSourceEntity(source);
+		objRelationship.setTargetEntityName(atts.getValue("", "target"));
+		objRelationship.setDeleteRule(deleteRule);
+		objRelationship.setUsedForLocking(TRUE.equalsIgnoreCase(atts.getValue(
+				"", "lock")));
+
+		// Added 
+
+		objRelationship.setToMany(TRUE.equalsIgnoreCase(atts.getValue("",
+				"toMany")));
+
+		objRelationship.setReadOnly(TRUE.equalsIgnoreCase(atts.getValue("",
+				"readOnly")));
+
+		objRelationship.setReverseRelationshipName(atts.getValue("",
+				"reverseRelationshipName"));
+
+		source.addRelationship(objRelationship);
+
+	}
+
+	protected void processStartDataMapProperty(Attributes attributes)
+			throws SAXException {
+		String name = attributes.getValue("", "name");
+		if (null == name) {
+			throw new SAXException(
+					"MapLoader::processStartDataMapProperty(), no property name.");
+		}
+
+		String value = attributes.getValue("", "value");
+		if (null == value) {
+			throw new SAXException(
+					"MapLoader::processStartDataMapProperty(), no property value.");
+		}
+
+		if (mapProperties == null) {
+			mapProperties = new TreeMap<String, String>();
+		}
+
+		mapProperties.put(name, value);
+	}
+
+	protected void processEndDataMap() {
+		if (mapProperties != null) {
+			dataMap.initWithProperties(mapProperties);
+		}
+
+		mapProperties = null;
+	}
+
+	protected void processEndObjEntity() {
+		objEntity = null;
+	}
+
+	protected void processEndObjRelationship() {
+		objRelationship = null;
+	}
+
+	/** Prints the attributes. Used for error reporting purposes. */
+	protected StringBuffer printAttributes(Attributes atts) {
+		StringBuffer sb = new StringBuffer();
+		String name, value;
+		for (int i = 0; i < atts.getLength(); i++) {
+			value = atts.getQName(i);
+			name = atts.getValue(i);
+			sb.append("Name: " + name + "\tValue: " + value + "\n");
+		}
+		return sb;
+	}
+
+	public void characters(char[] text, int start, int length)
+			throws org.xml.sax.SAXException {
+		if (charactersBuffer != null) {
+			charactersBuffer.append(text, start, length);
+		}
+	}
+
+	protected void rememberCurrentTag(String tag) {
+		currentTag = tag;
+	}
+
+	protected void resetCurrentTag() {
+		currentTag = null;
+	}
+
+	/**
+	 * @since 2.0
+	 */
+	protected String convertClassNameFromV1_2(String name) {
+		if (name == null) {
+			return null;
+		}
+
+		// upgrade from v. <= 1.2
+		if (name.startsWith(_1_2_PACKAGE_PREFIX)) {
+			return _2_0_PACKAGE_PREFIX
+					+ name.substring(_1_2_PACKAGE_PREFIX.length());
+		}
+
+		return name;
+	}
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientObjRelationship.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientObjRelationship.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientObjRelationship.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/client/map/ClientObjRelationship.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,154 @@
+/****************************************************************************
+ *  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.client.map;
+
+import org.apache.cayenne.map.DeleteRule;
+import org.apache.cayenne.map.Entity;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.map.ObjRelationship;
+import org.apache.cayenne.util.Util;
+import org.apache.cayenne.util.XMLEncoder;
+
+/**
+ * client side variant of ObjRelationship. Does not depends on database info.
+ * Can be used without DbRelationship definitions.
+ * 
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+@SuppressWarnings("serial")
+public class ClientObjRelationship extends ObjRelationship {
+
+	private String reverseRelationshipName;
+
+	private boolean readOnly;
+
+	private boolean toMany;
+
+	public ClientObjRelationship(String name, String reverseRelationshipName,
+			boolean toMany, boolean readOnly) {
+		super(name);
+		this.toMany = toMany;
+		this.readOnly = readOnly;
+		this.reverseRelationshipName = reverseRelationshipName;
+	}
+
+	public boolean isToMany() {
+		return toMany;
+	}
+
+	public boolean isReadOnly() {
+		return readOnly;
+	}
+
+	public void setReadOnly(boolean readOnly) {
+		this.readOnly = readOnly;
+	}
+
+	public void setReverseRelationshipName(String reverseRelationshipName) {
+		this.reverseRelationshipName = reverseRelationshipName;
+	}
+
+	public void setToMany(boolean toMany) {
+		this.toMany = toMany;
+	}
+
+	public String getReverseRelationshipName() {
+		return reverseRelationshipName;
+	}
+
+	public ObjRelationship getReverseRelationship() {
+		if (reverseRelationshipName == null) {
+			return null;
+		}
+
+		Entity target = getTargetEntity();
+		if (target == null) {
+			return null;
+		}
+
+		return (ObjRelationship) target
+				.getRelationship(reverseRelationshipName);
+	}
+
+	public ClientObjRelationship() {
+		super();
+	}
+
+	public ClientObjRelationship(String name) {
+		super(name);
+	}
+
+	public static ClientObjRelationship createClientObjRelationship(
+			ObjRelationship proto) {
+		ClientObjRelationship res = new ClientObjRelationship(proto.getName());
+
+		res.setReadOnly(proto.isReadOnly());
+		res.setReverseRelationshipName(proto.getReverseRelationshipName());
+		res.setToMany(proto.isToMany());
+		res.setUsedForLocking(proto.isUsedForLocking());
+		res.setSourceEntity(proto.getSourceEntity());
+		res.setTargetEntity(proto.getTargetEntity());
+		res.setDeleteRule(proto.getDeleteRule());
+
+		return res;
+	}
+
+	@Override
+	public void encodeAsXML(XMLEncoder encoder) {
+		ObjEntity source = (ObjEntity) getSourceEntity();
+		if (source == null) {
+			return;
+		}
+
+		encoder.print("<obj-relationship name=\"" + getName());
+		encoder.print("\" source=\"" + source.getName());
+
+		ObjEntity target = (ObjEntity) getTargetEntity();
+		if (target != null) {
+			encoder.print("\" target=\"" + target.getName());
+		}
+
+		if (isUsedForLocking()) {
+			encoder.print("\" lock=\"true");
+		}
+
+		String deleteRule = DeleteRule.deleteRuleName(getDeleteRule());
+		if (getDeleteRule() != DeleteRule.NO_ACTION && deleteRule != null) {
+			encoder.print("\" deleteRule=\"" + deleteRule);
+		}
+
+		// Added
+
+		if (this.isReadOnly()) {
+			encoder.print("\" readOnly=\"true");
+		}
+
+		if (this.isToMany()) {
+			encoder.print("\" toMany=\"true");
+		}
+
+		if (this.reverseRelationshipName != null) {
+			encoder.print("\" reverseRelationshipName=\"");
+			encoder.print(Util.encodeXmlAttribute(reverseRelationshipName));
+		}
+
+		encoder.println("\"/>");
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/peerdata/PeerDataUser.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/peerdata/PeerDataUser.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/peerdata/PeerDataUser.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/peerdata/PeerDataUser.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,32 @@
+/****************************************************************************
+ *  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.peerdata;
+
+/**
+ * Interface for objects whic use ServicePeerData objects.
+ * 
+ * CayenneSerializerFactory/CayenneDeserializerFactory automaticaly sets
+ * provided ServicePeerData objects to all ser/deser classes implementing this
+ * interface.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+public interface PeerDataUser {
+	public void setPeerData(ServicePeerData value);
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/peerdata/ServicePeerData.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/peerdata/ServicePeerData.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/peerdata/ServicePeerData.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/peerdata/ServicePeerData.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,146 @@
+/****************************************************************************
+ *  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.peerdata;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cayenne.CayenneException;
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.conf.Configuration;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.remote.axis.client.map.ClientMapLoader;
+import org.apache.cayenne.util.ResourceLocator;
+import org.xml.sax.InputSource;
+
+/**
+ * This class contains client session objects needed for
+ * serialization/deserialization process.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+public class ServicePeerData {
+	private boolean isServerSide = false;
+	
+	private ObjectContext context;
+
+	private Map<String, DataMap> dataMaps;
+
+	public ObjectContext getContext() {
+		return context;
+	}
+
+	public void setContext(ObjectContext context) {
+		this.context = context;
+	}
+
+	public Map<String, DataMap> getDataMaps() {
+		if (dataMaps == null)
+			dataMaps = new HashMap<String, DataMap>();
+		return dataMaps;
+	}
+
+	public DataMap getDataMap(String name) {
+		if (context instanceof DataContext) {
+			return getDataMaps().get(name);
+		} else {
+
+			DataMap map = getDataMaps().get(name);
+			if (map == null) {
+				InputStream in = new ResourceLocator().findResourceStream(name
+						+ ".map.xml");
+
+				ClientMapLoader loader = new ClientMapLoader();
+
+				if (in == null) {
+					throw new CayenneRuntimeException("Can't find data map "
+							+ name);
+				}
+
+				try {
+					InputSource inSrc = new InputSource(in);
+					inSrc.setSystemId(name);
+					map = loader.loadDataMap(inSrc);
+				} finally {
+					try {
+						in.close();
+					} catch (IOException ioex) {
+					}
+				}
+
+				if (map != null)
+					getDataMaps().put(map.getName(), map);
+			}
+
+			return map;
+		}
+	}
+
+	public void setDataMaps(Map<String, DataMap> dataMaps) {
+		this.dataMaps = dataMaps;
+	}
+
+	/**
+	 * Creates ServicePeerData based on Cayenne local configuration.
+	 * 
+	 * @return
+	 */
+	public static ServicePeerData createServerPeerData() {
+		ServicePeerData peerData = new ServicePeerData(true);
+		peerData.setContext(Configuration.getSharedConfiguration().getDomain()
+				.createDataContext());
+		Map<String, DataMap> maps = peerData.getDataMaps();
+		for (Object obj : peerData.context.getEntityResolver().getDataMaps()) {
+			DataMap map = (DataMap) obj;
+			maps.put(map.getName(), map);
+		}		
+		
+		return peerData;
+	}
+
+	/**
+	 * Creates client-side ServicePeerData. Assigns no ObjectContext.
+	 * 
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("unchecked")
+	public static ServicePeerData createClientPeerData()
+			throws CayenneException {
+		ServicePeerData peerData = new ServicePeerData();
+		return peerData;
+	}
+
+	public boolean isServerSide() {
+		return isServerSide;
+	}
+
+	public ServicePeerData() {
+		super();
+	}
+
+	public ServicePeerData(boolean isServerSide) {
+		super();
+		this.isServerSide = isServerSide;
+	}
+
+	
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneDeserializerFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneDeserializerFactory.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneDeserializerFactory.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneDeserializerFactory.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,86 @@
+/****************************************************************************
+ *  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 javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.encoding.Deserializer;
+
+import org.apache.axis.encoding.ser.BaseDeserializerFactory;
+import org.apache.cayenne.remote.axis.peerdata.PeerDataUser;
+import org.apache.cayenne.remote.axis.peerdata.ServicePeerData;
+
+/**
+ * Deserializer factory for use with Cayenne AXIS WS.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+@SuppressWarnings("serial")
+public class CayenneDeserializerFactory extends BaseDeserializerFactory
+		implements PeerDataUser {
+
+	private ServicePeerData peerData;
+
+	@Override
+	public Deserializer getDeserializerAs(String mechanismType)
+			throws JAXRPCException {
+		Deserializer deser = super.getDeserializerAs(mechanismType);
+		if ((deser != null) && (deser instanceof PeerDataUser))
+			((PeerDataUser) deser).setPeerData(getPeerData());
+		return deser;
+
+	}
+
+	@Override
+	protected org.apache.axis.encoding.Deserializer getGeneralPurpose(
+			String mechanismType) {
+		org.apache.axis.encoding.Deserializer deser = super
+				.getGeneralPurpose(mechanismType);
+		if ((deser != null) && (deser instanceof PeerDataUser))
+			((PeerDataUser) deser).setPeerData(getPeerData());
+		return deser;
+	}
+
+	@Override
+	protected org.apache.axis.encoding.Deserializer getSpecialized(
+			String mechanismType) {
+		org.apache.axis.encoding.Deserializer deser = super
+				.getSpecialized(mechanismType);
+		if ((deser != null) && (deser instanceof PeerDataUser))
+			((PeerDataUser) deser).setPeerData(getPeerData());
+		return deser;
+	}
+
+	@SuppressWarnings("unchecked")
+	public CayenneDeserializerFactory(Class javaType, QName xmlType) {
+		super(CayenneSerializationMapping.getDeserializerClass(javaType),
+				xmlType, javaType);
+
+	}
+
+	public ServicePeerData getPeerData() {
+		if (peerData == null)
+			peerData = ServicePeerData.createServerPeerData();
+		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/CayenneSerializationMapping.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneSerializationMapping.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneSerializationMapping.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneSerializationMapping.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,273 @@
+/****************************************************************************
+ *  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.Date;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.TypeMapping;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
+import org.apache.axis.encoding.ser.ArraySerializerFactory;
+import org.apache.axis.encoding.ser.BeanDeserializer;
+import org.apache.axis.encoding.ser.BeanSerializer;
+import org.apache.axis.encoding.ser.CalendarSerializer;
+import org.apache.cayenne.Fault;
+import org.apache.cayenne.ObjectId;
+import org.apache.cayenne.Persistent;
+import org.apache.cayenne.QueryResponse;
+import org.apache.cayenne.access.ToManyList;
+import org.apache.cayenne.exp.Expression;
+import org.apache.cayenne.graph.ArcCreateOperation;
+import org.apache.cayenne.graph.ArcDeleteOperation;
+import org.apache.cayenne.graph.CompoundDiff;
+import org.apache.cayenne.graph.GraphDiff;
+import org.apache.cayenne.graph.NodeCreateOperation;
+import org.apache.cayenne.graph.NodeDeleteOperation;
+import org.apache.cayenne.graph.NodeDiff;
+import org.apache.cayenne.graph.NodeIdChangeOperation;
+import org.apache.cayenne.graph.NodePropertyChangeOperation;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.EntityResolver;
+import org.apache.cayenne.query.AbstractQuery;
+import org.apache.cayenne.query.DeleteQuery;
+import org.apache.cayenne.query.IndirectQuery;
+import org.apache.cayenne.query.NamedQuery;
+import org.apache.cayenne.query.ObjectIdQuery;
+import org.apache.cayenne.query.QualifiedQuery;
+import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryChain;
+import org.apache.cayenne.query.QueryMetadata;
+import org.apache.cayenne.query.RelationshipQuery;
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.UpdateQuery;
+import org.apache.cayenne.remote.axis.Constants;
+import org.apache.cayenne.remote.axis.peerdata.ServicePeerData;
+import org.apache.cayenne.remote.axis.ser.query.AbstractQueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.AbstractQuerySerializer;
+import org.apache.cayenne.remote.axis.ser.query.DeleteQueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.DeleteQuerySerializer;
+import org.apache.cayenne.remote.axis.ser.query.IndirectQueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.IndirectQuerySerializer;
+import org.apache.cayenne.remote.axis.ser.query.NamedQueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.NamedQuerySerializer;
+import org.apache.cayenne.remote.axis.ser.query.ObjectIdQueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.ObjectIdQuerySerializer;
+import org.apache.cayenne.remote.axis.ser.query.QualifiedQueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.QualifiedQuerySerializer;
+import org.apache.cayenne.remote.axis.ser.query.QueryChainDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.QueryChainSerializer;
+import org.apache.cayenne.remote.axis.ser.query.QueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.QueryMetadataDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.QueryMetadataSerializer;
+import org.apache.cayenne.remote.axis.ser.query.QuerySerializer;
+import org.apache.cayenne.remote.axis.ser.query.RelationshipQueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.RelationshipQuerySerializer;
+import org.apache.cayenne.remote.axis.ser.query.SelectQueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.SelectQuerySerializer;
+import org.apache.cayenne.remote.axis.ser.query.UpdateQueryDeserializer;
+import org.apache.cayenne.remote.axis.ser.query.UpdateQuerySerializer;
+import org.apache.cayenne.remote.axis.ser.resolving.DataMapDeserializer;
+import org.apache.cayenne.remote.axis.ser.resolving.DataMapSerializer;
+import org.apache.cayenne.remote.axis.ser.resolving.EntityResolverDeserializer;
+import org.apache.cayenne.remote.axis.ser.resolving.EntityResolverSerializer;
+import org.apache.cayenne.remote.axis.ser.sync.ArcCreateOperationDeserializer;
+import org.apache.cayenne.remote.axis.ser.sync.ArcCreateOperationSerializer;
+import org.apache.cayenne.remote.axis.ser.sync.ArcDeleteOperationDeserializer;
+import org.apache.cayenne.remote.axis.ser.sync.ArcDeleteOperationSerializer;
+import org.apache.cayenne.remote.axis.ser.sync.CompoundDiffDeserializer;
+import org.apache.cayenne.remote.axis.ser.sync.CompoundDiffSerializer;
+import org.apache.cayenne.remote.axis.ser.sync.GraphDiffDeserializer;
+import org.apache.cayenne.remote.axis.ser.sync.GraphDiffSerializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodeCreateOperationDeserializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodeCreateOperationSerializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodeDeleteOperationDeserializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodeDeleteOperationSerializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodeDiffDeserializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodeDiffSerializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodeIdChangeOperationDeserializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodeIdChangeOperationSerializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodePropertyChangeOperationDeserializer;
+import org.apache.cayenne.remote.axis.ser.sync.NodePropertyChangeOperationSerializer;
+import org.apache.cayenne.util.GenericResponse;
+import org.apache.cayenne.util.ListResponse;
+
+/**
+ * Contains information to map Cayenne classes to their serializers and 
+ * deserializers and mapping-related utility methods.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ *
+ */
+public class CayenneSerializationMapping {
+
+	protected static final Object[][] TYPE_MAPPING = new Object[][] {
+			{ Persistent.class, PersistentSerializer.class,
+					PersistentDeserializer.class },
+			{ ToManyList.class, ToManyListSerializer.class,
+					ToManyListDeserializer.class },
+
+			{ Expression.class, ExpressionSerializer.class,
+					ExpressionDeserializer.class },
+
+			{ Fault.class, FaultSerializer.class, FaultDeserializer.class },
+
+			// Queries
+			{ Query.class, QuerySerializer.class, QueryDeserializer.class },
+			{ AbstractQuery.class, AbstractQuerySerializer.class,
+					AbstractQueryDeserializer.class },
+			{ QualifiedQuery.class, QualifiedQuerySerializer.class,
+					QualifiedQueryDeserializer.class },
+			{ SelectQuery.class, SelectQuerySerializer.class,
+					SelectQueryDeserializer.class },
+			{ DeleteQuery.class, DeleteQuerySerializer.class,
+					DeleteQueryDeserializer.class },
+			{ UpdateQuery.class, UpdateQuerySerializer.class,
+					UpdateQueryDeserializer.class },
+			{ QueryChain.class, QueryChainSerializer.class,
+					QueryChainDeserializer.class },
+			{ IndirectQuery.class, IndirectQuerySerializer.class,
+					IndirectQueryDeserializer.class },
+			{ NamedQuery.class, NamedQuerySerializer.class,
+					NamedQueryDeserializer.class },
+			{ ObjectIdQuery.class, ObjectIdQuerySerializer.class,
+					ObjectIdQueryDeserializer.class },
+			{ RelationshipQuery.class, RelationshipQuerySerializer.class,
+					RelationshipQueryDeserializer.class },
+			{ QueryMetadata.class, QueryMetadataSerializer.class,
+					QueryMetadataDeserializer.class },
+
+			// Responses
+			{ QueryResponse.class, QueryResponseSerializer.class,
+					QueryResponseDeserializer.class },
+			{ GenericResponse.class, GenericResponseSerializer.class,
+					GenericResponseDeserializer.class },
+			{ ListResponse.class, ListResponseSerializer.class,
+					ListResponseDeserializer.class },
+
+			{ ObjectId.class, ObjectIdSerializer.class,
+					ObjectIdDeserializer.class },
+
+			// Sync
+			{ GraphDiff.class, GraphDiffSerializer.class,
+					GraphDiffDeserializer.class },
+			{ NodeDiff.class, NodeDiffSerializer.class,
+					NodeDiffDeserializer.class },
+			{ NodeCreateOperation.class, NodeCreateOperationSerializer.class,
+					NodeCreateOperationDeserializer.class },
+			{ NodeDeleteOperation.class, NodeDeleteOperationSerializer.class,
+					NodeDeleteOperationDeserializer.class },
+			{ NodeCreateOperation.class, NodeCreateOperationSerializer.class,
+					NodeCreateOperationDeserializer.class },
+			{ NodeIdChangeOperation.class,
+					NodeIdChangeOperationSerializer.class,
+					NodeIdChangeOperationDeserializer.class },
+			{ NodePropertyChangeOperation.class,
+					NodePropertyChangeOperationSerializer.class,
+					NodePropertyChangeOperationDeserializer.class },
+			{ ArcCreateOperation.class, ArcCreateOperationSerializer.class,
+					ArcCreateOperationDeserializer.class },
+			{ ArcDeleteOperation.class, ArcDeleteOperationSerializer.class,
+					ArcDeleteOperationDeserializer.class },
+			{ CompoundDiff.class, CompoundDiffSerializer.class,
+					CompoundDiffDeserializer.class },
+
+			// Resolving
+			{ DataMap.class, DataMapSerializer.class, DataMapDeserializer.class },
+			{ EntityResolver.class, EntityResolverSerializer.class,
+					EntityResolverDeserializer.class },
+
+			// Util
+			{ Date.class, CalendarSerializer.class, DateDeserializer.class,
+					XMLType.XSD_DATETIME } };
+
+	protected static Object[][] ARRAY_MAPPING = new Object[][] {
+			{ GraphDiff[].class, "ArrayOfGraphDiffs" },
+			{ Query[].class, "ArrayOfQueries" },
+			{ GraphDiff[].class, "ArrayOfGraphDiffs" }, };
+
+	protected static void registerArrayMappings(TypeMapping tm) {
+		for (int i = 0; i < ARRAY_MAPPING.length; i++) {
+			QName typeQName;
+			if (ARRAY_MAPPING[i].length > 2) {
+				typeQName = (QName) ARRAY_MAPPING[i][2];
+			} else {
+				typeQName = new QName(Constants.CAYENNE_NS,
+						((String) ARRAY_MAPPING[i][1]));
+			}
+			Class javaType = ((Class) ARRAY_MAPPING[i][0]);
+			Class itemJavaType = javaType.getComponentType();
+			tm.register(javaType, typeQName, new ArraySerializerFactory(
+					new QName(typeQName.getNamespaceURI(), itemJavaType
+							.getSimpleName())), new ArrayDeserializerFactory());
+		}
+	}
+
+	public static void registerComplexTypeMappings(TypeMapping tm,
+			ServicePeerData peerData) {
+		for (int i = 0; i < TYPE_MAPPING.length; i++) {
+			QName typeQName;
+			if (TYPE_MAPPING[i].length > 3) {
+				typeQName = (QName) TYPE_MAPPING[i][3];
+			} else {
+				typeQName = new QName(Constants.CAYENNE_NS,
+						((Class) TYPE_MAPPING[i][0]).getSimpleName());
+			}
+			Class javaType = ((Class) TYPE_MAPPING[i][0]);
+
+			CayenneSerializerFactory sf = new CayenneSerializerFactory(
+					javaType, typeQName);
+			sf.setPeerData(peerData);
+			CayenneDeserializerFactory df = new CayenneDeserializerFactory(
+					javaType, typeQName);
+			df.setPeerData(peerData);
+
+			tm.register(javaType, typeQName, sf, df);
+		}
+	}
+
+	public static void registerTypeMappings(TypeMapping tm, ServicePeerData peerData) {
+		registerComplexTypeMappings(tm, peerData);
+		registerArrayMappings(tm);
+	}
+
+	@SuppressWarnings("unchecked")
+	public static Class getDeserializerClass(Class javaType) {
+		Class deserClass = BeanDeserializer.class;
+		for (int i = 0; i < CayenneSerializationMapping.TYPE_MAPPING.length; i++) {
+			if (((Class) CayenneSerializationMapping.TYPE_MAPPING[i][0])
+					.isAssignableFrom(javaType))
+				deserClass = ((Class) CayenneSerializationMapping.TYPE_MAPPING[i][2]);
+		}
+		return deserClass;
+
+	}
+
+	@SuppressWarnings("unchecked")
+	public static Class getSerializerClass(Class javaType) {
+		Class serClass = BeanSerializer.class;
+		for (int i = 0; i < CayenneSerializationMapping.TYPE_MAPPING.length; i++) {
+			if (((Class) CayenneSerializationMapping.TYPE_MAPPING[i][0])
+					.isAssignableFrom(javaType))
+				serClass = ((Class) CayenneSerializationMapping.TYPE_MAPPING[i][1]);
+		}
+		return serClass;
+
+	}
+
+}

Added: incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneSerializerFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneSerializerFactory.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneSerializerFactory.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/CayenneSerializerFactory.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,90 @@
+/****************************************************************************
+ *  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 javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+
+import org.apache.axis.encoding.Serializer;
+import org.apache.axis.encoding.ser.BaseSerializerFactory;
+import org.apache.cayenne.remote.axis.peerdata.PeerDataUser;
+import org.apache.cayenne.remote.axis.peerdata.ServicePeerData;
+
+/**
+ * Serializer factory for use with Cayenne AXIS WS.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ * 
+ */
+@SuppressWarnings("serial")
+public class CayenneSerializerFactory extends BaseSerializerFactory implements
+		PeerDataUser {
+
+	private ServicePeerData peerData;
+
+	@SuppressWarnings("unchecked")
+	public CayenneSerializerFactory(Class javaType, QName xmlType) {
+		super(CayenneSerializationMapping.getSerializerClass(javaType),
+				xmlType, javaType);
+	}
+
+	@Override
+	protected Serializer getGeneralPurpose(String mechanismType) {
+		Serializer ser = super.getGeneralPurpose(mechanismType);
+		if ((ser != null) && (ser instanceof PeerDataUser))
+			((PeerDataUser) ser).setPeerData(getPeerData());
+		return ser;
+	}
+
+	@Override
+	public javax.xml.rpc.encoding.Serializer getSerializerAs(
+			String mechanismType) throws JAXRPCException {
+		javax.xml.rpc.encoding.Serializer ser = super
+				.getSerializerAs(mechanismType);
+		if ((ser != null) && (ser instanceof PeerDataUser))
+			((PeerDataUser) ser).setPeerData(getPeerData());
+		return ser;
+	}
+
+	@Override
+	protected Serializer getSerializerAsInternal(String mechanismType)
+			throws JAXRPCException {
+		Serializer ser = super.getSerializerAsInternal(mechanismType);
+		if ((ser != null) && (ser instanceof PeerDataUser))
+			((PeerDataUser) ser).setPeerData(getPeerData());
+		return ser;
+	}
+
+	@Override
+	protected Serializer getSpecialized(String mechanismType) {
+		Serializer ser = super.getSpecialized(mechanismType);
+		if ((ser != null) && (ser instanceof PeerDataUser))
+			((PeerDataUser) ser).setPeerData(getPeerData());
+		return ser;
+	}
+
+	public ServicePeerData getPeerData() {
+		if (peerData == null)
+			peerData = ServicePeerData.createServerPeerData();
+		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/DateDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/DateDeserializer.java?view=auto&rev=441230
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/DateDeserializer.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-ropwsdl/cayenne-axis/src/org/apache/cayenne/remote/axis/ser/DateDeserializer.java Thu Sep  7 14:28:04 2006
@@ -0,0 +1,38 @@
+/****************************************************************************
+ *  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.Date;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.ser.CalendarDeserializer;
+
+/**
+ * AXIS deserializer for Cayenne class.
+ * 
+ * @author Michael Victorov (m_victorov@mail.ru)
+ */
+@SuppressWarnings("serial")
+public class DateDeserializer extends CalendarDeserializer {
+	
+	 public DateDeserializer(Class javaType, QName xmlType) {
+	        super(Date.class, xmlType);
+	   }
+	
+
+}



Mime
View raw message