|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteasik.sketch.util.Export.SketchToSchema
public class SketchToSchema
Sketch to Schema is a class which will accept a sketch and then generate an SQL schema. It can currently create a schema without constraints. Constraints will be implemented later using SQL triggers.
Field Summary | |
---|---|
private java.lang.String |
_createString
The string CREATE DATABASE |
private ExportHandler |
_eHandler
The export handler associated with this sketch |
private java.util.LinkedList<java.lang.String> |
_finalTables
A list of all the table to be defined |
private java.util.ArrayList<java.lang.String> |
_procedures
A list of al the procedures to be defined. |
private ExportTriggerFormatter |
_triggers
The Trigger formatter associated with this sketch |
private java.lang.String |
_useString
The string USE |
Constructor Summary | |
---|---|
SketchToSchema(ExportHandler sh,
java.lang.String name)
This is the constructor that takes the ExportHandler containing information via the XML file (that is, bypassing all sketch information) and provides the output schema. |
Method Summary | |
---|---|
private void |
addUnmarkedParents(java.util.HashMap tables,
java.util.LinkedList workingSet,
java.util.ListIterator<ExportTable> listIterator,
ExportTable currentTable)
Find all the unmarked parents of marked nodes, add them to the provided listIterator. |
private boolean |
areNeighborsMarked(java.util.HashMap tables,
ExportTable t)
A helper method which will check to see if the neighbours of a current table have been marked. |
java.util.ArrayList<java.lang.String> |
getConstraints()
Getter method for the set of constraints of the schema. |
java.lang.String |
getCreateString()
Getter method for the CREATE DATABASE |
private java.util.LinkedList<ExportTable> |
getSinks(java.util.HashMap tables)
Find all the tables in the sketch that do not have any outgoing edges. |
java.util.LinkedList<java.lang.String> |
getTables()
Getter method for the constructed set of tables |
java.util.ArrayList<java.lang.String> |
getTriggers()
Getter method for all triggers formed from the table. |
java.lang.String |
getUseString()
Getter method for the USE |
private java.lang.String |
newTable(ExportTable table)
Given a table, create a SQL table (which is a string). |
private void |
printSchemaInfo()
Temporary method to print schema info. |
private void |
setConstraints()
Sets the constraint string for this schema |
void |
setCreateString(java.lang.String name)
Setter method for the CREATE DATABASE |
private void |
setTables()
A method to set all tables associated with the schema. |
void |
setUseString(java.lang.String name)
Sets the USE |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.LinkedList<java.lang.String> _finalTables
private java.util.ArrayList<java.lang.String> _procedures
private java.lang.String _createString
private java.lang.String _useString
private ExportTriggerFormatter _triggers
private ExportHandler _eHandler
Constructor Detail |
---|
public SketchToSchema(ExportHandler sh, java.lang.String name)
sh
- The ExportHandler containg information about the sketch gleaned from the XML file.name
- The name of the database to be created.Method Detail |
---|
private void setTables()
private java.util.LinkedList<ExportTable> getSinks(java.util.HashMap tables)
tables
- The hashmap of all tables contained in this sketch
private boolean areNeighborsMarked(java.util.HashMap tables, ExportTable t)
tables
- The tables of this sketcht
- The current table for which it must be determined whether neighbours are marked.
private void addUnmarkedParents(java.util.HashMap tables, java.util.LinkedList workingSet, java.util.ListIterator<ExportTable> listIterator, ExportTable currentTable)
tables
- The set of tables for the sketchworkingSet
- The tables which are currently 'in play'listIterator
- The list iterator containing where we are in the nodescurrentTable
- The table whose unmarked parents we're looking forprivate java.lang.String newTable(ExportTable table)
table
- The table which is getting its own SQL table
public java.util.LinkedList<java.lang.String> getTables()
public java.util.ArrayList<java.lang.String> getConstraints()
public java.util.ArrayList<java.lang.String> getTriggers()
public java.lang.String getCreateString()
public void setCreateString(java.lang.String name)
name
- The name of the databasepublic java.lang.String getUseString()
public void setUseString(java.lang.String name)
name
- The name of the databaseprivate void setConstraints()
private void printSchemaInfo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |