01: package org.apache.ojb.broker;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * 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.7.2.2 2005/12/22 21:14:30 tomdz Exp $
28: */
29: public interface PersistenceBrokerAware {
30: /**
31: * Is called as the first operation before an object is updated in the underlying
32: * persistence system.
33: *
34: * @param broker The persistence broker performing the persistence operation
35: */
36: public void beforeUpdate(PersistenceBroker broker)
37: 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)
46: throws PersistenceBrokerException;
47:
48: /**
49: * Is called as the first operation before an object is inserted into the underlying
50: * persistence system.
51: *
52: * @param broker The persistence broker performing the persistence operation
53: */
54: public void beforeInsert(PersistenceBroker broker)
55: throws PersistenceBrokerException;
56:
57: /**
58: * Is called as the last operation after an object was inserted into the underlying
59: * persistence system.
60: *
61: * @param broker The persistence broker performing the persistence operation
62: */
63: public void afterInsert(PersistenceBroker broker)
64: throws PersistenceBrokerException;
65:
66: /**
67: * Is called as the first operation before an object is deleted in the underlying
68: * persistence system.
69: *
70: * @param broker The persistence broker performing the persistence operation
71: */
72: public void beforeDelete(PersistenceBroker broker)
73: throws PersistenceBrokerException;
74:
75: /**
76: * Is called as the last operation after an object was deleted in the underlying
77: * persistence system.
78: *
79: * @param broker The persistence broker performing the persistence operation
80: */
81: public void afterDelete(PersistenceBroker broker)
82: throws PersistenceBrokerException;
83:
84: /**
85: * Is called as the last operation after an object was retrieved from the underlying
86: * persistence system via a call to the <code>getObjectByXXX()</code> or
87: * <code>getCollectionByXXX()</code>/<code>getIteratorByXXX()</code> methods in
88: * {@link PersistenceBroker}.
89: *
90: * @param broker The persistence broker performing the persistence operation
91: */
92: public void afterLookup(PersistenceBroker broker)
93: throws PersistenceBrokerException;
94: }
|