cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r771057 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ framework/cayenne-jdk1.5-unp...
Date Sun, 03 May 2009 14:04:44 GMT
Author: aadamchik
Date: Sun May  3 14:04:43 2009
New Revision: 771057

URL: http://svn.apache.org/viewvc?rev=771057&view=rev
Log:
CAY-1218 Query caching loose ends

1. passing domain properties to query cache factory when creating default query cache
2. fixing generics declarations in the DataDomain properties
3. modeler support for cache groups on queries
4. modeler support for query cache factory per domain

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProject.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ModelerProjectLoadDelegate.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EjbqlQueryPropertiesPanel.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureQueryView.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/RawQueryPropertiesPanel.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SQLTemplateMainTab.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/datanode/MainDataNodeView.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Sun May  3 14:04:43 2009
@@ -38,6 +38,7 @@
 CAY-1211 Modeler: blown out warning dialogs
 CAY-1214 Class generation should create abstract callback methods in the superclass and stub methods in the subclass
 CAY-1215 Move tool-like items into new cayenne-tools module
+CAY-1218 Query caching loose ends
 
 Bug Fixes Since M5:
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/BaseContext.java Sun May  3 14:04:43 2009
@@ -44,21 +44,21 @@
 
 /**
  * A common base superclass for Cayenne ObjectContext implementors.
- *
+ * 
  * @since 3.0
  */
 public abstract class BaseContext implements ObjectContext, DataChannel {
 
     /**
      * A holder of a ObjectContext bound to the current thread.
-     *
+     * 
      * @since 3.0
      */
     protected static final ThreadLocal<ObjectContext> threadObjectContext = new ThreadLocal<ObjectContext>();
 
     /**
      * Returns the ObjectContext bound to the current thread.
-     *
+     * 
      * @since 3.0
      * @return the ObjectContext associated with caller thread.
      * @throws IllegalStateException if there is no ObjectContext bound to the current
@@ -75,10 +75,10 @@
     }
 
     /**
-     * Binds a ObjectContext to the current thread. ObjectContext can later be retrieved by
-     * users in the same thread by calling {@link BaseContext#getThreadObjectContext}.
+     * Binds a ObjectContext to the current thread. ObjectContext can later be retrieved
+     * by users in the same thread by calling {@link BaseContext#getThreadObjectContext}.
      * Using null parameter will unbind currently bound ObjectContext.
-     *
+     * 
      * @since 3.0
      */
     public static void bindThreadObjectContext(ObjectContext context) {
@@ -92,7 +92,7 @@
 
     /**
      * Stores user defined properties associated with this DataContext.
-     *
+     * 
      * @since 3.0
      */
     protected Map<String, Object> userProperties;
@@ -255,7 +255,7 @@
     /**
      * Returns {@link QueryCache}, creating it on the fly if needed.
      */
-    public synchronized QueryCache getQueryCache() {
+    public QueryCache getQueryCache() {
         if (queryCache == null) {
             synchronized (this) {
                 if (queryCache == null) {
@@ -272,13 +272,13 @@
     /**
      * Sets a QueryCache to be used for storing cached query results.
      */
-    public synchronized void setQueryCache(QueryCache queryCache) {
+    public void setQueryCache(QueryCache queryCache) {
         this.queryCache = queryCache;
     }
 
     /**
      * Returns EventManager associated with the ObjectStore.
-     *
+     * 
      * @since 1.2
      */
     public EventManager getEventManager() {
@@ -354,7 +354,7 @@
 
     /**
      * Returns a map of user-defined properties associated with this DataContext.
-     *
+     * 
      * @since 3.0
      */
     protected Map<String, Object> getUserProperties() {
@@ -370,7 +370,7 @@
     /**
      * Returns a user-defined property previously set via 'setUserProperty'. Note that it
      * is a caller responsibility to synchronize access to properties.
-     *
+     * 
      * @since 3.0
      */
     public Object getUserProperty(String key) {
@@ -380,7 +380,7 @@
     /**
      * Sets a user-defined property. Note that it is a caller responsibility to
      * synchronize access to properties.
-     *
+     * 
      * @since 3.0
      */
     public void setUserProperty(String key, Object value) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java Sun May  3 14:04:43 2009
@@ -25,6 +25,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -44,6 +45,7 @@
 import org.apache.cayenne.Persistent;
 import org.apache.cayenne.QueryResponse;
 import org.apache.cayenne.access.util.IteratedSelectObserver;
+import org.apache.cayenne.cache.MapQueryCache;
 import org.apache.cayenne.cache.QueryCache;
 import org.apache.cayenne.cache.QueryCacheFactory;
 import org.apache.cayenne.conf.Configuration;
@@ -106,7 +108,7 @@
 
     /**
      * Returns the DataContext bound to the current thread.
-     *
+     * 
      * @since 1.1
      * @return the DataContext associated with caller thread.
      * @throws IllegalStateException if there is no DataContext bound to the current
@@ -123,7 +125,7 @@
      * Binds a DataContext to the current thread. DataContext can later be retrieved by
      * users in the same thread by calling {@link DataContext#getThreadDataContext}. Using
      * null parameter will unbind currently bound DataContext.
-     *
+     * 
      * @since 1.1
      * @deprecated since 3.0, replaced by BaseContex#getThreadObjectContext().
      */
@@ -149,7 +151,7 @@
      * {@link DataContext#createDataContext(String, boolean)} must be used instead.
      * ObjectStore associated with newly created DataContext will have a cache stack
      * configured according to the specified policy, overriding a parent domain setting.
-     *
+     * 
      * @since 1.1
      */
     public static DataContext createDataContext(boolean useSharedCache) {
@@ -174,7 +176,7 @@
      * Creates and returns new DataContext that will use a named DataDomain as its parent.
      * ObjectStore associated with newly created DataContext will have a cache stack
      * configured according to the specified policy, overriding a parent domain setting.
-     *
+     * 
      * @since 1.1
      */
     public static DataContext createDataContext(String domainName, boolean useSharedCache) {
@@ -195,7 +197,7 @@
 
     /**
      * Creates a new DataContext with parent DataChannel and ObjectStore.
-     *
+     * 
      * @since 1.2
      */
     public DataContext(DataChannel channel, ObjectStore objectStore) {
@@ -218,15 +220,21 @@
     /**
      * Returns {@link QueryCache} used by this DataContext, creating it on the fly if
      * needed. Uses parent DataDomain {@link QueryCacheFactory} to initialize the cache
-     * for the first time.
-     *
+     * for the first time, passing parent DataDomain's properties.
+     * 
      * @since 3.0
      */
     @Override
-    public synchronized QueryCache getQueryCache() {
+    public QueryCache getQueryCache() {
         if (queryCache == null) {
-            queryCache = getParentDataDomain().getQueryCacheFactory().getQueryCache(
-                    Collections.EMPTY_MAP);
+            synchronized (this) {
+                if (queryCache == null) {
+
+                    DataDomain domain = getParentDataDomain();
+                    queryCache = domain.getQueryCacheFactory().getQueryCache(
+                            domain.getProperties());
+                }
+            }
         }
 
         return queryCache;
@@ -234,7 +242,7 @@
 
     /**
      * Creates and returns a new child ObjectContext.
-     *
+     * 
      * @since 3.0
      */
     public ObjectContext createChildContext() {
@@ -243,7 +251,7 @@
 
     /**
      * Creates and returns a new child DataContext.
-     *
+     * 
      * @since 1.2
      * @deprecated since 3.0 use {@link #createChildContext()}.
      */
@@ -317,7 +325,7 @@
      * Returns a DataDomain used by this DataContext. DataDomain is looked up in the
      * DataChannel hierarchy. If a channel is not a DataDomain or a DataContext, null is
      * returned.
-     *
+     * 
      * @return DataDomain that is a direct or indirect parent of this DataContext in the
      *         DataChannel hierarchy.
      * @since 1.1
@@ -347,7 +355,7 @@
     /**
      * Sets a DataContextDelegate for this context. Delegate is notified of certain events
      * in the DataContext lifecycle and can customize DataContext behavior.
-     *
+     * 
      * @since 1.1
      */
     public void setDelegate(DataContextDelegate delegate) {
@@ -356,7 +364,7 @@
 
     /**
      * Returns a delegate currently associated with this DataContext.
-     *
+     * 
      * @since 1.1
      */
     public DataContextDelegate getDelegate() {
@@ -417,7 +425,7 @@
 
     /**
      * Returns a collection of all uncommitted registered objects.
-     *
+     * 
      * @since 1.2
      */
     @Override
@@ -454,7 +462,7 @@
      * temporary ids. DO NOT USE this method if you expect a DataRow to represent a
      * complete object state.
      * </p>
-     *
+     * 
      * @since 1.1
      */
     public DataRow currentSnapshot(final Persistent object) {
@@ -561,7 +569,7 @@
 
     /**
      * Converts a list of data rows to a list of DataObjects.
-     *
+     * 
      * @since 1.1
      * @deprecated since 3.0 as refreshing and resolvingInheritanceHierarchy flags are
      *             deprecated. Use {@link #objectsFromDataRows(ClassDescriptor, List)}
@@ -582,7 +590,7 @@
     /**
      * Converts a list of DataRows to a List of DataObject registered with this
      * DataContext.
-     *
+     * 
      * @since 3.0
      */
     public List objectsFromDataRows(
@@ -595,7 +603,7 @@
     /**
      * Converts a list of DataRows to a List of DataObject registered with this
      * DataContext.
-     *
+     * 
      * @deprecated since 3.0 as refresh and resolveInheritanceHierarchy flags are
      *             deprecated. Use {@link #objectsFromDataRows(ClassDescriptor, List)}
      *             instead.
@@ -621,7 +629,7 @@
 
     /**
      * Creates a DataObject from DataRow.
-     *
+     * 
      * @see DataRow
      */
     public <T extends DataObject> T objectFromDataRow(
@@ -644,7 +652,7 @@
     /**
      * Creates a DataObject from DataRow. This variety of the 'objectFromDataRow' method
      * is normally used for generic classes.
-     *
+     * 
      * @see DataRow
      * @since 3.0
      */
@@ -669,7 +677,7 @@
 
     /**
      * Creates and registers a new persistent object.
-     *
+     * 
      * @since 1.2
      */
     @Override
@@ -693,7 +701,7 @@
      * <p/>
      * <i>Note: in most cases {@link #newObject(Class)} method should be used, however
      * this method is helpful when generic persistent classes are used.</i>
-     *
+     * 
      * @since 3.0
      */
     public Persistent newObject(String entityName) {
@@ -734,7 +742,7 @@
     /**
      * Instantiates new object and registers it with itself. Object class must have a
      * default constructor.
-     *
+     * 
      * @since 1.1
      * @deprecated since 3.0, use {@link #newObject(Class)} instead.
      */
@@ -759,7 +767,7 @@
      * <p/>
      * <i>Note that since 3.0 this method takes Object as an argument instead of a
      * {@link DataObject}.</i>
-     *
+     * 
      * @param object new object that needs to be made persistent.
      */
     @Override
@@ -872,7 +880,7 @@
      * Unregisters a Collection of DataObjects from the DataContext and the underlying
      * ObjectStore. This operation also unsets DataContext and ObjectId for each object
      * and changes its state to TRANSIENT.
-     *
+     * 
      * @see #invalidateObjects(Collection)
      */
     public void unregisterObjects(Collection dataObjects) {
@@ -890,7 +898,7 @@
      * to-many relationship with nullify delete rule may result in objects being removed
      * from collection.
      * </p>
-     *
+     * 
      * @since 1.2
      */
     public void deleteObjects(Collection objects) {
@@ -910,7 +918,7 @@
      * persistence state is changed to PersistenceState.DELETED; objects related to this
      * object are processed according to delete rules, i.e. relationships can be unset
      * ("nullify" rule), deletion operation is cascaded (cascade rule).
-     *
+     * 
      * @param object a persistent object that we want to delete.
      * @throws DeleteDenyException if a DENY delete rule is applicable for object
      *             deletion.
@@ -925,7 +933,7 @@
      * Refetches object data for ObjectId. This method is used internally by Cayenne to
      * resolve objects in state <code>PersistenceState.HOLLOW</code>. It can also be used
      * to refresh certain objects.
-     *
+     * 
      * @throws CayenneRuntimeException if object id doesn't match any records, or if there
      *             is more than one object is fetched.
      * @deprecated since 3.0 use {@link ObjectIdQuery} with appropriate refresh settings.
@@ -967,7 +975,7 @@
     /**
      * If the parent channel is a DataContext, reverts local changes to make this context
      * look like the parent, if the parent channel is a DataDomain, reverts all changes.
-     *
+     * 
      * @since 1.2
      */
     @Override
@@ -1017,7 +1025,7 @@
      * update. If it is a DataDomain (the most common case), the changes are written to
      * the database. To cause cascading commit all the way to the database, one must use
      * {@link #commitChanges()}.
-     *
+     * 
      * @since 1.2
      * @see #commitChanges()
      */
@@ -1061,7 +1069,7 @@
 
     /**
      * Synchronizes with the parent channel, performing a flush or a commit.
-     *
+     * 
      * @since 1.2
      */
     GraphDiff flushToParent(boolean cascade) {
@@ -1195,7 +1203,7 @@
 
     /**
      * Runs an iterated query in transactional context provided by the caller.
-     *
+     * 
      * @since 1.2
      */
     ResultIterator internalPerformIteratedQuery(Query query) throws CayenneException {
@@ -1208,7 +1216,7 @@
 
     /**
      * Executes a query returning a generic response.
-     *
+     * 
      * @since 1.2
      */
     @Override
@@ -1242,7 +1250,7 @@
      * <p>
      * <i>Since 1.2 takes any Query parameter, not just GenericSelectQuery</i>
      * </p>
-     *
+     * 
      * @return A list of DataObjects or a DataRows, depending on the value returned by
      *         {@link QueryMetadata#isFetchingDataRows()}.
      */
@@ -1261,7 +1269,7 @@
     /**
      * An implementation of a {@link DataChannel} method that is used by child contexts to
      * execute queries. Not intended for direct use.
-     *
+     * 
      * @since 1.2
      */
     public QueryResponse onQuery(ObjectContext context, Query query) {
@@ -1271,7 +1279,7 @@
     /**
      * Performs a single database query that does not select rows. Returns an array of
      * update counts.
-     *
+     * 
      * @since 1.1
      */
     public int[] performNonSelectingQuery(Query query) {
@@ -1282,7 +1290,7 @@
     /**
      * Performs a named mapped query that does not select rows. Returns an array of update
      * counts.
-     *
+     * 
      * @since 1.1
      */
     public int[] performNonSelectingQuery(String queryName) {
@@ -1292,7 +1300,7 @@
     /**
      * Performs a named mapped non-selecting query using a map of parameters. Returns an
      * array of update counts.
-     *
+     * 
      * @since 1.1
      */
     public int[] performNonSelectingQuery(String queryName, Map<String, ?> parameters) {
@@ -1303,7 +1311,7 @@
      * Returns a list of objects or DataRows for a named query stored in one of the
      * DataMaps. Internally Cayenne uses a caching policy defined in the named query. If
      * refresh flag is true, a refresh is forced no matter what the caching policy is.
-     *
+     * 
      * @param queryName a name of a GenericSelectQuery defined in one of the DataMaps. If
      *            no such query is defined, this method will throw a
      *            CayenneRuntimeException.
@@ -1319,7 +1327,7 @@
      * Returns a list of objects or DataRows for a named query stored in one of the
      * DataMaps. Internally Cayenne uses a caching policy defined in the named query. If
      * refresh flag is true, a refresh is forced no matter what the caching policy is.
-     *
+     * 
      * @param queryName a name of a GenericSelectQuery defined in one of the DataMaps. If
      *            no such query is defined, this method will throw a
      *            CayenneRuntimeException.
@@ -1350,7 +1358,7 @@
     /**
      * Returns <code>true</code> if the ObjectStore uses shared cache of a parent
      * DataDomain.
-     *
+     * 
      * @since 1.1
      */
     public boolean isUsingSharedSnapshotCache() {
@@ -1360,7 +1368,7 @@
     /**
      * Returns whether this DataContext performs object validation before commit is
      * executed.
-     *
+     * 
      * @since 1.1
      */
     public boolean isValidatingObjectsOnCommit() {
@@ -1370,7 +1378,7 @@
     /**
      * Sets the property defining whether this DataContext should perform object
      * validation before commit is executed.
-     *
+     * 
      * @since 1.1
      */
     public void setValidatingObjectsOnCommit(boolean flag) {
@@ -1482,7 +1490,7 @@
 
     /**
      * Returns this context's ObjectStore.
-     *
+     * 
      * @since 1.2
      */
     @Override
@@ -1498,7 +1506,7 @@
      * In case you pass a non-null second parameter, you are responsible for setting
      * correct persistence state of the returned local object, as generally there is no
      * way for Cayenne to determine the resulting local object state.
-     *
+     * 
      * @since 1.2
      */
     @Override

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomain.java Sun May  3 14:04:43 2009
@@ -51,7 +51,6 @@
  * source abstraction hiding multiple physical data sources from the user. When a child
  * DataContext sends a query to the DataDomain, it is transparently routed to an
  * appropriate DataNode.
- * 
  */
 public class DataDomain implements QueryEngine, DataChannel {
 
@@ -88,7 +87,7 @@
      * Properties configured for DataDomain. These include properties of the DataRowStore
      * and remote notifications.
      */
-    protected Map properties = Collections.synchronizedMap(new TreeMap());
+    protected Map<String, String> properties = Collections.synchronizedMap(new TreeMap<String, String>());
 
     protected EntityResolver entityResolver;
     protected DataRowStore sharedSnapshotCache;
@@ -212,50 +211,48 @@
      * 
      * @since 1.1
      */
-    public void initWithProperties(Map properties) {
+    public void initWithProperties(Map<String, String> properties) {
         // create map with predictable modification and synchronization behavior
-        Map localMap = new HashMap();
+        Map<String, String> localMap = new HashMap<String, String>();
         if (properties != null) {
             localMap.putAll(properties);
         }
 
         this.properties = localMap;
 
-        Object sharedCacheEnabled = localMap.get(SHARED_CACHE_ENABLED_PROPERTY);
-        Object validatingObjectsOnCommit = localMap
+        String sharedCacheEnabled = localMap.get(SHARED_CACHE_ENABLED_PROPERTY);
+        String validatingObjectsOnCommit = localMap
                 .get(VALIDATING_OBJECTS_ON_COMMIT_PROPERTY);
-        Object usingExternalTransactions = localMap
+        String usingExternalTransactions = localMap
                 .get(USING_EXTERNAL_TRANSACTIONS_PROPERTY);
 
-        Object dataContextFactory = localMap.get(DATA_CONTEXT_FACTORY_PROPERTY);
-        Object queryCacheFactory = localMap.get(QUERY_CACHE_FACTORY_PROPERTY);
+        String dataContextFactory = localMap.get(DATA_CONTEXT_FACTORY_PROPERTY);
+        String queryCacheFactoryName = localMap.get(QUERY_CACHE_FACTORY_PROPERTY);
 
         // init ivars from properties
-        this.sharedCacheEnabled = (sharedCacheEnabled != null)
-                ? "true".equalsIgnoreCase(sharedCacheEnabled.toString())
-                : SHARED_CACHE_ENABLED_DEFAULT;
+        this.sharedCacheEnabled = (sharedCacheEnabled != null) ? "true"
+                .equalsIgnoreCase(sharedCacheEnabled) : SHARED_CACHE_ENABLED_DEFAULT;
         this.validatingObjectsOnCommit = (validatingObjectsOnCommit != null)
-                ? "true".equalsIgnoreCase(validatingObjectsOnCommit.toString())
+                ? "true".equalsIgnoreCase(validatingObjectsOnCommit)
                 : VALIDATING_OBJECTS_ON_COMMIT_DEFAULT;
         this.usingExternalTransactions = (usingExternalTransactions != null)
-                ? "true".equalsIgnoreCase(usingExternalTransactions.toString())
+                ? "true".equalsIgnoreCase(usingExternalTransactions)
                 : USING_EXTERNAL_TRANSACTIONS_DEFAULT;
 
-        if (dataContextFactory != null
-                && !Util.isEmptyString(dataContextFactory.toString())) {
-            this.dataContextFactory = (DataContextFactory) createInstance(
-                    dataContextFactory.toString(),
+        if (dataContextFactory != null && !Util.isEmptyString(dataContextFactory)) {
+            this.dataContextFactory = createInstance(
+                    dataContextFactory,
                     DataContextFactory.class);
         }
         else {
             this.dataContextFactory = null;
         }
 
-        if (queryCacheFactory != null
+        if (queryCacheFactoryName != null
                 && dataContextFactory != null
-                && !Util.isEmptyString(dataContextFactory.toString())) {
+                && !Util.isEmptyString(dataContextFactory)) {
             queryCacheFactory = createInstance(
-                    queryCacheFactory.toString(),
+                    queryCacheFactoryName,
                     QueryCacheFactory.class);
         }
         else {
@@ -263,7 +260,7 @@
         }
     }
 
-    private Object createInstance(String className, Class<?> implementedInterface) {
+    private <T> T createInstance(String className, Class<T> implementedInterface) {
         Class<?> aClass;
         try {
             aClass = Class.forName(className, true, Thread
@@ -282,7 +279,7 @@
         }
 
         try {
-            return aClass.newInstance();
+            return (T) aClass.newInstance();
         }
         catch (Exception e) {
             throw new CayenneRuntimeException("Error instantiating " + className, e);
@@ -330,9 +327,9 @@
 
     /**
      * Returns <code>true</code> if DataContexts produced by this DataDomain are using
-     * shared DataRowStore. Returns <code>false</code> if each DataContext would work
-     * with its own DataRowStore. Note that this setting can be overwritten per
-     * DataContext. See {@link #createDataContext(boolean)}.
+     * shared DataRowStore. Returns <code>false</code> if each DataContext would work with
+     * its own DataRowStore. Note that this setting can be overwritten per DataContext.
+     * See {@link #createDataContext(boolean)}.
      */
     public boolean isSharedCacheEnabled() {
         return sharedCacheEnabled;
@@ -387,7 +384,7 @@
      * @return a Map of properties for this DataDomain. There is no guarantees of specific
      *         synchronization behavior of this map.
      */
-    public Map getProperties() {
+    public Map<String, String> getProperties() {
         return properties;
     }
 
@@ -898,7 +895,8 @@
     /**
      * Returns shared {@link QueryCache} used by this DataDomain, creating it on the fly
      * if needed. Uses factory obtained via {@link #getQueryCacheFactory()} to initialize
-     * the cache for the first time.
+     * the cache for the first time. This domain properties are passed to the
+     * {@link QueryCacheFactory#getQueryCache(Map)} method.
      * 
      * @since 3.0
      */
@@ -907,8 +905,7 @@
         if (queryCache == null) {
             synchronized (this) {
                 if (queryCache == null) {
-                    queryCache = getQueryCacheFactory().getQueryCache(
-                            Collections.EMPTY_MAP);
+                    queryCache = getQueryCacheFactory().getQueryCache(getProperties());
                 }
             }
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/ConfigLoaderDelegate.java Sun May  3 14:04:43 2009
@@ -17,7 +17,6 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.conf;
 
 import java.util.Map;
@@ -26,14 +25,13 @@
 
 /**
  * Interface that defines callback API used by ConfigLoader to process loaded
- * configuration. Main responsibility of ConfigLoaderDelegate is to create
- * objects, while ConfigLoader is mainly concerned with XML parsing. 
- * 
+ * configuration. Main responsibility of ConfigLoaderDelegate is to create objects, while
+ * ConfigLoader is mainly concerned with XML parsing.
  */
 public interface ConfigLoaderDelegate {
+
     /**
-     * Callback methods invoked in the beginning of the configuration
-     * processing.
+     * Callback methods invoked in the beginning of the configuration processing.
      */
     public void startedLoading();
 
@@ -44,20 +42,21 @@
 
     /**
      * Callback method invoked when a project version is read.
+     * 
      * @since 1.1
      */
     public void shouldLoadProjectVersion(String version);
-        
+
     /**
-     * Callback method invoked when a domain is encountered in the configuration
-     * file.
+     * Callback method invoked when a domain is encountered in the configuration file.
+     * 
      * @param name domain name.
      */
     public void shouldLoadDataDomain(String name);
-    
+
     /**
-     * Callback method invoked when a DataView reference is encountered in the configuration
-     * file.
+     * Callback method invoked when a DataView reference is encountered in the
+     * configuration file.
      * 
      * @since 1.1
      */
@@ -67,32 +66,30 @@
      * @since 1.1
      */
     public void shouldLoadDataMaps(String domainName, Map<String, DataMap> locations);
-    
+
     /**
      * @since 1.1
      */
-    public void shouldLoadDataDomainProperties(String domainName, Map properties);
+    public void shouldLoadDataDomainProperties(
+            String domainName,
+            Map<String, String> properties);
 
     public void shouldLoadDataNode(
-        String domainName,
-        String nodeName,
-        String dataSource,
-        String adapter,
-        String factory, 
-        String schemaUpdateStrategy);
-
-    public void shouldLinkDataMap(
-        String domainName,
-        String nodeName,
-        String mapName);
+            String domainName,
+            String nodeName,
+            String dataSource,
+            String adapter,
+            String factory,
+            String schemaUpdateStrategy);
+
+    public void shouldLinkDataMap(String domainName, String nodeName, String mapName);
 
     /**
      * Gives delegate an opportunity to process the error.
      * 
      * @param th
-     * @return boolean indicating whether ConfigLoader should proceed with
-     * further processing. Ultimately it is up to the ConfigLoader to make this
-     * decision.
+     * @return boolean indicating whether ConfigLoader should proceed with further
+     *         processing. Ultimately it is up to the ConfigLoader to make this decision.
      */
     public boolean loadError(Throwable th);
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeLoadDelegate.java Sun May  3 14:04:43 2009
@@ -117,7 +117,9 @@
         views.put(name, location);
     }
 
-    public void shouldLoadDataDomainProperties(String domainName, Map properties) {
+    public void shouldLoadDataDomainProperties(
+            String domainName,
+            Map<String, String> properties) {
         if (properties == null || properties.isEmpty()) {
             return;
         }
@@ -315,7 +317,7 @@
         catch (ClassNotFoundException e) {
             logger.info("Error: ", e);
         }
-        
+
         // load DataSource
         try {
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProject.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProject.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProject.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProject.java Sun May  3 14:04:43 2009
@@ -37,7 +37,6 @@
 
 /**
  * Represents Cayenne application project.
- * 
  */
 public class ApplicationProject extends Project {
 
@@ -218,7 +217,7 @@
         public ProjectLoader(Configuration config) {
             super(config, config.getLoadStatus());
         }
-        
+
         protected void updateDefaults(DataDomain domain) {
             // do nothing...
         }
@@ -237,13 +236,15 @@
         }
 
         @Override
-        public void shouldLoadDataDomainProperties(String domainName, Map properties) {
+        public void shouldLoadDataDomainProperties(
+                String domainName,
+                Map<String, String> properties) {
 
-            // remove factory property to avoid instatiation attempts for unknown/invalid
+            // remove factory property to avoid instantiation attempts for unknown/invalid
             // classes
 
-            Map propertiesClone = new HashMap(properties);
-            Object dataContextFactory = propertiesClone
+            Map<String, String> propertiesClone = new HashMap<String, String>(properties);
+            String dataContextFactory = propertiesClone
                     .remove(DataDomain.DATA_CONTEXT_FACTORY_PROPERTY);
 
             super.shouldLoadDataDomainProperties(domainName, propertiesClone);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ModelerProjectLoadDelegate.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ModelerProjectLoadDelegate.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ModelerProjectLoadDelegate.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ModelerProjectLoadDelegate.java Sun May  3 14:04:43 2009
@@ -62,13 +62,15 @@
         }
     }
 
-    public void shouldLoadDataDomainProperties(String domainName, Map properties) {
+    public void shouldLoadDataDomainProperties(
+            String domainName,
+            Map<String, String> properties) {
 
-        // remove factory property to avoid instatiation attempts for unknown/invalid
+        // remove factory property to avoid instantiation attempts for unknown/invalid
         // classes
 
-        Map propertiesClone = new HashMap(properties);
-        Object dataContextFactory = propertiesClone
+        Map<String, String> propertiesClone = new HashMap<String, String>(properties);
+        String dataContextFactory = propertiesClone
                 .remove(DataDomain.DATA_CONTEXT_FACTORY_PROPERTY);
 
         super.shouldLoadDataDomainProperties(domainName, propertiesClone);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java Sun May  3 14:04:43 2009
@@ -17,7 +17,6 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.modeler.editor;
 
 import java.awt.BorderLayout;
@@ -25,13 +24,17 @@
 import java.awt.event.ActionListener;
 import java.util.Map;
 
+import javax.swing.DefaultComboBoxModel;
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 
 import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.access.DataRowStore;
+import org.apache.cayenne.cache.MapQueryCacheFactory;
+import org.apache.cayenne.cache.OSQueryCacheFactory;
 import org.apache.cayenne.conf.Configuration;
 import org.apache.cayenne.map.event.DomainEvent;
 import org.apache.cayenne.modeler.Application;
@@ -55,6 +58,10 @@
  */
 public class DataDomainView extends JPanel implements DomainDisplayListener {
 
+    final static String[] QUERY_CACHE_FACTORIES = new String[] {
+            MapQueryCacheFactory.class.getName(), OSQueryCacheFactory.class.getName()
+    };
+
     protected ProjectController projectController;
 
     protected TextAdapter name;
@@ -62,6 +69,7 @@
     protected JCheckBox objectValidation;
     protected JCheckBox externalTransactions;
     protected TextAdapter dataContextFactory;
+    protected JComboBox queryCacheFactory;
     protected JCheckBox sharedCache;
     protected JCheckBox remoteUpdates;
     protected JButton configRemoteUpdates;
@@ -103,6 +111,8 @@
         this.objectValidation = new JCheckBox();
         this.externalTransactions = new JCheckBox();
 
+        this.queryCacheFactory = new JComboBox();
+
         this.sharedCache = new JCheckBox();
         this.remoteUpdates = new JCheckBox();
         this.configRemoteUpdates = new JButton("Configure...");
@@ -112,7 +122,7 @@
         CellConstraints cc = new CellConstraints();
         FormLayout layout = new FormLayout(
                 "right:pref, 3dlu, fill:50dlu, 3dlu, fill:47dlu, 3dlu, fill:100",
-                "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
+                "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
 
         PanelBuilder builder = new PanelBuilder(layout);
         builder.setDefaultDialogBorder();
@@ -129,17 +139,20 @@
 
         builder.addLabel("Container-Managed Transactions:", cc.xy(1, 9));
         builder.add(externalTransactions, cc.xy(3, 9));
-        
+
         builder.addSeparator("Cache Configuration", cc.xywh(1, 11, 7, 1));
-        builder.addLabel("Max. Number of Objects:", cc.xy(1, 13));
-        builder.add(cacheSize.getComponent(), cc.xy(3, 13));
+        builder.addLabel("Query Cache Factory:", cc.xy(1, 13));
+        builder.add(queryCacheFactory, cc.xywh(3, 13, 5, 1));
 
-        builder.addLabel("Use Shared Cache:", cc.xy(1, 15));
-        builder.add(sharedCache, cc.xy(3, 15));
+        builder.addLabel("Size of Object Cache:", cc.xy(1, 15));
+        builder.add(cacheSize.getComponent(), cc.xy(3, 15));
 
-        builder.addLabel("Remote Change Notifications:", cc.xy(1, 17));
-        builder.add(remoteUpdates, cc.xy(3, 17));
-        builder.add(configRemoteUpdates, cc.xy(7, 17));
+        builder.addLabel("Use Shared Cache:", cc.xy(1, 17));
+        builder.add(sharedCache, cc.xy(3, 17));
+
+        builder.addLabel("Remote Change Notifications:", cc.xy(1, 19));
+        builder.add(remoteUpdates, cc.xy(3, 19));
+        builder.add(configRemoteUpdates, cc.xy(7, 19));
 
         this.setLayout(new BorderLayout());
         this.add(builder.getPanel(), BorderLayout.CENTER);
@@ -148,6 +161,19 @@
     protected void initController() {
         projectController.addDomainDisplayListener(this);
 
+        queryCacheFactory.setEditable(true);
+        queryCacheFactory.setModel(new DefaultComboBoxModel(QUERY_CACHE_FACTORIES));
+
+        queryCacheFactory.addActionListener(new ActionListener() {
+
+            public void actionPerformed(ActionEvent e) {
+                setDomainProperty(
+                        DataDomain.QUERY_CACHE_FACTORY_PROPERTY,
+                        (String) queryCacheFactory.getModel().getSelectedItem(),
+                        MapQueryCacheFactory.class.getName());
+            }
+        });
+
         // add action listener to checkboxes
         objectValidation.addActionListener(new ActionListener() {
 
@@ -187,7 +213,7 @@
                 if (!sharedCache.isSelected()) {
                     // uncheck remote updates...
                     remoteUpdates.setSelected(false);
-                    
+
                     setDomainProperty(
                             DataRowStore.REMOTE_NOTIFICATION_PROPERTY,
                             "false",
@@ -305,6 +331,10 @@
         remoteUpdates.setEnabled(sharedCache.isSelected());
         configRemoteUpdates.setEnabled(remoteUpdates.isEnabled()
                 && remoteUpdates.isSelected());
+
+        queryCacheFactory.setSelectedItem(getDomainProperty(
+                DataDomain.QUERY_CACHE_FACTORY_PROPERTY,
+                MapQueryCacheFactory.class.getName()));
     }
 
     void setDomainName(String newName) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EjbqlQueryPropertiesPanel.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EjbqlQueryPropertiesPanel.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EjbqlQueryPropertiesPanel.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EjbqlQueryPropertiesPanel.java Sun May  3 14:04:43 2009
@@ -19,8 +19,9 @@
 package org.apache.cayenne.modeler.editor;
 
 import java.awt.BorderLayout;
+
 import javax.swing.DefaultComboBoxModel;
-import javax.swing.text.JTextComponent;
+
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.query.EJBQLQuery;
 import org.apache.cayenne.query.Query;
@@ -30,36 +31,32 @@
 import com.jgoodies.forms.layout.CellConstraints;
 import com.jgoodies.forms.layout.FormLayout;
 
-
 public class EjbqlQueryPropertiesPanel extends SelectPropertiesPanel {
 
-
     public EjbqlQueryPropertiesPanel(ProjectController mediator) {
         super(mediator);
     }
 
-    protected void initController() {
-        super.initController();
-    }
-
     protected PanelBuilder createPanelBuilder() {
         CellConstraints cc = new CellConstraints();
         FormLayout layout = new FormLayout(
                 "right:max(80dlu;pref), 3dlu, left:max(10dlu;pref), "
                         + "3dlu, left:max(37dlu;pref), 3dlu, fill:max(147dlu;pref)",
-                "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
+                "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
 
         PanelBuilder builder = new PanelBuilder(layout);
         builder.setDefaultDialogBorder();
         builder.addSeparator("Select Properties", cc.xywh(1, 1, 7, 1));
         builder.addLabel("Result Caching:", cc.xy(1, 3));
         builder.add(cacheStrategy, cc.xywh(3, 3, 5, 1));
-        builder.addLabel("Fetch Offset, Rows:", cc.xy(1, 7));
-        builder.add(fetchOffset.getComponent(), cc.xywh(3, 7, 3, 1));
-        builder.addLabel("Fetch Limit, Rows:", cc.xy(1, 9));
-        builder.add(fetchLimit.getComponent(), cc.xywh(3, 9, 3, 1));
-        builder.addLabel("Page Size:", cc.xy(1, 11));
-        builder.add(pageSize.getComponent(), cc.xywh(3, 11, 3, 1));
+        cacheGroupsLabel = builder.addLabel("Cache Groups:", cc.xy(1, 7));
+        builder.add(cacheGroups.getComponent(), cc.xywh(3, 7, 5, 1));
+        builder.addLabel("Fetch Offset, Rows:", cc.xy(1, 9));
+        builder.add(fetchOffset.getComponent(), cc.xywh(3, 9, 3, 1));
+        builder.addLabel("Fetch Limit, Rows:", cc.xy(1, 11));
+        builder.add(fetchLimit.getComponent(), cc.xywh(3, 11, 3, 1));
+        builder.addLabel("Page Size:", cc.xy(1, 13));
+        builder.add(pageSize.getComponent(), cc.xywh(3, 13, 3, 1));
         return builder;
     }
 
@@ -74,21 +71,26 @@
      * query is changed.
      */
     public void initFromModel(Query query) {
+
+        // instead of metadata lookups, use EJBQLQuery getters to access fields to avoid
+        // unneeded EJBQL parsing...
         EJBQLQuery ejbqlQuery = (EJBQLQuery) query;
-     
+
         DefaultComboBoxModel cacheModel = new DefaultComboBoxModel(CACHE_POLICIES);
 
         QueryCacheStrategy selectedStrategy = ejbqlQuery.getCacheStrategy();
-        
+
         cacheModel.setSelectedItem(selectedStrategy != null
                 ? selectedStrategy
                 : QueryCacheStrategy.getDefaultStrategy());
         cacheStrategy.setModel(cacheModel);
+        String[] cacheGroupsArray = ejbqlQuery.getCacheGroups();
+        cacheGroups.setText(toCacheGroupsString(cacheGroupsArray));
+        setCacheGroupsEnabled(selectedStrategy != null
+                && selectedStrategy != QueryCacheStrategy.NO_CACHE);
 
         fetchOffset.setText(String.valueOf(ejbqlQuery.getFetchOffset()));
         fetchLimit.setText(String.valueOf(ejbqlQuery.getFetchLimit()));
- //       pageSize.setText(String.valueOf(ejbqlQuery.getPageSize()));
-        JTextComponent ps = pageSize.getComponent();
-        ps.setEditable(false);
+        pageSize.setText(String.valueOf(ejbqlQuery.getPageSize()));
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java Sun May  3 14:04:43 2009
@@ -54,7 +54,7 @@
         CellConstraints cc = new CellConstraints();
         FormLayout layout = new FormLayout(
                 "right:max(80dlu;pref), 3dlu, left:max(50dlu;pref), fill:max(150dlu;pref)",
-                "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
+                "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
         PanelBuilder builder = new PanelBuilder(layout);
         builder.setDefaultDialogBorder();
 
@@ -62,14 +62,16 @@
 
         builder.addLabel("Result Caching:", cc.xy(1, 3));
         builder.add(cacheStrategy, cc.xywh(3, 3, 2, 1));
-        builder.addLabel("Fetch Data Rows:", cc.xy(1, 7));
-        builder.add(dataRows, cc.xy(3, 7));
-        builder.addLabel("Fetch Offset, Rows:", cc.xy(1, 9));
-        builder.add(fetchOffset.getComponent(), cc.xy(3, 9));
-        builder.addLabel("Fetch Limit, Rows:", cc.xy(1, 11));
-        builder.add(fetchLimit.getComponent(), cc.xy(3, 11));
-        builder.addLabel("Page Size:", cc.xy(1, 13));
-        builder.add(pageSize.getComponent(), cc.xy(3, 13));
+        cacheGroupsLabel = builder.addLabel("Cache Groups:", cc.xy(1, 7));
+        builder.add(cacheGroups.getComponent(), cc.xywh(3, 7, 2, 1));
+        builder.addLabel("Fetch Data Rows:", cc.xy(1, 9));
+        builder.add(dataRows, cc.xy(3, 9));
+        builder.addLabel("Fetch Offset, Rows:", cc.xy(1, 11));
+        builder.add(fetchOffset.getComponent(), cc.xy(3, 11));
+        builder.addLabel("Fetch Limit, Rows:", cc.xy(1, 13));
+        builder.add(fetchLimit.getComponent(), cc.xy(3, 13));
+        builder.addLabel("Page Size:", cc.xy(1, 15));
+        builder.add(pageSize.getComponent(), cc.xy(3, 15));
 
         this.setLayout(new BorderLayout());
         this.add(builder.getPanel(), BorderLayout.CENTER);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureQueryView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureQueryView.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureQueryView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureQueryView.java Sun May  3 14:04:43 2009
@@ -290,8 +290,8 @@
             }
 
             CellConstraints cc = new CellConstraints();
-            builder.addLabel("Row Label Case:", cc.xy(1, 15));
-            builder.add(labelCase, cc.xywh(3, 15, 5, 1));
+            builder.addLabel("Row Label Case:", cc.xy(1, 17));
+            builder.add(labelCase, cc.xywh(3, 17, 5, 1));
 
             return builder;
         }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/RawQueryPropertiesPanel.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/RawQueryPropertiesPanel.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/RawQueryPropertiesPanel.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/RawQueryPropertiesPanel.java Sun May  3 14:04:43 2009
@@ -79,7 +79,7 @@
         FormLayout layout = new FormLayout(
                 "right:max(80dlu;pref), 3dlu, left:max(10dlu;pref), "
                         + "3dlu, left:max(37dlu;pref), 3dlu, fill:max(147dlu;pref)",
-                "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
+                "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
 
         PanelBuilder builder = new PanelBuilder(layout);
         builder.setDefaultDialogBorder();
@@ -88,15 +88,17 @@
 
         builder.addLabel("Result Caching:", cc.xy(1, 3));
         builder.add(cacheStrategy, cc.xywh(3, 3, 5, 1));
-        builder.addLabel("Fetch Data Objects:", cc.xy(1, 7));
-        builder.add(dataObjects, cc.xy(3, 7));
-        builder.add(entities, cc.xywh(5, 7, 3, 1));
-        builder.addLabel("Fetch Offset, Rows:", cc.xy(1, 9));
-        builder.add(fetchOffset.getComponent(), cc.xywh(3, 9, 3, 1));
-        builder.addLabel("Fetch Limit, Rows:", cc.xy(1, 11));
-        builder.add(fetchLimit.getComponent(), cc.xywh(3, 11, 3, 1));
-        builder.addLabel("Page Size:", cc.xy(1, 13));
-        builder.add(pageSize.getComponent(), cc.xywh(3, 13, 3, 1));
+        cacheGroupsLabel = builder.addLabel("Cache Groups:", cc.xy(1, 7));
+        builder.add(cacheGroups.getComponent(), cc.xywh(3, 7, 5, 1));
+        builder.addLabel("Fetch Data Objects:", cc.xy(1, 9));
+        builder.add(dataObjects, cc.xy(3, 9));
+        builder.add(entities, cc.xywh(5, 9, 3, 1));
+        builder.addLabel("Fetch Offset, Rows:", cc.xy(1, 11));
+        builder.add(fetchOffset.getComponent(), cc.xywh(3, 11, 3, 1));
+        builder.addLabel("Fetch Limit, Rows:", cc.xy(1, 13));
+        builder.add(fetchLimit.getComponent(), cc.xywh(3, 13, 3, 1));
+        builder.addLabel("Page Size:", cc.xy(1, 15));
+        builder.add(pageSize.getComponent(), cc.xywh(3, 15, 3, 1));
         return builder;
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SQLTemplateMainTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SQLTemplateMainTab.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SQLTemplateMainTab.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SQLTemplateMainTab.java Sun May  3 14:04:43 2009
@@ -235,8 +235,8 @@
             }
 
             CellConstraints cc = new CellConstraints();
-            builder.addLabel("Row Label Case:", cc.xy(1, 15));
-            builder.add(labelCase, cc.xywh(3, 15, 5, 1));
+            builder.addLabel("Row Label Case:", cc.xy(1, 17));
+            builder.add(labelCase, cc.xywh(3, 17, 5, 1));
 
             return builder;
         }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java Sun May  3 14:04:43 2009
@@ -24,11 +24,13 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.Map;
+import java.util.StringTokenizer;
 import java.util.TreeMap;
 
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.DefaultListCellRenderer;
 import javax.swing.JComboBox;
+import javax.swing.JComponent;
 import javax.swing.JList;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
@@ -76,6 +78,8 @@
     protected TextAdapter fetchLimit;
     protected TextAdapter pageSize;
     protected JComboBox cacheStrategy;
+    protected TextAdapter cacheGroups;
+    protected JComponent cacheGroupsLabel;
 
     protected ProjectController mediator;
 
@@ -92,7 +96,7 @@
                 setFetchOffset(text);
             }
         };
-        
+
         fetchLimit = new TextAdapter(new JTextField(7)) {
 
             protected void updateModel(String text) {
@@ -109,14 +113,24 @@
 
         cacheStrategy = CayenneWidgetFactory.createComboBox();
         cacheStrategy.setRenderer(new CacheStrategyRenderer());
+        cacheGroups = new TextAdapter(new JTextField()) {
+
+            protected void updateModel(String text) {
+                setCacheGroups(text);
+            }
+        };
     }
 
     protected void initController() {
         cacheStrategy.addActionListener(new ActionListener() {
 
             public void actionPerformed(ActionEvent event) {
-                Object strategy = cacheStrategy.getModel().getSelectedItem();
+                QueryCacheStrategy strategy = (QueryCacheStrategy) cacheStrategy
+                        .getModel()
+                        .getSelectedItem();
                 setQueryProperty("cacheStrategy", strategy);
+                setCacheGroupsEnabled(strategy != null
+                        && strategy != QueryCacheStrategy.NO_CACHE);
             }
         });
     }
@@ -138,11 +152,33 @@
                 : QueryCacheStrategy.getDefaultStrategy());
         cacheStrategy.setModel(cacheModel);
 
+        String[] cacheGroupsArray = query.getMetaData(resolver).getCacheGroups();
+        cacheGroups.setText(toCacheGroupsString(cacheGroupsArray));
+        setCacheGroupsEnabled(selectedStrategy != null
+                && selectedStrategy != QueryCacheStrategy.NO_CACHE);
+
         fetchOffset.setText(String.valueOf(query.getMetaData(resolver).getFetchOffset()));
         fetchLimit.setText(String.valueOf(query.getMetaData(resolver).getFetchLimit()));
         pageSize.setText(String.valueOf(query.getMetaData(resolver).getPageSize()));
     }
-    
+
+    protected String toCacheGroupsString(String[] groups) {
+
+        StringBuilder buffer = new StringBuilder();
+        if (groups != null && groups.length > 0) {
+
+            for (int i = 0; i < groups.length; i++) {
+                if (i > 0) {
+                    buffer.append(", ");
+                }
+
+                buffer.append(groups[i]);
+            }
+        }
+
+        return buffer.toString();
+    }
+
     void setFetchOffset(String string) {
         string = (string == null) ? "" : string.trim();
 
@@ -154,7 +190,8 @@
                 setQueryProperty("fetchOffset", new Integer(string));
             }
             catch (NumberFormatException nfex) {
-                throw new ValidationException("Fetch offset must be an integer: " + string);
+                throw new ValidationException("Fetch offset must be an integer: "
+                        + string);
             }
         }
     }
@@ -191,6 +228,18 @@
         }
     }
 
+    void setCacheGroups(String string) {
+        string = (string == null) ? "" : string.trim();
+
+        StringTokenizer toks = new StringTokenizer(string, ", \t");
+        String[] cacheGroups = new String[toks.countTokens()];
+        for (int i = 0; i < cacheGroups.length; i++) {
+            cacheGroups[i] = toks.nextToken();
+        }
+
+        setQueryProperty("cacheGroups", cacheGroups);
+    }
+
     Query getQuery() {
         return mediator.getCurrentQuery();
     }
@@ -206,6 +255,11 @@
         }
     }
 
+    protected void setCacheGroupsEnabled(boolean enabled) {
+        cacheGroups.getComponent().setEnabled(enabled);
+        cacheGroupsLabel.setEnabled(enabled);
+    }
+
     void setQueryProperty(String property, Object value) {
         Query query = getQuery();
         if (query != null) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/datanode/MainDataNodeView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/datanode/MainDataNodeView.java?rev=771057&r1=771056&r2=771057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/datanode/MainDataNodeView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/datanode/MainDataNodeView.java Sun May  3 14:04:43 2009
@@ -28,7 +28,6 @@
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
-import javax.swing.SwingConstants;
 
 import com.jgoodies.forms.builder.DefaultFormBuilder;
 import com.jgoodies.forms.layout.FormLayout;



Mime
View raw message