dods.servers.sql
Class sqlSeq

java.lang.Object
  extended bydods.dap.BaseType
      extended bydods.dap.DConstructor
          extended bydods.dap.DSequence
              extended bydods.dap.Server.SDSequence
                  extended bydods.servers.sql.sqlSeq
All Implemented Interfaces:
ClientIO, java.lang.Cloneable, RelOps, ServerMethods

public class sqlSeq
extends SDSequence

Holds a DODS Server Sequence value.

Version:
$Revision: 1.3.4.1 $
Author:
ndp
See Also:
BaseType

Field Summary
 
Fields inherited from class dods.dap.DSequence
allValues, END_OF_SEQUENCE, START_OF_INSTANCE, varTemplate
 
Constructor Summary
sqlSeq()
          Constructs a new test_SDSequence.
sqlSeq(java.lang.String n)
          Constructs a new test_SDSequence with name n.
 
Method Summary
 boolean read(java.lang.String datasetName, java.lang.Object specialO)
          Read a value from the named dataset for this variable.
 void serialize(java.lang.String dataset, java.io.DataOutputStream sink, CEEvaluator ce, java.lang.Object specialO)
          Server-side serialization for DODS variables (sub-classes of BaseType).
 
Methods inherited from class dods.dap.Server.SDSequence
equal, getRowVector, greater_eql, greater, isProject, isRead, isSynthesized, less_eql, less, not_equal, printDecl, printVal, regexp, setAllReadFlags, setProject, setProject, setRead, setSynthesized
 
Methods inherited from class dods.dap.DSequence
addRow, addVariable, checkSemantics, clone, delRow, deserialize, elementCount, externalize, getLevel, getRow, getRowCount, getTypeName, getVar, getVariable, getVariable, getVariables, setLevel, writeMarker
 
Methods inherited from class dods.dap.DConstructor
addVariable
 
Methods inherited from class dods.dap.BaseType
checkSemantics, elementCount, getLongName, getName, getParent, newPrimitiveVector, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printVal, printVal, printVal, setName, setParent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

sqlSeq

public sqlSeq()
Constructs a new test_SDSequence.


sqlSeq

public sqlSeq(java.lang.String n)
Constructs a new test_SDSequence with name n.

Parameters:
n - the name of the variable.
Method Detail

read

public boolean read(java.lang.String datasetName,
                    java.lang.Object specialO)
             throws NoSuchVariableException,
                    java.io.IOException,
                    java.io.EOFException
Read a value from the named dataset for this variable. 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 Sequence read() method handles "rewinding" the currentColumn index in the sqlResponse object to insure that for as long as there is more data to be read into this Sequence that the currentColumn is set correctly for each invocation of this method. In addition, this method handles the task of moving the ResultSet object in the sqlResponse through the rows of the response data, insuring that at each invocation of a top level sequence read() invocation the ResultSet is set up for a new row of data.

Specified by:
read in interface ServerMethods
Specified by:
read in class SDSequence
Parameters:
datasetName - String identifying the file or other data store from which to read a vaue for this variable.
specialO - This Object is used by this method. It is assumed to be of type sqlResponse, a container for the ResultSet and the index value of next column to evaluate.
Returns:
true if more data remains to be read, otherwise false.
Throws:
NoSuchVariableException
java.io.IOException
java.io.EOFException

serialize

public void serialize(java.lang.String dataset,
                      java.io.DataOutputStream sink,
                      CEEvaluator ce,
                      java.lang.Object specialO)
               throws NoSuchVariableException,
                      SDODSException,
                      java.io.IOException
Server-side serialization for DODS variables (sub-classes of BaseType). We override the serialize() method of the parent SDClass in order to stop the evaluation of the CEEvaluator's Clauses, as this has been handled implicitly by the SQL Database that this Server is designed to interrogate.

Specified by:
serialize in interface ServerMethods
Overrides:
serialize in class SDSequence
Parameters:
sink - a DataOutputStream to write to.
Throws:
java.io.IOException - thrown on any OutputStream exception.
NoSuchVariableException
SDODSException
See Also:
BaseType, DDS, ServerDDS