You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2016/06/08 15:12:34 UTC

[1/2] incubator-geode git commit: Revert "GEODE-1463: Legacy OperationContexts do not set the appropriate Shiro"

Repository: incubator-geode
Updated Branches:
  refs/heads/develop ec466fc38 -> 4af707237


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java
index 5b07bdf..46c0e1d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.*;
 import com.gemstone.gemfire.cache.operations.OperationContext;
 import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
 import com.gemstone.gemfire.cache.operations.OperationContext.Resource;
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 import org.apache.shiro.authz.permission.WildcardPermission;
@@ -50,12 +49,12 @@ public class ResourceOperationContextJUnitTest {
 
   @Test
   public void testConstructor(){
-    context = new ResourceOperationContext();
+    context = new ResourceOperationContext(null, null, null);
     assertEquals(Resource.NULL, context.getResource());
     assertEquals(OperationCode.NULL, context.getOperationCode());
     assertEquals(OperationContext.ALL_REGIONS, context.getRegionName());
 
-    context = new ResourceOperationContext();
+    context = new ResourceOperationContext(null, null);
     assertEquals(Resource.NULL, context.getResource());
     assertEquals(OperationCode.NULL, context.getOperationCode());
     assertEquals(OperationContext.ALL_REGIONS, context.getRegionName());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
index 0f13246..2ddc6ee 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
@@ -22,7 +22,6 @@ import java.util.List;
 
 import com.gemstone.gemfire.cache.operations.OperationContext;
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 import org.apache.shiro.authz.Permission;
 
 public class TestCommand {
@@ -42,23 +41,23 @@ public class TestCommand {
 
   private static List<TestCommand> testCommands = new ArrayList<>();
 
-  static {
+  static{
     init();
   }
-
+  
   private final String command;
   private final OperationContext permission;
-
+  
   public TestCommand(String command, OperationContext permission) {
     this.command = command;
     this.permission = permission;
   }
-
+  
   private static void createTestCommand(String command, OperationContext permission) {
     TestCommand instance = new TestCommand(command, permission);
     testCommands.add(instance);
   }
-
+  
   public String getCommand() {
     return this.command;
   }
@@ -67,13 +66,13 @@ public class TestCommand {
     return this.permission;
   }
 
-  public static List<TestCommand> getCommands() {
+  public static List<TestCommand> getCommands(){
     return testCommands;
   }
 
-  public static List<TestCommand> getPermittedCommands(Permission permission) {
+  public static List<TestCommand> getPermittedCommands(Permission permission){
     List<TestCommand> result = new ArrayList<>();
-    for (TestCommand testCommand : testCommands) {
+    for(TestCommand testCommand:testCommands){
       OperationContext cPerm = testCommand.getPermission();
       if(cPerm!=null && permission.implies(cPerm)){
         result.add(testCommand);
@@ -226,5 +225,5 @@ public class TestCommand {
     createTestCommand("disconnect", null);
     //Misc commands
     //createTestCommand("shutdown", clusterManage);
-  }
+  };
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
index 8ea91f5..2147219 100755
--- a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
@@ -130,7 +130,6 @@ com/gemstone/gemfire/cache/execute/FunctionException,true,4893171227542647452
 com/gemstone/gemfire/cache/execute/FunctionInvocationTargetException,true,1,id:com/gemstone/gemfire/distributed/DistributedMember
 com/gemstone/gemfire/cache/operations/OperationContext$OperationCode,false
 com/gemstone/gemfire/cache/operations/OperationContext$Resource,false
-com/gemstone/gemfire/cache/operations/internal/ResourceOperationContext,false,isPostOperation:boolean,opResult:java/lang/Object,operation:com/gemstone/gemfire/cache/operations/OperationContext$OperationCode,regionName:java/lang/String,resource:com/gemstone/gemfire/cache/operations/OperationContext$Resource
 com/gemstone/gemfire/cache/partition/PartitionNotAvailableException,true,1
 com/gemstone/gemfire/cache/persistence/ConflictingPersistentDataException,true,-2629287782021455875
 com/gemstone/gemfire/cache/persistence/PartitionOfflineException,true,-6471045959318795870,offlineMembers:java/util/Set
@@ -257,6 +256,7 @@ com/gemstone/gemfire/internal/admin/CompoundRegionSnapshot,true,6295026394298398
 com/gemstone/gemfire/internal/admin/StatAlert,true,5725457607122449170,definitionId:int,time:java/util/Date,values:java/lang/Number[]
 com/gemstone/gemfire/internal/admin/remote/DistributionLocatorId,true,6587390186971937865,bindAddress:java/lang/String,host:java/net/InetAddress,hostnameForClients:java/lang/String,peerLocator:boolean,port:int,serverLocator:boolean
 com/gemstone/gemfire/internal/admin/remote/EntryValueNodeImpl,false,fields:com/gemstone/gemfire/internal/admin/remote/EntryValueNodeImpl[],name:java/lang/String,primitive:boolean,primitiveVal:java/lang/Object,type:java/lang/String
+com/gemstone/gemfire/internal/cache/AbstractRegionMap$1,false,this$0:com/gemstone/gemfire/internal/cache/AbstractRegionMap
 com/gemstone/gemfire/internal/cache/BackupLock,false,backupDone:java/util/concurrent/locks/Condition,backupThread:java/lang/Thread,isBackingUp:boolean
 com/gemstone/gemfire/internal/cache/BucketAdvisor$SetFromMap,true,2454657854757543876,m:java/util/Map
 com/gemstone/gemfire/internal/cache/BucketNotFoundException,false
@@ -281,6 +281,7 @@ com/gemstone/gemfire/internal/cache/ForceableLinkedBlockingQueue,true,-690393397
 com/gemstone/gemfire/internal/cache/GemFireCacheImpl$3,true,1,this$0:com/gemstone/gemfire/internal/cache/GemFireCacheImpl
 com/gemstone/gemfire/internal/cache/GemFireCacheImpl$4,true,1,this$0:com/gemstone/gemfire/internal/cache/GemFireCacheImpl
 com/gemstone/gemfire/internal/cache/GemFireCacheImpl$5,true,1,this$0:com/gemstone/gemfire/internal/cache/GemFireCacheImpl
+com/gemstone/gemfire/internal/cache/GemFireCacheImpl$6,true,1,this$0:com/gemstone/gemfire/internal/cache/GemFireCacheImpl
 com/gemstone/gemfire/internal/cache/IdentityArrayList,true,449125332499184497,size:int,wrapped:boolean
 com/gemstone/gemfire/internal/cache/IncomingGatewayStatus,true,-4579815367602658353,_memberId:java/lang/String,_socketAddress:java/net/InetAddress,_socketPort:int
 com/gemstone/gemfire/internal/cache/InitialImageOperation$GIIStatus,false


[2/2] incubator-geode git commit: Revert "GEODE-1463: Legacy OperationContexts do not set the appropriate Shiro"

Posted by je...@apache.org.
Revert "GEODE-1463: Legacy OperationContexts do not set the appropriate Shiro"

This reverts commit 670fae4b3950fa1ce302461312dd1251d8ea2d8a.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/4af70723
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/4af70723
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/4af70723

Branch: refs/heads/develop
Commit: 4af707237ad1095f09a27a60a5813c4280d93f4d
Parents: ec466fc
Author: Jens Deppe <jd...@pivotal.io>
Authored: Tue Jun 7 13:17:06 2016 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Wed Jun 8 08:12:24 2016 -0700

----------------------------------------------------------------------
 .../operations/CloseCQOperationContext.java     |  24 ++-
 .../operations/DestroyOperationContext.java     |  15 +-
 .../operations/ExecuteCQOperationContext.java   |  24 +--
 .../ExecuteFunctionOperationContext.java        |  45 +++--
 .../GetDurableCQsOperationContext.java          |  28 ++-
 .../cache/operations/GetOperationContext.java   |  35 +++-
 .../operations/InterestOperationContext.java    |  26 ++-
 .../operations/InvalidateOperationContext.java  |  17 +-
 .../cache/operations/KeyOperationContext.java   |  46 ++++-
 .../operations/KeySetOperationContext.java      |  35 +++-
 .../operations/KeyValueOperationContext.java    |  14 +-
 .../cache/operations/OperationContext.java      |  33 ++--
 .../operations/PutAllOperationContext.java      |  34 +++-
 .../cache/operations/PutOperationContext.java   |  28 ++-
 .../cache/operations/QueryOperationContext.java |  86 +++++---
 .../operations/RegionClearOperationContext.java |  14 +-
 .../RegionCreateOperationContext.java           |  28 ++-
 .../RegionDestroyOperationContext.java          |  13 +-
 .../operations/RegionOperationContext.java      |  30 ++-
 .../RegisterInterestOperationContext.java       |  13 +-
 .../operations/RemoveAllOperationContext.java   |  34 +++-
 .../operations/StopCQOperationContext.java      |  24 ++-
 .../UnregisterInterestOperationContext.java     |  13 +-
 .../internal/GetOperationContextImpl.java       |  10 +-
 .../internal/ResourceOperationContext.java      | 128 ------------
 .../ServerToClientFunctionResultSender.java     |   2 +-
 .../operations/ContainsKeyOperationContext.java |  13 +-
 .../cache/tier/sockets/BaseCommandQuery.java    |   5 +-
 .../internal/security/GeodeSecurityUtil.java    |  36 ++--
 .../security/shiro/CustomAuthRealm.java         |  12 +-
 .../internal/security/MBeanServerWrapper.java   |   3 +-
 .../security/ResourceOperationContext.java      |  85 ++++++++
 .../templates/SampleJsonAuthorization.java      |   4 +-
 .../operations/OperationPartsJUnitTest.java     | 195 -------------------
 .../ResourceOperationContextJUnitTest.java      |   5 +-
 .../internal/security/TestCommand.java          |  19 +-
 .../codeAnalysis/sanctionedSerializables.txt    |   3 +-
 37 files changed, 668 insertions(+), 511 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/CloseCQOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/CloseCQOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/CloseCQOperationContext.java
index b984981..1924605 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/CloseCQOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/CloseCQOperationContext.java
@@ -37,8 +37,28 @@ public class CloseCQOperationContext extends ExecuteCQOperationContext {
    * @param regionNames
    *                names of regions that are part of the query string
    */
-  public CloseCQOperationContext(String cqName, String queryString, Set regionNames) {
-    super(OperationCode.CLOSE_CQ, cqName, queryString, regionNames, false);
+  public CloseCQOperationContext(String cqName, String queryString,
+      Set regionNames) {
+    super(cqName, queryString, regionNames, false);
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.CLOSE_CQ</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.CLOSE_CQ;
+  }
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return false;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/DestroyOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/DestroyOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/DestroyOperationContext.java
index b681c15..c00b1a7 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/DestroyOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/DestroyOperationContext.java
@@ -33,7 +33,7 @@ public class DestroyOperationContext extends KeyOperationContext {
    *                the key for this operation
    */
   public DestroyOperationContext(Object key) {
-    this(key, false);
+    super(key);
   }
 
   /**
@@ -45,7 +45,18 @@ public class DestroyOperationContext extends KeyOperationContext {
    *                true to set the post-operation flag
    */
   public DestroyOperationContext(Object key, boolean postOperation) {
-    super(OperationCode.DESTROY, key, postOperation);
+    super(key, postOperation);
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.DESTROY</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.DESTROY;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteCQOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteCQOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteCQOperationContext.java
index 068849c..a2b8ab2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteCQOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteCQOperationContext.java
@@ -44,25 +44,19 @@ public class ExecuteCQOperationContext extends QueryOperationContext {
    */
   public ExecuteCQOperationContext(String cqName, String queryString,
       Set regionNames, boolean postOperation) {
-    this(OperationCode.EXECUTE_CQ, cqName, queryString, regionNames, postOperation);
+    super(queryString, regionNames, postOperation);
+    this.cqName = cqName;
   }
 
   /**
-   * Constructor for the EXECUTE_CQ operation only intended for use by subclasses.
-   *
-   * @param cqName
-   *                the name of the continuous query being registered
-   * @param queryString
-   *                the query string for this operation
-   * @param regionNames
-   *                names of regions that are part of the query string
-   * @param postOperation
-   *                true to set the post-operation flag
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return the <code>OperationCode</code> of this operation
    */
-  protected ExecuteCQOperationContext(OperationCode code, String cqName, String queryString,
-      Set regionNames, boolean postOperation) {
-    super(code, queryString, regionNames, postOperation);
-    this.cqName = cqName;
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.EXECUTE_CQ;
   }
 
   /** Return the name of the continuous query. */

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteFunctionOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteFunctionOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteFunctionOperationContext.java
index bfbe4d1..dafc5c0 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteFunctionOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/ExecuteFunctionOperationContext.java
@@ -16,8 +16,7 @@
  */
 package com.gemstone.gemfire.cache.operations;
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
-
+import java.io.Serializable;
 import java.util.Set;
 
 /**
@@ -26,44 +25,53 @@ import java.util.Set;
  * @since GemFire 6.0
  *
  */
-public class ExecuteFunctionOperationContext extends ResourceOperationContext {
+public class ExecuteFunctionOperationContext extends OperationContext {
 
   private String functionId;
 
-  private boolean optimizeForWrite;
+  private String regionName;
+
+  private boolean optizeForWrite;
 
+  private boolean isPostOperation;
+  
   private Set keySet;
   
   private Object arguments;
 
   private Object result;
 
-  /**
-   * Constructor for the EXECUTE_FUNCTION operation.
-   *
-   * @param functionName     the name of the function being executed
-   * @param regionName       the name of the region on which the function is being executed
-   * @param keySet           the set of keys against which the function is filtered
-   * @param arguments        the array of function arguments
-   * @param optimizeForWrite boolean indicating whether this function is optimized for writing
-   * @param isPostOperation  boolean indicating whether this context is for post-operation evaluation
-   */
   public ExecuteFunctionOperationContext(String functionName,
       String regionName, Set keySet, Object arguments,
       boolean optimizeForWrite, boolean isPostOperation) {
-    super(Resource.DATA, OperationCode.EXECUTE_FUNCTION, regionName, isPostOperation);
     this.functionId = functionName;
+    this.regionName = regionName;
     this.keySet = keySet;
     this.arguments = arguments;
-    this.optimizeForWrite = optimizeForWrite;
+    this.optizeForWrite = optimizeForWrite;
+    this.isPostOperation = isPostOperation;
+  }
+
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.EXECUTE_FUNCTION;
+  }
+
+  @Override
+  public boolean isPostOperation() {
+    return this.isPostOperation;
   }
 
   public String getFunctionId() {
     return this.functionId;
   }
 
+  public String getRegionName() {
+    return this.regionName;
+  }
+
   public boolean isOptimizeForWrite() {
-    return this.optimizeForWrite;
+    return this.optizeForWrite;
   }
   
   public Object getResult() {
@@ -82,4 +90,7 @@ public class ExecuteFunctionOperationContext extends ResourceOperationContext {
     this.result = oneResult;
   }
   
+  public void setIsPostOperation(boolean isPostOperation) {
+    this.isPostOperation = isPostOperation;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetDurableCQsOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetDurableCQsOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetDurableCQsOperationContext.java
index 9082e42..abec6b6 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetDurableCQsOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetDurableCQsOperationContext.java
@@ -17,7 +17,8 @@
 
 package com.gemstone.gemfire.cache.operations;
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
+import java.util.Set;
+
 
 /**
  * Encapsulates a {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#GET_DURABLE_CQS} operation for the pre-operation
@@ -25,13 +26,34 @@ import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
  * 
  * @since GemFire 7.0
  */
-public class GetDurableCQsOperationContext extends ResourceOperationContext {
+public class GetDurableCQsOperationContext extends OperationContext {
 
   /**
    * Constructor for the GET_DURABLE_CQS operation.
+   * 
+  
    */
   public GetDurableCQsOperationContext() {
-    super(Resource.DATA, OperationCode.GET_DURABLE_CQS, false);
+    super();
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.GET_DURABLE_CQS</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.GET_DURABLE_CQS;
+  }
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return false;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetOperationContext.java
index ade353c..f276d2c 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/GetOperationContext.java
@@ -25,18 +25,37 @@ package com.gemstone.gemfire.cache.operations;
  * 
  * @since GemFire 5.5
  */
-public abstract class GetOperationContext extends KeyValueOperationContext {
+public class GetOperationContext extends KeyValueOperationContext {
 
   /**
    * Constructor for the operation.
-   *
-   * @param code          the {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode} for this
-   *                      context
-   * @param key           the key for this operation
-   * @param postOperation true if the context is for the post-operation case
+   * 
+   * @param key
+   *                the key for this operation
+   * @param postOperation
+   *                true if the context is for the post-operation case
+   */
+  public GetOperationContext(Object key, boolean postOperation) {
+    super(key, null, false, postOperation);
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.GET</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.GET;
+  }
+
+  /**
+   * Set the post-operation flag to true.
    */
-  protected GetOperationContext(OperationCode code, Object key, boolean postOperation) {
-    super(code, key, null, false, postOperation);
+  @Override
+  public void setPostOperation() {
+    super.setPostOperation();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InterestOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InterestOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InterestOperationContext.java
index 0643ec6..18aff9e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InterestOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InterestOperationContext.java
@@ -18,14 +18,12 @@
 package com.gemstone.gemfire.cache.operations;
 
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
-
 /**
  * Encapsulates registration/unregistration of interest in a region.
  * 
  * @since GemFire 5.5
  */
-public abstract class InterestOperationContext extends ResourceOperationContext {
+public abstract class InterestOperationContext extends OperationContext {
 
   /** The key or list of keys being registered/unregistered. */
   private Object key;
@@ -34,19 +32,27 @@ public abstract class InterestOperationContext extends ResourceOperationContext
   private InterestType interestType;
 
   /**
-   * Constructor for the register interest operation. This constructor is only for subclasses.
-   *
-   * @param code         the {@link OperationCode} for this context
-   * @param key          the key or list of keys being registered/unregistered
-   * @param interestType the <code>InterestType</code> of the register request
+   * Constructor for the register interest operation.
+   * 
+   * @param key
+   *                the key or list of keys being registered/unregistered
+   * @param interestType
+   *                the <code>InterestType</code> of the register request
    */
- protected InterestOperationContext(OperationCode code, Object key, InterestType interestType) {
-    super(Resource.DATA, code, false);
+  public InterestOperationContext(Object key, InterestType interestType) {
     this.key = key;
     this.interestType = interestType;
   }
 
   /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return false;
+  }
+
+  /**
    * Get the key for this register/unregister interest operation.
    * 
    * @return the key to be registered/unregistered.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InvalidateOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InvalidateOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InvalidateOperationContext.java
index 6830276..dd8ce38 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InvalidateOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/InvalidateOperationContext.java
@@ -27,13 +27,13 @@ package com.gemstone.gemfire.cache.operations;
 public class InvalidateOperationContext extends KeyOperationContext {
 
   /**
-   * Constructor for the INVALIDATE operation.
+   * Constructor for the operation.
    * 
    * @param key
    *                the key for this operation
    */
   public InvalidateOperationContext(Object key) {
-    super(OperationCode.INVALIDATE, key);
+    super(key);
   }
 
   /**
@@ -46,7 +46,18 @@ public class InvalidateOperationContext extends KeyOperationContext {
    *                sending updates                 
    */
   public InvalidateOperationContext(Object key, boolean isPostOperation) {
-    super(OperationCode.INVALIDATE, key, isPostOperation);
+    super(key, isPostOperation);
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.INVALIDATE</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.INVALIDATE;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyOperationContext.java
index c0e7145..985af0b 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyOperationContext.java
@@ -17,7 +17,6 @@
 
 package com.gemstone.gemfire.cache.operations;
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 
 /**
  * Encapsulates a region operation that requires only a key object for the
@@ -27,7 +26,7 @@ import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
  * 
  * @since GemFire 5.5
  */
-public abstract class KeyOperationContext extends ResourceOperationContext {
+public abstract class KeyOperationContext extends OperationContext {
 
   /** The key object of the operation */
   private Object key;
@@ -35,14 +34,19 @@ public abstract class KeyOperationContext extends ResourceOperationContext {
   /** Callback object for the operation (if any) */
   private Object callbackArg;
 
+  /** True if this is a post-operation context */
+  private boolean postOperation;
+
   /**
    * Constructor for the operation.
    * 
    * @param key
    *                the key for this operation
    */
-  public KeyOperationContext(OperationCode code, Object key) {
-    this(code, key, false);
+  public KeyOperationContext(Object key) {
+    this.key = key;
+    this.callbackArg = null;
+    this.postOperation = false;
   }
 
   /**
@@ -53,10 +57,40 @@ public abstract class KeyOperationContext extends ResourceOperationContext {
    * @param postOperation
    *                true to set the post-operation flag
    */
-  protected KeyOperationContext(OperationCode code, Object key, boolean postOperation) {
-    super(Resource.DATA, code, postOperation);
+  public KeyOperationContext(Object key, boolean postOperation) {
     this.key = key;
     this.callbackArg = null;
+    this.postOperation = postOperation;
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return The <code>OperationCode</code> of this operation. This is one of
+   *         {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#DESTROY} 
+   *         or {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#CONTAINS_KEY}
+   *         for <code>KeyOperationContext</code>, and one of
+   *         {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#GET} or 
+   *         {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#PUT} for
+   *         <code>KeyValueOperationContext</code>.
+   */
+  @Override
+  public abstract OperationCode getOperationCode();
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return this.postOperation;
+  }
+
+  /**
+   * Set the post-operation flag to true.
+   */
+  protected void setPostOperation() {
+    this.postOperation = true;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeySetOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeySetOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeySetOperationContext.java
index 1664b2a..0b8bccc 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeySetOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeySetOperationContext.java
@@ -20,7 +20,7 @@ package com.gemstone.gemfire.cache.operations;
 import java.util.Set;
 
 import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
+import com.gemstone.gemfire.cache.operations.OperationContext;
 
 /**
  * Encapsulates a {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#KEY_SET} operation for both the
@@ -28,11 +28,14 @@ import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
  * 
  * @since GemFire 5.5
  */
-public class KeySetOperationContext extends ResourceOperationContext {
+public class KeySetOperationContext extends OperationContext {
 
   /** The set of keys for the operation */
   private Set keySet;
 
+  /** True if this is a post-operation context */
+  private boolean postOperation;
+
   /**
    * Constructor for the operation.
    * 
@@ -40,7 +43,33 @@ public class KeySetOperationContext extends ResourceOperationContext {
    *                true to set the post-operation flag
    */
   public KeySetOperationContext(boolean postOperation) {
-    super(Resource.DATA, OperationCode.KEY_SET, postOperation);
+    this.postOperation = postOperation;
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.KEY_SET</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.KEY_SET;
+  }
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return this.postOperation;
+  }
+
+  /**
+   * Set the post-operation flag to true.
+   */
+  public void setPostOperation() {
+    this.postOperation = true;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyValueOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyValueOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyValueOperationContext.java
index 1a92613..415f842 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyValueOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/KeyValueOperationContext.java
@@ -54,9 +54,12 @@ public abstract class KeyValueOperationContext extends KeyOperationContext {
    *                byte array
    * @since GemFire 6.5
    */
-  protected KeyValueOperationContext(OperationCode code, Object key, Object value, boolean isObject) {
-    super(code, key);
+  public KeyValueOperationContext(Object key, Object value,
+      boolean isObject) {
+    super(key);
     setValue(value,isObject);
+    //this.value = value;
+    // this.isObject = isObject;
   }
 
   /**
@@ -73,9 +76,12 @@ public abstract class KeyValueOperationContext extends KeyOperationContext {
    *                true if the context is at the time of sending updates
    * @since GemFire 6.5
    */
-  protected KeyValueOperationContext(OperationCode code, Object key, Object value, boolean isObject, boolean postOperation) {
-    super(code, key, postOperation);
+  public KeyValueOperationContext(Object key, Object value,
+      boolean isObject, boolean postOperation) {
+    super(key, postOperation);
     setValue(value,isObject);
+    //this.value = value;
+    //this.isObject = isObject;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
index ca0a549..20b528c 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
@@ -17,7 +17,7 @@
 
 package com.gemstone.gemfire.cache.operations;
 
-import org.apache.shiro.authz.Permission;
+import org.apache.shiro.authz.permission.WildcardPermission;
 
 /**
  * Encapsulates a cache operation and the data associated with it for both the
@@ -30,17 +30,16 @@ import org.apache.shiro.authz.Permission;
  *
  * @since GemFire 5.5
  */
-public interface OperationContext extends Permission {
+public abstract class OperationContext extends WildcardPermission{
+  public static String ALL_REGIONS="*";
 
-  String ALL_REGIONS = "*";
-
-  enum Resource {
+  public enum Resource {
     NULL,
     CLUSTER,
     DATA
-  }
+  };
 
-  enum OperationCode {
+  public enum OperationCode {
     @Deprecated
     GET,
     @Deprecated
@@ -299,13 +298,13 @@ public interface OperationContext extends Permission {
    * Return the operation code associated with the <code>OperationContext</code>
    * object.
    */
-  OperationCode getOperationCode();
+  public abstract OperationCode getOperationCode();
 
-  default Resource getResource() {
+  public Resource getResource(){
     return Resource.NULL;
   }
 
-  default String getRegionName() {
+  public String getRegionName(){
     return ALL_REGIONS;
   }
 
@@ -319,7 +318,7 @@ public interface OperationContext extends Permission {
    * context object in the pre-processing stage. In the post-processing stage
    * the context object shall contain results of the query.
    */
-  boolean isPostOperation();
+  public abstract boolean isPostOperation();
 
   /**
    * When called post-operation, returns true if the operation was one that performed an update.
@@ -330,7 +329,7 @@ public interface OperationContext extends Permission {
    *
    * @since GemFire 6.6
    */
-  default boolean isClientUpdate() {
+  public boolean isClientUpdate() {
     if (isPostOperation()) {
       switch (getOperationCode()) {
         case PUT:
@@ -351,7 +350,7 @@ public interface OperationContext extends Permission {
    * True if the context is created before sending the updates to a client.
    */
   @Deprecated
-  default boolean isClientUpdate(OperationContext context) {
+  public boolean isClientUpdate(OperationContext context) {
     OperationCode opCode = context.getOperationCode();
     return context.isPostOperation()
         && (opCode.isPut() || opCode.isPutAll() || opCode.isDestroy()
@@ -360,4 +359,12 @@ public interface OperationContext extends Permission {
         || opCode.isRegionDestroy() || opCode.isRegionClear());
   }
 
+  @Override
+  public String toString(){
+    if(ALL_REGIONS.equals(getRegionName()))
+      return getResource()+":"+getOperationCode();
+    else
+      return getResource()+":"+getOperationCode()+":"+getRegionName();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutAllOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutAllOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutAllOperationContext.java
index 71c3c22..d8acba9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutAllOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutAllOperationContext.java
@@ -19,7 +19,7 @@ package com.gemstone.gemfire.cache.operations;
 
 import java.util.Map;
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
+import com.gemstone.gemfire.cache.operations.OperationContext;
 import com.gemstone.gemfire.cache.operations.internal.UpdateOnlyMap;
 
 /**
@@ -28,11 +28,14 @@ import com.gemstone.gemfire.cache.operations.internal.UpdateOnlyMap;
  * 
  * @since GemFire 5.7
  */
-public class PutAllOperationContext extends ResourceOperationContext {
+public class PutAllOperationContext extends OperationContext {
 
   /** The set of keys for the operation */
   private final UpdateOnlyMap map;
   
+  /** True if this is a post-operation context */
+  private boolean postOperation = false;
+  
   private Object callbackArg;
 
   /**
@@ -40,11 +43,36 @@ public class PutAllOperationContext extends ResourceOperationContext {
    * 
    */
   public PutAllOperationContext(Map map) {
-    super(Resource.DATA, OperationCode.PUTALL, false);
     this.map = new UpdateOnlyMap(map);
   }
 
   /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.PUTALL</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.PUTALL;
+  }
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return this.postOperation;
+  }
+
+  /**
+   * Set the post-operation flag to true.
+   */
+  protected void setPostOperation() {
+    this.postOperation = true;
+  }
+
+  /**
    * Returns the map whose keys and values will be put.
    * Note that only the values of this map can be changed.
    * You can not add or remove keys.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutOperationContext.java
index b24d838..de24fd1 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/PutOperationContext.java
@@ -63,8 +63,10 @@ public class PutOperationContext extends KeyValueOperationContext {
    *                byte array
    * @since GemFire 6.5
    */
-  public PutOperationContext(Object key,Object value, boolean isObject) {
-    this(key, value, isObject, false);
+  public PutOperationContext(Object key,Object value,
+      boolean isObject) {
+    super(key, value, isObject);
+    this.opType = UNKNOWN;
   }
 
   /**
@@ -81,8 +83,10 @@ public class PutOperationContext extends KeyValueOperationContext {
    *                true if the context is at the time of sending updates
    * @since GemFire 6.5
    */
-  public PutOperationContext(Object key, Object value, boolean isObject, boolean postOperation) {
-    this(key, value, isObject, UNKNOWN, postOperation);
+  public PutOperationContext(Object key, Object value,
+      boolean isObject, boolean postOperation) {
+    super(key, value, isObject, postOperation);
+    this.opType = UNKNOWN;
   }
 
   /**
@@ -102,12 +106,24 @@ public class PutOperationContext extends KeyValueOperationContext {
    *                true if the context is at the time of sending updates
    * @since GemFire 6.5
    */
-  public PutOperationContext(Object key, Object value, boolean isObject, byte opType, boolean isPostOperation) {
-    super(OperationCode.PUT, key, value, isObject, isPostOperation);
+  public PutOperationContext(Object key, Object value,
+      boolean isObject, byte opType, boolean isPostOperation) {
+    super(key, value, isObject, isPostOperation);
     this.opType = opType;
   }
 
   /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.PUT</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.PUT;
+  }
+
+  /**
    * Return whether the operation is a create or update or unknown.
    * 
    * The user should check against {@link PutOperationContext#CREATE},

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/QueryOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/QueryOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/QueryOperationContext.java
index bc774bc..9113f79 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/QueryOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/QueryOperationContext.java
@@ -19,7 +19,7 @@ package com.gemstone.gemfire.cache.operations;
 
 import java.util.Set;
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
+import com.gemstone.gemfire.cache.operations.OperationContext;
 
 /**
  * Encapsulates a cache query operation for both the pre-operation and
@@ -27,7 +27,7 @@ import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
  * 
  * @since GemFire 5.5
  */
-public class QueryOperationContext extends ResourceOperationContext {
+public class QueryOperationContext extends OperationContext {
 
   /** The query string of this query operation. */
   private String queryString;
@@ -38,38 +38,73 @@ public class QueryOperationContext extends ResourceOperationContext {
   /** The result of query operation */
   private Object queryResult;
 
+  /** True if this is a post-operation context */
+  private boolean postOperation;
+
   /** The bind parameters for the query */
   private Object[] queryParams;
   
   /**
    * Constructor for the query operation.
-   *
-   * @param queryString   the query string for this operation
-   * @param regionNames   names of regions that are part of the query string
-   * @param postOperation true to set the post-operation flag
+   * 
+   * @param queryString
+   *                the query string for this operation
+   * @param regionNames
+   *                names of regions that are part of the query string
+   * @param postOperation
+   *                true to set the post-operation flag
    */
-  public QueryOperationContext(String queryString, Set regionNames, boolean postOperation) {
-    this(OperationCode.QUERY, queryString, regionNames, postOperation);
-  }
-
-  QueryOperationContext(OperationCode code, String queryString, Set regionNames, boolean postOperation) {
-    super(Resource.DATA, code, postOperation);
+  public QueryOperationContext(String queryString, Set regionNames,
+      boolean postOperation) {
     this.queryString = queryString;
     this.regionNames = regionNames;
+    this.queryResult = null;
+    this.postOperation = postOperation;
   }
 
   /**
    * Constructor for the query operation.
-   *
-   * @param queryString   the query string for this operation
-   * @param regionNames   names of regions that are part of the query string
-   * @param postOperation true to set the post-operation flag
-   * @param queryParams   the bind parameters for the query
+   * 
+   * @param queryString
+   *                the query string for this operation
+   * @param regionNames
+   *                names of regions that are part of the query string
+   * @param postOperation
+   *                true to set the post-operation flag
+   * @param queryParams
+   *                the bind parameters for the query
    */
-  public QueryOperationContext(String queryString, Set regionNames, boolean postOperation, Object[] queryParams) {
-    this(OperationCode.QUERY, queryString, regionNames, postOperation);
+  public QueryOperationContext(String queryString, Set regionNames,
+      boolean postOperation, Object[] queryParams) {
+    this(queryString, regionNames, postOperation);
     this.queryParams = queryParams;
   }
+  
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return the <code>OperationCode</code> of this operation
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.QUERY;
+  }
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return this.postOperation;
+  }
+
+  /**
+   * Set the post-operation flag to true.
+   */
+  public void setPostOperation() {
+    this.postOperation = true;
+  }
 
   /** Return the query string of this query operation. */
   public String getQuery() {
@@ -78,7 +113,7 @@ public class QueryOperationContext extends ResourceOperationContext {
 
   /**
    * Modify the query string.
-   *
+   * 
    * @param query
    *                the new query string for this query.
    */
@@ -89,7 +124,7 @@ public class QueryOperationContext extends ResourceOperationContext {
 
   /**
    * Get the names of regions that are part of the query string.
-   *
+   * 
    * @return names of regions being queried.
    */
   public Set getRegionNames() {
@@ -98,7 +133,7 @@ public class QueryOperationContext extends ResourceOperationContext {
 
   /**
    * Set the names of regions that are part of the query string.
-   *
+   * 
    * @param regionNames names of regions being queried
    */
   public void setRegionNames(Set regionNames) {
@@ -107,7 +142,7 @@ public class QueryOperationContext extends ResourceOperationContext {
 
   /**
    * Get the result of the query execution.
-   *
+   * 
    * @return result of the query.
    */
   public Object getQueryResult() {
@@ -116,7 +151,7 @@ public class QueryOperationContext extends ResourceOperationContext {
 
   /**
    * Set the result of query operation.
-   *
+   * 
    * @param queryResult
    *                the new result of the query operation.
    */
@@ -126,10 +161,11 @@ public class QueryOperationContext extends ResourceOperationContext {
 
   /**
    * Get the bind parameters for the query
-   *
+   * 
    * @return bind parameters for the query
    */
   public Object[] getQueryParams() {
     return queryParams;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionClearOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionClearOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionClearOperationContext.java
index 120584e..f3ac414 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionClearOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionClearOperationContext.java
@@ -33,6 +33,18 @@ public class RegionClearOperationContext extends RegionOperationContext {
    *                true to set the post-operation flag
    */
   public RegionClearOperationContext(boolean postOperation) {
-    super(OperationCode.REGION_CLEAR, postOperation);
+    super(postOperation);
   }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.REGION_CLEAR</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.REGION_CLEAR;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionCreateOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionCreateOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionCreateOperationContext.java
index 6985d91..4b92ae9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionCreateOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionCreateOperationContext.java
@@ -17,15 +17,16 @@
 
 package com.gemstone.gemfire.cache.operations;
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
-
 /**
  * Encapsulates a {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#REGION_CREATE} operation for both the
  * pre-operation and post-operation cases.
  * 
  * @since GemFire 5.5
  */
-public class RegionCreateOperationContext extends ResourceOperationContext {
+public class RegionCreateOperationContext extends OperationContext {
+
+  /** True if this is a post-operation context */
+  private boolean postOperation;
 
   /**
    * Constructor for the region creation operation.
@@ -34,7 +35,26 @@ public class RegionCreateOperationContext extends ResourceOperationContext {
    *                true to set the post-operation flag
    */
   public RegionCreateOperationContext(boolean postOperation) {
-    super(Resource.DATA, OperationCode.REGION_CREATE, postOperation);
+    this.postOperation = postOperation;
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.REGION_CREATE</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.REGION_CREATE;
+  }
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return this.postOperation;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionDestroyOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionDestroyOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionDestroyOperationContext.java
index c4b7375..b2d19c1 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionDestroyOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionDestroyOperationContext.java
@@ -33,7 +33,18 @@ public class RegionDestroyOperationContext extends RegionOperationContext {
    *                true to set the post-operation flag
    */
   public RegionDestroyOperationContext(boolean postOperation) {
-    super(OperationCode.REGION_DESTROY, postOperation);
+    super(postOperation);
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.REGION_DESTROY</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.REGION_DESTROY;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionOperationContext.java
index 4c41cdc..c631a78 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegionOperationContext.java
@@ -18,8 +18,6 @@
 package com.gemstone.gemfire.cache.operations;
 
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
-
 /**
  * Encapsulates a region-level operation in both the pre-operation and
  * post-operation cases. The operations this class encapsulates are
@@ -28,20 +26,42 @@ import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
  * 
  * @since GemFire 5.5
  */
-public abstract class RegionOperationContext extends ResourceOperationContext {
+public abstract class RegionOperationContext extends OperationContext {
 
   /** Callback object for the operation (if any) */
   private Object callbackArg;
 
+  /** True if this is a post-operation context */
+  private boolean postOperation;
+
   /**
    * Constructor for a region operation.
    * 
    * @param postOperation
    *                true to set the post-operation flag
    */
-  protected RegionOperationContext(OperationCode code, boolean postOperation) {
-    super(Resource.DATA, code, postOperation);
+  public RegionOperationContext(boolean postOperation) {
     this.callbackArg = null;
+    this.postOperation = postOperation;
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return The <code>OperationCode</code> of this operation. This is one of
+   *         {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#REGION_CLEAR} or
+   *         {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#REGION_DESTROY}.
+   */
+  @Override
+  public abstract OperationCode getOperationCode();
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return this.postOperation;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegisterInterestOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegisterInterestOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegisterInterestOperationContext.java
index 78cc533..f5cda63 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegisterInterestOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RegisterInterestOperationContext.java
@@ -43,11 +43,22 @@ public class RegisterInterestOperationContext extends InterestOperationContext {
    */
   public RegisterInterestOperationContext(Object key,
       InterestType interestType, InterestResultPolicy policy) {
-    super(OperationCode.REGISTER_INTEREST, key, interestType);
+    super(key, interestType);
     this.policy = policy;
   }
 
   /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.REGISTER_INTEREST</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.REGISTER_INTEREST;
+  }
+
+  /**
    * Get the <code>InterestResultPolicy</code> of this register/unregister
    * operation.
    * 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RemoveAllOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RemoveAllOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RemoveAllOperationContext.java
index 3c0a51c..c33d85d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RemoveAllOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/RemoveAllOperationContext.java
@@ -20,7 +20,7 @@ package com.gemstone.gemfire.cache.operations;
 import java.util.Collection;
 import java.util.Collections;
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
+import com.gemstone.gemfire.cache.operations.OperationContext;
 
 /**
  * Encapsulates a {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#REMOVEALL} operation for both the
@@ -28,11 +28,14 @@ import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
  * 
  * @since GemFire 8.1
  */
-public class RemoveAllOperationContext extends ResourceOperationContext {
+public class RemoveAllOperationContext extends OperationContext {
 
   /** The collection of keys for the operation */
   private Collection<?> keys;
   
+  /** True if this is a post-operation context */
+  private boolean postOperation = false;
+  
   private Object callbackArg;
 
   /**
@@ -40,11 +43,36 @@ public class RemoveAllOperationContext extends ResourceOperationContext {
    * 
    */
   public RemoveAllOperationContext(Collection<?> keys) {
-    super(Resource.DATA, OperationCode.REMOVEALL);
     this.keys = keys;
   }
 
   /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.RemoveAll</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.REMOVEALL;
+  }
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return this.postOperation;
+  }
+
+  /**
+   * Set the post-operation flag to true.
+   */
+  protected void setPostOperation() {
+    this.postOperation = true;
+  }
+
+  /**
    * Returns the keys for this removeAll in an unmodifiable collection.
    */
   public Collection<?> getKeys() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/StopCQOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/StopCQOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/StopCQOperationContext.java
index 5cc4f69..eae3ec5 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/StopCQOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/StopCQOperationContext.java
@@ -38,8 +38,28 @@ public class StopCQOperationContext extends ExecuteCQOperationContext {
    * @param regionNames
    *                names of regions that are part of the query string
    */
-  public StopCQOperationContext(String cqName, String queryString, Set regionNames) {
-    super(OperationCode.STOP_CQ, cqName, queryString, regionNames, false);
+  public StopCQOperationContext(String cqName, String queryString,
+      Set regionNames) {
+    super(cqName, queryString, regionNames, false);
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.STOP_CQ</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.STOP_CQ;
+  }
+
+  /**
+   * True if the context is for post-operation.
+   */
+  @Override
+  public boolean isPostOperation() {
+    return false;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/UnregisterInterestOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/UnregisterInterestOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/UnregisterInterestOperationContext.java
index 076712c..868d455 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/UnregisterInterestOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/UnregisterInterestOperationContext.java
@@ -36,7 +36,18 @@ public class UnregisterInterestOperationContext extends InterestOperationContext
    */
   public UnregisterInterestOperationContext(Object key,
       InterestType interestType) {
-    super(OperationCode.UNREGISTER_INTEREST, key, interestType);
+    super(key, interestType);
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.UNREGISTER_INTEREST</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.UNREGISTER_INTEREST;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImpl.java
index 6096c53..f664061 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/GetOperationContextImpl.java
@@ -32,15 +32,9 @@ import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
 public class GetOperationContextImpl extends GetOperationContext implements Releasable {
 
   private boolean released;
-
-  /**
-   * Constructor for a concrete {@link GetOperationContext}
-   *
-   * @param key           the key object
-   * @param postOperation boolean indication whether this is a post-operation
-   */
+  
   public GetOperationContextImpl(Object key, boolean postOperation) {
-    super(OperationCode.GET, key, postOperation);
+    super(key, postOperation);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/ResourceOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/ResourceOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/ResourceOperationContext.java
deleted file mode 100644
index 636af05..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/ResourceOperationContext.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.cache.operations.internal;
-
-import com.gemstone.gemfire.cache.operations.OperationContext;
-import org.apache.shiro.authz.permission.WildcardPermission;
-
-/**
- * This is the base class for all {@link OperationContext}s. For JMX and CLI operations this is the
- * concrete class which is passed in to {@link com.gemstone.gemfire.security.AccessControl#authorizeOperation}.
- */
-public class ResourceOperationContext extends WildcardPermission implements OperationContext {
-
-  private boolean isPostOperation = false;
-  private Object opResult = null;
-
-  // these default values are used when creating a lock around an operation
-  private final Resource resource;
-  private final OperationCode operation;
-  private final String regionName;
-
-  public ResourceOperationContext() {
-    this(Resource.NULL, OperationCode.NULL);
-  }
-
-  public ResourceOperationContext(Resource resource, OperationCode code, boolean isPost) {
-    this(resource.toString(), code.toString(), ALL_REGIONS.toString(), isPost);
-  }
-
-  public ResourceOperationContext(Resource resource, OperationCode code) {
-    this(resource.toString(), code.toString(), ALL_REGIONS.toString(), false);
-  }
-
-  // When only specified a resource and operation, it's assumed that you need access to all regions
-  // in order to perform the operations guarded by this ResourceOperationContext
-  public ResourceOperationContext(String resource, String operation) {
-    this(resource, operation, ALL_REGIONS, false);
-  }
-
-  public ResourceOperationContext(String resource, String operation, String region) {
-    this(resource, operation, region, false);
-  }
-
-  public ResourceOperationContext(String resource, String operation, String regionName, boolean isPost) {
-    this((resource != null) ? Resource.valueOf(resource) : Resource.NULL,
-        (operation != null) ? OperationCode.valueOf(operation) : OperationCode.NULL,
-        (regionName != null) ? regionName : ALL_REGIONS, isPost);
-  }
-
-  public ResourceOperationContext(Resource resource, OperationCode operation, String regionName, boolean isPost) {
-    this.resource = (resource != null) ? resource : Resource.NULL;
-    String resourcePart = (this.resource != Resource.NULL) ? resource.toString() : "*";
-
-    this.operation = (operation != null) ? operation : OperationCode.NULL;
-    String operationPart = (this.operation != OperationCode.NULL) ? operation.toString() : "*";
-
-    this.regionName = (regionName != null) ? regionName : ALL_REGIONS;
-    this.isPostOperation = isPost;
-
-    String shiroPermission = String.format("%s:%s:%s", resourcePart, operationPart, this.regionName);
-    setParts(shiroPermission, true);
-  }
-
-  @Override
-  public final boolean isClientUpdate() {
-    return false;
-  }
-
-  @Override
-  public final OperationCode getOperationCode() {
-    return operation;
-  }
-
-  @Override
-  public final Resource getResource() {
-    return resource;
-  }
-
-  @Override
-  public final String getRegionName() {
-    return this.regionName;
-  }
-
-  @Override
-  public final boolean isPostOperation() {
-    return isPostOperation;
-  }
-
-  public final void setPostOperationResult(Object result) {
-    this.isPostOperation = true;
-    this.opResult = result;
-  }
-
-  /**
-   * Set the post-operation flag to true.
-   */
-  public final void setPostOperation() {
-    this.isPostOperation = true;
-  }
-
-  public final Object getOperationResult() {
-    return this.opResult;
-  }
-
-  @Override
-  public String toString() {
-    if (ALL_REGIONS.equals(getRegionName())) {
-      return getResource() + ":" + getOperationCode();
-    } else {
-      return getResource() + ":" + getOperationCode() + ":" + getRegionName();
-    }
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java
index e08e6e3..14b81a1 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/execute/ServerToClientFunctionResultSender.java
@@ -244,7 +244,7 @@ public class ServerToClientFunctionResultSender implements ResultSender {
     // results from server
     AuthorizeRequestPP authzRequestPP = this.sc.getPostAuthzRequest();
     if (authzRequestPP != null) {
-      this.authContext.setPostOperation();
+      this.authContext.setIsPostOperation(true);
       this.authContext = authzRequestPP.executeFunctionAuthorize(oneResult,
           this.authContext);
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/operations/ContainsKeyOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/operations/ContainsKeyOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/operations/ContainsKeyOperationContext.java
index 0ced75a..da2fcc7 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/operations/ContainsKeyOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/operations/ContainsKeyOperationContext.java
@@ -34,7 +34,18 @@ public class ContainsKeyOperationContext extends KeyOperationContext {
    *                the key for this operation
    */
   public ContainsKeyOperationContext(Object key) {
-    super(OperationCode.CONTAINS_KEY, key);
+    super(key);
+  }
+
+  /**
+   * Return the operation associated with the <code>OperationContext</code>
+   * object.
+   * 
+   * @return <code>OperationCode.CONTAINS_KEY</code>.
+   */
+  @Override
+  public OperationCode getOperationCode() {
+    return OperationCode.CONTAINS_KEY;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
index 4635d55..3a80e25 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
@@ -31,6 +31,7 @@ import com.gemstone.gemfire.cache.query.SelectResults;
 import com.gemstone.gemfire.cache.query.Struct;
 import com.gemstone.gemfire.cache.query.internal.CqEntry;
 import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
+import com.gemstone.gemfire.cache.query.internal.cq.InternalCqQuery;
 import com.gemstone.gemfire.cache.query.internal.cq.ServerCQ;
 import com.gemstone.gemfire.cache.query.internal.types.CollectionTypeImpl;
 import com.gemstone.gemfire.cache.query.internal.types.StructTypeImpl;
@@ -64,7 +65,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
    */
   protected static boolean processQuery(Message msg, Query query,
       String queryString, Set regionNames, long start, ServerCQ cqQuery,
-      QueryOperationContext queryContext, ServerConnection servConn,
+      QueryOperationContext queryContext, ServerConnection servConn, 
       boolean sendResults)
       throws IOException, InterruptedException {
     return processQueryUsingParams(msg, query, queryString,
@@ -88,7 +89,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
    */
   protected static boolean processQueryUsingParams(Message msg, Query query,
       String queryString, Set regionNames, long start, ServerCQ cqQuery,
-      QueryOperationContext queryContext, ServerConnection servConn,
+      QueryOperationContext queryContext, ServerConnection servConn, 
       boolean sendResults, Object[] params)
       throws IOException, InterruptedException {
     ChunkedMessage queryResponseMsg = servConn.getQueryResponseMessage();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
index 6f9079d..838bfc6 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
@@ -25,7 +25,7 @@ import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.security.shiro.CustomAuthRealm;
 import com.gemstone.gemfire.internal.security.shiro.ShiroPrincipal;
 import com.gemstone.gemfire.management.internal.security.ResourceOperation;
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
+import com.gemstone.gemfire.management.internal.security.ResourceOperationContext;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 import com.gemstone.gemfire.security.NotAuthorizedException;
@@ -192,29 +192,34 @@ public class GeodeSecurityUtil {
 
   private static void authorize(String resource, String operation, String regionName){
     regionName = StringUtils.stripStart(regionName, "/");
-    authorize(new ResourceOperationContext(resource, operation, regionName, false));
+    authorize(new ResourceOperationContext(resource, operation, regionName));
   }
 
   public static void authorize(OperationContext context) {
-    if (context == null) return;
+    if(context==null)
+      return;
 
-    if (context.getResource() == Resource.NULL && context.getOperationCode() == OperationCode.NULL) return;
+    if(context.getResource()== Resource.NULL && context.getOperationCode()== OperationCode.NULL)
+      return;
 
     Subject currentUser = getSubject();
-    if (currentUser == null) return;
+    if(currentUser==null)
+      return;
 
     try {
       currentUser.checkPermission(context);
-    } catch (ShiroException e) {
+    }
+    catch(ShiroException e){
       logger.info(currentUser.getPrincipal() + " not authorized for " + context);
       throw new NotAuthorizedException(e.getMessage(), e);
     }
   }
 
-  private static boolean isSecured() {
-    try {
+  private static boolean isSecured(){
+    try{
       SecurityUtils.getSecurityManager();
-    } catch (UnavailableSecurityManagerException e) {
+    }
+    catch(UnavailableSecurityManagerException e){
       return false;
     }
     return true;
@@ -225,27 +230,30 @@ public class GeodeSecurityUtil {
    * @param securityProps
    */
   public static void initSecurity(Properties securityProps){
-    if (securityProps == null) return;
+    if(securityProps==null)
+      return;
 
     String shiroConfig = securityProps.getProperty(DistributionConfig.SECURITY_SHIRO_INIT);
     String customAuthenticator =securityProps.getProperty(SECURITY_CLIENT_AUTHENTICATOR);
     if (!com.gemstone.gemfire.internal.lang.StringUtils.isBlank(shiroConfig)) {
-      IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:" + shiroConfig);
+      IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:"+shiroConfig);
 
       // we will need to make sure that shiro uses a case sensitive permission resolver
       Section main = factory.getIni().addSection("main");
       main.put("geodePermissionResolver", "com.gemstone.gemfire.internal.security.shiro.GeodePermissionResolver");
-      if (!main.containsKey("iniRealm.permissionResolver")) {
+      if(!main.containsKey("iniRealm.permissionResolver")) {
         main.put("iniRealm.permissionResolver", "$geodePermissionResolver");
       }
 
       SecurityManager securityManager = factory.getInstance();
       SecurityUtils.setSecurityManager(securityManager);
-    } else if (!com.gemstone.gemfire.internal.lang.StringUtils.isBlank(customAuthenticator)) {
+    }
+    else if (!com.gemstone.gemfire.internal.lang.StringUtils.isBlank(customAuthenticator)) {
       Realm realm = new CustomAuthRealm(securityProps);
       SecurityManager securityManager = new DefaultSecurityManager(realm);
       SecurityUtils.setSecurityManager(securityManager);
-    } else {
+    }
+    else{
       SecurityUtils.setSecurityManager(null);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
index 7e7a928..fff008f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
@@ -89,12 +89,11 @@ public class CustomAuthRealm extends AuthorizingRealm{
 
   @Override
   public boolean isPermitted(PrincipalCollection principals, Permission permission) {
-    OperationContext context = (OperationContext) permission;
-    Principal principal = (Principal) principals.getPrimaryPrincipal();
-
+    OperationContext context =(OperationContext)permission;
+    Principal principal = (Principal)principals.getPrimaryPrincipal();
     // if no access control is specified, then we allow all
-    if (StringUtils.isBlank(authzFactoryName)) return true;
-
+    if(StringUtils.isBlank(authzFactoryName))
+      return true;
     AccessControl accessControl = getAccessControl(principal, false);
     return accessControl.authorizeOperation(context.getRegionName(), context);
   }
@@ -140,7 +139,8 @@ public class CustomAuthRealm extends AuthorizingRealm{
       Method instanceGetter = ClassLoadUtil.methodFromName(this.authenticatorFactoryName);
       auth = (Authenticator) instanceGetter.invoke(null, (Object[]) null);
     } catch (Exception ex) {
-      throw new AuthenticationException(ex.toString(), ex);
+      throw new AuthenticationException(
+          ex.toString(), ex);
     }
     if (auth == null) {
       throw new AuthenticationException(

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java
index 8541295..efbc1f1 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java
@@ -44,7 +44,6 @@ import javax.management.ReflectionException;
 import javax.management.loading.ClassLoaderRepository;
 import javax.management.remote.MBeanServerForwarder;
 
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 import com.gemstone.gemfire.management.internal.ManagementConstants;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
@@ -257,7 +256,7 @@ public class MBeanServerWrapper implements MBeanServerForwarder {
     String resource = (String)descriptor.getFieldValue("resource");
     String operationCode = (String)descriptor.getFieldValue("operation");
     if(resource!=null && operationCode!=null){
-      return new ResourceOperationContext(resource, operationCode, null, false);
+      return new ResourceOperationContext(resource, operationCode, null);
     }
     return defaultValue;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java
new file mode 100644
index 0000000..99da1f1
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management.internal.security;
+
+import com.gemstone.gemfire.cache.operations.OperationContext;
+
+/**
+ * This is base class for OperationContext for resource (JMX and CLI) operations
+ */
+public class ResourceOperationContext extends OperationContext {
+
+  private boolean isPostOperation = false;
+  private Object opResult = null;
+
+  // these default values are used when creating a lock around an operation
+  private Resource resource = Resource.NULL;
+  private OperationCode operation = OperationCode.NULL;
+  private String regionName = OperationContext.ALL_REGIONS;
+
+  public ResourceOperationContext() {
+    this(null, null, null);
+  }
+
+  // When only specified a resource and operation, it's assumed that you need access to all regions in order to perform the operations
+  // guarded by this ResourceOperationConext
+  public ResourceOperationContext(String resource, String operation) {
+    this(resource, operation, OperationContext.ALL_REGIONS);
+  }
+
+  public ResourceOperationContext(String resource, String operation, String regionName) {
+    if (resource != null) this.resource = Resource.valueOf(resource);
+    if (operation != null) this.operation = OperationCode.valueOf(operation);
+    if (regionName !=null ) this.regionName = regionName;
+
+    setParts(this.resource.name()+":"+this.operation.name()+":"+this.regionName, true);
+  }
+
+  @Override
+  public boolean isClientUpdate() {
+    return false;
+  }
+
+  @Override
+  public OperationCode getOperationCode() {
+    return operation;
+  }
+
+  @Override
+  public Resource getResource() {
+    return resource;
+  }
+
+  @Override
+  public String getRegionName(){
+    return this.regionName;
+  }
+
+  @Override
+  public boolean isPostOperation() {
+    return isPostOperation;
+  }
+
+  public void setPostOperationResult(Object result) {
+    this.isPostOperation = true;
+    this.opResult = result;
+  }
+
+  public Object getOperationResult() {
+    return this.opResult;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
index dca64e7..63c8536 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
@@ -21,10 +21,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.operations.OperationContext;
-import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.management.internal.security.ResourceConstants;
+import com.gemstone.gemfire.management.internal.security.ResourceOperationContext;
 import com.gemstone.gemfire.security.AccessControl;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
@@ -181,7 +181,7 @@ public class SampleJsonAuthorization implements AccessControl, Authenticator {
         String resourcePart = (parts.length > 0) ? parts[0] : null;
         String operationPart = (parts.length > 1) ? parts[1] : null;
         String regionPart = (regionNames != null) ? regionNames : "*";
-        role.permissions.add(new ResourceOperationContext(resourcePart, operationPart, regionPart, false));
+        role.permissions.add(new ResourceOperationContext(resourcePart, operationPart, regionPart));
       }
 
       roleMap.put(role.name, role);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4af70723/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/OperationPartsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/OperationPartsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/OperationPartsJUnitTest.java
deleted file mode 100644
index 46ad79f..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/OperationPartsJUnitTest.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.cache.operations;
-
-import com.gemstone.gemfire.cache.operations.internal.GetOperationContextImpl;
-import com.gemstone.gemfire.internal.cache.operations.ContainsKeyOperationContext;
-import com.gemstone.gemfire.test.junit.categories.SecurityTest;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import org.apache.shiro.authz.Permission;
-import org.apache.shiro.authz.permission.WildcardPermission;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.HashMap;
-import java.util.HashSet;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-@Category({ UnitTest.class, SecurityTest.class })
-public class OperationPartsJUnitTest {
-
-  private static final WildcardPermission allDataPermissions =
-      new WildcardPermission(OperationContext.Resource.DATA.toString(), true);
-
-  private Permission makePermission(OperationContext.OperationCode opCode) {
-    return new WildcardPermission(String.format("%s:%s", OperationContext.Resource.DATA, opCode.toString()), true);
-  }
-
-  @Test
-  public void closeCQ() {
-    CloseCQOperationContext context = new CloseCQOperationContext("name", "query", new HashSet<>());
-    assertTrue(makePermission(OperationContext.OperationCode.CLOSE_CQ).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void containsKey() {
-    ContainsKeyOperationContext context = new ContainsKeyOperationContext(null);
-    assertTrue(makePermission(OperationContext.OperationCode.CONTAINS_KEY).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void destroy() {
-    DestroyOperationContext context = new DestroyOperationContext(null);
-    assertTrue(makePermission(OperationContext.OperationCode.DESTROY).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void executeCQ() {
-    ExecuteCQOperationContext context = new ExecuteCQOperationContext("name", "query", new HashSet<>(), false);
-    assertTrue(makePermission(OperationContext.OperationCode.EXECUTE_CQ).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void executeFunction() {
-    ExecuteFunctionOperationContext context = new ExecuteFunctionOperationContext("name", "region", new HashSet<>(), null, true, false);
-    assertTrue(makePermission(OperationContext.OperationCode.EXECUTE_FUNCTION).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void getDurableCQs() {
-    GetDurableCQsOperationContext context = new GetDurableCQsOperationContext();
-    assertTrue(makePermission(OperationContext.OperationCode.GET_DURABLE_CQS).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void get() {
-    GetOperationContext context = new GetOperationContextImpl(null, false);
-    assertTrue(makePermission(OperationContext.OperationCode.GET).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void registerInterest() {
-    RegisterInterestOperationContext context = new RegisterInterestOperationContext(null, null, null);
-    assertTrue(makePermission(OperationContext.OperationCode.REGISTER_INTEREST).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void unregisterInterest() {
-    UnregisterInterestOperationContext context = new UnregisterInterestOperationContext(null, null);
-    assertTrue(makePermission(OperationContext.OperationCode.UNREGISTER_INTEREST).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void invalidate() {
-    InvalidateOperationContext context = new InvalidateOperationContext(null);
-    assertTrue(makePermission(OperationContext.OperationCode.INVALIDATE).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void keySet() {
-    KeySetOperationContext context = new KeySetOperationContext(false);
-    assertTrue(makePermission(OperationContext.OperationCode.KEY_SET).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void putAll() {
-    PutAllOperationContext context = new PutAllOperationContext(new HashMap<>());
-    assertTrue(makePermission(OperationContext.OperationCode.PUTALL).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void put() {
-    PutOperationContext context = new PutOperationContext(null, null, true);
-    assertTrue(makePermission(OperationContext.OperationCode.PUT).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void query() {
-    QueryOperationContext context = new QueryOperationContext("query", null, false);
-    assertTrue(makePermission(OperationContext.OperationCode.QUERY).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void regionClear() {
-    RegionClearOperationContext context = new RegionClearOperationContext(false);
-    assertTrue(makePermission(OperationContext.OperationCode.REGION_CLEAR).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void regionCreate() {
-    RegionCreateOperationContext context = new RegionCreateOperationContext(false);
-    assertTrue(makePermission(OperationContext.OperationCode.REGION_CREATE).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void regionDestroy() {
-    RegionDestroyOperationContext context = new RegionDestroyOperationContext(false);
-    assertTrue(makePermission(OperationContext.OperationCode.REGION_DESTROY).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void removeAll() {
-    RemoveAllOperationContext context = new RemoveAllOperationContext(null);
-    assertTrue(makePermission(OperationContext.OperationCode.REMOVEALL).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-
-  @Test
-  public void stopCQ() {
-    StopCQOperationContext context = new StopCQOperationContext(null, null, null);
-    assertTrue(makePermission(OperationContext.OperationCode.STOP_CQ).implies(context));
-    assertTrue(allDataPermissions.implies(context));
-    assertFalse(context.isPostOperation());
-  }
-}