org.apache.ojb.broker.core
Class PersistenceBrokerAbstractImpl

java.lang.Object
  extended byorg.apache.ojb.broker.core.PersistenceBrokerAbstractImpl
All Implemented Interfaces:
org.apache.ojb.broker.util.configuration.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

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(org.apache.ojb.broker.util.configuration.Configuration pConfig)
          Override if needed.
 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
equals, 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
 

Constructor Detail

PersistenceBrokerAbstractImpl

public PersistenceBrokerAbstractImpl()
Method Detail

configure

public void configure(org.apache.ojb.broker.util.configuration.Configuration pConfig)
               throws org.apache.ojb.broker.util.configuration.ConfigurationException
Override if needed.

Specified by:
configure in interface org.apache.ojb.broker.util.configuration.Configurable
Throws:
org.apache.ojb.broker.util.configuration.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)

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