1 package org.apache.torque.betwixt;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 /***
20 * Interface that all record handlers called by the Importer class should
21 * impliment.
22 * <p>
23 *
24 * Note that to allow for import transactions to be rolled back,
25 * implementors should use the Importer.getConnection() method
26 * when any DB save, update, or delete actions are performed.
27 * <p>
28 *
29 * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
30 */
31 public interface RecordHandler extends Cloneable
32 {
33
34 /***
35 * Handles both creating new record or updating existing record.
36 * <p>
37 *
38 * Implementors need to report any error or success back via the
39 * dispatcher's notifyListeners method.
40 * <p>
41 *
42 * @param record The record object to process.
43 * @param dispatcher The object to get connection, event listener info,
44 * and the like from.
45 * @throws Exception
46 */
47 public void addUpdateRecord( Object record, Importer dispatcher )
48 throws Exception;
49
50 /***
51 * Handles deleting records.
52 * <p>
53 *
54 * Implementors need to report any error or success back via the
55 * dispatcher's notifyListeners method.
56 * <p>
57 *
58 * @param record The record object to process.
59 * @param dispatcher The object to get connection, event listener info,
60 * and the like from.
61 * @throws Exception
62 */
63 public void deleteRecord( Object record, Importer dispatcher )
64 throws Exception;
65
66 /***
67 * RecordHandlers need to be cloneable so the dispatcher can clone
68 * handlers as needed.
69 *
70 * @return
71 * @throws CloneNotSupportedException
72 */
73 public Object clone() throws CloneNotSupportedException;
74
75 }