All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class de.tudarmstadt.ito.xmldbms.mapfactories.MapFactory_MapDocument

java.lang.Object
   |
   +----de.tudarmstadt.ito.xmldbms.mapfactories.MapFactory_MapDocument

public class MapFactory_MapDocument
extends Object
implements DocumentHandler
Create a Map from a mapping document.

MapFactory_MapDocument assumes that the mapping document is valid. If it is not, the class will either generate garbage or throw an error. One way to guarantee that the document is valid is to pass a validating parser to the map factory.

For example, the following code creates a map from the sales.map mapping document.

    // Instantiate a new map factory from a database connection
    // and a SAX parser.
    factory = new MapFactory_MapDocument(conn, parser);
// Create a Map from sales.map. map = factory.createMap(new InputSource(new FileReader("sales.map")));
// Pass the Map to DOMToDBMS. domToDBMS = new DOMToDBMS(map);

Version:
1.01
Author:
Ronald Bourret, Technical University of Darmstadt

Constructor Index

 o MapFactory_MapDocument()
Construct a new MapFactory_MapDocument.
 o MapFactory_MapDocument(Connection, Parser)
Construct a new MapFactory_MapDocument and set the database connection and SAX parser.
 o MapFactory_MapDocument(Connection, ResultSet, Parser)
Construct a new MapFactory_MapDocument and set the database connection, SAX parser, and result set.

Method Index

 o characters(char[], int, int)
Implementation of characters in SAX' DocumentHandler interface.
 o createMap(Connection, ResultSet, Parser, InputSource)
Set the connection, mapped result set (if any), and SAX parser, then create a map from a mapping document.
 o createMap(InputSource)
Create a map from a mapping document.
 o endDocument()
Implementation of endDocument in SAX' DocumentHandler interface.
 o endElement(String)
Implementation of endElement in SAX' DocumentHandler interface.
 o getConnection()
Get the current Connection.
 o getParser()
Get the current SAX Parser.
 o getResultSet()
Get the current ResultSet.
 o ignorableWhitespace(char[], int, int)
Implementation of ignorableWhitespace in SAX' DocumentHandler interface.
 o processingInstruction(String, String)
Implementation of processingInstruction in SAX' DocumentHandler interface.
 o setConnection(Connection)
Set the current Connection.
 o setDocumentLocator(Locator)
Implementation of setDocumentLocator in SAX' DocumentHandler interface.
 o setParser(Parser)
Set the current SAX Parser.
 o setResultSet(ResultSet)
Set the current ResultSet.
 o startDocument()
Implementation of startDocument in SAX' DocumentHandler interface.
 o startElement(String, AttributeList)
Implementation of startElement in SAX' DocumentHandler interface.

Constructors

 o MapFactory_MapDocument
 public MapFactory_MapDocument()
Construct a new MapFactory_MapDocument.

 o MapFactory_MapDocument
 public MapFactory_MapDocument(Connection conn,
                               Parser parser)
Construct a new MapFactory_MapDocument and set the database connection and SAX parser.

 o MapFactory_MapDocument
 public MapFactory_MapDocument(Connection conn,
                               ResultSet mappedResultSet,
                               Parser parser)
Construct a new MapFactory_MapDocument and set the database connection, SAX parser, and result set.

A result set is needed only when one of the tables in the mapping document is named "Result Set". It is used to retrieve metadata about the columns in the result set.

Methods

 o getConnection
 public Connection getConnection()
Get the current Connection.

Returns:
The current Connection.
 o setConnection
 public void setConnection(Connection conn)
Set the current Connection.

Parameters:
conn - The current Connection.
 o getResultSet
 public ResultSet getResultSet()
Get the current ResultSet.

Returns:
The current ResultSet.
 o setResultSet
 public void setResultSet(ResultSet mappedResultSet)
Set the current ResultSet.

Parameters:
mappedResultSet - The current ResultSet.
 o getParser
 public Parser getParser()
Get the current SAX Parser.

Returns:
The current SAX Parser.
 o setParser
 public void setParser(Parser parser)
Set the current SAX Parser.

Parameters:
parser - The current SAX Parser.
 o createMap
 public Map createMap(Connection conn,
                      ResultSet mappedResultSet,
                      Parser parser,
                      InputSource src) throws InvalidMapException, SQLException
Set the connection, mapped result set (if any), and SAX parser, then create a map from a mapping document.

Parameters:
conn - The current Connection.
mappedResultSet - The current ResultSet. This should be null if the mapping document does not map an element type-as-class to the table named "Result Set".
parser - The current SAX Parser.
src - A SAX InputSource for the mapping document.
Throws: InvalidMapException
Thrown if the mapping document contained a mistake.
Throws: SQLException
Thrown if an error occurred retrieving column metadata from the database or result set.
 o createMap
 public Map createMap(InputSource src) throws InvalidMapException, SQLException
Create a map from a mapping document.

Parameters:
src - A SAX InputSource for the mapping document.
Throws: InvalidMapException
Thrown if the mapping document contained a mistake.
Throws: SQLException
Thrown if an error occurred retrieving column metadata from the database or result set.
 o setDocumentLocator
 public void setDocumentLocator(Locator locator)
Implementation of setDocumentLocator in SAX' DocumentHandler interface. This method is called by the SAX Parser and should not be called by XML-DBMS programmers.

 o startDocument
 public void startDocument() throws SAXException
Implementation of startDocument in SAX' DocumentHandler interface. This method is called by the SAX Parser and should not be called by XML-DBMS programmers.

 o endDocument
 public void endDocument() throws SAXException
Implementation of endDocument in SAX' DocumentHandler interface. This method is called by the SAX Parser and should not be called by XML-DBMS programmers.

 o startElement
 public void startElement(String name,
                          AttributeList attrs) throws SAXException
Implementation of startElement in SAX' DocumentHandler interface. This method is called by the SAX Parser and should not be called by XML-DBMS programmers.

 o endElement
 public void endElement(String name) throws SAXException
Implementation of endElement in SAX' DocumentHandler interface. This method is called by the SAX Parser and should not be called by XML-DBMS programmers.

 o characters
 public void characters(char ch[],
                        int start,
                        int length) throws SAXException
Implementation of characters in SAX' DocumentHandler interface. This method is called by the SAX Parser and should not be called by XML-DBMS programmers.

 o ignorableWhitespace
 public void ignorableWhitespace(char ch[],
                                 int start,
                                 int length) throws SAXException
Implementation of ignorableWhitespace in SAX' DocumentHandler interface. This method is called by the SAX Parser and should not be called by XML-DBMS programmers.

 o processingInstruction
 public void processingInstruction(String target,
                                   String data) throws SAXException
Implementation of processingInstruction in SAX' DocumentHandler interface. This method is called by the SAX Parser and should not be called by XML-DBMS programmers.


All Packages  Class Hierarchy  This Package  Previous  Next  Index