org.apache.openjpa.jdbc.schema
Class DynamicSchemaFactory

java.lang.Object
  extended by org.apache.openjpa.jdbc.schema.NameSet
      extended by org.apache.openjpa.jdbc.schema.SchemaGroup
          extended by org.apache.openjpa.jdbc.schema.DynamicSchemaFactory
All Implemented Interfaces:
Serializable, Cloneable, SchemaFactory, Configurable

public class DynamicSchemaFactory
extends SchemaGroup
implements SchemaFactory, Configurable

Factory whose schema group dynamically fills itself with information as mappings validate themselves in their map method. Tables are added when SchemaGroup.findTable(org.apache.openjpa.jdbc.schema.Table) is called. Columns are added to tables when Table.getColumn(java.lang.String) is called. And the column types are set when Column.isCompatible(int, java.lang.String, int, int) is called.

Author:
Abe White
See Also:
Serialized Form

Constructor Summary
DynamicSchemaFactory()
           
 
Method Summary
 void endConfiguration()
          Invoked upon completion of bean property configuration for this object.
 Table findTable(String name)
          Find the table with the given name in the group, using '.' as the catalog separator.
 boolean isKnownTable(String name)
          Return true if the given table is known to exist.
 boolean isKnownTable(Table table)
          Return true if the given table is known to exist.
protected  Column newColumn(String name, Table table)
          Return a new column with the given name and owner table.
protected  Table newTable(String name, Schema schema)
          Return a new table with the given name and owner schema.
 SchemaGroup readSchema()
          Return the schema group for the current object model and database.
 void setConfiguration(Configuration conf)
          Invoked prior to setting bean properties.
 void startConfiguration()
          Invoked before bean property configuration is begun on this object.
 void storeSchema(SchemaGroup schema)
          Record the schema group after changes may have been made.
 
Methods inherited from class org.apache.openjpa.jdbc.schema.SchemaGroup
addSchema, addSchema, clone, copy, findExportedForeignKeys, findSequence, findSequence, findSequence, findTable, findTable, getSchema, getSchemas, importSchema, isKnownSequence, isKnownSequence, newForeignKey, newIndex, newInstance, newPrimaryKey, newSchema, newSequence, newUnique, removeSchema, removeUnusedComponents
 
Methods inherited from class org.apache.openjpa.jdbc.schema.NameSet
addName, isNameTaken, removeName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicSchemaFactory

public DynamicSchemaFactory()
Method Detail

setConfiguration

public void setConfiguration(Configuration conf)
Description copied from interface: Configurable
Invoked prior to setting bean properties.

Specified by:
setConfiguration in interface Configurable

startConfiguration

public void startConfiguration()
Description copied from interface: Configurable
Invoked before bean property configuration is begun on this object.

Specified by:
startConfiguration in interface Configurable

endConfiguration

public void endConfiguration()
Description copied from interface: Configurable
Invoked upon completion of bean property configuration for this object.

Specified by:
endConfiguration in interface Configurable

readSchema

public SchemaGroup readSchema()
Description copied from interface: SchemaFactory
Return the schema group for the current object model and database.

Specified by:
readSchema in interface SchemaFactory

storeSchema

public void storeSchema(SchemaGroup schema)
Description copied from interface: SchemaFactory
Record the schema group after changes may have been made.

Specified by:
storeSchema in interface SchemaFactory
Parameters:
schema - the schema definition for the entire system

isKnownTable

public boolean isKnownTable(Table table)
Description copied from class: SchemaGroup
Return true if the given table is known to exist. While SchemaGroup.findTable(org.apache.openjpa.jdbc.schema.Table) may exhibit dynamic behavior in some schema group implementations, this method only returns true if the table has been added to this group or is known to exist in the database.

Overrides:
isKnownTable in class SchemaGroup

isKnownTable

public boolean isKnownTable(String name)
Description copied from class: SchemaGroup
Return true if the given table is known to exist. While SchemaGroup.findTable(org.apache.openjpa.jdbc.schema.Table) may exhibit dynamic behavior in some schema group implementations, this method only returns true if the table has been added to this group or is known to exist in the database.

Overrides:
isKnownTable in class SchemaGroup

findTable

public Table findTable(String name)
Description copied from class: SchemaGroup
Find the table with the given name in the group, using '.' as the catalog separator. Returns null if no table found.

Overrides:
findTable in class SchemaGroup

newTable

protected Table newTable(String name,
                         Schema schema)
Description copied from class: SchemaGroup
Return a new table with the given name and owner schema.

Overrides:
newTable in class SchemaGroup

newColumn

protected Column newColumn(String name,
                           Table table)
Description copied from class: SchemaGroup
Return a new column with the given name and owner table.

Overrides:
newColumn in class SchemaGroup


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.