bloritsch 2002/09/04 08:24:30
Modified: infomover/src/java/org/apache/infomover/manipulator
Manipulator.java
infomover/src/java/org/apache/infomover/transaction
Transaction.java
Log:
Make changes to Transaction to allow the Manipulator to work properly
Revision Changes Path
1.3 +1 -1
jakarta-avalon-apps/infomover/src/java/org/apache/infomover/manipulator/Manipulator.java
Index: Manipulator.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/infomover/src/java/org/apache/infomover/manipulator/Manipulator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Manipulator.java 19 Aug 2002 16:49:48 -0000 1.2
+++ Manipulator.java 4 Sep 2002 15:24:29 -0000 1.3
@@ -65,5 +65,5 @@
* the <code>Manipulator</code> experiences a problem preventing it from
* doing its job, it will throw an Exception.
*/
- Transaction process(Transaction trans) throws JobException;
+ Transaction process(Transaction trans);
}
1.4 +41 -0
jakarta-avalon-apps/infomover/src/java/org/apache/infomover/transaction/Transaction.java
Index: Transaction.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/infomover/src/java/org/apache/infomover/transaction/Transaction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Transaction.java 19 Aug 2002 16:49:48 -0000 1.3
+++ Transaction.java 4 Sep 2002 15:24:30 -0000 1.4
@@ -66,6 +66,7 @@
public class Transaction
{
private List m_records;
+ private Response m_response;
/**
* Initialize a transaction
@@ -81,6 +82,7 @@
public Transaction( List initRecords )
{
m_records = initRecords;
+ m_response = new Response();
}
/**
@@ -150,5 +152,44 @@
public int numberOfRecords()
{
return m_records.size();
+ }
+
+ /**
+ */
+ public boolean isSuccessful()
+ {
+ return m_response.isSuccessful();
+ }
+
+ /**
+ * Get the response for this Transaction
+ */
+ public Response getResponse()
+ {
+ return m_response;
+ }
+
+ /**
+ * Set the response for this Transaction
+ */
+ public void setResponse( final boolean isSuccessful, final String message )
+ {
+ m_response = new Response( isSuccessful, message );
+ }
+
+ /**
+ * Set the response for this Transaction
+ */
+ public void setResponse( final String message, final Throwable cause )
+ {
+ if ( message == null && cause == null )
+ {
+ throw new NullPointerException("You must supply either a message or a
cause for failure");
+ }
+
+ m_response = new Response( (message == null) ?
+ cause.getMessage() :
+ message,
+ cause );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>