easik.sketch.util
Class SketchHandler

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

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

The SketchHandler is the overloaded handler for reading the sketches in from XML. There is very little error checking in here to deal with bad XML. TODO: Implement schema checking

Version:
2006-07-14 Vera Ranieri
Author:
Rob Fletcher 2005, Kevin Green 2006, Vera Ranieri 2006

Field Summary
private  boolean _allConstraintsVisible
          Whether all constraints are visible
private  java.util.HashMap<java.lang.String,SketchPath> _allPaths
          The paths of the sketch, indexed by name
private  java.util.LinkedList<Constraint> _constraints
          The constraints of the sketch
private  java.util.ArrayList<SketchPath> _curConstraintPaths
          The paths involved in the current constraint being defined
private  boolean _curConstraintVisible
          The visibility of the current constraint
private  int _curConstraintX
          The x-position of the current constraint being defined
private  int _curConstraintY
          The y-position of the current constraint being defined
private  java.util.HashMap<java.lang.String,EntityAttribute> _curNodeAtts
          Hash Map of the current node attributes, indexed by the name of the attribute
private  java.util.LinkedList<SketchEdge> _curPath
          The edges involved in the current path being built from the XML file
private  java.lang.String _currNode
          The name of the current entity or constraint
private  DataType _curType
          The data type of the current attribute
private  java.util.ArrayList<EntityAttribute> _curUniqueKeyAtts
          The EntityAttributes involved in the current Unique key being defined
private  java.lang.String _curUniqueKeyName
          The name of the current unique key
private  java.util.ArrayList<DataType> _datatypes
          The data types defined for the sketch
private  DocumentInfo _docInfo
          The document information for the sketch
private  java.util.HashMap<java.lang.String,org.jgrapht.graph.DefaultEdge> _edges
          The edges of the sketch, indexed by name
private  java.util.HashMap<java.lang.String,EntityNode> _entityNodes
          The entity nodes of the sketch, indexed by name
private  EntityNode _newNode
          The current entity node
private  boolean _useDB2
          Variable to store whether the respective platform is in use and defined.
private  boolean _useMySQL
          Variable to store whether the respective platform is in use and defined.
private  boolean _useOracle
          Variable to store whether the respective platform is in use and defined.
private  boolean _useUserDefined
          Variable to store whether the respective platform is in use and defined.
private  boolean _useXML
          Variable to store whether the respective platform is in use and defined.
 
Constructor Summary
SketchHandler()
          Default Constructor
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Overloaded method that is called any time the end of an element is found
 java.util.LinkedList<Constraint> getConstraints()
          Returns LinkedList of constraints
 java.util.ArrayList<DataType> getDataTypes()
          Returns ArrayList of data types
 DocumentInfo getDocumentInfo()
          Get the document information of the current sketch
 java.util.HashMap<java.lang.String,org.jgrapht.graph.DefaultEdge> getEdges()
          Returns HashMap of edges
 java.util.HashMap<java.lang.String,EntityNode> getEntities()
          Returns HashMap of entities
 java.util.HashMap<java.lang.String,SketchPath> getPaths()
          Returns HashMap of paths
 boolean is_useDB2()
           
 boolean is_useMySQL()
           
 boolean is_useOracle()
           
 boolean is_useUserDefined()
           
 boolean is_useXML()
           
 void startElement(java.lang.String namespace, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Overloaded method that is called any time the start of an element is found
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
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

_entityNodes

private java.util.HashMap<java.lang.String,EntityNode> _entityNodes
The entity nodes of the sketch, indexed by name


_edges

private java.util.HashMap<java.lang.String,org.jgrapht.graph.DefaultEdge> _edges
The edges of the sketch, indexed by name


_allPaths

private java.util.HashMap<java.lang.String,SketchPath> _allPaths
The paths of the sketch, indexed by name


_constraints

private java.util.LinkedList<Constraint> _constraints
The constraints of the sketch


_datatypes

private java.util.ArrayList<DataType> _datatypes
The data types defined for the sketch


_docInfo

private DocumentInfo _docInfo
The document information for the sketch


_useMySQL

private boolean _useMySQL
Variable to store whether the respective platform is in use and defined.


_useOracle

private boolean _useOracle
Variable to store whether the respective platform is in use and defined.


_useDB2

private boolean _useDB2
Variable to store whether the respective platform is in use and defined.


_useXML

private boolean _useXML
Variable to store whether the respective platform is in use and defined.


_useUserDefined

private boolean _useUserDefined
Variable to store whether the respective platform is in use and defined.


_curPath

private java.util.LinkedList<SketchEdge> _curPath
The edges involved in the current path being built from the XML file


_curConstraintX

private int _curConstraintX
The x-position of the current constraint being defined


_curConstraintY

private int _curConstraintY
The y-position of the current constraint being defined


_curConstraintVisible

private boolean _curConstraintVisible
The visibility of the current constraint


_allConstraintsVisible

private boolean _allConstraintsVisible
Whether all constraints are visible


_curConstraintPaths

private java.util.ArrayList<SketchPath> _curConstraintPaths
The paths involved in the current constraint being defined


_curUniqueKeyAtts

private java.util.ArrayList<EntityAttribute> _curUniqueKeyAtts
The EntityAttributes involved in the current Unique key being defined


_curNodeAtts

private java.util.HashMap<java.lang.String,EntityAttribute> _curNodeAtts
Hash Map of the current node attributes, indexed by the name of the attribute


_curUniqueKeyName

private java.lang.String _curUniqueKeyName
The name of the current unique key


_newNode

private EntityNode _newNode
The current entity node


_curType

private DataType _curType
The data type of the current attribute


_currNode

private java.lang.String _currNode
The name of the current entity or constraint

Constructor Detail

SketchHandler

public SketchHandler()
Default Constructor

Method Detail

getEdges

public java.util.HashMap<java.lang.String,org.jgrapht.graph.DefaultEdge> getEdges()
Returns HashMap of edges

Returns:
HashMap of edges

getPaths

public java.util.HashMap<java.lang.String,SketchPath> getPaths()
Returns HashMap of paths

Returns:
HashMap of all paths
Since:
2006-05-29

getEntities

public java.util.HashMap<java.lang.String,EntityNode> getEntities()
Returns HashMap of entities

Returns:
HashMap of entities

getConstraints

public java.util.LinkedList<Constraint> getConstraints()
Returns LinkedList of constraints

Returns:
LinkedList of constraints

getDataTypes

public java.util.ArrayList<DataType> getDataTypes()
Returns ArrayList of data types

Returns:
ArrayList of data types

getDocumentInfo

public DocumentInfo getDocumentInfo()
Get the document information of the current sketch

Returns:
The DocumentInfo object associated with this sketch

startElement

public void startElement(java.lang.String namespace,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
Overloaded method that is called any time the start of an element is found

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

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
Overloaded method that is called any time the end of an element is found

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - @see org.xml.sax.helpers.DefaultHandler
localName - @see org.xml.sax.helpers.DefaultHandler
qName - @see org.xml.sax.helpers.DefaultHandler

characters

public void characters(char[] ch,
                       int start,
                       int length)
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - @see org.xml.sax.helpers.DefaultHandler
start - @see org.xml.sax.helpers.DefaultHandler
length - @see org.xml.sax.helpers.DefaultHandler
See Also:
DefaultHandler

is_useDB2

public boolean is_useDB2()
Returns:
Returns the _useDB2.

is_useMySQL

public boolean is_useMySQL()
Returns:
Returns the _useMySQL.

is_useOracle

public boolean is_useOracle()
Returns:
Returns the _useOracle.

is_useUserDefined

public boolean is_useUserDefined()
Returns:
Returns the _useUserDefined.

is_useXML

public boolean is_useXML()
Returns:
Returns the _useXML.