incubator-oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfos...@apache.org
Subject svn commit: r1002752 [4/9] - in /incubator/oodt/trunk/catalog: ./ .externalToolBuilders/ .settings/ src/ src/main/ src/main/assembly/ src/main/bin/ src/main/java/ src/main/java/gov/ src/main/java/gov/nasa/ src/main/java/gov/nasa/jpl/ src/main/java/gov/...
Date Wed, 29 Sep 2010 17:19:15 GMT
Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,780 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. QueryParserTokenManager.java */
+package org.apache.oodt.cas.catalog.query.parser;
+import java.io.ByteArrayInputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Vector;
+import java.util.Properties;
+import org.apache.oodt.cas.catalog.query.QueryExpression;
+import org.apache.oodt.cas.catalog.query.QueryLogicalGroup;
+import org.apache.oodt.cas.catalog.query.StdQueryExpression;
+import org.apache.oodt.cas.catalog.query.ComparisonQueryExpression;
+import org.apache.oodt.cas.catalog.query.CustomQueryExpression;
+import org.apache.oodt.cas.catalog.term.Term;
+
+/** Token Manager. */
+public class QueryParserTokenManager implements QueryParserConstants
+{
+
+  /** Debug output. */
+  public  java.io.PrintStream debugStream = System.out;
+  /** Set debug output. */
+  public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+   switch (pos)
+   {
+      case 0:
+         if ((active0 & 0x18000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            return 16;
+         }
+         if ((active0 & 0x80L) != 0L)
+            return 10;
+         return -1;
+      case 1:
+         if ((active0 & 0x18000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            jjmatchedPos = 1;
+            return 16;
+         }
+         return -1;
+      case 2:
+         if ((active0 & 0x18000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            jjmatchedPos = 2;
+            return 16;
+         }
+         return -1;
+      case 3:
+         if ((active0 & 0x8000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            jjmatchedPos = 3;
+            return 16;
+         }
+         if ((active0 & 0x10000L) != 0L)
+            return 16;
+         return -1;
+      case 4:
+         if ((active0 & 0x8000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            jjmatchedPos = 4;
+            return 16;
+         }
+         return -1;
+      case 5:
+         if ((active0 & 0x8000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            jjmatchedPos = 5;
+            return 16;
+         }
+         return -1;
+      case 6:
+         if ((active0 & 0x8000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            jjmatchedPos = 6;
+            return 16;
+         }
+         return -1;
+      case 7:
+         if ((active0 & 0x8000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            jjmatchedPos = 7;
+            return 16;
+         }
+         return -1;
+      case 8:
+         if ((active0 & 0x8000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            jjmatchedPos = 8;
+            return 16;
+         }
+         return -1;
+      case 9:
+         if ((active0 & 0x8000L) != 0L)
+         {
+            jjmatchedKind = 23;
+            jjmatchedPos = 9;
+            return 16;
+         }
+         return -1;
+      default :
+         return -1;
+   }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+   return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private int jjStopAtPos(int pos, int kind)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   return pos + 1;
+}
+private int jjMoveStringLiteralDfa0_0()
+{
+   switch(curChar)
+   {
+      case 13:
+         jjmatchedKind = 1;
+         return jjMoveStringLiteralDfa1_0(0x8L);
+      case 32:
+         jjmatchedKind = 4;
+         return jjMoveStringLiteralDfa1_0(0x60L);
+      case 39:
+         return jjStartNfaWithStates_0(0, 7, 10);
+      case 40:
+         return jjStopAtPos(0, 13);
+      case 41:
+         return jjStopAtPos(0, 14);
+      case 44:
+         return jjStopAtPos(0, 10);
+      case 59:
+         return jjStopAtPos(0, 9);
+      case 60:
+         jjmatchedKind = 22;
+         return jjMoveStringLiteralDfa1_0(0x200000L);
+      case 61:
+         jjmatchedKind = 8;
+         return jjMoveStringLiteralDfa1_0(0x40000L);
+      case 62:
+         jjmatchedKind = 20;
+         return jjMoveStringLiteralDfa1_0(0x80000L);
+      case 98:
+         return jjMoveStringLiteralDfa1_0(0x8000L);
+      case 110:
+         return jjMoveStringLiteralDfa1_0(0x10000L);
+      case 123:
+         return jjStopAtPos(0, 11);
+      case 125:
+         return jjStopAtPos(0, 12);
+      default :
+         return jjMoveNfa_0(3, 0);
+   }
+}
+private int jjMoveStringLiteralDfa1_0(long active0)
+{
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(0, active0);
+      return 1;
+   }
+   switch(curChar)
+   {
+      case 10:
+         if ((active0 & 0x8L) != 0L)
+            return jjStopAtPos(1, 3);
+         break;
+      case 61:
+         if ((active0 & 0x40000L) != 0L)
+            return jjStopAtPos(1, 18);
+         else if ((active0 & 0x80000L) != 0L)
+            return jjStopAtPos(1, 19);
+         else if ((active0 & 0x200000L) != 0L)
+            return jjStopAtPos(1, 21);
+         break;
+      case 65:
+         return jjMoveStringLiteralDfa2_0(active0, 0x20L);
+      case 79:
+         return jjMoveStringLiteralDfa2_0(active0, 0x40L);
+      case 97:
+         return jjMoveStringLiteralDfa2_0(active0, 0x10000L);
+      case 117:
+         return jjMoveStringLiteralDfa2_0(active0, 0x8000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(0, active0);
+}
+private int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(0, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(1, active0);
+      return 2;
+   }
+   switch(curChar)
+   {
+      case 78:
+         return jjMoveStringLiteralDfa3_0(active0, 0x20L);
+      case 82:
+         return jjMoveStringLiteralDfa3_0(active0, 0x40L);
+      case 99:
+         return jjMoveStringLiteralDfa3_0(active0, 0x8000L);
+      case 109:
+         return jjMoveStringLiteralDfa3_0(active0, 0x10000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(1, active0);
+}
+private int jjMoveStringLiteralDfa3_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(1, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(2, active0);
+      return 3;
+   }
+   switch(curChar)
+   {
+      case 32:
+         if ((active0 & 0x40L) != 0L)
+            return jjStopAtPos(3, 6);
+         break;
+      case 68:
+         return jjMoveStringLiteralDfa4_0(active0, 0x20L);
+      case 101:
+         if ((active0 & 0x10000L) != 0L)
+            return jjStartNfaWithStates_0(3, 16, 16);
+         break;
+      case 107:
+         return jjMoveStringLiteralDfa4_0(active0, 0x8000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(2, active0);
+}
+private int jjMoveStringLiteralDfa4_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(2, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(3, active0);
+      return 4;
+   }
+   switch(curChar)
+   {
+      case 32:
+         if ((active0 & 0x20L) != 0L)
+            return jjStopAtPos(4, 5);
+         break;
+      case 101:
+         return jjMoveStringLiteralDfa5_0(active0, 0x8000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(3, active0);
+}
+private int jjMoveStringLiteralDfa5_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(3, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(4, active0);
+      return 5;
+   }
+   switch(curChar)
+   {
+      case 116:
+         return jjMoveStringLiteralDfa6_0(active0, 0x8000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(4, active0);
+}
+private int jjMoveStringLiteralDfa6_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(4, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(5, active0);
+      return 6;
+   }
+   switch(curChar)
+   {
+      case 78:
+         return jjMoveStringLiteralDfa7_0(active0, 0x8000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(5, active0);
+}
+private int jjMoveStringLiteralDfa7_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(5, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(6, active0);
+      return 7;
+   }
+   switch(curChar)
+   {
+      case 97:
+         return jjMoveStringLiteralDfa8_0(active0, 0x8000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(6, active0);
+}
+private int jjMoveStringLiteralDfa8_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(6, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(7, active0);
+      return 8;
+   }
+   switch(curChar)
+   {
+      case 109:
+         return jjMoveStringLiteralDfa9_0(active0, 0x8000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(7, active0);
+}
+private int jjMoveStringLiteralDfa9_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(7, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(8, active0);
+      return 9;
+   }
+   switch(curChar)
+   {
+      case 101:
+         return jjMoveStringLiteralDfa10_0(active0, 0x8000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(8, active0);
+}
+private int jjMoveStringLiteralDfa10_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(8, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(9, active0);
+      return 10;
+   }
+   switch(curChar)
+   {
+      case 115:
+         if ((active0 & 0x8000L) != 0L)
+            return jjStartNfaWithStates_0(10, 15, 16);
+         break;
+      default :
+         break;
+   }
+   return jjStartNfa_0(9, active0);
+}
+private int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) { return pos + 1; }
+   return jjMoveNfa_0(state, pos + 1);
+}
+private int jjMoveNfa_0(int startState, int curPos)
+{
+   int startsAt = 0;
+   jjnewStateCnt = 16;
+   int i = 1;
+   jjstateSet[0] = startState;
+   int kind = 0x7fffffff;
+   for (;;)
+   {
+      if (++jjround == 0x7fffffff)
+         ReInitRounds();
+      if (curChar < 64)
+      {
+         long l = 1L << curChar;
+         do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 10:
+                  if ((0xd7ffe77a00000000L & l) != 0L)
+                     jjCheckNAddStates(0, 2);
+                  break;
+               case 16:
+               case 5:
+                  if ((0x7ffe00000000000L & l) == 0L)
+                     break;
+                  if (kind > 23)
+                     kind = 23;
+                  jjCheckNAdd(5);
+                  break;
+               case 3:
+                  if (curChar == 39)
+                     jjAddStates(3, 4);
+                  break;
+               case 0:
+                  if (curChar == 58)
+                     jjstateSet[jjnewStateCnt++] = 1;
+                  break;
+               case 2:
+                  if ((0x7ffe00000000000L & l) == 0L)
+                     break;
+                  if (kind > 17)
+                     kind = 17;
+                  jjstateSet[jjnewStateCnt++] = 2;
+                  break;
+               case 8:
+                  if ((0x7ffe00000000000L & l) != 0L)
+                     jjCheckNAddTwoStates(8, 9);
+                  break;
+               case 9:
+                  if (curChar == 39 && kind > 24)
+                     kind = 24;
+                  break;
+               case 11:
+                  if (curChar == 32)
+                     jjAddStates(5, 6);
+                  break;
+               case 12:
+                  if ((0x7ffe00000000000L & l) != 0L)
+                     jjCheckNAddStates(7, 9);
+                  break;
+               case 13:
+                  if ((0xd7ffe77a00000000L & l) != 0L)
+                     jjCheckNAddStates(7, 9);
+                  break;
+               case 14:
+                  if ((0xd000877a00000000L & l) != 0L)
+                     jjCheckNAddStates(7, 9);
+                  break;
+               case 15:
+                  if ((0xd7ffe77a00000000L & l) != 0L)
+                     jjCheckNAddStates(10, 13);
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else if (curChar < 128)
+      {
+         long l = 1L << (curChar & 077);
+         do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 10:
+                  if ((0x6fffffffffffffffL & l) != 0L)
+                     jjCheckNAddStates(0, 2);
+                  if ((0x7fffffe07fffffeL & l) != 0L)
+                     jjCheckNAddStates(14, 16);
+                  break;
+               case 16:
+                  if ((0x7fffffe87fffffeL & l) != 0L)
+                  {
+                     if (kind > 23)
+                        kind = 23;
+                     jjCheckNAdd(5);
+                  }
+                  if ((0x7fffffe07fffffeL & l) != 0L)
+                  {
+                     if (kind > 23)
+                        kind = 23;
+                     jjCheckNAddTwoStates(4, 5);
+                  }
+                  break;
+               case 3:
+                  if ((0x7fffffe07fffffeL & l) != 0L)
+                  {
+                     if (kind > 23)
+                        kind = 23;
+                     jjCheckNAddTwoStates(4, 5);
+                  }
+                  if (curChar == 112)
+                     jjstateSet[jjnewStateCnt++] = 0;
+                  break;
+               case 1:
+                  if ((0x7fffffe07fffffeL & l) == 0L)
+                     break;
+                  if (kind > 17)
+                     kind = 17;
+                  jjCheckNAddTwoStates(1, 2);
+                  break;
+               case 2:
+                  if ((0x7fffffe87fffffeL & l) == 0L)
+                     break;
+                  if (kind > 17)
+                     kind = 17;
+                  jjCheckNAdd(2);
+                  break;
+               case 4:
+                  if ((0x7fffffe07fffffeL & l) == 0L)
+                     break;
+                  if (kind > 23)
+                     kind = 23;
+                  jjCheckNAddTwoStates(4, 5);
+                  break;
+               case 5:
+                  if ((0x7fffffe87fffffeL & l) == 0L)
+                     break;
+                  if (kind > 23)
+                     kind = 23;
+                  jjCheckNAdd(5);
+                  break;
+               case 7:
+                  if ((0x7fffffe07fffffeL & l) != 0L)
+                     jjCheckNAddStates(14, 16);
+                  break;
+               case 8:
+                  if ((0x7fffffe87fffffeL & l) != 0L)
+                     jjCheckNAddTwoStates(8, 9);
+                  break;
+               case 12:
+                  if ((0x7fffffe87fffffeL & l) != 0L)
+                     jjCheckNAddStates(7, 9);
+                  break;
+               case 13:
+                  if ((0x6fffffffffffffffL & l) != 0L)
+                     jjCheckNAddStates(7, 9);
+                  break;
+               case 14:
+                  if ((0x6800000178000001L & l) != 0L)
+                     jjCheckNAddStates(7, 9);
+                  break;
+               case 15:
+                  if ((0x6fffffffffffffffL & l) != 0L)
+                     jjCheckNAddStates(10, 13);
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else
+      {
+         int i2 = (curChar & 0xff) >> 6;
+         long l2 = 1L << (curChar & 077);
+         do
+         {
+            switch(jjstateSet[--i])
+            {
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      if (kind != 0x7fffffff)
+      {
+         jjmatchedKind = kind;
+         jjmatchedPos = curPos;
+         kind = 0x7fffffff;
+      }
+      ++curPos;
+      if ((i = jjnewStateCnt) == (startsAt = 16 - (jjnewStateCnt = startsAt)))
+         return curPos;
+      try { curChar = input_stream.readChar(); }
+      catch(java.io.IOException e) { return curPos; }
+   }
+}
+static final int[] jjnextStates = {
+   9, 11, 15, 7, 10, 12, 14, 13, 9, 11, 13, 9, 11, 15, 7, 8, 
+   9, 
+};
+
+/** Token literal values. */
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, "\40", "\40\101\116\104\40", "\40\117\122\40", "\47", 
+"\75", "\73", "\54", "\173", "\175", "\50", "\51", 
+"\142\165\143\153\145\164\116\141\155\145\163", "\156\141\155\145", null, "\75\75", "\76\75", "\76", "\74\75", "\74", null, 
+null, null, null, null, };
+
+/** Lexer state names. */
+public static final String[] lexStateNames = {
+   "DEFAULT",
+};
+static final long[] jjtoToken = {
+   0x1fffff1L, 
+};
+static final long[] jjtoSkip = {
+   0xeL, 
+};
+protected SimpleCharStream input_stream;
+private final int[] jjrounds = new int[16];
+private final int[] jjstateSet = new int[32];
+protected char curChar;
+/** Constructor. */
+public QueryParserTokenManager(SimpleCharStream stream){
+   if (SimpleCharStream.staticFlag)
+      throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+   input_stream = stream;
+}
+
+/** Constructor. */
+public QueryParserTokenManager(SimpleCharStream stream, int lexState){
+   this(stream);
+   SwitchTo(lexState);
+}
+
+/** Reinitialise parser. */
+public void ReInit(SimpleCharStream stream)
+{
+   jjmatchedPos = jjnewStateCnt = 0;
+   curLexState = defaultLexState;
+   input_stream = stream;
+   ReInitRounds();
+}
+private void ReInitRounds()
+{
+   int i;
+   jjround = 0x80000001;
+   for (i = 16; i-- > 0;)
+      jjrounds[i] = 0x80000000;
+}
+
+/** Reinitialise parser. */
+public void ReInit(SimpleCharStream stream, int lexState)
+{
+   ReInit(stream);
+   SwitchTo(lexState);
+}
+
+/** Switch to specified lex state. */
+public void SwitchTo(int lexState)
+{
+   if (lexState >= 1 || lexState < 0)
+      throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+   else
+      curLexState = lexState;
+}
+
+protected Token jjFillToken()
+{
+   final Token t;
+   final String curTokenImage;
+   final int beginLine;
+   final int endLine;
+   final int beginColumn;
+   final int endColumn;
+   String im = jjstrLiteralImages[jjmatchedKind];
+   curTokenImage = (im == null) ? input_stream.GetImage() : im;
+   beginLine = input_stream.getBeginLine();
+   beginColumn = input_stream.getBeginColumn();
+   endLine = input_stream.getEndLine();
+   endColumn = input_stream.getEndColumn();
+   t = Token.newToken(jjmatchedKind, curTokenImage);
+
+   t.beginLine = beginLine;
+   t.endLine = endLine;
+   t.beginColumn = beginColumn;
+   t.endColumn = endColumn;
+
+   return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+/** Get the next Token. */
+public Token getNextToken() 
+{
+  Token matchedToken;
+  int curPos = 0;
+
+  EOFLoop :
+  for (;;)
+  {
+   try
+   {
+      curChar = input_stream.BeginToken();
+   }
+   catch(java.io.IOException e)
+   {
+      jjmatchedKind = 0;
+      matchedToken = jjFillToken();
+      return matchedToken;
+   }
+
+   try { input_stream.backup(0);
+      while (curChar <= 10 && (0x400L & (1L << curChar)) != 0L)
+         curChar = input_stream.BeginToken();
+   }
+   catch (java.io.IOException e1) { continue EOFLoop; }
+   jjmatchedKind = 0x7fffffff;
+   jjmatchedPos = 0;
+   curPos = jjMoveStringLiteralDfa0_0();
+   if (jjmatchedKind != 0x7fffffff)
+   {
+      if (jjmatchedPos + 1 < curPos)
+         input_stream.backup(curPos - jjmatchedPos - 1);
+      if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+      {
+         matchedToken = jjFillToken();
+         return matchedToken;
+      }
+      else
+      {
+         continue EOFLoop;
+      }
+   }
+   int error_line = input_stream.getEndLine();
+   int error_column = input_stream.getEndColumn();
+   String error_after = null;
+   boolean EOFSeen = false;
+   try { input_stream.readChar(); input_stream.backup(1); }
+   catch (java.io.IOException e1) {
+      EOFSeen = true;
+      error_after = curPos <= 1 ? "" : input_stream.GetImage();
+      if (curChar == '\n' || curChar == '\r') {
+         error_line++;
+         error_column = 0;
+      }
+      else
+         error_column++;
+   }
+   if (!EOFSeen) {
+      input_stream.backup(1);
+      error_after = curPos <= 1 ? "" : input_stream.GetImage();
+   }
+   throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+  }
+}
+
+private void jjCheckNAdd(int state)
+{
+   if (jjrounds[state] != jjround)
+   {
+      jjstateSet[jjnewStateCnt++] = state;
+      jjrounds[state] = jjround;
+   }
+}
+private void jjAddStates(int start, int end)
+{
+   do {
+      jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+   } while (start++ != end);
+}
+private void jjCheckNAddTwoStates(int state1, int state2)
+{
+   jjCheckNAdd(state1);
+   jjCheckNAdd(state2);
+}
+
+private void jjCheckNAddStates(int start, int end)
+{
+   do {
+      jjCheckNAdd(jjnextStates[start]);
+   } while (start++ != end);
+}
+
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTreeConstants.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTreeConstants.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTreeConstants.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTreeConstants.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,29 @@
+/* Generated By:JavaCC: Do not edit this line. QueryParserTreeConstants.java Version 5.0 */
+package org.apache.oodt.cas.catalog.query.parser;
+
+public interface QueryParserTreeConstants
+{
+  public int JJTPARSEINPUT = 0;
+  public int JJTQUERY = 1;
+  public int JJTQUERYEXPRESSION = 2;
+  public int JJTSTDQUERYEXPRESSION = 3;
+  public int JJTCOMPARISONQUERYEXPRESSION = 4;
+  public int JJTPRIORITYQUERYEXPRESSION = 5;
+  public int JJTCUSTOMQUERYEXPRESSION = 6;
+  public int JJTGETVALUES = 7;
+  public int JJTGETPROPERTIES = 8;
+
+
+  public String[] jjtNodeName = {
+    "parseInput",
+    "Query",
+    "QueryExpression",
+    "StdQueryExpression",
+    "ComparisonQueryExpression",
+    "PriorityQueryExpression",
+    "CustomQueryExpression",
+    "getValues",
+    "getProperties",
+  };
+}
+/* JavaCC - OriginalChecksum=cd7c1693d949a3ea81c5b0f64e573c6d (do not edit this line) */

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,471 @@
+/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */
+/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
+package org.apache.oodt.cas.catalog.query.parser;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public class SimpleCharStream
+{
+/** Whether parser is static. */
+  public static final boolean staticFlag = false;
+  int bufsize;
+  int available;
+  int tokenBegin;
+/** Position in buffer. */
+  public int bufpos = -1;
+  protected int bufline[];
+  protected int bufcolumn[];
+
+  protected int column = 0;
+  protected int line = 1;
+
+  protected boolean prevCharIsCR = false;
+  protected boolean prevCharIsLF = false;
+
+  protected java.io.Reader inputStream;
+
+  protected char[] buffer;
+  protected int maxNextCharInd = 0;
+  protected int inBuf = 0;
+  protected int tabSize = 8;
+
+  protected void setTabSize(int i) { tabSize = i; }
+  protected int getTabSize(int i) { return tabSize; }
+
+
+  protected void ExpandBuff(boolean wrapAround)
+  {
+    char[] newbuffer = new char[bufsize + 2048];
+    int newbufline[] = new int[bufsize + 2048];
+    int newbufcolumn[] = new int[bufsize + 2048];
+
+    try
+    {
+      if (wrapAround)
+      {
+        System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+        System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
+        buffer = newbuffer;
+
+        System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+        System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+        bufline = newbufline;
+
+        System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+        System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+        bufcolumn = newbufcolumn;
+
+        maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+      }
+      else
+      {
+        System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+        buffer = newbuffer;
+
+        System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+        bufline = newbufline;
+
+        System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+        bufcolumn = newbufcolumn;
+
+        maxNextCharInd = (bufpos -= tokenBegin);
+      }
+    }
+    catch (Throwable t)
+    {
+      throw new Error(t.getMessage());
+    }
+
+
+    bufsize += 2048;
+    available = bufsize;
+    tokenBegin = 0;
+  }
+
+  protected void FillBuff() throws java.io.IOException
+  {
+    if (maxNextCharInd == available)
+    {
+      if (available == bufsize)
+      {
+        if (tokenBegin > 2048)
+        {
+          bufpos = maxNextCharInd = 0;
+          available = tokenBegin;
+        }
+        else if (tokenBegin < 0)
+          bufpos = maxNextCharInd = 0;
+        else
+          ExpandBuff(false);
+      }
+      else if (available > tokenBegin)
+        available = bufsize;
+      else if ((tokenBegin - available) < 2048)
+        ExpandBuff(true);
+      else
+        available = tokenBegin;
+    }
+
+    int i;
+    try {
+      if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
+      {
+        inputStream.close();
+        throw new java.io.IOException();
+      }
+      else
+        maxNextCharInd += i;
+      return;
+    }
+    catch(java.io.IOException e) {
+      --bufpos;
+      backup(0);
+      if (tokenBegin == -1)
+        tokenBegin = bufpos;
+      throw e;
+    }
+  }
+
+/** Start. */
+  public char BeginToken() throws java.io.IOException
+  {
+    tokenBegin = -1;
+    char c = readChar();
+    tokenBegin = bufpos;
+
+    return c;
+  }
+
+  protected void UpdateLineColumn(char c)
+  {
+    column++;
+
+    if (prevCharIsLF)
+    {
+      prevCharIsLF = false;
+      line += (column = 1);
+    }
+    else if (prevCharIsCR)
+    {
+      prevCharIsCR = false;
+      if (c == '\n')
+      {
+        prevCharIsLF = true;
+      }
+      else
+        line += (column = 1);
+    }
+
+    switch (c)
+    {
+      case '\r' :
+        prevCharIsCR = true;
+        break;
+      case '\n' :
+        prevCharIsLF = true;
+        break;
+      case '\t' :
+        column--;
+        column += (tabSize - (column % tabSize));
+        break;
+      default :
+        break;
+    }
+
+    bufline[bufpos] = line;
+    bufcolumn[bufpos] = column;
+  }
+
+/** Read a character. */
+  public char readChar() throws java.io.IOException
+  {
+    if (inBuf > 0)
+    {
+      --inBuf;
+
+      if (++bufpos == bufsize)
+        bufpos = 0;
+
+      return buffer[bufpos];
+    }
+
+    if (++bufpos >= maxNextCharInd)
+      FillBuff();
+
+    char c = buffer[bufpos];
+
+    UpdateLineColumn(c);
+    return c;
+  }
+
+  @Deprecated
+  /**
+   * @deprecated
+   * @see #getEndColumn
+   */
+
+  public int getColumn() {
+    return bufcolumn[bufpos];
+  }
+
+  @Deprecated
+  /**
+   * @deprecated
+   * @see #getEndLine
+   */
+
+  public int getLine() {
+    return bufline[bufpos];
+  }
+
+  /** Get token end column number. */
+  public int getEndColumn() {
+    return bufcolumn[bufpos];
+  }
+
+  /** Get token end line number. */
+  public int getEndLine() {
+     return bufline[bufpos];
+  }
+
+  /** Get token beginning column number. */
+  public int getBeginColumn() {
+    return bufcolumn[tokenBegin];
+  }
+
+  /** Get token beginning line number. */
+  public int getBeginLine() {
+    return bufline[tokenBegin];
+  }
+
+/** Backup a number of characters. */
+  public void backup(int amount) {
+
+    inBuf += amount;
+    if ((bufpos -= amount) < 0)
+      bufpos += bufsize;
+  }
+
+  /** Constructor. */
+  public SimpleCharStream(java.io.Reader dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+    inputStream = dstream;
+    line = startline;
+    column = startcolumn - 1;
+
+    available = bufsize = buffersize;
+    buffer = new char[buffersize];
+    bufline = new int[buffersize];
+    bufcolumn = new int[buffersize];
+  }
+
+  /** Constructor. */
+  public SimpleCharStream(java.io.Reader dstream, int startline,
+                          int startcolumn)
+  {
+    this(dstream, startline, startcolumn, 4096);
+  }
+
+  /** Constructor. */
+  public SimpleCharStream(java.io.Reader dstream)
+  {
+    this(dstream, 1, 1, 4096);
+  }
+
+  /** Reinitialise. */
+  public void ReInit(java.io.Reader dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+    inputStream = dstream;
+    line = startline;
+    column = startcolumn - 1;
+
+    if (buffer == null || buffersize != buffer.length)
+    {
+      available = bufsize = buffersize;
+      buffer = new char[buffersize];
+      bufline = new int[buffersize];
+      bufcolumn = new int[buffersize];
+    }
+    prevCharIsLF = prevCharIsCR = false;
+    tokenBegin = inBuf = maxNextCharInd = 0;
+    bufpos = -1;
+  }
+
+  /** Reinitialise. */
+  public void ReInit(java.io.Reader dstream, int startline,
+                     int startcolumn)
+  {
+    ReInit(dstream, startline, startcolumn, 4096);
+  }
+
+  /** Reinitialise. */
+  public void ReInit(java.io.Reader dstream)
+  {
+    ReInit(dstream, 1, 1, 4096);
+  }
+  /** Constructor. */
+  public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
+  int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+  {
+    this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+  }
+
+  /** Constructor. */
+  public SimpleCharStream(java.io.InputStream dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+    this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+  }
+
+  /** Constructor. */
+  public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
+                          int startcolumn) throws java.io.UnsupportedEncodingException
+  {
+    this(dstream, encoding, startline, startcolumn, 4096);
+  }
+
+  /** Constructor. */
+  public SimpleCharStream(java.io.InputStream dstream, int startline,
+                          int startcolumn)
+  {
+    this(dstream, startline, startcolumn, 4096);
+  }
+
+  /** Constructor. */
+  public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+  {
+    this(dstream, encoding, 1, 1, 4096);
+  }
+
+  /** Constructor. */
+  public SimpleCharStream(java.io.InputStream dstream)
+  {
+    this(dstream, 1, 1, 4096);
+  }
+
+  /** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+                          int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+  {
+    ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+  }
+
+  /** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, int startline,
+                          int startcolumn, int buffersize)
+  {
+    ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+  }
+
+  /** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+  {
+    ReInit(dstream, encoding, 1, 1, 4096);
+  }
+
+  /** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream)
+  {
+    ReInit(dstream, 1, 1, 4096);
+  }
+  /** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+                     int startcolumn) throws java.io.UnsupportedEncodingException
+  {
+    ReInit(dstream, encoding, startline, startcolumn, 4096);
+  }
+  /** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, int startline,
+                     int startcolumn)
+  {
+    ReInit(dstream, startline, startcolumn, 4096);
+  }
+  /** Get token literal value. */
+  public String GetImage()
+  {
+    if (bufpos >= tokenBegin)
+      return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+    else
+      return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+                            new String(buffer, 0, bufpos + 1);
+  }
+
+  /** Get the suffix. */
+  public char[] GetSuffix(int len)
+  {
+    char[] ret = new char[len];
+
+    if ((bufpos + 1) >= len)
+      System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+    else
+    {
+      System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+                                                        len - bufpos - 1);
+      System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+    }
+
+    return ret;
+  }
+
+  /** Reset buffer when finished. */
+  public void Done()
+  {
+    buffer = null;
+    bufline = null;
+    bufcolumn = null;
+  }
+
+  /**
+   * Method to adjust line and column numbers for the start of a token.
+   */
+  public void adjustBeginLineColumn(int newLine, int newCol)
+  {
+    int start = tokenBegin;
+    int len;
+
+    if (bufpos >= tokenBegin)
+    {
+      len = bufpos - tokenBegin + inBuf + 1;
+    }
+    else
+    {
+      len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+    }
+
+    int i = 0, j = 0, k = 0;
+    int nextColDiff = 0, columnDiff = 0;
+
+    while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+    {
+      bufline[j] = newLine;
+      nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+      bufcolumn[j] = newCol + columnDiff;
+      columnDiff = nextColDiff;
+      i++;
+    }
+
+    if (i < len)
+    {
+      bufline[j] = newLine++;
+      bufcolumn[j] = newCol + columnDiff;
+
+      while (i++ < len)
+      {
+        if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+          bufline[j] = newLine++;
+        else
+          bufline[j] = newLine;
+      }
+    }
+
+    line = bufline[j];
+    column = bufcolumn[j];
+  }
+
+}
+/* JavaCC - OriginalChecksum=121bf419e6c52d5335ce44acb0bd27aa (do not edit this line) */

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleNode.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleNode.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleNode.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleNode.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,79 @@
+/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */
+/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
+package org.apache.oodt.cas.catalog.query.parser;
+
+public
+class SimpleNode implements Node {
+
+  protected Node parent;
+  protected Node[] children;
+  protected int id;
+  protected Object value;
+  protected QueryParser parser;
+
+  public SimpleNode(int i) {
+    id = i;
+  }
+
+  public SimpleNode(QueryParser p, int i) {
+    this(i);
+    parser = p;
+  }
+
+  public void jjtOpen() {
+  }
+
+  public void jjtClose() {
+  }
+
+  public void jjtSetParent(Node n) { parent = n; }
+  public Node jjtGetParent() { return parent; }
+
+  public void jjtAddChild(Node n, int i) {
+    if (children == null) {
+      children = new Node[i + 1];
+    } else if (i >= children.length) {
+      Node c[] = new Node[i + 1];
+      System.arraycopy(children, 0, c, 0, children.length);
+      children = c;
+    }
+    children[i] = n;
+  }
+
+  public Node jjtGetChild(int i) {
+    return children[i];
+  }
+
+  public int jjtGetNumChildren() {
+    return (children == null) ? 0 : children.length;
+  }
+
+  public void jjtSetValue(Object value) { this.value = value; }
+  public Object jjtGetValue() { return value; }
+
+  /* You can override these two methods in subclasses of SimpleNode to
+     customize the way the node appears when the tree is dumped.  If
+     your output uses more than one line you should override
+     toString(String), otherwise overriding toString() is probably all
+     you need to do. */
+
+  public String toString() { return QueryParserTreeConstants.jjtNodeName[id]; }
+  public String toString(String prefix) { return prefix + toString(); }
+
+  /* Override this method if you want to customize how the node dumps
+     out its children. */
+
+  public void dump(String prefix) {
+    System.out.println(toString(prefix));
+    if (children != null) {
+      for (int i = 0; i < children.length; ++i) {
+        SimpleNode n = (SimpleNode)children[i];
+        if (n != null) {
+          n.dump(prefix + " ");
+        }
+      }
+    }
+  }
+}
+
+/* JavaCC - OriginalChecksum=040e6dcfc83a8e9d2049166ee31054f3 (do not edit this line) */

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Token.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Token.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Token.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Token.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,131 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
+package org.apache.oodt.cas.catalog.query.parser;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token implements java.io.Serializable {
+
+  /**
+   * The version identifier for this Serializable class.
+   * Increment only if the <i>serialized</i> form of the
+   * class changes.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * An integer that describes the kind of this token.  This numbering
+   * system is determined by JavaCCParser, and a table of these numbers is
+   * stored in the file ...Constants.java.
+   */
+  public int kind;
+
+  /** The line number of the first character of this Token. */
+  public int beginLine;
+  /** The column number of the first character of this Token. */
+  public int beginColumn;
+  /** The line number of the last character of this Token. */
+  public int endLine;
+  /** The column number of the last character of this Token. */
+  public int endColumn;
+
+  /**
+   * The string image of the token.
+   */
+  public String image;
+
+  /**
+   * A reference to the next regular (non-special) token from the input
+   * stream.  If this is the last token from the input stream, or if the
+   * token manager has not read tokens beyond this one, this field is
+   * set to null.  This is true only if this token is also a regular
+   * token.  Otherwise, see below for a description of the contents of
+   * this field.
+   */
+  public Token next;
+
+  /**
+   * This field is used to access special tokens that occur prior to this
+   * token, but after the immediately preceding regular (non-special) token.
+   * If there are no such special tokens, this field is set to null.
+   * When there are more than one such special token, this field refers
+   * to the last of these special tokens, which in turn refers to the next
+   * previous special token through its specialToken field, and so on
+   * until the first special token (whose specialToken field is null).
+   * The next fields of special tokens refer to other special tokens that
+   * immediately follow it (without an intervening regular token).  If there
+   * is no such token, this field is null.
+   */
+  public Token specialToken;
+
+  /**
+   * An optional attribute value of the Token.
+   * Tokens which are not used as syntactic sugar will often contain
+   * meaningful values that will be used later on by the compiler or
+   * interpreter. This attribute value is often different from the image.
+   * Any subclass of Token that actually wants to return a non-null value can
+   * override this method as appropriate.
+   */
+  public Object getValue() {
+    return null;
+  }
+
+  /**
+   * No-argument constructor
+   */
+  public Token() {}
+
+  /**
+   * Constructs a new token for the specified Image.
+   */
+  public Token(int kind)
+  {
+    this(kind, null);
+  }
+
+  /**
+   * Constructs a new token for the specified Image and Kind.
+   */
+  public Token(int kind, String image)
+  {
+    this.kind = kind;
+    this.image = image;
+  }
+
+  /**
+   * Returns the image.
+   */
+  public String toString()
+  {
+    return image;
+  }
+
+  /**
+   * Returns a new Token object, by default. However, if you want, you
+   * can create and return subclass objects based on the value of ofKind.
+   * Simply add the cases to the switch for all those special cases.
+   * For example, if you have a subclass of Token called IDToken that
+   * you want to create if ofKind is ID, simply add something like :
+   *
+   *    case MyParserConstants.ID : return new IDToken(ofKind, image);
+   *
+   * to the following switch statement. Then you can cast matchedToken
+   * variable to the appropriate type and use sit in your lexical actions.
+   */
+  public static Token newToken(int ofKind, String image)
+  {
+    switch(ofKind)
+    {
+      default : return new Token(ofKind, image);
+    }
+  }
+
+  public static Token newToken(int ofKind)
+  {
+    return newToken(ofKind, null);
+  }
+
+}
+/* JavaCC - OriginalChecksum=a71b830768b8b7df481722ce93775dc3 (do not edit this line) */

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,147 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
+/* JavaCCOptions: */
+package org.apache.oodt.cas.catalog.query.parser;
+
+/** Token Manager Error. */
+public class TokenMgrError extends Error
+{
+
+  /**
+   * The version identifier for this Serializable class.
+   * Increment only if the <i>serialized</i> form of the
+   * class changes.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /*
+   * Ordinals for various reasons why an Error of this type can be thrown.
+   */
+
+  /**
+   * Lexical error occurred.
+   */
+  static final int LEXICAL_ERROR = 0;
+
+  /**
+   * An attempt was made to create a second instance of a static token manager.
+   */
+  static final int STATIC_LEXER_ERROR = 1;
+
+  /**
+   * Tried to change to an invalid lexical state.
+   */
+  static final int INVALID_LEXICAL_STATE = 2;
+
+  /**
+   * Detected (and bailed out of) an infinite loop in the token manager.
+   */
+  static final int LOOP_DETECTED = 3;
+
+  /**
+   * Indicates the reason why the exception is thrown. It will have
+   * one of the above 4 values.
+   */
+  int errorCode;
+
+  /**
+   * Replaces unprintable characters by their escaped (or unicode escaped)
+   * equivalents in the given string
+   */
+  protected static final String addEscapes(String str) {
+    StringBuffer retval = new StringBuffer();
+    char ch;
+    for (int i = 0; i < str.length(); i++) {
+      switch (str.charAt(i))
+      {
+        case 0 :
+          continue;
+        case '\b':
+          retval.append("\\b");
+          continue;
+        case '\t':
+          retval.append("\\t");
+          continue;
+        case '\n':
+          retval.append("\\n");
+          continue;
+        case '\f':
+          retval.append("\\f");
+          continue;
+        case '\r':
+          retval.append("\\r");
+          continue;
+        case '\"':
+          retval.append("\\\"");
+          continue;
+        case '\'':
+          retval.append("\\\'");
+          continue;
+        case '\\':
+          retval.append("\\\\");
+          continue;
+        default:
+          if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+            String s = "0000" + Integer.toString(ch, 16);
+            retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+          } else {
+            retval.append(ch);
+          }
+          continue;
+      }
+    }
+    return retval.toString();
+  }
+
+  /**
+   * Returns a detailed message for the Error when it is thrown by the
+   * token manager to indicate a lexical error.
+   * Parameters :
+   *    EOFSeen     : indicates if EOF caused the lexical error
+   *    curLexState : lexical state in which this error occurred
+   *    errorLine   : line number when the error occurred
+   *    errorColumn : column number when the error occurred
+   *    errorAfter  : prefix that was seen before this error occurred
+   *    curchar     : the offending character
+   * Note: You can customize the lexical error message by modifying this method.
+   */
+  protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+    return("Lexical error at line " +
+          errorLine + ", column " +
+          errorColumn + ".  Encountered: " +
+          (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+          "after : \"" + addEscapes(errorAfter) + "\"");
+  }
+
+  /**
+   * You can also modify the body of this method to customize your error messages.
+   * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+   * of end-users concern, so you can return something like :
+   *
+   *     "Internal Error : Please file a bug report .... "
+   *
+   * from this method for such cases in the release version of your parser.
+   */
+  public String getMessage() {
+    return super.getMessage();
+  }
+
+  /*
+   * Constructors of various flavors follow.
+   */
+
+  /** No arg constructor. */
+  public TokenMgrError() {
+  }
+
+  /** Constructor with message and reason. */
+  public TokenMgrError(String message, int reason) {
+    super(message);
+    errorCode = reason;
+  }
+
+  /** Full Constructor. */
+  public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+    this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+  }
+}
+/* JavaCC - OriginalChecksum=aa4a499114e90d0d55997529e48f5ebe (do not edit this line) */

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepository.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepository.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepository.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepository.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,107 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.repository;
+
+//JDK imports
+import java.util.List;
+import java.util.Set;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+import org.apache.oodt.cas.catalog.system.Catalog;
+import org.apache.oodt.cas.catalog.util.PluginURL;
+
+/**
+ * 
+ * @author bfoster
+ * @version $Revision$
+ * 
+ *          <p>
+ *          Repository where the CatalogService stores its TransactionId Mapping
+ *          and serializes its Catalogs
+ *          <p>
+ */
+public interface CatalogRepository {
+//
+//	/**
+//	 * Verifies if the given Catalog URN has been serialized via {@link
+//	 * serializeCatalog(Catalog)}
+//	 * 
+//	 * @param catalogUrn
+//	 *            The URN that unique represents the Catalog
+//	 * @return True if the Catalog has been serialized, false otherwise
+//	 * @throws CatalogRepositoryException
+//	 *             Any Error
+//	 */
+//	public boolean isCatalogSerialized(String catalogUrn)
+//			throws CatalogRepositoryException;
+//
+	/**
+	 * Serializes a given Catalog to the Repository
+	 * 
+	 * @param catalog
+	 *            The Catalog to be serialized
+	 * @throws CatalogRepositoryException
+	 *             Any Error
+	 */
+	public void serializeCatalog(Catalog catalog)
+			throws CatalogRepositoryException;
+//
+//	/**
+//	 * Loads a Catalog from the Repository
+//	 * 
+//	 * @param catalogUrn
+//	 *            The URN that unique represents a Catalog
+//	 * @return The Catalog represented by the given URN
+//	 * @throws CatalogRepositoryException
+//	 *             Any Error
+//	 */
+//	public Catalog deserializeCatalog(String catalogUrn)
+//			throws CatalogRepositoryException;
+//
+	/**
+	 * Removes a Catalog from the Repository
+	 * 
+	 * @param catalogUrn
+	 *            The URN that unique represents the Catalog to be removed
+	 * @param preserveMapping
+	 *            If true, don't erase TransactionId mapping for this catalog
+	 * @throws CatalogRepositoryException
+	 *             Any Error
+	 */
+	public void deleteSerializedCatalog(String catalogUrn)
+			throws CatalogRepositoryException;
+
+	/**
+	 * Loads all Catalogs serialized in this Repository
+	 * 
+	 * @return All the Catalogs serialized in this Repository
+	 * @throws CatalogRepositoryException
+	 *             Any Error
+	 */
+	public Set<Catalog> deserializeAllCatalogs()
+			throws CatalogRepositoryException;
+
+	public void serializePluginURLs(List<PluginURL> urls) 
+			throws CatalogRepositoryException;
+	
+	public List<PluginURL> deserializePluginURLs() 
+			throws CatalogRepositoryException;
+	
+	public boolean isModifiable() throws CatalogRepositoryException;
+	
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepositoryFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepositoryFactory.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepositoryFactory.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepositoryFactory.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,34 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.repository;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Factory for creating CatalogRepository
+ * <p>
+ */
+public interface CatalogRepositoryFactory {
+
+	public CatalogRepository createRepository() throws CatalogRepositoryException;
+	
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,123 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.repository;
+
+//JDK imports
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+import org.apache.oodt.cas.catalog.system.Catalog;
+import org.apache.oodt.cas.catalog.util.PluginURL;
+
+/**
+ * 
+ * @author bfoster
+ * @version $Revision$
+ * 
+ *          <p>
+ *          Memory based Repository where the CatalogService stores its
+ *          TransactionId Mapping and serializes its Catalogs
+ *          <p>
+ */
+public class MemoryBasedCatalogRepository implements CatalogRepository {
+	
+	protected HashMap<String, Catalog> catalogMap;
+	protected List<PluginURL> classLoaderUrls;
+
+	public MemoryBasedCatalogRepository() {
+		this.catalogMap = new HashMap<String, Catalog>();
+		this.classLoaderUrls = new Vector<PluginURL>();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository#
+	 * deleteSerializedCatalog(java.lang.String)
+	 */
+	public void deleteSerializedCatalog(String catalogUrn)
+			throws CatalogRepositoryException {
+		this.catalogMap.remove(catalogUrn);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository#
+	 * deserializeAllCatalogs()
+	 */
+	public Set<Catalog> deserializeAllCatalogs()
+			throws CatalogRepositoryException {
+		return new HashSet<Catalog>(this.catalogMap.values());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.apache.oodt.cas.catalog.repository.CatalogRepository#deserializeCatalog
+	 * (java.lang.String)
+	 */
+	public Catalog deserializeCatalog(String catalogUrn)
+			throws CatalogRepositoryException {
+		return this.catalogMap.get(catalogUrn);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository#
+	 * isCatalogSerialized(java.lang.String)
+	 */
+	public boolean isCatalogSerialized(String catalogUrn)
+			throws CatalogRepositoryException {
+		return this.catalogMap.containsKey(catalogUrn);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.apache.oodt.cas.catalog.repository.CatalogRepository#serializeCatalog
+	 * (org.apache.oodt.cas.catalog.Catalog)
+	 */
+	public void serializeCatalog(Catalog catalog)
+			throws CatalogRepositoryException {
+		this.catalogMap.put(catalog.getId(), catalog);
+	}
+	
+	public void serializePluginURLs(List<PluginURL> urls) 
+			throws CatalogRepositoryException {
+		this.classLoaderUrls.addAll(urls);
+	}
+
+	public List<PluginURL> deserializePluginURLs() 
+			throws CatalogRepositoryException {
+		return new Vector<PluginURL>(this.classLoaderUrls);
+	}
+	
+	public boolean isModifiable() 
+			throws CatalogRepositoryException {
+		return true;
+	}
+
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepositoryFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepositoryFactory.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepositoryFactory.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepositoryFactory.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,38 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.repository;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Factory for creating MemoryBasedCatalogRepository
+ * <p>
+ */
+public class MemoryBasedCatalogRepositoryFactory implements
+		CatalogRepositoryFactory {
+
+	public MemoryBasedCatalogRepository createRepository()
+			throws CatalogRepositoryException {
+		return new MemoryBasedCatalogRepository();
+	}
+
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,209 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.repository;
+
+//JDK imports
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//APACHE imports
+import org.apache.commons.io.FileUtils;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+import org.apache.oodt.cas.catalog.system.Catalog;
+import org.apache.oodt.cas.catalog.util.PluginURL;
+import org.apache.oodt.cas.catalog.util.Serializer;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Catalog Repository that serializes Catalogs via XStream utility
+ * <p>
+ */
+public class SerializedCatalogRepository implements CatalogRepository {
+
+	private static Logger LOG = Logger.getLogger(SerializedCatalogRepository.class.getName());
+	protected String storageDir;
+	
+	public SerializedCatalogRepository(String storageDir) throws InstantiationException {
+		try {
+			this.storageDir = storageDir;
+			new File(this.storageDir + "/catalogs").mkdirs();
+			new File(this.storageDir + "/classloaders").mkdirs();
+		}catch(Exception e) {
+			e.printStackTrace();
+			throw new InstantiationException("Failed to instantiate SerializedCatalogRepository : " + e.getMessage());
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#deleteSerializedCatalog(java.lang.String)
+	 */
+	public void deleteSerializedCatalog(String catalogUrn)
+			throws CatalogRepositoryException {
+		LOG.log(Level.INFO, "Deleting Catalog: '" + catalogUrn + "' . . . ");
+		boolean catalogFileDelete = this.getCatalogFile(catalogUrn).delete();
+		if (!catalogFileDelete)
+			throw new CatalogRepositoryException("Failed to deserialize catalog '" + catalogUrn + "', delete files returned false");
+		else 
+			LOG.log(Level.INFO, "Successfully deleting Catalog: '" + catalogUrn + "'");
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#deserializeCatalog(java.lang.String)
+	 */
+	public Catalog deserializeCatalog(String catalogUrn)
+			throws CatalogRepositoryException {
+		LOG.log(Level.INFO, "Deserializing Catalog: " + catalogUrn);
+		FileInputStream catalogIn = null;
+		try {
+			return new Serializer().deserializeObject(Catalog.class, catalogIn = new FileInputStream(this.getCatalogFile(catalogUrn)));
+		}catch (Exception e) {
+			throw new CatalogRepositoryException("Failed to Deserialized Catalogs from '" + this.storageDir + "' : " + e.getMessage(), e);
+		}finally {
+			try {
+				catalogIn.close();
+			}catch (Exception e) {}
+		}
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#deserializeAllCatalogs()
+	 */
+	public Set<Catalog> deserializeAllCatalogs()
+			throws CatalogRepositoryException {
+		HashSet<Catalog> catalogs = new HashSet<Catalog>();
+		for (String catalogFile : new File(this.storageDir + "/catalogs").list()) {
+			Catalog catalog = this.deserializeCatalog(catalogFile.split("\\.ser")[0]);
+			catalogs.add(catalog);
+		}
+		return catalogs;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#isCatalogSerialized(java.lang.String)
+	 */
+	public boolean isCatalogSerialized(String catalogUrn)
+			throws CatalogRepositoryException {
+		return this.getCatalogFile(catalogUrn).exists();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#serializeCatalog(org.apache.oodt.cas.catalog.Catalog)
+	 */
+	public void serializeCatalog(Catalog catalog)
+			throws CatalogRepositoryException {
+		LOG.log(Level.INFO, "Serializing Catalog: " + catalog.getId());
+		FileOutputStream catalogOut = null;
+		try {
+			//serialize Catalog
+			new Serializer().serializeObject(catalog, (catalogOut = new FileOutputStream(this.getCatalogFileWorker(catalog.getId()))));
+			if (this.getCatalogFile(catalog.getId()).exists())
+				FileUtils.copyFile(this.getCatalogFile(catalog.getId()), this.getCatalogFileBkup(catalog.getId()), true);
+			FileUtils.copyFile(this.getCatalogFileWorker(catalog.getId()), this.getCatalogFile(catalog.getId()), true);
+			this.getCatalogFileWorker(catalog.getId()).delete();
+			this.getCatalogFileBkup(catalog.getId()).delete();
+		}catch (Exception e) {
+			throw new CatalogRepositoryException("Failed to Serialized Catalogs to '" + this.storageDir + "' : " + e.getMessage(), e);
+		}finally {
+			try {
+				catalogOut.close();
+			}catch (Exception e) {}
+		}	
+	}
+	
+	public void serializePluginURLs(List<PluginURL> urls) 
+			throws CatalogRepositoryException {
+		FileOutputStream urlsOut = null;
+		try {
+			//serialize URLs
+			new Serializer().serializeObject(urls, (urlsOut = new FileOutputStream(this.getClassLoaderUrlsFileWorker())));
+			if (this.getClassLoaderUrlsFile().exists())
+				FileUtils.copyFile(this.getClassLoaderUrlsFile(), this.getClassLoaderUrlsFileBkup(), true);
+			FileUtils.copyFile(this.getClassLoaderUrlsFileWorker(), this.getClassLoaderUrlsFile(), true);
+			this.getClassLoaderUrlsFileWorker().delete();
+			this.getClassLoaderUrlsFileBkup().delete();
+		}catch (Exception e) {
+			throw new CatalogRepositoryException("Failed to Serialized ClassLoader URLs to '" + this.storageDir + "' : " + e.getMessage(), e);
+		}finally {
+			try {
+				urlsOut.close();
+			}catch (Exception e) {}
+		}	
+	}
+
+	public List<PluginURL> deserializePluginURLs() throws CatalogRepositoryException {
+		FileInputStream urlsIn = null;
+		try {
+			if (this.getClassLoaderUrlsFile().exists())
+				return new Serializer().deserializeObject(List.class, (urlsIn = new FileInputStream(this.getClassLoaderUrlsFile())));
+			else
+				return Collections.emptyList();
+		}catch (Exception e) {
+			throw new CatalogRepositoryException("Failed to Deserialized All ClassLoader URLs from '" + this.storageDir + "' : " + e.getMessage(), e);
+		}finally {
+			try {
+				urlsIn.close();
+			}catch (Exception e) {}
+		}
+	}
+
+	public boolean isModifiable() 
+			throws CatalogRepositoryException {
+		return true;
+	}
+
+	protected File getCatalogFile(String catalogUrn) {
+		return new File(this.storageDir + "/catalogs/" + catalogUrn + ".ser");
+	}
+
+	protected File getCatalogFileBkup(String catalogUrn) {
+		return new File(this.storageDir + "/catalogs/" + catalogUrn + ".ser-bkup");
+	}
+	
+	protected File getCatalogFileWorker(String catalogUrn) {
+		return new File(this.storageDir + "/catalogs/" + catalogUrn + ".ser-worker");
+	}
+	
+	protected File getClassLoaderUrlsFile() {
+		return new File(this.storageDir + "/classloaders/urls.ser");
+	}
+	
+	protected File getClassLoaderUrlsFileBkup() {
+		return new File(this.storageDir + "/classloaders/urls.ser-bkup");
+	}
+	
+	protected File getClassLoaderUrlsFileWorker() {
+		return new File(this.storageDir + "/classloaders/urls.ser-worker");
+	}
+	
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepositoryFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepositoryFactory.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepositoryFactory.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepositoryFactory.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,54 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.repository;
+
+//Spring imports
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+import org.springframework.beans.factory.annotation.Required;
+
+//OODT imports
+import org.apache.oodt.cas.metadata.util.PathUtils;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Factory for creating SerializedMemoryBasedCatalogRepository
+ * <p>
+ */
+public class SerializedCatalogRepositoryFactory implements CatalogRepositoryFactory {
+
+	protected String storageDir;
+
+	public SerializedCatalogRepositoryFactory() {}
+	
+	@Required
+	public void setStorageDir(String storageDir) {
+		this.storageDir = storageDir;
+	}
+
+	public SerializedCatalogRepository createRepository()
+			throws CatalogRepositoryException {
+		try {
+			return new SerializedCatalogRepository(PathUtils.doDynamicReplacement(this.storageDir));
+		}catch (Exception e) {
+			throw new CatalogRepositoryException("Failed to create Serialized Catalog Repository : " + e.getMessage(), e);
+		}
+	}
+
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepository.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepository.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepository.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepository.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,87 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.repository;
+
+//JDK imports
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+import org.apache.oodt.cas.catalog.system.Catalog;
+import org.apache.oodt.cas.catalog.util.PluginURL;
+import org.apache.oodt.cas.catalog.util.Serializer;
+
+//Spring imports
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A Spring Framework based CatalogRepository
+ * <p>
+ */
+public class SpringCatalogRepository implements CatalogRepository {
+
+	protected String beanRepo;
+	
+	public SpringCatalogRepository(String beanRepo) {
+		this.beanRepo = beanRepo;
+	}
+	
+	public Set<Catalog> deserializeAllCatalogs()
+			throws CatalogRepositoryException {
+		try {
+	        FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
+	        appContext.setClassLoader(new Serializer().getClassLoader());
+	        appContext.refresh();
+	        return new HashSet<Catalog>(appContext.getBeansOfType(Catalog.class).values());
+		} catch (Exception e) {
+			throw new CatalogRepositoryException("", e);
+		}
+	}
+
+	public void deleteSerializedCatalog(String catalogUrn)
+			throws CatalogRepositoryException {
+		throw new CatalogRepositoryException("Modification not allowed during runtime");
+	}
+
+	public boolean isModifiable() throws CatalogRepositoryException {
+		return false;
+	}
+
+	public void serializeCatalog(Catalog catalog)
+			throws CatalogRepositoryException {
+		throw new CatalogRepositoryException("Modification not allowed during runtime");		
+	}
+
+	public List<PluginURL> deserializePluginURLs()
+			throws CatalogRepositoryException {
+		// TODO Auto-generated method stub
+		return Collections.emptyList();
+	}
+
+	public void serializePluginURLs(List<PluginURL> urls)
+			throws CatalogRepositoryException {
+		throw new CatalogRepositoryException("Modification not allowed during runtime");		
+	}
+	
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepositoryFactory.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepositoryFactory.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepositoryFactory.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepositoryFactory.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,43 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.repository;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A factory for creating SpringCatalogRepository
+ * <p>
+ */
+public class SpringCatalogRepositoryFactory implements CatalogRepositoryFactory {
+
+	protected String catalogBeanRepo;
+	
+	public CatalogRepository createRepository()
+			throws CatalogRepositoryException {
+		return new SpringCatalogRepository(this.catalogBeanRepo);
+	}
+	
+	public void setCatalogBeanRepo(String catalogBeanRepo) {
+		this.catalogBeanRepo = catalogBeanRepo;
+	}
+
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,60 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.server;
+
+//JDK imports
+import java.io.FileInputStream;
+import java.util.List;
+
+//Spring imports
+import org.apache.oodt.cas.catalog.server.action.CatalogServiceServerAction;
+import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClient;
+import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClientFactory;
+import org.apache.oodt.cas.catalog.util.Serializer;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+//OODT imports
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.util.CmdLineOptionUtils;
+import org.apache.oodt.cas.metadata.util.PathUtils;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Client Utility for sending commands to servers
+ * <p>
+ */
+public class CatalogServiceCommandLineClient {
+
+	public static void main(String[] args) throws Exception {
+		String propertiesFile = System.getProperty("org.apache.oodt.cas.catalog.properties.file");
+		if (propertiesFile != null)
+			System.getProperties().load(new FileInputStream(propertiesFile));
+		String configFile = PathUtils.doDynamicReplacement(System.getProperty("org.apache..oodt.cas.catalog.client.config.file", "classpath:/org/apache/oodt/cas/catalog/config/catserv-client-config.xml"));
+		FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { configFile }, false);
+//		appContext.setClassLoader(new Serializer().getClassLoader());
+		appContext.refresh();
+        List<CmdLineOptionInstance> optionInstances = CmdLineOptionUtils.loadValidateAndHandleInstances(appContext, args);
+        CmdLineOptionInstance instance = CmdLineOptionUtils.getOptionInstanceByName("clientFactoryBeanId", optionInstances);
+		CatalogServiceClientFactory csClientFactory = (CatalogServiceClientFactory) appContext.getBean(instance.getValues().get(0), CatalogServiceClientFactory.class);
+		CatalogServiceClient csClient = csClientFactory.createCatalogService();
+        instance = CmdLineOptionUtils.getOptionInstanceByName("action", optionInstances);
+		((CatalogServiceServerAction) appContext.getBean(instance.getValues().get(0), CatalogServiceServerAction.class)).performAction(csClient);
+	}
+}

Added: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java?rev=1002752&view=auto
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java (added)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java Wed Sep 29 17:19:09 2010
@@ -0,0 +1,94 @@
+/*
+ * 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 org.apache.oodt.cas.catalog.server;
+
+//JDK imports
+import java.io.FileInputStream;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.catalog.server.action.CatalogServiceServerAction;
+import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServer;
+import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServerFactory;
+import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClient;
+import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClientFactory;
+import org.apache.oodt.cas.catalog.util.Serializer;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.util.CmdLineOptionUtils;
+import org.apache.oodt.cas.metadata.util.PathUtils;
+
+//Spring imports
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+/**
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Utility for launching CommunicationChannelServers
+ * <p>
+ */
+public class CatalogServiceServerLauncher {
+		
+	private CatalogServiceServerLauncher() throws InstantiationException {}
+//	
+//	public static void startup(String beanId) throws Exception {
+//		String propertiesFile = System.getProperty("org.apache.oodt.cas.catalog.properties.file");
+//		if (propertiesFile != null)
+//			System.getProperties().load(new FileInputStream(propertiesFile));
+//        FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(PathUtils.doDynamicReplacement(System.getProperty("org.apache.oodt.cas.catalog.config.file", "classpath:/gov/nasa/jpl/oodt/cas/catalog/config/catserv-config.xml")));
+//        CommunicationChannelServerFactory serverFactory = (CommunicationChannelServerFactory) appContext.getBean(beanId, CommunicationChannelServerFactory.class);
+//        CommunicationChannelServer communicationChannelServer = serverFactory.createCommunicationChannelServer();
+//		communicationChannelServer.startup();
+//		System.out.println("\n---- Launched '" +  communicationChannelServer.getClass().getCanonicalName() + "' on port: " + communicationChannelServer.getPort() + " ----");
+//	}
+	
+	public static void main(String[] args) throws Exception {
+		String propertiesFile = System.getProperty("org.apache.oodt.cas.catalog.properties.file");
+		if (propertiesFile != null)
+			System.getProperties().load(new FileInputStream(propertiesFile));
+		String configFile = PathUtils.doDynamicReplacement(System.getProperty("org.apache.oodt.cas.catalog.server.config.file", "classpath:/org/apache/oodt/cas/catalog/config/catserv-server-config.xml"));
+		FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { configFile }, false);
+		appContext.setClassLoader(new Serializer().getClassLoader());
+		appContext.refresh();
+        List<CmdLineOptionInstance> optionInstances = CmdLineOptionUtils.loadValidateAndHandleInstances(appContext, args);
+        CmdLineOptionInstance instance = CmdLineOptionUtils.getOptionInstanceByName("serverFactoryBeanId", optionInstances);
+        CommunicationChannelServerFactory serverFactory = (CommunicationChannelServerFactory) appContext.getBean(instance.getValues().get(0), CommunicationChannelServerFactory.class);
+        CommunicationChannelServer communicationChannelServer = serverFactory.createCommunicationChannelServer();
+		communicationChannelServer.startup();
+		System.out.println("\n---- Launched '" +  communicationChannelServer.getClass().getCanonicalName() + "' on port: " + communicationChannelServer.getPort() + " ----");
+
+//		
+//		
+//		
+//		String beanId = null;
+//		for (int i = 0; i < args.length; i++) {
+//			if (args[i].equals("--serverFactoryBeanId")) 
+//				beanId = args[++i];
+//		}
+//		
+//		if (beanId == null) {
+//			System.out.println("Usage: " + CatalogServiceServerLauncher.class.getName() + "\n"
+//					+ " --serverFactoryBeanId <bean-id> \n");
+//			System.exit(1);
+//		}
+//
+//		CatalogServiceServerLauncher.startup(beanId);
+				
+	}
+
+}



Mime
View raw message