001    package org.apache.ojb.broker;
002    
003    /* Copyright 2003-2005 The Apache Software Foundation
004     *
005     * Licensed under the Apache License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    /**
019     * The listener interface for receiving <code>PersistenceBroker</code>
020     * state changes.
021     *
022     * @author Armin Waibel
023     * @version $Id: PBStateListener.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $
024     */
025    public interface PBStateListener extends PBListener
026    {
027        /**
028         * Called after the {@link org.apache.ojb.broker.PersistenceBroker} instance was
029         * obtained from the pool.
030         * 
031         * @param event The event object
032         */
033        public void afterOpen(PBStateEvent event);
034    
035        /**
036         * Called before a transaction was started.
037         * 
038         * @param event The event object
039         */
040        public void beforeBegin(PBStateEvent event);
041    
042        /**
043         * Called after a transaction was started.
044         * 
045         * @param event The event object
046         */
047        public void afterBegin(PBStateEvent event);
048    
049        /**
050         * Called before a transaction will be comitted.
051         * 
052         * @param event The event object
053         */
054        public void beforeCommit(PBStateEvent event);
055    
056        /**
057         * Called after a transaction was comitted.
058         * 
059         * @param event The event object
060         */
061        public void afterCommit(PBStateEvent event);
062    
063        /**
064         * Called before a transaction will be rolled back.
065         * 
066         * @param event The event object
067         */
068        public void beforeRollback(PBStateEvent event);
069    
070        /**
071         * Called after a transaction was rolled back.
072         * 
073         * @param event The event object
074         */
075        public void afterRollback(PBStateEvent event);
076    
077        /**
078         * Called before the {@link org.apache.ojb.broker.PersistenceBroker}
079         * instance will be returned to the pool.
080         * 
081         * @param event The event object
082         */
083        public void beforeClose(PBStateEvent event);
084    }