org.apache.ojb.broker.core
Class PersistenceBrokerAbstractImpl

java.lang.Object
  extended byorg.apache.ojb.broker.core.PersistenceBrokerAbstractImpl
All Implemented Interfaces:
Configurable, ObjectContainer, PersistenceBroker
Direct Known Subclasses:
PersistenceBrokerImpl

public abstract class PersistenceBrokerAbstractImpl
extends java.lang.Object
implements PersistenceBroker

Abstract Implementation of the PersistenceBroker encapsulating the used PB-event/listener concept.

Version:
$Id: PersistenceBrokerAbstractImpl.java,v 1.4 2003/08/11 22:54:51 arminw Exp $
Author:
Created by Charles on 12-Sep-2002 08:04:47, Armin Waibel
See Also:
PersistenceBroker, PBLifeCycleListener, PersistenceBrokerAware, PBStateListener

Field Summary
protected  PBStateEvent AFTER_BEGIN_EVENT
           
protected  PBStateEvent AFTER_COMMIT_EVENT
           
protected  PBLifeCycleEvent AFTER_DELETE_EVENT
           
protected  PBLifeCycleEvent AFTER_LOOKUP_EVENT
           
protected  PBStateEvent AFTER_OPEN_EVENT
           
protected  PBStateEvent AFTER_ROLLBACK_EVENT
           
protected  PBLifeCycleEvent AFTER_STORE_EVENT
           
protected  PBLifeCycleEvent AFTER_UPDATE_EVENT
           
protected  PBStateEvent BEFORE_BEGIN_EVENT
           
protected  PBStateEvent BEFORE_CLOSE_EVENT
           
protected  PBStateEvent BEFORE_COMMIT_EVENT
           
protected  PBLifeCycleEvent BEFORE_DELETE_EVENT
           
protected  PBStateEvent BEFORE_ROLLBACK_EVENT
           
protected  PBLifeCycleEvent BEFORE_STORE_EVENT
           
protected  PBLifeCycleEvent BEFORE_UPDATE_EVENT
           
 
Constructor Summary
PersistenceBrokerAbstractImpl()
           
 
Method Summary
 void addListener(PBListener listener)
          Adds a temporary PBListener to this PersistenceBroker instance - when PersistenceBroker.close() was called the listener was removed.
 void addListener(PBListener listener, boolean permanent)
          Adds a permanent PBListener to this PersistenceBroker instance if parameter permanent was true.
 void configure(Configuration pConfig)
          Override if needed.
protected  boolean contains(PBListener[] listeners, PBListener listener)
           
 void fireBrokerEvent(PBLifeCycleEvent event)
          Performs a broker event to inform all managed PBListener implementations.
 void fireBrokerEvent(PBStateEvent event)
          Performs a broker event to inform all managed PBListener implementations.
 void fireBrokerEvent(PersistenceBrokerEvent event)
          Performs a broker event to inform all managed PBListener implementations.
 void removeAllListeners()
          Removes all temporary listeners from this PersistenceBroker instance - Handle with care!
 void removeAllListeners(boolean permanent)
          If parameter permanet was true all permanent and temporary listeners will be removed from this PersistenceBroker instance.
 void removeListener(PBListener listener)
          Removes a listener from this PersistenceBroker instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ojb.broker.PersistenceBroker
abortTransaction, addMtoNImplementor, beginTransaction, clearCache, close, commitTransaction, delete, deleteByQuery, deleteMtoNImplementor, getClassDescriptor, getCollectionByQuery, getCollectionByQuery, getCount, getDescriptorRepository, getIteratorByQuery, getObjectByIdentity, getObjectByQuery, getPBKey, getPKEnumerationByQuery, getReportQueryIteratorByQuery, getTopLevelClass, hasClassDescriptor, isClosed, isInTransaction, removeFromCache, retrieveAllReferences, retrieveReference, serviceBrokerHelper, serviceConnectionManager, serviceJdbcAccess, serviceObjectCache, serviceSequenceManager, serviceSqlGenerator, serviceStatementManager, store, store
 
Methods inherited from interface org.odbms.ObjectContainer
query
 

Field Detail

AFTER_OPEN_EVENT

protected final PBStateEvent AFTER_OPEN_EVENT

AFTER_BEGIN_EVENT

protected final PBStateEvent AFTER_BEGIN_EVENT

AFTER_COMMIT_EVENT

protected final PBStateEvent AFTER_COMMIT_EVENT

AFTER_ROLLBACK_EVENT

protected final PBStateEvent AFTER_ROLLBACK_EVENT

BEFORE_BEGIN_EVENT

protected final PBStateEvent BEFORE_BEGIN_EVENT

BEFORE_COMMIT_EVENT

protected final PBStateEvent BEFORE_COMMIT_EVENT

BEFORE_ROLLBACK_EVENT

protected final PBStateEvent BEFORE_ROLLBACK_EVENT

BEFORE_CLOSE_EVENT

protected final PBStateEvent BEFORE_CLOSE_EVENT

BEFORE_STORE_EVENT

protected PBLifeCycleEvent BEFORE_STORE_EVENT

AFTER_STORE_EVENT

protected PBLifeCycleEvent AFTER_STORE_EVENT

BEFORE_DELETE_EVENT

protected PBLifeCycleEvent BEFORE_DELETE_EVENT

AFTER_DELETE_EVENT

protected PBLifeCycleEvent AFTER_DELETE_EVENT

AFTER_LOOKUP_EVENT

protected PBLifeCycleEvent AFTER_LOOKUP_EVENT

BEFORE_UPDATE_EVENT

protected PBLifeCycleEvent BEFORE_UPDATE_EVENT

AFTER_UPDATE_EVENT

protected PBLifeCycleEvent AFTER_UPDATE_EVENT
Constructor Detail

PersistenceBrokerAbstractImpl

public PersistenceBrokerAbstractImpl()
Method Detail

configure

public void configure(Configuration pConfig)
               throws ConfigurationException
Override if needed.

Specified by:
configure in interface Configurable
Parameters:
pConfig - the Configuration object used to configure current instance
Throws:
ConfigurationException
See Also:
Configurable.configure(Configuration)

addListener

public void addListener(PBListener listener)
                 throws PersistenceBrokerException
Description copied from interface: PersistenceBroker
Adds a temporary PBListener to this PersistenceBroker instance - when PersistenceBroker.close() was called the listener was removed.

Specified by:
addListener in interface PersistenceBroker
Parameters:
listener - The listener to add
Throws:
PersistenceBrokerException
See Also:
PersistenceBroker.addListener(PBListener listener)

addListener

public void addListener(PBListener listener,
                        boolean permanent)
                 throws PersistenceBrokerException
Description copied from interface: PersistenceBroker
Adds a permanent PBListener to this PersistenceBroker instance if parameter permanent was true. This means the listener will be hold the whole life time of the broker.
NOTE: Handle carefully when using this method, keep in mind you don't know which instance was returned next time from the pool, with a permanent listener or without! To garantee that any pooled broker instance use the permanent listener, best way is to implement your own PersistenceBrokerFactoryIF or extend the default implementation PersistenceBrokerFactoryDefaultImpl and add the listener at creation of the PersistenceBroker instances.

Specified by:
addListener in interface PersistenceBroker
Throws:
PersistenceBrokerException
See Also:
PersistenceBroker.addListener(PBListener listener, boolean permanent)

removeListener

public void removeListener(PBListener listener)
                    throws PersistenceBrokerException
Description copied from interface: PersistenceBroker
Removes a listener from this PersistenceBroker instance

Specified by:
removeListener in interface PersistenceBroker
Parameters:
listener -
Throws:
PersistenceBrokerException
See Also:
PersistenceBroker.removeListener(PBListener listener)

contains

protected boolean contains(PBListener[] listeners,
                           PBListener listener)

removeAllListeners

public void removeAllListeners(boolean permanent)
                        throws PersistenceBrokerException
Description copied from interface: PersistenceBroker
If parameter permanet was true all permanent and temporary listeners will be removed from this PersistenceBroker instance.
NOTE: Handle with care!

Specified by:
removeAllListeners in interface PersistenceBroker
Throws:
PersistenceBrokerException
See Also:
PersistenceBroker.removeAllListeners(boolean)

removeAllListeners

public void removeAllListeners()
                        throws PersistenceBrokerException
Description copied from interface: PersistenceBroker
Removes all temporary listeners from this PersistenceBroker instance - Handle with care!

Specified by:
removeAllListeners in interface PersistenceBroker
Throws:
PersistenceBrokerException
See Also:
PersistenceBroker.removeAllListeners()

fireBrokerEvent

public void fireBrokerEvent(PersistenceBrokerEvent event)
Description copied from interface: PersistenceBroker
Performs a broker event to inform all managed PBListener implementations.

Specified by:
fireBrokerEvent in interface PersistenceBroker

fireBrokerEvent

public void fireBrokerEvent(PBLifeCycleEvent event)
Description copied from interface: PersistenceBroker
Performs a broker event to inform all managed PBListener implementations.

Specified by:
fireBrokerEvent in interface PersistenceBroker

fireBrokerEvent

public void fireBrokerEvent(PBStateEvent event)
Description copied from interface: PersistenceBroker
Performs a broker event to inform all managed PBListener implementations.

Specified by:
fireBrokerEvent in interface PersistenceBroker


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14