You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by an...@apache.org on 2010/03/08 09:29:09 UTC
svn commit: r920227 [1/2] - in /cayenne/sandbox/cayenne-gwt: ./ .settings/
src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/cayenne/ src/main/resources/
src/main/resources/org/ src/main/resources/org/a...
Author: andrey
Date: Mon Mar 8 08:29:07 2010
New Revision: 920227
URL: http://svn.apache.org/viewvc?rev=920227&view=rev
Log:
cayenne-gwt project
Added:
cayenne/sandbox/cayenne-gwt/.classpath
cayenne/sandbox/cayenne-gwt/.project
cayenne/sandbox/cayenne-gwt/.settings/
cayenne/sandbox/cayenne-gwt/.settings/com.google.gwt.eclipse.core.prefs
cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.core.prefs
cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.ui.prefs
cayenne/sandbox/cayenne-gwt/.settings/org.maven.ide.eclipse.prefs
cayenne/sandbox/cayenne-gwt/pom.xml
cayenne/sandbox/cayenne-gwt/src/
cayenne/sandbox/cayenne-gwt/src/main/
cayenne/sandbox/cayenne-gwt/src/main/java/
cayenne/sandbox/cayenne-gwt/src/main/java/org/
cayenne/sandbox/cayenne-gwt/src/main/java/org/apache/
cayenne/sandbox/cayenne-gwt/src/main/java/org/apache/cayenne/
cayenne/sandbox/cayenne-gwt/src/main/java/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java
cayenne/sandbox/cayenne-gwt/src/main/resources/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/Cayenne.gwt.xml
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneRuntimeException.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/DataObject.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Fault.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/FaultFailureException.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectContext.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectId.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistenceState.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Persistent.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistentObject.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ValueHolder.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyList.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyListFault.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManySetFault.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToOneFault.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/util/
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/util/IDUtil.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/util/PersistentObjectList.java
cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/util/RelationshipFault.java
cayenne/sandbox/cayenne-gwt/src/test/
cayenne/sandbox/cayenne-gwt/src/test/java/
cayenne/sandbox/cayenne-gwt/src/test/java/org/
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/CayenneGWTTest.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/GwtTestSerialization.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/TestService.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/TestServiceAsync.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/model/
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/model/Forest.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/model/TestDomainMap.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/model/Tree.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/model/auto/
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/model/auto/_Forest.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/model/auto/_TestDomainMap.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/client/model/auto/_Tree.java
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/server/
cayenne/sandbox/cayenne-gwt/src/test/java/org/apache/cayenne/gwt/test/server/TestServiceImpl.java
cayenne/sandbox/cayenne-gwt/src/test/resources/
cayenne/sandbox/cayenne-gwt/src/test/resources/TestDomainMap.map.xml
cayenne/sandbox/cayenne-gwt/src/test/resources/TestDomainNode.driver.xml
cayenne/sandbox/cayenne-gwt/src/test/resources/cayenne.xml
cayenne/sandbox/cayenne-gwt/src/test/resources/org/
cayenne/sandbox/cayenne-gwt/src/test/resources/org/apache/
cayenne/sandbox/cayenne-gwt/src/test/resources/org/apache/cayenne/
cayenne/sandbox/cayenne-gwt/src/test/resources/org/apache/cayenne/gwt/
cayenne/sandbox/cayenne-gwt/src/test/resources/org/apache/cayenne/gwt/test/
cayenne/sandbox/cayenne-gwt/src/test/resources/org/apache/cayenne/gwt/test/CayenneTest.gwt.xml
cayenne/sandbox/cayenne-gwt/war/
cayenne/sandbox/cayenne-gwt/war/WEB-INF/
cayenne/sandbox/cayenne-gwt/war/WEB-INF/web.xml
Modified:
cayenne/sandbox/cayenne-gwt/ (props changed)
Propchange: cayenne/sandbox/cayenne-gwt/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 8 08:29:07 2010
@@ -0,0 +1,3 @@
+target
+tomcat
+www-test
Added: cayenne/sandbox/cayenne-gwt/.classpath
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/.classpath?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/.classpath (added)
+++ cayenne/sandbox/cayenne-gwt/.classpath Mon Mar 8 08:29:07 2010
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry excluding="org/apache/cayenne/emul/org/apache/cayenne/" kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: cayenne/sandbox/cayenne-gwt/.project
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/.project?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/.project (added)
+++ cayenne/sandbox/cayenne-gwt/.project Mon Mar 8 08:29:07 2010
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>cayenne-gwt</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>com.google.gwt.eclipse.core.gwtNature</nature>
+ <nature>com.google.gdt.eclipse.core.webAppNature</nature>
+ </natures>
+</projectDescription>
Added: cayenne/sandbox/cayenne-gwt/.settings/com.google.gwt.eclipse.core.prefs
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/.settings/com.google.gwt.eclipse.core.prefs?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/.settings/com.google.gwt.eclipse.core.prefs (added)
+++ cayenne/sandbox/cayenne-gwt/.settings/com.google.gwt.eclipse.core.prefs Mon Mar 8 08:29:07 2010
@@ -0,0 +1,3 @@
+#Fri Mar 05 09:36:01 MSK 2010
+eclipse.preferences.version=1
+filesCopiedToWebInfLib=gwt-servlet.jar
Added: cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.core.prefs?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.core.prefs (added)
+++ cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.core.prefs Mon Mar 8 08:29:07 2010
@@ -0,0 +1,13 @@
+#Thu Mar 04 17:12:19 MSK 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
Added: cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.ui.prefs
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.ui.prefs?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.ui.prefs (added)
+++ cayenne/sandbox/cayenne-gwt/.settings/org.eclipse.jdt.ui.prefs Mon Mar 8 08:29:07 2010
@@ -0,0 +1,4 @@
+#Mon Mar 08 01:49:49 MSK 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.javadoc=false
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert
\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n *
${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-JSDoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\
="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${t
odo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomm
ent" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_con
text" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*****************************************************************\r\n * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * "License"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing,\r\n * software distributed under the License is distributed on an\r\n * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n * KIND, either express or implied. See the License for the\r\n
* specific language governing permissions and limitations\r\n * under the License.\r\n ****************************************************************/\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\=
"false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement
}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
Added: cayenne/sandbox/cayenne-gwt/.settings/org.maven.ide.eclipse.prefs
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/.settings/org.maven.ide.eclipse.prefs?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/.settings/org.maven.ide.eclipse.prefs (added)
+++ cayenne/sandbox/cayenne-gwt/.settings/org.maven.ide.eclipse.prefs Mon Mar 8 08:29:07 2010
@@ -0,0 +1,9 @@
+#Thu Mar 04 16:21:13 MSK 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Added: cayenne/sandbox/cayenne-gwt/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/pom.xml?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/pom.xml (added)
+++ cayenne/sandbox/cayenne-gwt/pom.xml Mon Mar 8 08:29:07 2010
@@ -0,0 +1,85 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.cayenne</groupId>
+ <artifactId>cayenne-gwt</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>cayenne-gwt</name>
+ <description>Cayenne for GWT</description>
+
+ <properties>
+ <maven.compiler.source>1.6</maven.compiler.source>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>2.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cayenne</groupId>
+ <artifactId>cayenne-server</artifactId>
+ <version>3.0RC2</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cayenne</groupId>
+ <artifactId>cayenne-server</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <!-- execution>
+ <id>gwt-compile</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution-->
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+</project>
\ No newline at end of file
Added: cayenne/sandbox/cayenne-gwt/src/main/java/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/java/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/java/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/java/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,46 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.client.rpc.SerializationStreamReader;
+import com.google.gwt.user.client.rpc.SerializationStreamWriter;
+
+/**
+ * Custom serializer of CDOs
+ */
+public final class CayenneDataObject_CustomFieldSerializer {
+ public static void serialize(SerializationStreamWriter streamWriter, CayenneDataObject instance)
+ throws SerializationException {
+
+ streamWriter.writeInt(instance.persistenceState);
+ streamWriter.writeObject(instance.values);
+ streamWriter.writeObject(instance.objectId);
+ }
+
+ public static void deserialize(SerializationStreamReader streamReader, CayenneDataObject instance)
+ throws SerializationException {
+ instance.persistenceState = streamReader.readInt();
+ instance.values = (Map<String, Object>) streamReader.readObject();
+ instance.objectId = (ObjectId) streamReader.readObject();
+ }
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/Cayenne.gwt.xml
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/Cayenne.gwt.xml?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/Cayenne.gwt.xml (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/Cayenne.gwt.xml Mon Mar 8 08:29:07 2010
@@ -0,0 +1,3 @@
+<module>
+ <super-source path="emul"/>
+</module>
\ No newline at end of file
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,102 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class CayenneDataObject extends PersistentObject implements DataObject {
+ protected long snapshotVersion = DEFAULT_VERSION;
+
+ protected Map values = new HashMap();
+
+ public void writeProperty(String propName, Object val) {
+ writePropertyDirectly(propName, val);
+ }
+
+ public void writePropertyDirectly(String propName, Object val) {
+ values.put(propName, val);
+ }
+
+ public Object readProperty(String propertyName) {
+ Object object = readPropertyDirectly(propertyName);
+
+ if (object instanceof Fault) {
+ object = ((Fault) object).resolveFault(this, propertyName);
+ writePropertyDirectly(propertyName, object);
+ }
+
+ return object;
+ }
+
+ public Object readPropertyDirectly(String propName) {
+ return values.get(propName);
+ }
+
+ @Override
+ public void addToManyTarget(String relationshipName, DataObject target, boolean setReverse) {
+ if (target == null) {
+ throw new NullPointerException("Attempt to add null target DataObject.");
+ }
+
+ // Now do the rest of the normal handling (regardless of whether it was
+ // flattened or not)
+ Object holder = readProperty(relationshipName);
+
+ if (holder instanceof Collection) {
+ ((Collection<Object>) holder).add(target);
+ }
+ }
+
+ @Override
+ public long getSnapshotVersion() {
+ return snapshotVersion;
+ }
+
+ @Override
+ public Object readNestedProperty(String path) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeToManyTarget(String relationshipName, DataObject target, boolean unsetReverse) {
+ Object holder = readProperty(relationshipName);
+
+ if (holder instanceof Collection) {
+ ((Collection<Object>) holder).remove(target);
+ }
+ }
+
+ @Override
+ public void setSnapshotVersion(long snapshotVersion) {
+ this.snapshotVersion = snapshotVersion;
+ }
+
+ @Override
+ public void setToOneTarget(String relationshipName, DataObject value, boolean setReverse) {
+ Object oldTarget = readProperty(relationshipName);
+ if (oldTarget == value) {
+ return;
+ }
+
+ writePropertyDirectly(relationshipName, value);
+ }
+}
\ No newline at end of file
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneDataObject_CustomFieldSerializer.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,46 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.client.rpc.SerializationStreamReader;
+import com.google.gwt.user.client.rpc.SerializationStreamWriter;
+
+/**
+ * Custom serializer of CDOs
+ */
+public final class CayenneDataObject_CustomFieldSerializer {
+ public static void serialize(SerializationStreamWriter streamWriter, CayenneDataObject instance)
+ throws SerializationException {
+
+ streamWriter.writeInt(instance.persistenceState);
+ streamWriter.writeObject(instance.values);
+ streamWriter.writeObject(instance.objectId);
+ }
+
+ public static void deserialize(SerializationStreamReader streamReader, CayenneDataObject instance)
+ throws SerializationException {
+ instance.persistenceState = streamReader.readInt();
+ instance.values = (Map<String, Object>) streamReader.readObject();
+ instance.objectId = (ObjectId) streamReader.readObject();
+ }
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneRuntimeException.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneRuntimeException.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneRuntimeException.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/CayenneRuntimeException.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,77 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+/**
+ * A generic unchecked exception that may be thrown by Cayenne framework. All runtime
+ * exceptions in Cayenne inherit from this class.
+ *
+ */
+public class CayenneRuntimeException extends RuntimeException {
+
+ /**
+ * Creates new CayenneRuntimeException without detail message.
+ */
+ public CayenneRuntimeException() {
+ }
+
+ /**
+ * Constructs an <code>CayenneRuntimeException</code> with the specified detail
+ * message.
+ *
+ * @param message the detail message.
+ */
+ public CayenneRuntimeException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs an <code>CayenneRuntimeException</code> that wraps
+ * <code>exception</code> thrown elsewhere.
+ */
+ public CayenneRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+ public CayenneRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Returns exception message without Cayenne version label.
+ *
+ * @since 1.1
+ */
+ public String getUnlabeledMessage() {
+ return super.getMessage();
+ }
+
+ /**
+ * Returns message that includes Cayenne version label and the actual exception
+ * message.
+ */
+ @Override
+ public String getMessage() {
+ String message = super.getMessage();
+ return (message != null)
+ ? "[Cayenne-GWT Module] " + message
+ : "[Cayenne-GWT Module] " + "(no message)";
+ }
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/DataObject.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/DataObject.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/DataObject.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/DataObject.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,152 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import org.apache.cayenne.Persistent;
+
+/**
+ * Defines basic methods for a persistent object in Cayenne.
+ */
+public interface DataObject extends Persistent {
+
+ public static final long DEFAULT_VERSION = Long.MIN_VALUE;
+
+ /**
+ * Modifies a value of a named property without altering the object state in any way,
+ * and without triggering any database operations. This method is intended mostly for
+ * internal use by Cayenne framework, and shouldn't be called from the application
+ * code.
+ */
+ public void writePropertyDirectly(String propertyName, Object val);
+
+ /**
+ * Returns mapped property value as curently stored in the DataObject. Returned value
+ * maybe a fault or a real value. This method will not attempt to resolve faults, or
+ * to read unmapped properties.
+ */
+ public Object readPropertyDirectly(String propertyName);
+
+ /**
+ * Returns a value of the property identified by a property path. Supports reading
+ * both mapped and unmapped properties. Unmapped properties are accessed in a manner
+ * consistent with JavaBeans specification.
+ * <p>
+ * Property path (or nested property) is a dot-separated path used to traverse object
+ * relationships until the final object is found. If a null object found while
+ * traversing path, null is returned. If a list is encountered in the middle of the
+ * path, CayenneRuntimeException is thrown. Unlike
+ * {@link #readPropertyDirectly(String)}, this method will resolve an object if it is
+ * HOLLOW.
+ * <p>
+ * Examples:
+ * </p>
+ * <ul>
+ * <li>Read this object property:<br>
+ * <code>String name = (String)artist.readNestedProperty("name");</code><br>
+ * <br>
+ * </li>
+ * <li>Read an object related to this object:<br>
+ * <code>Gallery g = (Gallery)paintingInfo.readNestedProperty("toPainting.toGallery");</code>
+ * <br>
+ * <br>
+ * </li>
+ * <li>Read a property of an object related to this object: <br>
+ * <code>String name = (String)painting.readNestedProperty("toArtist.artistName");</code>
+ * <br>
+ * <br>
+ * </li>
+ * <li>Read to-many relationship list:<br>
+ * <code>List exhibits = (List)painting.readNestedProperty("toGallery.exhibitArray");</code>
+ * <br>
+ * <br>
+ * </li>
+ * <li>Read to-many relationship in the middle of the path:<br>
+ * <code>List<String> names = (List<String>)artist.readNestedProperty("paintingArray.paintingName");</code>
+ * <br>
+ * <br>
+ * </li>
+ * </ul>
+ *
+ * @since 1.0.5
+ */
+ public Object readNestedProperty(String path);
+
+ /**
+ * Returns a value of the property identified by propName. Resolves faults if needed.
+ * This method can safely be used instead of or in addition to the auto-generated
+ * property accessors in subclasses of CayenneDataObject.
+ */
+ public Object readProperty(String propName);
+
+ /**
+ * Sets the property to the new value. Resolves faults if needed. This method can be
+ * safely used instead of or in addition to the auto-generated property modifiers to
+ * set simple properties. Note that to set to-one relationships use
+ * {@link #setToOneTarget(String, DataObject, boolean)}.
+ *
+ * @param propertyName a name of the bean property being modified.
+ * @param value a new value of the property.
+ */
+ public void writeProperty(String propertyName, Object value);
+
+ /**
+ * Adds an object to a to-many relationship.
+ */
+ public void addToManyTarget(
+ String relationshipName,
+ DataObject target,
+ boolean setReverse);
+
+ /**
+ * Removes an object from a to-many relationship.
+ */
+ public void removeToManyTarget(
+ String relationshipName,
+ DataObject target,
+ boolean unsetReverse);
+
+ /**
+ * Sets to-one relationship to a new value. Resolves faults if needed. This method can
+ * safely be used instead of or in addition to the auto-generated property modifiers
+ * to set properties that are to-one relationships.
+ *
+ * @param relationshipName a name of the bean property being modified - same as the
+ * name of ObjRelationship.
+ * @param value a new value of the property.
+ * @param setReverse whether to update the reverse relationship pointing from the old
+ * and new values of the property to this object.
+ */
+ public void setToOneTarget(
+ String relationshipName,
+ DataObject value,
+ boolean setReverse);
+
+ /**
+ * Returns a version of a DataRow snapshot that was used to create this object.
+ *
+ * @since 1.1
+ */
+ public long getSnapshotVersion();
+
+ /**
+ * @since 1.1
+ */
+ public void setSnapshotVersion(long snapshotVersion);
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Fault.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Fault.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Fault.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Fault.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,41 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import java.io.Serializable;
+
+/**
+ * Represents a placeholder for an unresolved relationship from a source object. Fault is
+ * resolved via {@link #resolveFault(Persistent, String)}. Depending on the type of fault
+ * it is resolved differently. Each type of fault is a singleton that can be obtained via
+ * corresponding static method.
+ *
+ * @since 1.1
+ */
+public abstract class Fault implements Serializable {
+
+ protected Fault() {
+ }
+
+ /**
+ * Returns an object for a given source object and relationship.
+ */
+ public abstract Object resolveFault(Persistent sourceObject, String relationshipName);
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/FaultFailureException.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/FaultFailureException.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/FaultFailureException.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/FaultFailureException.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,56 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+/**
+ * A runtime exception thrown when <code>DataObject.resolveFault()</code> finds that no
+ * matching row exists in the database for an <code>ObjectId</code>.
+ *
+ */
+public class FaultFailureException extends CayenneRuntimeException {
+
+ /**
+ * Creates new FaultFailureException without detail message.
+ */
+ public FaultFailureException() {
+ super();
+ }
+
+ /**
+ * Constructs an FaultFailureException with the specified detail message.
+ *
+ * @param msg the detail message.
+ */
+ public FaultFailureException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an FaultFailureException that wraps a <code>Throwable</code> thrown
+ * elsewhere.
+ */
+ public FaultFailureException(Throwable th) {
+ super(th);
+ }
+
+ public FaultFailureException(String msg, Throwable th) {
+ super(msg, th);
+ }
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectContext.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectContext.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectContext.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectContext.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,26 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import java.io.Serializable;
+
+public interface ObjectContext extends Serializable {
+
+}
\ No newline at end of file
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectId.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectId.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectId.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ObjectId.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,259 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cayenne.util.IDUtil;
+
+/**
+ * A portable global identifier for persistent objects. ObjectId can be temporary (used
+ * for transient or new uncommitted objects) or permanent (used for objects that have been
+ * already stored in DB). A temporary ObjectId stores object entity name and a
+ * pseudo-unique binary key; permanent id stores a map of values from an external
+ * persistent store (aka "primary key").
+ *
+ */
+public class ObjectId<T> implements Serializable {
+
+ protected String entityName;
+ protected Map<String, Object> objectIdKeys;
+
+ private String singleKey;
+ private T singleValue;
+
+ // key which is used for temporary ObjectIds only
+ protected byte[] key;
+
+ protected Map<String, Object> replacementIdMap;
+
+ // hash code is transient to make sure id is portable across VM
+ transient int hashCode;
+
+ // exists for deserialization with Hessian and similar
+ @SuppressWarnings("unused")
+ public ObjectId() {
+ }
+
+ /**
+ * Creates a TEMPORARY id with a specified entity name and a binary key. It is a
+ * caller responsibility to provide a globally unique binary key.
+ *
+ * @since 1.2
+ */
+ public ObjectId(String entityName, byte[] key) {
+ this.entityName = entityName;
+ this.key = key;
+ }
+
+ /**
+ * Creates a portable permanent ObjectId.
+ *
+ * @param entityName The entity name which this object id is for
+ * @param key A key describing this object id, usually the attribute name for the
+ * primary key
+ * @param value The unique value for this object id
+ * @since 1.2
+ */
+ public ObjectId(String entityName, String key, int value) {
+ this(entityName, key, Integer.valueOf(value));
+ }
+
+ /**
+ * Creates a portable permanent ObjectId.
+ *
+ * @param entityName The entity name which this object id is for
+ * @param key A key describing this object id, usually the attribute name for the
+ * primary key
+ * @param value The unique value for this object id
+ * @since 1.2
+ */
+ public ObjectId(String entityName, String key, Object value) {
+ this.entityName = entityName;
+
+ this.singleKey = key;
+ this.singleValue = (T) value;
+ }
+
+ /**
+ * Creates a portable permanent ObjectId as a compound primary key.
+ *
+ * @param entityName The entity name which this object id is for
+ * @param idMap Keys are usually the attribute names for each part of the primary key.
+ * Values are unique when taken as a whole.
+ * @since 1.2
+ */
+ public ObjectId(String entityName, Map<String, ?> idMap) {
+ this.entityName = entityName;
+
+ if (idMap == null || idMap.size() == 0) {
+
+ }
+ else if (idMap.size() == 1) {
+ Map.Entry<String, ?> e = idMap.entrySet().iterator().next();
+ this.singleKey = String.valueOf(e.getKey());
+ this.singleValue = (T) e.getValue();
+ }
+ else {
+
+ // we have to create a copy of the map, otherwise we may run into
+ // serialization
+ // problems with hessian
+ this.objectIdKeys = new HashMap<String, Object>(idMap);
+ }
+ }
+
+ /**
+ * Is this is temporary object id (used for objects which are not yet persisted to the
+ * data store).
+ */
+ public boolean isTemporary() {
+ return key != null;
+ }
+
+ /**
+ * @since 1.2
+ */
+ public String getEntityName() {
+ return entityName;
+ }
+
+ /**
+ * Get the binary temporary object id. Null if this object id is permanent (persisted
+ * to the data store).
+ */
+ public byte[] getKey() {
+ return key;
+ }
+
+ /**
+ * Returns an unmodifiable Map of persistent id values, essentially a primary key map.
+ * For temporary id returns replacement id, if it was already created. Otherwise
+ * returns an empty map.
+ */
+ public Map<String, Object> getIdSnapshot() {
+ if (isTemporary()) {
+ return (replacementIdMap == null) ? Collections.EMPTY_MAP : Collections
+ .unmodifiableMap(replacementIdMap);
+ }
+
+ if (singleKey != null) {
+ return Collections.singletonMap(singleKey, (Object) singleValue);
+ }
+
+ return objectIdKeys != null
+ ? Collections.unmodifiableMap(objectIdKeys)
+ : Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Returns a non-null mutable map that can be used to append replacement id values.
+ * This allows to incrementally build a replacement GlobalID.
+ *
+ * @since 1.2
+ */
+ public Map<String, Object> getReplacementIdMap() {
+ if (replacementIdMap == null) {
+ replacementIdMap = new HashMap<String, Object>();
+ }
+
+ return replacementIdMap;
+ }
+
+ /**
+ * Creates and returns a replacement ObjectId. No validation of ID is done.
+ *
+ * @since 1.2
+ */
+ public ObjectId createReplacementId() {
+ // merge existing and replaced ids to handle a replaced subset of
+ // a compound primary key
+ Map<String, Object> newIdMap = new HashMap<String, Object>(getIdSnapshot());
+ if (replacementIdMap != null) {
+ newIdMap.putAll(replacementIdMap);
+ }
+ return new ObjectId(getEntityName(), newIdMap);
+ }
+
+ /**
+ * Returns true if there is full or partial replacement id attached to this id. This
+ * method is preferrable to "!getReplacementIdMap().isEmpty()" as it avoids unneeded
+ * replacement id map creation.
+ */
+ public boolean isReplacementIdAttached() {
+ return replacementIdMap != null && !replacementIdMap.isEmpty();
+ }
+
+ /**
+ * A standard toString method used for debugging. It is guaranteed to produce the same
+ * string if two ObjectIds are equal.
+ */
+ @Override
+ public String toString() {
+
+ StringBuilder buffer = new StringBuilder();
+
+ buffer.append("<ObjectId:").append(entityName);
+
+ if (isTemporary()) {
+ buffer.append(", TEMP:");
+ for (byte aKey : key) {
+ IDUtil.appendFormattedByte(buffer, aKey);
+ }
+ }
+ else if (singleKey != null) {
+ buffer.append(", ").append(String.valueOf(singleKey)).append("=").append(
+ singleValue);
+ }
+ else if (objectIdKeys != null) {
+
+ // ensure consistent order of the keys, so that toString could be used as a
+ // unique key, just like id itself
+
+ List<String> keys = new ArrayList<String>(objectIdKeys.keySet());
+ Collections.sort(keys);
+ for (Object key : keys) {
+ buffer.append(", ");
+ buffer.append(String.valueOf(key)).append("=").append(
+ objectIdKeys.get(key));
+ }
+ }
+
+ buffer.append(">");
+ return buffer.toString();
+ }
+
+ private final boolean valueEquals(Object o1, Object o2) {
+ if (o1 == o2) {
+ return true;
+ }
+
+ if (o1 == null) {
+ return false;
+ }
+
+ return o1.equals(o2);
+ }
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistenceState.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistenceState.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistenceState.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistenceState.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,98 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+/**
+ * Defines a set of object states from the point of view of persistence. I.e.
+ * PersistenceState is the state of data stored in an object relative to the external
+ * persistence store. If an object's state matches the state of the persistence store, the
+ * object is COMMITTED. If object is not intended to be persistent or is not explicitly
+ * made persistent, the state is TRANSIENT, and so on.
+ * <p>
+ * Object persistence states should not be modified directly. Rather it is a
+ * responsibility of a ObjectContext/DataContext to maintain correct state of the managed
+ * objects.
+ *
+ */
+public class PersistenceState {
+
+ /**
+ * Returns String label for persistence state. Used for debugging.
+ */
+ public static String persistenceStateName(int persistenceState) {
+ switch (persistenceState) {
+ case PersistenceState.TRANSIENT:
+ return "transient";
+ case PersistenceState.NEW:
+ return "new";
+ case PersistenceState.MODIFIED:
+ return "modified";
+ case PersistenceState.COMMITTED:
+ return "committed";
+ case PersistenceState.HOLLOW:
+ return "hollow";
+ case PersistenceState.DELETED:
+ return "deleted";
+ default:
+ return "unknown";
+ }
+ }
+
+ /**
+ * Describes a state of an object not registered with DataContext/ObjectContext, and
+ * therefore having no persistence features.
+ */
+ public static final int TRANSIENT = 1;
+
+ /**
+ * Describes a state of an object freshly registered with DataContext/ObjectContext,
+ * but not committed to the database yet. So there is no corresponding database record
+ * for this object just yet.
+ */
+ public static final int NEW = 2;
+
+ /**
+ * Describes a state of an object registered with DataContext/ObjectContext, whose
+ * fields exactly match the state of a corresponding database row. This state is not
+ * fully "clean", since database record may have been externally modified.
+ */
+ public static final int COMMITTED = 3;
+
+ /**
+ * Describes a state of an object registered with DataContext/ObjectContext, and
+ * having a corresponding database row. This object state is known to be locally
+ * modified and different from the database state.
+ */
+ public static final int MODIFIED = 4;
+
+ /**
+ * Describes a state of an object registered with DataContext/ObjectContext, and
+ * having a corresponding database row. This object does not store any fields except
+ * for its id (it is "hollow"), so next time it is accessed, it will be populated from
+ * the database by the context. In this respect this is a real "clean" object.
+ */
+ public static final int HOLLOW = 5;
+
+ /**
+ * Describes a state of an object registered with DataContext/ObjectContext, that will
+ * be deleted from the database on the next commit.
+ */
+ public static final int DELETED = 6;
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Persistent.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Persistent.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Persistent.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/Persistent.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,43 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import java.io.Serializable;
+
+/**
+ * Defines minimal API of an object that can be persisted via Cayenne.
+ *
+ * @since 1.2
+ */
+// TODO: with field-based access there is no need to declare setters...
+public interface Persistent extends Serializable {
+
+ ObjectId getObjectId();
+
+ void setObjectId(ObjectId id);
+
+ int getPersistenceState();
+
+ void setPersistenceState(int state);
+
+ ObjectContext getObjectContext();
+
+ void setObjectContext(ObjectContext objectContext);
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistentObject.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistentObject.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistentObject.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/PersistentObject.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,96 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+/**
+ * A convenience base superclass for concrete Persistent objects. Provides implementation
+ * of properties declared in Persistent interface.
+ * <h4>POJO Note</h4>
+ * <p>
+ * If having PersistentObject as a superclass presents a problem in an application, source
+ * code of this class can be copied verbatim to a custom class generation template.
+ * Desired superclass can be set in CayenneModeler.
+ * </p>
+ *
+ * @since 1.2
+ */
+public abstract class PersistentObject implements Persistent {
+
+ protected ObjectId objectId;
+ protected int persistenceState;
+ protected transient ObjectContext objectContext;
+
+ /**
+ * Creates a new transient object.
+ */
+ public PersistentObject() {
+ this.persistenceState = PersistenceState.TRANSIENT;
+ }
+
+ public int getPersistenceState() {
+ return persistenceState;
+ }
+
+ public void setPersistenceState(int persistenceState) {
+ this.persistenceState = persistenceState;
+
+ if (persistenceState == PersistenceState.TRANSIENT) {
+ setObjectContext(null);
+ }
+ }
+
+ public ObjectContext getObjectContext() {
+ return objectContext;
+ }
+
+ public void setObjectContext(ObjectContext objectContext) {
+ this.objectContext = objectContext;
+ }
+
+ public ObjectId getObjectId() {
+ return objectId;
+ }
+
+ public void setObjectId(ObjectId objectId) {
+ this.objectId = objectId;
+ }
+
+ @Override
+ public String toString() {
+ String state = PersistenceState.persistenceStateName(getPersistenceState());
+
+ StringBuilder buffer = new StringBuilder();
+ buffer
+ .append("<")
+ .append(getClass().getName())
+ .append("@")
+ .append(System.identityHashCode(this))
+ .append(", id=")
+ .append(objectId)
+ .append(", state=")
+ .append(state)
+ .append(", context=")
+ .append(objectContext)
+ .append(">");
+
+ return buffer.toString();
+ }
+
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ValueHolder.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ValueHolder.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ValueHolder.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/ValueHolder.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,80 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import java.io.Serializable;
+
+/**
+ * Provides a level of indirection for property value access, most often used for deferred
+ * faulting of to-one relationships. A ValueHolder abstracts how a property value is
+ * obtained (fetched from DB, etc.), thus simplifying design of an object that uses it.
+ * <p>
+ * Here is an example of a bean property implemented using ValueHolder:
+ * </p>
+ *
+ * <pre>
+ * protected ValueHolder someProperty;
+ *
+ * public SomeClass getSomeProperty() {
+ * return (SomeClass) somePropertyHolder.getValue(SomeClass.class);
+ * }
+ *
+ * public void setSomeProperty(SomeClass newValue) {
+ * somePropertyHolder.setValue(SomeClass.class, newValue);
+ * }
+ * </pre>
+ *
+ * @since 1.2
+ */
+public interface ValueHolder extends Serializable {
+
+ /**
+ * Returns an object stored by this ValueHolder.
+ */
+ Object getValue() throws CayenneRuntimeException;
+
+ /**
+ * Retrieves ValueHolder value without triggering fault resolution.
+ */
+ Object getValueDirectly() throws CayenneRuntimeException;
+
+ /**
+ * Sets an object stored by this ValueHolder.
+ *
+ * @param value a new value of the ValueHolder.
+ * @return a previous value saved in the ValueHolder.
+ */
+ Object setValue(Object value) throws CayenneRuntimeException;
+
+ /**
+ * Sets ValueHolder vaue without triggering fault resolution.
+ */
+ Object setValueDirectly(Object value) throws CayenneRuntimeException;
+
+ /**
+ * Returns true if the internal value is not yet resolved.
+ */
+ boolean isFault();
+
+ /**
+ * Turns a ValueHolder into a fault.
+ */
+ void invalidate();
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyList.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyList.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyList.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyList.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,107 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.access;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.cayenne.PersistenceState;
+import org.apache.cayenne.Persistent;
+import org.apache.cayenne.util.PersistentObjectList;
+
+/**
+ * A list that holds objects for to-many relationships. All operations, except for
+ * resolving the list from DB, are not synchronized. The safest way to implement custom
+ * synchronization is to synchronize on parent ObjectStore.
+ */
+public class ToManyList extends PersistentObjectList implements Serializable {
+
+ //for serialization
+ @SuppressWarnings("unused")
+ private ToManyList() {}
+
+ /**
+ * Creates ToManyList.
+ *
+ * @since 1.1
+ */
+ public ToManyList(Persistent source, String relationship) {
+ super(source, relationship);
+
+ // if source is new, set object list right away
+ if (isTransientParent()) {
+ objectList = new LinkedList();
+ }
+ }
+
+ // ====================================================
+ // Standard List Methods.
+ // ====================================================
+ @Override
+ public int hashCode() {
+ return 15 + resolvedObjectList().hashCode();
+ }
+
+ // ====================================================
+ // Tracking list modifications, and resolving it
+ // on demand
+ // ====================================================
+
+ @Override
+ protected boolean shouldAddToRemovedFromUnresolvedList(Object object) {
+ // No point in adding a new or transient object -- these will never be fetched
+ // from the database.
+ if (object instanceof Persistent) {
+ Persistent dataObject = (Persistent) object;
+ if ((dataObject.getPersistenceState() == PersistenceState.TRANSIENT)
+ || (dataObject.getPersistenceState() == PersistenceState.NEW)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getName() + "@" + System.identityHashCode(this);
+ }
+
+ @Override
+ protected void postprocessAdd(Collection collection) {
+ // no need for this operation for DataObjects...
+ }
+
+ @Override
+ protected void postprocessRemove(Collection collection) {
+ // no need for this operation for DataObjects...
+ }
+
+ @Override
+ protected void postprocessAdd(Object addedObject) {
+ // no need for this operation for DataObjects...
+ }
+
+ @Override
+ protected void postprocessRemove(Object removedObject) {
+ // no need for this operation for DataObjects...
+ }
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyListFault.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyListFault.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyListFault.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManyListFault.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,35 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.access;
+
+import org.apache.cayenne.Fault;
+import org.apache.cayenne.FaultFailureException;
+import org.apache.cayenne.Persistent;
+
+public class ToManyListFault extends Fault {
+
+ /**
+ * Resolves this fault to a List of objects.
+ */
+ @Override
+ public Object resolveFault(Persistent sourceObject, String relationshipName) {
+ throw new FaultFailureException("Trying to access unresolved to-many property " +
+ relationshipName + " of " + sourceObject);
+ }
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManySetFault.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManySetFault.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManySetFault.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToManySetFault.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,35 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.access;
+
+import org.apache.cayenne.Fault;
+import org.apache.cayenne.FaultFailureException;
+import org.apache.cayenne.Persistent;
+
+public class ToManySetFault extends Fault {
+
+ /**
+ * Resolves this fault to a List of objects.
+ */
+ @Override
+ public Object resolveFault(Persistent sourceObject, String relationshipName) {
+ throw new FaultFailureException("Trying to access unresolved to-many property " +
+ relationshipName + " of " + sourceObject);
+ }
+}
Added: cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToOneFault.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToOneFault.java?rev=920227&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToOneFault.java (added)
+++ cayenne/sandbox/cayenne-gwt/src/main/resources/org/apache/cayenne/emul/org/apache/cayenne/access/ToOneFault.java Mon Mar 8 08:29:07 2010
@@ -0,0 +1,35 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.access;
+
+import org.apache.cayenne.Fault;
+import org.apache.cayenne.FaultFailureException;
+import org.apache.cayenne.Persistent;
+
+public class ToOneFault extends Fault {
+
+ /**
+ * Resolves this fault to a DataObject.
+ */
+ @Override
+ public Object resolveFault(Persistent sourceObject, String relationshipName) {
+ throw new FaultFailureException("Trying to access unresolved to-one property " +
+ relationshipName + " of " + sourceObject);
+ }
+}