001 package org.apache.ojb.broker;
002
003 /* Copyright 2002-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 * This interface defines a protocol for persistent objects that want to be aware
020 * of the operations of the persistence broker. It defines callback methods that
021 * allows implementors to interact with persistence operations.
022 * <br/>
023 * Non persistent objects could use the {@link PBLifeCycleListener} interface
024 * to be notified of persistence broker operations.
025 *
026 * @author Thomas Mahler
027 * @version $Id: PersistenceBrokerAware.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $
028 */
029 public interface PersistenceBrokerAware
030 {
031 /**
032 * Is called as the first operation before an object is updated in the underlying
033 * persistence system.
034 *
035 * @param broker The persistence broker performing the persistence operation
036 */
037 public void beforeUpdate(PersistenceBroker broker) throws PersistenceBrokerException;
038
039 /**
040 * Is called as the last operation after an object was updated in the underlying
041 * persistence system.
042 *
043 * @param broker The persistence broker performed the persistence operation
044 */
045 public void afterUpdate(PersistenceBroker broker) throws PersistenceBrokerException;
046
047 /**
048 * Is called as the first operation before an object is inserted into the underlying
049 * persistence system.
050 *
051 * @param broker The persistence broker performing the persistence operation
052 */
053 public void beforeInsert(PersistenceBroker broker) throws PersistenceBrokerException;
054
055 /**
056 * Is called as the last operation after an object was inserted into the underlying
057 * persistence system.
058 *
059 * @param broker The persistence broker performing the persistence operation
060 */
061 public void afterInsert(PersistenceBroker broker) throws PersistenceBrokerException;
062
063 /**
064 * Is called as the first operation before an object is deleted in the underlying
065 * persistence system.
066 *
067 * @param broker The persistence broker performing the persistence operation
068 */
069 public void beforeDelete(PersistenceBroker broker) throws PersistenceBrokerException;
070
071 /**
072 * Is called as the last operation after an object was deleted in the underlying
073 * persistence system.
074 *
075 * @param broker The persistence broker performing the persistence operation
076 */
077 public void afterDelete(PersistenceBroker broker) throws PersistenceBrokerException;
078
079 /**
080 * Is called as the last operation after an object was retrieved from the underlying
081 * persistence system via a call to the <code>getObjectByXXX()</code> or
082 * <code>getCollectionByXXX()</code>/<code>getIteratorByXXX()</code> methods in
083 * {@link PersistenceBroker}.
084 *
085 * @param broker The persistence broker performing the persistence operation
086 */
087 public void afterLookup(PersistenceBroker broker) throws PersistenceBrokerException;
088 }