|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectHttpServlet
dods.servlet.DODSServlet
dods.servers.sql.dodsSQLServlet
public abstract class dodsSQLServlet
This extension of DODSServlet adds JDBC connection functionality to the
servlet design.
Because of the unusual nature of DBMS systems with respect to other types
of data archives, the usual procedures for retrieving data in a DODS server
needed to be changed. This class, dodsSQLServlet
, encapsulates
the logic for interacting with a DBMS. This includes getting the client's
DODS request, changing it to an SQL query, querying the DBMS (using JDBC)
and then collecting the reply and sending the returned data to the client.
The information for making the JDBC connection should be located in the
iniFile
object that is inflated by the doGet()
method of the parent class DODSServlet
. The section in the
iniFile should look like:
[JDBC] Driver = the.name.of.the.jdbc.driver ConnectionURL = jdbc:somevendor://targetmachine:port username = guest password = MaxResponseLength = 300
doGet()
,
#loadIniFile()
Constructor Summary | |
---|---|
dodsSQLServlet()
|
Method Summary | |
---|---|
Statement |
connect2DB(requestState rs)
|
void |
doGetDODS(HttpServletRequest request,
HttpServletResponse response,
requestState rs)
Handler for the client's data request. |
protected GuardedDataset |
getDataset(requestState rs)
Supress this method (just pass through it) we need a special DDS here, and thus this method gets replaced by getSQLDDS(). |
abstract String |
getServerVersion()
This function must be implemented locally for each DODS server. |
protected abstract GuardedSQLDataset |
getSQLDataset(requestState rs)
This function must be implemented locally for each DODS server. |
void |
init()
Intitializes the servlet. |
void |
printColumnNames(ResultSetMetaData m,
PrintStream dOut)
Read the meta data stream and print up column names with type information |
void |
processResult(ResultSet result,
PrintStream dOut)
|
Methods inherited from class dods.servlet.DODSServlet |
---|
anyExceptionHandler, badURL, dodsExceptionHandler, doGet, doGetASC, doGetCatalog, doGetDAS, doGetDDS, doGetDIR, doGetHELP, doGetHTML, doGetINFO, doGetStatus, doGetVER, getDAS, getServerName, isTheClientCompressed, openCachedDAS, openCachedDDS, parseExceptionHandler, printCatalog, printStatus, probeRequest, processDodsURL, sendDODSError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public dodsSQLServlet()
Method Detail |
---|
protected abstract GuardedSQLDataset getSQLDataset(requestState rs) throws DODSException, IOException, ParseException
dataSet
- the name of the data set requested.
DODSException
IOException
ParseException
ServerDDS
,
sqlServerFactory
,
test_ServerFactory
protected GuardedDataset getDataset(requestState rs) throws DODSException, IOException, ParseException
getDataset
in class DODSServlet
dataSet
- the name of the data set requested.
DODSException
IOException
ParseException
ServerDDS
,
sqlServerFactory
,
test_ServerFactory
public abstract String getServerVersion()
getServerVersion
in class DODSServlet
public void init() throws ServletException
init
in class DODSServlet
ServletException
public void doGetDODS(HttpServletRequest request, HttpServletResponse response, requestState rs) throws IOException, ServletException
Once the DDS has been parsed, the projection is determine by proccesing the constraint expression. The SQLDDS is then asked to convert it's projection and selection information into an SQL query. This query is then submitted to the DBMS. The result set is then read into the SQLDDS. In the the process, the data is returned to the client. Neat, eh?
doGetDODS
in class DODSServlet
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.dataSet
- Name of the datset whose data is requested.constraintExpression
- Constraint expression recieved from the client.
This is used (if it's not just empty) subset the data in the dataset.
IOException
ServletException
public Statement connect2DB(requestState rs) throws SQLException, IOException
SQLException
IOException
public void processResult(ResultSet result, PrintStream dOut) throws SQLException, IOException
SQLException
IOException
public void printColumnNames(ResultSetMetaData m, PrintStream dOut) throws SQLException
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |