db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r355651 - in /incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm: CacheManagerImpl.java PersistenceManagerImpl.java PersistenceManagerWrapper.java
Date Fri, 09 Dec 2005 23:39:39 GMT
Author: clr
Date: Fri Dec  9 15:39:32 2005
New Revision: 355651

URL: http://svn.apache.org/viewcvs?rev=355651&view=rev
Log:
JDO-257 Adapt runtime20 to the change in makePersistent return types

Modified:
    incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/CacheManagerImpl.java
    incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java
    incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerWrapper.java

Modified: incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/CacheManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/CacheManagerImpl.java?rev=355651&r1=355650&r2=355651&view=diff
==============================================================================
--- incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/CacheManagerImpl.java (original)
+++ incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/CacheManagerImpl.java Fri
Dec  9 15:39:32 2005
@@ -217,7 +217,7 @@
      * @param pc a transient instance of a Class that implements
      * PersistenceCapable
      */
-    protected void makePersistent (PersistenceCapable pc) {
+    protected Object makePersistent (PersistenceCapable pc) {
 
         StateManagerInternal sm = pm.findStateManager(pc);
         if (sm == null) {
@@ -225,6 +225,7 @@
         }
 
         sm.makePersistent();
+        return pc; // XXX fix this for detached objects
     }
 
     /** Make the transient or persistent instance transactional in

Modified: incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java?rev=355651&r1=355650&r2=355651&view=diff
==============================================================================
--- incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java
(original)
+++ incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java
Fri Dec  9 15:39:32 2005
@@ -25,6 +25,7 @@
 import java.lang.reflect.Constructor;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Iterator;
@@ -817,42 +818,41 @@
     * @param pc a transient instance of a Class that implements
     * PersistenceCapable
     */
-    public void makePersistent (Object pc) {
+    public Object makePersistent (Object pc) {
         if (debugging())
             debug("makePersistent"); // NOI18N
 
         assertIsOpen();
         assertActiveTransaction(false);
 
-        makePersistentInternal(pc);
+        return makePersistentInternal(pc);
     }
 
     /** Make an array of instances persistent.
     * @param pcs an array of transient instances
     * @see #makePersistent(Object pc)
     */
-    public void makePersistentAll(Object[] pcs) {
+    public Object[] makePersistentAll(Object[] pcs) {
         if (debugging())
             debug("makePersistentAll"); // NOI18N
 
         assertIsOpen();
         assertIsOpen();
         assertActiveTransaction(false);
-        makePersistentAllInternal(pcs);
-
+        return makePersistentAllInternal(pcs);
     }
 
     /** Make an collection of instances persistent.
     * @param pcs an collection of transient instances
     * @see #makePersistent(Object pc)
     */
-    public void makePersistentAll(Collection pcs) {
+    public Collection makePersistentAll(Collection pcs) {
         if (debugging())
             debug("makePersistentAll"); // NOI18N
 
         assertIsOpen();
         assertActiveTransaction(false);
-        makePersistentAllInternal(pcs.toArray());
+        return Arrays.asList(makePersistentAllInternal(pcs.toArray()));
     }
 
     /** Delete the persistent instance from the data store.
@@ -2253,11 +2253,11 @@
      * Internal method for processing makePersistent request.
      * @see #makePersistent(Object pc)
      */
-    private void makePersistentInternal(Object pc) {
+    private Object makePersistentInternal(Object pc) {
         if (pc == null) {
             if (debugging())
                 debug("makePersistentInternal null"); // NOI18N
-            return;        // ignore
+            return null;        // ignore
         }
         if (debugging())
             debug("makePersistentInternal for " + pc.getClass().getName()); // NOI18N
@@ -2267,14 +2267,15 @@
             debug("makePersistentInternal is pc"); // NOI18N
 
         PersistenceCapable p = (PersistenceCapable)pc;
-        _txCache.makePersistent(p);
+        return _txCache.makePersistent(p);
     }
 
     /**
      * Internal method for processing makePersistentAll request.
      * @see #makePersistentAll(Object[] pcs)
      */
-    private void makePersistentAllInternal(Object[] pcs) {
+    private Object[] makePersistentAllInternal(Object[] pcs) {
+        Object[] result = new Object[pcs.length];
         Throwable[] err = new Throwable[pcs.length];
         int l = 0;
 
@@ -2282,12 +2283,13 @@
             debug("makePersistentAllInternal " + pcs.length); // NOI18N
         for(int i = 0; i < pcs.length; i++) {
             try {
-                makePersistentInternal(pcs[i]);
+                result[i] = makePersistentInternal(pcs[i]);
             } catch (Throwable e) {
                 err[l++] = e;
             }
         }
         validateResult(l, err);
+        return result;
     }
 
     /**

Modified: incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerWrapper.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerWrapper.java?rev=355651&r1=355650&r2=355651&view=diff
==============================================================================
--- incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerWrapper.java
(original)
+++ incubator/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerWrapper.java
Fri Dec  9 15:39:32 2005
@@ -563,9 +563,9 @@
     /** 
      * @see javax.jdo.PersistenceManager#makePersistent(Object pc)
      */
-    public void makePersistent(Object pc){
+    public Object makePersistent(Object pc){
         if (isValid) { 
-            pm.makePersistent(pc);
+            return pm.makePersistent(pc);
         } else { 
             throw new JDOFatalUserException(msg.msg(
                 "EXC_PersistenceManagerClosed"));// NOI18N
@@ -575,9 +575,9 @@
     /** 
      * @see javax.jdo.PersistenceManager#makePersistentAll(Object[] pc)
      */
-    public void makePersistentAll(Object[] pcs){
+    public Object[] makePersistentAll(Object[] pcs){
         if (isValid) { 
-            pm.makePersistentAll(pcs);
+            return pm.makePersistentAll(pcs);
         } else { 
             throw new JDOFatalUserException(msg.msg(
                 "EXC_PersistenceManagerClosed"));// NOI18N
@@ -587,9 +587,9 @@
     /** 
      * @see javax.jdo.PersistenceManager#makePersistentAll(Collection pcs)
      */
-    public void makePersistentAll (Collection pcs){
+    public Collection makePersistentAll (Collection pcs){
         if (isValid) { 
-            pm.makePersistentAll(pcs);
+            return pm.makePersistentAll(pcs);
         } else { 
             throw new JDOFatalUserException(msg.msg(
                 "EXC_PersistenceManagerClosed"));// NOI18N



Mime
View raw message