dbXML API

## com.dbxml.db.core.trigger
Interface Trigger

All Superinterfaces:
  Configurable

All Known Implementing Classes:
  SimpleTrigger

public interface Trigger
extends Configurable

Trigger represents a dbXML trigger. Triggers are class implementations that are capable of responding to Collection level events. Triggerrs are a fairly low level interface, and use Object instances to represent the data that is being reported. Depending on the type of Collection that is being monitored, the actual type of Object will be a DocumentTable (for Document collections) or a byte array (for Binary collections).

Method Summary
`void` `afterDelete(Transaction tx, Key key, java.lang.Object oldObj)` afterDelete is fired after a Object is deleted from the Collection.
`void` `afterGet(Transaction tx, Key key, java.lang.Object obj)` afterGet is fired after a Object is retrieved from the Collection, but before it is actually returned.
`void` `afterInsert(Transaction tx, Key key, java.lang.Object newObj)` afterInsert is fired after a new Object is inserted into the Collection.
`void` `afterUpdate(Transaction tx, Key key, java.lang.Object oldObj, java.lang.Object newObj)` afterUpdate is fired after a Object is updated in the Collection.
`void` `beforeDelete(Transaction tx, Key key, java.lang.Object oldObj)` beforeDelete is fired before a Object is deleted from the Collection.
`void` `beforeGet(Transaction tx, Key key)` beforeGet is fired before a Object is retrieved from the Collection.
`java.lang.Object` `beforeInsert(Transaction tx, Key key, java.lang.Object newObj)` beforeInsert is fired before a new Object is inserted into the Collection.
`java.lang.Object` `beforeUpdate(Transaction tx, Key key, java.lang.Object oldObj, java.lang.Object newObj)` beforeUpdate is fired before a Object is updated in the Collection.
`Collection` `getCollection()` getCollection returns the Collection context for this Trigger.
`java.lang.String` `getName()` getName returns the name of this Trigger.
`void` `setCollection(Collection collection)` setCollection sets the Collection context for this Trigger.

Methods inherited from interface com.dbxml.util.Configurable
`getConfig, setConfig`

Method Detail

### getName

    public java.lang.String getName()

  getName returns the name of this Trigger.

  Returns:
    the Trigger name

### setCollection

    public void setCollection(Collection collection)

  setCollection sets the Collection context for this Trigger.

  Parameters:
    `collection` - The Collection

### getCollection

    public Collection getCollection()

  getCollection returns the Collection context for this Trigger.

  Returns:
    The Collection

### beforeInsert

    public java.lang.Object beforeInsert(Transaction tx,
                                         Key key,
                                         java.lang.Object newObj)
                                  throws DBException

  beforeInsert is fired before a new Object is inserted into the Collection. Throw a CancelOperationException to cancel the Object insertion.

  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `newObj` - The new Object
  Returns:
    The modified or original new Object
  Throws:
    `DBException`

### afterInsert

    public void afterInsert(Transaction tx,
                            Key key,
                            java.lang.Object newObj)
                     throws DBException

  afterInsert is fired after a new Object is inserted into the Collection.

  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `newObj` - The new Object
  Throws:
    `DBException`

### beforeUpdate

    public java.lang.Object beforeUpdate(Transaction tx,
                                         Key key,
                                         java.lang.Object oldObj,
                                         java.lang.Object newObj)
                                  throws DBException

  beforeUpdate is fired before a Object is updated in the Collection. Throw a CancelOperationException to cancel the Object update.

  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `oldObj` - The old Object
    `newObj` - The new Object
  Returns:
    The modified or original new Object
  Throws:
    `DBException`

### afterUpdate

    public void afterUpdate(Transaction tx,
                            Key key,
                            java.lang.Object oldObj,
                            java.lang.Object newObj)
                     throws DBException

  afterUpdate is fired after a Object is updated in the Collection.

  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `oldObj` - The old Object
    `newObj` - The new Object
  Throws:
    `DBException`

### beforeDelete

    public void beforeDelete(Transaction tx,
                             Key key,
                             java.lang.Object oldObj)
                      throws DBException

  beforeDelete is fired before a Object is deleted from the Collection. Throw a CancelOperationException to cancel the delete operation.

  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `oldObj` - The Object to be deleted
  Throws:
    `DBException`

### afterDelete

    public void afterDelete(Transaction tx,
                            Key key,
                            java.lang.Object oldObj)
                     throws DBException

  afterDelete is fired after a Object is deleted from the Collection.

  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `oldObj` - The Object that was deleted
  Throws:
    `DBException`

### beforeGet

    public void beforeGet(Transaction tx,
                          Key key)
                   throws DBException

  beforeGet is fired before a Object is retrieved from the Collection. At this point, the Object hasn't even been loaded, so there is no reference to the actual Object Node.

  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
  Throws:
    `DBException`

### afterGet

    public void afterGet(Transaction tx,
                         Key key,
                         java.lang.Object obj)
                  throws DBException

  afterGet is fired after a Object is retrieved from the Collection, but before it is actually returned.

  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
  Throws:
    `DBException`

dbXML API

Copyright (c) 2004 The dbXML Group