|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdods.dap.Server.CEEvaluator
dods.servers.sql.sqlCEEval
This class is used to parse and evaluate a constraint expression. When constructed it must be passed a valid DDS along with the expression. This DDS will be used as the environment (collection of variables and functions) during the parse and evaluation of the constraint expression.
A server (servlet, CGI, ...) must first instantiate the DDS (possibly reading it from a cache) and then create and instance of this class. Once created, the constraint may be parsed and then evaluated. The class supports sending data based on the results of CE evaluation. That is, the send() method of the class combines both the evaluation of the constraint and the output of data values so that the server can return data using a single method call. This implementation is intended to be reading data from a JDBC connection to a relational database. And as such the send method has been modified to to handle bookkeeping issues, and a method added that generates and SQL SELECT statement by interogating the DDS to determine the "Projection" and by converting the "Selection" (the Clauses) into the constraint used in the Select statement's WHERE section.
ServerDDS
,
ServerMethods
,
Clause
Field Summary |
Fields inherited from interface dods.dap.parser.ExprParserConstants |
AMPERSAND, ASTERISK, COLON, COMMA, DEFAULT, EOF, EQUAL, EXPONENT, FLOAT, GREATER, GREATER_EQL, ID, INT, LBRACE, LBRACKET, LESS, LESS_EQL, LPAREN, MANTISSA, NOT_EQUAL, QUOTED_STR, RBRACE, RBRACKET, REGEXP, RPAREN, SEPARATOR, STR, tokenImage, UNQUOTED_STR, UNTERM_QUOTE |
Constructor Summary | |
sqlCEEval(ServerDDS dds)
Construct a new sqlCEEval with dds as the
DDS object with which to resolve all variable and function names. |
|
sqlCEEval(ServerDDS dds,
ClauseFactory clauseFactory)
Construct a new sqlCEEvaluator with dds as the
DDS object with which to resolve all variable and function names, and
clauseFactory as a source of Clause objects . |
Method Summary | |
protected java.lang.String |
convertClausesToSQL(boolean useDatasetName)
Helper method for getSQLQuery(). |
protected java.lang.String |
convertClauseToSQL(Clause c,
boolean useDatasetName)
Helper method for convertClausesToSQL(). |
protected java.lang.String |
getSQLFromClause()
|
java.lang.String |
getSQLQuery(DAS das,
boolean useDatasetName)
Generates an SQL SELECT statement by interogating the DDS object to determine the "Projection" and by converting the "Selection" (the Clauses) into the constraint used in the SELECT statement's WHERE section. |
protected java.lang.String |
getSQLVariables()
|
protected java.lang.String |
getSQLWhereClause()
|
void |
send(java.lang.String dataset,
java.io.OutputStream sink,
java.lang.Object specialO)
This function sends the variables described in the constrained DDS to the output described by sink . |
Methods inherited from class dods.dap.Server.CEEvaluator |
appendClause, evalClauses, getClauses, getDDS, markAll, parseConstraint, removeClause |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public sqlCEEval(ServerDDS dds)
sqlCEEval
with dds
as the
DDS object with which to resolve all variable and function names.
dds
- DDS object describing the dataset targeted by this
constraint.public sqlCEEval(ServerDDS dds, ClauseFactory clauseFactory)
sqlCEEvaluator
with dds
as the
DDS object with which to resolve all variable and function names, and
clauseFactory
as a source of Clause objects .
clauseFactory
- The factory which will be used by the parser to construct the clause
tree. This allows servers to pass in a factory which creates
custom clause objects.dds
- DDS object describing the dataset targeted by this
constraint.Method Detail |
public void send(java.lang.String dataset, java.io.OutputStream sink, java.lang.Object specialO) throws NoSuchVariableException, SDODSException, java.io.IOException
sink
. This function calls
ServerIO::serialize()
. to achieve this data transmission.
This implementation is intended to be reading data from a JDBC connection
to a relational database.
Relational databases appear relatively "flat" to DODS. By this we mean that DODS datasets can have very complex multilevel structure. Relational databases appear to DODS as a dataset populated by one or more Sequences, each one representing a table in the database. The table contents are generally simple types, or arrays of bytes. Since relational databases support cross table (and thus cross sequence) queries and since they return the results of these queries in a single "table like" object, we must take care to unpack this returned data into the appropriate members of the DDS representation of the dataset. The read() method of the Sequence type plays a key roll in this, along with the read() methods of the simple types and the send() method of the CEEvaluator.
This send() method handles "rewinding" the row index in the ResultSet so that as each Sequence (table) is processed, the ResultSet object is starting at the first row of returned data, and the Sequence's read() method can scan the columns it needs from all of the rows of returned data.
send
in class CEEvaluator
dataset
- The name of the dataset to send.sink
- A pointer to the output buffer for the data.specialO
- Special Object to carry implementation specific content..
NoSuchVariableException
SDODSException
java.io.IOException
parseConstraint()
,
ServerMethods.serialize(java.lang.String, java.io.DataOutputStream, dods.dap.Server.CEEvaluator, java.lang.Object)
public java.lang.String getSQLQuery(DAS das, boolean useDatasetName) throws InvalidOperatorException
String
containing the prepared SQL Select
statement for use in the Databse query.
InvalidOperatorException
protected java.lang.String convertClausesToSQL(boolean useDatasetName) throws InvalidOperatorException
String
containing the SQL representation of
the Clauses
. If no Clauses can be represented as SQL
then this method returns null
.
InvalidOperatorException
protected java.lang.String convertClauseToSQL(Clause c, boolean useDatasetName) throws InvalidOperatorException
String
containing the SQL representation of
the Clause
. If the Clause
cannot be
represented as SQL then this method returns null
.
InvalidOperatorException
protected java.lang.String getSQLVariables()
protected java.lang.String getSQLFromClause()
protected java.lang.String getSQLWhereClause()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |