Example usage for java.lang Boolean valueOf

List of usage examples for java.lang Boolean valueOf

Introduction

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

Prototype

public static Boolean valueOf(String s) 

Source Link

Document

Returns a Boolean with a value represented by the specified string.

Usage

From source file:com.sm.store.TestGZStoreServer.java

public static void main(String[] args) {
    String[] opts = new String[] { "-store", "-path", "-port", "-mode", "-delay" };
    String[] defaults = new String[] { "store", "./data", "7100", "0", "false" };
    String[] paras = getOpts(args, opts, defaults);
    String p0 = paras[0];//from  w  ww.  j  a v a2s .  com
    int port = Integer.valueOf(paras[2]);
    String path = paras[1];
    int mode = Integer.valueOf(paras[3]);
    boolean delay = Boolean.valueOf(paras[4]);
    String[] stores = p0.split(",");
    List<TupleThree<String, String, Integer>> storeList = new ArrayList<TupleThree<String, String, Integer>>();
    for (String store : stores) {
        storeList.add(new TupleThree<String, String, Integer>(store, path, mode));

    }
    GZRemoteStoreServer rs = new GZRemoteStoreServer(port, storeList, delay);
    logger.info("hookup jvm shutdown process");
    rs.hookShutdown();
    List list = new ArrayList();
    //add jmx metric
    for (String store : stores) {
        list.add(rs.getRemoteStore(store));
    }
    list.add(rs);
    JmxService jms = new JmxService(list);
}

From source file:org.wso2.carbon.sample.pizzadelivery.client.PizzaOrderClient.java

public static void main(String[] args) {
    KeyStoreUtil.setTrustStoreParams();/*from  w  w  w  . j  av  a 2  s  .  co m*/
    String url = args[0];
    boolean batchedElements = Boolean.valueOf(args[1]);

    HttpClient httpClient = new SystemDefaultHttpClient();

    try {
        HttpPost method = new HttpPost(url);

        if (httpClient != null) {
            String[] xmlElements = new String[] {
                    "<mypizza:PizzaOrderStream xmlns:mypizza=\"http://samples.wso2.org/\">\n"
                            + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0023</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>PEPPERONI</mypizza:Type>\n"
                            + "              <mypizza:Size>L</mypizza:Size>\n"
                            + "              <mypizza:Quantity>2</mypizza:Quantity>\n"
                            + "              <mypizza:Contact>James Mark</mypizza:Contact>\n"
                            + "              <mypizza:Address>29BX Finchwood Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "</mypizza:PizzaOrderStream>",
                    "<mypizza:PizzaOrderStream xmlns:mypizza=\"http://samples.wso2.org/\">\n"
                            + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0024</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>CHEESE</mypizza:Type>\n"
                            + "              <mypizza:Size>M</mypizza:Size>\n"
                            + "              <mypizza:Quantity>1</mypizza:Quantity>\n"
                            + "              <mypizza:Contact>Henry Clock</mypizza:Contact>\n"
                            + "              <mypizza:Address>2CYL Morris Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "</mypizza:PizzaOrderStream>",
                    "<mypizza:PizzaOrderStream xmlns:mypizza=\"http://samples.wso2.org/\">\n"
                            + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0025</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>SEAFOOD</mypizza:Type>\n"
                            + "              <mypizza:Size>S</mypizza:Size>\n"
                            + "              <mypizza:Quantity>4</mypizza:Quantity>\n"
                            + "              <mypizza:Contact>James Mark</mypizza:Contact>\n"
                            + "              <mypizza:Address>22RE Robinwood Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "</mypizza:PizzaOrderStream>",
                    "<mypizza:PizzaOrderStream xmlns:mypizza=\"http://samples.wso2.org/\">\n"
                            + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0026</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>CHICKEN</mypizza:Type>\n"
                            + "              <mypizza:Size>L</mypizza:Size>\n"
                            + "              <mypizza:Contact>Alis Miranda</mypizza:Contact>\n"
                            + "              <mypizza:Address>779 Burl Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "</mypizza:PizzaOrderStream>",
                    "<mypizza:PizzaOrderStream xmlns:mypizza=\"http://samples.wso2.org/\">\n"
                            + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0026</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>VEGGIE</mypizza:Type>\n"
                            + "              <mypizza:Size>L</mypizza:Size>\n"
                            + "              <mypizza:Quantity>1</mypizza:Quantity>\n"
                            + "              <mypizza:Contact>James Mark</mypizza:Contact>\n"
                            + "              <mypizza:Address>29BX Finchwood Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "</mypizza:PizzaOrderStream>" };

            String[] batchedXmlElements = new String[] {
                    "<mypizza:PizzaOrderStream xmlns:mypizza=\"http://samples.wso2.org/\">\n"
                            + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0023</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>PEPPERONI</mypizza:Type>\n"
                            + "              <mypizza:Size>L</mypizza:Size>\n"
                            + "              <mypizza:Quantity>2</mypizza:Quantity>\n"
                            + "              <mypizza:Contact>James Mark</mypizza:Contact>\n"
                            + "              <mypizza:Address>29BX Finchwood Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0024</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>CHEESE</mypizza:Type>\n"
                            + "              <mypizza:Size>M</mypizza:Size>\n"
                            + "              <mypizza:Quantity>1</mypizza:Quantity>\n"
                            + "              <mypizza:Contact>Henry Clock</mypizza:Contact>\n"
                            + "              <mypizza:Address>2CYL Morris Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0025</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>SEAFOOD</mypizza:Type>\n"
                            + "              <mypizza:Size>S</mypizza:Size>\n"
                            + "              <mypizza:Quantity>4</mypizza:Quantity>\n"
                            + "              <mypizza:Contact>James Mark</mypizza:Contact>\n"
                            + "              <mypizza:Address>22RE Robinwood Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "</mypizza:PizzaOrderStream>",
                    "<mypizza:PizzaOrderStream xmlns:mypizza=\"http://samples.wso2.org/\">\n"
                            + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0026</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>CHICKEN</mypizza:Type>\n"
                            + "              <mypizza:Size>L</mypizza:Size>\n"
                            + "              <mypizza:Quantity>1</mypizza:Quantity>\n"
                            + "              <mypizza:Contact>Alis Miranda</mypizza:Contact>\n"
                            + "              <mypizza:Address>779 Burl Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "        <mypizza:PizzaOrder>\n"
                            + "              <mypizza:OrderNo>0026</mypizza:OrderNo>\n"
                            + "              <mypizza:Type>VEGGIE</mypizza:Type>\n"
                            + "              <mypizza:Size>L</mypizza:Size>\n"
                            + "              <mypizza:Quantity>1</mypizza:Quantity>\n"
                            + "              <mypizza:Contact>James Mark</mypizza:Contact>\n"
                            + "              <mypizza:Address>29BX Finchwood Ave, Clovis, CA 93611</mypizza:Address>\n"
                            + "        </mypizza:PizzaOrder>\n" + "</mypizza:PizzaOrderStream>" };

            int i = 0;
            if (batchedElements) {
                for (String xmlElement : batchedXmlElements) {
                    StringEntity entity = new StringEntity(xmlElement);
                    method.setEntity(entity);
                    httpClient.execute(method).getEntity().getContent().close();
                    System.out.println("Sent event no :" + i++);
                }
            } else {
                for (String xmlElement : xmlElements) {
                    StringEntity entity = new StringEntity(xmlElement);
                    method.setEntity(entity);
                    httpClient.execute(method).getEntity().getContent().close();
                    System.out.println("Sent event no :" + i++);
                }
            }
            Thread.sleep(500); // We need to wait some time for the message to be sent
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
}

From source file:com.sm.store.TestStoreServer.java

public static void main(String[] args) {
    String[] opts = new String[] { "-store", "-path", "-port", "-mode", "-delay" };
    String[] defaults = new String[] { "store", "./storepath", "7100", "0", "false" };
    String[] paras = getOpts(args, opts, defaults);
    String p0 = paras[0];//  w ww  . j a  v  a  2 s  . co m
    int port = Integer.valueOf(paras[2]);
    String path = paras[1];
    int mode = Integer.valueOf(paras[3]);
    boolean delay = Boolean.valueOf(paras[4]);
    String[] stores = p0.split(",");
    List<TupleThree<String, String, Integer>> storeList = new ArrayList<TupleThree<String, String, Integer>>();
    for (String store : stores) {
        storeList.add(new TupleThree<String, String, Integer>(store, path, mode));

    }
    RemoteStoreServer rs = new RemoteStoreServer(port, storeList, delay);
    logger.info("hookup jvm shutdown process");
    rs.hookShutdown();
    List list = new ArrayList();
    //add jmx metric
    for (String store : stores) {
        list.add(rs.getRemoteStore(store));
    }
    list.add(rs);
    JmxService jms = new JmxService(list);
}

From source file:com.sm.store.server.RemoteReplicaServer.java

public static void main(String[] args) {
    String[] opts = new String[] { "-configPath", "-start" };
    String[] defaults = new String[] { "./config", "true" };
    String[] paras = getOpts(args, opts, defaults);

    String configPath = paras[0];
    if (configPath.length() == 0) {
        logger.error("missing config path");
        throw new RuntimeException("missing -configPath");
    }/*from w  w w.  j a  v a  2  s  .c o  m*/
    //make sure path is in proper format
    configPath = getPath(configPath);
    boolean start = Boolean.valueOf(paras[1]);
    logger.info("read stores.xml from " + configPath);
    BuildRemoteConfig bsc = new BuildRemoteConfig(configPath + "/stores.xml");
    RemoteStoreServer cs = new RemoteStoreServer(bsc.build());
    logger.info("hookup jvm shutdown process");
    cs.hookShutdown();
    if (start) {
        logger.info("server is starting " + cs.toString());
        cs.startServer();
    } else
        logger.warn("server is staged and wait to be started");
    List list = new ArrayList();
    //add jmx metric
    List<String> stores = cs.getAllStoreNames();
    for (String store : stores) {
        list.add(cs.getRemoteStore(store));
    }
    list.add(cs);
    JmxService jms = new JmxService(list);
}

From source file:de.tudarmstadt.ukp.dkpro.c4corpus.boilerplate.standalone.HTMLBoilerplateRemoval.java

public static void main(String[] args) throws IOException {
    File input = new File(args[0]);
    File output = new File(args[1]);
    boolean keepMinimalHtml = Boolean.valueOf(args[2]);

    processHtmlFile(input, output, keepMinimalHtml);
}

From source file:com.sm.store.server.netty.RemoteScan4ReplicaServer.java

public static void main(String[] args) {
    String[] opts = new String[] { "-configPath", "-start" };
    String[] defaults = new String[] { "./config", "true" };
    String[] paras = getOpts(args, opts, defaults);

    String configPath = paras[0];
    if (configPath.length() == 0) {
        logger.error("missing config path");
        throw new RuntimeException("missing -configPath");
    }/*from w w  w  .  j  a va 2  s. c  om*/
    //make sure path is in proper format
    configPath = getPath(configPath);
    boolean start = Boolean.valueOf(paras[1]);
    logger.info("read stores.xml from " + configPath);
    BuildRemoteConfig bsc = new BuildRemoteConfig(configPath + "/stores.xml");
    Scan4RemoteServer cs = new Scan4RemoteServer(bsc.build());
    logger.info("hookup jvm shutdown process");
    cs.hookShutdown();
    if (start) {
        logger.info("server is starting " + cs.toString());
        cs.startServer();
    } else
        logger.warn("server is staged and wait to be started");
    List list = new ArrayList();
    //add jmx metric
    List<String> stores = cs.getAllStoreNames();
    for (String store : stores) {
        list.add(cs.getRemoteStore(store));
    }
    // add additional name into list for Scan4RemoteServer
    list.add(cs);
    stores.add("Scan4RemoteServer");
    JmxService jms = new JmxService(list, stores);
}

From source file:com.sm.store.server.grizzly.RemoteScan4ReplicaServer.java

public static void main(String[] args) {
    String[] opts = new String[] { "-configPath", "-start" };
    String[] defaults = new String[] { "./config", "true" };
    String[] paras = getOpts(args, opts, defaults);

    String configPath = paras[0];
    if (configPath.length() == 0) {
        logger.error("missing config path");
        throw new RuntimeException("missing -configPath");
    }/*w w w .j av  a2s .  c  o  m*/
    //make sure path is in proper format
    configPath = getPath(configPath);
    boolean start = Boolean.valueOf(paras[1]);
    logger.info("read stores.xml from " + configPath);
    BuildRemoteConfig bsc = new BuildRemoteConfig(configPath + "/stores.xml");
    GZScan4RemoteServer cs = new GZScan4RemoteServer(bsc.build());
    logger.info("hookup jvm shutdown process");
    cs.hookShutdown();
    if (start) {
        logger.info("server is starting " + cs.toString());
        cs.startServer();
    } else
        logger.warn("server is staged and wait to be started");
    List list = new ArrayList();
    //add jmx metric
    List<String> stores = cs.getAllStoreNames();
    for (String store : stores) {
        list.add(cs.getRemoteStore(store));
    }
    // add additional name into list for Scan4RemoteServer
    list.add(cs);
    stores.add("Scan4RemoteServer");
    JmxService jms = new JmxService(list, stores);
}

From source file:com.floreantpos.main.Main.java

/**
 * @param args/*www  .  j ava  2s . c om*/
 * @throws Exception 
 */
public static void main(String[] args) throws Exception {
    Options options = new Options();
    options.addOption(DEVELOPMENT_MODE, true, "State if this is developmentMode"); //$NON-NLS-1$
    CommandLineParser parser = new BasicParser();
    CommandLine commandLine = parser.parse(options, args);
    String optionValue = commandLine.getOptionValue(DEVELOPMENT_MODE);
    Locale defaultLocale = TerminalConfig.getDefaultLocale();
    if (defaultLocale != null) {
        Locale.setDefault(defaultLocale);
    }

    Application application = Application.getInstance();

    if (optionValue != null) {
        application.setDevelopmentMode(Boolean.valueOf(optionValue));
    }

    application.start();
}

From source file:Bounce.java

/**
 * The main method./*from w  w w .  j  av a2 s .com*/
 */

public static void main(String[] args) {
    if (args.length < 3) {
        printUsage();
        System.exit(1);
    }

    int localPort;
    try {
        localPort = Integer.parseInt(args[0]);
    } catch (NumberFormatException e) {
        System.err.println("Bad local port value: " + args[0]);
        printUsage();
        System.exit(2);
        return;
    }

    String hostname = args[1];

    int remotePort;
    try {
        remotePort = Integer.parseInt(args[2]);
    } catch (NumberFormatException e) {
        System.err.println("Bad remote port value: " + args[2]);
        printUsage();
        System.exit(3);
        return;
    }

    boolean shouldLog = args.length > 3 ? Boolean.valueOf(args[3]).booleanValue() : false;
    int numConnections = 0;

    try {
        ServerSocket ssock = new ServerSocket(localPort);
        while (true) {
            Socket incomingSock = ssock.accept();
            Socket outgoingSock = new Socket(hostname, remotePort);
            numConnections++;

            InputStream incomingIn = incomingSock.getInputStream();
            InputStream outgoingIn = outgoingSock.getInputStream();
            OutputStream incomingOut = incomingSock.getOutputStream();
            OutputStream outgoingOut = outgoingSock.getOutputStream();

            if (shouldLog) {
                String incomingLogName = "in-log-" + incomingSock.getInetAddress().getHostName() + "("
                        + localPort + ")-" + numConnections + ".dat";
                String outgoingLogName = "out-log-" + hostname + "(" + remotePort + ")-" + numConnections
                        + ".dat";
                OutputStream incomingLog = new FileOutputStream(incomingLogName);
                incomingOut = new MultiOutputStream(incomingOut, incomingLog);
                OutputStream outgoingLog = new FileOutputStream(outgoingLogName);
                outgoingOut = new MultiOutputStream(outgoingOut, outgoingLog);
            }

            PumpThread t1 = new PumpThread(incomingIn, outgoingOut);
            PumpThread t2 = new PumpThread(outgoingIn, incomingOut);
            t1.start();
            t2.start();
        }
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(3);
    }
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
    Document doc = dBuilder.parse(new InputSource(new StringReader(cfgXml)));
    doc.getDocumentElement().normalize();

    System.out.println("Root element :" + doc.getDocumentElement().getNodeName());

    NodeList nList = doc.getElementsByTagName("config");
    for (int temp = 0; temp < nList.getLength(); temp++) {
        Node nNode = nList.item(temp);
        System.out.println("\nCurrent Element :" + nNode.getNodeName());
        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
            Element eElement = (Element) nNode;
            Config c = new Config();
            c.name = eElement.getAttribute("name");
            c.type = eElement.getAttribute("type");
            c.format = eElement.getAttribute("format");
            c.size = Integer.valueOf(eElement.getAttribute("size"));
            c.scale = Integer.valueOf(eElement.getAttribute("scale"));
            String attribute = eElement.getAttribute("required");
            c.required = Boolean.valueOf("Yes".equalsIgnoreCase(attribute) ? true : false);
            System.out.println("Imported config : " + c);
        }/* w  w w .  jav  a 2  s.co  m*/
    }
}