Search in sources :

Example 26 with ConfigException

use of org.opensextant.ConfigException in project Xponents by OpenSextant.

the class OutlookPSTCrawler method collect.

@Override
public void collect() throws IOException, ConfigException {
    //
    // Logic:  Traverse PST file.
    //     it contains mail, contacts, tasks, notes, other stuff?
    //
    // Replicate folder structure discovered.
    // Mail and date-oriented items should be filed by date. For now, YYYY-MM-DD is fine.
    //
    // For mail messages, review DefaultMailCralwer:
    //  - for each message
    //    save message to disk;  create parent folder to contain message contents
    //    run text conversion individually on attachments.
    //
    //  - structure:
    //    ./Mail/
    //         2014-04-09/messageABC.eml
    //         2014-04-09/messageABC/attachment1.doc
    log.info("Traversing PST Folders for FILE={}", pst);
    try {
        PSTFile pstStore = new PSTFile(pst);
        processFolder(pstStore.getRootFolder());
    } catch (PSTException err) {
        throw new ConfigException("Failure with PST traversal", err);
    }
}
Also used : PSTFile(com.pff.PSTFile) PSTException(com.pff.PSTException) ConfigException(org.opensextant.ConfigException)

Example 27 with ConfigException

use of org.opensextant.ConfigException in project Xponents by OpenSextant.

the class ImageGroper method main.

public static void main(String[] args) {
    gnu.getopt.Getopt opts = new gnu.getopt.Getopt("ImageGroper", args, "hei:o:");
    String input = null;
    String output = null;
    boolean embed = false;
    try {
        int c;
        while ((c = opts.getopt()) != -1) {
            switch(c) {
                case 'i':
                    input = opts.getOptarg();
                    break;
                case 'o':
                    output = opts.getOptarg();
                    break;
                case 'e':
                    embed = true;
                    System.out.println("Saving conversions to Input folder.  Output folder will be ignored.");
                    break;
                default:
                    ImageGroper.usage();
                    System.exit(1);
            }
        }
    } catch (Exception err) {
        ImageGroper.usage();
        System.exit(1);
    }
    // Setting LANG=en_US in your shell.
    //
    // System.setProperty("LANG", "en_US");
    XText xt = new XText();
    xt.enableSaving(true);
    // creates a ./text/ Folder locally in directory.
    xt.getPathManager().enableSaveWithInput(embed);
    xt.clearSettings();
    xt.convertFileType("jpg");
    xt.convertFileType("jpeg");
    try {
        xt.getPathManager().setConversionCache(output);
        xt.setup();
        xt.extractText(input);
    } catch (IOException ioerr) {
        ioerr.printStackTrace();
    } catch (ConfigException cfgerr) {
        cfgerr.printStackTrace();
    }
}
Also used : XText(org.opensextant.xtext.XText) ConfigException(org.opensextant.ConfigException) IOException(java.io.IOException) ConfigException(org.opensextant.ConfigException) IOException(java.io.IOException)

Example 28 with ConfigException

use of org.opensextant.ConfigException in project Xponents by OpenSextant.

the class MailClientTest method main.

/**
     * Simple connection demo.  No mail reading... just configure, connect, disconnect.
     * @param args
     */
public static void main(String[] args) {
    try {
        System.out.println("Usage:  MailClientTest   cfg-url  /save/to/archive");
        MailConfig imapClientCfg;
        URL abc = MailClient.class.getResource(args[0]);
        imapClientCfg = new MailConfig(abc);
        MailClient imapClient = new MailClient(imapClientCfg, args[1]);
        imapClient.connect();
        imapClient.disconnect();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ConfigException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (MessagingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : MessagingException(javax.mail.MessagingException) ConfigException(org.opensextant.ConfigException) MailClient(org.opensextant.xtext.collectors.mailbox.MailClient) IOException(java.io.IOException) MailConfig(org.opensextant.xtext.collectors.mailbox.MailConfig) URL(java.net.URL)

Aggregations

ConfigException (org.opensextant.ConfigException)28 IOException (java.io.IOException)20 File (java.io.File)5 URL (java.net.URL)4 MimeTypeParseException (javax.activation.MimeTypeParseException)3 MessagingException (javax.mail.MessagingException)3 SolrServerException (org.apache.solr.client.solrj.SolrServerException)3 PlaceGeocoder (org.opensextant.extractors.geo.PlaceGeocoder)3 XText (org.opensextant.xtext.XText)3 PSTFile (com.pff.PSTFile)2 MalformedURLException (java.net.MalformedURLException)2 HashSet (java.util.HashSet)2 TextMatch (org.opensextant.extraction.TextMatch)2 PersonNameFilter (org.opensextant.extractors.geo.rules.PersonNameFilter)2 TaxonMatcher (org.opensextant.extractors.xtax.TaxonMatcher)2 XTemporal (org.opensextant.extractors.xtemporal.XTemporal)2 PSTException (com.pff.PSTException)1 LongOpt (gnu.getopt.LongOpt)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1