Merge pull request #7386 from rcordovano/develop

7673 Allow helpers to call correct Blackboard.postArtifacts() API - format file
This commit is contained in:
Richard Cordovano 2021-10-26 17:44:14 -04:00 committed by GitHub
commit aa783db66c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -218,7 +218,8 @@ public final class LeappFileProcessor {
"LeappFileProcessor.has.run=Leapp", "LeappFileProcessor.has.run=Leapp",
"LeappFileProcessor.Leapp.cancelled=Leapp run was canceled", "LeappFileProcessor.Leapp.cancelled=Leapp run was canceled",
"LeappFileProcessor.completed=Leapp Processing Completed", "LeappFileProcessor.completed=Leapp Processing Completed",
"LeappFileProcessor.error.reading.Leapp.directory=Error reading Leapp Output Directory"}) "LeappFileProcessor.error.reading.Leapp.directory=Error reading Leapp Output Directory"
})
public ProcessResult processFiles(Content dataSource, Path moduleOutputPath, AbstractFile LeappFile) { public ProcessResult processFiles(Content dataSource, Path moduleOutputPath, AbstractFile LeappFile) {
try { try {
List<String> LeappTsvOutputFiles = findTsvFiles(moduleOutputPath); List<String> LeappTsvOutputFiles = findTsvFiles(moduleOutputPath);
@ -418,9 +419,8 @@ public final class LeappFileProcessor {
} }
@NbBundle.Messages({ @NbBundle.Messages({
"LeappFileProcessor.cannot.create.waypoint.relationship=Cannot create TSK_WAYPOINT artifact.", "LeappFileProcessor.cannot.create.waypoint.relationship=Cannot create TSK_WAYPOINT artifact."
}) })
private void createRoute(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException { private void createRoute(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
Double startLatitude = Double.valueOf(0); Double startLatitude = Double.valueOf(0);
@ -484,13 +484,11 @@ public final class LeappFileProcessor {
throw new IngestModuleException(Bundle.LeappFileProcessor_cannot_create_waypoint_relationship() + ex.getLocalizedMessage(), ex); //NON-NLS throw new IngestModuleException(Bundle.LeappFileProcessor_cannot_create_waypoint_relationship() + ex.getLocalizedMessage(), ex); //NON-NLS
} }
} }
@NbBundle.Messages({ @NbBundle.Messages({
"LeappFileProcessor.cannot.create.trackpoint.relationship=Cannot create TSK_TRACK_POINT artifact.", "LeappFileProcessor.cannot.create.trackpoint.relationship=Cannot create TSK_TRACK_POINT artifact."
}) })
private AbstractFile createTrackpoint(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName, String trackpointSegmentName, GeoTrackPoints pointList) throws IngestModuleException { private AbstractFile createTrackpoint(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName, String trackpointSegmentName, GeoTrackPoints pointList) throws IngestModuleException {
Double latitude = Double.valueOf(0); Double latitude = Double.valueOf(0);
@ -556,11 +554,9 @@ public final class LeappFileProcessor {
} }
@NbBundle.Messages({ @NbBundle.Messages({
"LeappFileProcessor.cannot.create.message.relationship=Cannot create TSK_MESSAGE Relationship.", "LeappFileProcessor.cannot.create.message.relationship=Cannot create TSK_MESSAGE Relationship."
}) })
private void createMessageRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException { private void createMessageRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
String messageType = null; String messageType = null;
@ -662,7 +658,7 @@ public final class LeappFileProcessor {
} }
@NbBundle.Messages({ @NbBundle.Messages({
"LeappFileProcessor.cannot.create.contact.relationship=Cannot create TSK_CONTACT Relationship.", "LeappFileProcessor.cannot.create.contact.relationship=Cannot create TSK_CONTACT Relationship."
}) })
private void createContactRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException { private void createContactRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
@ -732,9 +728,8 @@ public final class LeappFileProcessor {
} }
@NbBundle.Messages({ @NbBundle.Messages({
"LeappFileProcessor.cannot.create.calllog.relationship=Cannot create TSK_CALLLOG Relationship.", "LeappFileProcessor.cannot.create.calllog.relationship=Cannot create TSK_CALLLOG Relationship."
}) })
private void createCalllogRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException { private void createCalllogRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
String callerId = null; String callerId = null;
@ -886,14 +881,16 @@ public final class LeappFileProcessor {
* *
* @param lineValues List of column values. * @param lineValues List of column values.
* @param columnIndexes Mapping of column headers (trimmed; to lower case) * @param columnIndexes Mapping of column headers (trimmed; to lower case)
* to column index. All header columns and only all header columns should be * to column index. All header columns and only all
* present. * header columns should be present.
* @param attrList The list of attributes as specified for the schema of * @param attrList The list of attributes as specified for the schema
* this file. * of this file.
* @param fileName The name of the file being processed. * @param fileName The name of the file being processed.
* @param lineNum The line number in the file. * @param lineNum The line number in the file.
*
* @return The collection of blackboard attributes for the artifact created * @return The collection of blackboard attributes for the artifact created
* from this line. * from this line.
*
* @throws IngestModuleException * @throws IngestModuleException
*/ */
private Collection<BlackboardAttribute> processReadLine(List<String> lineValues, Map<String, Integer> columnIndexes, private Collection<BlackboardAttribute> processReadLine(List<String> lineValues, Map<String, Integer> columnIndexes,
@ -950,6 +947,7 @@ public final class LeappFileProcessor {
* *
* @param colAttr Column Attribute information * @param colAttr Column Attribute information
* @param value string to be formatted * @param value string to be formatted
*
* @return formatted string based on attribute type if no attribute type * @return formatted string based on attribute type if no attribute type
* found then return original string * found then return original string
*/ */
@ -974,6 +972,7 @@ public final class LeappFileProcessor {
* @param value The string value to be converted to the appropriate data * @param value The string value to be converted to the appropriate data
* type for the attribute type. * type for the attribute type.
* @param fileName The file name that the value comes from. * @param fileName The file name that the value comes from.
*
* @return The generated blackboard attribute. * @return The generated blackboard attribute.
*/ */
private BlackboardAttribute getAttribute(BlackboardAttribute.Type attrType, String value, String fileName) { private BlackboardAttribute getAttribute(BlackboardAttribute.Type attrType, String value, String fileName) {
@ -1022,7 +1021,9 @@ public final class LeappFileProcessor {
* Handles converting a string value to a blackboard attribute. * Handles converting a string value to a blackboard attribute.
* *
* @param orig The original string value. * @param orig The original string value.
*
* @return The generated blackboard attribute. * @return The generated blackboard attribute.
*
* @throws ParseException * @throws ParseException
* @throws NumberFormatException * @throws NumberFormatException
*/ */
@ -1037,9 +1038,11 @@ public final class LeappFileProcessor {
* @param attrType The blackboard attribute type. * @param attrType The blackboard attribute type.
* @param fileName The name of the file from which the value comes. * @param fileName The name of the file from which the value comes.
* @param blankIsNull If string is blank return null attribute. * @param blankIsNull If string is blank return null attribute.
* @param zeroIsNull If string is some version of 0, return null attribute. * @param zeroIsNull If string is some version of 0, return null
* attribute.
* @param valueConverter The means of converting the string value to an * @param valueConverter The means of converting the string value to an
* appropriate blackboard attribute. * appropriate blackboard attribute.
*
* @return The generated blackboard attribute or null if not determined. * @return The generated blackboard attribute or null if not determined.
*/ */
private BlackboardAttribute parseAttrValue(String value, BlackboardAttribute.Type attrType, String fileName, boolean blankIsNull, boolean zeroIsNull, ParseExceptionFunction valueConverter) { private BlackboardAttribute parseAttrValue(String value, BlackboardAttribute.Type attrType, String fileName, boolean blankIsNull, boolean zeroIsNull, ParseExceptionFunction valueConverter) {
@ -1063,6 +1066,9 @@ public final class LeappFileProcessor {
} }
} }
/**
* Read the XML config file and load the mappings into maps
*/
@NbBundle.Messages({ @NbBundle.Messages({
"LeappFileProcessor.cannot.load.artifact.xml=Cannot load xml artifact file.", "LeappFileProcessor.cannot.load.artifact.xml=Cannot load xml artifact file.",
"LeappFileProcessor.cannotBuildXmlParser=Cannot buld an XML parser.", "LeappFileProcessor.cannotBuildXmlParser=Cannot buld an XML parser.",
@ -1070,10 +1076,6 @@ public final class LeappFileProcessor {
"LeappFileProcessor.postartifacts_error=Error posting Blackboard Artifact", "LeappFileProcessor.postartifacts_error=Error posting Blackboard Artifact",
"LeappFileProcessor.error.creating.new.artifacts=Error creating new artifacts." "LeappFileProcessor.error.creating.new.artifacts=Error creating new artifacts."
}) })
/**
* Read the XML config file and load the mappings into maps
*/
private void loadConfigFile() throws IngestModuleException { private void loadConfigFile() throws IngestModuleException {
Document xmlinput; Document xmlinput;
try { try {
@ -1213,7 +1215,8 @@ public final class LeappFileProcessor {
* @param dataSource is the Content object that needs to have the artifact * @param dataSource is the Content object that needs to have the artifact
* added for it * added for it
* @param bbattributes is the collection of blackboard attributes that need * @param bbattributes is the collection of blackboard attributes that need
* to be added to the artifact after the artifact has been created * to be added to the artifact after the artifact has
* been created
* *
* @return The newly-created artifact, or null on error * @return The newly-created artifact, or null on error
*/ */