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 persistent object
020     * life cycle information. This interface is intended for
021     * non persistent objects which want to track persistent
022     * object life cycle.
023     * <br/>
024     * NOTE:
025     * <br/>
026     * Persistent objects should implement the {@link PersistenceBrokerAware}
027     * interface to be notified on persistent method calls via callback.
028     *
029     * @author Armin Waibel
030     * @version $Id: PBLifeCycleListener.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $
031     */
032    public interface PBLifeCycleListener extends PBListener
033    {
034        /**
035         * Called before an object will be stored by a persistence broker.
036         * 
037         * @param event The event object
038         */
039        public void beforeInsert(PBLifeCycleEvent event) throws PersistenceBrokerException;
040    
041        /**
042         * Called after an object instance has been stored by a persistence broker.
043         * 
044         * @param event The event object
045         */
046        public void afterInsert(PBLifeCycleEvent event) throws PersistenceBrokerException;
047    
048        /**
049         * Called before an object will be updated by a persistence broker.
050         * 
051         * @param event The event object
052         */
053        public void beforeUpdate(PBLifeCycleEvent event) throws PersistenceBrokerException;
054    
055        /**
056         * Called after an object has been stored by a persistence broker.
057         * 
058         * @param event The event object
059         */
060        public void afterUpdate(PBLifeCycleEvent event) throws PersistenceBrokerException;
061    
062        /**
063         * Called before an object will be deleted by a persistence broker.
064         * 
065         * @param event The event object
066         */
067        public void beforeDelete(PBLifeCycleEvent event) throws PersistenceBrokerException;
068    
069        /**
070         * Called after an object has been deleted by a persistence broker.
071         * 
072         * @param event The event object
073         */
074        public void afterDelete(PBLifeCycleEvent event) throws PersistenceBrokerException;
075    
076        /**
077         * Called after an object has been looked up by a persistence broker.
078         * 
079         * @param event The event object
080         */
081        public void afterLookup(PBLifeCycleEvent event) throws PersistenceBrokerException;
082    }