Example usage for java.lang Exception getMessage

List of usage examples for java.lang Exception getMessage

Introduction

In this page you can find the example usage for java.lang Exception getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.eclipse.lyo.client.oslc.samples.RQMFormSample.java

/**
 * Login to the RQM server and perform some OSLC actions
 * @param args//from w ww.j ava  2  s  .c o  m
 * @throws ParseException 
 */
public static void main(String[] args) throws ParseException {

    Options options = new Options();

    options.addOption("url", true, "url");
    options.addOption("user", true, "user ID");
    options.addOption("password", true, "password");
    options.addOption("project", true, "project area");

    CommandLineParser cliParser = new GnuParser();

    //Parse the command line
    CommandLine cmd = cliParser.parse(options, args);

    if (!validateOptions(cmd)) {
        logger.severe(
                "Syntax:  java <class_name> -url https://<server>:port/<context>/ -user <user> -password <password> -project \"<project_area>\"");
        logger.severe(
                "Example: java RQMFormSample -url https://exmple.com:9443/ccm -user ADMIN -password ADMIN -project \"JKE Banking (Quality Management)\"");
        return;
    }

    String webContextUrl = cmd.getOptionValue("url");
    String user = cmd.getOptionValue("user");
    String passwd = cmd.getOptionValue("password");
    String projectArea = cmd.getOptionValue("project");

    try {

        //STEP 1: Initialize a Jazz rootservices helper and indicate we're looking for the QualityManagement catalog
        //RQM contains both Quality and Change Management providers, so need to look for QM specifically
        JazzRootServicesHelper helper = new JazzRootServicesHelper(webContextUrl, OSLCConstants.OSLC_QM_V2);

        //STEP 2: Create a new Form Auth client with the supplied user/password
        JazzFormAuthClient client = helper.initFormClient(user, passwd);

        //STEP 3: Login in to Jazz Server
        if (client.formLogin() == HttpStatus.SC_OK) {

            //STEP 4: Get the URL of the OSLC QualityManagement catalog
            String catalogUrl = helper.getCatalogUrl();

            //STEP 5: Find the OSLC Service Provider for the project area we want to work with
            String serviceProviderUrl = client.lookupServiceProviderUrl(catalogUrl, projectArea);

            //STEP 6: Get the Query Capabilities URL so that we can run some OSLC queries
            String queryCapability = client.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_QM_V2,
                    OSLCConstants.QM_TEST_RESULT_QUERY);

            //SCENARIO A: Run a query for all TestResults with a status of passed with OSLC paging of 10 items per
            //page turned on and list the members of the result
            OslcQueryParameters queryParams = new OslcQueryParameters();
            queryParams.setWhere("oslc_qm:status=\"com.ibm.rqm.execution.common.state.passed\"");
            OslcQuery query = new OslcQuery(client, queryCapability, 10, queryParams);

            OslcQueryResult result = query.submit();

            boolean processAsJavaObjects = true;
            processPagedQueryResults(result, client, processAsJavaObjects);

            System.out.println("\n------------------------------\n");

            //SCENARIO B:  Run a query for a specific TestResult selecting only certain 
            //attributes and then print it as raw XML.  Change the dcterms:title below to match a 
            //real TestResult in your RQM project area
            OslcQueryParameters queryParams2 = new OslcQueryParameters();
            queryParams2
                    .setWhere("dcterms:title=\"Consistent_display_of_currency_Firefox_DB2_WAS_Windows_S1\"");
            queryParams2.setSelect(
                    "dcterms:identifier,dcterms:title,dcterms:creator,dcterms:created,oslc_qm:status");
            OslcQuery query2 = new OslcQuery(client, queryCapability, queryParams2);

            OslcQueryResult result2 = query2.submit();
            ClientResponse rawResponse = result2.getRawResponse();
            processRawResponse(rawResponse);
            rawResponse.consumeContent();

            //SCENARIO C:  RQM TestCase creation and update
            TestCase testcase = new TestCase();
            testcase.setTitle("Accessibility verification using a screen reader");
            testcase.setDescription(
                    "This test case uses a screen reader application to ensure that the web browser content fully complies with accessibility standards");
            testcase.addTestsChangeRequest(new Link(new URI("http://cmprovider/changerequest/1"),
                    "Implement accessibility in Pet Store application"));

            //Get the Creation Factory URL for test cases so that we can create a test case
            String testcaseCreation = client.lookupCreationFactory(serviceProviderUrl, OSLCConstants.OSLC_QM_V2,
                    testcase.getRdfTypes()[0].toString());

            //Create the test case
            ClientResponse creationResponse = client.createResource(testcaseCreation, testcase,
                    OslcMediaType.APPLICATION_RDF_XML);
            creationResponse.consumeContent();
            String testcaseLocation = creationResponse.getHeaders().getFirst(HttpHeaders.LOCATION);
            System.out.println("Test Case created a location " + testcaseLocation);

            //Get the test case from the service provider and update its title property 
            testcase = client.getResource(testcaseLocation, OslcMediaType.APPLICATION_RDF_XML)
                    .getEntity(TestCase.class);
            testcase.setTitle(testcase.getTitle() + " (updated)");

            //Create a partial update URL so that only the title will be updated.
            //Assuming (for readability) that the test case URL does not already contain a '?'
            String updateUrl = testcase.getAbout() + "?oslc.properties=dcterms:title";

            //Update the test case at the service provider
            client.updateResource(updateUrl, testcase, OslcMediaType.APPLICATION_RDF_XML).consumeContent();

        }
    } catch (RootServicesException re) {
        logger.log(Level.SEVERE,
                "Unable to access the Jazz rootservices document at: " + webContextUrl + "/rootservices", re);
    } catch (Exception e) {
        logger.log(Level.SEVERE, e.getMessage(), e);
    }

}

From source file:es.tid.cosmos.platform.injection.server.InjectionServerMain.java

/**
 * //ww w .j ava 2 s .  c  o m
 * @param args
 * @throws ConfigurationException
 */
public static void main(String[] args) throws ConfigurationException {
    ServerCommandLine commandLine = new ServerCommandLine();

    try {
        commandLine.parse(args);
    } catch (ParseException e) {
        commandLine.printUsage();
        System.exit(1);
    } // try catch

    String externalConfiguration = DEFAULT_EXTERNAL_CONFIGURATION;

    if (commandLine.hasConfigFile()) {
        externalConfiguration = commandLine.getConfigFile();
    } // if

    Configuration config;

    try {
        config = new Configuration(new File(externalConfiguration).toURI().toURL());
    } catch (Exception ex) {
        config = new Configuration(InjectionServerMain.class.getResource(INTERNAL_CONFIGURATION));
    } // try catch

    try {
        InjectionServer server = new InjectionServer(config);
        server.setupSftpServer();
    } catch (Exception ex) {
        LOG.error(ex.getMessage(), ex);
        System.exit(1);
    } // try catch
}

From source file:com.genentech.chemistry.tool.align.SDFAlign.java

public static void main(String... args) {
    Options options = new Options();
    Option opt = new Option("in", true, "input sd file");
    opt.setRequired(true);/*w w  w .  ja  v  a  2s .c o  m*/
    options.addOption(opt);

    opt = new Option("out", true, "output file");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("method", true, "fss|sss|MCS|clique (default mcs).");
    options.addOption(opt);

    opt = new Option("ref", true,
            "reference molecule if not given first in file is used. If multiple ref molecules are read the min RMSD is reported");
    options.addOption(opt);

    opt = new Option("mirror", false, "If given and the molecule is not chiral, return best mirror image.");
    options.addOption(opt);

    opt = new Option("rmsdTag", true, "Tagname for output of rmsd, default: no output.");
    options.addOption(opt);

    opt = new Option("atomMatch", true,
            "Sequence of none|default|hcount|noAromatic specifing how atoms are matched cf. oe document.\n"
                    + "noAromatic can be used to make terminal atoms match aliphatic and aromatic atoms.\n"
                    + "Queryfeatures are considered only if default is used.");
    options.addOption(opt);

    opt = new Option("bondMatch", true,
            "Sequence of none|default specifing how bonds are matched cf. oe document.");
    options.addOption(opt);

    opt = new Option("keepCoreHydrogens", false,
            "If not specified the hydrigen atoms are removed from the core.");
    options.addOption(opt);

    opt = new Option("outputMol", true, "aligned|original (def: aligned) use original to just compute rmsd.");
    options.addOption(opt);

    opt = new Option("doNotOptimize", false,
            "If specified the RMSD is computed without moving optimizing the overlay.");
    options.addOption(opt);

    opt = new Option("quiet", false, "Reduced warining messages");
    options.addOption(opt);

    CommandLineParser parser = new BasicParser();
    CommandLine cmd = null;
    try {
        cmd = parser.parse(options, args);
    } catch (Exception e) {
        exitWithHelp(e.getMessage(), options);
    }

    if (cmd.getArgs().length > 0)
        exitWithHelp("To many arguments", options);

    // do not check aromaticity on atoms so that a terminal atom matches aromatic and non aromatic atoms
    int atomExpr = OEExprOpts.DefaultAtoms;
    int bondExpr = OEExprOpts.DefaultBonds;

    String atomMatch = cmd.getOptionValue("atomMatch");
    if (atomMatch == null)
        atomMatch = "";
    atomMatch = '|' + atomMatch.toLowerCase() + '|';

    String bondMatch = cmd.getOptionValue("bondMatch");
    if (bondMatch == null)
        bondMatch = "";
    bondMatch = '|' + bondMatch.toLowerCase() + '|';

    String inFile = cmd.getOptionValue("in");
    String outFile = cmd.getOptionValue("out");
    String refFile = cmd.getOptionValue("ref");
    String method = cmd.getOptionValue("method");
    String rmsdTag = cmd.getOptionValue("rmsdTag");
    String oMol = cmd.getOptionValue("outputMol");
    boolean doMirror = cmd.hasOption("mirror");
    boolean doOptimize = !cmd.hasOption("doNotOptimize");
    boolean quiet = cmd.hasOption("quiet");

    OUTType outputMol = oMol == null ? OUTType.ALIGNED : OUTType.valueOf(oMol.toUpperCase());

    if (atomMatch.startsWith("|none"))
        atomExpr = 0;
    if (atomMatch.contains("|hcount|"))
        atomExpr |= OEExprOpts.HCount;
    if (atomMatch.contains("|noAromatic|"))
        atomExpr &= (~OEExprOpts.Aromaticity);

    if (bondMatch.startsWith("|none"))
        bondExpr = 0;

    ArrayList<OEMol> refmols = new ArrayList<OEMol>();
    if (refFile != null) {
        oemolistream reffs = new oemolistream(refFile);
        if (!is3DFormat(reffs.GetFormat()))
            oechem.OEThrow.Fatal("Invalid input format: need 3D coordinates");
        reffs.SetFormat(OEFormat.MDL);

        int aromodel = OEIFlavor.Generic.OEAroModelOpenEye;
        int qflavor = reffs.GetFlavor(reffs.GetFormat());
        reffs.SetFlavor(reffs.GetFormat(), (qflavor | aromodel));

        OEMol rmol = new OEMol();
        while (oechem.OEReadMDLQueryFile(reffs, rmol)) {
            if (!cmd.hasOption("keepCoreHydrogens"))
                oechem.OESuppressHydrogens(rmol);
            refmols.add(rmol);
            rmol = new OEMol();
        }
        rmol.delete();

        if (refmols.size() == 0)
            throw new Error("reference file had no entries");

        reffs.close();
    }

    oemolistream fitfs = new oemolistream(inFile);
    if (!is3DFormat(fitfs.GetFormat()))
        oechem.OEThrow.Fatal("Invalid input format: need 3D coordinates");

    oemolostream ofs = new oemolostream(outFile);
    if (!is3DFormat(ofs.GetFormat()))
        oechem.OEThrow.Fatal("Invalid output format: need 3D coordinates");

    AlignInterface aligner = null;
    OEGraphMol fitmol = new OEGraphMol();

    if (oechem.OEReadMolecule(fitfs, fitmol)) {
        if (refmols.size() == 0) {
            OEMol rmol = new OEMol(fitmol);
            if (!cmd.hasOption("keepCoreHydrogens"))
                oechem.OESuppressHydrogens(rmol);

            refmols.add(rmol);
        }

        if ("sss".equalsIgnoreCase(method)) {
            aligner = new SSSAlign(refmols, outputMol, rmsdTag, doOptimize, doMirror, atomExpr, bondExpr,
                    quiet);

        } else if ("clique".equalsIgnoreCase(method)) {
            aligner = new CliqueAlign(refmols, outputMol, rmsdTag, doOptimize, doMirror, atomExpr, bondExpr,
                    quiet);

        } else if ("fss".equalsIgnoreCase(method)) {
            if (cmd.hasOption("atomMatch") || cmd.hasOption("bondMatch"))
                exitWithHelp("method fss does not support '-atomMatch' or '-bondMatch'", options);
            aligner = new FSSAlign(refmols, outputMol, rmsdTag, doOptimize, doMirror);

        } else {
            aligner = new McsAlign(refmols, outputMol, rmsdTag, doOptimize, doMirror, atomExpr, bondExpr,
                    quiet);
        }

        do {
            aligner.align(fitmol);
            oechem.OEWriteMolecule(ofs, fitmol);
        } while (oechem.OEReadMolecule(fitfs, fitmol));

    }

    fitmol.delete();
    if (aligner != null)
        aligner.close();
    for (OEMolBase mol : refmols)
        mol.delete();
    fitfs.close();
    ofs.close();
}

From source file:se.berazy.api.examples.App.java

/**
 * Operation examples./* ww w. j a  va2 s  . co m*/
 * @param args
 */
public static void main(String[] args) {
    Scanner scanner = null;
    try {
        client = new BookkeepingClient();
        System.out.println("Choose operation to invoke:\n");
        System.out.println("1. Create invoice");
        System.out.println("2. Credit invoice");
        scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            line = (line != null) ? line.trim().toLowerCase() : "";
            if (line.equals("1")) {
                outPutResponse(createInvoice());
            } else if (line.equals("2")) {
                outPutResponse(creditInvoice());
            } else if (line.equals("q") || line.equals("quit") || line.equals("exit")) {
                System.exit(0);
            } else {
                System.out.println("\nPlease choose an operation from 1-7.");
            }
        }
        scanner.close();
    } catch (Exception ex) {
        System.out.println(String.format(
                "\nAn exception occured, press CTRL+C to exit or enter 'q', 'quit' or 'exit'.\n\nException: %s %s",
                ex.getMessage(), ex.getStackTrace()));
    } finally {
        if (scanner != null) {
            scanner.close();
        }
    }
}

From source file:com.genentech.chemistry.openEye.apps.enumerate.SDFEnumerator.java

public static void main(String... args) throws IOException {
    Options options = new Options();
    Option opt = new Option("out", true, "output file oe-supported");
    opt.setRequired(true);//from ww w.j av a 2  s  . c o m
    options.addOption(opt);

    opt = new Option("hydrogenExplicit", false, "Use explicit hydrogens");
    options.addOption(opt);

    opt = new Option("correctValences", false, "Correct valences after the enumeration");
    options.addOption(opt);

    opt = new Option("regenerate2D", false, "Regenerate 2D coordinates for the products");
    options.addOption(opt);

    opt = new Option("reactAllSites", false, "Generate a product for each match in a reagent.");
    options.addOption(opt);

    opt = new Option("randomFraction", true, "Only output a fraction of the products.");
    options.addOption(opt);

    opt = new Option("maxAtoms", true, "Only output products with <= maxAtoms.");
    options.addOption(opt);

    opt = new Option("notReacted", true,
            "Output file for reagents that didn't produce at leaste one output molecule, useful for debugging SMIRKS.");
    options.addOption(opt);

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = null;
    try {
        cmd = parser.parse(options, args);
    } catch (Exception e) {
        System.err.println(e.getMessage());
        exitWithHelp("", options);
    }

    args = cmd.getArgs();
    if (args.length < 2) {
        exitWithHelp("Transformation and/or reagentFiles missing", options);
    }
    String smirks = args[0];
    if (new File(smirks).canRead())
        smirks = IOUtil.fileToString(smirks).trim();
    if (!smirks.contains(">>"))
        smirks = scaffoldToSmirks(smirks);
    String[] reagentSmiOrFiles = Arrays.copyOfRange(args, 1, args.length);

    if (cmd.hasOption("d")) {
        System.err.println("Start debugger and press return:");
        new BufferedReader(new InputStreamReader(System.in)).readLine();
    }

    String outFile = cmd.getOptionValue("out");
    OELibraryGen lg = new OELibraryGen();
    lg.Init(smirks);
    if (!lg.IsValid())
        exitWithHelp("Invalid Transform: " + smirks, options);

    lg.SetExplicitHydrogens(cmd.hasOption("hydrogenExplicit"));
    lg.SetValenceCorrection(cmd.hasOption("correctValences"));
    lg.SetRemoveUnmappedFragments(true);

    boolean regenerate2D = cmd.hasOption("regenerate2D");
    boolean reactAllSites = cmd.hasOption("reactAllSites");
    String unreactedFile = null;
    if (cmd.hasOption("notReacted")) {
        unreactedFile = cmd.getOptionValue("notReacted");
    }

    double randomFract = 2;
    if (cmd.hasOption("randomFraction"))
        randomFract = Double.parseDouble(cmd.getOptionValue("randomFraction"));

    int maxAtoms = 0;
    if (cmd.hasOption("maxAtoms"))
        maxAtoms = Integer.parseInt(cmd.getOptionValue("maxAtoms"));

    SDFEnumerator en = new SDFEnumerator(lg, reactAllSites, reagentSmiOrFiles);
    en.generateLibrary(outFile, maxAtoms, randomFract, regenerate2D, unreactedFile);
    en.delete();
}

From source file:com.xlson.standalonewar.Starter.java

/**
 * @param args the command line arguments
 *///from w w  w  .j  a  va 2s  .  c  o  m
public static void main(String[] args) {
    try {
        defaultProperties = new PropertiesConfiguration(
                Starter.class.getClassLoader().getResource("webserver.properties").toURI().toURL());

        appendClasspath(defaultProperties.getList("webserver.extraClasspath"));

        config = loadConfig();

        final String PROP_NAME_WEBSERVER_TIMEOUT = defaultProperties.getString("PROP_NAME_WEBSERVER_TIMEOUT",
                "webserver.timeout");
        int timeout = Integer.parseInt(getString(PROP_NAME_WEBSERVER_TIMEOUT, "0"));
        start();
        if (timeout != 0) {
            Thread.sleep(timeout);
            stop();
        }
    } catch (Exception ex) {
        logger.error("error", ex);
        System.err.println(ex.getMessage());
        System.exit(-1);
    }
}

From source file:com.genentech.chemistry.tool.mm.SDFMMMinimize.java

/**
 * Main function for running on the command line
 * @param args//from  w  w  w  . ja v a  2s .  c o m
 */
public static void main(String... args) throws IOException {
    // Get the available options from the programs
    Map<String, List<String>> allowedProgramsAndForceFields = getAllowedProgramsAndForceFields();
    Map<String, List<String>> allowedProgramsAndSolvents = getAllowedProgramsAndSolvents();

    // create command line Options object
    Options options = new Options();
    Option opt = new Option(OPT_INFILE, true,
            "input file oe-supported Use .sdf|.smi to specify the file type.");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option(OPT_OUTFILE, true, "output file oe-supported. Use .sdf|.smi to specify the file type.");
    opt.setRequired(true);
    options.addOption(opt);

    StringBuilder programOptions = new StringBuilder("Program to use for minimization.  Choices are\n");

    for (String program : allowedProgramsAndForceFields.keySet()) {
        programOptions.append("\n***   -program " + program + "   ***\n");
        String forcefields = "";
        for (String option : allowedProgramsAndForceFields.get(program)) {
            forcefields += option + " ";
        }
        programOptions.append("-forcefield " + forcefields + "\n");

        String solvents = "";
        for (String option : allowedProgramsAndSolvents.get(program)) {
            solvents += option + " ";
        }
        programOptions.append("-solvent " + solvents + "\n");
    }

    opt = new Option(OPT_PROGRAM, true, programOptions.toString());
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option(OPT_FORCEFIELD, true, "Forcefield options.  See -program for choices");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option(OPT_SOLVENT, true, "Solvent options.  See -program for choices");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option(OPT_FIXED_ATOM_TAG, true, "SD tag name which contains the atom numbers to be held fixed.");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option(OPT_FIX_TORSION, true,
            "true/false. if true, the atoms in fixedAtomTag contains 4 indices of atoms defining a torsion angle to be held fixed");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option(OPT_WORKING_DIR, true, "Working directory to put files.");
    opt.setRequired(false);
    options.addOption(opt);

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = null;
    try {
        cmd = parser.parse(options, args);
    } catch (Exception e) {
        System.err.println(e.getMessage());
        exitWithHelp(options);
    }
    args = cmd.getArgs();

    if (args.length != 0) {
        System.err.println("Unknown arguments" + args);
        exitWithHelp(options);
    }

    if (cmd.hasOption("d")) {
        System.err.println("Start debugger and press return:");
        new BufferedReader(new InputStreamReader(System.in)).readLine();
    }

    String inFile = cmd.getOptionValue(OPT_INFILE);
    String outFile = cmd.getOptionValue(OPT_OUTFILE);
    String fixedAtomTag = cmd.getOptionValue(OPT_FIXED_ATOM_TAG);
    boolean fixTorsion = (cmd.getOptionValue(OPT_FIX_TORSION) != null
            && cmd.getOptionValue(OPT_FIX_TORSION).equalsIgnoreCase("true"));
    String programName = cmd.getOptionValue(OPT_PROGRAM);
    String forcefield = cmd.getOptionValue(OPT_FORCEFIELD);
    String solvent = cmd.getOptionValue(OPT_SOLVENT);
    String workDir = cmd.getOptionValue(OPT_WORKING_DIR);

    if (workDir == null || workDir.trim().length() == 0)
        workDir = ".";

    // Create a minimizer 
    SDFMMMinimize minimizer = new SDFMMMinimize();
    minimizer.setMethod(programName, forcefield, solvent);
    minimizer.run(inFile, outFile, fixedAtomTag, fixTorsion, workDir);
    minimizer.close();
    System.err.println("Minimization complete.");
}

From source file:com.marklogic.contentpump.ContentPump.java

public static void main(String[] args) throws Exception {
    if (args.length == 0) {
        printUsage();// www  .ja  v a2  s  .c  o m
        System.exit(1);
    }

    String[] expandedArgs = null;
    int rc = 1;
    try {
        expandedArgs = OptionsFileUtil.expandArguments(args);
        rc = runCommand(expandedArgs);
    } catch (Exception ex) {
        LOG.error("Error while expanding arguments", ex);
        System.err.println(ex.getMessage());
        System.err.println("Try 'mlcp help' for usage.");
    }

    System.exit(rc);
}

From source file:edu.msu.cme.rdp.seqmatch.cli.SeqmatchCheckRevSeq.java

public static void main(String[] args) throws Exception {

    String trainingFile = null;//from   w w w  .j a  va 2  s . c  o  m
    String queryFile = null;
    String outputFile = null;
    PrintWriter revOutputWriter = new PrintWriter(System.out);
    PrintStream correctedQueryOut = System.out;
    String traineeDesc = null;
    int numOfResults = 20;
    boolean checkReverse = false;

    float diffScoreCutoff = CheckReverseSeq.DIFF_SCORE_CUTOFF;
    String format = "txt"; // default

    try {
        CommandLine line = new PosixParser().parse(options, args);

        if (line.hasOption("c")) {
            checkReverse = true;
        }

        if (line.hasOption("t")) {
            trainingFile = line.getOptionValue("t");
        } else {
            throw new Exception("training file must be specified");
        }
        if (line.hasOption("q")) {
            queryFile = line.getOptionValue("q");
        } else {
            throw new Exception("query file must be specified");
        }
        if (line.hasOption("o")) {
            outputFile = line.getOptionValue("o");
        } else {
            throw new Exception("output file must be specified");
        }
        if (line.hasOption("r")) {
            revOutputWriter = new PrintWriter(line.getOptionValue("r"));
        }
        if (line.hasOption("s")) {
            correctedQueryOut = new PrintStream(line.getOptionValue("s"));
        }
        if (line.hasOption("d")) {
            diffScoreCutoff = Float.parseFloat(line.getOptionValue("d"));
        }
        if (line.hasOption("h")) {
            traineeDesc = line.getOptionValue("h");
        }
        if (line.hasOption("n")) {
            numOfResults = Integer.parseInt(line.getOptionValue("n"));
        }
        if (line.hasOption("f")) {
            format = line.getOptionValue("f");
            if (!format.equals("tab") && !format.equals("dbformat") && !format.equals("xml")) {
                throw new IllegalArgumentException("Only dbformat, tab or xml format available");
            }
        }

    } catch (Exception e) {
        System.out.println("Command Error: " + e.getMessage());
        new HelpFormatter().printHelp(120, "SeqmatchCheckRevSeq", "", options, "", true);
        return;
    }

    SeqmatchCheckRevSeq theObj = new SeqmatchCheckRevSeq();

    if (!checkReverse) {
        theObj.doUserLibMatch(queryFile, trainingFile, outputFile, numOfResults, format, traineeDesc);
    } else {
        theObj.checkRevSeq(queryFile, trainingFile, outputFile, revOutputWriter, correctedQueryOut,
                diffScoreCutoff, format, traineeDesc);
    }
}

From source file:com.microsoft.azure.management.network.samples.ManageInternalLoadBalancer.java

/**
 * Main entry point.//from   ww w  .j a  v  a 2  s.  c  o  m
 * @param args parameters.\
 */

public static void main(String[] args) {
    try {

        //=============================================================
        // Authenticate

        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));

        Azure azure = Azure.configure().withLogLevel(LogLevel.BODY).authenticate(credFile)
                .withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}