IBM WebSphere Application ServerTM
Release 7

com.ibm.websphere.sdo.mediator.ejb
Interface MediatorAdapter


public interface MediatorAdapter

Implemented by a user class to customize the processing of graph changes. The adapter can be used in situations when there are create methods other than create(PrimaryKey) or when business methods must be called instead of cmp setter methods or when special optimistic caching logic is needed.

Three passes are made over DataGraph Log passing changed DataObjects to the applyChange method.

In pass 1 new DataObjects are passed. Adapter should create the EJB instance and set the cmp fields. CMRs that reference EJBs that have not been created yet must be deferred to pass 2.

In pass 2 new and updated DataObjects are passed. CMRs deferred from pass 1 can be set at this time.

In pass 3 deleted DataObjects are passed.

Adapter return true if it has processed the change and return false to have the mediator process the change.


Field Summary
static int CREATE
          Pass 1 to handle creation of new EJBs.
static int REMOVE
          Pass 3 to handle EJB removal.
static int UPDATE
          Pass 2 to handle update of cmp fields and ejb relationships.
 
Method Summary
 boolean applyChange(commonj.sdo.DataObject object, int phase)
          A changed DataObject is passed to the adapter.
 void end()
          Called after pass 3 to clean up any resources.
 void init(commonj.sdo.ChangeSummary log)
          Called before pass 1 to allow adapter class to initialize itself.
 

Field Detail

CREATE

static final int CREATE
Pass 1 to handle creation of new EJBs.

See Also:
Constant Field Values

UPDATE

static final int UPDATE
Pass 2 to handle update of cmp fields and ejb relationships.

See Also:
Constant Field Values

REMOVE

static final int REMOVE
Pass 3 to handle EJB removal.

See Also:
Constant Field Values
Method Detail

applyChange

boolean applyChange(commonj.sdo.DataObject object,
                    int phase)
                    throws QueryException
A changed DataObject is passed to the adapter.

Parameters:
object - The changed DataObject from the graph log.
phase - Processing phase.
Returns:
True if adapter has handled the changed object, false if the mediator should process the change.
Throws:
QueryException - The adapter throwing an excption will cause the mediator to abort processing.

end

void end()
Called after pass 3 to clean up any resources.


init

void init(commonj.sdo.ChangeSummary log)
Called before pass 1 to allow adapter class to initialize itself.

Parameters:
log - The graph log.

IBM WebSphere Application ServerTM
Release 7