From be5ae65c97518fa6aea9871762e1575d4e975c5a Mon Sep 17 00:00:00 2001 From: Nick Davis Date: Mon, 3 Mar 2014 15:38:33 -0500 Subject: [PATCH] Pulled strings into Bundle. Created _ja. Created Bundle in jni Created _ja for jni. Added NbBundle dep to project.xml. --- ScalpelCarver/nbproject/project.xml | 8 ++++++++ .../autopsy/scalpel/Bundle.properties | 3 +++ .../autopsy/scalpel/Bundle_ja.properties | 0 .../scalpel/ScalpelCarverIngestModule.java | 6 ++++-- .../autopsy/scalpel/jni/Bundle.properties | 8 ++++++++ .../autopsy/scalpel/jni/Bundle_ja.properties | 0 .../autopsy/scalpel/jni/ScalpelCarver.java | 18 ++++++++++++------ .../scalpel/jni/ScalpelOutputParser.java | 8 ++++++-- 8 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/Bundle_ja.properties create mode 100644 ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/Bundle.properties create mode 100644 ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/Bundle_ja.properties diff --git a/ScalpelCarver/nbproject/project.xml b/ScalpelCarver/nbproject/project.xml index 09a3bb2f87..05eecf644b 100644 --- a/ScalpelCarver/nbproject/project.xml +++ b/ScalpelCarver/nbproject/project.xml @@ -6,6 +6,14 @@ org.sleuthkit.autopsy.scalpel + + org.openide.util + + + + 8.25.1 + + org.sleuthkit.autopsy.core diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/Bundle.properties b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/Bundle.properties index 7bef33de95..2b5483a453 100644 --- a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/Bundle.properties +++ b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/Bundle.properties @@ -4,3 +4,6 @@ OpenIDE-Module-Long-Description=\ Carves files from unallocated space at ingest time.\n\ Carved files are reanalyzed and displayed in the directory tree. OpenIDE-Module-Short-Description=Carves files from unallocated space +ScalpelCarverIngestModule.moduleName=Scalpel Carver +ScalpelCarverIngestModule.moduleDesc.text=Carves files from unallocated space at ingest time.\ +Carved files are reanalyzed and displayed in the directory tree. diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/Bundle_ja.properties b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/Bundle_ja.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/ScalpelCarverIngestModule.java b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/ScalpelCarverIngestModule.java index 98bfbdf29c..619fd17ae7 100644 --- a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/ScalpelCarverIngestModule.java +++ b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/ScalpelCarverIngestModule.java @@ -23,6 +23,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; + +import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; @@ -55,8 +57,8 @@ class ScalpelCarverIngestModule { // extends IngestModuleAbstractFile { // disab private static final Logger logger = Logger.getLogger(ScalpelCarverIngestModule.class.getName()); private static ScalpelCarverIngestModule instance; - private final String MODULE_NAME = "Scalpel Carver"; - private final String MODULE_DESCRIPTION = "Carves files from unallocated space at ingest time.\nCarved files are reanalyzed and displayed in the directory tree."; + private final String MODULE_NAME = NbBundle.getMessage(ScalpelCarverIngestModule.class, "ScalpelCarverIngestModule.moduleName"); + private final String MODULE_DESCRIPTION = NbBundle.getMessage(ScalpelCarverIngestModule.class, "ScalpelCarverIngestModule.moduleDesc.text"); private final String MODULE_VERSION = Version.getVersion(); private final String MODULE_OUTPUT_DIR_NAME = "ScalpelCarver"; private String moduleOutputDirPath; diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/Bundle.properties b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/Bundle.properties new file mode 100644 index 0000000000..846b5613c8 --- /dev/null +++ b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/Bundle.properties @@ -0,0 +1,8 @@ +ScalpelCarver.loadLib.errMsg.cannotLoadLib=Could not load library {0} for your environment +ScalpelCarver.loadLib.errMsg.cannotLoadLib2=Could not load library {0} for your environment +ScalpelCarver.carve.exception.libNotInit=Scalpel library is not fully initialized. +ScalpelCarver.carve.exception.invalidArgs=Invalid arguments for scalpel carving. +ScalpelCarver.carve.exception.cannotReadConfig=Cannot read libscalpel config file\: {0} +ScalpelCarver.carve.exception.cannotWriteConfig=Cannot write to libscalpel output dir\: {0} +ScalpelOutputParser.outputStart.text=The following files were carved\: +ScalpelOutputParser.toString.text=CarvedFileMeta'{'fileName\={0}, start\: {1}, size\: {2}'}' \ No newline at end of file diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/Bundle_ja.properties b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/Bundle_ja.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java index 00a1913bd5..70ea7cd029 100644 --- a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java +++ b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java @@ -25,6 +25,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.logging.Level; + +import org.openide.util.NbBundle; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.scalpel.jni.ScalpelOutputParser.CarvedFileMeta; import org.sleuthkit.datamodel.AbstractFile; @@ -76,11 +78,11 @@ public class ScalpelCarver { System.loadLibrary(id); success = true; } catch (UnsatisfiedLinkError ex) { - String msg = "Could not load library " + id + " for your environment "; + String msg = NbBundle.getMessage(ScalpelCarver.class, "ScalpelCarver.loadLib.errMsg.cannotLoadLib", id); System.out.println(msg + ex.toString()); logger.log(Level.SEVERE, msg, ex); } catch (Exception ex) { - String msg = "Could not load library " + id + " for your environment "; + String msg = NbBundle.getMessage(ScalpelCarver.class, "ScalpelCarver.loadLib.errMsg.cannotLoadLib2", id); System.out.println(msg + ex.toString()); logger.log(Level.SEVERE, msg, ex); } @@ -113,24 +115,28 @@ public class ScalpelCarver { */ public List carve(AbstractFile file, String configFilePath, String outputFolderPath) throws ScalpelException { if (!initialized) { - throw new ScalpelException("Scalpel library is not fully initialized. "); + throw new ScalpelException(NbBundle.getMessage(this.getClass(), "ScalpelCarver.carve.exception.libNotInit")); } //basic check of arguments before going to jni land if (file == null || configFilePath == null || configFilePath.isEmpty() || outputFolderPath == null || outputFolderPath.isEmpty()) { - throw new ScalpelException("Invalid arguments for scalpel carving. "); + throw new ScalpelException(NbBundle.getMessage(this.getClass(), "ScalpelCarver.carve.exception.invalidArgs")); } //validate the paths passed in File config = new File(configFilePath); if (! config.exists() || ! config.canRead()) { - throw new ScalpelException("Cannot read libscalpel config file: " + configFilePath); + throw new ScalpelException( + NbBundle.getMessage(this.getClass(), "ScalpelCarver.carve.exception.cannotReadConfig", + configFilePath)); } File outDir = new File(outputFolderPath); if (! outDir.exists() || ! outDir.canWrite()) { - throw new ScalpelException("Cannot write to libscalpel output dir: " + outputFolderPath); + throw new ScalpelException( + NbBundle.getMessage(this.getClass(), "ScalpelCarver.carve.exception.cannotWriteConfig", + outputFolderPath)); } final String carverInputId = file.getId() + ": " + file.getName(); diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelOutputParser.java b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelOutputParser.java index 6b78ee5131..ac18bac6d6 100644 --- a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelOutputParser.java +++ b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelOutputParser.java @@ -25,6 +25,8 @@ import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; + +import org.openide.util.NbBundle; import org.sleuthkit.datamodel.TskFileRange; /** @@ -32,7 +34,8 @@ import org.sleuthkit.datamodel.TskFileRange; */ public class ScalpelOutputParser { - private static final String OUTPUT_START = "The following files were carved:"; + private static final String OUTPUT_START = NbBundle.getMessage(ScalpelOutputParser.class, + "ScalpelOutputParser.outputStart.text"); public static class CarvedFileMeta { @@ -62,7 +65,8 @@ public class ScalpelOutputParser { @Override public String toString() { - return "CarvedFileMeta{" + "fileName=" + fileName + ", start: " + byteRange.getByteStart() + ", size: " + byteRange.getByteLen() + '}'; + return NbBundle.getMessage(this.getClass(), "ScalpelOutputParser.toString.text", + fileName, byteRange.getByteStart(), byteRange.getByteLen()); } }