[jboss-cvs] JBossCache/src/org/jboss/cache/marshall ...
Manik Surtani
msurtani at jboss.com
Sat Nov 11 14:55:19 EST 2006
User: msurtani
Date: 06/11/11 14:55:19
Modified: src/org/jboss/cache/marshall MethodDeclarations.java
Log:
JBCACHE-842 and JBCACHE-843
Revision Changes Path
1.21 +113 -1 JBossCache/src/org/jboss/cache/marshall/MethodDeclarations.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MethodDeclarations.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/MethodDeclarations.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- MethodDeclarations.java 6 Nov 2006 23:34:09 -0000 1.20
+++ MethodDeclarations.java 11 Nov 2006 19:55:19 -0000 1.21
@@ -30,7 +30,7 @@
* allowing lookup operations both ways.
*
* @author <a href="galder.zamarreno at jboss.com">Galder Zamarreno</a>
- * @version $Revision: 1.20 $
+ * @version $Revision: 1.21 $
*/
public class MethodDeclarations
{
@@ -111,6 +111,20 @@
public static final Method moveMethodLocal;
+ // these are basic crud methods that are version-aware - JBCACHE-843.
+
+ public static final Method putDataVersionedMethodLocal;
+
+ public static final Method putDataEraseVersionedMethodLocal;
+
+ public static final Method putKeyValVersionedMethodLocal;
+
+ public static final Method removeNodeVersionedMethodLocal;
+
+ public static final Method removeKeyVersionedMethodLocal;
+
+ public static final Method removeDataVersionedMethodLocal;
+
//not all of these are used for RPC - trim accordingly.
public static final int putDataMethodLocal_id = 1;
@@ -181,6 +195,20 @@
public static final int moveMethodLocal_id = 36;
+ // these are basic crud methods that are version-aware - JBCACHE-843.
+
+ public static final int putDataVersionedMethodLocal_id = 37;
+
+ public static final int putDataEraseVersionedMethodLocal_id = 38;
+
+ public static final int putKeyValVersionedMethodLocal_id = 39;
+
+ public static final int removeNodeVersionedMethodLocal_id = 40;
+
+ public static final int removeKeyVersionedMethodLocal_id = 41;
+
+ public static final int removeDataVersionedMethodLocal_id = 42;
+
static
{
@@ -229,6 +257,15 @@
// ------------ move() api
moveMethodLocal = TreeCache.class.getDeclaredMethod("_move", Fqn.class, Fqn.class);
+
+ // ------------ version-aware methods - see JBCACHE-843
+ putDataVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, DataVersion.class);
+ putDataEraseVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, boolean.class, DataVersion.class);
+ putKeyValVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Object.class, Object.class, boolean.class, DataVersion.class);
+ removeNodeVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, boolean.class, DataVersion.class);
+ removeKeyVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, Object.class, boolean.class, DataVersion.class);
+ removeDataVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_removeData", GlobalTransaction.class, Fqn.class, boolean.class, DataVersion.class);
+
}
catch (NoSuchMethodException ex)
{
@@ -273,6 +310,13 @@
methods.put(moveMethodLocal_id, moveMethodLocal);
+ methods.put(putDataVersionedMethodLocal_id, putDataVersionedMethodLocal);
+ methods.put(putDataEraseVersionedMethodLocal_id, putDataEraseVersionedMethodLocal);
+ methods.put(putKeyValVersionedMethodLocal_id, putKeyValVersionedMethodLocal);
+ methods.put(removeDataVersionedMethodLocal_id, removeDataVersionedMethodLocal);
+ methods.put(removeKeyVersionedMethodLocal_id, removeKeyVersionedMethodLocal);
+ methods.put(removeNodeVersionedMethodLocal_id, removeNodeVersionedMethodLocal);
+
for (Integer id : methods.keySet())
{
methodIds.put(methods.get(id), id);
@@ -282,6 +326,9 @@
putMethodIds.add(putDataMethodLocal_id);
putMethodIds.add(putDataEraseMethodLocal_id);
putMethodIds.add(putKeyValMethodLocal_id);
+ putMethodIds.add(putDataEraseVersionedMethodLocal_id);
+ putMethodIds.add(putDataVersionedMethodLocal_id);
+ putMethodIds.add(putKeyValVersionedMethodLocal_id);
crudMethodIds.addAll(putMethodIds);
crudMethodIds.add(removeNodeMethodLocal_id);
@@ -289,6 +336,13 @@
crudMethodIds.add(removeDataMethodLocal_id);
crudMethodIds.add(dataGravitationCleanupMethod_id);
crudMethodIds.add(moveMethodLocal_id);
+ crudMethodIds.add(putDataVersionedMethodLocal_id);
+ crudMethodIds.add(putDataEraseVersionedMethodLocal_id);
+ crudMethodIds.add(putKeyValVersionedMethodLocal_id);
+ crudMethodIds.add(removeNodeVersionedMethodLocal_id);
+ crudMethodIds.add(removeKeyVersionedMethodLocal_id);
+ crudMethodIds.add(removeDataVersionedMethodLocal_id);
+
transactionLifecycleMethodIds.add(commitMethod_id);
transactionLifecycleMethodIds.add(rollbackMethod_id);
@@ -298,6 +352,7 @@
buddyGroupOrganisationMethodIds.add(remoteAnnounceBuddyPoolNameMethod_id);
buddyGroupOrganisationMethodIds.add(remoteAssignToBuddyGroupMethod_id);
buddyGroupOrganisationMethodIds.add(remoteRemoveFromBuddyGroupMethod_id);
+
}
protected static int lookupMethodId(Method method)
@@ -356,4 +411,61 @@
{
return putMethodIds.contains(id);
}
+
+ /**
+ * Returns the versioned equivalent of a crud method.
+ */
+ public static Method getVersionedMethod(int methodId)
+ {
+ if (isCrudMethod(methodId))
+ {
+ switch (methodId)
+ {
+ case putDataEraseMethodLocal_id:
+ return putDataEraseVersionedMethodLocal;
+ case putDataMethodLocal_id:
+ return putDataVersionedMethodLocal;
+ case putKeyValMethodLocal_id:
+ return putKeyValVersionedMethodLocal;
+ case removeDataMethodLocal_id:
+ return removeDataVersionedMethodLocal;
+ case removeKeyMethodLocal_id:
+ return removeKeyVersionedMethodLocal;
+ case removeNodeMethodLocal_id:
+ return removeNodeVersionedMethodLocal;
+ default:
+ throw new RuntimeException("Unrecognised method id " + methodId);
+ }
+ }
+ else throw new RuntimeException("Attempting to look up a versioned equivalent of a non-crud method");
+ }
+
+ /**
+ * Counterpart to {@link #getVersionedMethod(int)}
+ */
+ public static Method getUnversionedMethod(int methodId)
+ {
+ if (isCrudMethod(methodId))
+ {
+ switch (methodId)
+ {
+ case putDataEraseVersionedMethodLocal_id:
+ return putDataEraseMethodLocal;
+ case putDataVersionedMethodLocal_id:
+ return putDataMethodLocal;
+ case putKeyValVersionedMethodLocal_id:
+ return putKeyValMethodLocal;
+ case removeDataVersionedMethodLocal_id:
+ return removeDataMethodLocal;
+ case removeKeyVersionedMethodLocal_id:
+ return removeKeyMethodLocal;
+ case removeNodeVersionedMethodLocal_id:
+ return removeNodeMethodLocal;
+ default:
+ throw new RuntimeException("Unrecognised method id " + methodId);
+ }
+ }
+ else throw new RuntimeException("Attempting to look up a versioned equivalent of a non-crud method");
+ }
}
+
More information about the jboss-cvs-commits
mailing list