openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r618834 - in /openjpa/branches/1.0.x: openjpa-kernel/src/main/java/org/apache/openjpa/event/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persiste...
Date Wed, 06 Feb 2008 00:09:34 GMT
Author: pcl
Date: Tue Feb  5 16:09:28 2008
New Revision: 618834

URL: http://svn.apache.org/viewvc?rev=618834&view=rev
Log:
OPENJPA-506. svn merge -c 618821 ../../trunk. Oddly, the TCK was passing on this branch; maybe
trunk and 1.0.x have different TCK versions?

Added:
    openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/event/PostDeleteListener.java
      - copied unchanged from r618821, openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/event/PostDeleteListener.java
    openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/event/PostPersistListener.java
      - copied unchanged from r618821, openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/event/PostPersistListener.java
    openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/event/UpdateListener.java
      - copied unchanged from r618821, openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/event/UpdateListener.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/EntityListenerEntity.java
      - copied unchanged from r618821, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/EntityListenerEntity.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/GlobalListenerEntity.java
      - copied unchanged from r618821, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/GlobalListenerEntity.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/ListenerImpl.java
      - copied unchanged from r618821, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/ListenerImpl.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/ListenerTestEntity.java
      - copied unchanged from r618821, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/ListenerTestEntity.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/TestEntityListeners.java
      - copied unchanged from r618821, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/callbacks/TestEntityListeners.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/resources/META-INF/listener-orm.xml
      - copied unchanged from r618821, openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/listener-orm.xml
Modified:
    openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java
    openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
    openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceListenerAdapter.java

Modified: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java?rev=618834&r1=618833&r2=618834&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java
(original)
+++ openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java
Tue Feb  5 16:09:28 2008
@@ -491,6 +491,42 @@
                                 ((AttachListener) listener).afterAttach(ev);
                         }
                         break;
+
+                    case LifecycleEvent.AFTER_PERSIST_PERFORMED:
+                        if (responds || listener instanceof PostPersistListener)
+                        {
+                            if (mock)
+                                return Boolean.TRUE;
+                            if (ev == null)
+                                ev = new LifecycleEvent(source, rel, type);
+                            ((PostPersistListener) listener)
+                                .afterPersistPerformed(ev);
+                        }
+                        break;
+                    case LifecycleEvent.BEFORE_UPDATE:
+                    case LifecycleEvent.AFTER_UPDATE_PERFORMED:
+                        if (responds || listener instanceof UpdateListener) {
+                            if (mock)
+                                return Boolean.TRUE;
+                            if (ev == null)
+                                ev = new LifecycleEvent(source, rel, type);
+                            if (type == LifecycleEvent.BEFORE_UPDATE)
+                                ((UpdateListener) listener).beforeUpdate(ev);
+                            else
+                                ((UpdateListener) listener)
+                                    .afterUpdatePerformed(ev);
+                        }
+                        break;
+                    case LifecycleEvent.AFTER_DELETE_PERFORMED:
+                        if (responds || listener instanceof PostDeleteListener){
+                            if (mock)
+                                return Boolean.TRUE;
+                            if (ev == null)
+                                ev = new LifecycleEvent(source, rel, type);
+                            ((PostDeleteListener) listener)
+                                .afterDeletePerformed(ev);
+                        }
+                        break;
                     default:
                         if (_log.isWarnEnabled())
                             _log.warn(_loc.get("unknown-lifecycle-event",

Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java?rev=618834&r1=618833&r2=618834&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java
(original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java
Tue Feb  5 16:09:28 2008
@@ -91,7 +91,11 @@
         }
 
         return (OpenJPAEntityManagerFactorySPI) Persistence.
-            createEntityManagerFactory("test", map);
+            createEntityManagerFactory(getPersistenceUnitName(), map);
+    }
+
+    protected String getPersistenceUnitName() {
+        return "test";
     }
 
     @Override

Modified: openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml?rev=618834&r1=618833&r2=618834&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
(original)
+++ openjpa/branches/1.0.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
Tue Feb  5 16:09:28 2008
@@ -63,4 +63,14 @@
                 value="DriverClassName=not.a.real.Driver,Url=jdbc:notreal://"/>
         </properties>
     </persistence-unit>
+
+    <persistence-unit name="listener-pu">
+        <mapping-file>META-INF/listener-orm.xml</mapping-file>
+        <class>org.apache.openjpa.persistence.callbacks.EntityListenerEntity</class>
+        <class>org.apache.openjpa.persistence.callbacks.GlobalListenerEntity</class>
+        <properties>
+            <property name="openjpa.jdbc.SynchronizeMappings"
+                  value="buildSchema(ForeignKeys=true)"/>
+        </properties>
+    </persistence-unit>
 </persistence>

Modified: openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceListenerAdapter.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceListenerAdapter.java?rev=618834&r1=618833&r2=618834&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceListenerAdapter.java
(original)
+++ openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceListenerAdapter.java
Tue Feb  5 16:09:28 2008
@@ -27,13 +27,16 @@
 import org.apache.openjpa.event.LifecycleEventManager;
 import org.apache.openjpa.event.LoadListener;
 import org.apache.openjpa.event.PersistListener;
-import org.apache.openjpa.event.StoreListener;
+import org.apache.openjpa.event.PostPersistListener;
+import org.apache.openjpa.event.UpdateListener;
+import org.apache.openjpa.event.PostDeleteListener;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.util.CallbackException;
 
 class PersistenceListenerAdapter
     implements LifecycleEventManager.ListenerAdapter, PersistListener,
-    LoadListener, StoreListener, DeleteListener {
+    PostPersistListener, LoadListener, UpdateListener, DeleteListener,
+    PostDeleteListener {
 
     private static final Localizer _loc = Localizer.forPackage
         (PersistenceListenerAdapter.class);
@@ -83,6 +86,10 @@
     }
 
     public void afterPersist(LifecycleEvent event) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void afterPersistPerformed(LifecycleEvent event) {
         makeCallback(event);
     }
 
@@ -94,11 +101,11 @@
         makeCallback(event);
     }
 
-    public void beforeStore(LifecycleEvent event) {
+    public void beforeUpdate(LifecycleEvent event) {
         makeCallback(event);
     }
 
-    public void afterStore(LifecycleEvent event) {
+    public void afterUpdatePerformed(LifecycleEvent event) {
         makeCallback(event);
     }
 
@@ -107,6 +114,10 @@
     }
 
     public void afterDelete(LifecycleEvent event) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void afterDeletePerformed(LifecycleEvent event) {
         makeCallback(event);
     }
 }



Mime
View raw message