| java.lang.Object org.geotools.graph.io.standard.AbstractReaderWriter org.geotools.graph.io.standard.DBReaderWriter
DBReaderWriter | abstract public class DBReaderWriter extends AbstractReaderWriter (Code) | | An implementation of GraphReaderWriter used for reading and writing graph
objects to and from a database.
Upon reading, the database is queried using
the getQuery() template method, and a representation of the objects to be
modelled by the graph are returned through a standard ResultSet. From each
tuple in the result set, the object is recreated via the template method
readInternal(ResultSet). The object is then passed to an underlying
graph generator and the graph components used to model the object are
constructed.
Upon writing, the graph is read component by component based
on set properties. If the NODES property is set, nodes will be written. If
the EDGES property is set, edges will be written as well. As each component
is processed, it is passed to the repspective template methods
writeNode(Statement,Node) and writeEdge(Statement,Edge). The methods then
execute a statement to create the database representation of the graph
component.
author: Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net |
Method Summary | |
protected Connection | getConnection() Opens a connection to the database, based on set properties. | abstract protected String | getQuery() Template method which returns the query to execute in order to read
a graph from the database. | public Graph | read() Performs a graph read by querying the database and processing each tuple
returned in the query. | abstract protected Object | readInternal(ResultSet rs) Template method used to create the object represented by a tuple returned
by the database query.
Parameters: rs - ResultSet of query. | public void | write(Graph g) Performs a write on the graph out to the database. | protected void | writeEdge(Statement st, Edge edge) Template method used to write an edge into the database. | protected void | writeNode(Statement st, Node node) Template method used to write a node into the database. |
DBNAME | final public static String DBNAME(Code) | | Database name key *
|
DRIVERCLASS | final public static String DRIVERCLASS(Code) | | JDBC driver class name key *
|
DRIVERURL | final public static String DRIVERURL(Code) | | JDBC driver url *
|
PORT | final public static String PORT(Code) | | Database port key *
|
SERVER | final public static String SERVER(Code) | | Database server key *
|
TABLENAME | final public static String TABLENAME(Code) | | Table key *
|
USERNAME | final public static String USERNAME(Code) | | User name key *
|
getConnection | protected Connection getConnection() throws Exception(Code) | | Opens a connection to the database, based on set properties.
Connection to the database. throws: Exception - |
getQuery | abstract protected String getQuery()(Code) | | Template method which returns the query to execute in order to read
a graph from the database.
SQL query. |
readInternal | abstract protected Object readInternal(ResultSet rs) throws Exception(Code) | | Template method used to create the object represented by a tuple returned
by the database query.
Parameters: rs - ResultSet of query. Object represented by current tuple of result set. |
write | public void write(Graph g) throws Exception(Code) | | Performs a write on the graph out to the database. If the NODES property
is set, the nodes of the graph will be written, and if the EDGES property
is set, the edges of the graph will be written.
See Also: GraphGenerator.write |
writeEdge | protected void writeEdge(Statement st, Edge edge)(Code) | | Template method used to write an edge into the database.
Parameters: st - Statement used to execute write statement. Parameters: edge - Edge to write. |
writeNode | protected void writeNode(Statement st, Node node)(Code) | | Template method used to write a node into the database.
Parameters: st - Statement used to execute write statement. Parameters: node - Node to write. |
|
|