|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.ic.doc.automed.reps.RelationalOutputter
public class RelationalOutputter
Class the materialise an SQL oriented AutoMed schema
Nested Class Summary | |
---|---|
(package private) class |
RelationalOutputter.SQLColumn
|
(package private) class |
RelationalOutputter.SQLTable
A class to store info about a SQL table before it is materialised |
Field Summary | |
---|---|
private java.util.ArrayList |
allSchemaObjects
A list of all the Schema Objects of type 'sql' in this schema |
private java.sql.Connection |
con
|
private java.util.HashSet |
createdTables
|
private Schema[] |
dataSourceSchemas
The wrapped source shema we'll get the data from |
private java.lang.String |
dbDriver
|
private java.lang.String |
dbName
The name of database we create |
private Schema |
dsSchema
|
private java.lang.String |
modelName
The name of the SQL model to materialise |
private java.lang.String |
password
|
private java.lang.String |
peerName
The name of the peer if we're using this in P2P |
private Schema |
schema
The schema with the sql constructs to output |
private static java.lang.String |
SQL_MODEL_NAME
|
private java.util.HashMap |
sqlTables
|
private int |
tableUniqueIdentifier
An identifier to add to a table name to make it unique to stop lots of table already exists errors during testing |
private java.lang.String |
url
|
private java.lang.String |
username
|
Constructor Summary | |
---|---|
RelationalOutputter(AutoMedPeer peer,
Schema schema)
Creates a new instance of RelationalOutputter with a default output directory for use with an AutoMed peer |
|
RelationalOutputter(Schema schema,
java.lang.String dbName)
Creates a new instance of RelationalOutputter with a default output directory |
|
RelationalOutputter(Schema s,
java.lang.String dbDriver,
java.lang.String url,
java.lang.String username,
java.lang.String password)
Creates a new instance of RelationalOutputter with a given DB url, username and password |
Method Summary | |
---|---|
private RelationalOutputter.SQLTable |
addColumns(SchemaObject[] columnsAndKeys,
RelationalOutputter.SQLTable table)
|
private boolean |
checkTableExists(RelationalOutputter.SQLTable table)
Check to see if this table exists |
void |
connectToDB()
Connect to the local database |
private java.lang.String |
createFKStatement(RelationalOutputter.SQLTable table)
|
java.lang.String |
createRelationalTables()
Create the relational tables from the automed schema objects |
private java.lang.String |
createSQLStatement(RelationalOutputter.SQLTable table)
|
private void |
executeSQL()
Execute a SQL statement to create a table |
private java.lang.String |
insertValues(RelationalOutputter.SQLTable table)
|
private ASG |
querySourceSchema(java.lang.String query)
Get the data from the source Schema |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Schema schema
private Schema dsSchema
private java.util.ArrayList allSchemaObjects
private Schema[] dataSourceSchemas
private java.lang.String modelName
private java.lang.String dbName
private java.util.HashSet createdTables
private java.util.HashMap sqlTables
private java.sql.Connection con
private java.lang.String url
private java.lang.String username
private java.lang.String password
private java.lang.String dbDriver
private static final java.lang.String SQL_MODEL_NAME
private int tableUniqueIdentifier
private java.lang.String peerName
Constructor Detail |
---|
public RelationalOutputter(Schema schema, java.lang.String dbName) throws AutoMedException
AutoMedException
public RelationalOutputter(AutoMedPeer peer, Schema schema) throws AutoMedException
AutoMedException
public RelationalOutputter(Schema s, java.lang.String dbDriver, java.lang.String url, java.lang.String username, java.lang.String password) throws AutoMedException
source
- The source schemas
- The schema to be materialiseddbDriver
- The db driver stringxmlDoc
- Whether or not there is a XML instance documenturl
- The url of the output databaseusername
- The username to log into the target dbpassword
- The password to log into the output db
AutoMedException
- Thrown when theres a problemMethod Detail |
---|
private RelationalOutputter.SQLTable addColumns(SchemaObject[] columnsAndKeys, RelationalOutputter.SQLTable table) throws AutoMedException
AutoMedException
private java.lang.String createSQLStatement(RelationalOutputter.SQLTable table) throws AutoMedException
AutoMedException
private java.lang.String createFKStatement(RelationalOutputter.SQLTable table) throws AutoMedException
AutoMedException
private java.lang.String insertValues(RelationalOutputter.SQLTable table)
private boolean checkTableExists(RelationalOutputter.SQLTable table)
private void executeSQL() throws java.lang.Exception
java.lang.Exception
private ASG querySourceSchema(java.lang.String query)
public void connectToDB()
public java.lang.String createRelationalTables() throws AutoMedException, java.lang.Exception
java.lang.Exception
- A SQL problem
AutoMedException
- A repository problem
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |