cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1506223 - in /cayenne/main/trunk/framework/cayenne-core-unpublished/src: main/java/org/apache/cayenne/map/MapLoader.java test/resources/testmap.map.xml
Date Tue, 23 Jul 2013 19:14:18 GMT
Author: aadamchik
Date: Tue Jul 23 19:14:18 2013
New Revision: 1506223

URL: http://svn.apache.org/r1506223
Log:
CAY-1843  Stop saving listeners in DataMap, add upgrade handler

core.patch by Miłosz Pigłas

Modified:
    cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java
    cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/resources/testmap.map.xml

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java?rev=1506223&r1=1506222&r2=1506223&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java
(original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/map/MapLoader.java
Tue Jul 23 19:14:18 2013
@@ -83,7 +83,6 @@ public class MapLoader extends DefaultHa
     public static final String PROCEDURE_PARAMETER_TAG = "procedure-parameter";
 
     // lifecycle listeners and callbacks related
-    public static final String ENTITY_LISTENER_TAG = "entity-listener";
     public static final String POST_ADD_TAG = "post-add";
     public static final String PRE_PERSIST_TAG = "pre-persist";
     public static final String POST_PERSIST_TAG = "post-persist";
@@ -142,7 +141,6 @@ public class MapLoader extends DefaultHa
     private DataMap dataMap;
     private DbEntity dbEntity;
     private ObjEntity objEntity;
-    private EntityListener entityListener;
     private Embeddable embeddable;
     private EmbeddedAttribute embeddedAttribute;
     private DbRelationship dbRelationship;
@@ -351,14 +349,6 @@ public class MapLoader extends DefaultHa
             }
         });
 
-        startTagOpMap.put(ENTITY_LISTENER_TAG, new StartClosure() {
-
-            @Override
-            void execute(Attributes attributes) throws SAXException {
-                processStartEntitylistener(attributes);
-            }
-        });
-
         startTagOpMap.put(POST_ADD_TAG, new StartClosure() {
 
             @Override
@@ -574,44 +564,15 @@ public class MapLoader extends DefaultHa
                 processEndQueryPrefetch();
             }
         });
-
-        endTagOpMap.put(ENTITY_LISTENER_TAG, new EndClosure() {
-
-            @Override
-            void execute() throws SAXException {
-                processEndEntitylistener();
-            }
-        });
     }
 
     private void processStartDataMap(Attributes attributes) {
         this.mapVersion = attributes.getValue("", "project-version");
     }
 
-    private void processStartEntitylistener(Attributes attributes) {
-        entityListener = new EntityListener(attributes.getValue("", "class"));
-        if (objEntity != null) {
-            // we are inside of obj-entity tag
-            objEntity.addEntityListener(entityListener);
-        }
-        else if (dataMap != null) {
-            // we are inside of datamap tag
-            logger
-                    .warn("DataMap listeners are no longer supported. See UPGRADE.txt for
more information.");
-        }
-    }
-
-    private void processEndEntitylistener() {
-        entityListener = null;
-    }
-
     private void processStartPostAdd(Attributes attributes) {
         String methodName = attributes.getValue("", "method-name");
-        if (entityListener != null) {
-            // new "entity-listener" tag as a child of "obj-entity"
-            entityListener.getCallbackMap().getPostAdd().addCallbackMethod(methodName);
-        }
-        else if (objEntity != null) {
+        if (objEntity != null) {
             // new callback tags - children of "obj-entity"
             objEntity.getCallbackMap().getPostAdd().addCallbackMethod(methodName);
         }
@@ -628,14 +589,7 @@ public class MapLoader extends DefaultHa
 
             String methodName = attributes.getValue("", "method-name");
 
-            if (entityListener != null) {
-                // new "entity-listener" tag as a child of "obj-entity"
-                entityListener
-                        .getCallbackMap()
-                        .getPrePersist()
-                        .addCallbackMethod(methodName);
-            }
-            else if (objEntity != null) {
+            if (objEntity != null) {
                 // new callback tags - children of "obj-entity"
                 objEntity.getCallbackMap().getPrePersist().addCallbackMethod(methodName);
             }
@@ -644,63 +598,42 @@ public class MapLoader extends DefaultHa
 
     private void processStartPostPersist(Attributes attributes) {
         String methodName = attributes.getValue("", "method-name");
-        if (entityListener != null) {
-            entityListener
-                    .getCallbackMap()
-                    .getPostPersist()
-                    .addCallbackMethod(methodName);
-        }
-        else if (objEntity != null) {
+        if (objEntity != null) {
             objEntity.getCallbackMap().getPostPersist().addCallbackMethod(methodName);
         }
     }
 
     private void processStartPreUpdate(Attributes attributes) {
         String methodName = attributes.getValue("", "method-name");
-        if (entityListener != null) {
-            entityListener.getCallbackMap().getPreUpdate().addCallbackMethod(methodName);
-        }
-        else if (objEntity != null) {
+        if (objEntity != null) {
             objEntity.getCallbackMap().getPreUpdate().addCallbackMethod(methodName);
         }
     }
 
     private void processStartPostUpdate(Attributes attributes) {
         String methodName = attributes.getValue("", "method-name");
-        if (entityListener != null) {
-            entityListener.getCallbackMap().getPostUpdate().addCallbackMethod(methodName);
-        }
-        else if (objEntity != null) {
+        if (objEntity != null) {
             objEntity.getCallbackMap().getPostUpdate().addCallbackMethod(methodName);
         }
     }
 
     private void processStartPreRemove(Attributes attributes) {
         String methodName = attributes.getValue("", "method-name");
-        if (entityListener != null) {
-            entityListener.getCallbackMap().getPreRemove().addCallbackMethod(methodName);
-        }
-        else if (objEntity != null) {
+        if (objEntity != null) {
             objEntity.getCallbackMap().getPreRemove().addCallbackMethod(methodName);
         }
     }
 
     private void processStartPostRemove(Attributes attributes) {
         String methodName = attributes.getValue("", "method-name");
-        if (entityListener != null) {
-            entityListener.getCallbackMap().getPostRemove().addCallbackMethod(methodName);
-        }
-        else if (objEntity != null) {
+        if (objEntity != null) {
             objEntity.getCallbackMap().getPostRemove().addCallbackMethod(methodName);
         }
     }
 
     private void processStartPostLoad(Attributes attributes) {
         String methodName = attributes.getValue("", "method-name");
-        if (entityListener != null) {
-            entityListener.getCallbackMap().getPostLoad().addCallbackMethod(methodName);
-        }
-        else if (objEntity != null) {
+        if (objEntity != null) {
             objEntity.getCallbackMap().getPostLoad().addCallbackMethod(methodName);
         }
     }

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/resources/testmap.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/resources/testmap.map.xml?rev=1506223&r1=1506222&r2=1506223&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/resources/testmap.map.xml
(original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/test/resources/testmap.map.xml
Tue Jul 23 19:14:18 2013
@@ -333,15 +333,6 @@
 	<obj-entity name="ArtistCallbackTest" className="org.apache.cayenne.testdo.testmap.ArtistCallbackTest"
dbEntityName="ARTIST_CT" exclude-superclass-listeners="true" exclude-default-listeners="true">
 		<obj-attribute name="artistName" type="java.lang.String"/>
 		<obj-attribute name="dateOfBirth" type="java.util.Date"/>
-		<entity-listener class="org.apache.cayenne.testdo.testmap.EntityListenerObjEntity">
-			<post-add method-name="prePersistEntityListener"/>
-			<post-persist method-name="postPersistEntityListener"/>
-			<pre-update method-name="preUpdateEntityListener"/>
-			<post-update method-name="postUpdateEntityListener"/>
-			<pre-remove method-name="preRemoveEntityListener"/>
-			<post-remove method-name="postRemoveEntityListener"/>
-			<post-load method-name="postLoadEntityListener"/>
-		</entity-listener>
 		<post-add method-name="prePersistEntityObjEntity"/>
 		<post-persist method-name="postPersistEntityObjEntity"/>
 		<pre-update method-name="preUpdateEntityObjEntity"/>



Mime
View raw message