You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2016/04/21 00:29:24 UTC
[2/6] incubator-geode git commit: Implementing the UDA functionality
in the OQL engine
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/OQLParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/OQLParser.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/OQLParser.java
index bb70b05..1ae0f9e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/OQLParser.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/OQLParser.java
@@ -1,4 +1,4 @@
-// $ANTLR 2.7.4: "oql.g" -> "OQLParser.java"$
+// $ANTLR 2.7.7 (20060906): "oql.g" -> "OQLParser.java"$
package com.gemstone.gemfire.cache.query.internal.parse;
import java.util.*;
@@ -293,7 +293,7 @@ public OQLParser(ParserSharedInputState state) {
synPredMatched153 = false;
}
rewind(_m153);
- inputState.guessing--;
+inputState.guessing--;
}
if ( synPredMatched153 ) {
identifier();
@@ -1644,7 +1644,7 @@ public OQLParser(ParserSharedInputState state) {
expr();
astFactory.addASTChild(currentAST, returnAST);
{
- _loop268:
+ _loop269:
do {
if ((LA(1)==TOK_COMMA)) {
match(TOK_COMMA);
@@ -1652,7 +1652,7 @@ public OQLParser(ParserSharedInputState state) {
astFactory.addASTChild(currentAST, returnAST);
}
else {
- break _loop268;
+ break _loop269;
}
} while (true);
@@ -1766,7 +1766,7 @@ public OQLParser(ParserSharedInputState state) {
synPredMatched183 = false;
}
rewind(_m183);
- inputState.guessing--;
+inputState.guessing--;
}
if ( synPredMatched183 ) {
lp = LT(1);
@@ -1947,7 +1947,7 @@ public OQLParser(ParserSharedInputState state) {
synPredMatched195 = false;
}
rewind(_m195);
- inputState.guessing--;
+inputState.guessing--;
}
if ( synPredMatched195 ) {
AST tmp99_AST = null;
@@ -2594,17 +2594,6 @@ public OQLParser(ParserSharedInputState state) {
{
switch ( LA(1)) {
- case LITERAL_distinct:
- case LITERAL_listtoset:
- case LITERAL_element:
- case LITERAL_flatten:
- case LITERAL_nvl:
- case LITERAL_to_date:
- {
- conversionExpr();
- astFactory.addASTChild(currentAST, returnAST);
- break;
- }
case LITERAL_exists:
case LITERAL_first:
case LITERAL_last:
@@ -2688,46 +2677,51 @@ public OQLParser(ParserSharedInputState state) {
break;
}
default:
- boolean synPredMatched246 = false;
- if (((LA(1)==QuotedIdentifier||LA(1)==Identifier) && (LA(2)==TOK_LPAREN))) {
- int _m246 = mark();
- synPredMatched246 = true;
- inputState.guessing++;
- try {
- {
- identifier();
- match(TOK_LPAREN);
- identifier();
- match(TOK_COLON);
+ if ((_tokenSet_28.member(LA(1))) && (LA(2)==TOK_LPAREN)) {
+ conversionExpr();
+ astFactory.addASTChild(currentAST, returnAST);
+ }
+ else {
+ boolean synPredMatched246 = false;
+ if (((LA(1)==QuotedIdentifier||LA(1)==Identifier) && (LA(2)==TOK_LPAREN))) {
+ int _m246 = mark();
+ synPredMatched246 = true;
+ inputState.guessing++;
+ try {
+ {
+ identifier();
+ match(TOK_LPAREN);
+ identifier();
+ match(TOK_COLON);
+ }
+ }
+ catch (RecognitionException pe) {
+ synPredMatched246 = false;
}
+ rewind(_m246);
+inputState.guessing--;
}
- catch (RecognitionException pe) {
- synPredMatched246 = false;
+ if ( synPredMatched246 ) {
+ objectConstruction();
+ astFactory.addASTChild(currentAST, returnAST);
}
- rewind(_m246);
- inputState.guessing--;
- }
- if ( synPredMatched246 ) {
- objectConstruction();
- astFactory.addASTChild(currentAST, returnAST);
- }
- else if ((LA(1)==QuotedIdentifier||LA(1)==Identifier) && (LA(2)==TOK_LPAREN)) {
- methodInvocation(true);
- astFactory.addASTChild(currentAST, returnAST);
+ else if ((LA(1)==QuotedIdentifier||LA(1)==Identifier) && (LA(2)==TOK_LPAREN)) {
+ methodInvocation(true);
+ astFactory.addASTChild(currentAST, returnAST);
+ }
+ else if ((LA(1)==QuotedIdentifier||LA(1)==Identifier) && (_tokenSet_27.member(LA(2)))) {
+ identifier();
+ astFactory.addASTChild(currentAST, returnAST);
+ }
+ else {
+ throw new NoViableAltException(LT(1), getFilename());
}
- else if ((LA(1)==QuotedIdentifier||LA(1)==Identifier) && (_tokenSet_27.member(LA(2)))) {
- identifier();
- astFactory.addASTChild(currentAST, returnAST);
+ }}
}
- else {
- throw new NoViableAltException(LT(1), getFilename());
- }
- }
+ primaryExpr_AST = (AST)currentAST.root;
+ returnAST = primaryExpr_AST;
}
- primaryExpr_AST = (AST)currentAST.root;
- returnAST = primaryExpr_AST;
- }
-
+
public final void index() throws RecognitionException, TokenStreamException {
returnAST = null;
@@ -2868,6 +2862,9 @@ public OQLParser(ParserSharedInputState state) {
returnAST = null;
ASTPair currentAST = new ASTPair();
AST conversionExpr_AST = null;
+ Token n = null;
+ com.gemstone.gemfire.cache.query.internal.parse.ASTAggregateFunc n_AST = null;
+ AST tokExpr1_AST = null;
{
switch ( LA(1)) {
@@ -2960,6 +2957,28 @@ public OQLParser(ParserSharedInputState state) {
}
break;
}
+ case Identifier:
+ {
+ {
+ n = LT(1);
+ n_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTAggregateFunc)astFactory.create(n,"com.gemstone.gemfire.cache.query.internal.parse.ASTAggregateFunc");
+ astFactory.makeASTRoot(currentAST, n_AST);
+ match(Identifier);
+ match(TOK_LPAREN);
+ expr();
+ tokExpr1_AST = (AST)returnAST;
+ astFactory.addASTChild(currentAST, returnAST);
+ match(TOK_RPAREN);
+ if ( inputState.guessing==0 ) {
+ conversionExpr_AST = (AST)currentAST.root;
+
+ ((ASTAggregateFunc)conversionExpr_AST).setAggregateFunctionType(UDA);
+ ((ASTAggregateFunc)conversionExpr_AST).setUDAName(n.getText());
+
+ }
+ }
+ break;
+ }
default:
{
throw new NoViableAltException(LT(1), getFilename());
@@ -2980,33 +2999,33 @@ public OQLParser(ParserSharedInputState state) {
switch ( LA(1)) {
case LITERAL_first:
{
- AST tmp156_AST = null;
- tmp156_AST = astFactory.create(LT(1));
- astFactory.makeASTRoot(currentAST, tmp156_AST);
+ AST tmp158_AST = null;
+ tmp158_AST = astFactory.create(LT(1));
+ astFactory.makeASTRoot(currentAST, tmp158_AST);
match(LITERAL_first);
break;
}
case LITERAL_last:
{
- AST tmp157_AST = null;
- tmp157_AST = astFactory.create(LT(1));
- astFactory.makeASTRoot(currentAST, tmp157_AST);
+ AST tmp159_AST = null;
+ tmp159_AST = astFactory.create(LT(1));
+ astFactory.makeASTRoot(currentAST, tmp159_AST);
match(LITERAL_last);
break;
}
case LITERAL_unique:
{
- AST tmp158_AST = null;
- tmp158_AST = astFactory.create(LT(1));
- astFactory.makeASTRoot(currentAST, tmp158_AST);
+ AST tmp160_AST = null;
+ tmp160_AST = astFactory.create(LT(1));
+ astFactory.makeASTRoot(currentAST, tmp160_AST);
match(LITERAL_unique);
break;
}
case LITERAL_exists:
{
- AST tmp159_AST = null;
- tmp159_AST = astFactory.create(LT(1));
- astFactory.makeASTRoot(currentAST, tmp159_AST);
+ AST tmp161_AST = null;
+ tmp161_AST = astFactory.create(LT(1));
+ astFactory.makeASTRoot(currentAST, tmp161_AST);
match(LITERAL_exists);
break;
}
@@ -3032,15 +3051,15 @@ public OQLParser(ParserSharedInputState state) {
{
if ((LA(1)==LITERAL_is_undefined)) {
- com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr tmp162_AST = null;
- tmp162_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr");
- astFactory.makeASTRoot(currentAST, tmp162_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr tmp164_AST = null;
+ tmp164_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr");
+ astFactory.makeASTRoot(currentAST, tmp164_AST);
match(LITERAL_is_undefined);
}
else if ((LA(1)==LITERAL_is_defined)) {
- com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr tmp163_AST = null;
- tmp163_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr");
- astFactory.makeASTRoot(currentAST, tmp163_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr tmp165_AST = null;
+ tmp165_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTUndefinedExpr");
+ astFactory.makeASTRoot(currentAST, tmp165_AST);
match(LITERAL_is_defined);
}
else {
@@ -3086,9 +3105,9 @@ public OQLParser(ParserSharedInputState state) {
ASTPair currentAST = new ASTPair();
AST structConstruction_AST = null;
- AST tmp167_AST = null;
- tmp167_AST = astFactory.create(LT(1));
- astFactory.makeASTRoot(currentAST, tmp167_AST);
+ AST tmp169_AST = null;
+ tmp169_AST = astFactory.create(LT(1));
+ astFactory.makeASTRoot(currentAST, tmp169_AST);
match(LITERAL_struct);
match(TOK_LPAREN);
fieldList();
@@ -3110,25 +3129,25 @@ public OQLParser(ParserSharedInputState state) {
switch ( LA(1)) {
case LITERAL_array:
{
- AST tmp170_AST = null;
- tmp170_AST = astFactory.create(LT(1));
- astFactory.makeASTRoot(currentAST, tmp170_AST);
+ AST tmp172_AST = null;
+ tmp172_AST = astFactory.create(LT(1));
+ astFactory.makeASTRoot(currentAST, tmp172_AST);
match(LITERAL_array);
break;
}
case LITERAL_set:
{
- com.gemstone.gemfire.cache.query.internal.parse.ASTConstruction tmp171_AST = null;
- tmp171_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTConstruction)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTConstruction");
- astFactory.makeASTRoot(currentAST, tmp171_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTConstruction tmp173_AST = null;
+ tmp173_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTConstruction)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTConstruction");
+ astFactory.makeASTRoot(currentAST, tmp173_AST);
match(LITERAL_set);
break;
}
case LITERAL_bag:
{
- AST tmp172_AST = null;
- tmp172_AST = astFactory.create(LT(1));
- astFactory.makeASTRoot(currentAST, tmp172_AST);
+ AST tmp174_AST = null;
+ tmp174_AST = astFactory.create(LT(1));
+ astFactory.makeASTRoot(currentAST, tmp174_AST);
match(LITERAL_bag);
break;
}
@@ -3142,13 +3161,13 @@ public OQLParser(ParserSharedInputState state) {
astFactory.addASTChild(currentAST, returnAST);
}
else if ((LA(1)==LITERAL_list)) {
- AST tmp173_AST = null;
- tmp173_AST = astFactory.create(LT(1));
- astFactory.makeASTRoot(currentAST, tmp173_AST);
+ AST tmp175_AST = null;
+ tmp175_AST = astFactory.create(LT(1));
+ astFactory.makeASTRoot(currentAST, tmp175_AST);
match(LITERAL_list);
- AST tmp174_AST = null;
- tmp174_AST = astFactory.create(LT(1));
- astFactory.addASTChild(currentAST, tmp174_AST);
+ AST tmp176_AST = null;
+ tmp176_AST = astFactory.create(LT(1));
+ astFactory.addASTChild(currentAST, tmp176_AST);
match(TOK_LPAREN);
{
if ((_tokenSet_4.member(LA(1)))) {
@@ -3156,27 +3175,27 @@ public OQLParser(ParserSharedInputState state) {
astFactory.addASTChild(currentAST, returnAST);
{
if ((LA(1)==TOK_DOTDOT)) {
- AST tmp175_AST = null;
- tmp175_AST = astFactory.create(LT(1));
- astFactory.addASTChild(currentAST, tmp175_AST);
+ AST tmp177_AST = null;
+ tmp177_AST = astFactory.create(LT(1));
+ astFactory.addASTChild(currentAST, tmp177_AST);
match(TOK_DOTDOT);
expr();
astFactory.addASTChild(currentAST, returnAST);
}
else if ((LA(1)==TOK_RPAREN||LA(1)==TOK_COMMA)) {
{
- _loop278:
+ _loop279:
do {
if ((LA(1)==TOK_COMMA)) {
- AST tmp176_AST = null;
- tmp176_AST = astFactory.create(LT(1));
- astFactory.addASTChild(currentAST, tmp176_AST);
+ AST tmp178_AST = null;
+ tmp178_AST = astFactory.create(LT(1));
+ astFactory.addASTChild(currentAST, tmp178_AST);
match(TOK_COMMA);
expr();
astFactory.addASTChild(currentAST, returnAST);
}
else {
- break _loop278;
+ break _loop279;
}
} while (true);
@@ -3195,9 +3214,9 @@ public OQLParser(ParserSharedInputState state) {
}
}
- AST tmp177_AST = null;
- tmp177_AST = astFactory.create(LT(1));
- astFactory.addASTChild(currentAST, tmp177_AST);
+ AST tmp179_AST = null;
+ tmp179_AST = astFactory.create(LT(1));
+ astFactory.addASTChild(currentAST, tmp179_AST);
match(TOK_RPAREN);
}
else {
@@ -3292,9 +3311,9 @@ public OQLParser(ParserSharedInputState state) {
ASTPair currentAST = new ASTPair();
AST stringLiteral_AST = null;
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp178_AST = null;
- tmp178_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp178_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp180_AST = null;
+ tmp180_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp180_AST);
match(StringLiteral);
stringLiteral_AST = (AST)currentAST.root;
returnAST = stringLiteral_AST;
@@ -3312,7 +3331,7 @@ public OQLParser(ParserSharedInputState state) {
expr();
astFactory.addASTChild(currentAST, returnAST);
{
- _loop271:
+ _loop272:
do {
if ((LA(1)==TOK_COMMA)) {
match(TOK_COMMA);
@@ -3323,7 +3342,7 @@ public OQLParser(ParserSharedInputState state) {
astFactory.addASTChild(currentAST, returnAST);
}
else {
- break _loop271;
+ break _loop272;
}
} while (true);
@@ -3349,27 +3368,27 @@ public OQLParser(ParserSharedInputState state) {
switch ( LA(1)) {
case LITERAL_nil:
{
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp182_AST = null;
- tmp182_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp182_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp184_AST = null;
+ tmp184_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp184_AST);
match(LITERAL_nil);
objectLiteral_AST = (AST)currentAST.root;
break;
}
case LITERAL_null:
{
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp183_AST = null;
- tmp183_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp183_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp185_AST = null;
+ tmp185_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp185_AST);
match(LITERAL_null);
objectLiteral_AST = (AST)currentAST.root;
break;
}
case LITERAL_undefined:
{
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp184_AST = null;
- tmp184_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp184_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp186_AST = null;
+ tmp186_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp186_AST);
match(LITERAL_undefined);
objectLiteral_AST = (AST)currentAST.root;
break;
@@ -3390,15 +3409,15 @@ public OQLParser(ParserSharedInputState state) {
{
if ((LA(1)==LITERAL_true)) {
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp185_AST = null;
- tmp185_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp185_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp187_AST = null;
+ tmp187_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp187_AST);
match(LITERAL_true);
}
else if ((LA(1)==LITERAL_false)) {
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp186_AST = null;
- tmp186_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp186_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp188_AST = null;
+ tmp188_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp188_AST);
match(LITERAL_false);
}
else {
@@ -3420,33 +3439,33 @@ public OQLParser(ParserSharedInputState state) {
switch ( LA(1)) {
case NUM_INT:
{
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp187_AST = null;
- tmp187_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp187_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp189_AST = null;
+ tmp189_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp189_AST);
match(NUM_INT);
break;
}
case NUM_LONG:
{
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp188_AST = null;
- tmp188_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp188_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp190_AST = null;
+ tmp190_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp190_AST);
match(NUM_LONG);
break;
}
case NUM_FLOAT:
{
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp189_AST = null;
- tmp189_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp189_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp191_AST = null;
+ tmp191_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp191_AST);
match(NUM_FLOAT);
break;
}
case NUM_DOUBLE:
{
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp190_AST = null;
- tmp190_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.addASTChild(currentAST, tmp190_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp192_AST = null;
+ tmp192_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.addASTChild(currentAST, tmp192_AST);
match(NUM_DOUBLE);
break;
}
@@ -3466,13 +3485,13 @@ public OQLParser(ParserSharedInputState state) {
ASTPair currentAST = new ASTPair();
AST charLiteral_AST = null;
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp191_AST = null;
- tmp191_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.makeASTRoot(currentAST, tmp191_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp193_AST = null;
+ tmp193_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.makeASTRoot(currentAST, tmp193_AST);
match(LITERAL_char);
- AST tmp192_AST = null;
- tmp192_AST = astFactory.create(LT(1));
- astFactory.addASTChild(currentAST, tmp192_AST);
+ AST tmp194_AST = null;
+ tmp194_AST = astFactory.create(LT(1));
+ astFactory.addASTChild(currentAST, tmp194_AST);
match(StringLiteral);
charLiteral_AST = (AST)currentAST.root;
returnAST = charLiteral_AST;
@@ -3484,13 +3503,13 @@ public OQLParser(ParserSharedInputState state) {
ASTPair currentAST = new ASTPair();
AST dateLiteral_AST = null;
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp193_AST = null;
- tmp193_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.makeASTRoot(currentAST, tmp193_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp195_AST = null;
+ tmp195_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.makeASTRoot(currentAST, tmp195_AST);
match(LITERAL_date);
- AST tmp194_AST = null;
- tmp194_AST = astFactory.create(LT(1));
- astFactory.addASTChild(currentAST, tmp194_AST);
+ AST tmp196_AST = null;
+ tmp196_AST = astFactory.create(LT(1));
+ astFactory.addASTChild(currentAST, tmp196_AST);
match(StringLiteral);
dateLiteral_AST = (AST)currentAST.root;
returnAST = dateLiteral_AST;
@@ -3502,13 +3521,13 @@ public OQLParser(ParserSharedInputState state) {
ASTPair currentAST = new ASTPair();
AST timeLiteral_AST = null;
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp195_AST = null;
- tmp195_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.makeASTRoot(currentAST, tmp195_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp197_AST = null;
+ tmp197_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.makeASTRoot(currentAST, tmp197_AST);
match(LITERAL_time);
- AST tmp196_AST = null;
- tmp196_AST = astFactory.create(LT(1));
- astFactory.addASTChild(currentAST, tmp196_AST);
+ AST tmp198_AST = null;
+ tmp198_AST = astFactory.create(LT(1));
+ astFactory.addASTChild(currentAST, tmp198_AST);
match(StringLiteral);
timeLiteral_AST = (AST)currentAST.root;
returnAST = timeLiteral_AST;
@@ -3520,13 +3539,13 @@ public OQLParser(ParserSharedInputState state) {
ASTPair currentAST = new ASTPair();
AST timestampLiteral_AST = null;
- com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp197_AST = null;
- tmp197_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
- astFactory.makeASTRoot(currentAST, tmp197_AST);
+ com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral tmp199_AST = null;
+ tmp199_AST = (com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral)astFactory.create(LT(1),"com.gemstone.gemfire.cache.query.internal.parse.ASTLiteral");
+ astFactory.makeASTRoot(currentAST, tmp199_AST);
match(LITERAL_timestamp);
- AST tmp198_AST = null;
- tmp198_AST = astFactory.create(LT(1));
- astFactory.addASTChild(currentAST, tmp198_AST);
+ AST tmp200_AST = null;
+ tmp200_AST = astFactory.create(LT(1));
+ astFactory.addASTChild(currentAST, tmp200_AST);
match(StringLiteral);
timestampLiteral_AST = (AST)currentAST.root;
returnAST = timestampLiteral_AST;
@@ -3600,6 +3619,7 @@ public OQLParser(ParserSharedInputState state) {
"COUNT",
"MAX",
"MIN",
+ "UDA",
"\"trace\"",
"\"import\"",
"\"as\"",
@@ -3690,112 +3710,112 @@ public OQLParser(ParserSharedInputState state) {
};
private static final long[] mk_tokenSet_0() {
- long[] data = { 2327943626784L, 576460615267125096L, 2089665L, 0L, 0L, 0L};
+ long[] data = { 2327943626784L, 1152921230534250192L, 4179330L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
private static final long[] mk_tokenSet_1() {
- long[] data = { 2327970839714L, -3236942208L, 2097151L, 0L, 0L, 0L};
+ long[] data = { 2327970839714L, -6473884416L, 4194303L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
private static final long[] mk_tokenSet_2() {
- long[] data = { 0L, 360L, 0L, 0L};
+ long[] data = { 0L, 720L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
private static final long[] mk_tokenSet_3() {
- long[] data = { 2327943626784L, 576460615267124736L, 2089665L, 0L, 0L, 0L};
+ long[] data = { 2327943626784L, 1152921230534249472L, 4179330L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
private static final long[] mk_tokenSet_4() {
- long[] data = { 2327939432480L, 576460615267124224L, 2089665L, 0L, 0L, 0L};
+ long[] data = { 2327939432480L, 1152921230534248448L, 4179330L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
private static final long[] mk_tokenSet_5() {
- long[] data = { 210L, 2326528L, 0L, 0L};
+ long[] data = { 210L, 4653056L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
private static final long[] mk_tokenSet_6() {
- long[] data = { 2327970839794L, -3235647984L, 2097151L, 0L, 0L, 0L};
+ long[] data = { 2327970839794L, -6471295968L, 4194303L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
private static final long[] mk_tokenSet_7() {
- long[] data = { 210L, 2342912L, 0L, 0L};
+ long[] data = { 210L, 4685824L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7());
private static final long[] mk_tokenSet_8() {
- long[] data = { 25778192594L, 2326528L, 0L, 0L};
+ long[] data = { 25778192594L, 4653056L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8());
private static final long[] mk_tokenSet_9() {
- long[] data = { 2327939563552L, 576460615267124224L, 2089665L, 0L, 0L, 0L};
+ long[] data = { 2327939563552L, 1152921230534248448L, 4179330L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9());
private static final long[] mk_tokenSet_10() {
- long[] data = { 2327970840160L, -3237986800L, 2097151L, 0L, 0L, 0L};
+ long[] data = { 2327970840160L, -6475973600L, 4194303L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10());
private static final long[] mk_tokenSet_11() {
- long[] data = { 146L, 2293760L, 0L, 0L};
+ long[] data = { 146L, 4587520L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_11 = new BitSet(mk_tokenSet_11());
private static final long[] mk_tokenSet_12() {
- long[] data = { 146L, 2162688L, 0L, 0L};
+ long[] data = { 146L, 4325376L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_12 = new BitSet(mk_tokenSet_12());
private static final long[] mk_tokenSet_13() {
- long[] data = { 146L, 65536L, 0L, 0L};
+ long[] data = { 146L, 131072L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_13 = new BitSet(mk_tokenSet_13());
private static final long[] mk_tokenSet_14() {
- long[] data = { 2327970839650L, -3237986816L, 2097151L, 0L, 0L, 0L};
+ long[] data = { 2327970839650L, -6475973632L, 4194303L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_14 = new BitSet(mk_tokenSet_14());
private static final long[] mk_tokenSet_15() {
- long[] data = { 2327970839650L, -3237986800L, 2097151L, 0L, 0L, 0L};
+ long[] data = { 2327970839650L, -6475973600L, 4194303L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_15 = new BitSet(mk_tokenSet_15());
private static final long[] mk_tokenSet_16() {
- long[] data = { 2327970839600L, -3237990912L, 2097151L, 0L, 0L, 0L};
+ long[] data = { 2327970839600L, -6475981824L, 4194303L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_16 = new BitSet(mk_tokenSet_16());
private static final long[] mk_tokenSet_17() {
- long[] data = { 25769803776L, -36028797018963968L, 8191L, 0L, 0L, 0L};
+ long[] data = { 25769803776L, -72057594037927936L, 16383L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_17 = new BitSet(mk_tokenSet_17());
private static final long[] mk_tokenSet_18() {
- long[] data = { 2328004394994L, 576460749080886800L, 2089665L, 0L, 0L, 0L};
+ long[] data = { 2328004394994L, 1152921498161773600L, 4179330L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_18 = new BitSet(mk_tokenSet_18());
private static final long[] mk_tokenSet_19() {
- long[] data = { 2327939432480L, 576460615132906496L, 2089665L, 0L, 0L, 0L};
+ long[] data = { 2327939432480L, 1152921230265812992L, 4179330L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_19 = new BitSet(mk_tokenSet_19());
private static final long[] mk_tokenSet_20() {
- long[] data = { 2328004394994L, 576460749080884752L, 2089665L, 0L, 0L, 0L};
+ long[] data = { 2328004394994L, 1152921498161769504L, 4179330L, 0L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_20 = new BitSet(mk_tokenSet_20());
private static final long[] mk_tokenSet_21() {
- long[] data = { 25803359186L, 4964732944L, 0L, 0L};
+ long[] data = { 25803359186L, 9929465888L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_21 = new BitSet(mk_tokenSet_21());
@@ -3805,29 +3825,34 @@ public OQLParser(ParserSharedInputState state) {
}
public static final BitSet _tokenSet_22 = new BitSet(mk_tokenSet_22());
private static final long[] mk_tokenSet_23() {
- long[] data = { 53248L, 25769803776L, 0L, 0L};
+ long[] data = { 53248L, 51539607552L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_23 = new BitSet(mk_tokenSet_23());
private static final long[] mk_tokenSet_24() {
- long[] data = { 196608L, 103079215104L, 0L, 0L};
+ long[] data = { 196608L, 206158430208L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_24 = new BitSet(mk_tokenSet_24());
private static final long[] mk_tokenSet_25() {
- long[] data = { 25818035154L, 133813751824L, 0L, 0L};
+ long[] data = { 25818035154L, 267627503648L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_25 = new BitSet(mk_tokenSet_25());
private static final long[] mk_tokenSet_26() {
- long[] data = { 49152L, 412316860416L, 0L, 0L};
+ long[] data = { 49152L, 824633720832L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_26 = new BitSet(mk_tokenSet_26());
private static final long[] mk_tokenSet_27() {
- long[] data = { 25834815442L, 133813760016L, 0L, 0L};
+ long[] data = { 25834815442L, 267627520032L, 0L, 0L};
return data;
}
public static final BitSet _tokenSet_27 = new BitSet(mk_tokenSet_27());
+ private static final long[] mk_tokenSet_28() {
+ long[] data = { 17179869184L, 34084860463104L, 0L, 0L};
+ return data;
+ }
+ public static final BitSet _tokenSet_28 = new BitSet(mk_tokenSet_28());
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/oql.g
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/oql.g b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/oql.g
index caf0ec0..a9f0af3 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/oql.g
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/parse/oql.g
@@ -343,6 +343,7 @@ tokens {
COUNT;
MAX;
MIN;
+ UDA;
}
queryProgram :
@@ -919,7 +920,17 @@ conversionExpr :
TOK_LPAREN!
stringLiteral TOK_COMMA! stringLiteral
TOK_RPAREN!
- )
+ )
+ |
+ (
+ n:Identifier^<AST=com.gemstone.gemfire.cache.query.internal.parse.ASTAggregateFunc>
+ TOK_LPAREN! tokExpr1:expr TOK_RPAREN!
+ {
+ ((ASTAggregateFunc)#conversionExpr).setAggregateFunctionType(UDA);
+ ((ASTAggregateFunc)#conversionExpr).setUDAName(n.getText());
+ }
+
+ )
)
;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java
index fc280f1..b5fde24 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java
@@ -1545,6 +1545,19 @@ public class DistributionAdvisor {
this.peerMemberId = memberId;
this.version = version;
}
+
+ /**
+ * Default no op method, which needs to be overridden by the profile class which needs to be
+ * collected and sent to the caller. The overriding method should fill in the profile & add it
+ * to the replyProfiles List
+ * @param dm
+ * @param adviseePath
+ * @param replyProfiles
+ */
+ public void collectProfile(DistributionManager dm, String adviseePath,
+ final List<Profile> replyProfiles) {
+ // nothing by default;
+ }
/**
* Return object that uniquely identifies this profile.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java
index 77f24a3..ed79de7 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/DSFIDFactory.java
@@ -70,6 +70,13 @@ import com.gemstone.gemfire.cache.query.internal.StructBag;
import com.gemstone.gemfire.cache.query.internal.StructImpl;
import com.gemstone.gemfire.cache.query.internal.StructSet;
import com.gemstone.gemfire.cache.query.internal.Undefined;
+import com.gemstone.gemfire.cache.query.internal.aggregate.Avg;
+import com.gemstone.gemfire.cache.query.internal.aggregate.Count;
+import com.gemstone.gemfire.cache.query.internal.aggregate.DistinctAggregator;
+import com.gemstone.gemfire.cache.query.internal.aggregate.MaxMin;
+import com.gemstone.gemfire.cache.query.internal.aggregate.Sum;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDADistributionAdvisor;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDAMessage;
import com.gemstone.gemfire.cache.query.internal.index.IndexCreationData;
import com.gemstone.gemfire.cache.query.internal.index.IndexManager;
import com.gemstone.gemfire.cache.query.internal.types.CollectionTypeImpl;
@@ -275,6 +282,7 @@ import com.gemstone.gemfire.internal.cache.TXRemoteCommitMessage.TXRemoteCommitR
import com.gemstone.gemfire.internal.cache.TXRemoteRollbackMessage;
import com.gemstone.gemfire.internal.cache.Token;
import com.gemstone.gemfire.internal.cache.UpdateAttributesProcessor;
+import com.gemstone.gemfire.internal.cache.UpdateAttributesProcessor.CollectAttributesMessage;
import com.gemstone.gemfire.internal.cache.UpdateEntryVersionOperation.UpdateEntryVersionMessage;
import com.gemstone.gemfire.internal.cache.UpdateOperation;
import com.gemstone.gemfire.internal.cache.VMCachedDeserializable;
@@ -1043,6 +1051,14 @@ public final class DSFIDFactory implements DataSerializableFixedID {
DestroyRegionOnDataStoreMessage.class);
registerDSFID(SHUTDOWN_ALL_GATEWAYHUBS_REQUEST,
ShutdownAllGatewayHubsRequest.class);
+ registerDSFID(AGG_FUNC_AVG, Avg.class);
+ registerDSFID(AGG_FUNC_COUNT, Count.class);
+ registerDSFID(AGG_FUNC_SUM, Sum.class);
+ registerDSFID(AGG_FUNC_DISTINCT_AGG, DistinctAggregator.class);
+ registerDSFID(AGG_FUNC_MAX_MIN, MaxMin.class);
+ registerDSFID(UDA_PROFILE, UDADistributionAdvisor.UDAProfile.class);
+ registerDSFID(UDA_MESSAGE, UDAMessage.class);
+ registerDSFID(COLLECT_ATTRIBUTES_MESSAGE, CollectAttributesMessage.class);
registerDSFID(BUCKET_COUNT_LOAD_PROBE, BucketCountLoadProbe.class);
}
@@ -1098,39 +1114,48 @@ public final class DSFIDFactory implements DataSerializableFixedID {
case PR_DESTROY_ON_DATA_STORE_MESSAGE:
return readDestroyOnDataStore(in);
default:
- final Constructor<?> cons;
- if (dsfid >= Byte.MIN_VALUE && dsfid <= Byte.MAX_VALUE) {
- cons = dsfidMap[dsfid + Byte.MAX_VALUE + 1];
+ Object ds = getDSFIDInstance(dsfid);
+ InternalDataSerializer.invokeFromData(ds, in);
+ return ds;
+
+ }
+ }
+
+ /**
+ * Returns the instance of class which is registered with the given iD
+ *
+ * @param dsfid ID with which the DataSerializableFixedID class is registered
+ * @return Object DataSerializableFixedID instance
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ public static Object getDSFIDInstance(int dsfid) throws IOException, ClassNotFoundException {
+ final Constructor<?> cons;
+ if (dsfid >= Byte.MIN_VALUE && dsfid <= Byte.MAX_VALUE) {
+ cons = dsfidMap[dsfid + Byte.MAX_VALUE + 1];
+ } else {
+ cons = (Constructor<?>) dsfidMap2.get(dsfid);
+ }
+ if (cons != null) {
+ try {
+ return cons.newInstance((Object[]) null);
+ } catch (InstantiationException ie) {
+ throw new IOException(ie.getMessage(), ie);
+ } catch (IllegalAccessException iae) {
+ throw new IOException(iae.getMessage(), iae);
+ } catch (InvocationTargetException ite) {
+ Throwable targetEx = ite.getTargetException();
+ if (targetEx instanceof IOException) {
+ throw (IOException) targetEx;
+ } else if (targetEx instanceof ClassNotFoundException) {
+ throw (ClassNotFoundException) targetEx;
} else {
- cons = (Constructor<?>) dsfidMap2.get(dsfid);
- }
- if (cons != null) {
- try {
- Object ds = cons
- .newInstance((Object[]) null);
- InternalDataSerializer.invokeFromData(ds, in);
- return ds;
- } catch (InstantiationException ie) {
- throw new IOException(ie.getMessage(), ie);
- } catch (IllegalAccessException iae) {
- throw new IOException(iae.getMessage(), iae);
- } catch (InvocationTargetException ite) {
- Throwable targetEx = ite.getTargetException();
- if (targetEx instanceof IOException) {
- throw (IOException) targetEx;
- } else if (targetEx instanceof ClassNotFoundException) {
- throw (ClassNotFoundException) targetEx;
- } else {
- throw new IOException(ite.getMessage(), targetEx);
- }
- }
+ throw new IOException(ite.getMessage(), targetEx);
}
- throw new DSFIDNotFoundException("Unknown DataSerializableFixedID: "
- + dsfid, dsfid);
-
+ }
}
+ throw new DSFIDNotFoundException("Unknown DataSerializableFixedID: " + dsfid, dsfid);
}
-
////////////////// Reading Internal Objects /////////////////
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java
index 5d52346..ccb4dc6 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java
@@ -646,7 +646,15 @@ public interface DataSerializableFixedID extends SerializationVersions {
public static final short CUMULATIVE_RESULTS = 168;
public static final short DISTTX_ROLLBACK_MESSAGE = 169;
public static final short DISTTX_ROLLBACK_REPLY_MESSAGE = 170;
- // 171..999 unused
+ public static final short AGG_FUNC_AVG = 171;
+ public static final short AGG_FUNC_COUNT = 172;
+ public static final short AGG_FUNC_SUM = 173;
+ public static final short AGG_FUNC_DISTINCT_AGG = 174;
+ public static final short AGG_FUNC_MAX_MIN = 175;
+ public static final short UDA_PROFILE = 176;
+ public static final short UDA_MESSAGE = 177;
+ public static final short COLLECT_ATTRIBUTES_MESSAGE = 178;
+ // 179..999 unused
public static final short ADD_HEALTH_LISTENER_REQUEST = 1000;
public static final short ADD_HEALTH_LISTENER_RESPONSE = 1001;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
index cc9727b..1b9bf81 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
@@ -140,6 +140,8 @@ import com.gemstone.gemfire.cache.query.QueryService;
import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
import com.gemstone.gemfire.cache.query.internal.DefaultQueryService;
import com.gemstone.gemfire.cache.query.internal.QueryMonitor;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDAManager;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDAManagerImpl;
import com.gemstone.gemfire.cache.query.internal.cq.CqService;
import com.gemstone.gemfire.cache.query.internal.cq.CqServiceProvider;
import com.gemstone.gemfire.cache.server.CacheServer;
@@ -491,6 +493,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
* lock used to access prLockService
*/
private final Object prLockServiceLock = new Object();
+ private final UDAManagerImpl udaMgr;
/**
* DistributedLockService for GatewaySenders. Remains null until the
@@ -859,7 +862,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
.toLocalizedString());
}
}
-
+ this.udaMgr = new UDAManagerImpl();
this.rootRegions = new HashMap();
this.cqService = CqServiceProvider.create(this);
@@ -1196,6 +1199,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
startRestAgentServer(this);
+ udaMgr.collectUDAsFromRemote();
int time = Integer.getInteger("gemfire.CLIENT_FUNCTION_TIMEOUT",
DEFAULT_CLIENT_FUNCTION_TIMEOUT);
clientFunctionTimeout = time >= 0 ? time : DEFAULT_CLIENT_FUNCTION_TIMEOUT;
@@ -1975,6 +1979,10 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
public PersistentMemberManager getPersistentMemberManager() {
return persistentMemberManager;
}
+
+ public UDAManagerImpl getUDAManager() {
+ return this.udaMgr;
+ }
public ClientMetadataService getClientMetadataService() {
synchronized (this.clientMetaDatServiceLock) {
@@ -2181,7 +2189,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
}
destroyPartitionedRegionLockService();
}
-
+ udaMgr.clear();
closeDiskStores();
diskMonitor.close();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalCache.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalCache.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalCache.java
index 36eee80..06023b1 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalCache.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalCache.java
@@ -22,6 +22,7 @@ import java.util.Collection;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreImpl;
import com.gemstone.gemfire.cache.hdfs.internal.hoplog.HDFSStoreDirector;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDAManager;
import com.gemstone.gemfire.cache.query.internal.cq.CqService;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.internal.cache.extension.Extensible;
@@ -47,5 +48,7 @@ public interface InternalCache extends Cache, Extensible<Cache> {
public Collection<HDFSStoreImpl> getHDFSStores() ;
+ public UDAManager getUDAManager() ;
+
public <T extends CacheService> T getService(Class<T> clazz);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionQueryEvaluator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionQueryEvaluator.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionQueryEvaluator.java
index 85f058f..b45e5ff 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionQueryEvaluator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionQueryEvaluator.java
@@ -52,6 +52,7 @@ import com.gemstone.gemfire.cache.query.internal.CumulativeNonDistinctResults;
import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
import com.gemstone.gemfire.cache.query.internal.DefaultQueryService;
import com.gemstone.gemfire.cache.query.internal.ExecutionContext;
+import com.gemstone.gemfire.cache.query.internal.CumulativeNonDistinctResults.Metadata;
import com.gemstone.gemfire.cache.query.internal.IndexTrackingQueryObserver.IndexInfo;
import com.gemstone.gemfire.cache.query.internal.NWayMergeResults;
import com.gemstone.gemfire.cache.query.internal.OrderByComparator;
@@ -785,12 +786,7 @@ public class PartitionedRegionQueryEvaluator extends StreamingPartitionOperation
/**
* Applies order-by on the results returned from PR nodes and puts the results in
* the cumulative result set.
- * The order-by is applied by running a generated query on the each result returned
- * by the remote nodes.
- * Example generated query: SELECT DISTINCT * FROM $1 p ORDER BY p.ID
- * Where results are passed as bind parameter.
- * This is added as quick turn-around, this is added based on most commonly used
- * queries, needs to be investigated further.
+ *
*/
private SelectResults buildSortedResult(CompiledSelect cs, int limit) throws QueryException {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/UpdateAttributesProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/UpdateAttributesProcessor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/UpdateAttributesProcessor.java
index 866eaff..71c58b6 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/UpdateAttributesProcessor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/UpdateAttributesProcessor.java
@@ -165,6 +165,50 @@ public class UpdateAttributesProcessor {
this.processor = processor;
}
+ /**
+ * Collects the profile from the remote peers.
+ * The profile to be collected is defined by the ID contained in DataSerializableFixedID.getDSFID
+ * for that profile. This method is different in the sense, it does not send this member's profile
+ * to the peers.
+ * Note: The dsfID should be that of a Profile type class .
+ *
+ * @param dsfID ID contained in DataSerializableFixedID.getDSFID
+ * for that profile
+ */
+ public void collect(int dsfID) {
+ DM mgr = this.advisee.getDistributionManager();
+ DistributionAdvisor advisor = this.advisee.getDistributionAdvisor();
+
+ final Set recipients = advisor.adviseProfileExchange();
+ if (recipients.isEmpty()) {
+ return;
+ }
+
+ ReplyProcessor21 processor = null;
+ // Scope scope = this.region.scope;
+
+ // always require an ack to prevent misordering of messages
+ InternalDistributedSystem system = this.advisee.getSystem();
+ processor = new UpdateAttributesReplyProcessor(system, recipients);
+ CollectAttributesMessage message = getCollectAttributesMessage(processor, recipients, dsfID);
+ mgr.putOutgoing(message);
+ this.processor = processor;
+ waitForProfileResponse();
+ }
+
+ CollectAttributesMessage getCollectAttributesMessage(ReplyProcessor21 processor, Set recipients, int dsfID) {
+
+ CollectAttributesMessage msg = new CollectAttributesMessage();
+ msg.dsfID = dsfID;
+
+ msg.adviseePath = this.advisee.getFullPath();
+ msg.setRecipients(recipients);
+ if (processor != null) {
+ msg.processorId = processor.getProcessorId();
+ }
+
+ return msg;
+ }
UpdateAttributesMessage getUpdateAttributesMessage(ReplyProcessor21 processor,
Set recipients) {
@@ -549,4 +593,106 @@ public class UpdateAttributesProcessor {
return true;
}
}
+
+ public static final class CollectAttributesMessage extends HighPriorityDistributionMessage
+ implements MessageWithReply {
+ protected int dsfID;
+
+ protected String adviseePath;
+ protected int processorId = 0;
+
+ @Override
+ public int getProcessorId() {
+ return this.processorId;
+ }
+
+ @Override
+ protected void process(DistributionManager dm) {
+ Throwable thr = null;
+
+ boolean sendReply = this.processorId != 0;
+ List<Profile> replyProfiles = null;
+ try {
+ // create a dummy profile object
+ Profile dummyProfile = (Profile) DSFIDFactory.getDSFIDInstance(this.dsfID);
+ replyProfiles = new ArrayList<Profile>();
+ dummyProfile.collectProfile(dm, this.adviseePath, replyProfiles);
+ } catch (CancelException e) {
+
+ } catch (Throwable t) {
+ Error err;
+ if (t instanceof Error && SystemFailure.isJVMFailureError(err = (Error) t)) {
+ SystemFailure.initiateFailure(err);
+ // If this ever returns, rethrow the error. We're poisoned
+ // now, so don't let this thread continue.
+ throw err;
+ }
+ // Whenever you catch Error or Throwable, you must also
+ // check for fatal JVM error (see above). However, there is
+ // _still_ a possibility that you are dealing with a cascading
+ // error condition, so you also need to check to see if the JVM
+ // is still usable:
+ SystemFailure.checkFailure();
+ thr = t;
+ } finally {
+ if (sendReply) {
+ ReplyException rex = null;
+ if (thr != null) {
+ rex = new ReplyException(thr);
+ }
+ if (replyProfiles == null || replyProfiles.size() <= 1) {
+ Profile p = null;
+ if (replyProfiles != null && replyProfiles.size() == 1) {
+ p = replyProfiles.get(0);
+ }
+ ProfileReplyMessage.send(getSender(), this.processorId, rex, dm, p);
+ } else {
+ Profile[] profiles = new Profile[replyProfiles.size()];
+ replyProfiles.toArray(profiles);
+ ProfilesReplyMessage.send(getSender(), this.processorId, rex, dm, profiles);
+ }
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buff = new StringBuilder();
+ buff.append("CollectAttributesMessage (adviseePath=");
+ buff.append(this.adviseePath);
+ buff.append("; processorId=");
+ buff.append(this.processorId);
+ buff.append("; dsfid=");
+ buff.append(this.dsfID);
+
+ buff.append(")");
+ return buff.toString();
+ }
+
+ public int getDSFID() {
+ return COLLECT_ATTRIBUTES_MESSAGE;
+ }
+
+ @Override
+ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+ super.fromData(in);
+ this.adviseePath = DataSerializer.readString(in);
+ this.processorId = in.readInt();
+ this.dsfID = in.readInt();
+
+ // set the processor ID to be able to send reply to sender in case of any
+ // unexpected exception during deserialization etc.
+ ReplyProcessor21.setMessageRPId(this.processorId);
+
+ }
+
+ @Override
+ public void toData(DataOutput out) throws IOException {
+ super.toData(out);
+ DataSerializer.writeString(this.adviseePath, out);
+ out.writeInt(this.processorId);
+ out.writeInt(this.dsfID);
+
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheCreation.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheCreation.java
index 915bde9..a8d020d 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheCreation.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheCreation.java
@@ -74,10 +74,14 @@ import com.gemstone.gemfire.cache.query.IndexInvalidException;
import com.gemstone.gemfire.cache.query.IndexNameConflictException;
import com.gemstone.gemfire.cache.query.IndexType;
import com.gemstone.gemfire.cache.query.MultiIndexCreationException;
+import com.gemstone.gemfire.cache.query.NameResolutionException;
import com.gemstone.gemfire.cache.query.Query;
import com.gemstone.gemfire.cache.query.QueryInvalidException;
import com.gemstone.gemfire.cache.query.QueryService;
import com.gemstone.gemfire.cache.query.RegionNotFoundException;
+import com.gemstone.gemfire.cache.query.UDAExistsException;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDAManager;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDAManagerImpl;
import com.gemstone.gemfire.cache.query.internal.cq.CqService;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache.snapshot.CacheSnapshotService;
@@ -199,7 +203,8 @@ public class CacheCreation implements InternalCache {
*/
protected final Map diskStores = new LinkedHashMap();
protected final Map hdfsStores = new LinkedHashMap();
-
+ private final UDAManagerCreation udaMgrCreation = new UDAManagerCreation();
+
private final List<File> backups = new ArrayList<File>();
private CacheConfig cacheConfig = new CacheConfig();
@@ -311,6 +316,10 @@ public class CacheCreation implements InternalCache {
return this.searchTimeout;
}
+ public void addUDA(String udaName, String udaClass) {
+ this.udaMgrCreation.createUDA(udaName, udaClass);
+ }
+
public void setSearchTimeout(int seconds) {
this.searchTimeout = seconds;
this.hasSearchTimeout = true;
@@ -459,7 +468,18 @@ public class CacheCreation implements InternalCache {
cache.getCacheTransactionManager()!=null) {
cache.getCacheTransactionManager().setWriter(this.txMgrCreation.getWriter());
}
-
+
+ UDAManagerImpl udaMgrImpl = cache.getUDAManager();
+ for (Map.Entry<String, String> entry : this.udaMgrCreation.getUDAs().entrySet()) {
+ try {
+ udaMgrImpl.createUDA(entry.getKey(), entry.getValue());
+ } catch (UDAExistsException udae) {
+ throw new RuntimeException(LocalizedStrings.UDA_MANAGER_Uda_Exists.toLocalizedString(entry.getKey()));
+ } catch (NameResolutionException nre) {
+ throw new RuntimeException(LocalizedStrings.UDA_MANAGER_Class_Not_Found.toLocalizedString(entry.getValue(), entry.getKey()));
+ }
+
+ }
for (GatewaySender senderCreation : this.getGatewaySenders()) {
GatewaySenderFactory factory = (GatewaySenderFactory)cache
.createGatewaySenderFactory();
@@ -1684,10 +1704,25 @@ public class CacheCreation implements InternalCache {
public boolean clearDefinedIndexes() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
-
+
+ @Override
+ public void createUDA(String udaName, String udaClass) throws UDAExistsException, NameResolutionException {
+ getUDAManager().createUDA(udaName, udaClass);
+
+ }
+
+ @Override
+ public void removeUDA(String udaName) {
+ getUDAManager().removeUDA(udaName);
+ }
+
};
@Override
+ public UDAManager getUDAManager() {
+ return this.udaMgrCreation;
+ }
+
public <T extends CacheService> T getService(Class<T> clazz) {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java
index c6b0509..66091d2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java
@@ -625,6 +625,11 @@ public abstract class CacheXml implements EntityResolver2, ErrorHandler {
/** Name of region property specifying the cloning **/
public static final String CLONING_ENABLED = "cloning-enabled";
+ /** The name of the <code>uda</code> element */
+ public static final String UDA_MANAGER = "uda-manager";
+ public static final String UDA = "uda";
+ public static final String UDA_NAME = "name";
+ public static final String UDA_CLASS = "class";
// begin constants for connection pool
public static final String CONNECTION_POOL = "pool";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
index ea3c975..d2ac140 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
@@ -58,6 +58,7 @@ import org.xml.sax.XMLReader;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.AttributesImpl;
+import com.gemstone.gemfire.internal.cache.InternalCache;
import com.gemstone.gemfire.InternalGemFireException;
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
@@ -99,7 +100,9 @@ import com.gemstone.gemfire.cache.client.internal.PoolImpl;
import com.gemstone.gemfire.cache.execute.Function;
import com.gemstone.gemfire.cache.execute.FunctionService;
import com.gemstone.gemfire.cache.partition.PartitionListener;
+import com.gemstone.gemfire.cache.query.Aggregator;
import com.gemstone.gemfire.cache.query.Index;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDAManager;
import com.gemstone.gemfire.cache.query.internal.index.HashIndex;
import com.gemstone.gemfire.cache.query.internal.index.PrimaryKeyIndex;
import com.gemstone.gemfire.cache.server.CacheServer;
@@ -535,7 +538,11 @@ public class CacheXmlGenerator extends CacheXml implements XMLReader {
} else if(this.version.compareTo(CacheXmlVersion.GEMFIRE_6_6) >= 0) {
generate(this.cache.getCacheTransactionManager());
}
-
+
+ if (this.version.compareTo(CacheXmlVersion.GEODE_1_0) >= 0) {
+ generateUDA(this.cache);
+ }
+
generateDynamicRegionFactory(this.cache);
if (!isClientCache) {
@@ -1391,6 +1398,23 @@ public class CacheXmlGenerator extends CacheXml implements XMLReader {
}
handler.endElement("", DYNAMIC_REGION_FACTORY, DYNAMIC_REGION_FACTORY);
}
+
+ private void generateUDA(Cache c) throws SAXException {
+ UDAManager udaMgr = ((InternalCache)c).getUDAManager();
+ Map<String, String> map = udaMgr.getUDAs();
+ if (map.isEmpty()) {
+ return;
+ }
+ handler.startElement("", UDA_MANAGER, UDA_MANAGER, EMPTY);
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("", "", UDA_NAME, "", entry.getKey());
+ atts.addAttribute("", "", UDA_CLASS, "", entry.getValue());
+ handler.startElement("", UDA, UDA, atts);
+ handler.endElement("", UDA, UDA);
+ }
+ handler.endElement("", UDA_MANAGER, UDA_MANAGER);
+ }
private void generateGatewaySender(GatewaySender sender) throws SAXException {
AttributesImpl atts = new AttributesImpl();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java
index e6c0b60..256f5ef 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java
@@ -90,6 +90,9 @@ import com.gemstone.gemfire.cache.execute.Function;
import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreCreation;
import com.gemstone.gemfire.cache.partition.PartitionListener;
import com.gemstone.gemfire.cache.query.IndexType;
+import com.gemstone.gemfire.cache.query.NameResolutionException;
+import com.gemstone.gemfire.cache.query.UDAExistsException;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDAManager;
import com.gemstone.gemfire.cache.query.internal.index.IndexCreationData;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
@@ -1967,6 +1970,23 @@ public class CacheXmlParser extends CacheXml implements ContentHandler {
this.stack.push(icd);
}
+ private void startUDA(Attributes atts) {
+ String name = atts.getValue(UDA_NAME);
+ String clazz = atts.getValue(UDA_CLASS);
+ Map<String, String> map = (Map<String, String>)this.stack.peek();
+ map.put(name, clazz);
+ }
+ private void startUDAManager() {
+ this.stack.push(new HashMap<String, String>());
+ }
+
+ private void endUDAManager() {
+ Map<String, String> map = (Map<String, String>)this.stack.pop();
+ for(Map.Entry<String, String> entry : map.entrySet()) {
+ this.cache.addUDA(entry.getKey(), entry.getValue());
+ }
+ }
+
/**
* When index element is ending we need to verify all attributes because of
* new index tag definition since 6.6.1 and support previous definition also.
@@ -2931,6 +2951,11 @@ public class CacheXmlParser extends CacheXml implements ContentHandler {
//push it in stack
startIndex(atts);
//this.stack.push(new IndexCreationData(atts.getValue(NAME)));
+ }else if (qName.equals(UDA_MANAGER)) {
+ startUDAManager();
+ }
+ else if (qName.equals(UDA)) {
+ startUDA(atts);
}
else if (qName.equals(FUNCTIONAL)) {
startFunctionalIndex(atts);
@@ -3300,6 +3325,10 @@ public class CacheXmlParser extends CacheXml implements ContentHandler {
else if (qName.equals(INDEX)) {
endIndex();
}
+ else if (qName.equals(UDA_MANAGER)) {
+ endUDAManager();
+ }else if (qName.equals(UDA)) {
+ }
else if (qName.equals(PRIMARY_KEY)) {
}
else if (qName.equals(TRANSACTION_MANAGER)) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
index 8285a65..7d57b8a 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/i18n/ParentLocalizedStrings.java
@@ -2359,11 +2359,11 @@ class ParentLocalizedStrings {
public static final StringId TransactionImpl_TRANSACTIONIMPLREGISTERSYNCHRONIZATIONSYNCHRONIZATION_IS_NULL = new StringId(3362, "TransactionImpl::registerSynchronization:Synchronization is null");
public static final StringId TransactionManagerImpl_NO_TRANSACTION_PRESENT = new StringId(3363, "no transaction present");
public static final StringId TransactionManagerImpl_TRANSACTIONMANAGER_INVALID = new StringId(3364, "TransactionManager invalid");
- // okay to reuse 3365
- // okay to reuse 3366
- // okay to reuse 3367
- // okay to reuse 3368
- // okay to reuse 3369
+ public static final StringId UDA_MANAGER_Class_Not_Found = new StringId(3365, "The class {0} for UDA {1} could not be found");
+ public static final StringId UDA_MANAGER_Uda_Exists = new StringId(3366, "UDA with name {0} already exists");
+ public static final StringId UDA_MANAGER_Class_Conflict = new StringId(3367, "UDA with name {0} is already registered with UDA class {1} which conflicts with the UDA class {2}");
+ public static final StringId UDA_MANAGER_Aggregator_Not_Found= new StringId(3368, "No UDA registered with name {0}");
+ public static final StringId UDA_MANAGER_Udas_Not_Collected= new StringId(3369, "UDAs defined in the system could not be collected");
// okay to reuse 3370
// okay to reuse 3371
// okay to reuse 3372
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
----------------------------------------------------------------------
diff --git a/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd b/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
index 5ecd67d..26a18de 100755
--- a/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
+++ b/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
@@ -77,6 +77,18 @@ declarative caching XML file elements unless indicated otherwise.
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="0" name="cache-transaction-manager" type="gf:cache-transaction-manager-type" />
<xsd:element maxOccurs="1" minOccurs="0" name="dynamic-region-factory" type="gf:dynamic-region-factory-type" />
+ <xsd:element maxOccurs="1" minOccurs="0" name="uda-manager">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="uda">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ <xsd:attribute name="class" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="gateway-hub">
<xsd:annotation>
<xsd:documentation>
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java
index b005463..d3afe36 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java
@@ -22,12 +22,6 @@ import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.query.Index;
-import com.gemstone.gemfire.cache.query.IndexExistsException;
-import com.gemstone.gemfire.cache.query.IndexInvalidException;
-import com.gemstone.gemfire.cache.query.IndexNameConflictException;
-import com.gemstone.gemfire.cache.query.IndexType;
-import com.gemstone.gemfire.cache.query.RegionNotFoundException;
import com.gemstone.gemfire.cache.query.functional.GroupByTestImpl;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/CompiledAggregateFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/CompiledAggregateFunctionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/CompiledAggregateFunctionJUnitTest.java
index fc793bf..a495684 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/CompiledAggregateFunctionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/CompiledAggregateFunctionJUnitTest.java
@@ -29,19 +29,13 @@ import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.query.Aggregator;
import com.gemstone.gemfire.cache.query.internal.aggregate.Avg;
-import com.gemstone.gemfire.cache.query.internal.aggregate.AvgBucketNode;
import com.gemstone.gemfire.cache.query.internal.aggregate.AvgDistinct;
-import com.gemstone.gemfire.cache.query.internal.aggregate.AvgDistinctPRQueryNode;
-import com.gemstone.gemfire.cache.query.internal.aggregate.AvgPRQueryNode;
import com.gemstone.gemfire.cache.query.internal.aggregate.Count;
import com.gemstone.gemfire.cache.query.internal.aggregate.CountDistinct;
-import com.gemstone.gemfire.cache.query.internal.aggregate.CountDistinctPRQueryNode;
-import com.gemstone.gemfire.cache.query.internal.aggregate.CountPRQueryNode;
import com.gemstone.gemfire.cache.query.internal.aggregate.DistinctAggregator;
import com.gemstone.gemfire.cache.query.internal.aggregate.MaxMin;
import com.gemstone.gemfire.cache.query.internal.aggregate.Sum;
import com.gemstone.gemfire.cache.query.internal.aggregate.SumDistinct;
-import com.gemstone.gemfire.cache.query.internal.aggregate.SumDistinctPRQueryNode;
import com.gemstone.gemfire.cache.query.internal.parse.OQLLexerTokenTypes;
import com.gemstone.gemfire.test.junit.categories.UnitTest;
@@ -73,12 +67,7 @@ public class CompiledAggregateFunctionJUnitTest extends TestCase {
ExecutionContext context2 = new ExecutionContext(null,cache);
assertTrue(caf2.evaluate(context2) instanceof CountDistinct);
- CompiledAggregateFunction caf3 = new CompiledAggregateFunction(null,
- OQLLexerTokenTypes.COUNT);
- ExecutionContext context3 = new ExecutionContext(null,cache);
- context3.setIsPRQueryNode(true);
- assertTrue(caf3.evaluate(context3) instanceof CountPRQueryNode);
-
+
CompiledAggregateFunction caf4 = new CompiledAggregateFunction(null,
OQLLexerTokenTypes.COUNT);
QueryExecutionContext context4 = new QueryExecutionContext(null,cache);
@@ -86,12 +75,7 @@ public class CompiledAggregateFunctionJUnitTest extends TestCase {
context4.setBucketList(bucketList);
assertTrue(caf4.evaluate(context4) instanceof Count);
- CompiledAggregateFunction caf5 = new CompiledAggregateFunction(null,
- OQLLexerTokenTypes.COUNT, true);
- ExecutionContext context5 = new ExecutionContext(null,cache);
- context5.setIsPRQueryNode(true);
- assertTrue(caf5.evaluate(context5) instanceof CountDistinctPRQueryNode);
-
+
CompiledAggregateFunction caf6 = new CompiledAggregateFunction(null,
OQLLexerTokenTypes.COUNT, true);
QueryExecutionContext context6 = new QueryExecutionContext(null,cache);
@@ -123,12 +107,7 @@ public class CompiledAggregateFunctionJUnitTest extends TestCase {
context4.setBucketList(bucketList);
assertTrue(caf4.evaluate(context4) instanceof Sum);
- CompiledAggregateFunction caf5 = new CompiledAggregateFunction(null,
- OQLLexerTokenTypes.SUM, true);
- ExecutionContext context5 = new ExecutionContext(null,cache);
- context5.setIsPRQueryNode(true);
- assertTrue(caf5.evaluate(context5) instanceof SumDistinctPRQueryNode);
-
+
CompiledAggregateFunction caf6 = new CompiledAggregateFunction(null,
OQLLexerTokenTypes.SUM, true);
QueryExecutionContext context6 = new QueryExecutionContext(null,cache);
@@ -148,24 +127,7 @@ public class CompiledAggregateFunctionJUnitTest extends TestCase {
ExecutionContext context2 = new ExecutionContext(null,cache);
assertTrue(caf2.evaluate(context2) instanceof AvgDistinct);
- CompiledAggregateFunction caf3 = new CompiledAggregateFunction(null,
- OQLLexerTokenTypes.AVG);
- ExecutionContext context3 = new ExecutionContext(null,cache);
- context3.setIsPRQueryNode(true);
- assertTrue(caf3.evaluate(context3) instanceof AvgPRQueryNode);
-
- CompiledAggregateFunction caf4 = new CompiledAggregateFunction(null,
- OQLLexerTokenTypes.AVG);
- QueryExecutionContext context4 = new QueryExecutionContext(null,cache);
- context4.setBucketList(this.bucketList);
- assertTrue(caf4.evaluate(context4) instanceof AvgBucketNode);
-
- CompiledAggregateFunction caf5 = new CompiledAggregateFunction(null,
- OQLLexerTokenTypes.AVG, true);
- ExecutionContext context5 = new ExecutionContext(null,cache);
- context5.setIsPRQueryNode(true);
- assertTrue(caf5.evaluate(context5) instanceof AvgDistinctPRQueryNode);
-
+
CompiledAggregateFunction caf6 = new CompiledAggregateFunction(null,
OQLLexerTokenTypes.AVG, true);
QueryExecutionContext context6 = new QueryExecutionContext(null,cache);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/aggregate/AggregatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/aggregate/AggregatorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/aggregate/AggregatorJUnitTest.java
index 9645b4e..e7eba61 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/aggregate/AggregatorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/aggregate/AggregatorJUnitTest.java
@@ -16,8 +16,9 @@
*/
package com.gemstone.gemfire.cache.query.internal.aggregate;
-import java.util.HashSet;
-import java.util.Set;
+import java.math.BigDecimal;
+
+import junit.framework.TestCase;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -41,9 +42,20 @@ public class AggregatorJUnitTest extends TestCase{
count.accumulate(null);
assertEquals(2, ((Number)count.terminate()).intValue());
- CountPRQueryNode countPrQ = new CountPRQueryNode();
- countPrQ.accumulate(new Integer(5));
- countPrQ.accumulate(new Integer(6));
+ Count countPrQ = new Count();
+ Count count1 = new Count();
+ for(int i = 1; i <=5; ++i) {
+ count1.accumulate(100);
+ }
+
+ Count count2 = new Count();
+ for(int i = 1; i <=6; ++i) {
+ count2.accumulate(100);
+ }
+
+ countPrQ.merge(count1);
+ countPrQ.merge(count2);
+
assertEquals(11, ((Number)countPrQ.terminate()).intValue());
}
@@ -58,20 +70,20 @@ public class AggregatorJUnitTest extends TestCase{
count.accumulate(null);
assertEquals(2, ((Number)count.terminate()).intValue());
- CountDistinctPRQueryNode cdpr = new CountDistinctPRQueryNode();
+ CountDistinct cdpr = new CountDistinct();
- Set<Integer> set1 = new HashSet<Integer>();
- set1.add(1);
- set1.add(2);
- set1.add(3);
+ CountDistinct cd1 = new CountDistinct();
+ cd1.accumulate(1);
+ cd1.accumulate(2);
+ cd1.accumulate(3);
- Set<Integer> set2 = new HashSet<Integer>();
- set2.add(3);
- set2.add(4);
- set2.add(5);
+ CountDistinct cd2 = new CountDistinct();
+ cd1.accumulate(3);
+ cd1.accumulate(4);
+ cd1.accumulate(5);
- cdpr.accumulate(set1);
- cdpr.accumulate(set2);
+ cdpr.merge(cd1);
+ cdpr.merge(cd2);
assertEquals(5, ((Number)cdpr.terminate()).intValue());
}
@@ -81,7 +93,25 @@ public class AggregatorJUnitTest extends TestCase{
sum.accumulate(new Integer(5));
sum.accumulate(new Integer(6));
sum.accumulate(null);
- assertEquals(11, ((Number)sum.terminate()).intValue());
+ assertEquals(11, ((Number)sum.terminate()).intValue());
+
+ Sum sumPR = new Sum();
+
+ Sum sum1 = new Sum();
+ sum1.accumulate(new Integer(5));
+ sum1.accumulate(new Integer(6));
+ sum1.accumulate(null);
+
+ Sum sum2 = new Sum();
+ sum2.accumulate(new Integer(7));
+ sum2.accumulate(new Integer(8));
+
+
+ sumPR.merge(sum1);
+ sumPR.merge(sum2);
+
+ assertEquals(26, ((Number)sumPR.terminate()).intValue());
+
}
@Test
@@ -94,20 +124,22 @@ public class AggregatorJUnitTest extends TestCase{
sum.accumulate(new Integer(6));
assertEquals(11, ((Number)sum.terminate()).intValue());
- SumDistinctPRQueryNode sdpr = new SumDistinctPRQueryNode();
+ SumDistinct sdpr = new SumDistinct();
+
+ SumDistinct sd1 = new SumDistinct();
+ sd1.accumulate(5);
+ sd1.accumulate(6);
+ sd1.accumulate(3);
+
+ SumDistinct sd2 = new SumDistinct();
+ sd1.accumulate(3);
+ sd1.accumulate(7);
+ sd1.accumulate(8);
+
+
+ sdpr.merge(sd1);
+ sdpr.merge(sd2);
- Set<Integer> set1 = new HashSet<Integer>();
- set1.add(5);
- set1.add(6);
- set1.add(3);
-
- Set<Integer> set2 = new HashSet<Integer>();
- set2.add(3);
- set2.add(7);
- set2.add(8);
-
- sdpr.accumulate(set1);
- sdpr.accumulate(set2);
assertEquals(29, ((Number)sdpr.terminate()).intValue());
}
@@ -128,29 +160,27 @@ public class AggregatorJUnitTest extends TestCase{
assertEquals(expected, ((Number)avg.terminate()).floatValue());
- AvgBucketNode abn = new AvgBucketNode();
- abn.accumulate(new Integer(1));
- abn.accumulate(new Integer(2));
- abn.accumulate(new Integer(3));
- abn.accumulate(new Integer(4));
- abn.accumulate(new Integer(5));
- abn.accumulate(new Integer(6));
- abn.accumulate(new Integer(7));
- abn.accumulate(new Integer(7));
- abn.accumulate(null);
- abn.accumulate(null);
- Object[] arr = (Object[]) abn.terminate();
- assertEquals(8, ((Integer)arr[0]).intValue());
- assertEquals(35, ((Number)arr[1]).intValue());
-
-
- AvgPRQueryNode apqn = new AvgPRQueryNode();
- Object[] val1 = new Object[]{new Integer(7), new Double(43)};
- Object[] val2 = new Object[]{new Integer(5), new Double(273.86)};
- apqn.accumulate(val1);
- apqn.accumulate(val2);
- expected = (43+273.86f)/12.0f ;
- assertEquals(expected, ((Number)apqn.terminate()).floatValue());
+ Avg avgQ = new Avg();
+
+ Avg abn1 = new Avg();
+ abn1.accumulate(new Integer(1));
+ abn1.accumulate(new Integer(2));
+ abn1.accumulate(new Integer(3));
+ abn1.accumulate(new Integer(4));
+
+ Avg abn2 = new Avg();
+ abn2.accumulate(new Integer(5));
+ abn2.accumulate(new Integer(6));
+ abn2.accumulate(new Integer(7));
+ abn2.accumulate(new Integer(8));
+ abn2.accumulate(null);
+ abn2.accumulate(null);
+
+ avgQ.merge(abn1);
+ avgQ.merge(abn2);
+
+ expected = (1+2+3 +4 +5 +6 + 7 + 8)/8.0f ;
+ assertEquals(expected, ((Number)avgQ.terminate()).floatValue());
}
@Test
@@ -173,22 +203,22 @@ public class AggregatorJUnitTest extends TestCase{
assertEquals(expected, ((Number)avg.terminate()).floatValue());
- AvgDistinctPRQueryNode adpqn = new AvgDistinctPRQueryNode();
-
- Set<Integer> set1 = new HashSet<Integer>();
- set1.add(5);
- set1.add(6);
- set1.add(3);
- set1.add(4);
-
- Set<Integer> set2 = new HashSet<Integer>();
- set2.add(3);
- set2.add(7);
- set2.add(8);
- set2.add(4);
-
- adpqn.accumulate(set1);
- adpqn.accumulate(set2);
+ AvgDistinct adpqn = new AvgDistinct();
+
+ AvgDistinct ad1 = new AvgDistinct();
+ ad1.accumulate(5);
+ ad1.accumulate(6);
+ ad1.accumulate(3);
+ ad1.accumulate(4);
+
+ AvgDistinct ad2 = new AvgDistinct();
+ ad2.accumulate(3);
+ ad2.accumulate(7);
+ ad2.accumulate(8);
+ ad2.accumulate(4);
+
+ adpqn.merge(ad1);
+ adpqn.merge(ad2);
expected = (3+4+5+6+7+8)/6.0f ;
assertEquals(expected, ((Number)adpqn.terminate()).floatValue());
@@ -210,5 +240,30 @@ public class AggregatorJUnitTest extends TestCase{
min.accumulate(null);
assertEquals(1,((Integer)min.terminate()).intValue());
}
+
+ @Test
+ public void testDowncast() throws Exception {
+ new BigDecimal(1d).longValueExact();
+ Sum sum = new Sum();
+ sum.accumulate(new Integer(Integer.MAX_VALUE));
+ sum.accumulate(new Integer(6));
+ Number result = (Number)sum.terminate();
+ assertTrue( result instanceof Long);
+ assertEquals(Integer.MAX_VALUE + 6l, result.longValue());
+
+ sum = new Sum();
+ sum.accumulate(new Long(5));
+ sum.accumulate(new Integer(6));
+ result = (Number)sum.terminate();
+ assertTrue( result instanceof Integer);
+ assertEquals(11, result.intValue());
+
+ sum = new Sum();
+ sum.accumulate(Float.MAX_VALUE);
+ result = (Number)sum.terminate();
+ assertTrue( result instanceof Double);
+ assertEquals(Float.MAX_VALUE, result.floatValue());
+
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java
index 57e3a13..f3959e4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java
@@ -22,7 +22,10 @@ package com.gemstone.gemfire.cache30;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.query.Aggregator;
+import com.gemstone.gemfire.cache.query.internal.aggregate.uda.UDAManager;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
@@ -30,6 +33,7 @@ import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.ResourceManagerCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import java.util.Map;
public class CacheXmlGeode10DUnitTest extends CacheXml81DUnitTest {
@@ -231,4 +235,74 @@ public class CacheXmlGeode10DUnitTest extends CacheXml81DUnitTest {
System.clearProperty("gemfire."+DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME);
}
}
+
+ public void testUDA() {
+ final CacheCreation cache = new CacheCreation();
+ cache.addUDA("uda1", UDACLass1.class.getName());
+ cache.addUDA("uda2", UDACLass2.class.getName());
+ cache.addUDA("uda3", UDACLass3.class.getName());
+ testXml(cache);
+
+ final Cache c = getCache();
+ assertNotNull(c);
+ UDAManager udaMgr = ((GemFireCacheImpl) c).getUDAManager();
+ Map<String, String> map = udaMgr.getUDAs();
+ assertEquals(map.get("uda1"), UDACLass1.class.getName());
+ assertEquals(map.get("uda2"), UDACLass2.class.getName());
+ assertEquals(map.get("uda3"), UDACLass3.class.getName());
+ }
+
+ public class UDACLass1 implements Aggregator {
+
+ @Override
+ public void accumulate(Object value) {}
+
+ @Override
+ public void init() {}
+
+ @Override
+ public Object terminate() {
+ return null;
+ }
+
+ @Override
+ public void merge(Aggregator otherAggregator) {}
+
+ }
+
+ public class UDACLass2 implements Aggregator {
+
+ @Override
+ public void accumulate(Object value) {}
+
+ @Override
+ public void init() {}
+
+ @Override
+ public Object terminate() {
+ return null;
+ }
+
+ @Override
+ public void merge(Aggregator otherAggregator) {}
+
+ }
+
+ public class UDACLass3 implements Aggregator {
+
+ @Override
+ public void accumulate(Object value) {}
+
+ @Override
+ public void init() {}
+
+ @Override
+ public Object terminate() {
+ return null;
+ }
+
+ @Override
+ public void merge(Aggregator otherAggregator) {}
+
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4f85cac9/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java
index 8c9776e..dd09247 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java
@@ -38,7 +38,7 @@ public class CacheXmlTestCase extends CacheTestCase {
private File xmlFile;
/** set this to false if a test needs a non-loner distributed system */
- static boolean lonerDistributedSystem = true;
+ protected static boolean lonerDistributedSystem = true;
public CacheXmlTestCase(String name) {
super(name);