com.caucho.amber.table
Class AmberTable

java.lang.Object
  extended by com.caucho.amber.table.AmberTable

public class AmberTable
extends java.lang.Object

Representation of a database table.


Constructor Summary
AmberTable(AmberPersistenceUnit manager, java.lang.String name)
           
 
Method Summary
 AmberColumn addColumn(AmberColumn column)
          Adds a column.
 void addEntityListener(EntityListener listener)
          Adds a listener for create/delete events
 void addIdColumn(AmberColumn column)
          Adds an id column.
 void beforeEntityDelete(AmberConnection aConn, Entity entity)
          Called before the entity is deleted.
 AmberColumn createColumn(java.lang.String name, AmberType type)
          Creates a column.
 void createDatabaseTable(AmberPersistenceUnit amberPersistenceUnit)
          Creates the table if missing.
 ForeignColumn createForeignColumn(java.lang.String name, AmberColumn key)
          Creates a foreign column.
protected  ConfigException error(java.lang.String msg, java.lang.Throwable e)
           
protected  java.lang.RuntimeException error(java.lang.Throwable e)
           
 AmberPersistenceUnit getAmberManager()
          Returns the amber manager.
 long getCacheTimeout()
          Returns the cache timeout.
 java.util.ArrayList<AmberColumn> getColumns()
          Returns the columns.
 AmberCompletion getDeleteCompletion()
          Returns the table's invalidation.
 LinkColumns getDependentIdLink()
          Gets the id link for a dependent table.
 java.util.ArrayList<AmberColumn> getIdColumns()
          Returns the id columns.
 java.util.ArrayList<LinkColumns> getIncomingLinks()
           
 AmberCompletion getInvalidateCompletion()
          Returns the table's invalidation.
 java.lang.String getLocation()
          Returns the location.
 java.lang.String getName()
          Gets the sql table name.
 java.util.ArrayList<LinkColumns> getOutgoingLinks()
           
 EntityType getType()
          Gets the entity type.
 AmberCompletion getUpdateCompletion()
          Returns the table's invalidation.
 boolean hasListeners()
          Returns true if there are any listeners.
 boolean isCascadeDelete()
          Returns true if any deletes of this object are cascaded.
 boolean isReadOnly()
          Returns true if read-only
 boolean removeColumn(AmberColumn column)
          Remove a given column.
 void setCacheTimeout(long timeout)
          Sets the cache timeout.
 void setConfigLocation(java.lang.String location)
          Sets the config location.
 void setDependentIdLink(LinkColumns link)
          Sets the id link for a dependent table.
 void setReadOnly(boolean isReadOnly)
          Sets true if read-only
 void setType(EntityType type)
          Sets the entity type.
 java.lang.String toString()
          Printable version of the entity.
 void validateDatabaseTable(AmberPersistenceUnit amberPersistenceUnit)
          Creates the table if missing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AmberTable

public AmberTable(AmberPersistenceUnit manager,
                  java.lang.String name)
Method Detail

getIncomingLinks

public java.util.ArrayList<LinkColumns> getIncomingLinks()

getOutgoingLinks

public java.util.ArrayList<LinkColumns> getOutgoingLinks()

getName

public java.lang.String getName()
Gets the sql table name.


setConfigLocation

public void setConfigLocation(java.lang.String location)
Sets the config location.


getLocation

public java.lang.String getLocation()
Returns the location.


getAmberManager

public AmberPersistenceUnit getAmberManager()
Returns the amber manager.


setType

public void setType(EntityType type)
Sets the entity type.


getType

public EntityType getType()
Gets the entity type.


isReadOnly

public boolean isReadOnly()
Returns true if read-only


setReadOnly

public void setReadOnly(boolean isReadOnly)
Sets true if read-only


getCacheTimeout

public long getCacheTimeout()
Returns the cache timeout.


setCacheTimeout

public void setCacheTimeout(long timeout)
Sets the cache timeout.


createColumn

public AmberColumn createColumn(java.lang.String name,
                                AmberType type)
Creates a column.


createForeignColumn

public ForeignColumn createForeignColumn(java.lang.String name,
                                         AmberColumn key)
Creates a foreign column.


addColumn

public AmberColumn addColumn(AmberColumn column)
Adds a column.


getColumns

public java.util.ArrayList<AmberColumn> getColumns()
Returns the columns.


removeColumn

public boolean removeColumn(AmberColumn column)
Remove a given column.


addIdColumn

public void addIdColumn(AmberColumn column)
Adds an id column.


getIdColumns

public java.util.ArrayList<AmberColumn> getIdColumns()
Returns the id columns.


setDependentIdLink

public void setDependentIdLink(LinkColumns link)
Sets the id link for a dependent table.


getDependentIdLink

public LinkColumns getDependentIdLink()
Gets the id link for a dependent table.


createDatabaseTable

public void createDatabaseTable(AmberPersistenceUnit amberPersistenceUnit)
                         throws ConfigException
Creates the table if missing.

Throws:
ConfigException

validateDatabaseTable

public void validateDatabaseTable(AmberPersistenceUnit amberPersistenceUnit)
                           throws ConfigException
Creates the table if missing.

Throws:
ConfigException

getInvalidateCompletion

public AmberCompletion getInvalidateCompletion()
Returns the table's invalidation.


getUpdateCompletion

public AmberCompletion getUpdateCompletion()
Returns the table's invalidation.


getDeleteCompletion

public AmberCompletion getDeleteCompletion()
Returns the table's invalidation.


addEntityListener

public void addEntityListener(EntityListener listener)
Adds a listener for create/delete events


hasListeners

public boolean hasListeners()
Returns true if there are any listeners.


isCascadeDelete

public boolean isCascadeDelete()
Returns true if any deletes of this object are cascaded.


beforeEntityDelete

public void beforeEntityDelete(AmberConnection aConn,
                               Entity entity)
Called before the entity is deleted.


error

protected ConfigException error(java.lang.String msg,
                                java.lang.Throwable e)

error

protected java.lang.RuntimeException error(java.lang.Throwable e)

toString

public java.lang.String toString()
Printable version of the entity.

Overrides:
toString in class java.lang.Object