Allow RepositoryUnit and RepositoryListenerUnit to throw any exception.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2003 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2006-12-20 23:28:01 +00:00
parent bad40f8a0b
commit 5468794fed
2 changed files with 15 additions and 19 deletions
@@ -22,14 +22,13 @@ import com.samskivert.io.PersistenceException;
import com.samskivert.util.ResultListener; import com.samskivert.util.ResultListener;
/** /**
* Extends the {@link RepositoryUnit} and integrates with a {@link * Extends the {@link RepositoryUnit} and integrates with a {@link ResultListener}.
* ResultListener}.
*/ */
public abstract class RepositoryListenerUnit<T> extends RepositoryUnit public abstract class RepositoryListenerUnit<T> extends RepositoryUnit
{ {
/** /**
* Creates a repository listener unit that will report its results to the * Creates a repository listener unit that will report its results to the supplied result
* supplied result listener. * listener.
*/ */
public RepositoryListenerUnit (ResultListener<T> listener) public RepositoryListenerUnit (ResultListener<T> listener)
{ {
@@ -37,9 +36,8 @@ public abstract class RepositoryListenerUnit<T> extends RepositoryUnit
} }
/** /**
* Creates a repository listener unit that will report its results to the * Creates a repository listener unit that will report its results to the supplied result
* supplied result listener and report the supplied name in * listener and report the supplied name in {@link #toString}.
* {@link #toString}.
*/ */
public RepositoryListenerUnit (String name, ResultListener<T> listener) public RepositoryListenerUnit (String name, ResultListener<T> listener)
{ {
@@ -51,11 +49,11 @@ public abstract class RepositoryListenerUnit<T> extends RepositoryUnit
* Called to perform our persistent action and generate our result. * Called to perform our persistent action and generate our result.
*/ */
public abstract T invokePersistResult () public abstract T invokePersistResult ()
throws PersistenceException; throws Exception;
@Override // from RepositoryUnit @Override // from RepositoryUnit
public void invokePersist () public void invokePersist ()
throws PersistenceException throws Exception
{ {
_result = invokePersistResult(); _result = invokePersistResult();
} }
@@ -22,8 +22,8 @@ import com.samskivert.io.PersistenceException;
import com.samskivert.util.Invoker; import com.samskivert.util.Invoker;
/** /**
* Extends the {@link com.samskivert.util.Invoker.Unit} and specializes it for * Extends the {@link com.samskivert.util.Invoker.Unit} and specializes it for doing database
* doing database repository manipulation. * repository manipulation.
*/ */
public abstract class RepositoryUnit extends Invoker.Unit public abstract class RepositoryUnit extends Invoker.Unit
{ {
@@ -33,8 +33,7 @@ public abstract class RepositoryUnit extends Invoker.Unit
} }
/** /**
* Create a RepositoryUnit which will report the supplied name * Create a RepositoryUnit which will report the supplied name in {@link #toString}.
* in {@link #toString}.
*/ */
public RepositoryUnit (String name) public RepositoryUnit (String name)
{ {
@@ -66,18 +65,17 @@ public abstract class RepositoryUnit extends Invoker.Unit
* Called to perform our persistent actions. * Called to perform our persistent actions.
*/ */
public abstract void invokePersist () public abstract void invokePersist ()
throws PersistenceException; throws Exception;
/** /**
* Called if our persistent actions have succeeded, back on the non-invoker * Called if our persistent actions have succeeded, back on the non-invoker thread.
* thread.
*/ */
public abstract void handleSuccess (); public abstract void handleSuccess ();
/** /**
* Called if our persistent actions failed, back on the non-invoker thread. * Called if our persistent actions failed, back on the non-invoker thread. Note that this may
* Note that this may be either a {@link PersistenceException} thrown by * be either an {@link Exception} thrown by {@link #invokePersist} or a {@link
* {@link #invokePersist} or a {@link RuntimeException} thrown by same. * RuntimeException} thrown by same.
*/ */
public abstract void handleFailure (Exception pe); public abstract void handleFailure (Exception pe);