Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 542   Methods: 12
NCLOC: 365   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
MethodDeclarations.java 33.3% 88.9% 100% 86.3%
coverage coverage
 1    /*
 2    * JBoss, the OpenSource J2EE webOS
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.marshall;
 8   
 9    import org.apache.commons.logging.Log;
 10    import org.apache.commons.logging.LogFactory;
 11    import org.jboss.cache.CacheException;
 12    import org.jboss.cache.CacheImpl;
 13    import org.jboss.cache.Fqn;
 14    import org.jboss.cache.Node;
 15    import org.jboss.cache.buddyreplication.BuddyGroup;
 16    import org.jboss.cache.lock.NodeLock;
 17    import org.jboss.cache.optimistic.DataVersion;
 18    import org.jboss.cache.transaction.GlobalTransaction;
 19    import org.jgroups.Address;
 20   
 21    import java.lang.reflect.Method;
 22    import java.util.HashMap;
 23    import java.util.HashSet;
 24    import java.util.List;
 25    import java.util.Map;
 26    import java.util.Set;
 27   
 28    /**
 29    * Class containing Method and Method id definitions as well methods
 30    * allowing lookup operations both ways.
 31    *
 32    * @author <a href="galder.zamarreno@jboss.com">Galder Zamarreno</a>
 33    * @version $Revision: 1.40 $
 34    */
 35    public class MethodDeclarations
 36    {
 37    private static Log log = LogFactory.getLog(MethodDeclarations.class);
 38   
 39    static final Set<Integer> crudMethodIds = new HashSet<Integer>();
 40    static final Set<Integer> transactionLifecycleMethodIds = new HashSet<Integer>();
 41    static final Set<Integer> buddyGroupOrganisationMethodIds = new HashSet<Integer>();
 42    static final Set<Integer> blockUnblockMethodIds = new HashSet<Integer>();
 43    static final Set<Integer> putMethodIds = new HashSet<Integer>();
 44    static final Set<Integer> methodsThatNeedToReturnValuesToRemoteCallers = new HashSet<Integer>();
 45   
 46    // maintain a list of method IDs that correspond to Methods in CacheImpl
 47    static final Map<Integer, Method> methods = new HashMap<Integer, Method>();
 48   
 49    // and for reverse lookup
 50    static final Map<Method, Integer> methodIds = new HashMap<Method, Integer>();
 51   
 52    public static final Method putDataMethodLocal;
 53   
 54    public static final Method putDataEraseMethodLocal;
 55   
 56    public static final Method putKeyValMethodLocal;
 57   
 58    public static final Method removeNodeMethodLocal;
 59   
 60    public static final Method removeKeyMethodLocal;
 61   
 62    public static final Method removeDataMethodLocal;
 63   
 64    public static final Method evictNodeMethodLocal;
 65   
 66    public static final Method evictVersionedNodeMethodLocal;
 67   
 68    public static final Method prepareMethod;
 69   
 70    public static final Method commitMethod;
 71   
 72    public static final Method rollbackMethod;
 73   
 74    public static final Method replicateMethod;
 75   
 76    public static final Method replicateAllMethod;
 77   
 78    public static final Method addChildMethodLocal;
 79   
 80    public static final Method getKeyValueMethodLocal;
 81   
 82    public static final Method getNodeMethodLocal;
 83   
 84    public static final Method getKeysMethodLocal;
 85   
 86    public static final Method getChildrenNamesMethodLocal;
 87   
 88    public static final Method getDataMapMethodLocal;
 89   
 90    public static final Method existsMethod;
 91   
 92    public static final Method releaseAllLocksMethodLocal;
 93   
 94    public static final Method printMethodLocal;
 95   
 96    public static final Method lockMethodLocal;
 97   
 98    public static final Method optimisticPrepareMethod;
 99   
 100    public static final Method clusteredGetMethod;
 101   
 102    public static final Method remoteAssignToBuddyGroupMethod;
 103   
 104    public static final Method remoteRemoveFromBuddyGroupMethod;
 105   
 106    public static final Method remoteAnnounceBuddyPoolNameMethod;
 107   
 108    public static final Method dataGravitationCleanupMethod;
 109   
 110    public static final Method dataGravitationMethod;
 111   
 112    public static final Method moveMethodLocal;
 113   
 114    public static final Method blockChannelLocal;
 115   
 116    public static final Method unblockChannelLocal;
 117   
 118    public static final Method putForExternalReadMethodLocal;
 119   
 120    // these are basic crud methods that are version-aware - JBCACHE-843.
 121   
 122    public static final Method putDataVersionedMethodLocal;
 123   
 124    public static final Method putDataEraseVersionedMethodLocal;
 125   
 126    public static final Method putKeyValVersionedMethodLocal;
 127   
 128    public static final Method putForExternalReadVersionedMethodLocal;
 129   
 130    public static final Method removeNodeVersionedMethodLocal;
 131   
 132    public static final Method removeKeyVersionedMethodLocal;
 133   
 134    public static final Method removeDataVersionedMethodLocal;
 135   
 136    //not all of these are used for RPC - trim accordingly.
 137    public static final int putDataMethodLocal_id = 1;
 138   
 139    public static final int putDataEraseMethodLocal_id = 2;
 140   
 141    public static final int putKeyValMethodLocal_id = 3;
 142   
 143    // public static final int putFailFastKeyValueMethodLocal_id = 4; // this method is no longer needed.
 144   
 145    public static final int removeNodeMethodLocal_id = 5;
 146   
 147    public static final int removeKeyMethodLocal_id = 6;
 148   
 149    public static final int removeDataMethodLocal_id = 7;
 150   
 151    public static final int evictNodeMethodLocal_id = 8;
 152   
 153    public static final int evictVersionedNodeMethodLocal_id = 9;
 154   
 155    public static final int prepareMethod_id = 10;
 156   
 157    public static final int commitMethod_id = 11;
 158   
 159    public static final int rollbackMethod_id = 12;
 160   
 161    public static final int replicateMethod_id = 13;
 162   
 163    public static final int replicateAllMethod_id = 14;
 164   
 165    public static final int addChildMethodLocal_id = 15;
 166   
 167    public static final int existsMethod_id = 16;
 168   
 169    public static final int releaseAllLocksMethodLocal_id = 17;
 170   
 171    public static final int optimisticPrepareMethod_id = 18;
 172   
 173    public static final int getPartialStateMethod_id = 19;
 174   
 175    public static final int clusteredGetMethod_id = 22;
 176   
 177    public static final int getChildrenNamesMethodLocal_id = 23;
 178   
 179    public static final int getDataMapMethodLocal_id = 24;
 180   
 181    public static final int getKeysMethodLocal_id = 25;
 182   
 183    public static final int getKeyValueMethodLocal_id = 26;
 184   
 185    public static final int remoteAnnounceBuddyPoolNameMethod_id = 28;
 186   
 187    public static final int remoteAssignToBuddyGroupMethod_id = 29;
 188   
 189    public static final int remoteRemoveFromBuddyGroupMethod_id = 30;
 190   
 191    /* Method id added as they did not exist before refactoring */
 192    public static final int getNodeMethodLocal_id = 31;
 193   
 194    public static final int printMethodLocal_id = 32;
 195   
 196    public static final int lockMethodLocal_id = 33;
 197   
 198    public static final int dataGravitationCleanupMethod_id = 34;
 199   
 200    public static final int dataGravitationMethod_id = 35;
 201   
 202    public static final int moveMethodLocal_id = 36;
 203   
 204    // these are basic crud methods that are version-aware - JBCACHE-843.
 205   
 206    public static final int putDataVersionedMethodLocal_id = 37;
 207   
 208    public static final int putDataEraseVersionedMethodLocal_id = 38;
 209   
 210    public static final int putKeyValVersionedMethodLocal_id = 39;
 211   
 212    public static final int removeNodeVersionedMethodLocal_id = 40;
 213   
 214    public static final int removeKeyVersionedMethodLocal_id = 41;
 215   
 216    public static final int removeDataVersionedMethodLocal_id = 42;
 217   
 218    public static final int blockChannelMethodLocal_id = 43;
 219   
 220    public static final int unblockChannelMethodLocal_id = 44;
 221   
 222    public static final int putForExternalReadMethodLocal_id = 45;
 223   
 224    public static final int putForExternalReadVersionedMethodLocal_id = 46;
 225   
 226   
 227    static
 228    {
 229  269 try
 230    {
 231    // these methods need to return values even to remote callers.
 232  269 methodsThatNeedToReturnValuesToRemoteCallers.add(dataGravitationMethod_id);
 233  269 methodsThatNeedToReturnValuesToRemoteCallers.add(clusteredGetMethod_id);
 234   
 235   
 236  269 getDataMapMethodLocal = CacheImpl.class.getDeclaredMethod("_getData", Fqn.class);
 237  269 existsMethod = CacheImpl.class.getDeclaredMethod("exists", Fqn.class);
 238  269 putDataMethodLocal = CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class);
 239  269 putDataEraseMethodLocal = CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, boolean.class);
 240  269 putKeyValMethodLocal = CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Object.class, Object.class, boolean.class);
 241  269 putForExternalReadMethodLocal = CacheImpl.class.getDeclaredMethod("_putForExternalRead", GlobalTransaction.class, Fqn.class, Object.class, Object.class);
 242  269 removeNodeMethodLocal = CacheImpl.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, boolean.class);
 243  269 removeKeyMethodLocal = CacheImpl.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, Object.class, boolean.class);
 244  269 removeDataMethodLocal = CacheImpl.class.getDeclaredMethod("_removeData", GlobalTransaction.class, Fqn.class, boolean.class);
 245  269 evictNodeMethodLocal = CacheImpl.class.getDeclaredMethod("_evict", Fqn.class);
 246  269 evictVersionedNodeMethodLocal = CacheImpl.class.getDeclaredMethod("_evict", Fqn.class, DataVersion.class);
 247   
 248    // evictKeyValueMethodLocal=CacheImpl.class.getDeclaredMethod("_evict", new Class[]{Fqn.class, Object.class});
 249  269 prepareMethod = CacheImpl.class.getDeclaredMethod("prepare", GlobalTransaction.class, List.class, Address.class, boolean.class);
 250  269 commitMethod = CacheImpl.class.getDeclaredMethod("commit", GlobalTransaction.class);
 251  269 rollbackMethod = CacheImpl.class.getDeclaredMethod("rollback", GlobalTransaction.class);
 252  269 addChildMethodLocal = CacheImpl.class.getDeclaredMethod("_addChild", GlobalTransaction.class, Fqn.class, Object.class, Node.class, boolean.class);
 253  269 getKeyValueMethodLocal = CacheImpl.class.getDeclaredMethod("_get", Fqn.class, Object.class, boolean.class);
 254  269 getNodeMethodLocal = CacheImpl.class.getDeclaredMethod("_get", Fqn.class);
 255  269 getKeysMethodLocal = CacheImpl.class.getDeclaredMethod("_getKeys", Fqn.class);
 256  269 getChildrenNamesMethodLocal = CacheImpl.class.getDeclaredMethod("_getChildrenNames", Fqn.class);
 257  269 replicateMethod = CacheImpl.class.getDeclaredMethod("_replicate", MethodCall.class);
 258  269 replicateAllMethod = CacheImpl.class.getDeclaredMethod("_replicate", List.class);
 259  269 releaseAllLocksMethodLocal = CacheImpl.class.getDeclaredMethod("_releaseAllLocks", Fqn.class);
 260  269 printMethodLocal = CacheImpl.class.getDeclaredMethod("_print", Fqn.class);
 261  269 lockMethodLocal = CacheImpl.class.getDeclaredMethod("_lock", Fqn.class, NodeLock.LockType.class, boolean.class);
 262   
 263  269 optimisticPrepareMethod = CacheImpl.class.getDeclaredMethod("optimisticPrepare", GlobalTransaction.class, List.class, Map.class, Address.class, boolean.class);
 264   
 265  269 clusteredGetMethod = CacheImpl.class.getDeclaredMethod("_clusteredGet", MethodCall.class, Boolean.class);
 266   
 267    // ------------ buddy replication
 268   
 269  269 remoteAnnounceBuddyPoolNameMethod = CacheImpl.class.getDeclaredMethod("_remoteAnnounceBuddyPoolName", Address.class, String.class);
 270  269 remoteRemoveFromBuddyGroupMethod = CacheImpl.class.getDeclaredMethod("_remoteRemoveFromBuddyGroup", String.class);
 271  269 remoteAssignToBuddyGroupMethod = CacheImpl.class.getDeclaredMethod("_remoteAssignToBuddyGroup", BuddyGroup.class, Map.class);
 272   
 273  269 dataGravitationCleanupMethod = CacheImpl.class.getDeclaredMethod("_dataGravitationCleanup", GlobalTransaction.class, Fqn.class, Fqn.class);
 274  269 dataGravitationMethod = CacheImpl.class.getDeclaredMethod("gravitateData", Fqn.class, boolean.class);
 275   
 276    // ------------ move() api
 277  269 moveMethodLocal = CacheImpl.class.getDeclaredMethod("_move", Fqn.class, Fqn.class);
 278   
 279    // ------------ Channel BLOCK event
 280  269 blockChannelLocal = CacheImpl.class.getDeclaredMethod("_block");
 281  269 unblockChannelLocal = CacheImpl.class.getDeclaredMethod("_unblock");
 282   
 283    // ------------ version-aware methods - see JBCACHE-843
 284  269 putDataVersionedMethodLocal = CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, DataVersion.class);
 285  269 putDataEraseVersionedMethodLocal = CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, boolean.class, DataVersion.class);
 286  269 putKeyValVersionedMethodLocal = CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Object.class, Object.class, boolean.class, DataVersion.class);
 287  269 putForExternalReadVersionedMethodLocal = CacheImpl.class.getDeclaredMethod("_putForExternalRead", GlobalTransaction.class, Fqn.class, Object.class, Object.class, DataVersion.class);
 288  269 removeNodeVersionedMethodLocal = CacheImpl.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, boolean.class, DataVersion.class);
 289  269 removeKeyVersionedMethodLocal = CacheImpl.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, Object.class, boolean.class, DataVersion.class);
 290  269 removeDataVersionedMethodLocal = CacheImpl.class.getDeclaredMethod("_removeData", GlobalTransaction.class, Fqn.class, boolean.class, DataVersion.class);
 291   
 292    }
 293    catch (NoSuchMethodException e)
 294    {
 295  0 throw new ExceptionInInitializerError(e);
 296    }
 297   
 298  269 methods.put(putDataMethodLocal_id, putDataMethodLocal);
 299  269 methods.put(putDataEraseMethodLocal_id, putDataEraseMethodLocal);
 300  269 methods.put(putKeyValMethodLocal_id, putKeyValMethodLocal);
 301  269 methods.put(removeNodeMethodLocal_id, removeNodeMethodLocal);
 302  269 methods.put(removeKeyMethodLocal_id, removeKeyMethodLocal);
 303  269 methods.put(removeDataMethodLocal_id, removeDataMethodLocal);
 304  269 methods.put(evictNodeMethodLocal_id, evictNodeMethodLocal);
 305  269 methods.put(evictVersionedNodeMethodLocal_id, evictVersionedNodeMethodLocal);
 306  269 methods.put(prepareMethod_id, prepareMethod);
 307  269 methods.put(commitMethod_id, commitMethod);
 308  269 methods.put(rollbackMethod_id, rollbackMethod);
 309  269 methods.put(replicateMethod_id, replicateMethod);
 310  269 methods.put(replicateAllMethod_id, replicateAllMethod);
 311  269 methods.put(addChildMethodLocal_id, addChildMethodLocal);
 312  269 methods.put(existsMethod_id, existsMethod);
 313  269 methods.put(releaseAllLocksMethodLocal_id, releaseAllLocksMethodLocal);
 314  269 methods.put(optimisticPrepareMethod_id, optimisticPrepareMethod);
 315  269 methods.put(clusteredGetMethod_id, clusteredGetMethod);
 316  269 methods.put(getChildrenNamesMethodLocal_id, getChildrenNamesMethodLocal);
 317  269 methods.put(getDataMapMethodLocal_id, getDataMapMethodLocal);
 318  269 methods.put(getKeysMethodLocal_id, getKeysMethodLocal);
 319  269 methods.put(getKeyValueMethodLocal_id, getKeyValueMethodLocal);
 320  269 methods.put(remoteAnnounceBuddyPoolNameMethod_id, remoteAnnounceBuddyPoolNameMethod);
 321  269 methods.put(remoteAssignToBuddyGroupMethod_id, remoteAssignToBuddyGroupMethod);
 322  269 methods.put(remoteRemoveFromBuddyGroupMethod_id, remoteRemoveFromBuddyGroupMethod);
 323    /* Mappings added as they did not exist before refactoring */
 324  269 methods.put(getNodeMethodLocal_id, getNodeMethodLocal);
 325  269 methods.put(printMethodLocal_id, printMethodLocal);
 326  269 methods.put(lockMethodLocal_id, lockMethodLocal);
 327   
 328  269 methods.put(dataGravitationCleanupMethod_id, dataGravitationCleanupMethod);
 329  269 methods.put(dataGravitationMethod_id, dataGravitationMethod);
 330   
 331  269 methods.put(moveMethodLocal_id, moveMethodLocal);
 332  269 methods.put(blockChannelMethodLocal_id, blockChannelLocal);
 333  269 methods.put(unblockChannelMethodLocal_id, unblockChannelLocal);
 334   
 335  269 methods.put(putDataVersionedMethodLocal_id, putDataVersionedMethodLocal);
 336  269 methods.put(putDataEraseVersionedMethodLocal_id, putDataEraseVersionedMethodLocal);
 337  269 methods.put(putKeyValVersionedMethodLocal_id, putKeyValVersionedMethodLocal);
 338  269 methods.put(removeDataVersionedMethodLocal_id, removeDataVersionedMethodLocal);
 339  269 methods.put(removeKeyVersionedMethodLocal_id, removeKeyVersionedMethodLocal);
 340  269 methods.put(removeNodeVersionedMethodLocal_id, removeNodeVersionedMethodLocal);
 341   
 342  269 methods.put(putForExternalReadVersionedMethodLocal_id, putForExternalReadVersionedMethodLocal);
 343  269 methods.put(putForExternalReadMethodLocal_id, putForExternalReadMethodLocal);
 344   
 345  269 for (Integer id : methods.keySet())
 346    {
 347  11029 methodIds.put(methods.get(id), id);
 348    }
 349   
 350  269 putMethodIds.add(putDataMethodLocal_id);
 351  269 putMethodIds.add(putDataEraseMethodLocal_id);
 352  269 putMethodIds.add(putKeyValMethodLocal_id);
 353  269 putMethodIds.add(putDataEraseVersionedMethodLocal_id);
 354  269 putMethodIds.add(putDataVersionedMethodLocal_id);
 355  269 putMethodIds.add(putKeyValVersionedMethodLocal_id);
 356  269 putMethodIds.add(putForExternalReadMethodLocal_id);
 357  269 putMethodIds.add(putForExternalReadVersionedMethodLocal_id);
 358   
 359  269 crudMethodIds.addAll(putMethodIds);
 360  269 crudMethodIds.add(removeNodeMethodLocal_id);
 361  269 crudMethodIds.add(removeKeyMethodLocal_id);
 362  269 crudMethodIds.add(removeDataMethodLocal_id);
 363  269 crudMethodIds.add(dataGravitationCleanupMethod_id);
 364  269 crudMethodIds.add(moveMethodLocal_id);
 365  269 crudMethodIds.add(putDataVersionedMethodLocal_id);
 366  269 crudMethodIds.add(putDataEraseVersionedMethodLocal_id);
 367  269 crudMethodIds.add(putKeyValVersionedMethodLocal_id);
 368  269 crudMethodIds.add(removeNodeVersionedMethodLocal_id);
 369  269 crudMethodIds.add(removeKeyVersionedMethodLocal_id);
 370  269 crudMethodIds.add(removeDataVersionedMethodLocal_id);
 371   
 372   
 373  269 transactionLifecycleMethodIds.add(commitMethod_id);
 374  269 transactionLifecycleMethodIds.add(rollbackMethod_id);
 375  269 transactionLifecycleMethodIds.add(prepareMethod_id);
 376  269 transactionLifecycleMethodIds.add(optimisticPrepareMethod_id);
 377   
 378  269 buddyGroupOrganisationMethodIds.add(remoteAnnounceBuddyPoolNameMethod_id);
 379  269 buddyGroupOrganisationMethodIds.add(remoteAssignToBuddyGroupMethod_id);
 380  269 buddyGroupOrganisationMethodIds.add(remoteRemoveFromBuddyGroupMethod_id);
 381   
 382  269 blockUnblockMethodIds.add(blockChannelMethodLocal_id);
 383  269 blockUnblockMethodIds.add(unblockChannelMethodLocal_id);
 384   
 385    }
 386   
 387  4502204 protected static int lookupMethodId(Method method)
 388    {
 389  4502201 Integer methodIdInteger = methodIds.get(method);
 390  4502204 int methodId = -1;
 391   
 392  4502163 if (methodIdInteger != null)
 393    {
 394  4502205 methodId = methodIdInteger;
 395    }
 396    else
 397    {
 398  0 if (log.isWarnEnabled())
 399    {
 400  0 log.warn("Method " + method + " is not registered with " + CacheMarshaller200.class);
 401    }
 402    }
 403   
 404  4502205 return methodId;
 405    }
 406   
 407  331817 protected static Method lookupMethod(int id)
 408    {
 409  331817 Method method = methods.get(id);
 410  331817 if (method == null)
 411    {
 412  0 if (log.isErrorEnabled())
 413    {
 414  0 log.error("Method id " + id + " is not registered");
 415    }
 416  0 throw new CacheException("Method id " + id + " is not registered with " + CacheMarshaller200.class);
 417    }
 418  331817 return method;
 419    }
 420   
 421    /**
 422    * Returns true if the method is a CRUD method.
 423    */
 424  1743141 public static boolean isCrudMethod(int id)
 425    {
 426  1743141 return crudMethodIds.contains(Integer.valueOf(id));
 427    }
 428   
 429  6536840 public static boolean isTransactionLifecycleMethod(int id)
 430    {
 431  6536840 return transactionLifecycleMethodIds.contains(id);
 432    }
 433   
 434  2800027 public static boolean isBuddyGroupOrganisationMethod(int id)
 435    {
 436  2800027 return buddyGroupOrganisationMethodIds.contains(id);
 437    }
 438   
 439  1055052 public static boolean isPutMethod(int id)
 440    {
 441  1055052 return putMethodIds.contains(id);
 442    }
 443   
 444  251 public static boolean isGetMethod(int methodId)
 445    {
 446  251 return methodId == getChildrenNamesMethodLocal_id || methodId == getDataMapMethodLocal_id || methodId == existsMethod_id
 447    || methodId == getKeysMethodLocal_id || methodId == getKeyValueMethodLocal_id || methodId == getNodeMethodLocal_id;
 448    }
 449   
 450  3335 public static boolean isBlockUnblockMethod(int id)
 451    {
 452  3335 return blockUnblockMethodIds.contains(id);
 453    }
 454   
 455    /**
 456    * Returns the versioned equivalent of a crud method.
 457    */
 458  200 public static Method getVersionedMethod(int methodId)
 459    {
 460  200 if (isCrudMethod(methodId))
 461    {
 462  200 switch (methodId)
 463    {
 464  10 case putForExternalReadMethodLocal_id:
 465  10 return putForExternalReadVersionedMethodLocal;
 466  0 case putDataEraseMethodLocal_id:
 467  0 return putDataEraseVersionedMethodLocal;
 468  15 case putDataMethodLocal_id:
 469  15 return putDataVersionedMethodLocal;
 470  144 case putKeyValMethodLocal_id:
 471  144 return putKeyValVersionedMethodLocal;
 472  0 case removeDataMethodLocal_id:
 473  0 return removeDataVersionedMethodLocal;
 474  4 case removeKeyMethodLocal_id:
 475  4 return removeKeyVersionedMethodLocal;
 476  19 case removeNodeMethodLocal_id:
 477  19 return removeNodeVersionedMethodLocal;
 478  8 case moveMethodLocal_id:
 479  8 return moveMethodLocal;
 480  0 default:
 481  0 throw new CacheException("Unrecognised method id " + methodId);
 482    }
 483    }
 484    else
 485    {
 486  0 throw new CacheException("Attempting to look up a versioned equivalent of a non-crud method");
 487    }
 488    }
 489   
 490    /**
 491    * Counterpart to {@link #getVersionedMethod(int)}
 492    */
 493  197 public static Method getUnversionedMethod(int methodId)
 494    {
 495  197 if (isCrudMethod(methodId))
 496    {
 497  197 switch (methodId)
 498    {
 499  6 case putForExternalReadVersionedMethodLocal_id:
 500  6 return putForExternalReadMethodLocal;
 501  0 case putDataEraseVersionedMethodLocal_id:
 502  0 return putDataEraseMethodLocal;
 503  15 case putDataVersionedMethodLocal_id:
 504  15 return putDataMethodLocal;
 505  143 case putKeyValVersionedMethodLocal_id:
 506  143 return putKeyValMethodLocal;
 507  0 case removeDataVersionedMethodLocal_id:
 508  0 return removeDataMethodLocal;
 509  4 case removeKeyVersionedMethodLocal_id:
 510  4 return removeKeyMethodLocal;
 511  21 case removeNodeVersionedMethodLocal_id:
 512  21 return removeNodeMethodLocal;
 513  8 case moveMethodLocal_id:
 514  8 return moveMethodLocal;
 515  0 default:
 516  0 throw new CacheException("Unrecognised method id " + methodId);
 517    }
 518    }
 519    else
 520    {
 521  0 throw new CacheException("Attempting to look up a versioned equivalent of a non-crud method");
 522    }
 523    }
 524   
 525   
 526  399 public static boolean isDataGravitationMethod(int methodId)
 527    {
 528  399 return methodId == MethodDeclarations.dataGravitationCleanupMethod_id || methodId == MethodDeclarations.dataGravitationMethod_id;
 529    }
 530   
 531    /**
 532    * Tests whether remote calls to this method should return the value to the caller or just return a null (more efficient if the caller won't use this value anyway)
 533    *
 534    * @param methodId
 535    * @return true if the caller expects the value to come back.
 536    */
 537  43715 public static boolean returnValueForRemoteCall(int methodId)
 538    {
 539  43715 return methodsThatNeedToReturnValuesToRemoteCallers.contains(methodId);
 540    }
 541    }
 542