org.apache.oodt.cas.filemgr.util
Class SqlParser

java.lang.Object
  extended by org.apache.oodt.cas.filemgr.util.SqlParser

public class SqlParser
extends Object

Version:
$Revision: 9683 $

A fairly robust SQL parser, based on the Shunting yard algorithm

Evaluates SQL like string statements contained in a string. The SQL statement should be enclosed within: SQL (<sql_arguments> ) { <sql_statement> . the <sql_arguments> can be either FORMAT, SORT_BY, or FILTER. Syntax: SQL (FORMAT='',SORT_BY='', FILTER=', , , ') { SELECT FROM WHERE } Here is an example SQL statement: SQL (FORMAT='FileLocation/Filename', SORT_BY='FileSize',FILTER== '2007-12-01T00:00:00.000000Z' } This example would query the cas-filemgr for metadata values: FileLocation,Filename,FileSize for any data file where the ProductType == IASI_L1C and the ProductionDateTime >= 2007-12-01T00:00:00.000000Z. It would then combine the return data files metadata via the specified FORMAT. Each data file's metadata will be formated to a string representation of (with the actual values replaced in the location of the metadata keys): FileLocation/Filename. They will be concatenated together, in FileSize order.

Author:
bfoster

Method Summary
static String getInfixCriteriaString(List<QueryCriteria> criteriaList)
           
static String getInfixCriteriaString(QueryCriteria criteria)
           
static void main(String[] args)
           
static ComplexQuery parseSqlQuery(String sqlStringQuery)
           
static ComplexQuery parseSqlQueryMethod(String sqlStringQueryMethod)
           
static QueryCriteria parseSqlWhereClause(String sqlWhereClause)
           
static String unparseSqlQuery(ComplexQuery complexQuery)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseSqlQueryMethod

public static ComplexQuery parseSqlQueryMethod(String sqlStringQueryMethod)
                                        throws QueryFormulationException
Throws:
QueryFormulationException

parseSqlQuery

public static ComplexQuery parseSqlQuery(String sqlStringQuery)
                                  throws QueryFormulationException
Throws:
QueryFormulationException

parseSqlWhereClause

public static QueryCriteria parseSqlWhereClause(String sqlWhereClause)
                                         throws QueryFormulationException
Throws:
QueryFormulationException

unparseSqlQuery

public static String unparseSqlQuery(ComplexQuery complexQuery)
                              throws QueryFormulationException
Throws:
QueryFormulationException

getInfixCriteriaString

public static String getInfixCriteriaString(List<QueryCriteria> criteriaList)
                                     throws QueryFormulationException
Throws:
QueryFormulationException

getInfixCriteriaString

public static String getInfixCriteriaString(QueryCriteria criteria)

main

public static void main(String[] args)
                 throws QueryFormulationException
Throws:
QueryFormulationException


Copyright © 1999-2011 Apache OODT. All Rights Reserved.