easik.sketch.util.Export
Class ExportHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by easik.sketch.util.Export.ExportHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class ExportHandler
extends org.xml.sax.helpers.DefaultHandler

A class to parse XML specifically for database and SQL file generation. Should not be used for any other purpose, as it does not contain any graphical information.

Since:
2006-05-18 Vera Ranieri
Version:
2006-06-27 Vera Ranieri
Author:
Vera Ranieri

Field Summary
private  java.util.ArrayList<ExportConstraint> _constraints
          A list of all constraints found in the XML file.
private  int _count
          A count maintained to ensure that each procedure has a unique identifier
private  ExportConstraint _curConstraint
          The current constraint
private  java.lang.String _curDatatype
          The current datatype
private  ExportPath _curPath
          The current path
private  ExportUniqueKey _curUniqueKey
          The current unique key
private  java.util.HashMap<java.lang.String,java.lang.String> _datatypes
          A hashmap of all data types found in the XML file.
private  java.util.HashMap<java.lang.String,ExportEdge> _edges
          HashMap of all edges to add to paths.
private  ExportTable _newTable
          The current table being added to the database
private  java.util.HashMap<java.lang.String,ExportPath> _paths
          HashMap of all paths in the sketch.
private  java.lang.String _platform
          The database platform to export to
private  java.util.HashMap<java.lang.String,ExportTable> _tables
          A HashMap of all the tables of the graph.
 
Constructor Summary
ExportHandler(java.lang.String platform)
          Create a new instance of a SQLHandler and initialize all fields.
 
Method Summary
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Overloaded method from the extended default handler.
 java.util.ArrayList<ExportConstraint> getConstraints()
          Gets the constraints associated with a XML sketch
 java.lang.String getPlatform()
          Gets the platform of the database.
 ExportTable getTable(java.lang.String name)
          Gets the table associated with a given entity name
 java.util.HashMap<java.lang.String,ExportTable> getTables()
          Getter method for the HashMap of all tables to be created.
 void startElement(java.lang.String namespace, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Overloaded method from the extended Default Handler
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tables

private java.util.HashMap<java.lang.String,ExportTable> _tables
A HashMap of all the tables of the graph. Indexed by the name of the table.


_platform

private java.lang.String _platform
The database platform to export to


_newTable

private ExportTable _newTable
The current table being added to the database


_curPath

private ExportPath _curPath
The current path


_curConstraint

private ExportConstraint _curConstraint
The current constraint


_curUniqueKey

private ExportUniqueKey _curUniqueKey
The current unique key


_curDatatype

private java.lang.String _curDatatype
The current datatype


_edges

private java.util.HashMap<java.lang.String,ExportEdge> _edges
HashMap of all edges to add to paths. Indexed by the name of the edge


_paths

private java.util.HashMap<java.lang.String,ExportPath> _paths
HashMap of all paths in the sketch. Indexed by the name of the path


_constraints

private java.util.ArrayList<ExportConstraint> _constraints
A list of all constraints found in the XML file.


_datatypes

private java.util.HashMap<java.lang.String,java.lang.String> _datatypes
A hashmap of all data types found in the XML file. Indexed by the description of the type


_count

private int _count
A count maintained to ensure that each procedure has a unique identifier

Constructor Detail

ExportHandler

public ExportHandler(java.lang.String platform)
Create a new instance of a SQLHandler and initialize all fields.

Parameters:
platform - The string representation of the user chosen platform.
Since:
2006-05-18 Vera Ranieri
Method Detail

getPlatform

public java.lang.String getPlatform()
Gets the platform of the database.

Returns:
The platform name
Since:
2006-05-18, Vera Ranieri

getTables

public java.util.HashMap<java.lang.String,ExportTable> getTables()
Getter method for the HashMap of all tables to be created. (ie all entities in XML and their properties)

Returns:
The tables of the XML
Since:
2006-05-18 Vera Ranieri

getTable

public ExportTable getTable(java.lang.String name)
Gets the table associated with a given entity name

Parameters:
name - The name of the table
Returns:
The SQLTable associated with that name
Since:
2006-05-18, Vera Ranieri

getConstraints

public java.util.ArrayList<ExportConstraint> getConstraints()
Gets the constraints associated with a XML sketch

Returns:
ArrayList of all constraints
Since:
2006-05-23, Vera Ranieri

startElement

public void startElement(java.lang.String namespace,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
Overloaded method from the extended Default Handler

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
namespace - @see org.xml.sax.helpers.DefaultHandler
localName - @see org.xml.sax.helpers.DefaultHandler
qName - @see org.xml.sax.helpers.DefaultHandler
atts - @see org.xml.sax.helpers.DefaultHandler
Since:
2006-05-18, Vera Ranieri
See Also:
DefaultHandler

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
Overloaded method from the extended default handler.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri -
localName -
qName -
Since:
2006-05-23, Vera Ranieri
See Also:
DefaultHandler