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/02 17:13:55 UTC

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

GEODE-1463: Legacy OperationContexts do not set the appropriate Shiro
permission tuple

- Moved ResourceOperationContext into a 'public' package.
- Converted OperationContext into an interface.
- Cleaned up the hierarchy of everything that previously
  extended OperationContext.
- Marked GetOperationContext as abstract seeing that
  GetOperationContextImpl extends it and there are no uses of
  GetOperationContext anywhere. (So why does it still exist?).


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

Branch: refs/heads/develop
Commit: 670fae4b3950fa1ce302461312dd1251d8ea2d8a
Parents: 557fae1
Author: Jens Deppe <jd...@pivotal.io>
Authored: Tue May 31 07:44:25 2016 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Thu Jun 2 10:08:25 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 --------
 .../operations/OperationPartsJUnitTest.java     | 195 +++++++++++++++++++
 .../security/ExampleJSONAuthorization.java      |   5 +-
 .../internal/security/JSONAuthorization.java    |   5 +-
 .../ResourceOperationContextJUnitTest.java      |   5 +-
 .../internal/security/TestCommand.java          |  19 +-
 .../codeAnalysis/sanctionedSerializables.txt    |   3 +-
 38 files changed, 515 insertions(+), 670 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 1924605..b984981 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,28 +37,8 @@ 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(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;
+  public CloseCQOperationContext(String cqName, String queryString, Set regionNames) {
+    super(OperationCode.CLOSE_CQ, cqName, queryString, regionNames, false);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 c00b1a7..b681c15 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) {
-    super(key);
+    this(key, false);
   }
 
   /**
@@ -45,18 +45,7 @@ public class DestroyOperationContext extends KeyOperationContext {
    *                true to set the post-operation flag
    */
   public DestroyOperationContext(Object key, boolean 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;
+    super(OperationCode.DESTROY, key, postOperation);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 a2b8ab2..068849c 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,19 +44,25 @@ public class ExecuteCQOperationContext extends QueryOperationContext {
    */
   public ExecuteCQOperationContext(String cqName, String queryString,
       Set regionNames, boolean postOperation) {
-    super(queryString, regionNames, postOperation);
-    this.cqName = cqName;
+    this(OperationCode.EXECUTE_CQ, cqName, queryString, regionNames, postOperation);
   }
 
   /**
-   * Return the operation associated with the <code>OperationContext</code>
-   * object.
-   * 
-   * @return the <code>OperationCode</code> of this operation
+   * 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
    */
-  @Override
-  public OperationCode getOperationCode() {
-    return OperationCode.EXECUTE_CQ;
+  protected ExecuteCQOperationContext(OperationCode code, String cqName, String queryString,
+      Set regionNames, boolean postOperation) {
+    super(code, queryString, regionNames, postOperation);
+    this.cqName = cqName;
   }
 
   /** Return the name of the continuous query. */

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 dafc5c0..bfbe4d1 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,7 +16,8 @@
  */
 package com.gemstone.gemfire.cache.operations;
 
-import java.io.Serializable;
+import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
+
 import java.util.Set;
 
 /**
@@ -25,53 +26,44 @@ import java.util.Set;
  * @since GemFire 6.0
  *
  */
-public class ExecuteFunctionOperationContext extends OperationContext {
+public class ExecuteFunctionOperationContext extends ResourceOperationContext {
 
   private String functionId;
 
-  private String regionName;
-
-  private boolean optizeForWrite;
+  private boolean optimizeForWrite;
 
-  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.optizeForWrite = optimizeForWrite;
-    this.isPostOperation = isPostOperation;
-  }
-
-  @Override
-  public OperationCode getOperationCode() {
-    return OperationCode.EXECUTE_FUNCTION;
-  }
-
-  @Override
-  public boolean isPostOperation() {
-    return this.isPostOperation;
+    this.optimizeForWrite = optimizeForWrite;
   }
 
   public String getFunctionId() {
     return this.functionId;
   }
 
-  public String getRegionName() {
-    return this.regionName;
-  }
-
   public boolean isOptimizeForWrite() {
-    return this.optizeForWrite;
+    return this.optimizeForWrite;
   }
   
   public Object getResult() {
@@ -90,7 +82,4 @@ public class ExecuteFunctionOperationContext extends OperationContext {
     this.result = oneResult;
   }
   
-  public void setIsPostOperation(boolean isPostOperation) {
-    this.isPostOperation = isPostOperation;
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 abec6b6..9082e42 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,8 +17,7 @@
 
 package com.gemstone.gemfire.cache.operations;
 
-import java.util.Set;
-
+import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 
 /**
  * Encapsulates a {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#GET_DURABLE_CQS} operation for the pre-operation
@@ -26,34 +25,13 @@ import java.util.Set;
  * 
  * @since GemFire 7.0
  */
-public class GetDurableCQsOperationContext extends OperationContext {
+public class GetDurableCQsOperationContext extends ResourceOperationContext {
 
   /**
    * Constructor for the GET_DURABLE_CQS operation.
-   * 
-  
    */
   public GetDurableCQsOperationContext() {
-    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;
+    super(Resource.DATA, OperationCode.GET_DURABLE_CQS, false);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 f276d2c..ade353c 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,37 +25,18 @@ package com.gemstone.gemfire.cache.operations;
  * 
  * @since GemFire 5.5
  */
-public class GetOperationContext extends KeyValueOperationContext {
+public abstract class GetOperationContext extends KeyValueOperationContext {
 
   /**
    * Constructor for the operation.
-   * 
-   * @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.
+   *
+   * @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
    */
-  @Override
-  public void setPostOperation() {
-    super.setPostOperation();
+  protected GetOperationContext(OperationCode code, Object key, boolean postOperation) {
+    super(code, key, null, false, postOperation);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 18aff9e..0643ec6 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,12 +18,14 @@
 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 OperationContext {
+public abstract class InterestOperationContext extends ResourceOperationContext {
 
   /** The key or list of keys being registered/unregistered. */
   private Object key;
@@ -32,27 +34,19 @@ public abstract class InterestOperationContext extends OperationContext {
   private InterestType interestType;
 
   /**
-   * 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
+   * 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
    */
-  public InterestOperationContext(Object key, InterestType interestType) {
+ protected InterestOperationContext(OperationCode code, Object key, InterestType interestType) {
+    super(Resource.DATA, code, false);
     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/670fae4b/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 dd8ce38..6830276 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 operation.
+   * Constructor for the INVALIDATE operation.
    * 
    * @param key
    *                the key for this operation
    */
   public InvalidateOperationContext(Object key) {
-    super(key);
+    super(OperationCode.INVALIDATE, key);
   }
 
   /**
@@ -46,18 +46,7 @@ public class InvalidateOperationContext extends KeyOperationContext {
    *                sending updates                 
    */
   public InvalidateOperationContext(Object key, boolean 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;
+    super(OperationCode.INVALIDATE, key, isPostOperation);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 985af0b..c0e7145 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,6 +17,7 @@
 
 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
@@ -26,7 +27,7 @@ package com.gemstone.gemfire.cache.operations;
  * 
  * @since GemFire 5.5
  */
-public abstract class KeyOperationContext extends OperationContext {
+public abstract class KeyOperationContext extends ResourceOperationContext {
 
   /** The key object of the operation */
   private Object key;
@@ -34,19 +35,14 @@ public abstract class KeyOperationContext 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 the operation.
    * 
    * @param key
    *                the key for this operation
    */
-  public KeyOperationContext(Object key) {
-    this.key = key;
-    this.callbackArg = null;
-    this.postOperation = false;
+  public KeyOperationContext(OperationCode code, Object key) {
+    this(code, key, false);
   }
 
   /**
@@ -57,40 +53,10 @@ public abstract class KeyOperationContext extends OperationContext {
    * @param postOperation
    *                true to set the post-operation flag
    */
-  public KeyOperationContext(Object key, boolean postOperation) {
+  protected KeyOperationContext(OperationCode code, Object key, boolean postOperation) {
+    super(Resource.DATA, code, 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/670fae4b/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 0b8bccc..1664b2a 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.OperationContext;
+import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 
 /**
  * Encapsulates a {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#KEY_SET} operation for both the
@@ -28,14 +28,11 @@ import com.gemstone.gemfire.cache.operations.OperationContext;
  * 
  * @since GemFire 5.5
  */
-public class KeySetOperationContext extends OperationContext {
+public class KeySetOperationContext extends ResourceOperationContext {
 
   /** 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.
    * 
@@ -43,33 +40,7 @@ public class KeySetOperationContext extends OperationContext {
    *                true to set the post-operation flag
    */
   public KeySetOperationContext(boolean 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;
+    super(Resource.DATA, OperationCode.KEY_SET, postOperation);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 415f842..1a92613 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,12 +54,9 @@ public abstract class KeyValueOperationContext extends KeyOperationContext {
    *                byte array
    * @since GemFire 6.5
    */
-  public KeyValueOperationContext(Object key, Object value,
-      boolean isObject) {
-    super(key);
+  protected KeyValueOperationContext(OperationCode code, Object key, Object value, boolean isObject) {
+    super(code, key);
     setValue(value,isObject);
-    //this.value = value;
-    // this.isObject = isObject;
   }
 
   /**
@@ -76,12 +73,9 @@ public abstract class KeyValueOperationContext extends KeyOperationContext {
    *                true if the context is at the time of sending updates
    * @since GemFire 6.5
    */
-  public KeyValueOperationContext(Object key, Object value,
-      boolean isObject, boolean postOperation) {
-    super(key, postOperation);
+  protected KeyValueOperationContext(OperationCode code, Object key, Object value, boolean isObject, boolean postOperation) {
+    super(code, key, postOperation);
     setValue(value,isObject);
-    //this.value = value;
-    //this.isObject = isObject;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 20b528c..ca0a549 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.WildcardPermission;
+import org.apache.shiro.authz.Permission;
 
 /**
  * Encapsulates a cache operation and the data associated with it for both the
@@ -30,16 +30,17 @@ import org.apache.shiro.authz.permission.WildcardPermission;
  *
  * @since GemFire 5.5
  */
-public abstract class OperationContext extends WildcardPermission{
-  public static String ALL_REGIONS="*";
+public interface OperationContext extends Permission {
 
-  public enum Resource {
+  String ALL_REGIONS = "*";
+
+  enum Resource {
     NULL,
     CLUSTER,
     DATA
-  };
+  }
 
-  public enum OperationCode {
+  enum OperationCode {
     @Deprecated
     GET,
     @Deprecated
@@ -298,13 +299,13 @@ public abstract class OperationContext extends WildcardPermission{
    * Return the operation code associated with the <code>OperationContext</code>
    * object.
    */
-  public abstract OperationCode getOperationCode();
+  OperationCode getOperationCode();
 
-  public Resource getResource(){
+  default Resource getResource() {
     return Resource.NULL;
   }
 
-  public String getRegionName(){
+  default String getRegionName() {
     return ALL_REGIONS;
   }
 
@@ -318,7 +319,7 @@ public abstract class OperationContext extends WildcardPermission{
    * context object in the pre-processing stage. In the post-processing stage
    * the context object shall contain results of the query.
    */
-  public abstract boolean isPostOperation();
+  boolean isPostOperation();
 
   /**
    * When called post-operation, returns true if the operation was one that performed an update.
@@ -329,7 +330,7 @@ public abstract class OperationContext extends WildcardPermission{
    *
    * @since GemFire 6.6
    */
-  public boolean isClientUpdate() {
+  default boolean isClientUpdate() {
     if (isPostOperation()) {
       switch (getOperationCode()) {
         case PUT:
@@ -350,7 +351,7 @@ public abstract class OperationContext extends WildcardPermission{
    * True if the context is created before sending the updates to a client.
    */
   @Deprecated
-  public boolean isClientUpdate(OperationContext context) {
+  default boolean isClientUpdate(OperationContext context) {
     OperationCode opCode = context.getOperationCode();
     return context.isPostOperation()
         && (opCode.isPut() || opCode.isPutAll() || opCode.isDestroy()
@@ -359,12 +360,4 @@ public abstract class OperationContext extends WildcardPermission{
         || 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/670fae4b/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 d8acba9..71c3c22 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.OperationContext;
+import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 import com.gemstone.gemfire.cache.operations.internal.UpdateOnlyMap;
 
 /**
@@ -28,14 +28,11 @@ import com.gemstone.gemfire.cache.operations.internal.UpdateOnlyMap;
  * 
  * @since GemFire 5.7
  */
-public class PutAllOperationContext extends OperationContext {
+public class PutAllOperationContext extends ResourceOperationContext {
 
   /** 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;
 
   /**
@@ -43,36 +40,11 @@ public class PutAllOperationContext extends OperationContext {
    * 
    */
   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/670fae4b/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 de24fd1..b24d838 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,10 +63,8 @@ public class PutOperationContext extends KeyValueOperationContext {
    *                byte array
    * @since GemFire 6.5
    */
-  public PutOperationContext(Object key,Object value,
-      boolean isObject) {
-    super(key, value, isObject);
-    this.opType = UNKNOWN;
+  public PutOperationContext(Object key,Object value, boolean isObject) {
+    this(key, value, isObject, false);
   }
 
   /**
@@ -83,10 +81,8 @@ 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) {
-    super(key, value, isObject, postOperation);
-    this.opType = UNKNOWN;
+  public PutOperationContext(Object key, Object value, boolean isObject, boolean postOperation) {
+    this(key, value, isObject, UNKNOWN, postOperation);
   }
 
   /**
@@ -106,24 +102,12 @@ 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(key, value, isObject, isPostOperation);
+  public PutOperationContext(Object key, Object value, boolean isObject, byte opType, boolean isPostOperation) {
+    super(OperationCode.PUT, 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/670fae4b/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 9113f79..bc774bc 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.OperationContext;
+import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 
 /**
  * Encapsulates a cache query operation for both the pre-operation and
@@ -27,7 +27,7 @@ import com.gemstone.gemfire.cache.operations.OperationContext;
  * 
  * @since GemFire 5.5
  */
-public class QueryOperationContext extends OperationContext {
+public class QueryOperationContext extends ResourceOperationContext {
 
   /** The query string of this query operation. */
   private String queryString;
@@ -38,73 +38,38 @@ public class QueryOperationContext extends OperationContext {
   /** 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) {
+  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);
     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(queryString, regionNames, postOperation);
+  public QueryOperationContext(String queryString, Set regionNames, boolean postOperation, Object[] queryParams) {
+    this(OperationCode.QUERY, 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() {
@@ -113,7 +78,7 @@ public class QueryOperationContext extends OperationContext {
 
   /**
    * Modify the query string.
-   * 
+   *
    * @param query
    *                the new query string for this query.
    */
@@ -124,7 +89,7 @@ public class QueryOperationContext extends OperationContext {
 
   /**
    * Get the names of regions that are part of the query string.
-   * 
+   *
    * @return names of regions being queried.
    */
   public Set getRegionNames() {
@@ -133,7 +98,7 @@ public class QueryOperationContext extends OperationContext {
 
   /**
    * Set the names of regions that are part of the query string.
-   * 
+   *
    * @param regionNames names of regions being queried
    */
   public void setRegionNames(Set regionNames) {
@@ -142,7 +107,7 @@ public class QueryOperationContext extends OperationContext {
 
   /**
    * Get the result of the query execution.
-   * 
+   *
    * @return result of the query.
    */
   public Object getQueryResult() {
@@ -151,7 +116,7 @@ public class QueryOperationContext extends OperationContext {
 
   /**
    * Set the result of query operation.
-   * 
+   *
    * @param queryResult
    *                the new result of the query operation.
    */
@@ -161,11 +126,10 @@ public class QueryOperationContext extends OperationContext {
 
   /**
    * 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/670fae4b/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 f3ac414..120584e 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,18 +33,6 @@ public class RegionClearOperationContext extends RegionOperationContext {
    *                true to set the post-operation flag
    */
   public RegionClearOperationContext(boolean postOperation) {
-    super(postOperation);
+    super(OperationCode.REGION_CLEAR, 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/670fae4b/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 4b92ae9..6985d91 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,16 +17,15 @@
 
 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 OperationContext {
-
-  /** True if this is a post-operation context */
-  private boolean postOperation;
+public class RegionCreateOperationContext extends ResourceOperationContext {
 
   /**
    * Constructor for the region creation operation.
@@ -35,26 +34,7 @@ public class RegionCreateOperationContext extends OperationContext {
    *                true to set the post-operation flag
    */
   public RegionCreateOperationContext(boolean 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;
+    super(Resource.DATA, OperationCode.REGION_CREATE, postOperation);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 b2d19c1..c4b7375 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,18 +33,7 @@ public class RegionDestroyOperationContext extends RegionOperationContext {
    *                true to set the post-operation flag
    */
   public RegionDestroyOperationContext(boolean 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;
+    super(OperationCode.REGION_DESTROY, postOperation);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 c631a78..4c41cdc 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,6 +18,8 @@
 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
@@ -26,42 +28,20 @@ package com.gemstone.gemfire.cache.operations;
  * 
  * @since GemFire 5.5
  */
-public abstract class RegionOperationContext extends OperationContext {
+public abstract class RegionOperationContext 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 a region operation.
    * 
    * @param postOperation
    *                true to set the post-operation flag
    */
-  public RegionOperationContext(boolean postOperation) {
+  protected RegionOperationContext(OperationCode code, boolean postOperation) {
+    super(Resource.DATA, code, 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/670fae4b/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 f5cda63..78cc533 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,22 +43,11 @@ public class RegisterInterestOperationContext extends InterestOperationContext {
    */
   public RegisterInterestOperationContext(Object key,
       InterestType interestType, InterestResultPolicy policy) {
-    super(key, interestType);
+    super(OperationCode.REGISTER_INTEREST, 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/670fae4b/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 c33d85d..3c0a51c 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.OperationContext;
+import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 
 /**
  * Encapsulates a {@link com.gemstone.gemfire.cache.operations.OperationContext.OperationCode#REMOVEALL} operation for both the
@@ -28,14 +28,11 @@ import com.gemstone.gemfire.cache.operations.OperationContext;
  * 
  * @since GemFire 8.1
  */
-public class RemoveAllOperationContext extends OperationContext {
+public class RemoveAllOperationContext extends ResourceOperationContext {
 
   /** 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;
 
   /**
@@ -43,36 +40,11 @@ public class RemoveAllOperationContext extends OperationContext {
    * 
    */
   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/670fae4b/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 eae3ec5..5cc4f69 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,28 +38,8 @@ 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(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;
+  public StopCQOperationContext(String cqName, String queryString, Set regionNames) {
+    super(OperationCode.STOP_CQ, cqName, queryString, regionNames, false);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 868d455..076712c 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,18 +36,7 @@ public class UnregisterInterestOperationContext extends InterestOperationContext
    */
   public UnregisterInterestOperationContext(Object key,
       InterestType 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;
+    super(OperationCode.UNREGISTER_INTEREST, key, interestType);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 f664061..6096c53 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,9 +32,15 @@ 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(key, postOperation);
+    super(OperationCode.GET, key, postOperation);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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
new file mode 100644
index 0000000..636af05
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/internal/ResourceOperationContext.java
@@ -0,0 +1,128 @@
+/*
+ * 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/670fae4b/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 14b81a1..e08e6e3 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.setIsPostOperation(true);
+      this.authContext.setPostOperation();
       this.authContext = authzRequestPP.executeFunctionAuthorize(oneResult,
           this.authContext);
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 da2fcc7..0ced75a 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,18 +34,7 @@ public class ContainsKeyOperationContext extends KeyOperationContext {
    *                the key for this operation
    */
   public ContainsKeyOperationContext(Object 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;
+    super(OperationCode.CONTAINS_KEY, key);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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 3a80e25..4635d55 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,7 +31,6 @@ 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;
@@ -65,7 +64,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,
@@ -89,7 +88,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/670fae4b/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 838bfc6..6f9079d 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.management.internal.security.ResourceOperationContext;
+import com.gemstone.gemfire.cache.operations.internal.ResourceOperationContext;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 import com.gemstone.gemfire.security.NotAuthorizedException;
@@ -192,34 +192,29 @@ public class GeodeSecurityUtil {
 
   private static void authorize(String resource, String operation, String regionName){
     regionName = StringUtils.stripStart(regionName, "/");
-    authorize(new ResourceOperationContext(resource, operation, regionName));
+    authorize(new ResourceOperationContext(resource, operation, regionName, false));
   }
 
   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;
@@ -230,30 +225,27 @@ 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/670fae4b/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 fff008f..7e7a928 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,11 +89,12 @@ 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);
   }
@@ -139,8 +140,7 @@ 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/670fae4b/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 efbc1f1..8541295 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,6 +44,7 @@ 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;
@@ -256,7 +257,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);
+      return new ResourceOperationContext(resource, operationCode, null, false);
     }
     return defaultValue;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/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
deleted file mode 100644
index 99da1f1..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java
+++ /dev/null
@@ -1,85 +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.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/670fae4b/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
new file mode 100644
index 0000000..46ad79f
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/operations/OperationPartsJUnitTest.java
@@ -0,0 +1,195 @@
+/*
+ * 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());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/670fae4b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java
index 822dc47..cb67f48 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ExampleJSONAuthorization.java
@@ -19,6 +19,7 @@ package com.gemstone.gemfire.management.internal.security;
 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.security.AccessControl;
@@ -119,10 +120,10 @@ public class ExampleJSONAuthorization implements AccessControl, Authenticator {
       for (int j = 0; j < ops.length(); j++) {
         String[] parts = ops.getString(j).split(":");
         if(regionNames!=null) {
-          role.permissions.add(new ResourceOperationContext(parts[0], parts[1], regionNames));
+          role.permissions.add(new ResourceOperationContext(parts[0], parts[1], regionNames, false));
         }
         else
-          role.permissions.add(new ResourceOperationContext(parts[0], parts[1], "*"));
+          role.permissions.add(new ResourceOperationContext(parts[0], parts[1], "*", false));
       }
 
       roleMap.put(role.name, role);