@@ -89,30 +89,34 @@ public final class AutoIngestJob implements Comparable<AutoIngestJob>, Serializa
8989 *
9090 * @param manifest The manifest for an automated ingest job.
9191 */
92- AutoIngestJob (Manifest manifest ) {
93- /*
94- * Version 0 fields.
95- */
96- this .manifest = manifest ;
97- this .nodeName = "" ;
98- this .caseDirectoryPath = "" ;
99- this .priority = DEFAULT_PRIORITY ;
100- this .stage = Stage .PENDING ;
101- this .stageStartDate = manifest .getDateFileCreated ();
102- this .dataSourceProcessor = null ;
103- this .ingestJob = null ;
104- this .cancelled = false ;
105- this .completed = false ;
106- this .completedDate = new Date (0 );
107- this .errorsOccurred = false ;
108-
109- /*
110- * Version 1 fields.
111- */
112- this .version = CURRENT_VERSION ;
113- this .processingStatus = ProcessingStatus .PENDING ;
114- this .numberOfCrashes = 0 ;
115- this .stageDetails = this .getProcessingStageDetails ();
92+ AutoIngestJob (Manifest manifest ) throws AutoIngestJobException {
93+ try {
94+ /*
95+ * Version 0 fields.
96+ */
97+ this .manifest = manifest ;
98+ this .nodeName = "" ;
99+ this .caseDirectoryPath = "" ;
100+ this .priority = DEFAULT_PRIORITY ;
101+ this .stage = Stage .PENDING ;
102+ this .stageStartDate = manifest .getDateFileCreated ();
103+ this .dataSourceProcessor = null ;
104+ this .ingestJob = null ;
105+ this .cancelled = false ;
106+ this .completed = false ;
107+ this .completedDate = new Date (0 );
108+ this .errorsOccurred = false ;
109+
110+ /*
111+ * Version 1 fields.
112+ */
113+ this .version = CURRENT_VERSION ;
114+ this .processingStatus = ProcessingStatus .PENDING ;
115+ this .numberOfCrashes = 0 ;
116+ this .stageDetails = this .getProcessingStageDetails ();
117+ } catch (Exception ex ) {
118+ throw new AutoIngestJobException (String .format ("Error creating automated ingest job" ), ex );
119+ }
116120 }
117121
118122 /**
@@ -122,30 +126,34 @@ public final class AutoIngestJob implements Comparable<AutoIngestJob>, Serializa
122126 * @param nodeData The coordination service node data for an automated
123127 * ingest job.
124128 */
125- AutoIngestJob (AutoIngestJobNodeData nodeData ) {
126- /*
127- * Version 0 fields.
128- */
129- this .manifest = new Manifest (nodeData .getManifestFilePath (), nodeData .getManifestFileDate (), nodeData .getCaseName (), nodeData .getDeviceId (), nodeData .getDataSourcePath (), Collections .emptyMap ());
130- this .nodeName = nodeData .getProcessingHostName ();
131- this .caseDirectoryPath = nodeData .getCaseDirectoryPath ().toString ();
132- this .priority = nodeData .getPriority ();
133- this .stage = nodeData .getProcessingStage ();
134- this .stageStartDate = nodeData .getProcessingStageStartDate ();
135- this .dataSourceProcessor = null ; // Transient data not in node data.
136- this .ingestJob = null ; // Transient data not in node data.
137- this .cancelled = false ; // Transient data not in node data.
138- this .completed = false ; // Transient data not in node data.
139- this .completedDate = nodeData .getCompletedDate ();
140- this .errorsOccurred = nodeData .getErrorsOccurred ();
141-
142- /*
143- * Version 1 fields.
144- */
145- this .version = CURRENT_VERSION ;
146- this .processingStatus = nodeData .getProcessingStatus ();
147- this .numberOfCrashes = nodeData .getNumberOfCrashes ();
148- this .stageDetails = this .getProcessingStageDetails ();
129+ AutoIngestJob (AutoIngestJobNodeData nodeData ) throws AutoIngestJobException {
130+ try {
131+ /*
132+ * Version 0 fields.
133+ */
134+ this .manifest = new Manifest (nodeData .getManifestFilePath (), nodeData .getManifestFileDate (), nodeData .getCaseName (), nodeData .getDeviceId (), nodeData .getDataSourcePath (), Collections .emptyMap ());
135+ this .nodeName = nodeData .getProcessingHostName ();
136+ this .caseDirectoryPath = nodeData .getCaseDirectoryPath ().toString ();
137+ this .priority = nodeData .getPriority ();
138+ this .stage = nodeData .getProcessingStage ();
139+ this .stageStartDate = nodeData .getProcessingStageStartDate ();
140+ this .dataSourceProcessor = null ; // Transient data not in node data.
141+ this .ingestJob = null ; // Transient data not in node data.
142+ this .cancelled = false ; // Transient data not in node data.
143+ this .completed = false ; // Transient data not in node data.
144+ this .completedDate = nodeData .getCompletedDate ();
145+ this .errorsOccurred = nodeData .getErrorsOccurred ();
146+
147+ /*
148+ * Version 1 fields.
149+ */
150+ this .version = CURRENT_VERSION ;
151+ this .processingStatus = nodeData .getProcessingStatus ();
152+ this .numberOfCrashes = nodeData .getNumberOfCrashes ();
153+ this .stageDetails = this .getProcessingStageDetails ();
154+ } catch (Exception ex ) {
155+ throw new AutoIngestJobException (String .format ("Error creating automated ingest job" ), ex );
156+ }
149157 }
150158
151159 /**
@@ -622,5 +630,33 @@ Date getStartDate() {
622630 }
623631
624632 }
633+
634+ /**
635+ * Exception thrown when there is a problem creating auto ingest job.
636+ */
637+ final static class AutoIngestJobException extends Exception {
625638
639+ private static final long serialVersionUID = 1L ;
640+
641+ /**
642+ * Constructs an exception to throw when there is a problem creating
643+ * auto ingest job.
644+ *
645+ * @param message The exception message.
646+ */
647+ private AutoIngestJobException (String message ) {
648+ super (message );
649+ }
650+
651+ /**
652+ * Constructs an exception to throw when there is a problem creating
653+ * auto ingest job.
654+ *
655+ * @param message The exception message.
656+ * @param cause The cause of the exception, if it was an exception.
657+ */
658+ private AutoIngestJobException (String message , Throwable cause ) {
659+ super (message , cause );
660+ }
661+ }
626662}
0 commit comments