org.apache.openjpa.jdbc.schema
Class Schema

java.lang.Object
  extended by org.apache.openjpa.jdbc.schema.Schema
All Implemented Interfaces:
Serializable, Comparable<Schema>

public class Schema
extends Object
implements Comparable<Schema>, Serializable

Represents a database schema.

Author:
Abe White
See Also:
Serialized Form

Constructor Summary
Schema()
          Default constructor.
Schema(DBIdentifier name, SchemaGroup group)
           
Schema(String name, SchemaGroup group)
          Deprecated.  
 
Method Summary
 Sequence addSequence(DBIdentifier name)
           
 Sequence addSequence(String name)
          Deprecated.  
 Table addTable(DBIdentifier name)
           
 Table addTable(DBIdentifier name, DBIdentifier validName)
           
 Table addTable(String name)
          Deprecated.  
 Table addTable(String name, String validName)
          Deprecated.  
 int compareTo(Schema other)
           
 DBIdentifier getIdentifier()
           
 String getName()
          Deprecated.  
 SchemaGroup getSchemaGroup()
          Return the schema's group.
 Sequence getSequence(DBIdentifier name)
           
 Sequence getSequence(String name)
          Deprecated.  
 Sequence[] getSequences()
          Return the schema's sequences.
 Table getTable(DBIdentifier name)
           
 Table getTable(String name)
          Deprecated.  
 Table[] getTables()
          Return the schema's tables.
 Sequence importSequence(Sequence seq)
          Import a sequence from another schema.
 Table importTable(Table table)
          Import a table from another schema.
(package private)  void remove()
          Called when the schema is removed from its group.
 boolean removeSequence(Sequence seq)
          Remove the given sequence from the schema.
 boolean removeTable(Table tab)
          Remove the given table from the schema.
 void setIdentifier(DBIdentifier name)
           
 void setName(String name)
          Deprecated.  
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Schema

public Schema()
Default constructor.


Schema

public Schema(String name,
              SchemaGroup group)
Deprecated. 

Constructor.

Parameters:
name - the schema name, if any
group - the schema's owning group

Schema

public Schema(DBIdentifier name,
              SchemaGroup group)
Method Detail

remove

void remove()
Called when the schema is removed from its group. Invalidates the schema and removes all its member tables.


getSchemaGroup

public SchemaGroup getSchemaGroup()
Return the schema's group.


getName

public String getName()
Deprecated. 

Return the name of the schema, or null if none.


getIdentifier

public DBIdentifier getIdentifier()

setName

public void setName(String name)
Deprecated. 

Set the name of the schema. This method can only be used for schemas not attached to a group.


setIdentifier

public void setIdentifier(DBIdentifier name)

getTables

public Table[] getTables()
Return the schema's tables.


getTable

public Table getTable(String name)
Deprecated. 

Return the table with the given name, or null if none.


getTable

public Table getTable(DBIdentifier name)

addTable

public Table addTable(String name)
Deprecated. 

Add a table to the schema.


addTable

public Table addTable(DBIdentifier name)

addTable

public Table addTable(String name,
                      String validName)
Deprecated. 

Add a table with a shortened (i.e., validated) name to the schema


addTable

public Table addTable(DBIdentifier name,
                      DBIdentifier validName)

removeTable

public boolean removeTable(Table tab)
Remove the given table from the schema.

Returns:
true if the table was removed, false if not in the schema

importTable

public Table importTable(Table table)
Import a table from another schema. Note that this method does not import foreign keys, indexes, or unique constraints.


getSequences

public Sequence[] getSequences()
Return the schema's sequences.


getSequence

public Sequence getSequence(String name)
Deprecated. 

Return the sequence with the given name, or null if none.


getSequence

public Sequence getSequence(DBIdentifier name)

addSequence

public Sequence addSequence(String name)
Deprecated. 

Add a sequence to the schema.


addSequence

public Sequence addSequence(DBIdentifier name)

removeSequence

public boolean removeSequence(Sequence seq)
Remove the given sequence from the schema.

Returns:
true if the sequence was removed, false if not in the schema

importSequence

public Sequence importSequence(Sequence seq)
Import a sequence from another schema.


compareTo

public int compareTo(Schema other)
Specified by:
compareTo in interface Comparable<Schema>

toString

public String toString()
Overrides:
toString in class Object


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