org.axiondb.constraints
Class BaseConstraint

java.lang.Object
  extended by org.axiondb.constraints.BaseConstraint
All Implemented Interfaces:
Serializable, Constraint
Direct Known Subclasses:
BaseSelectableBasedConstraint, CheckConstraint, ForeignKeyConstraint

public abstract class BaseConstraint
extends Object
implements Constraint

Abstract base Constraint implementation.

Version:
$Revision: 1.16 $ $Date: 2005/12/20 18:32:46 $
See Also:
Serialized Form

Constructor Summary
BaseConstraint(String name, String type)
          Creates a Constraint with the given name and type.
 
Method Summary
abstract  boolean evaluate(RowEvent event)
          Evaluate the given event under me.
 String getName()
          Get my name.
 String getType()
          Get a human-readable descrption of the type of constraint I represent.
 boolean isDeferrable()
          Return whether or not I am deferrable.
 boolean isDeferred()
          Return whether or not I am deferred.
 void resolve(Database db, TableIdentifier table)
          This base implementation is a no-op.
 void setDeferrable(boolean deferrable)
          Set whether or not I am deferrable.
 void setDeferred(boolean deferred)
          Set whether or not I am deferred.
 void setName(String name)
          Sets the name of this constraint.
protected  TableIdentifier[] toArray(TableIdentifier table)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.axiondb.Constraint
evaluate, evaluate
 

Constructor Detail

BaseConstraint

public BaseConstraint(String name,
                      String type)
Creates a Constraint with the given name and type.

Parameters:
name - the name of this constraint (see setName(java.lang.String)) which may be null
type - the type of this constraint (see getType()), which should not be null
Method Detail

evaluate

public abstract boolean evaluate(RowEvent event)
                          throws AxionException
Description copied from interface: Constraint
Evaluate the given event under me. Returns false if the constraint I represent has been violated.

Specified by:
evaluate in interface Constraint
Throws:
AxionException

resolve

public void resolve(Database db,
                    TableIdentifier table)
             throws AxionException
This base implementation is a no-op.

Specified by:
resolve in interface Constraint
Throws:
AxionException

getName

public String getName()
Description copied from interface: Constraint
Get my name.

Specified by:
getName in interface Constraint

setName

public void setName(String name)
Sets the name of this constraint. When name is null a unique name is programatically generated.

Specified by:
setName in interface Constraint

getType

public String getType()
Description copied from interface: Constraint
Get a human-readable descrption of the type of constraint I represent.

Specified by:
getType in interface Constraint

isDeferred

public boolean isDeferred()
Description copied from interface: Constraint
Return whether or not I am deferred. Deferred constraints are not evaluated until the transaction is committed.

Specified by:
isDeferred in interface Constraint

setDeferred

public void setDeferred(boolean deferred)
                 throws AxionException
Description copied from interface: Constraint
Set whether or not I am deferred. Deferred constraints are not evaluated until the transaction is committed. Throws an exception if I am not deferrableand deferred is true.

Specified by:
setDeferred in interface Constraint
Throws:
AxionException

isDeferrable

public boolean isDeferrable()
Description copied from interface: Constraint
Return whether or not I am deferrable.

Specified by:
isDeferrable in interface Constraint

setDeferrable

public void setDeferrable(boolean deferrable)
Description copied from interface: Constraint
Set whether or not I am deferrable.

Specified by:
setDeferrable in interface Constraint

toArray

protected TableIdentifier[] toArray(TableIdentifier table)