01: package com.sun.portal.app.filesharing.util;
02:
03: import com.sun.portal.app.filesharing.repo.RepoException;
04:
05: import java.sql.Connection;
06: import java.sql.SQLException;
07:
08: /**
09: * Command pattern for executing SQL commands
10: * <p>
11: * The run() method is invoked by the SQLExecutor within its execute() method.
12: * <p>
13: * A live JDBC connection is given to the run() method, this connection should not be closed.
14: * <p>
15: * @author Alejandro Abdelnur
16: *
17: */
18: public interface SQLTask {
19:
20: /**
21: * Implements the JDBC connection dependent task.
22: * <p>
23: * The SQLExecutor invokes this method with a live connection.
24: * <p>
25: * Do not close the connection, the connection will
26: * be recycled by the SQLExecutor.
27: * <p>
28: * If using a transaction and the transaction is not committed
29: * within the run() method, the transaction will be rolled back by
30: * the SQLExecutor.
31: * <p>
32: * @param conn a live JDBC connection from the SQLExecutor invoking the SQLTask.
33: * @throws SQLException thrown if the SQLTask JDBC operations failed.
34: *
35: */
36: public void run(Connection conn) throws SQLException, RepoException;
37:
38: }
|