From 07551a092544bb9f654227ff942e5605363defaa Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Fri, 8 Jan 2010 16:18:52 +0000 Subject: [PATCH] Rename the outlook extractor to be more consistent with other extractors git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@897249 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 2 +- .../apache/poi/extractor/ExtractorFactory.java | 4 ++-- .../poi/extractor/TestExtractorFactory.java | 8 ++++---- ...TextExtactor.java => OutlookTextExtactor.java} | 15 +++++++++------ ...tractor.java => TestOutlookTextExtractor.java} | 14 +++++++------- 5 files changed, 23 insertions(+), 20 deletions(-) rename src/scratchpad/src/org/apache/poi/hsmf/extractor/{HSMFTextExtactor.java => OutlookTextExtactor.java} (85%) rename src/scratchpad/testcases/org/apache/poi/hsmf/extractor/{TestHSMFTextExtractor.java => TestOutlookTextExtractor.java} (86%) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index b14c690e52..15b3750815 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,7 +34,7 @@ - Add a text extractor to HSMF for simpler extraction of text from .msg files + Add a text extractor (OutlookTextExtractor) to HSMF for simpler extraction of text from .msg files Some improvements to HSMF parsing of .msg files Initialise the link type of HSSFHyperLink, so that getType() on it works 48425 - improved performance of DateUtil.isCellDateFormatted() diff --git a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java index 28af05b3e2..7657635e75 100644 --- a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java +++ b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java @@ -31,7 +31,7 @@ import org.apache.poi.POIXMLDocument; import org.apache.poi.POIXMLTextExtractor; import org.apache.poi.hdgf.extractor.VisioTextExtractor; import org.apache.poi.hslf.extractor.PowerPointExtractor; -import org.apache.poi.hsmf.extractor.HSMFTextExtactor; +import org.apache.poi.hsmf.extractor.OutlookTextExtactor; import org.apache.poi.hssf.extractor.ExcelExtractor; import org.apache.poi.hwpf.extractor.WordExtractor; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; @@ -142,7 +142,7 @@ public class ExtractorFactory { if(entry.getName().equals("__substg1.0_1000001E") || entry.getName().equals("__substg1.0_0047001E") || entry.getName().equals("__substg1.0_0037001E")) { - return new HSMFTextExtactor(poifsDir, fs); + return new OutlookTextExtactor(poifsDir, fs); } } throw new IllegalArgumentException("No supported documents found in the OLE2 stream"); diff --git a/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java b/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java index 8518b6eab1..f9b88794bd 100644 --- a/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java +++ b/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java @@ -25,7 +25,7 @@ import org.apache.poi.POITextExtractor; import org.apache.poi.POIDataSamples; import org.apache.poi.hdgf.extractor.VisioTextExtractor; import org.apache.poi.hslf.extractor.PowerPointExtractor; -import org.apache.poi.hsmf.extractor.HSMFTextExtactor; +import org.apache.poi.hsmf.extractor.OutlookTextExtactor; import org.apache.poi.hssf.extractor.ExcelExtractor; import org.apache.poi.hwpf.extractor.WordExtractor; import org.apache.poi.poifs.filesystem.POIFSFileSystem; @@ -169,7 +169,7 @@ public class TestExtractorFactory extends TestCase { // Outlook msg assertTrue( ExtractorFactory.createExtractor(msg) - instanceof HSMFTextExtactor + instanceof OutlookTextExtactor ); assertTrue( ExtractorFactory.createExtractor(msg).getText().length() > 50 @@ -248,7 +248,7 @@ public class TestExtractorFactory extends TestCase { // Outlook msg assertTrue( ExtractorFactory.createExtractor(new FileInputStream(msg)) - instanceof HSMFTextExtactor + instanceof OutlookTextExtactor ); assertTrue( ExtractorFactory.createExtractor(new FileInputStream(msg)).getText().length() > 50 @@ -303,7 +303,7 @@ public class TestExtractorFactory extends TestCase { // Outlook msg assertTrue( ExtractorFactory.createExtractor(new POIFSFileSystem(new FileInputStream(msg))) - instanceof HSMFTextExtactor + instanceof OutlookTextExtactor ); assertTrue( ExtractorFactory.createExtractor(new POIFSFileSystem(new FileInputStream(msg))).getText().length() > 50 diff --git a/src/scratchpad/src/org/apache/poi/hsmf/extractor/HSMFTextExtactor.java b/src/scratchpad/src/org/apache/poi/hsmf/extractor/OutlookTextExtactor.java similarity index 85% rename from src/scratchpad/src/org/apache/poi/hsmf/extractor/HSMFTextExtactor.java rename to src/scratchpad/src/org/apache/poi/hsmf/extractor/OutlookTextExtactor.java index fd72feaa56..54a2ddda67 100644 --- a/src/scratchpad/src/org/apache/poi/hsmf/extractor/HSMFTextExtactor.java +++ b/src/scratchpad/src/org/apache/poi/hsmf/extractor/OutlookTextExtactor.java @@ -26,17 +26,21 @@ import org.apache.poi.hsmf.exceptions.ChunkNotFoundException; import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.POIFSFileSystem; -public class HSMFTextExtactor extends POIOLE2TextExtractor { - public HSMFTextExtactor(MAPIMessage msg) { +/** + * A text extractor for HSMF (Outlook) .msg files. + * Outputs in a format somewhat like a plain text email. + */ +public class OutlookTextExtactor extends POIOLE2TextExtractor { + public OutlookTextExtactor(MAPIMessage msg) { super(msg); } - public HSMFTextExtactor(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException { + public OutlookTextExtactor(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException { this(new MAPIMessage(poifsDir, fs)); } - public HSMFTextExtactor(POIFSFileSystem fs) throws IOException { + public OutlookTextExtactor(POIFSFileSystem fs) throws IOException { this(new MAPIMessage(fs)); } - public HSMFTextExtactor(InputStream inp) throws IOException { + public OutlookTextExtactor(InputStream inp) throws IOException { this(new MAPIMessage(inp)); } @@ -74,5 +78,4 @@ public class HSMFTextExtactor extends POIOLE2TextExtractor { return s.toString(); } - } diff --git a/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestHSMFTextExtractor.java b/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java similarity index 86% rename from src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestHSMFTextExtractor.java rename to src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java index 84ebbb1509..b15bbc7249 100644 --- a/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestHSMFTextExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java @@ -29,10 +29,10 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; /** * Tests to verify that the text extractor works */ -public final class TestHSMFTextExtractor extends TestCase { +public final class TestOutlookTextExtractor extends TestCase { private POIDataSamples samples; - public TestHSMFTextExtractor() throws IOException { + public TestOutlookTextExtractor() throws IOException { samples = POIDataSamples.getHSMFInstance(); } @@ -49,7 +49,7 @@ public final class TestHSMFTextExtractor extends TestCase { ); MAPIMessage msg = new MAPIMessage(simple); - HSMFTextExtactor ext = new HSMFTextExtactor(msg); + OutlookTextExtactor ext = new OutlookTextExtactor(msg); String text = ext.getText(); assertContains(text, "From: Kevin Roast\n"); @@ -66,7 +66,7 @@ public final class TestHSMFTextExtractor extends TestCase { new FileInputStream(samples.getFile("simple_test_msg.msg")) )); - HSMFTextExtactor ext = new HSMFTextExtactor(msg); + OutlookTextExtactor ext = new OutlookTextExtactor(msg); String text = ext.getText(); assertContains(text, "From: Travis Ferguson\n"); @@ -79,13 +79,13 @@ public final class TestHSMFTextExtractor extends TestCase { } public void testConstructors() throws Exception { - String inp = (new HSMFTextExtactor(new FileInputStream( + String inp = (new OutlookTextExtactor(new FileInputStream( samples.getFile("simple_test_msg.msg") )).getText()); - String poifs = (new HSMFTextExtactor(new POIFSFileSystem(new FileInputStream( + String poifs = (new OutlookTextExtactor(new POIFSFileSystem(new FileInputStream( samples.getFile("simple_test_msg.msg") ))).getText()); - String mapi = (new HSMFTextExtactor(new MAPIMessage(new FileInputStream( + String mapi = (new OutlookTextExtactor(new MAPIMessage(new FileInputStream( samples.getFile("simple_test_msg.msg") ))).getText()); -- 2.39.5