db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1727853 - in /db/torque/torque4/trunk/torque-runtime/src: main/java/org/apache/torque/manager/AbstractBaseManager.java main/java/org/apache/torque/manager/CacheListener.java test/java/org/apache/torque/manager/AbstractBaseManagerTest.java
Date Sun, 31 Jan 2016 20:28:09 GMT
Author: tv
Date: Sun Jan 31 20:28:09 2016
New Revision: 1727853

URL: http://svn.apache.org/viewvc?rev=1727853&view=rev
Log:
Modify several signatures to comply with the types used in Torque 4

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/manager/AbstractBaseManagerTest.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java?rev=1727853&r1=1727852&r2=1727853&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
Sun Jan 31 20:28:09 2016
@@ -37,6 +37,7 @@ import org.apache.commons.jcs.access.Gro
 import org.apache.commons.jcs.access.exception.CacheException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.torque.Column;
 import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
 import org.apache.torque.om.ObjectKey;
@@ -60,7 +61,7 @@ public abstract class AbstractBaseManage
     protected static final Log log = LogFactory.getLog(AbstractBaseManager.class);
 
     /** used to cache the om objects. cache is set by the region property */
-    protected transient CacheAccess<Serializable, T> cache;
+    protected transient CacheAccess<ObjectKey, T> cache;
 
     /** used to cache the method result objects. cache is set by the region property */
     protected transient GroupCacheAccess<MethodCacheKey, Object> groupCache;
@@ -81,11 +82,11 @@ public abstract class AbstractBaseManage
     private boolean isNew = true;
 
     /** The fields which are valid fields of interest for a listener. */
-    protected Map<String, ?> validFields;
+    protected Map<Column, ?> validFields;
 
     /** The listeners for this manager. */
-    protected Map<String, FastArrayList> listenersMap
-        = new HashMap<String, FastArrayList>();
+    protected Map<Column, FastArrayList> listenersMap
+        = new HashMap<Column, FastArrayList>();
 
     /**
      * Get the Class instance
@@ -224,7 +225,7 @@ public abstract class AbstractBaseManage
      * @param key the primary key of the object
      * @return the object from cache
      */
-    protected T cacheGet(final Serializable key)
+    protected T cacheGet(final ObjectKey key)
     {
         T om = null;
         if (cache != null)
@@ -285,7 +286,7 @@ public abstract class AbstractBaseManage
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    protected T removeInstanceImpl(final Serializable key)
+    protected T removeInstanceImpl(final ObjectKey key)
         throws TorqueException
     {
         T oldOm = null;
@@ -323,7 +324,7 @@ public abstract class AbstractBaseManage
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    protected T putInstanceImpl(final Serializable key, final T om)
+    protected T putInstanceImpl(final ObjectKey key, final T om)
         throws TorqueException
     {
         if (getOMClass() != null && !getOMClass().isInstance(om))
@@ -535,8 +536,8 @@ public abstract class AbstractBaseManage
     public void addCacheListenerImpl(
             final CacheListener<? extends Persistent> listener)
     {
-        List<String> keys = listener.getInterestedFields();
-        for (String key : keys)
+        List<Column> keys = listener.getInterestedFields();
+        for (Column key : keys)
         {
             // Peer.column names are the fields
             if (validFields != null && validFields.containsKey(key))
@@ -580,7 +581,7 @@ public abstract class AbstractBaseManage
      * @param key
      * @return A subset of the list identified by <code>key</code>.
      */
-    private synchronized FastArrayList createSubsetList(final String key)
+    private synchronized FastArrayList createSubsetList(final Column key)
     {
         FastArrayList list = null;
         if (listenersMap.containsKey(key))

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java?rev=1727853&r1=1727852&r2=1727853&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/CacheListener.java
Sun Jan 31 20:28:09 2016
@@ -21,6 +21,7 @@ package org.apache.torque.manager;
 
 import java.util.List;
 
+import org.apache.torque.Column;
 import org.apache.torque.om.Persistent;
 
 /**
@@ -49,5 +50,5 @@ public interface CacheListener<T extends
     /**
      *
      */
-    List<String> getInterestedFields();
+    List<Column> getInterestedFields();
 }

Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/manager/AbstractBaseManagerTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/manager/AbstractBaseManagerTest.java?rev=1727853&r1=1727852&r2=1727853&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/manager/AbstractBaseManagerTest.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/manager/AbstractBaseManagerTest.java
Sun Jan 31 20:28:09 2016
@@ -19,13 +19,15 @@ package org.apache.torque.manager;
  * under the License.
  */
 
-import java.util.Arrays;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
 import junit.framework.TestCase;
 
 import org.apache.torque.BaseTestCase;
+import org.apache.torque.Column;
+import org.apache.torque.ColumnImpl;
 import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
 import org.apache.torque.om.ObjectKey;
@@ -55,19 +57,25 @@ public class AbstractBaseManagerTest ext
 	}
 
 	/* CacheListener methods */
-	public void addedObject(TestPersistent om)
+	@Override
+    public void addedObject(TestPersistent om)
 	{
 		this.addedObjectCalled = true;
 	}
 
-	public void refreshedObject(TestPersistent om)
+	@Override
+    public void refreshedObject(TestPersistent om)
 	{
 		this.refreshedObjectCalled = true;
 	}
 
-	public List<String> getInterestedFields()
+	@Override
+    public List<Column> getInterestedFields()
 	{
-		return Arrays.asList("test1", "test2");
+	    List<Column> columnList = new ArrayList<Column>(2);
+		columnList.add(new ColumnImpl("test1"));
+		columnList.add(new ColumnImpl("test2"));
+		return columnList;
 	}
 
 	/**
@@ -167,20 +175,20 @@ public class AbstractBaseManagerTest ext
 	@SuppressWarnings("unchecked")
 	public void testListeners()
 	{
-		manager.validFields = new HashMap<String, Object>();
-		manager.validFields.put("test1", null);
-		manager.validFields.put("test2", null);
+		manager.validFields = new HashMap<Column, Object>();
+		manager.validFields.put(new ColumnImpl("test1"), null);
+		manager.validFields.put(new ColumnImpl("test2"), null);
 		manager.addCacheListenerImpl(this);
 		this.addedObjectCalled = false;
 		this.refreshedObjectCalled = false;
 		TestPersistent test1 = new TestPersistent();
 		TestPersistent test2 = new TestPersistent();
-		manager.notifyListeners(manager.listenersMap.get("test1"), (TestPersistent)null, test1);
+		manager.notifyListeners(manager.listenersMap.get(new ColumnImpl("test1")), (TestPersistent)null,
test1);
 		assertTrue("Should call addedObject", addedObjectCalled);
 		assertFalse("Should not call refreshedObject", refreshedObjectCalled);
 		this.addedObjectCalled = false;
 		this.refreshedObjectCalled = false;
-		manager.notifyListeners(manager.listenersMap.get("test2"), test2, test1);
+		manager.notifyListeners(manager.listenersMap.get(new ColumnImpl("test2")), test2, test1);
 		assertFalse("Should not call addedObject", addedObjectCalled);
 		assertTrue("Should call refreshedObject", refreshedObjectCalled);
 	}



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message