cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1495772 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/map/ test/java/org/apache/cayenne/map/
Date Sat, 22 Jun 2013 19:05:18 GMT
Author: aadamchik
Date: Sat Jun 22 19:05:17 2013
New Revision: 1495772

URL: http://svn.apache.org/r1495772
Log:
CAY-1789  Lock-free EntityResolver

cleanup

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java?rev=1495772&r1=1495771&r2=1495772&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java
Sat Jun 22 19:05:17 2013
@@ -1315,11 +1315,4 @@ public class DataMap implements Serializ
 
         return null;
     }
-
-    /**
-     * @since 3.2
-     */
-    public Collection<SQLResult> getResultSets() {
-        return results.values();
-    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java?rev=1495772&r1=1495771&r2=1495772&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
Sat Jun 22 19:05:17 2013
@@ -333,10 +333,18 @@ public class EntityResolver implements M
     }
 
     /**
-     * @since 3.0
+     * @deprecated since 3.2 use {@link #getResults()}.
      */
+    @Deprecated
     public Collection<SQLResult> getResultSets() {
-        return mappingCache.getResultSets();
+       return getResults();
+    }
+    
+    /**
+     * @since 3.2
+     */
+    public Collection<SQLResult> getResults() {
+        return mappingCache.getResults();
     }
 
     public Collection<Procedure> getProcedures() {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java?rev=1495772&r1=1495771&r2=1495772&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java
Sat Jun 22 19:05:17 2013
@@ -38,27 +38,27 @@ class MappingCache implements MappingNam
     protected static final Log logger = LogFactory.getLog(MappingCache.class);
 
     protected Collection<DataMap> maps;
-    protected Map<String, Query> queryCache;
-    protected Map<String, Embeddable> embeddableCache;
-    protected Map<String, SQLResult> resultsCache;
-    protected Map<String, DbEntity> dbEntityCache;
-    protected Map<String, ObjEntity> objEntityCache;
-    protected Map<String, ObjEntity> objEntityClassCache;
-    protected Map<String, Procedure> procedureCache;
+    protected Map<String, Query> queries;
+    protected Map<String, Embeddable> embeddables;
+    protected Map<String, SQLResult> results;
+    protected Map<String, DbEntity> dbEntities;
+    protected Map<String, ObjEntity> objEntities;
+    protected Map<String, ObjEntity> objEntitiesByClassName;
+    protected Map<String, Procedure> procedures;
     protected Map<String, EntityInheritanceTree> entityInheritanceCache;
 
     MappingCache(Collection<DataMap> maps) {
 
         this.maps = maps;
 
-        this.embeddableCache = new HashMap<String, Embeddable>();
-        this.queryCache = new HashMap<String, Query>();
-        this.dbEntityCache = new HashMap<String, DbEntity>();
-        this.objEntityCache = new HashMap<String, ObjEntity>();
-        this.objEntityClassCache = new HashMap<String, ObjEntity>();
-        this.procedureCache = new HashMap<String, Procedure>();
+        this.embeddables = new HashMap<String, Embeddable>();
+        this.queries = new HashMap<String, Query>();
+        this.dbEntities = new HashMap<String, DbEntity>();
+        this.objEntities = new HashMap<String, ObjEntity>();
+        this.objEntitiesByClassName = new HashMap<String, ObjEntity>();
+        this.procedures = new HashMap<String, Procedure>();
         this.entityInheritanceCache = new HashMap<String, EntityInheritanceTree>();
-        this.resultsCache = new HashMap<String, SQLResult>();
+        this.results = new HashMap<String, SQLResult>();
 
         index();
     }
@@ -70,7 +70,7 @@ class MappingCache implements MappingNam
 
         for (DataMap map : maps) {
             for (DbEntity de : map.getDbEntities()) {
-                dbEntityCache.put(de.getName(), de);
+                dbEntities.put(de.getName(), de);
             }
         }
 
@@ -80,7 +80,7 @@ class MappingCache implements MappingNam
             for (ObjEntity oe : map.getObjEntities()) {
 
                 // index by name
-                objEntityCache.put(oe.getName(), oe);
+                objEntities.put(oe.getName(), oe);
 
                 // index by class.. use class name as a key to avoid class
                 // loading here...
@@ -91,29 +91,29 @@ class MappingCache implements MappingNam
 
                 // allow duplicates, but put a special marker indicating
                 // that this entity can't be looked up by class
-                Object existing = objEntityClassCache.get(className);
+                Object existing = objEntitiesByClassName.get(className);
                 if (existing != null) {
 
                     if (existing != OBJ_DUPLICATE_MARKER) {
-                        objEntityClassCache.put(className, OBJ_DUPLICATE_MARKER);
+                        objEntitiesByClassName.put(className, OBJ_DUPLICATE_MARKER);
                     }
                 } else {
-                    objEntityClassCache.put(className, oe);
+                    objEntitiesByClassName.put(className, oe);
                 }
             }
 
             // index stored procedures
             for (Procedure proc : map.getProcedures()) {
-                procedureCache.put(proc.getName(), proc);
+                procedures.put(proc.getName(), proc);
             }
 
             // index embeddables
-            embeddableCache.putAll(map.getEmbeddableMap());
+            embeddables.putAll(map.getEmbeddableMap());
 
             // index queries
             for (Query query : map.getQueries()) {
                 String name = query.getName();
-                Object existingQuery = queryCache.put(name, query);
+                Object existingQuery = queries.put(name, query);
 
                 if (existingQuery != null && query != existingQuery) {
                     throw new CayenneRuntimeException("More than one Query for name" + name);
@@ -141,7 +141,7 @@ class MappingCache implements MappingNam
                     if (superNode == null) {
                         // do direct entity lookup to avoid recursive cache
                         // rebuild
-                        ObjEntity superOE = objEntityCache.get(superOEName);
+                        ObjEntity superOE = objEntities.get(superOEName);
                         if (superOE != null) {
                             superNode = new EntityInheritanceTree(superOE);
                             entityInheritanceCache.put(superOEName, superNode);
@@ -160,11 +160,11 @@ class MappingCache implements MappingNam
     }
 
     public Embeddable getEmbeddable(String className) {
-        return embeddableCache.get(className);
+        return embeddables.get(className);
     }
 
     public SQLResult getResult(String name) {
-        return resultsCache.get(name);
+        return results.get(name);
     }
 
     public EntityInheritanceTree getInheritanceTree(String entityName) {
@@ -172,19 +172,19 @@ class MappingCache implements MappingNam
     }
 
     public Procedure getProcedure(String procedureName) {
-        return procedureCache.get(procedureName);
+        return procedures.get(procedureName);
     }
 
     public Query getQuery(String queryName) {
-        return queryCache.get(queryName);
+        return queries.get(queryName);
     }
 
     public DbEntity getDbEntity(String name) {
-        return dbEntityCache.get(name);
+        return dbEntities.get(name);
     }
 
     public ObjEntity getObjEntity(Class<?> entityClass) {
-        ObjEntity entity = objEntityClassCache.get(entityClass.getName());
+        ObjEntity entity = objEntitiesByClassName.get(entityClass.getName());
 
         if (entity == OBJ_DUPLICATE_MARKER) {
             throw new CayenneRuntimeException("Can't perform lookup. There is more than one
ObjEntity mapped to "
@@ -195,7 +195,7 @@ class MappingCache implements MappingNam
     }
 
     public ObjEntity getObjEntity(String name) {
-        return objEntityCache.get(name);
+        return objEntities.get(name);
     }
 
     public Collection<DbEntity> getDbEntities() {
@@ -268,7 +268,7 @@ class MappingCache implements MappingNam
         return c;
     }
 
-    public Collection<SQLResult> getResultSets() {
+    public Collection<SQLResult> getResults() {
         // TODO: LEGACY SUPPORT:
         // some downstream code (like Modeler and merge framework) expect
         // always fresh list here, so instead of doing the right thing of
@@ -276,7 +276,7 @@ class MappingCache implements MappingNam
         // the list of DataMaps.
         CompositeCollection c = new CompositeCollection();
         for (DataMap map : maps) {
-            c.addComposited(map.getResultSets());
+            c.addComposited(map.getResults());
         }
 
         return c;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java?rev=1495772&r1=1495771&r2=1495772&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java
Sat Jun 22 19:05:17 2013
@@ -54,7 +54,7 @@ public interface MappingNamespace {
     /**
      * @since 3.2
      */
-    Collection<SQLResult> getResultSets();
+    Collection<SQLResult> getResults();
 
     /**
      * Returns DbEntity for a given name, or null if no such DbEntity is found

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java?rev=1495772&r1=1495771&r2=1495772&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java
Sat Jun 22 19:05:17 2013
@@ -97,8 +97,8 @@ abstract class ProxiedMappingNamespace i
         return getDelegate().getEmbeddables();
     }
     
-    public Collection<SQLResult> getResultSets() {
-        return getDelegate().getResultSets();
+    public Collection<SQLResult> getResults() {
+        return getDelegate().getResults();
     }
 
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java?rev=1495772&r1=1495771&r2=1495772&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java
Sat Jun 22 19:05:17 2013
@@ -113,7 +113,7 @@ public class MockMappingNamespace implem
         return null;
     }
     
-    public Collection<SQLResult> getResultSets() {
+    public Collection<SQLResult> getResults() {
         // TODO Auto-generated method stub
         return null;
     }



Mime
View raw message