Merge pull request #1485 from karlmortensen/standardterminology

Standardterminology
This commit is contained in:
Richard Cordovano 2015-07-31 14:56:54 -04:00
commit c6e9980b68
4 changed files with 33 additions and 33 deletions

View File

@ -241,7 +241,7 @@ CollaborationMonitor.analyzingDataSourceStatus.msg={0} analyzing {1}
MissingImageDialog.lbWarning.text= MissingImageDialog.lbWarning.text=
MissingImageDialog.lbWarning.toolTipText= MissingImageDialog.lbWarning.toolTipText=
SingleUserCaseImporter.AlreadyMultiUser=Case is already multi-user! SingleUserCaseImporter.AlreadyMultiUser=Case is already multi-user!
SingleUserCaseImporter.FinishedConverting=Finished converting SingleUserCaseImporter.FinishedImporting=Finished importing
SingleUserCaseImporter.To=to SingleUserCaseImporter.To=to
SingleUserCaseImporter.BadCaseSourceFolder=Case source folder does not exist! SingleUserCaseImporter.BadCaseSourceFolder=Case source folder does not exist!
SingleUserCaseImporter.BadImageSourceFolder=Image source folder does not exist! SingleUserCaseImporter.BadImageSourceFolder=Image source folder does not exist!
@ -249,9 +249,9 @@ SingleUserCaseImporter.BadDatabaseFileName=Database file does not exist!
SingleUserCaseImporter.NonUniqueOutputFolder=Output folder not unique. Skipping SingleUserCaseImporter.NonUniqueOutputFolder=Output folder not unique. Skipping
SingleUserCaseImporter.NonUniqueDatabaseName=Database name not unique. Skipping. SingleUserCaseImporter.NonUniqueDatabaseName=Database name not unique. Skipping.
SingleUserCaseImporter.PotentiallyNonUniqueDatabaseName=Unclear if database name unique. Moving ahead. SingleUserCaseImporter.PotentiallyNonUniqueDatabaseName=Unclear if database name unique. Moving ahead.
SingleUserCaseImporter.ConvertedToMultiUser=\nThis case was converted to a Multi-user collaborative case on SingleUserCaseImporter.ImportedAsMultiUser=\nThis case was imported as a multi-user collaborative case on
SingleUserCaseImporter.UnableToCopySourceImages=Unable to copy source images SingleUserCaseImporter.UnableToCopySourceImages=Unable to copy source images
SingleUserCaseImporter.ConversionSuccessful=. Conversion successful: SingleUserCaseImporter.ImportSuccessful=. Import result:
SingleUserCaseImporter.DeletingCase=Deleting original case folder SingleUserCaseImporter.DeletingCase=Deleting original case folder
SingleUserCaseImporter.CanNotOpenDatabase=Unable to open database SingleUserCaseImporter.CanNotOpenDatabase=Unable to open database
NewCaseVisualPanel1.caseParentDirWarningLabel.text=Case directory warning label NewCaseVisualPanel1.caseParentDirWarningLabel.text=Case directory warning label

View File

@ -1,5 +0,0 @@
package org.sleuthkit.autopsy.casemodule;
public interface ConversionDoneCallback {
void conversionDoneCallback(boolean result);
}

View File

@ -0,0 +1,6 @@
package org.sleuthkit.autopsy.casemodule;
public interface ImportDoneCallback {
void importDoneCallback(boolean result);
}

View File

@ -41,7 +41,6 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.logging.Level; import java.util.logging.Level;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case.CaseType; import org.sleuthkit.autopsy.casemodule.Case.CaseType;
import static org.sleuthkit.autopsy.casemodule.Case.MODULE_FOLDER; import static org.sleuthkit.autopsy.casemodule.Case.MODULE_FOLDER;
@ -53,13 +52,13 @@ import org.sleuthkit.autopsy.coreutils.TimeStampUtils;
import org.sleuthkit.autopsy.coreutils.UNCPathUtilities; import org.sleuthkit.autopsy.coreutils.UNCPathUtilities;
/** /**
* Convert case(s) from single-user to multi-user. Recursively scans subfolders. * Import case(s) from single-user to multi-user. Recursively scans subfolders.
*/ */
public class SingleUserCaseImporter implements Runnable { public class SingleUserCaseImporter implements Runnable {
private static final String AUTOPSY_DB_FILE = "autopsy.db"; //NON-NLS private static final String AUTOPSY_DB_FILE = "autopsy.db"; //NON-NLS
private static final String DOTAUT = ".aut"; //NON-NLS private static final String DOTAUT = ".aut"; //NON-NLS
public static final String CASE_CONVERSION_LOG_FILE = "case_import_log.txt"; //NON-NLS public static final String CASE_IMPORT_LOG_FILE = "case_import_log.txt"; //NON-NLS
private static final String logDateFormat = "yyyy/MM/dd HH:mm:ss"; //NON-NLS private static final String logDateFormat = "yyyy/MM/dd HH:mm:ss"; //NON-NLS
//If TIMELINE_FOLDER changes, also update TIMELINE in EventsRepository //If TIMELINE_FOLDER changes, also update TIMELINE in EventsRepository
private static final String TIMELINE_FOLDER = "Timeline"; //NON-NLS private static final String TIMELINE_FOLDER = "Timeline"; //NON-NLS
@ -76,7 +75,7 @@ public class SingleUserCaseImporter implements Runnable {
private final boolean copySourceImages; private final boolean copySourceImages;
private final boolean deleteCase; private final boolean deleteCase;
private final CaseDbConnectionInfo db; private final CaseDbConnectionInfo db;
private final ConversionDoneCallback notifyOnComplete; private final ImportDoneCallback notifyOnComplete;
private final UNCPathUtilities uncPathUtilities = new UNCPathUtilities(); private final UNCPathUtilities uncPathUtilities = new UNCPathUtilities();
private PrintWriter writer; private PrintWriter writer;
private XMLCaseManagement oldXmlCaseManagement; private XMLCaseManagement oldXmlCaseManagement;
@ -98,10 +97,10 @@ public class SingleUserCaseImporter implements Runnable {
* @param addTimestamp true if the output case name should end in a * @param addTimestamp true if the output case name should end in a
* timestamp, false otherwise * timestamp, false otherwise
* @param callback a callback from the calling panel for notification when * @param callback a callback from the calling panel for notification when
* the conversion has completed. This is a Runnable on a different thread. * the import has completed. This is a Runnable on a different thread.
*/ */
public SingleUserCaseImporter(String caseInput, String caseOutput, String imageInput, String imageOutput, CaseDbConnectionInfo database, public SingleUserCaseImporter(String caseInput, String caseOutput, String imageInput, String imageOutput, CaseDbConnectionInfo database,
boolean copySourceImages, boolean deleteCase, ConversionDoneCallback callback, boolean addTimestamp) { boolean copySourceImages, boolean deleteCase, ImportDoneCallback callback, boolean addTimestamp) {
this.caseInputFolder = caseInput; this.caseInputFolder = caseInput;
this.caseOutputFolder = caseOutput; this.caseOutputFolder = caseOutput;
this.imageInputFolder = imageInput; this.imageInputFolder = imageInput;
@ -114,9 +113,9 @@ public class SingleUserCaseImporter implements Runnable {
} }
/** /**
* Handles most of the heavy lifting for converting cases from single-user * Handles most of the heavy lifting for importing cases from single-user to
* to multi-user. Creates new .aut file, moves folders to the right place, * multi-user. Creates new .aut file, moves folders to the right place,
* converts the database, and updates paths within the database. * imports the database, and updates paths within the database.
* *
* @param input the full path of the folder to process. * @param input the full path of the folder to process.
* @param oldCaseFolder the case folder holding the old case. This name will * @param oldCaseFolder the case folder holding the old case. This name will
@ -128,7 +127,7 @@ public class SingleUserCaseImporter implements Runnable {
boolean result = true; boolean result = true;
try { try {
log("Beginning to convert " + input.toString() + " to " + caseOutputFolder + "\\" + oldCaseFolder); //NON-NLS log("Beginning to import " + input.toString() + " to " + caseOutputFolder + "\\" + oldCaseFolder); //NON-NLS
if (copySourceImages) { if (copySourceImages) {
checkInput(input.toFile(), new File(imageInputFolder)); checkInput(input.toFile(), new File(imageInputFolder));
@ -164,7 +163,7 @@ public class SingleUserCaseImporter implements Runnable {
File imageDestination = Paths.get(imageOutputFolder, caseName).toFile(); File imageDestination = Paths.get(imageOutputFolder, caseName).toFile();
copyResults(input, newCaseFolder, oldCaseName); // Copy items to new hostname folder structure copyResults(input, newCaseFolder, oldCaseName); // Copy items to new hostname folder structure
dbName = convertDb(dbName, input, newCaseFolder); // Change from SQLite to PostgreSQL dbName = importDb(dbName, input, newCaseFolder); // Change from SQLite to PostgreSQL
File imageSource = findInputFolder(input, imageInputFolder, oldCaseName); // Find a folder for the input images File imageSource = findInputFolder(input, imageInputFolder, oldCaseName); // Find a folder for the input images
fixPaths(imageSource.toString(), imageDestination.toString(), dbName); // Update paths in DB fixPaths(imageSource.toString(), imageDestination.toString(), dbName); // Update paths in DB
@ -191,7 +190,7 @@ public class SingleUserCaseImporter implements Runnable {
FileUtils.deleteDirectory(input.toFile()); FileUtils.deleteDirectory(input.toFile());
} }
log(NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.FinishedConverting") log(NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.FinishedImporting")
+ input.toString() + " " + NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.To") + input.toString() + " " + NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.To")
+ caseOutputFolder + File.separatorChar + newCaseFolder); + caseOutputFolder + File.separatorChar + newCaseFolder);
} catch (Exception exp) { } catch (Exception exp) {
@ -244,10 +243,10 @@ public class SingleUserCaseImporter implements Runnable {
Path partialAttempt = Paths.get(uncParent, oldCaseName); Path partialAttempt = Paths.get(uncParent, oldCaseName);
if (fullAttempt.toFile().isDirectory()) { if (fullAttempt.toFile().isDirectory()) {
/// we've found it, they are running a batch convert /// we've found it, they are running a batch import
return fullAttempt.toFile(); return fullAttempt.toFile();
} else if (uncParent != null && !uncParent.isEmpty() && partialAttempt.toFile().isDirectory()) { } else if (uncParent != null && !uncParent.isEmpty() && partialAttempt.toFile().isDirectory()) {
/// we've found it, they are running a specific convert /// we've found it, they are running a specific import
return partialAttempt.toFile(); return partialAttempt.toFile();
} }
@ -286,7 +285,7 @@ public class SingleUserCaseImporter implements Runnable {
/** /**
* Ensure the input source has an autopsy.db and exists. * Ensure the input source has an autopsy.db and exists.
* *
* @param caseInput The folder containing a case to convert. * @param caseInput The folder containing a case to import.
* @param imageInput The folder containing the images to copy or null if * @param imageInput The folder containing the images to copy or null if
* images are not being copied. * images are not being copied.
* @throws Exception * @throws Exception
@ -376,7 +375,7 @@ public class SingleUserCaseImporter implements Runnable {
FileUtils.copyFile(source.toFile(), destination.toFile()); FileUtils.copyFile(source.toFile(), destination.toFile());
} }
try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(destination.toString(), true)))) { try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(destination.toString(), true)))) {
out.println(NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.ConvertedToMultiUser") + new Date()); out.println(NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.ImportedAsMultiUser") + new Date());
} catch (IOException e) { } catch (IOException e) {
// if unable to log it, no problem // if unable to log it, no problem
} }
@ -416,7 +415,7 @@ public class SingleUserCaseImporter implements Runnable {
* @throws SQLException * @throws SQLException
* @throws ClassNotFoundException * @throws ClassNotFoundException
*/ */
private String convertDb(String dbName, Path inputPath, String outputCaseName) throws SQLException, ClassNotFoundException, Exception { private String importDb(String dbName, Path inputPath, String outputCaseName) throws SQLException, ClassNotFoundException, Exception {
// deconflict the database name // deconflict the database name
dbName = deconflictDatabaseName(db, dbName); dbName = deconflictDatabaseName(db, dbName);
@ -1254,18 +1253,18 @@ public class SingleUserCaseImporter implements Runnable {
closeLog(result); closeLog(result);
if (notifyOnComplete != null) { if (notifyOnComplete != null) {
notifyOnComplete.conversionDoneCallback(result); notifyOnComplete.importDoneCallback(result);
} }
} }
/** /**
* Open the case conversion log in the base output folder. * Open the case import log in the base output folder.
* *
*/ */
private void openLog() { private void openLog() {
File temp = new File(caseOutputFolder); File temp = new File(caseOutputFolder);
temp.mkdirs(); temp.mkdirs();
File logFile = Paths.get(caseOutputFolder, CASE_CONVERSION_LOG_FILE).toFile(); File logFile = Paths.get(caseOutputFolder, CASE_IMPORT_LOG_FILE).toFile();
try { try {
writer = new PrintWriter(new BufferedWriter(new FileWriter(logFile, logFile.exists())), true); writer = new PrintWriter(new BufferedWriter(new FileWriter(logFile, logFile.exists())), true);
} catch (IOException ex) { } catch (IOException ex) {
@ -1275,7 +1274,7 @@ public class SingleUserCaseImporter implements Runnable {
} }
/** /**
* Log a message to the case conversion log in the base output folder. * Log a message to the case import log in the base output folder.
* *
* @param message the message to log. * @param message the message to log.
*/ */
@ -1287,17 +1286,17 @@ public class SingleUserCaseImporter implements Runnable {
/** /**
* *
* Close the case conversion log in the base output folder. * Close the case import log in the base output folder.
* *
* @param result this informs the log if the end result was successful or * @param result this informs the log if the end result was successful or
* not. True if all was successful, false otherwise. * not. True if all was successful, false otherwise.
*/ */
private void closeLog(boolean result) { private void closeLog(boolean result) {
log(NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.FinishedConverting") log(NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.FinishedImporting")
+ caseInputFolder + " " + caseInputFolder + " "
+ NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.To") + NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.To")
+ caseOutputFolder + caseOutputFolder
+ NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.ConversionSuccessful") + NbBundle.getMessage(SingleUserCaseImporter.class, "SingleUserCaseImporter.ImportSuccessful")
+ result); + result);
if (writer != null) { if (writer != null) {
@ -1360,7 +1359,7 @@ public class SingleUserCaseImporter implements Runnable {
/** /**
* This returns the list of folders we've found that need to be looked * This returns the list of folders we've found that need to be looked
* at for possible conversion to multi-user cases. * at for possible import as multi-user cases.
* *
* @return the theList * @return the theList
*/ */