Example usage for java.lang Exception Exception

List of usage examples for java.lang Exception Exception

Introduction

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

Prototype

public Exception(Throwable cause) 

Source Link

Document

Constructs a new exception with the specified cause and a detail message of (cause==null ?

Usage

From source file:com.ibm.crail.storage.StorageServer.java

public static void main(String[] args) throws Exception {
    Logger LOG = CrailUtils.getLogger();
    CrailConfiguration conf = new CrailConfiguration();
    CrailConstants.updateConstants(conf);
    CrailConstants.printConf();/*from  w  ww .j a v  a  2 s . c om*/
    CrailConstants.verify();

    int splitIndex = 0;
    for (String param : args) {
        if (param.equalsIgnoreCase("--")) {
            break;
        }
        splitIndex++;
    }

    //default values
    StringTokenizer tokenizer = new StringTokenizer(CrailConstants.STORAGE_TYPES, ",");
    if (!tokenizer.hasMoreTokens()) {
        throw new Exception("No storage types defined!");
    }
    String storageName = tokenizer.nextToken();
    int storageType = 0;
    HashMap<String, Integer> storageTypes = new HashMap<String, Integer>();
    storageTypes.put(storageName, storageType);
    for (int type = 1; tokenizer.hasMoreElements(); type++) {
        String name = tokenizer.nextToken();
        storageTypes.put(name, type);
    }
    int storageClass = -1;

    //custom values
    if (args != null) {
        Option typeOption = Option.builder("t").desc("storage type to start").hasArg().build();
        Option classOption = Option.builder("c").desc("storage class the server will attach to").hasArg()
                .build();
        Options options = new Options();
        options.addOption(typeOption);
        options.addOption(classOption);
        CommandLineParser parser = new DefaultParser();

        try {
            CommandLine line = parser.parse(options, Arrays.copyOfRange(args, 0, splitIndex));
            if (line.hasOption(typeOption.getOpt())) {
                storageName = line.getOptionValue(typeOption.getOpt());
                storageType = storageTypes.get(storageName).intValue();
            }
            if (line.hasOption(classOption.getOpt())) {
                storageClass = Integer.parseInt(line.getOptionValue(classOption.getOpt()));
            }
        } catch (ParseException e) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("Storage tier", options);
            System.exit(-1);
        }
    }
    if (storageClass < 0) {
        storageClass = storageType;
    }

    StorageTier storageTier = StorageTier.createInstance(storageName);
    if (storageTier == null) {
        throw new Exception("Cannot instantiate datanode of type " + storageName);
    }

    String extraParams[] = null;
    splitIndex++;
    if (args.length > splitIndex) {
        extraParams = new String[args.length - splitIndex];
        for (int i = splitIndex; i < args.length; i++) {
            extraParams[i - splitIndex] = args[i];
        }
    }
    storageTier.init(conf, extraParams);
    storageTier.printConf(LOG);

    RpcClient rpcClient = RpcClient.createInstance(CrailConstants.NAMENODE_RPC_TYPE);
    rpcClient.init(conf, args);
    rpcClient.printConf(LOG);

    ConcurrentLinkedQueue<InetSocketAddress> namenodeList = CrailUtils.getNameNodeList();
    ConcurrentLinkedQueue<RpcConnection> connectionList = new ConcurrentLinkedQueue<RpcConnection>();
    while (!namenodeList.isEmpty()) {
        InetSocketAddress address = namenodeList.poll();
        RpcConnection connection = rpcClient.connect(address);
        connectionList.add(connection);
    }
    RpcConnection rpcConnection = connectionList.peek();
    if (connectionList.size() > 1) {
        rpcConnection = new RpcDispatcher(connectionList);
    }
    LOG.info("connected to namenode(s) " + rpcConnection.toString());

    StorageServer server = storageTier.launchServer();
    StorageRpcClient storageRpc = new StorageRpcClient(storageType, CrailStorageClass.get(storageClass),
            server.getAddress(), rpcConnection);

    HashMap<Long, Long> blockCount = new HashMap<Long, Long>();
    long sumCount = 0;
    while (server.isAlive()) {
        StorageResource resource = server.allocateResource();
        if (resource == null) {
            break;
        } else {
            storageRpc.setBlock(resource.getAddress(), resource.getLength(), resource.getKey());
            DataNodeStatistics stats = storageRpc.getDataNode();
            long newCount = stats.getFreeBlockCount();
            long serviceId = stats.getServiceId();

            long oldCount = 0;
            if (blockCount.containsKey(serviceId)) {
                oldCount = blockCount.get(serviceId);
            }
            long diffCount = newCount - oldCount;
            blockCount.put(serviceId, newCount);
            sumCount += diffCount;
            LOG.info("datanode statistics, freeBlocks " + sumCount);
        }
    }

    while (server.isAlive()) {
        DataNodeStatistics stats = storageRpc.getDataNode();
        long newCount = stats.getFreeBlockCount();
        long serviceId = stats.getServiceId();

        long oldCount = 0;
        if (blockCount.containsKey(serviceId)) {
            oldCount = blockCount.get(serviceId);
        }
        long diffCount = newCount - oldCount;
        blockCount.put(serviceId, newCount);
        sumCount += diffCount;

        LOG.info("datanode statistics, freeBlocks " + sumCount);
        Thread.sleep(2000);
    }
}

From source file:org.mzd.shap.spring.io.DescriptionEditor.java

/**
 * Convenience method for testing pattern matching.
 * @param args/*  w  ww  .  ja  va2s  .c o m*/
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    if (args.length != 2) {
        throw new Exception("Usage: [pattern] [description text]");
    }
    System.out.println("Pattern: " + args[0]);
    System.out.println("Descrip: " + args[1]);
    System.out.println("Result:  " + new DescriptionEditor(args[0]).getMinimalDescription(args[1]));
}

From source file:edu.msu.cme.rdp.kmer.KmerSearch.java

public static void main(String[] args) throws IOException {
    KmerTrie kmerTrie = null;//from  w  w  w . j  a v  a2 s.c  o  m
    SeqReader queryReader = null;
    SequenceType querySeqType = SequenceType.Unknown;
    FastaWriter out = null;
    boolean exhaustive = true;
    boolean translQuery = false;
    int wordSize = -1;
    int translTable = 11;

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

        if (args.length != 3) {
            throw new Exception("Unexpected number of arguments");
        }

        if (cmdLine.hasOption("out")) {
            out = new FastaWriter(cmdLine.getOptionValue("out"));
        } else {
            out = new FastaWriter(System.out);
        }

        if (cmdLine.hasOption("correct")) {
            exhaustive = false;
        } else {
            exhaustive = true;
        }

        if (cmdLine.hasOption("transl-table")) {
            translTable = Integer.valueOf(cmdLine.getOptionValue("transl-table"));
        }

        File trainingFile = new File(args[0]);
        wordSize = Integer.valueOf(args[1]);
        File queryFile = new File(args[2]);

        querySeqType = SeqUtils.guessSequenceType(queryFile);
        queryReader = new SequenceReader(new File(args[2]));

        kmerTrie = KmerTrie.buildTrie(new SequenceReader(trainingFile), wordSize);

        if (querySeqType == SequenceType.Protein && kmerTrie.getTreeSeqType() == SequenceType.Nucleotide) {
            throw new Exception("Trie is made of nucleotide sequences but the query sequences are protein");
        }

        if (querySeqType == SequenceType.Nucleotide && kmerTrie.getTreeSeqType() == SequenceType.Protein) {
            translQuery = true;
            System.err.println(
                    "Query sequences are nucleotide but trie is in protein space, query sequences will be translated");
        }

        if (querySeqType == SequenceType.Protein && exhaustive) {
            System.err.println("Cannot do an exaustive search with protein sequences, disabling");
            exhaustive = false;
        }

    } catch (Exception e) {
        new HelpFormatter().printHelp("KmerSearch <ref_file> <word_size> <query_file>", options);
        System.err.println(e.getMessage());
        System.exit(1);
    }

    long startTime = System.currentTimeMillis();
    long seqCount = 0, passedCount = 0;

    Sequence querySeq;

    while ((querySeq = queryReader.readNextSequence()) != null) {
        seqCount++;

        List<Sequence> testSequences;

        if (!exhaustive) {
            if (translQuery) {
                testSequences = Arrays.asList(new Sequence(querySeq.getSeqName(), "", ProteinUtils.getInstance()
                        .translateToProtein(querySeq.getSeqString(), true, translTable)));
            } else {
                testSequences = Arrays.asList(querySeq);
            }
        } else {
            if (translQuery) {
                testSequences = ProteinUtils.getInstance().allTranslate(querySeq);
            } else {
                testSequences = Arrays.asList(querySeq, new Sequence(querySeq.getSeqName(), "",
                        IUBUtilities.reverseComplement(querySeq.getSeqString())));
            }
        }

        boolean passed = false;
        for (Sequence seq : testSequences) {
            for (char[] kmer : KmerGenerator.getKmers(seq.getSeqString(), wordSize)) {
                if (kmerTrie.contains(kmer) != null) {
                    passed = true;
                    break;
                }
            }

            if (passed) {
                out.writeSeq(seq);
                passedCount++;
                break;
            }
        }
    }
    System.err.println("Processed: " + seqCount);
    System.err.println("Passed: " + passedCount);
    System.err.println("Failed: " + (seqCount - passedCount));
    System.err.println("Time: " + (System.currentTimeMillis() - startTime) + " ms");
}

From source file:eu.annocultor.utils.XmlUtils.java

public static void main(String... args) throws Exception {
    // Handling command line parameters with Apache Commons CLI
    Options options = new Options();

    options.addOption(OptionBuilder.withArgName(OPT_FN).hasArg().isRequired()
            .withDescription("XML file name to be pretty-printed").create(OPT_FN));

    // now lets parse the input
    CommandLineParser parser = new BasicParser();
    CommandLine cmd;/*  ww w  .  j a  v  a  2s.  c o  m*/
    try {
        cmd = parser.parse(options, Utils.getCommandLineFromANNOCULTOR_ARGS(args));
    } catch (ParseException pe) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("pretty", options);
        return;
    }

    List<File> files = Utils.expandFileTemplateFrom(new File("."), cmd.getOptionValue(OPT_FN));
    for (File file : files) {
        // XML pretty print
        System.out.println("Pretty-print for file " + file);
        if (file.exists())
            prettyPrintXmlFileSAX(file.getCanonicalPath());
        else
            throw new Exception("File not found: " + file.getCanonicalPath());
    }
}

From source file:edu.msu.cme.rdp.readseq.utils.QualityTrimmer.java

public static void main(String[] args) throws Exception {
    Options options = new Options();
    options.addOption("f", "fastq-out", false, "Write fastq instead of fasta file");
    options.addOption("l", "less-than", false, "Trim at <= instead of strictly =");
    options.addOption("i", "illumina", false, "Illumina trimming mode");

    FastqWriter fastqOut = null;//w  ww. j  av a 2 s . c om
    FastaWriter fastaOut = null;

    byte qualTrim = -1;

    boolean writeFasta = true;
    boolean trimle = false;
    boolean illumina = false;

    List<SeqReader> readers = new ArrayList();
    List<File> seqFiles = new ArrayList();

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

        if (line.hasOption("fastq-out")) {
            writeFasta = false;
        }

        if (line.hasOption("less-than")) {
            trimle = true;
        }
        if (line.hasOption("illumina")) {
            illumina = true;
        }

        args = line.getArgs();

        if (args.length < 2) {
            throw new Exception("Unexpected number of arguments");
        }

        if (args[0].length() != 1) {
            throw new Exception("Expected single character quality score");
        }

        qualTrim = FastqCore.Phred33QualFunction.translate(args[0].charAt(0));

        for (int index = 1; index < args.length; index++) {
            File seqFile = new File(args[index]);
            SeqReader reader;
            if (SeqUtils.guessFileFormat(seqFile) == SequenceFormat.FASTA) {
                if (index + 1 == args.length) {
                    throw new Exception("Fasta files must be immediately followed by their quality file");
                }

                File qualFile = new File(args[index + 1]);
                if (SeqUtils.guessFileFormat(qualFile) != SequenceFormat.FASTA) {
                    throw new Exception(seqFile + " was not followed by a fasta quality file");
                }

                reader = new QSeqReader(seqFile, qualFile);
                index++;
            } else {
                if (seqFile.getName().endsWith(".gz")) {
                    reader = new SequenceReader(new GZIPInputStream(new FileInputStream(seqFile)));
                } else {
                    reader = new SequenceReader(seqFile);
                }
            }

            readers.add(reader);
            seqFiles.add(seqFile);
        }
    } catch (Exception e) {
        new HelpFormatter().printHelp("USAGE: QualityTrimmer [options] <ascii_score> <seq_file> [qual_file]",
                options, true);
        System.err.println("Error: " + e.getMessage());
        System.exit(1);
    }

    for (int readerIndex = 0; readerIndex < readers.size(); readerIndex++) {
        File seqFile = seqFiles.get(readerIndex);
        String outStem = "trimmed_" + seqFile.getName().substring(0, seqFile.getName().lastIndexOf("."));
        if (writeFasta) {
            fastaOut = new FastaWriter(outStem + ".fasta");
        } else {
            fastqOut = new FastqWriter(outStem + ".fastq", FastqCore.Phred33QualFunction);
        }

        int[] lengthHisto = new int[200];

        SeqReader reader = readers.get(readerIndex);

        QSequence qseq;

        long totalLength = 0;
        int totalSeqs = 0;
        long trimmedLength = 0;
        int trimmedSeqs = 0;

        int zeroLengthAfterTrimming = 0;

        long startTime = System.currentTimeMillis();

        while ((qseq = (QSequence) reader.readNextSequence()) != null) {
            char[] bases = qseq.getSeqString().toCharArray();
            byte[] qual = qseq.getQuality();

            if (bases.length != qual.length) {
                System.err.println(qseq.getSeqName() + ": Quality length doesn't match seq length for seq");
                continue;
            }

            totalSeqs++;
            totalLength += bases.length;

            int trimIndex = -1;
            if (illumina && qual[bases.length - 1] == qualTrim) {
                trimIndex = bases.length - 1;
                while (trimIndex >= 0 && qual[trimIndex] == qualTrim) {
                    trimIndex--;
                }

                trimIndex++; //Technically we're positioned over the first good base, move back to the last bad base
            } else if (!illumina) {
                for (int index = 0; index < bases.length; index++) {
                    if (qual[index] == qualTrim || (trimle && qual[index] < qualTrim)) {
                        trimIndex = index;
                        break;
                    }
                }
            }

            String outSeq;
            byte[] outQual;
            if (trimIndex == -1) {
                outSeq = qseq.getSeqString();
                outQual = qseq.getQuality();
            } else {
                outSeq = new String(bases, 0, trimIndex);
                outQual = Arrays.copyOfRange(qual, 0, trimIndex);
                trimmedSeqs++;
            }
            int len = outSeq.length();
            trimmedLength += len;

            if (len >= lengthHisto.length) {
                lengthHisto = Arrays.copyOf(lengthHisto, len + 1);
            }
            lengthHisto[len]++;

            if (outSeq.length() == 0) {
                //System.err.println(qseq.getSeqName() + ": length 0 after trimming");
                zeroLengthAfterTrimming++;
                continue;
            }

            if (writeFasta) {
                fastaOut.writeSeq(qseq.getSeqName(), qseq.getDesc(), outSeq);
            } else {
                fastqOut.writeSeq(qseq.getSeqName(), qseq.getDesc(), outSeq, outQual);
            }
        }

        reader.close();

        if (writeFasta) {
            fastaOut.close();
        } else {
            fastqOut.close();
        }

        System.out.println(
                "Processed " + seqFile + " in " + (System.currentTimeMillis() - startTime) / 1000.0 + "s");
        System.out.println("Before trimming:");
        System.out.println("Total Sequences:           " + totalSeqs);
        System.out.println("Total Sequence Data:       " + totalLength);
        System.out.println("Average sequence length:   " + ((float) totalLength / totalSeqs));
        System.out.println();
        System.out.println("After trimming:");
        System.out.println("Total Sequences:           " + (totalSeqs - zeroLengthAfterTrimming));
        System.out.println("Sequences Trimmed:         " + trimmedSeqs);
        System.out.println("Total Sequence Data:       " + trimmedLength);
        System.out.println("Average sequence length:   "
                + ((float) trimmedLength / (totalSeqs - zeroLengthAfterTrimming)));
        System.out.println();

        System.out.println("Length\tCount");
        for (int index = 0; index < lengthHisto.length; index++) {
            if (lengthHisto[index] == 0) {
                continue;
            }

            System.out.println(index + "\t" + lengthHisto[index]);
        }

        System.out.println();
        System.out.println();
        System.out.println();
    }
}

From source file:net.anthonypoon.ngram.correlation.Main.java

public static void main(String[] args) throws Exception {
    Options options = new Options();
    options.addOption("a", "action", true, "Action");
    options.addOption("i", "input", true, "input");
    options.addOption("o", "output", true, "output");
    //options.addOption("f", "format", true, "Format");
    options.addOption("u", "upbound", true, "Year up bound");
    options.addOption("l", "lowbound", true, "Year low bound");
    options.addOption("t", "target", true, "Correlation Target URI"); // Can only take file from S# or HDFS
    options.addOption("L", "lag", true, "Lag factor");
    options.addOption("T", "threshold", true, "Correlation threshold");
    CommandLineParser parser = new GnuParser();
    CommandLine cmd = parser.parse(options, args);
    Configuration conf = new Configuration();
    if (cmd.hasOption("lag")) {
        conf.set("lag", cmd.getOptionValue("lag"));
    }//from   w w w  . j a va2  s.c o m
    if (cmd.hasOption("threshold")) {
        conf.set("threshold", cmd.getOptionValue("threshold"));
    }
    if (cmd.hasOption("upbound")) {
        conf.set("upbound", cmd.getOptionValue("upbound"));
    } else {
        conf.set("upbound", "9999");
    }
    if (cmd.hasOption("lowbound")) {
        conf.set("lowbound", cmd.getOptionValue("lowbound"));
    } else {
        conf.set("lowbound", "0");
    }
    if (cmd.hasOption("target")) {
        conf.set("target", cmd.getOptionValue("target"));
    } else {
        throw new Exception("Missing correlation target file uri");
    }
    Job job = Job.getInstance(conf);
    /**
    if (cmd.hasOption("format")) {
    switch (cmd.getOptionValue("format")) {
        case "compressed":
            job.setInputFormatClass(SequenceFileAsTextInputFormat.class);
            break;
        case "text":
            job.setInputFormatClass(KeyValueTextInputFormat.class);
            break;
    }
            
    }**/
    job.setJarByClass(Main.class);
    switch (cmd.getOptionValue("action")) {
    case "get-correlation":
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);
        for (String inputPath : cmd.getOptionValue("input").split(",")) {
            MultipleInputs.addInputPath(job, new Path(inputPath), KeyValueTextInputFormat.class,
                    CorrelationMapper.class);
        }
        job.setReducerClass(CorrelationReducer.class);
        break;
    default:
        throw new IllegalArgumentException("Missing action");
    }

    String timestamp = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss").format(new Date());

    //FileInputFormat.setInputPaths(job, new Path(cmd.getOptionValue("input")));
    FileOutputFormat.setOutputPath(job, new Path(cmd.getOptionValue("output") + "/" + timestamp));
    System.exit(job.waitForCompletion(true) ? 0 : 1);
}

From source file:com.hortonworks.atlas.trash.DemoClass.java

public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub

    if (args.length < 1) {
        throw new Exception("Please provide the DGI host url");
    }/*w  w w  . j a  v a 2  s.c o  m*/

    System.setProperty("atlas.conf", "/Users/sdutta/Applications/conf");

    String baseUrl = getServerUrl(args);

    DemoClass dc = new DemoClass(baseUrl);
    dc.createTypes();

    // Shows how to create types in Atlas for your meta model
    dc.createTypes();

    // Shows how to create entities (instances) for the added types in Atlas
    dc.createEntities();

    // Shows some search queries using DSL based on types
    //dc.search();

}

From source file:com.ibm.crail.namenode.NameNode.java

public static void main(String args[]) throws Exception {
    LOG.info("initalizing namenode ");
    CrailConfiguration conf = new CrailConfiguration();
    CrailConstants.updateConstants(conf);

    URI uri = CrailUtils.getPrimaryNameNode();
    String address = uri.getHost();
    int port = uri.getPort();

    if (args != null) {
        Option addressOption = Option.builder("a").desc("ip address namenode is started on").hasArg().build();
        Option portOption = Option.builder("p").desc("port namenode is started on").hasArg().build();
        Options options = new Options();
        options.addOption(portOption);/*w  ww .j  a  v a  2s .c  om*/
        options.addOption(addressOption);
        CommandLineParser parser = new DefaultParser();

        try {
            CommandLine line = parser.parse(options, Arrays.copyOfRange(args, 0, args.length));
            if (line.hasOption(addressOption.getOpt())) {
                address = line.getOptionValue(addressOption.getOpt());
            }
            if (line.hasOption(portOption.getOpt())) {
                port = Integer.parseInt(line.getOptionValue(portOption.getOpt()));
            }
        } catch (ParseException e) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("Namenode", options);
            System.exit(-1);
        }
    }

    String namenode = "crail://" + address + ":" + port;
    long serviceId = CrailUtils.getServiceId(namenode);
    long serviceSize = CrailUtils.getServiceSize();
    if (!CrailUtils.verifyNamenode(namenode)) {
        throw new Exception("Namenode address/port [" + namenode
                + "] has to be listed in crail.namenode.address " + CrailConstants.NAMENODE_ADDRESS);
    }

    CrailConstants.NAMENODE_ADDRESS = namenode + "?id=" + serviceId + "&size=" + serviceSize;
    CrailConstants.printConf();
    CrailConstants.verify();

    RpcNameNodeService service = RpcNameNodeService.createInstance(CrailConstants.NAMENODE_RPC_SERVICE);
    RpcBinding rpcBinding = RpcBinding.createInstance(CrailConstants.NAMENODE_RPC_TYPE);
    rpcBinding.init(conf, null);
    rpcBinding.printConf(LOG);
    rpcBinding.run(service);
    System.exit(0);
    ;
}

From source file:net.frontlinesms.DesktopLauncher.java

/**
 * Main class for launching the FrontlineSMS project.
 * @param args//from   w  ww  .  ja  v a  2s  .com
 */
public static void main(String[] args) {
    FrontlineSMS frontline = null;
    try {
        AppProperties appProperties = AppProperties.getInstance();
        final String VERSION = BuildProperties.getInstance().getVersion();
        LOG.info("FrontlineSMS version [" + VERSION + "]");
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        String lastVersion = appProperties.getLastRunVersion();
        InputStream defaultResourceArchive = ResourceUtils.class.getResourceAsStream("/resources.zip");
        if (defaultResourceArchive == null) {
            LOG.fatal("Default resources archive could not be found!");
            throw new Exception("Default resources archive could not be found!");
        }

        ResourceUtils.unzip(defaultResourceArchive, new File(ResourceUtils.getConfigDirectoryPath()),
                !VERSION.equals(lastVersion));

        // This should always get the English bundle, as other languages are only included in
        // resources.zip rather than in the resources/languages directory
        LanguageBundle englishBundle = InternationalisationUtils.getDefaultLanguageBundle();
        Thinlet.DEFAULT_ENGLISH_BUNDLE = englishBundle.getProperties();

        // If the user has currently no User ID defined
        // We generate one
        if (appProperties.getUserId() == null) {
            appProperties.setUserId(generateUserId());
        }

        boolean showWizard = appProperties.isShowWizard();
        appProperties.setLastRunVersion(VERSION);
        appProperties.saveToDisk();

        frontline = initFrontline();
        if (showWizard) {
            new FirstTimeWizard(frontline);
        } else {
            // Auto-detect phones.
            new UiGeneratorController(frontline, true);
        }
    } catch (Throwable t) {
        if (frontline != null)
            frontline.destroy();

        // Rather than swallowing the error, we now display it to the user
        // so that they can give us some feedback :)
        ErrorUtils.showErrorDialog("Fatal error starting FrontlineSMS!",
                "A problem ocurred during FrontlineSMS startup.", t, true);
    }
}

From source file:org.switchyard.quickstarts.demo.policy.security.wss.signencrypt.WorkServiceMain.java

public static void main(String... args) throws Exception {
    Set<String> policies = new HashSet<String>();
    for (String arg : args) {
        arg = Strings.trimToNull(arg);//from  ww  w .ja v  a2 s.c  o  m
        if (arg != null) {
            if (arg.equals(CONFIDENTIALITY) || arg.equals(SIGNENCRYPT) || arg.equals(HELP)) {
                policies.add(arg);
            } else {
                LOGGER.error(MAVEN_USAGE);
                throw new Exception(MAVEN_USAGE);
            }
        }
    }
    if (policies.contains(HELP)) {
        LOGGER.info(MAVEN_USAGE);
    } else {
        final String scheme;
        final int port;
        if (policies.contains(CONFIDENTIALITY)) {
            scheme = "https";
            port = getPort(8443);
            SSLContext sslcontext = SSLContext.getInstance("TLS");
            sslcontext.init(null, null, null);
            SSLSocketFactory sf = new SSLSocketFactory(sslcontext, SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
            Scheme https = new Scheme(scheme, port, sf);
            SchemeRegistry sr = new SchemeRegistry();
            sr.register(https);
        } else {
            scheme = "http";
            port = getPort(8080);
        }
        boolean signencrypt = policies.contains(SIGNENCRYPT);
        invokeWorkService(scheme, port, getContext(), signencrypt);
    }
}