Package org.apache.openjpa.jdbc.schema
Class SchemaGroup
- java.lang.Object
-
- org.apache.openjpa.jdbc.schema.NameSet
-
- org.apache.openjpa.jdbc.schema.SchemaGroup
-
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
DynamicSchemaFactory,LazySchemaFactory
public class SchemaGroup extends NameSet implements Cloneable
Represents a grouping of schemas used in a database.- Author:
- Abe White
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SchemaGroup()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SchemaaddSchema()Add a schema to the group.SchemaaddSchema(String name)Deprecated.SchemaaddSchema(DBIdentifier name)Add a schema to the group.Objectclone()protected voidcopy(SchemaGroup group)Copy cloneable state from the given instance.ForeignKey[]findExportedForeignKeys(PrimaryKey pk)Find all foreign keys exported by a given primary key (all foreign keys that link to the primary key).SequencefindSequence(String name)Deprecated.SequencefindSequence(DBIdentifier name)SequencefindSequence(QualifiedDBIdentifier path)SequencefindSequence(Schema inSchema, String name)Deprecated.SequencefindSequence(Schema inSchema, QualifiedDBIdentifier path)SequencefindSequence(Sequence seq)Find the equivalent of the given sequence in this schema group.TablefindTable(String name)Deprecated.TablefindTable(QualifiedDBIdentifier path)TablefindTable(Schema inSchema, String name)Deprecated.TablefindTable(Schema inSchema, DBIdentifier name)TablefindTable(Schema inSchema, DBIdentifier name, DBIdentifier defaultSchemaName)TablefindTable(Schema inSchema, QualifiedDBIdentifier path, DBIdentifier defaultSchemaName)TablefindTable(Table table)Find the equivalent of the given table in this schema group.SchemagetSchema(String name)Deprecated.SchemagetSchema(DBIdentifier name)Schema[]getSchemas()Return all schemas.SchemaimportSchema(Schema schema)Import a schema from another group.booleanisKnownSequence(String name)Deprecated.booleanisKnownSequence(DBIdentifier name)booleanisKnownSequence(QualifiedDBIdentifier path)booleanisKnownSequence(Sequence seq)Return true if the given sequence is known to exist.booleanisKnownTable(String name)Deprecated.booleanisKnownTable(QualifiedDBIdentifier path)booleanisKnownTable(Table table)Return true if the given table is known to exist.protected ColumnnewColumn(String name, Table table)Deprecated.protected ColumnnewColumn(DBIdentifier name, Table table)protected ForeignKeynewForeignKey(String name, Table table)Deprecated.protected ForeignKeynewForeignKey(DBIdentifier name, Table table)protected IndexnewIndex(String name, Table table)Deprecated.protected IndexnewIndex(DBIdentifier name, Table table)protected SchemaGroupnewInstance()Create a new instance of this class.protected PrimaryKeynewPrimaryKey(String name, Table table)Deprecated.protected PrimaryKeynewPrimaryKey(DBIdentifier name, Table table)protected SchemanewSchema(String name)Deprecated.protected SchemanewSchema(DBIdentifier name)protected SequencenewSequence(String name, Schema schema)Deprecated.protected SequencenewSequence(DBIdentifier name, Schema schema)protected TablenewTable(String name, Schema schema)Deprecated.protected TablenewTable(DBIdentifier name, Schema schema)protected UniquenewUnique(String name, Table table)Deprecated.protected UniquenewUnique(DBIdentifier name, Table table)booleanremoveSchema(Schema schema)Remove the given schema from the group.voidremoveUnusedComponents()Remove unreferenced or emtpy components from the schema.-
Methods inherited from class org.apache.openjpa.jdbc.schema.NameSet
addName, addName, isNameTaken, isNameTaken, removeName, removeName
-
-
-
-
Method Detail
-
getSchemas
public Schema[] getSchemas()
Return all schemas.
-
getSchema
@Deprecated public Schema getSchema(String name)
Deprecated.Return the schema with the given name, or null if none.
-
getSchema
public Schema getSchema(DBIdentifier name)
-
addSchema
public Schema addSchema()
Add a schema to the group.
-
addSchema
public Schema addSchema(DBIdentifier name)
Add a schema to the group.
-
addSchema
@Deprecated public Schema addSchema(String name)
Deprecated.- Parameters:
name-
-
removeSchema
public boolean removeSchema(Schema schema)
Remove the given schema from the group.- Returns:
- true if the schema was removed, false if not in the group
-
importSchema
public Schema importSchema(Schema schema)
Import a schema from another group. Foreign keys are not imported.
-
isKnownTable
public boolean isKnownTable(Table table)
Return true if the given table is known to exist. WhilefindTable(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.
-
isKnownTable
@Deprecated public boolean isKnownTable(String name)
Deprecated.Return true if the given table is known to exist. WhilefindTable(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.
-
isKnownTable
public boolean isKnownTable(QualifiedDBIdentifier path)
-
findTable
public Table findTable(Table table)
Find the equivalent of the given table in this schema group. The given table that may have come from another schema group.
-
findTable
@Deprecated public Table findTable(String name)
Deprecated.Find the table with the given name in the group, using '.' as the catalog separator. Returns null if no table found.
-
findTable
public Table findTable(QualifiedDBIdentifier path)
-
findTable
@Deprecated public Table findTable(Schema inSchema, String name)
Deprecated.Find the table with the given name in the group, using '.' as the catalog separator. Returns null if no table found.
-
findTable
public Table findTable(Schema inSchema, DBIdentifier name)
-
findTable
public Table findTable(Schema inSchema, DBIdentifier name, DBIdentifier defaultSchemaName)
-
findTable
public Table findTable(Schema inSchema, QualifiedDBIdentifier path, DBIdentifier defaultSchemaName)
-
isKnownSequence
public boolean isKnownSequence(Sequence seq)
Return true if the given sequence is known to exist. WhilefindSequence(org.apache.openjpa.jdbc.schema.Sequence)may exhibit dynamic behavior in some schema group implementations, this method only returns true if the sequence has been added to this group or is known to exist in the database.
-
isKnownSequence
@Deprecated public boolean isKnownSequence(String name)
Deprecated.Return true if the given sequence is known to exist. WhilefindSequence(org.apache.openjpa.jdbc.schema.Sequence)may exhibit dynamic behavior in some schema group implementations, this method only returns true if the sequence has been added to this group or is known to exist in the database.
-
isKnownSequence
public boolean isKnownSequence(DBIdentifier name)
-
isKnownSequence
public boolean isKnownSequence(QualifiedDBIdentifier path)
-
findSequence
public Sequence findSequence(Sequence seq)
Find the equivalent of the given sequence in this schema group. The given sequence that may have come from another schema group.
-
findSequence
@Deprecated public Sequence findSequence(String name)
Deprecated.Find the sequence with the given name in the group, using '.' as the catalog separator. Returns null if no sequence found.
-
findSequence
public Sequence findSequence(DBIdentifier name)
-
findSequence
public Sequence findSequence(QualifiedDBIdentifier path)
-
findSequence
@Deprecated public Sequence findSequence(Schema inSchema, String name)
Deprecated.Find the sequence with the given name in the group, using '.' as the catalog separator. Returns null if no sequence found.
-
findSequence
public Sequence findSequence(Schema inSchema, QualifiedDBIdentifier path)
-
findExportedForeignKeys
public ForeignKey[] findExportedForeignKeys(PrimaryKey pk)
Find all foreign keys exported by a given primary key (all foreign keys that link to the primary key).
-
removeUnusedComponents
public void removeUnusedComponents()
Remove unreferenced or emtpy components from the schema.
-
newInstance
protected SchemaGroup newInstance()
Create a new instance of this class.
-
copy
protected void copy(SchemaGroup group)
Copy cloneable state from the given instance.
-
newSchema
@Deprecated protected Schema newSchema(String name)
Deprecated.Return a new schema with the given name.
-
newSchema
protected Schema newSchema(DBIdentifier name)
-
newSequence
@Deprecated protected Sequence newSequence(String name, Schema schema)
Deprecated.Return a new sequence with the given name and owner schema.
-
newSequence
protected Sequence newSequence(DBIdentifier name, Schema schema)
-
newTable
@Deprecated protected Table newTable(String name, Schema schema)
Deprecated.Return a new table with the given name and owner schema.
-
newTable
protected Table newTable(DBIdentifier name, Schema schema)
-
newColumn
@Deprecated protected Column newColumn(String name, Table table)
Deprecated.Return a new column with the given name and owner table.
-
newColumn
protected Column newColumn(DBIdentifier name, Table table)
-
newPrimaryKey
@Deprecated protected PrimaryKey newPrimaryKey(String name, Table table)
Deprecated.Return a new primary key with the given name and owner table.
-
newPrimaryKey
protected PrimaryKey newPrimaryKey(DBIdentifier name, Table table)
-
newIndex
@Deprecated protected Index newIndex(String name, Table table)
Deprecated.Return a new index with the given name and owner table.
-
newIndex
protected Index newIndex(DBIdentifier name, Table table)
-
newUnique
@Deprecated protected Unique newUnique(String name, Table table)
Deprecated.Return a new unique constraint with the given name and owner table.
-
newUnique
protected Unique newUnique(DBIdentifier name, Table table)
-
newForeignKey
@Deprecated protected ForeignKey newForeignKey(String name, Table table)
Deprecated.Return a new foreign key with the given name and owner table.
-
newForeignKey
protected ForeignKey newForeignKey(DBIdentifier name, Table table)
-
-