cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r649242 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/access/ main/java/org/apache/cayenne/cache/ main/java/org/apache/cayenne/query/ main/java/org/apache/cayenne/remote/ test/java/org/apach...
Date Thu, 17 Apr 2008 19:22:24 GMT
Author: aadamchik
Date: Thu Apr 17 12:22:22 2008
New Revision: 649242

URL: http://svn.apache.org/viewvc?rev=649242&view=rev
Log:
CAY-1035 Replace QueryMetadata String cache policies with an enum
(first pass - introducing the enum next to the old policy)

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryCacheStrategy.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQuery.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadata.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/RangeQuery.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/MockQueryMetadata.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQuery.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQuery.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQuery.java
Thu Apr 17 12:22:22 2008
@@ -25,6 +25,7 @@
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.query.PrefetchTreeNode;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.QueryRouter;
 import org.apache.cayenne.query.SQLAction;
@@ -48,11 +49,11 @@
     public QueryMetadata getMetaData(EntityResolver resolver) {
         return this;
     }
-    
+
     public SQLResultSetMapping getResultSetMapping() {
         return null;
     }
-    
+
     public Query getOrginatingQuery() {
         return null;
     }
@@ -72,10 +73,17 @@
         return null;
     }
 
+    /**
+     * @deprecated since 3.0 in favor of 'getCacheStrategy'.
+     */
     public String getCachePolicy() {
         return null;
     }
 
+    public QueryCacheStrategy getCacheStrategy() {
+        return null;
+    }
+
     public DataMap getDataMap() {
         return null;
     }
@@ -95,7 +103,7 @@
     public ObjEntity getObjEntity() {
         return null;
     }
-    
+
     public ClassDescriptor getClassDescriptor() {
         return null;
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java
Thu Apr 17 12:22:22 2008
@@ -51,6 +51,7 @@
 import org.apache.cayenne.query.ObjectIdQuery;
 import org.apache.cayenne.query.PrefetchTreeNode;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.RefreshQuery;
 import org.apache.cayenne.query.SQLResultSetMapping;
@@ -243,9 +244,9 @@
      * @deprecated since 3.0. See {@link DataContext#getQueryCache()}.
      */
     public int cachedQueriesCount() {
-        return context != null && context.getQueryCache() != null
-                ? context.getQueryCache().size()
-                : 0;
+        return context != null && context.getQueryCache() != null ? context
+                .getQueryCache()
+                .size() : 0;
     }
 
     /**
@@ -579,7 +580,8 @@
      * @deprecated since 3.0. See {@link DataContext#getQueryCache()}.
      */
     public synchronized List getCachedQueryResult(String name) {
-        return context != null && context.getQueryCache() != null ? context.getQueryCache()
+        return context != null && context.getQueryCache() != null ? context
+                .getQueryCache()
                 .get(new CacheQueryMetadata(name)) : null;
     }
 
@@ -1145,6 +1147,10 @@
         }
     }
 
+    /**
+     * @deprecated since 3.0 as this inner class is used to provide backwards
+     *             compatibility for some deprecated methods.
+     */
     final class CacheQueryMetadata implements QueryMetadata {
 
         private String cacheKey;
@@ -1160,7 +1166,7 @@
         public SQLResultSetMapping getResultSetMapping() {
             return null;
         }
-        
+
         public Query getOrginatingQuery() {
             return null;
         }
@@ -1170,6 +1176,10 @@
         }
 
         public String getCachePolicy() {
+            return null;
+        }
+
+        public QueryCacheStrategy getCacheStrategy() {
             return null;
         }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/NestedQueryCache.java
Thu Apr 17 12:22:22 2008
@@ -26,6 +26,7 @@
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.query.PrefetchTreeNode;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.SQLResultSetMapping;
 import org.apache.cayenne.reflect.ClassDescriptor;
@@ -130,8 +131,15 @@
             return qualifiedKey(mdDelegate.getCacheKey());
         }
 
+        /**
+         * @deprecated since 3.0 in favor of 'getCacheStrategy'.
+         */
         public String getCachePolicy() {
             return mdDelegate.getCachePolicy();
+        }
+
+        public QueryCacheStrategy getCacheStrategy() {
+            return mdDelegate.getCacheStrategy();
         }
 
         public ClassDescriptor getClassDescriptor() {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
Thu Apr 17 12:22:22 2008
@@ -51,6 +51,7 @@
     boolean refreshingObjects = QueryMetadata.REFRESHING_OBJECTS_DEFAULT;
     boolean resolvingInherited = QueryMetadata.RESOLVING_INHERITED_DEFAULT;
     String cachePolicy = QueryMetadata.CACHE_POLICY_DEFAULT;
+    QueryCacheStrategy cacheStrategy = QueryCacheStrategy.getDefaultStrategy();
 
     PrefetchTreeNode prefetchTree;
     String cacheKey;
@@ -199,6 +200,13 @@
                 this.cacheGroups[i] = toks.nextToken();
             }
         }
+    }
+    
+    /**
+     * @since 3.0
+     */
+    public QueryCacheStrategy getCacheStrategy() {
+        return cacheStrategy;
     }
 
     public void encodeAsXML(XMLEncoder encoder) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/DefaultQueryMetadata.java
Thu Apr 17 12:22:22 2008
@@ -54,14 +54,14 @@
 
         return null;
     }
-    
+
     /**
      * @since 3.0
      */
     public SQLResultSetMapping getResultSetMapping() {
         return null;
     }
-    
+
     /**
      * @since 3.0
      */
@@ -69,6 +69,13 @@
         return null;
     }
 
+    /**
+     * @since 3.0
+     */
+    public QueryCacheStrategy getCacheStrategy() {
+        return QueryCacheStrategy.getDefaultStrategy();
+    }
+
     public DbEntity getDbEntity() {
         return null;
     }
@@ -76,7 +83,7 @@
     public ObjEntity getObjEntity() {
         return null;
     }
-    
+
     public ClassDescriptor getClassDescriptor() {
         return null;
     }
@@ -88,11 +95,14 @@
     public String getCacheKey() {
         return null;
     }
-    
+
     public String[] getCacheGroups() {
         return null;
     }
 
+    /**
+     * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
+     */
     public String getCachePolicy() {
         return QueryMetadata.CACHE_POLICY_DEFAULT;
     }
@@ -112,7 +122,7 @@
     public int getPageSize() {
         return QueryMetadata.PAGE_SIZE_DEFAULT;
     }
-    
+
     public int getFetchStartIndex() {
         return -1;
     }

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryCacheStrategy.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryCacheStrategy.java?rev=649242&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryCacheStrategy.java
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryCacheStrategy.java
Thu Apr 17 12:22:22 2008
@@ -0,0 +1,64 @@
+/*****************************************************************
+ *   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.query;
+
+/**
+ * Defines query result caching policy.
+ * 
+ * @since 3.0
+ * @author Andrus Adamchik
+ */
+public enum QueryCacheStrategy {
+
+    /**
+     * A default cache policy stating that the query results should not be cached.
+     */
+    NO_CACHE,
+
+    /**
+     * A cache policy stating that query results shall be cached by the ObjectContext that
+     * originated the query, independent from any other ObjectContexts.
+     */
+    LOCAL_CACHE,
+
+    /**
+     * A cache policy stating that query results shall be cached by the ObjectContext that
+     * originated the query, independent from any other ObjectContexts, however the query
+     * that uses this policy should treat current cache state as expired, and force the
+     * database fetch.
+     */
+    LOCAL_CACHE_REFRESH,
+
+    /**
+     * A cache policy ruling that query results shall be cached in a shared location
+     * accessible by all ObjectContexts.
+     */
+    SHARED_CACHE,
+
+    /**
+     * A cache policy ruling that query results shall be cached in a shared location
+     * accessible by all ObjectContexts, however the query that uses this policy should
+     * treat current cache state as expired, and force the database fetch.
+     */
+    SHARED_CACHE_REFRESH;
+    
+    public static QueryCacheStrategy getDefaultStrategy() {
+        return NO_CACHE;
+    }
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadata.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadata.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadata.java
Thu Apr 17 12:22:22 2008
@@ -35,28 +35,38 @@
 
     /**
      * A cache policy that disables caching of query results.
+     * 
+     * @deprecated since 3.0 use {@link QueryCacheStrategy} enum.
      */
     public static final String NO_CACHE = "nocache";
 
     /**
      * A cache policy ruling that query results shall be cached separately for each
      * DataContext.
+     * 
+     * @deprecated since 3.0 use {@link QueryCacheStrategy} enum.
      */
     public static final String LOCAL_CACHE = "localcache";
 
     /**
      * Same as {@link #LOCAL_CACHE}, only forcing any current cache expiration.
+     * 
+     * @deprecated since 3.0 use {@link QueryCacheStrategy} enum.
      */
     public static final String LOCAL_CACHE_REFRESH = "localcache_refresh";
 
     /**
      * A cache policy ruling that query results shall be stored in a shared cache
      * accessible by all DataContexts.
+     * 
+     * @deprecated since 3.0 use {@link QueryCacheStrategy} enum.
      */
     public static final String SHARED_CACHE = "sharedcache";
 
     /**
      * Same as {@link #SHARED_CACHE}, only forcing any current cache expiration.
+     * 
+     * @deprecated since 3.0 use {@link QueryCacheStrategy} enum.
      */
     public static final String SHARED_CACHE_REFRESH = "sharedcache_refresh";
 
@@ -93,13 +103,24 @@
 
     public static final boolean RESOLVING_INHERITED_DEFAULT = true;
 
+    /**
+     * @deprecated since 3.0 use {@value #CACHE_STRATEGY_PROPERTY}
+     */
     public static final String CACHE_POLICY_PROPERTY = "cayenne.GenericSelectQuery.cachePolicy";
+    
+    /**
+     * @since 3.0
+     */
+    public static final String CACHE_STRATEGY_PROPERTY = "cayenne.GenericSelectQuery.cacheStrategy";
 
     /**
      * @since 3.0
      */
     public static final String CACHE_GROUPS_PROPERTY = "cayenne.GenericSelectQuery.cacheGroups";
 
+    /**
+     * @deprecated since 3.0 use {@link QueryCacheStrategy} enum.
+     */
     public static final String CACHE_POLICY_DEFAULT = NO_CACHE;
 
     /**
@@ -131,8 +152,16 @@
      * Returns query cache policy, which can be one of {@link #NO_CACHE},
      * {@link #LOCAL_CACHE}, or {@link #SHARED_CACHE}. NO_CACHE is generally a default
      * policy.
+     * 
+     * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
      */
     String getCachePolicy();
+
+    /**
+     * Returns a caching strategy for this query.
+     * @since 3.0
+     */
+    QueryCacheStrategy getCacheStrategy();
 
     /**
      * Returns a String that uniquely identifies this query for the purposes of result

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/QueryMetadataWrapper.java
Thu Apr 17 12:22:22 2008
@@ -61,7 +61,7 @@
     boolean overrideExists(String key) {
         return overrides != null && overrides.containsKey(key);
     }
-    
+
     /**
      * @since 3.0
      */
@@ -84,11 +84,11 @@
     public ObjEntity getObjEntity() {
         return info.getObjEntity();
     }
-    
+
     public Query getOrginatingQuery() {
         return info.getOrginatingQuery();
     }
-    
+
     /**
      * @since 3.0
      */
@@ -101,11 +101,24 @@
                 .get(CACHE_KEY_PROPERTY) : info.getCacheKey();
     }
 
+    /**
+     * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
+     */
     public String getCachePolicy() {
         return (overrideExists(QueryMetadata.CACHE_POLICY_PROPERTY)) ? (String) overrides
                 .get(QueryMetadata.CACHE_POLICY_PROPERTY) : info.getCachePolicy();
     }
-    
+
+    /**
+     * @since 3.0
+     */
+    public QueryCacheStrategy getCacheStrategy() {
+        return (overrideExists(QueryMetadata.CACHE_STRATEGY_PROPERTY))
+                ? (QueryCacheStrategy) overrides
+                        .get(QueryMetadata.CACHE_STRATEGY_PROPERTY)
+                : info.getCacheStrategy();
+    }
+
     public String[] getCacheGroups() {
         return (overrideExists(QueryMetadata.CACHE_GROUPS_PROPERTY))
                 ? (String[]) overrides.get(QueryMetadata.CACHE_GROUPS_PROPERTY)
@@ -147,7 +160,7 @@
         Number n = (Number) overrides.get(QueryMetadata.PAGE_SIZE_PROPERTY);
         return n != null ? n.intValue() : 0;
     }
-    
+
     public int getFetchStartIndex() {
         return info.getFetchStartIndex();
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
Thu Apr 17 12:22:22 2008
@@ -26,6 +26,7 @@
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.query.PrefetchTreeNode;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.QueryRouter;
 import org.apache.cayenne.query.SQLAction;
@@ -60,7 +61,7 @@
         // ClientServerChannel behavior
 
         return new QueryMetadata() {
-            
+
             public Query getOrginatingQuery() {
                 return null;
             }
@@ -68,19 +69,29 @@
             public String getCacheKey() {
                 return cacheKey;
             }
-            
+
             public SQLResultSetMapping getResultSetMapping() {
                 return metadata.getResultSetMapping();
             }
-            
+
             public String[] getCacheGroups() {
                 return metadata.getCacheGroups();
             }
 
+            /**
+             * @deprecated since 3.0 in favor of 'getCacheStrategy'.
+             */
             public String getCachePolicy() {
                 return metadata.getCachePolicy();
             }
 
+            /**
+             * @since 3.0
+             */
+            public QueryCacheStrategy getCacheStrategy() {
+                return metadata.getCacheStrategy();
+            }
+
             public DataMap getDataMap() {
                 return metadata.getDataMap();
             }
@@ -100,7 +111,7 @@
             public ObjEntity getObjEntity() {
                 return metadata.getObjEntity();
             }
-            
+
             public ClassDescriptor getClassDescriptor() {
                 return metadata.getClassDescriptor();
             }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
Thu Apr 17 12:22:22 2008
@@ -31,6 +31,7 @@
 import org.apache.cayenne.query.Ordering;
 import org.apache.cayenne.query.PrefetchTreeNode;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.QueryRouter;
 import org.apache.cayenne.query.SQLAction;
@@ -74,7 +75,7 @@
             public Query getOrginatingQuery() {
                 return null;
             }
-            
+
             public String getCacheKey() {
                 return cacheKey;
             }
@@ -87,8 +88,15 @@
                 return metadata.getCacheGroups();
             }
 
+            /**
+             * @deprecated since 3.0 in favor of 'getCacheStrategy'.
+             */
             public String getCachePolicy() {
                 return metadata.getCachePolicy();
+            }
+
+            public QueryCacheStrategy getCacheStrategy() {
+                return metadata.getCacheStrategy();
             }
 
             public DataMap getDataMap() {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/RangeQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/RangeQuery.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/RangeQuery.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/remote/RangeQuery.java
Thu Apr 17 12:22:22 2008
@@ -26,6 +26,7 @@
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.query.PrefetchTreeNode;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.QueryRouter;
 import org.apache.cayenne.query.SQLAction;
@@ -57,7 +58,8 @@
      * Creates a query that returns a single page from an existing cached server-side
      * result list.
      */
-    RangeQuery(String cacheKey, int fetchStartIndex, int fetchLimit, Query originatingQuery)
{
+    RangeQuery(String cacheKey, int fetchStartIndex, int fetchLimit,
+            Query originatingQuery) {
         this.cacheKey = cacheKey;
         this.fetchStartIndex = fetchStartIndex;
         this.fetchLimit = fetchLimit;
@@ -66,9 +68,9 @@
 
     public QueryMetadata getMetaData(EntityResolver resolver) {
         final QueryMetadata originatingMetadata = originatingQuery.getMetaData(resolver);
-        
+
         return new QueryMetadata() {
-            
+
             public Query getOrginatingQuery() {
                 return originatingQuery;
             }
@@ -101,8 +103,18 @@
                 return 0;
             }
 
+            /**
+             * @deprecated since 3.0 in favor of 'getCacheStrategy'.
+             */
             public String getCachePolicy() {
                 return QueryMetadata.NO_CACHE;
+            }
+
+            /**
+             * @since 3.0
+             */
+            public QueryCacheStrategy getCacheStrategy() {
+                return QueryCacheStrategy.getDefaultStrategy();
             }
 
             public PrefetchTreeNode getPrefetchTree() {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/MockQueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/MockQueryMetadata.java?rev=649242&r1=649241&r2=649242&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/MockQueryMetadata.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/MockQueryMetadata.java
Thu Apr 17 12:22:22 2008
@@ -47,7 +47,14 @@
         return null;
     }
 
+    /**
+     * @deprecated since 3.0
+     */
     public String getCachePolicy() {
+        return null;
+    }
+    
+    public QueryCacheStrategy getCacheStrategy() {
         return null;
     }
     



Mime
View raw message