Skip to content
Snippets Groups Projects
Commit 22eff44a authored by anttil's avatar anttil
Browse files

BIS-528 / SP-881: Make it possible to return to the caller status of the...

BIS-528 / SP-881: Make it possible to return to the caller status of the ingestion service transaction commit.

SVN: 29773
parent 3620206c
No related branches found
No related tags found
No related merge requests found
...@@ -22,8 +22,7 @@ import java.io.PrintWriter; ...@@ -22,8 +22,7 @@ import java.io.PrintWriter;
import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.io.output.ByteArrayOutputStream;
/** /**
* An exception that signals to the client that an exception happened during service execution on * An exception that signals to the client that an exception happened during service execution on the server.
* the server.
* *
* @author Bernd Rinn * @author Bernd Rinn
*/ */
...@@ -37,7 +36,7 @@ public class ServiceExecutionException extends RuntimeException ...@@ -37,7 +36,7 @@ public class ServiceExecutionException extends RuntimeException
ServiceExecutionException(String serviceConversationId, String description) ServiceExecutionException(String serviceConversationId, String description)
{ {
super("Execution exception in service conversation " + serviceConversationId); super(description + "(service conversation " + serviceConversationId + ")");
this.serviceConversationId = serviceConversationId; this.serviceConversationId = serviceConversationId;
this.description = description; this.description = description;
} }
......
...@@ -94,8 +94,7 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg ...@@ -94,8 +94,7 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg
private final DssUniqueFilenameGenerator filenameGenerator; private final DssUniqueFilenameGenerator filenameGenerator;
/** /**
* Constructor for the AbstractDbModifyingAggegation service. This constructor is used by the * Constructor for the AbstractDbModifyingAggegation service. This constructor is used by the ReportingPluginTaskFactory.
* ReportingPluginTaskFactory.
* *
* @param properties * @param properties
* @param storeRoot * @param storeRoot
...@@ -149,8 +148,14 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg ...@@ -149,8 +148,14 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg
TableModel tableModel = process(transaction, parameters, context); TableModel tableModel = process(transaction, parameters, context);
service.commit(); service.commit();
if (service.encounteredErrors.size() > 0)
{
throw service.encounteredErrors.get(0);
}
return tableModel; return tableModel;
} catch (Exception e) } catch (Throwable e)
{ {
logInvocationError(parameters, e); logInvocationError(parameters, e);
return errorTableModel(parameters, e); return errorTableModel(parameters, e);
...@@ -191,8 +196,8 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg ...@@ -191,8 +196,8 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg
} }
/** /**
* Directory used for the fake incoming files used by the infrastructure. These fake files are * Directory used for the fake incoming files used by the infrastructure. These fake files are necessary because much of the infrastructure
* necessary because much of the infrastructure assumes the existance of a file in a dropbox. * assumes the existance of a file in a dropbox.
*/ */
protected File getMockIncomingDir() protected File getMockIncomingDir()
{ {
...@@ -375,7 +380,7 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg ...@@ -375,7 +380,7 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg
return false; return false;
} }
protected TableModel errorTableModel(Map<String, Object> parameters, Exception e) protected TableModel errorTableModel(Map<String, Object> parameters, Throwable e)
{ {
SimpleTableModelBuilder builder = new SimpleTableModelBuilder(true); SimpleTableModelBuilder builder = new SimpleTableModelBuilder(true);
builder.addHeader("Parameters"); builder.addHeader("Parameters");
...@@ -386,7 +391,7 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg ...@@ -386,7 +391,7 @@ public abstract class IngestionService<T extends DataSetInformation> extends Agg
return builder.getTableModel(); return builder.getTableModel();
} }
protected void logInvocationError(Map<String, Object> parameters, Exception e) protected void logInvocationError(Map<String, Object> parameters, Throwable e)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Error producing aggregation report\n"); sb.append("Error producing aggregation report\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment