org.clazzes.jdbc2xml.schema
Class SchemaManager

java.lang.Object
  extended by org.clazzes.jdbc2xml.schema.SchemaManager

public class SchemaManager
extends Object

Bean for initial database setup.


Field Summary
static TableInfo VERSION_HISTORY
           
 
Constructor Summary
SchemaManager()
           
 
Method Summary
 String getBaseDescription()
           
 List<TableInfo> getBaseTables()
           
 String getBaseVersion()
           
 DataSource getDataSource()
           
 ISchemaEngine getSchemaEngine()
           
 Map<String,Class<? extends ISchemaUpdateSnippet>> getUpateSnippets()
           
protected  void initUpdate()
          Triggers a schema-update.
 void setBaseDescription(String baseDescription)
           
 void setBaseTables(List<TableInfo> tables)
           
 void setBaseVersion(String baseVersion)
           
 void setDataSource(DataSource dataSource)
           
 void setSchemaEngine(ISchemaEngine schemaEngine)
           
 void setUpateSnippets(Map<String,Class<? extends ISchemaUpdateSnippet>> upateSnippets)
           
protected  void setupDB()
          Sets up the tables as described in baseTables.
 void start()
          Setup-method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_HISTORY

public static final TableInfo VERSION_HISTORY
Constructor Detail

SchemaManager

public SchemaManager()
Method Detail

start

public void start()
           throws SchemaManagementException
Setup-method. Checks if the schema-history table exists; if it does, it attempts to run a schema-update, otherwise the database is set up according to the TableInfos saved in baseTables, and then runs an update.

Throws:
SchemaManagementException

setupDB

protected void setupDB()
                throws SchemaManagementException
Sets up the tables as described in baseTables.

Throws:
SchemaManagementException

initUpdate

protected void initUpdate()
                   throws SchemaManagementException
Triggers a schema-update.

Throws:
SchemaManagementException
SQLException - because this method should only be called inside a try-catch block.

getDataSource

public DataSource getDataSource()
Returns:
the dataSource

setDataSource

public void setDataSource(DataSource dataSource)
Parameters:
dataSource - the dataSource to set

getSchemaEngine

public ISchemaEngine getSchemaEngine()
Returns:
the schemaEngine

setSchemaEngine

public void setSchemaEngine(ISchemaEngine schemaEngine)
Parameters:
schemaEngine - the schemaEngine to set

getBaseVersion

public String getBaseVersion()
Returns:
The initial schema version.

setBaseVersion

public void setBaseVersion(String baseVersion)
Parameters:
baseVersion - The initial version to set.

getBaseDescription

public String getBaseDescription()
Returns:
The description of the initial database version.

setBaseDescription

public void setBaseDescription(String baseDescription)
Parameters:
baseDescription - The description of the initial database version.

getBaseTables

public List<TableInfo> getBaseTables()
Returns:
The list of tables in the initial database setup.

setBaseTables

public void setBaseTables(List<TableInfo> tables)
Parameters:
tables - The list of tables in the initial database setup to set.

getUpateSnippets

public Map<String,Class<? extends ISchemaUpdateSnippet>> getUpateSnippets()
Returns:
The map of update snippets keyed to their originating version.

setUpateSnippets

public void setUpateSnippets(Map<String,Class<? extends ISchemaUpdateSnippet>> upateSnippets)
Parameters:
upateSnippets - The map of update snippets keyed to their originating version.


Copyright © 2012. All Rights Reserved.