1 package org.apache.ojb.broker; 2 3 /* Copyright 2002-2005 The Apache Software Foundation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** 19 * This interface defines a protocol for persistent objects that want to be aware 20 * of the operations of the persistence broker. It defines callback methods that 21 * allows implementors to interact with persistence operations. 22 * <br/> 23 * Non persistent objects could use the {@link PBLifeCycleListener} interface 24 * to be notified of persistence broker operations. 25 * 26 * @author Thomas Mahler 27 * @version $Id: PersistenceBrokerAware.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $ 28 */ 29 public interface PersistenceBrokerAware 30 { 31 /** 32 * Is called as the first operation before an object is updated in the underlying 33 * persistence system. 34 * 35 * @param broker The persistence broker performing the persistence operation 36 */ 37 public void beforeUpdate(PersistenceBroker broker) throws PersistenceBrokerException; 38 39 /** 40 * Is called as the last operation after an object was updated in the underlying 41 * persistence system. 42 * 43 * @param broker The persistence broker performed the persistence operation 44 */ 45 public void afterUpdate(PersistenceBroker broker) throws PersistenceBrokerException; 46 47 /** 48 * Is called as the first operation before an object is inserted into the underlying 49 * persistence system. 50 * 51 * @param broker The persistence broker performing the persistence operation 52 */ 53 public void beforeInsert(PersistenceBroker broker) throws PersistenceBrokerException; 54 55 /** 56 * Is called as the last operation after an object was inserted into the underlying 57 * persistence system. 58 * 59 * @param broker The persistence broker performing the persistence operation 60 */ 61 public void afterInsert(PersistenceBroker broker) throws PersistenceBrokerException; 62 63 /** 64 * Is called as the first operation before an object is deleted in the underlying 65 * persistence system. 66 * 67 * @param broker The persistence broker performing the persistence operation 68 */ 69 public void beforeDelete(PersistenceBroker broker) throws PersistenceBrokerException; 70 71 /** 72 * Is called as the last operation after an object was deleted in the underlying 73 * persistence system. 74 * 75 * @param broker The persistence broker performing the persistence operation 76 */ 77 public void afterDelete(PersistenceBroker broker) throws PersistenceBrokerException; 78 79 /** 80 * Is called as the last operation after an object was retrieved from the underlying 81 * persistence system via a call to the <code>getObjectByXXX()</code> or 82 * <code>getCollectionByXXX()</code>/<code>getIteratorByXXX()</code> methods in 83 * {@link PersistenceBroker}. 84 * 85 * @param broker The persistence broker performing the persistence operation 86 */ 87 public void afterLookup(PersistenceBroker broker) throws PersistenceBrokerException; 88 }