Example usage for java.util Enumeration hasMoreElements

List of usage examples for java.util Enumeration hasMoreElements

Introduction

In this page you can find the example usage for java.util Enumeration hasMoreElements.

Prototype

boolean hasMoreElements();

Source Link

Document

Tests if this enumeration contains more elements.

Usage

From source file:org.sonews.Application.java

/**
 * The main entrypoint.//from www.  ja va2s.  c o  m
 *
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    System.out.println(VERSION);
    Thread.currentThread().setName("Mainthread");

    // Command line arguments
    boolean async = false;
    boolean feed = false; // Enable feeding?
    boolean purger = false; // Enable message purging?
    int port = -1;

    for (int n = 0; n < args.length; n++) {
        switch (args[n]) {
        case "-async": {
            async = true;
            break;
        }
        case "-c":
        case "-config": {
            Config.inst().set(Config.LEVEL_CLI, Config.CONFIGFILE, args[++n]);
            System.out.println("Using config file " + args[n]);
            break;
        }
        case "-C":
        case "-context": {
            // FIXME: Additional context files
            n++;
            break;
        }
        case "-dumpjdbcdriver": {
            System.out.println("Available JDBC drivers:");
            Enumeration<Driver> drvs = DriverManager.getDrivers();
            while (drvs.hasMoreElements()) {
                System.out.println(drvs.nextElement());
            }
            return;
        }
        case "-feed": {
            feed = true;
            break;
        }
        case "-h":
        case "-help": {
            printArguments();
            return;
        }
        case "-p": {
            port = Integer.parseInt(args[++n]);
            break;
        }
        case "-plugin-storage": {
            System.out.println("Warning: -plugin-storage is not implemented!");
            break;
        }
        case "-purger": {
            purger = true;
            break;
        }
        case "-v":
        case "-version":
            // Simply return as the version info is already printed above
            return;
        }
    }

    ApplicationContext context = new AnnotationConfigApplicationContext(Application.class);
    context = new FileSystemXmlApplicationContext(new String[] { "sonews.xml" }, context);

    // Enable storage backend
    StorageProvider sprov = context.getBean("storageProvider", StorageProvider.class);
    StorageManager.enableProvider(sprov);

    ChannelLineBuffers.allocateDirect();

    // Add shutdown hook
    Runtime.getRuntime().addShutdownHook(new ShutdownHook());

    // Start the listening daemon
    if (port <= 0) {
        port = Config.inst().get(Config.PORT, 119);
    }

    NNTPDaemon daemon = context.getBean(NNTPDaemon.class);
    daemon.setPort(port);
    daemon.start();

    // Start Connections purger thread...
    Connections.getInstance().start();

    // Start feeds
    if (feed) {
        FeedManager.startFeeding();
    }

    if (purger) {
        Purger purgerDaemon = new Purger();
        purgerDaemon.start();
    }

    // Wait for main thread to exit (setDaemon(false))
    daemon.join();
}

From source file:codeswarm.CodeSwarmConfig.java

/**
 *
 * @param args/*from   w w w .  j ava  2s .c o  m*/
 */
public static void main(String[] args) {
    if (args.length > 0) {
        CodeSwarmConfig config = null;
        try {
            config = new CodeSwarmConfig(args[0]);
            Enumeration<?> en = config.p.propertyNames();
            while (en.hasMoreElements()) {
                String key = (String) en.nextElement();
                String value = config.p.getProperty(key);
                logger.debug(key + "=" + value);
            }
        } catch (IOException e) {
            System.err.println("Failed due to exception: " + e.getMessage());
        }
    } else {
        System.err.println("Requires config file.");
    }
}

From source file:ModifyModelSample.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Modifying Model");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();

    // Fill model
    final DefaultListModel model = new DefaultListModel();
    for (int i = 0, n = labels.length; i < n; i++) {
        model.addElement(labels[i]);// w ww  .  j a  va 2  s . co  m
    }
    JList jlist = new JList(model);
    JScrollPane scrollPane1 = new JScrollPane(jlist);
    contentPane.add(scrollPane1, BorderLayout.WEST);

    final JTextArea textArea = new JTextArea();
    textArea.setEditable(false);
    JScrollPane scrollPane2 = new JScrollPane(textArea);
    contentPane.add(scrollPane2, BorderLayout.CENTER);

    ListDataListener listDataListener = new ListDataListener() {
        public void contentsChanged(ListDataEvent listDataEvent) {
            appendEvent(listDataEvent);
        }

        public void intervalAdded(ListDataEvent listDataEvent) {
            appendEvent(listDataEvent);
        }

        public void intervalRemoved(ListDataEvent listDataEvent) {
            appendEvent(listDataEvent);
        }

        private void appendEvent(ListDataEvent listDataEvent) {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            switch (listDataEvent.getType()) {
            case ListDataEvent.CONTENTS_CHANGED:
                pw.print("Type: Contents Changed");
                break;
            case ListDataEvent.INTERVAL_ADDED:
                pw.print("Type: Interval Added");
                break;
            case ListDataEvent.INTERVAL_REMOVED:
                pw.print("Type: Interval Removed");
                break;
            }
            pw.print(", Index0: " + listDataEvent.getIndex0());
            pw.print(", Index1: " + listDataEvent.getIndex1());
            DefaultListModel theModel = (DefaultListModel) listDataEvent.getSource();
            Enumeration elements = theModel.elements();
            pw.print(", Elements: ");
            while (elements.hasMoreElements()) {
                pw.print(elements.nextElement());
                pw.print(",");
            }
            pw.println();
            textArea.append(sw.toString());
        }
    };

    model.addListDataListener(listDataListener);

    // Setup buttons
    JPanel jp = new JPanel(new GridLayout(2, 1));
    JPanel jp1 = new JPanel(new FlowLayout(FlowLayout.CENTER, 1, 1));
    JPanel jp2 = new JPanel(new FlowLayout(FlowLayout.CENTER, 1, 1));
    jp.add(jp1);
    jp.add(jp2);
    JButton jb = new JButton("add F");
    jp1.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            model.add(0, "First");
        }
    });
    jb = new JButton("addElement L");
    jp1.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            model.addElement("Last");
        }
    });
    jb = new JButton("insertElementAt M");
    jp1.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            int size = model.getSize();
            model.insertElementAt("Middle", size / 2);
        }
    });
    jb = new JButton("set F");
    jp1.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            int size = model.getSize();
            if (size != 0)
                model.set(0, "New First");
        }
    });
    jb = new JButton("setElementAt L");
    jp1.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            int size = model.getSize();
            if (size != 0)
                model.setElementAt("New Last", size - 1);
        }
    });
    jb = new JButton("load 10");
    jp1.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            for (int i = 0, n = labels.length; i < n; i++) {
                model.addElement(labels[i]);
            }
        }
    });
    jb = new JButton("clear");
    jp2.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            model.clear();
        }
    });
    jb = new JButton("remove F");
    jp2.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            int size = model.getSize();
            if (size != 0)
                model.remove(0);
        }
    });
    jb = new JButton("removeAllElements");
    jp2.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            model.removeAllElements();
        }
    });
    jb = new JButton("removeElement 'Last'");
    jp2.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            model.removeElement("Last");
        }
    });
    jb = new JButton("removeElementAt M");
    jp2.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            int size = model.getSize();
            if (size != 0)
                model.removeElementAt(size / 2);
        }
    });
    jb = new JButton("removeRange FM");
    jp2.add(jb);
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            int size = model.getSize();
            if (size != 0)
                model.removeRange(0, size / 2);
        }
    });
    contentPane.add(jp, BorderLayout.SOUTH);
    frame.setSize(640, 300);
    frame.setVisible(true);
}

From source file:createSod.java

/**
 * @param args//from   w  ww  .j a v a  2 s . c om
 * @throws CMSException 
 */
public static void main(String[] args) throws Exception {

    try {
        CommandLine options = verifyArgs(args);
        String privateKeyLocation = options.getOptionValue("privatekey");
        String keyPassword = options.getOptionValue("keypass");
        String certificate = options.getOptionValue("certificate");
        String sodContent = options.getOptionValue("content");
        String sod = "";
        if (options.hasOption("out")) {
            sod = options.getOptionValue("out");
        }

        // CHARGEMENT DU FICHIER PKCS#12

        KeyStore ks = null;
        char[] password = null;

        Security.addProvider(new BouncyCastleProvider());
        try {
            ks = KeyStore.getInstance("PKCS12");
            // Password pour le fichier personnal_nyal.p12
            password = keyPassword.toCharArray();
            ks.load(new FileInputStream(privateKeyLocation), password);
        } catch (Exception e) {
            System.out.println("Erreur: fichier " + privateKeyLocation
                    + " n'est pas un fichier pkcs#12 valide ou passphrase incorrect");
            return;
        }

        // RECUPERATION DU COUPLE CLE PRIVEE/PUBLIQUE ET DU CERTIFICAT PUBLIQUE

        X509Certificate cert = null;
        PrivateKey privatekey = null;
        PublicKey publickey = null;

        try {
            Enumeration en = ks.aliases();
            String ALIAS = "";
            Vector vectaliases = new Vector();

            while (en.hasMoreElements())
                vectaliases.add(en.nextElement());
            String[] aliases = (String[]) (vectaliases.toArray(new String[0]));
            for (int i = 0; i < aliases.length; i++)
                if (ks.isKeyEntry(aliases[i])) {
                    ALIAS = aliases[i];
                    break;
                }
            privatekey = (PrivateKey) ks.getKey(ALIAS, password);
            cert = (X509Certificate) ks.getCertificate(ALIAS);
            publickey = ks.getCertificate(ALIAS).getPublicKey();
        } catch (Exception e) {
            e.printStackTrace();
            return;
        }

        // Chargement du certificat  partir du fichier

        InputStream inStream = new FileInputStream(certificate);
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        cert = (X509Certificate) cf.generateCertificate(inStream);
        inStream.close();

        // Chargement du fichier qui va tre sign

        File file_to_sign = new File(sodContent);
        byte[] buffer = new byte[(int) file_to_sign.length()];
        DataInputStream in = new DataInputStream(new FileInputStream(file_to_sign));
        in.readFully(buffer);
        in.close();

        // Chargement des certificats qui seront stocks dans le fichier .p7
        // Ici, seulement le certificat personnal_nyal.cer sera associ.
        // Par contre, la chane des certificats non.

        ArrayList certList = new ArrayList();
        certList.add(cert);
        CertStore certs = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certList),
                "BC");

        CMSSignedDataGenerator signGen = new CMSSignedDataGenerator();

        // privatekey correspond  notre cl prive rcupre du fichier PKCS#12
        // cert correspond au certificat publique personnal_nyal.cer
        // Le dernier argument est l'algorithme de hachage qui sera utilis

        signGen.addSigner(privatekey, cert, CMSSignedDataGenerator.DIGEST_SHA1);
        signGen.addCertificatesAndCRLs(certs);
        CMSProcessable content = new CMSProcessableByteArray(buffer);

        // Generation du fichier CMS/PKCS#7
        // L'argument deux permet de signifier si le document doit tre attach avec la signature
        //     Valeur true:  le fichier est attach (c'est le cas ici)
        //     Valeur false: le fichier est dtach

        CMSSignedData signedData = signGen.generate(content, true, "BC");
        byte[] signeddata = signedData.getEncoded();

        // Ecriture du buffer dans un fichier.   

        if (sod.equals("")) {
            System.out.print(signeddata.toString());
        } else {
            FileOutputStream envfos = new FileOutputStream(sod);
            envfos.write(signeddata);
            envfos.close();
        }

    } catch (OptionException oe) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(NAME, getOptions());
        System.exit(-1);
    } catch (Exception e) {
        e.printStackTrace();
        return;
    }

}

From source file:com.bluexml.tools.miscellaneous.PrepareSIDEModulesMigration.java

/**
 * @param args//from ww  w.  j a  v a2 s  .  c o m
 */
public static void main(String[] args) {
    boolean inplace = false;

    String workspace = "/Users/davidabad/workspaces/SIDE-Modules/";
    String frameworkmodulesPath = "/Volumes/Data/SVN/side/HEAD/S-IDE/FrameworksModules/trunk/";
    String classifier_base = "enterprise";
    String version_base = "3.4.6";
    String classifier_target = "enterprise";
    String version_target = "3.4.11";
    String frameworkmodulesInplace = "/Volumes/Data/SVN/projects/Ifremer/IfremerV5/src/modules/mavenProjects";

    Properties props = new Properties();
    try {
        InputStream resourceAsStream = PrepareSIDEModulesMigration.class
                .getResourceAsStream("config.properties");
        if (resourceAsStream != null) {
            props.load(resourceAsStream);

            inplace = Boolean.parseBoolean(props.getProperty("inplace", Boolean.toString(inplace)));
            workspace = props.getProperty("workspace", workspace);
            frameworkmodulesPath = props.getProperty("frameworkmodulesPath", frameworkmodulesPath);
            classifier_base = props.getProperty("classifier_base", classifier_base);
            version_base = props.getProperty("version_base", version_base);
            classifier_target = props.getProperty("classifier_target", classifier_target);
            version_target = props.getProperty("version_target", version_target);
            frameworkmodulesInplace = props.getProperty("frameworkmodulesInplace", frameworkmodulesInplace);
        } else {
            System.out.println("no configuration founded in classpath config.properties");
        }

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return;
    }

    System.out.println("properties :");
    Enumeration<?> propertyNames = props.propertyNames();
    while (propertyNames.hasMoreElements()) {
        String nextElement = propertyNames.nextElement().toString();
        System.out.println("\t " + nextElement + " : " + props.getProperty(nextElement));
    }

    File workspaceFile = new File(workspace);

    File targetHome = new File(workspaceFile, MIGRATION_FOLDER);
    if (targetHome.exists()) {
        try {
            FileUtils.deleteDirectory(targetHome);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }

    final String versionInProjectName = getVersionInProjectName(classifier_base, version_base);
    String versionInProjectName2 = getVersionInProjectName(classifier_target, version_target);

    if (frameworkmodulesPath.contains(",")) {
        // this is a list of paths
        String[] split = frameworkmodulesPath.split(",");
        for (String string : split) {
            if (StringUtils.trimToNull(string) != null) {
                executeInpath(inplace, string, classifier_base, version_base, classifier_target, version_target,
                        frameworkmodulesInplace, workspaceFile, versionInProjectName, versionInProjectName2);
            }
        }
    } else {
        executeInpath(inplace, frameworkmodulesPath, classifier_base, version_base, classifier_target,
                version_target, frameworkmodulesInplace, workspaceFile, versionInProjectName,
                versionInProjectName2);
    }

    System.out.println("Job's done !");
    System.out.println("Please check " + MIGRATION_FOLDER);
    System.out.println(
            "If all is ok you can use commit.sh in a terminal do : cd " + MIGRATION_FOLDER + "; sh commit.sh");
    System.out.println(
            "This script will create new svn projet and commit resources, add 'target' to svn:ignore ...");

}

From source file:kilim.tools.DumpClass.java

public static void main(String[] args) throws IOException {
    String name = args.length == 2 ? args[1] : args[0];

    if (name.endsWith(".jar")) {
        try {/*from w w  w  .  j av  a 2s.c  om*/
            Enumeration<JarEntry> e = new JarFile(name).entries();
            while (e.hasMoreElements()) {
                ZipEntry en = (ZipEntry) e.nextElement();
                String n = en.getName();
                if (!n.endsWith(".class"))
                    continue;
                n = n.substring(0, n.length() - 6).replace('/', '.');
                new DumpClass(n);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        new DumpClass(name);
    }
}

From source file:ReadTemp.java

/**
 * Method main//from   ww w.  j av  a 2 s  . c om
 *
 *
 * @param args
 *
 * @throws OneWireException
 * @throws OneWireIOException
 *
 */
public static void main(String[] args) throws OneWireIOException, OneWireException {
    boolean usedefault = false;
    DSPortAdapter access = null;
    String adapter_name = null;
    String port_name = null;

    variableNames = new HashMap();

    if ((args == null) || (args.length < 1)) {
        try {
            access = OneWireAccessProvider.getDefaultAdapter();

            if (access == null)
                throw new Exception();
        } catch (Exception e) {
            System.out.println("Couldn't get default adapter!");
            printUsageString();

            return;
        }

        usedefault = true;
    }

    if (!usedefault) {
        StringTokenizer st = new StringTokenizer(args[0], "_");

        if (st.countTokens() != 2) {
            printUsageString();

            return;
        }

        adapter_name = st.nextToken();
        port_name = st.nextToken();

        System.out.println("Adapter Name: " + adapter_name);
        System.out.println("Port Name: " + port_name);
    }

    if (access == null) {
        try {
            access = OneWireAccessProvider.getAdapter(adapter_name, port_name);
        } catch (Exception e) {
            System.out.println("That is not a valid adapter/port combination.");

            Enumeration en = OneWireAccessProvider.enumerateAllAdapters();

            while (en.hasMoreElements()) {
                DSPortAdapter temp = (DSPortAdapter) en.nextElement();

                System.out.println("Adapter: " + temp.getAdapterName());

                Enumeration f = temp.getPortNames();

                while (f.hasMoreElements()) {
                    System.out.println("   Port name : " + ((String) f.nextElement()));
                }
            }

            return;
        }
    }

    boolean scan = false;

    if (args.length > 1) {
        if (args[1].compareTo("--scan") == 0)
            scan = true;
    } else {
        populateVariableNames();
    }

    while (true) {
        access.adapterDetected();
        access.targetAllFamilies();
        access.beginExclusive(true);
        access.reset();
        access.setSearchAllDevices();

        boolean next = access.findFirstDevice();

        if (!next) {
            System.out.println("Could not find any iButtons!");

            return;
        }

        while (next) {
            OneWireContainer owc = access.getDeviceContainer();

            boolean isTempContainer = false;
            TemperatureContainer tc = null;

            try {
                tc = (TemperatureContainer) owc;
                isTempContainer = true;
            } catch (Exception e) {
                tc = null;
                isTempContainer = false; //just to reiterate
            }

            if (isTempContainer) {
                String id = owc.getAddressAsString();
                if (scan) {
                    System.out.println("= Temperature Sensor Found: " + id);
                } else {

                    double high = 0.0;
                    double low = 0.0;
                    byte[] state = tc.readDevice();

                    boolean selectable = tc.hasSelectableTemperatureResolution();

                    if (selectable)
                        try {
                            tc.setTemperatureResolution(0.0625, state);
                        } catch (Exception e) {
                            System.out.println("= Could not set resolution for " + id + ": " + e.toString());
                        }

                    try {
                        tc.writeDevice(state);
                    } catch (Exception e) {
                        System.out.println("= Could not write device state, all changes lost.");
                        System.out.println("= Exception occurred for " + id + ": " + e.toString());
                    }

                    boolean conversion = false;
                    try {
                        tc.doTemperatureConvert(state);
                        conversion = true;
                    } catch (Exception e) {
                        System.out.println("= Could not complete temperature conversion...");
                        System.out.println("= Exception occurred for " + id + ": " + e.toString());
                    }

                    if (conversion) {
                        state = tc.readDevice();

                        double temp = tc.getTemperature(state);
                        if (temp < 84) {
                            double temp_f = (9.0 / 5.0) * temp + 32;
                            setVariable(id, Double.toString(temp_f));
                        }
                        System.out.println("= Reported temperature from " + (String) variableNames.get(id) + "("
                                + id + "):" + temp);
                    }
                }
            }
            next = access.findNextDevice();
        }
        if (!scan) {
            try {
                Thread.sleep(60 * 5 * 1000);
            } catch (Exception e) {
            }
        } else {
            System.exit(0);
        }
    }
}

From source file:PropsToXML.java

/**
 * <p>Provide a static entry point for testing.</p>
 *//* ww  w  .j a  v  a  2s  .  co  m*/
public static void main(String[] args) {
    if (args.length != 2) {
        System.out.println("Usage: java TestXMLProperties " + "[XML input document] [XML output document]");
        System.exit(0);
    }

    try {
        // Create and load properties
        System.out.println("Reading XML properties from " + args[0]);
        XMLProperties props = new XMLProperties();
        props.load(new FileInputStream(args[0]));

        // Print out properties and values
        System.out.println("\n\n---- Property Values ----");
        Enumeration names = props.propertyNames();
        while (names.hasMoreElements()) {
            String name = (String) names.nextElement();
            String value = props.getProperty(name);
            System.out.println("Property Name: " + name + " has value " + value);
        }

        // Store properties
        System.out.println("\n\nWriting XML properies to " + args[1]);
        props.store(new FileOutputStream(args[1]), "Testing XMLProperties class");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:maui.main.MauiModelBuilder.java

/**
 * The main method.  /*from   w  w w.java 2s  .com*/
 */
public static void main(String[] ops) {

    MauiModelBuilder modelBuilder = new MauiModelBuilder();

    try {

        modelBuilder.setOptions(ops);

        // Output what options are used
        if (modelBuilder.getDebug() == true) {
            System.err.print("Building model with options: ");
            String[] optionSettings = modelBuilder.getOptions();
            for (String optionSetting : optionSettings) {
                System.err.print(optionSetting + " ");
            }
            System.err.println();
        }

        HashSet<String> fileNames = modelBuilder.collectStems();
        modelBuilder.buildModel(fileNames);

        if (modelBuilder.getDebug() == true) {
            System.err.print("Model built. Saving the model...");
        }

        modelBuilder.saveModel();

        System.err.print("Done!");

    } catch (Exception e) {

        // Output information on how to use this class
        e.printStackTrace();
        System.err.println(e.getMessage());
        System.err.println("\nOptions:\n");
        Enumeration<Option> en = modelBuilder.listOptions();
        while (en.hasMoreElements()) {
            Option option = (Option) en.nextElement();
            System.err.println(option.synopsis());
            System.err.println(option.description());
        }
    }
}

From source file:maui.main.MauiTopicExtractor.java

/**
 * The main method.  /*from   ww w.  ja v  a 2 s.co  m*/
 */
public static void main(String[] ops) {

    MauiTopicExtractor topicExtractor = new MauiTopicExtractor();
    try {
        // Checking and Setting Options selected by the user:
        topicExtractor.setOptions(ops);
        System.err.print("Extracting keyphrases with options: ");

        // Reading Options, which were set above and output them:
        String[] optionSettings = topicExtractor.getOptions();
        for (int i = 0; i < optionSettings.length; i++) {
            System.err.print(optionSettings[i] + " ");
        }
        System.err.println();

        // Loading selected Model:
        System.err.println("-- Loading the model... ");
        topicExtractor.loadModel();

        // Extracting Keyphrases from all files in the selected directory
        topicExtractor.extractKeyphrases(topicExtractor.collectStems());

    } catch (Exception e) {

        // Output information on how to use this class
        e.printStackTrace();
        System.err.println(e.getMessage());
        System.err.println("\nOptions:\n");
        Enumeration<Option> en = topicExtractor.listOptions();
        while (en.hasMoreElements()) {
            Option option = (Option) en.nextElement();
            System.err.println(option.synopsis());
            System.err.println(option.description());
        }
    }
}