geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [49/50] [abbrv] incubator-geode git commit: Merge branch 'develop' into feature/GEODE-17
Date Thu, 25 Feb 2016 20:27:37 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5c01d5f4/geode-core/build.gradle
----------------------------------------------------------------------
diff --cc geode-core/build.gradle
index 0000000,1aa07ee..5a79c7c
mode 000000,100755..100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@@ -1,0 -1,204 +1,217 @@@
+ /*
+  * 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.
+  */
+ 
+ sourceSets {
+   jca {
+     compileClasspath += configurations.compile
+     runtimeClasspath += configurations.runtime
+   }
+ }
+ 
+ configurations {
+   //declaring new configuration that will be used to associate with artifacts
+   archives
+ }
+ 
+ dependencies {
+    // Source Dependencies
+   // External 
+   provided files("${System.getProperty('java.home')}/../lib/tools.jar")
+   compile 'org.jgroups:jgroups:3.6.7.Final'
+   compile 'antlr:antlr:' + project.'antlr.version'
+   compile 'com.fasterxml.jackson.core:jackson-annotations:' + project.'jackson.version'
+   compile 'com.fasterxml.jackson.core:jackson-core:' + project.'jackson.version'
+   compile 'com.fasterxml.jackson.core:jackson-databind:' + project.'jackson.version'
+   provided 'com.google.guava:guava:' + project.'guava.version'
+   compile 'commons-io:commons-io:' + project.'commons-io.version'
+   compile 'commons-lang:commons-lang:' + project.'commons-lang.version'
+   compile 'commons-logging:commons-logging:' + project.'commons-logging.version'
+   compile 'commons-modeler:commons-modeler:' + project.'commons-modeler.version'
+   compile 'io.netty:netty-all:' + project.'netty-all.version'
+   compile 'it.unimi.dsi:fastutil:' + project.'fastutil.version'
+   compile 'javax.activation:activation:' + project.'activation.version'
+   compile 'javax.mail:javax.mail-api:' + project.'javax.mail-api.version'
+   compile 'javax.resource:javax.resource-api:' + project.'javax.resource-api.version'
+   compile 'javax.servlet:javax.servlet-api:' + project.'javax.servlet-api.version'
+   compile 'javax.transaction:javax.transaction-api:' + project.'javax.transaction-api.version'
+   compile 'mx4j:mx4j:' + project.'mx4j.version'
+   compile 'mx4j:mx4j-remote:' + project.'mx4j.version'
+   compile 'mx4j:mx4j-tools:' + project.'mx4j.version'
+   compile 'net.java.dev.jna:jna:' + project.'jna.version'
+   compile 'jline:jline:' + project.'jline.version'
+   provided 'org.apache.hadoop:hadoop-common:' + project.'hadoop.version'
+   provided 'org.apache.hadoop:hadoop-annotations:' + project.'hadoop.version'
+   provided 'org.apache.hadoop:hadoop-hdfs:' + project.'hadoop.version'
+   provided 'org.apache.hadoop:hadoop-mapreduce-client-core:' + project.'hadoop.version'
+   compile 'org.apache.hbase:hbase:' + project.'hbase.version'
+   compile 'org.apache.logging.log4j:log4j-api:' + project.'log4j.version'
+   compile 'org.apache.logging.log4j:log4j-core:' + project.'log4j.version'
+   runtime 'org.apache.logging.log4j:log4j-slf4j-impl:' + project.'log4j.version'
+   runtime 'org.apache.logging.log4j:log4j-jcl:' + project.'log4j.version'
+   runtime 'org.apache.logging.log4j:log4j-jul:' + project.'log4j.version'
+   compile 'org.eclipse.jetty:jetty-http:' + project.'jetty.version'
+   compile 'org.eclipse.jetty:jetty-io:' + project.'jetty.version'
+   compile 'org.eclipse.jetty:jetty-security:' + project.'jetty.version'
+   compile 'org.eclipse.jetty:jetty-server:' + project.'jetty.version'
+   compile 'org.eclipse.jetty:jetty-servlet:' + project.'jetty.version'
+   compile 'org.eclipse.jetty:jetty-util:' + project.'jetty.version'
+   compile 'org.eclipse.jetty:jetty-webapp:' + project.'jetty.version'
+   compile 'org.eclipse.jetty:jetty-xml:' + project.'jetty.version'
+   compile 'org.fusesource.jansi:jansi:' + project.'jansi.version'
+   compile 'org.slf4j:slf4j-api:' + project.'slf4j-api.version'
+   compile 'org.springframework.data:spring-data-commons:' + project.'spring-data-commons.version'
+   provided 'org.springframework.data:spring-data-gemfire:' + project.'spring-data-gemfire.version'
+   compile 'org.springframework:spring-tx:' + project.'springframework.version'
+   compile 'org.springframework.shell:spring-shell:' + project.'spring-shell.version'
+   compile 'org.xerial.snappy:snappy-java:' + project.'snappy-java.version'
+   compile 'org.apache.hbase:hbase:' + project.'hbase.version'
+  
+   compile project(':geode-common')
+   compile project(':geode-joptsimple')
+   compile project(':geode-json')
+   
+   jcaCompile sourceSets.main.output
+ 
+   testCompile project(':geode-junit')
+ 
+   // Test Dependencies
+   // External
+   testCompile 'org.apache.bcel:bcel:' + project.'bcel.version'
+   testRuntime 'org.apache.derby:derby:' + project.'derby.version'
+   testRuntime 'org.apache.hadoop:hadoop-auth:' + project.'hadoop.version'
+   testCompile 'org.mockito:mockito-core:' + project.'mockito-core.version'
+   testRuntime 'commons-collections:commons-collections:' + project.'commons-collections.version'
+   testRuntime 'commons-configuration:commons-configuration:' + project.'commons-configuration.version'
+   testRuntime 'commons-io:commons-io:' + project.'commons-io.version'
+   testCompile 'net.spy:spymemcached:' + project.'spymemcached.version'
+   testCompile 'redis.clients:jedis:' + project.'jedis.version'
+ 
+   testCompile 'org.powermock:powermock-core:' + project.'powermock.version'
+   testCompile 'org.powermock:powermock-module-junit4:' + project.'powermock.version'
+   testCompile 'org.powermock:powermock-api-mockito:' + project.'powermock.version'
+ }
+ 
+ def generatedResources = "$buildDir/generated-resources/main"
+ 
+ sourceSets {
+   main {
+     output.dir(generatedResources, builtBy: 'createVersionPropertiesFile')
+   }
+ }
+  
+ // Creates the version properties file and writes it to the classes dir
+ task createVersionPropertiesFile {
+   def propertiesFile = file(generatedResources + "/com/gemstone/gemfire/internal/GemFireVersion.properties");
+   outputs.file propertiesFile
+   inputs.dir compileJava.destinationDir
+ 
+   doLast {
+ 
+     try {
+       def grgit = org.ajoberstar.grgit.Grgit.open(currentDir: projectDir)
+       ext.branch = grgit.branch.getCurrent().name
+       ext.commitId = grgit.head().id
+       ext.sourceDate = grgit.head().getDate().format('yyyy-MM-dd HH:mm:ss Z')
+       grgit.close()
+     } catch (Exception e) {
+       logger.warn( '***** Unable to find Git workspace. Using default version information
*****' )
+       ext.branch = 'UNKNOWN'
+       ext.commitId = 'UNKNOWN'
+       ext.sourceDate = new Date().format('yyyy-MM-dd HH:mm:ss Z')
+     }
+ 
+     ext.osArch = System.getProperty('os.arch')
+     ext.osName = System.getProperty('os.name')
+     ext.osVersion = System.getProperty('os.version')
+     ext.buildDate = new Date().format('yyyy-MM-dd HH:mm:ss Z')
+     ext.buildNumber = new Date().format('MMddyy')
+     ext.jdkVersion = System.getProperty('java.version')
+ 
+     def props = [
+       "Product-Name"      : "Apache Geode (incubating)",
+       "Product-Version"   : version,
+       "Build-Id"          : System.env.USER + ' ' + ext.buildNumber,
+       "Build-Date"        : ext.buildDate,
+       "Build-Platform"    : ext.osName + ' ' + ext.osVersion + ' ' + ext.osArch,
+       "Build-Java-Version": ext.jdkVersion,
+       "Source-Date"       : ext.sourceDate,
+       "Source-Revision"   : ext.commitId,
+       "Source-Repository" : ext.branch
+     ] as Properties
+ 
+     propertiesFile.getParentFile().mkdirs();
+     new FileOutputStream(propertiesFile).withStream { fos ->
+       props.store(fos, '')
+     }
+   }
+ }
+ 
+ jar {
+ 
+   from sourceSets.main.output
+   from sourceSets.jca.output
+   
+   exclude 'com/gemstone/gemfire/management/internal/web/**'
+   exclude 'com/gemstone/gemfire/internal/i18n/StringIdResourceBundle_ja.txt'
+   exclude 'com/gemstone/gemfire/admin/doc-files/ds4_0.dtd'
+ }
+ 
+ task webJar (type: Jar, dependsOn: classes) {
+   description 'Assembles the jar archive containing the gemfire management web classes.'
+   from sourceSets.main.output
+   baseName 'geode-web'
+   include 'com/gemstone/gemfire/management/internal/web/**'
+ }
+ 
+ task raJar (type: Jar, dependsOn: classes) {
+   description 'Assembles the jar archive that contains the JCA classes'
+   from sourceSets.jca.output
+   exclude 'com/gemstone/gemfire/ra/**'
+   archiveName 'ra.jar'
+ }
+ 
+ task jcaJar (type: Jar, dependsOn: raJar) {
+   description 'Assembles the jar archive that contains the JCA bundle'
+   baseName 'geode-jca'
+   extension 'rar'
+   metaInf { from 'src/jca/ra.xml' }
+   from raJar.archivePath
+ }
+ 
+ configurations {
+   classesOutput {
+     extendsFrom compile
+     description  'a dependency that exposes the compiled classes'
+   }
+ }
+ 
+ dependencies {
+   classesOutput sourceSets.main.output
+ }
++
++test {  
++  def assemblyPath = project(':gemfire-assembly').buildDir
++  def distributionBaseName = "apache-geode"
++  environment 'GEMFIRE', "$assemblyPath/install/${distributionBaseName}"
++}
++
++distributedTest {  
++  def assemblyPath = project(':gemfire-assembly').buildDir
++  def distributionBaseName = "apache-geode"
++  environment 'GEMFIRE', "$assemblyPath/install/${distributionBaseName}"
++}
++

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5c01d5f4/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
----------------------------------------------------------------------
diff --cc geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
index 0000000,5cae85d..ab3607f
mode 000000,100644..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
@@@ -1,0 -1,521 +1,587 @@@
+ /*
+  * 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 java.util.HashMap;
+ import java.util.Map;
+ 
+ import com.gemstone.gemfire.cache.Cache;
+ import com.gemstone.gemfire.cache.Region;
+ 
+ /**
+  * Encapsulates a cache operation and the data associated with it for both the
+  * pre-operation and post-operation cases. Implementations for specific
+  * operations will extend this with the specifics as required e.g. a getKey()
+  * method for a GET operation. Implementations for all the cache operations that
+  * require authorization are provided.
+  * 
+  * Implementations of this interface are <b>not</b> expected to be thread-safe.
+  * 
+  * @author Sumedh Wale
+  * @since 5.5
+  */
+ public abstract class OperationContext {
+ 
+   /**
+    * Enumeration for various cache operations. Implementations for each of the
+    * supported operation listed here are provided.
+    * 
+    * @author Sumedh Wale
+    * @since 5.5
+    */
+   public static final class OperationCode {
+ 
+     private static final byte OP_GET = 1;
+ 
+     private static final byte OP_PUT = 2;
+ 
+     private static final byte OP_DESTROY = 3;
+ 
+     private static final byte OP_INVALIDATE = 4;
+ 
+     private static final byte OP_REGISTER_INTEREST = 5;
+ 
+     private static final byte OP_UNREGISTER_INTEREST = 6;
+ 
+     private static final byte OP_CONTAINS_KEY = 7;
+ 
+     private static final byte OP_KEY_SET = 8;
+ 
+     private static final byte OP_QUERY = 9;
+ 
+     private static final byte OP_EXECUTE_CQ = 10;
+ 
+     private static final byte OP_STOP_CQ = 11;
+ 
+     private static final byte OP_CLOSE_CQ = 12;
+ 
+     private static final byte OP_REGION_CLEAR = 13;
+ 
+     private static final byte OP_REGION_CREATE = 14;
+ 
+     private static final byte OP_REGION_DESTROY = 15;
+     
+     private static final byte OP_PUTALL = 16;
+     
+     private static final byte OP_EXECUTE_FUNCTION = 17;
+     
+     private static final byte OP_GET_DURABLE_CQS = 18;
+     
+     private static final byte OP_REMOVEALL = 19;
+     
++    /**
++    @since Geode 1.0
++    */
+     private static final byte OP_RESOURCE = 20;
+     
 -    private static final OperationCode[] VALUES = new OperationCode[22];
++    private static final byte OP_LIST = 21;
++    
++    private static final byte OP_CREATE_QUERY = 22;
++
++    private static final byte OP_UPDATE_QUERY = 23;
++
++    private static final byte OP_DELETE_QUERY = 24;
++    
++    private static final OperationCode[] VALUES = new OperationCode[25];
+ 
+     private static final Map OperationNameMap = new HashMap();
+ 
+     /**
++     * A LIST operation.
++     * LIST regions, registered functions, named queries in DS. 
++     */
++    public static final OperationCode LIST = new OperationCode(
++        "LIST", OP_LIST);
++    
++    /**
++     * A create parameterized query operation with developer REST APIs. 
++     */
++    public static final OperationCode CREATE_QUERY = new OperationCode(
++        "CREATE_QUERY", OP_CREATE_QUERY);
++    
++    /**
++     * A update parameterized query operation with developer REST APIs. 
++     */
++    public static final OperationCode UPDATE_QUERY = new OperationCode(
++        "UPDATE_QUERY", OP_UPDATE_QUERY);
++    
++    /**
++     * A delete parameterized query operation with developer REST APIs. 
++     */
++    public static final OperationCode DELETE_QUERY = new OperationCode(
++        "DELETE_QUERY", OP_DELETE_QUERY);
++    
++    /**
+      * An entry get operation.
+      * 
+      * @see Region#get(Object)
+      */
+     public static final OperationCode GET = new OperationCode("GET", OP_GET);
+ 
+     /**
+      * An entry create/update operation.
+      * 
+      * @see Region#put(Object, Object)
+      */
+     public static final OperationCode PUT = new OperationCode("PUT", OP_PUT);
+ 
+     /**
+      * An map putAll operation.
+      * 
+      * @see Region#putAll(Map map)
+      */
+     public static final OperationCode PUTALL = new OperationCode("PUTALL", OP_PUTALL);
+     
+     /**
+      * A region removeAll operation.
+      * 
+      * @see Region#removeAll(java.util.Collection)
+      * @since 8.1
+      */
+     public static final OperationCode REMOVEALL = new OperationCode("REMOVEALL", OP_REMOVEALL);
+     
+     /**
+      * An entry destroy operation.
+      * 
+      * @see Region#destroy(Object, Object)
+      */
+     public static final OperationCode DESTROY = new OperationCode("DESTROY",
+         OP_DESTROY);
+ 
+     /**
+      * An entry invalidate operation.
+      * 
+      * @see Region#invalidate(Object, Object)
+      */
+     public static final OperationCode INVALIDATE = new OperationCode(
+         "INVALIDATE", OP_INVALIDATE);
+ 
+     /**
+      * A register interest operation.
+      * 
+      * @see Region#registerInterest(Object)
+      */
+     public static final OperationCode REGISTER_INTEREST = new OperationCode(
+         "REGISTER_INTEREST", OP_REGISTER_INTEREST);
+ 
+     /**
+      * An unregister interest operation.
+      * 
+      * @see Region#unregisterInterest
+      */
+     public static final OperationCode UNREGISTER_INTEREST = new OperationCode(
+         "UNREGISTER_INTEREST", OP_UNREGISTER_INTEREST);
+ 
+     /**
+      * A region <code>containsKey</code> operation.
+      * 
+      * @see Region#containsKey
+      */
+     public static final OperationCode CONTAINS_KEY = new OperationCode(
+         "CONTAINS_KEY", OP_CONTAINS_KEY);
+ 
+     /**
+      * A region <code>keySet</code> operation.
+      * 
+      * @see Region#keySet
+      */
+     public static final OperationCode KEY_SET = new OperationCode("KEY_SET",
+         OP_KEY_SET);
+ 
+     /**
+      * A cache query operation.
+      * 
+      * @see Region#query
+      */
+     public static final OperationCode QUERY = new OperationCode("QUERY",
+         OP_QUERY);
+ 
+     /**
+      * A continuous query execution operation.
+      */
+     public static final OperationCode EXECUTE_CQ = new OperationCode(
+         "EXECUTE_CQ", OP_EXECUTE_CQ);
+ 
+     /**
+      * A continuous query stop operation.
+      */
+     public static final OperationCode STOP_CQ = new OperationCode("STOP_CQ",
+         OP_STOP_CQ);
+ 
+     /**
+      * A continuous query close operation.
+      */
+     public static final OperationCode CLOSE_CQ = new OperationCode("CLOSE_CQ",
+         OP_CLOSE_CQ);
+ 
+     /**
+      * A region clear operation.
+      * 
+      * @see Region#clear
+      */
+     public static final OperationCode REGION_CLEAR = new OperationCode(
+         "REGION_CLEAR", OP_REGION_CLEAR);
+ 
+     /**
+      * A region create operation.
+      * 
+      * @see Region#createSubregion
+      * @see Cache#createRegion
+      */
+     public static final OperationCode REGION_CREATE = new OperationCode(
+         "REGION_CREATE", OP_REGION_CREATE);
+ 
+     /**
+      * A region destroy operation.
+      * 
+      * @see Region#destroyRegion(Object)
+      */
+     public static final OperationCode REGION_DESTROY = new OperationCode(
+         "REGION_DESTROY", OP_REGION_DESTROY);
+     
+     /**
+      * A function execution operation
+      */
+     public static final OperationCode EXECUTE_FUNCTION = new OperationCode(
+         "EXECUTE_FUNCTION", OP_EXECUTE_FUNCTION);
+     
+     /**
+      * A get durable continuous query operation
+      */
+     public static final OperationCode GET_DURABLE_CQS = new OperationCode(
+         "GET_DURABLE_CQS", OP_GET_DURABLE_CQS);
+     
+     
+     /**
 -     * A resource operation. See ResourceOperationContext for more details
++     * A resource operation 
++     * 
++     * @since Geode 1.0
+      */
+     public static final OperationCode RESOURCE = new OperationCode(
+         "RESOURCE", OP_RESOURCE);
+ 
+     /** The name of this operation. */
+     private final String name;
+ 
+     /**
+      * One of the following: OP_GET, OP_CREATE, OP_UPDATE, OP_INVALIDATE,
+      * OP_DESTROY, OP_REGISTER_INTEREST, OP_REGISTER_INTEREST_REGEX,
+      * OP_UNREGISTER_INTEREST, OP_UNREGISTER_INTEREST_REGEX, OP_QUERY,
+      * OP_REGION_CREATE, OP_REGION_DESTROY, OP_PUTALL
+      */
+     private final byte opCode;
+ 
+     /** Creates a new instance of Operation. */
+     private OperationCode(String name, byte opCode) {
+       this.name = name;
+       this.opCode = opCode;
+       VALUES[opCode] = this;
+       OperationNameMap.put(name, this);
+     }
++    
++    /**
++     * Returns true if this is a list operation for regions, functions and queries.
++     */
++    public boolean isList() {
++      return (this.opCode == OP_LIST);
++    }
++    
++    /**
++     * Returns true if this is a create named query operation.
++     */
++    public boolean isCreateQuery() {
++      return (this.opCode == OP_CREATE_QUERY);
++    }
+ 
+     /**
++     * Returns true if this is a update named query operation.
++     */
++    public boolean isUpdateQuery() {
++      return (this.opCode == OP_UPDATE_QUERY);
++    }
++    
++    /**
++     * Returns true if this is a delete named query operation.
++     */
++    public boolean isDestroyQuery() {
++      return (this.opCode == OP_DELETE_QUERY);
++    }
++    
++    /**
+      * Returns true if this is a entry get operation.
+      */
+     public boolean isGet() {
+       return (this.opCode == OP_GET);
+     }
+ 
+     /**
+      * Returns true if this is a entry create/update operation.
+      */
+     public boolean isPut() {
+       return (this.opCode == OP_PUT);
+     }
+     
+     /**
+      * Returns true if this is a map putAll operation.
+      */
+     public boolean isPutAll() {
+       return (this.opCode == OP_PUTALL);
+     }
+     
+     /**
+      * Returns true if this is a region removeAll operation.
+      * @since 8.1
+      */
+     public boolean isRemoveAll() {
+       return (this.opCode == OP_REMOVEALL);
+     }
+ 
+     /**
+      * Returns true if this is an entry destroy operation.
+      */
+     public boolean isDestroy() {
+       return (this.opCode == OP_DESTROY);
+     }
+ 
+     /**
+      * Returns true if this is an entry invalidate operation.
+      */
+     public boolean isInvalidate() {
+       return (this.opCode == OP_INVALIDATE);
+     }
+ 
+     /**
+      * Returns true if this is a register interest operation.
+      */
+     public boolean isRegisterInterest() {
+       return (this.opCode == OP_REGISTER_INTEREST);
+     }
+ 
+     /**
+      * Returns true if this is an unregister interest operation.
+      */
+     public boolean isUnregisterInterest() {
+       return (this.opCode == OP_UNREGISTER_INTEREST);
+     }
+ 
+     /**
+      * Returns true if this is a region <code>containsKey</code> operation.
+      */
+     public boolean isContainsKey() {
+       return (this.opCode == OP_CONTAINS_KEY);
+     }
+ 
+     /**
+      * Returns true if this is a region <code>keySet</code> operation.
+      */
+     public boolean isKeySet() {
+       return (this.opCode == OP_KEY_SET);
+     }
+ 
+     /**
+      * Returns true if this is a cache query operation.
+      */
+     public boolean isQuery() {
+       return (this.opCode == OP_QUERY);
+     }
+ 
+     /**
+      * Returns true if this is a continuous query execution operation.
+      */
+     public boolean isExecuteCQ() {
+       return (this.opCode == OP_EXECUTE_CQ);
+     }
+ 
+     /**
+      * Returns true if this is a continuous query stop operation.
+      */
+     public boolean isStopCQ() {
+       return (this.opCode == OP_STOP_CQ);
+     }
+ 
+     /**
+      * Returns true if this is a continuous query close operation.
+      */
+     public boolean isCloseCQ() {
+       return (this.opCode == OP_CLOSE_CQ);
+     }
+ 
+     /**
+      * Returns true if this is a region clear operation.
+      */
+     public boolean isRegionClear() {
+       return (this.opCode == OP_REGION_CLEAR);
+     }
+ 
+     /**
+      * Returns true if this is a region create operation.
+      */
+     public boolean isRegionCreate() {
+       return (this.opCode == OP_REGION_CREATE);
+     }
+ 
+     /**
+      * Returns true if this is a region destroy operation.
+      */
+     public boolean isRegionDestroy() {
+       return (this.opCode == OP_REGION_DESTROY);
+     }
+     
+     /**
+      * Returns true if this is a execute region function operation.
+      */
+     public boolean isExecuteRegionFunction() {
+       return (this.opCode == OP_EXECUTE_FUNCTION);
+     }
+ 
+     /**
+      * Returns true if this is a get durable cqs operation.
+      */
+     public boolean isGetDurableCQs() {
+       return (this.opCode == OP_GET_DURABLE_CQS);
+     }
+     
+     /**
+      * Returns the <code>OperationCode</code> represented by specified byte.
+      */
+     public static OperationCode fromOrdinal(byte opCode) {
+       return VALUES[opCode];
+     }
+ 
+     /**
+      * Returns the <code>OperationCode</code> represented by specified string.
+      */
+     public static OperationCode parse(String operationName) {
+       return (OperationCode)OperationNameMap.get(operationName);
+     }
+ 
+     /**
+      * Returns the byte representing this operation code.
+      * 
+      * @return a byte representing this operation.
+      */
+     public byte toOrdinal() {
+       return this.opCode;
+     }
+ 
+     /**
+      * Returns a string representation for this operation.
+      * 
+      * @return the name of this operation.
+      */
+     @Override
+     final public String toString() {
+       return this.name;
+     }
+ 
+     /**
+      * Indicates whether other object is same as this one.
+      * 
+      * @return true if other object is same as this one.
+      */
+     @Override
+     final public boolean equals(final Object obj) {
+       if (obj == this) {
+         return true;
+       }
+       if (!(obj instanceof OperationCode)) {
+         return false;
+       }
+       final OperationCode other = (OperationCode)obj;
+       return (other.opCode == this.opCode);
+     }
+ 
+     /**
+      * Indicates whether other <code>OperationCode</code> is same as this one.
+      * 
+      * @return true if other <code>OperationCode</code> is same as this one.
+      */
+     final public boolean equals(final OperationCode opCode) {
+       return (opCode != null && opCode.opCode == this.opCode);
+     }
+ 
+     /**
+      * Returns a hash code value for this <code>OperationCode</code> which is
+      * the same as the byte representing its operation type.
+      * 
+      * @return the hashCode of this operation.
+      */
+     @Override
+     final public int hashCode() {
+       return this.opCode;
+     }
+ 
+   }
+ 
+   /**
+    * Return the operation code associated with the <code>OperationContext</code>
+    * object.
+    */
+   public abstract OperationCode getOperationCode();
+ 
+   /**
+    * True if the context is for post-operation.
+    * 
+    * The <code>OperationContext</code> interface encapsulates the data both
+    * before the operation is performed and after the operation is complete. For
+    * example, for a query operation the <code>Query</code> object as well as
+    * the list of region names referenced by the query would be part of the
+    * 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();
+ 
+   /**
+    * When called post-operation, returns true if the operation was one that performed an
update.
+    * An update occurs when one of the following methods on <code>getOperationCode()</code>
returns true:
+    * <code>isPut()</code>, <code>isPutAll()</code>, <code>isDestroy()</code>,
<code>isRemoveAll()</code>,
+    * <code>isInvalidate()</code>, <code>isRegionCreate()</code>,
<code>isRegionClear()</code>, <code>isRegionDestroy()</code>.
+    * Otherwise, returns false.
+    * 
+    * @since 6.6
+    */
+   public boolean isClientUpdate() {
+     if (isPostOperation()) {
+       switch (getOperationCode().opCode) {
+         case OperationCode.OP_PUT:
+         case OperationCode.OP_PUTALL:
+         case OperationCode.OP_DESTROY:
+         case OperationCode.OP_REMOVEALL:
+         case OperationCode.OP_INVALIDATE:
+         case OperationCode.OP_REGION_CREATE:
+         case OperationCode.OP_REGION_DESTROY:
+         case OperationCode.OP_REGION_CLEAR:
+           return true;
+       }
+     }
+     return false;
+   }
+ 
+   /**
+    * True if the context is created before sending the updates to a client.
+    */
+   @Deprecated
+   public boolean isClientUpdate(OperationContext context) {
+     OperationCode opCode = context.getOperationCode();
+     return context.isPostOperation()
+         && (opCode.isPut() || opCode.isPutAll() || opCode.isDestroy()
+             || opCode.isRemoveAll()
+             || opCode.isInvalidate() || opCode.isRegionCreate()
+             || opCode.isRegionDestroy() || opCode.isRegionClear());
+   }
+ }


Mime
View raw message