List of usage examples for java.lang Boolean getBoolean
public static boolean getBoolean(String name)
From source file:com.twinsoft.convertigo.beans.transactions.HtmlTransaction.java
@Override public void parseInputDocument(com.twinsoft.convertigo.engine.Context context) throws EngineException { super.parseInputDocument(context); // TODO : voir si on garde cela // Overrides statefull mode using given __statefull request parameter NodeList stateNodes = context.inputDocument.getElementsByTagName("statefull"); if (stateNodes.getLength() == 1) { Element node = (Element) stateNodes.item(0); String value = node.getAttribute("value"); if (!value.equals("")) { setStateFull(value.equalsIgnoreCase("true")); }//from w ww . j av a 2 s . co m } stateNodes = context.inputDocument.getElementsByTagName("webviewer-action"); if (stateNodes.getLength() == 1 && stateNodes.item(0).getChildNodes().getLength() > 0) { Element webviewerAction = (Element) stateNodes.item(0); IdToXpathManager idToXpathManager = context.getIdToXpathManager(); NodeList fieldNodes = context.inputDocument.getElementsByTagName("field"); wcEvent = null; wcTrigger = null; wcFields = new ArrayList<AbstractEvent>(fieldNodes.getLength()); for (int i = 0; i < fieldNodes.getLength(); i++) { Element field = (Element) fieldNodes.item(i); String id = field.getAttribute("name"); id = id.substring(id.lastIndexOf('_') + 1, id.length()); String value = field.getAttribute("value"); String xPath = idToXpathManager.getXPath(id); Node node = idToXpathManager.getNode(id); if (node != null && node instanceof Element) { Element el = (Element) node; String tagname = el.getTagName(); AbstractEvent evt = null; if (tagname.equalsIgnoreCase("input")) { String type = el.getAttribute("type"); if (type.equalsIgnoreCase("checkbox") || type.equalsIgnoreCase("radio")) { evt = new InputCheckEvent(xPath, true, Boolean.valueOf(value).booleanValue()); } else { evt = new InputValueEvent(xPath, true, value); } } else if (tagname.equalsIgnoreCase("select")) { evt = new InputSelectEvent(xPath, true, InputSelectEvent.MOD_INDEX, value.split(";")); } else if (tagname.equalsIgnoreCase("textarea")) { evt = new InputValueEvent(xPath, true, value); } if (evt != null) { wcFields.add(evt); Engine.logBeans.trace("Xpath: " + xPath + " will be set to :" + value); } } } NodeList actionNodes = webviewerAction.getElementsByTagName("action"); if (actionNodes.getLength() == 1) { String action = ((Element) actionNodes.item(0)).getAttribute("value"); if (action.equals("click")) { int screenX, screenY, clientX, clientY; screenX = screenY = clientX = clientY = -1; boolean ctrlKey, altKey, shiftKey, metKey; ctrlKey = altKey = shiftKey = metKey = false; short button = 0; String xPath = null; NodeList eventNodes = webviewerAction.getElementsByTagName("event"); for (int i = 0; i < eventNodes.getLength(); i++) { String name = ((Element) eventNodes.item(i)).getAttribute("name"); String value = ((Element) eventNodes.item(i)).getAttribute("value"); if (name.equals("x") || name.equals("y") || name.startsWith("client")) { int valueInt = Integer.parseInt(value); if (name.equals("x")) screenX = valueInt; else if (name.equals("y")) screenY = valueInt; else if (name.equals("clientX")) clientX = valueInt; else if (name.equals("clientY")) clientY = valueInt; } else if (name.endsWith("Key")) { boolean valueBool = Boolean.getBoolean(value); if (name.equals("ctrlKey")) ctrlKey = valueBool; else if (name.equals("altKey")) altKey = valueBool; else if (name.equals("shiftKey")) altKey = valueBool; else if (name.equals("metKey")) altKey = valueBool; } else if (name.equals("srcid")) { xPath = idToXpathManager.getXPath(value); } } if (xPath != null) { wcEvent = new MouseEvent(xPath, action, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metKey, button); Engine.logBeans.debug("Created an click event from webviewer-action on : " + xPath); } } else if (action.startsWith("navbar_")) { action = action.substring(7, action.length()); wcEvent = new NavigationBarEvent(action); } else { String xPath = null; NodeList eventNodes = webviewerAction.getElementsByTagName("event"); for (int i = 0; i < eventNodes.getLength(); i++) { String name = ((Element) eventNodes.item(i)).getAttribute("name"); String value = ((Element) eventNodes.item(i)).getAttribute("value"); if (name.equals("srcid")) xPath = idToXpathManager.getXPath(value); } if (xPath != null) wcEvent = new SimpleEvent(xPath, action); } bDispatching = (wcEvent != null); if (bDispatching && wcTrigger == null) // wcTrigger = new WaitTimeTrigger(2000); // wcTrigger = new XpathTrigger("*", 10000); // wcTrigger = new DocumentCompletedTrigger(1, 10000); wcTrigger = getTrigger().getTrigger(); } } }
From source file:org.openconcerto.sql.model.SQLBase.java
static <T> void mustContain(final DBStructureItemJDBC c, final Set<T> newC, final Set<T> oldC, final String name) { if (Boolean.getBoolean(ALLOW_OBJECT_REMOVAL)) return;// w w w . ja v a 2s. c o m final Set<T> diff = CollectionUtils.contains(newC, oldC); if (diff != null) throw new IllegalStateException("some " + name + " were removed in " + c + ": " + diff); }
From source file:org.eclipse.gyrex.admin.ui.internal.AdminUiActivator.java
private void startServer() { try {/*from ww w . ja va2 s . c o m*/ server = new Server(); if (Boolean.getBoolean(PROPERTY_ADMIN_SECURE)) { addSslConnector(server); } else { addNonSslConnector(server); } // tweak server server.setStopAtShutdown(true); server.setStopTimeout(5000); // set thread pool // TODO: (Jetty9?) final QueuedThreadPool threadPool = new QueuedThreadPool(5); // TODO: (Jetty9?) threadPool.setName("jetty-server-admin"); // TODO: (Jetty9?) server.setThreadPool(threadPool); // create context final ServletContextHandler contextHandler = new ServletContextHandler(); contextHandler.setSessionHandler(new SessionHandler(createSessionManager())); configureContextWithServletsAndResources(contextHandler); // enable authentication if configured final String authenticationPhrase = System.getProperty(PROPERTY_ADMIN_AUTH); if (Boolean.getBoolean(PROPERTY_ADMIN_SECURE) && StringUtils.isNotBlank(authenticationPhrase)) { final String[] segments = authenticationPhrase.split("/"); if (segments.length != 3) throw new IllegalArgumentException( "Illegal authentication configuration. Must be three string separated by '/'"); else if (!StringUtils.equals(segments[0], "BASIC")) throw new IllegalArgumentException( "Illegal authentication configuration. Only method 'BASIC' is supported. Found " + segments[0]); server.setHandler(createSecurityHandler(contextHandler, segments[1], segments[2])); } else { server.setHandler(contextHandler); } server.start(); } catch (final Exception e) { throw new IllegalStateException("Error starting jetty for admin ui", e); } }
From source file:com.adeptj.runtime.server.Server.java
/** * Chaining of Undertow {@link HttpHandler} instances as follows. * <p>/* ww w . j a va 2 s .c om*/ * 1. GracefulShutdownHandler * 2. RequestLimitingHandler * 3. AllowedMethodsHandler * 4. PredicateHandler which resolves to either RedirectHandler or SetHeadersHandler * 5. RequestBufferingHandler if request buffering is enabled, wrapped in SetHeadersHandler * 5. And Finally ServletInitialHandler * * @param servletInitialHandler the {@link io.undertow.servlet.handlers.ServletInitialHandler} * @return GracefulShutdownHandler as the root handler */ private GracefulShutdownHandler rootHandler(HttpHandler servletInitialHandler) { Config cfg = Objects.requireNonNull(this.cfgReference.get()); Map<HttpString, String> headers = new HashMap<>(); headers.put(HttpString.tryFromString(Constants.HEADER_SERVER), cfg.getString(Constants.KEY_HEADER_SERVER)); if (Environment.isDev()) { headers.put(HttpString.tryFromString(Constants.HEADER_X_POWERED_BY), Version.getFullVersionString()); } HttpHandler headersHandler = Boolean.getBoolean(ServerConstants.SYS_PROP_ENABLE_REQ_BUFF) ? new SetHeadersHandler(new RequestBufferingHandler(servletInitialHandler, Integer.getInteger(ServerConstants.SYS_PROP_REQ_BUFF_MAX_BUFFERS, cfg.getInt(Constants.KEY_REQ_BUFF_MAX_BUFFERS))), headers) : new SetHeadersHandler(servletInitialHandler, headers); return Handlers.gracefulShutdown(new RequestLimitingHandler( Integer.getInteger(ServerConstants.SYS_PROP_MAX_CONCUR_REQ, cfg.getInt(Constants.KEY_MAX_CONCURRENT_REQS)), new AllowedMethodsHandler( Handlers.predicate(exchange -> Constants.CONTEXT_PATH.equals(exchange.getRequestURI()), Handlers.redirect(Constants.TOOLS_DASHBOARD_URI), headersHandler), this.allowedMethods(cfg)))); }
From source file:io.adeptj.runtime.server.Server.java
private Builder enableHttp2(Builder undertowBuilder) { if (Boolean.getBoolean(SYS_PROP_ENABLE_HTTP2)) { Config httpsConf = Objects.requireNonNull(this.cfgReference.get()).getConfig(KEY_HTTPS); int httpsPort = httpsConf.getInt(KEY_PORT); if (!Environment.useProvidedKeyStore()) { System.setProperty("adeptj.rt.keyStore", httpsConf.getString(KEY_KEYSTORE)); System.setProperty("adeptj.rt.keyStorePassword", httpsConf.getString("keyStorePwd")); System.setProperty("adeptj.rt.keyPassword", httpsConf.getString("keyPwd")); LOGGER.info("HTTP2 enabled @ port: [{}] using bundled KeyStore.", httpsPort); }//from ww w .j a v a2s . c om undertowBuilder.addHttpsListener(httpsPort, httpsConf.getString(KEY_HOST), SslContextFactory.newSslContext()); } return undertowBuilder; }
From source file:fr.gael.dhus.database.DatabasePostInit.java
private void doSynchronizeLocalArchive() { boolean synchronizeLocal = Boolean.getBoolean("Archive.synchronizeLocal"); logger.info("Local archive synchronization " + "(Archive.synchronizeLocal) requested by user (" + synchronizeLocal + ")"); if (!synchronizeLocal) return;/*from w w w . j ava2s . c o m*/ try { productService.processArchiveSync(); } catch (DataStoreLocalArchiveNotExistingException e) { logger.warn(e.getMessage()); } catch (InterruptedException e) { logger.info("Process interrupted by user."); } }
From source file:org.apache.qpid.server.Main.java
protected void setExceptionHandler() { Thread.UncaughtExceptionHandler handler = null; String handlerClass = System.getProperty("qpid.broker.exceptionHandler"); if (handlerClass != null) { try {//from w ww .j a v a 2 s.c o m handler = (Thread.UncaughtExceptionHandler) Class.forName(handlerClass).newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | ClassCastException e) { } } if (handler == null) { handler = new Thread.UncaughtExceptionHandler() { public void uncaughtException(final Thread t, final Throwable e) { boolean continueOnError = Boolean.getBoolean("qpid.broker.exceptionHandler.continue"); try { System.err.println( "########################################################################"); System.err.println("#"); System.err.print("# Unhandled Exception "); System.err.print(e.toString()); System.err.print(" in Thread "); System.err.println(t.getName()); System.err.println("#"); System.err.println(continueOnError ? "# Forced to continue by JVM setting 'qpid.broker.exceptionHandler.continue'" : "# Exiting"); System.err.println("#"); System.err.println( "########################################################################"); e.printStackTrace(System.err); Logger logger = LoggerFactory.getLogger("org.apache.qpid.server.Main"); logger.error("Uncaught exception, " + (continueOnError ? "continuing." : "shutting down."), e); } finally { if (!continueOnError) { Runtime.getRuntime().halt(1); } } } }; Thread.setDefaultUncaughtExceptionHandler(handler); } }
From source file:org.openscience.jmol.app.Jmol.java
public static void main(String[] args) { Dialog.setupUIManager();// www . j ava2 s .co m Jmol jmol = null; String modelFilename = null; String scriptFilename = null; Options options = new Options(); options.addOption("b", "backgroundtransparent", false, GT._("transparent background")); options.addOption("h", "help", false, GT._("give this help page")); options.addOption("n", "nodisplay", false, GT._("no display (and also exit when done)")); options.addOption("c", "check", false, GT._("check script syntax only")); options.addOption("i", "silent", false, GT._("silent startup operation")); options.addOption("l", "list", false, GT._("list commands during script execution")); options.addOption("o", "noconsole", false, GT._("no console -- all output to sysout")); options.addOption("t", "threaded", false, GT._("independent commmand thread")); options.addOption("x", "exit", false, GT._("exit after script (implicit with -n)")); OptionBuilder.withLongOpt("script"); OptionBuilder.withDescription("script file to execute"); OptionBuilder.withValueSeparator('='); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("s")); OptionBuilder.withLongOpt("menu"); OptionBuilder.withDescription("menu file to use"); OptionBuilder.withValueSeparator('='); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("m")); OptionBuilder.withArgName(GT._("property=value")); OptionBuilder.hasArg(); OptionBuilder.withValueSeparator(); OptionBuilder.withDescription(GT._("supported options are given below")); options.addOption(OptionBuilder.create("D")); OptionBuilder.withLongOpt("geometry"); // OptionBuilder.withDescription(GT._("overall window width x height, e.g. {0}", "-g512x616")); OptionBuilder.withDescription(GT._("window width x height, e.g. {0}", "-g500x500")); OptionBuilder.withValueSeparator(); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("g")); OptionBuilder.withLongOpt("quality"); // OptionBuilder.withDescription(GT._("overall window width x height, e.g. {0}", "-g512x616")); OptionBuilder.withDescription(GT._( "JPG image quality (1-100; default 75) or PNG image compression (0-9; default 2, maximum compression 9)")); OptionBuilder.withValueSeparator(); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("q")); OptionBuilder.withLongOpt("write"); OptionBuilder .withDescription(GT._("{0} or {1}:filename", new Object[] { "CLIP", "GIF|JPG|JPG64|PNG|PPM" })); OptionBuilder.withValueSeparator(); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("w")); int startupWidth = 0, startupHeight = 0; CommandLine line = null; try { CommandLineParser parser = new PosixParser(); line = parser.parse(options, args); } catch (ParseException exception) { System.err.println("Unexpected exception: " + exception.toString()); } if (line.hasOption("h")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("Jmol", options); // now report on the -D options System.out.println(); System.out.println(GT._("For example:")); System.out.println(); System.out.println("Jmol -ions myscript.spt -w JPEG:myfile.jpg > output.txt"); System.out.println(); System.out.println(GT._("The -D options are as follows (defaults in parenthesis):")); System.out.println(); System.out.println(" cdk.debugging=[true|false] (false)"); System.out.println(" cdk.debug.stdout=[true|false] (false)"); System.out.println(" display.speed=[fps|ms] (ms)"); System.out.println(" JmolConsole=[true|false] (true)"); System.out.println(" jmol.logger.debug=[true|false] (false)"); System.out.println(" jmol.logger.error=[true|false] (true)"); System.out.println(" jmol.logger.fatal=[true|false] (true)"); System.out.println(" jmol.logger.info=[true|false] (true)"); System.out.println(" jmol.logger.logLevel=[true|false] (false)"); System.out.println(" jmol.logger.warn=[true|false] (true)"); System.out.println(" plugin.dir (unset)"); System.out.println(" user.language=[CA|CS|DE|EN|ES|FR|NL|PT|TR] (EN)"); System.exit(0); } args = line.getArgs(); if (args.length > 0) { modelFilename = args[0]; } // Process more command line arguments // these are also passed to viewer String commandOptions = ""; //silent startup if (line.hasOption("i")) { commandOptions += "-i"; isSilent = Boolean.TRUE; } // transparent background if (line.hasOption("b")) { commandOptions += "-b"; } // independent command thread if (line.hasOption("t")) { commandOptions += "-t"; } //list commands during script operation if (line.hasOption("l")) { commandOptions += "-l"; } //output to sysout if (line.hasOption("o")) { commandOptions += "-o"; haveConsole = Boolean.FALSE; } //no display (and exit) if (line.hasOption("n")) { // this ensures that noDisplay also exits commandOptions += "-n-x"; haveDisplay = Boolean.FALSE; } //check script only if (line.hasOption("c")) { commandOptions += "-c"; } //run script if (line.hasOption("s")) { commandOptions += "-s"; scriptFilename = line.getOptionValue("s"); } //menu file if (line.hasOption("m")) { menuFile = line.getOptionValue("m"); } //exit when script completes (or file is read) if (line.hasOption("x")) { commandOptions += "-x"; } String imageType_name = null; //write image to clipboard or image file if (line.hasOption("w")) { imageType_name = line.getOptionValue("w"); } Dimension size; try { String vers = System.getProperty("java.version"); if (vers.compareTo("1.1.2") < 0) { System.out.println("!!!WARNING: Swing components require a " + "1.1.2 or higher version VM!!!"); } size = historyFile.getWindowSize(JMOL_WINDOW_NAME); if (size != null && haveDisplay.booleanValue()) { startupWidth = size.width; startupHeight = size.height; } //OUTER window dimensions /* if (line.hasOption("g") && haveDisplay.booleanValue()) { String geometry = line.getOptionValue("g"); int indexX = geometry.indexOf('x'); if (indexX > 0) { startupWidth = parseInt(geometry.substring(0, indexX)); startupHeight = parseInt(geometry.substring(indexX + 1)); } } */ Point b = historyFile.getWindowBorder(JMOL_WINDOW_NAME); //first one is just approximate, but this is set in doClose() //so it will reset properly -- still, not perfect //since it is always one step behind. if (b == null) border = new Point(12, 116); else border = new Point(b.x, b.y); //note -- the first time this is run after changes it will not work //because there is a bootstrap problem. int width = -1; int height = -1; int quality = 75; //INNER frame dimensions if (line.hasOption("g")) { String geometry = line.getOptionValue("g"); int indexX = geometry.indexOf('x'); if (indexX > 0) { width = Parser.parseInt(geometry.substring(0, indexX)); height = Parser.parseInt(geometry.substring(indexX + 1)); //System.out.println("setting geometry to " + geometry + " " + border + " " + startupWidth + startupHeight); } if (haveDisplay.booleanValue()) { startupWidth = width + border.x; startupHeight = height + border.y; } } if (line.hasOption("q")) quality = Parser.parseInt(line.getOptionValue("q")); if (imageType_name != null) commandOptions += "-w\1" + imageType_name + "\t" + width + "\t" + height + "\t" + quality + "\1"; if (startupWidth <= 0 || startupHeight <= 0) { startupWidth = 500 + border.x; startupHeight = 500 + border.y; } JFrame jmolFrame = new JFrame(); Point jmolPosition = historyFile.getWindowPosition(JMOL_WINDOW_NAME); if (jmolPosition != null) { jmolFrame.setLocation(jmolPosition); } //now pass these to viewer jmol = getJmol(jmolFrame, startupWidth, startupHeight, commandOptions); // Open a file if one is given as an argument -- note, this CAN be a script file if (modelFilename != null) { jmol.viewer.openFile(modelFilename); jmol.viewer.getOpenFileError(); } // OK, by now it is time to execute the script if (scriptFilename != null) { report("Executing script: " + scriptFilename); if (haveDisplay.booleanValue()) jmol.splash.showStatus(GT._("Executing script...")); jmol.viewer.evalFile(scriptFilename); } } catch (Throwable t) { System.out.println("uncaught exception: " + t); t.printStackTrace(); } if (haveConsole.booleanValue()) { Point location = jmol.frame.getLocation(); size = jmol.frame.getSize(); // Adding console frame to grab System.out & System.err consoleframe = new JFrame(GT._("Jmol Java Console")); consoleframe.setIconImage(jmol.frame.getIconImage()); try { final ConsoleTextArea consoleTextArea = new ConsoleTextArea(); consoleTextArea.setFont(java.awt.Font.decode("monospaced")); consoleframe.getContentPane().add(new JScrollPane(consoleTextArea), java.awt.BorderLayout.CENTER); if (Boolean.getBoolean("clearConsoleButton")) { JButton buttonClear = new JButton(GT._("Clear")); buttonClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { consoleTextArea.setText(""); } }); consoleframe.getContentPane().add(buttonClear, java.awt.BorderLayout.SOUTH); } } catch (IOException e) { JTextArea errorTextArea = new JTextArea(); errorTextArea.setFont(java.awt.Font.decode("monospaced")); consoleframe.getContentPane().add(new JScrollPane(errorTextArea), java.awt.BorderLayout.CENTER); errorTextArea.append(GT._("Could not create ConsoleTextArea: ") + e); } Dimension consoleSize = historyFile.getWindowSize(CONSOLE_WINDOW_NAME); Point consolePosition = historyFile.getWindowPosition(CONSOLE_WINDOW_NAME); if ((consoleSize != null) && (consolePosition != null)) { consoleframe.setBounds(consolePosition.x, consolePosition.y, consoleSize.width, consoleSize.height); } else { consoleframe.setBounds(location.x, location.y + size.height, size.width, 200); } Boolean consoleVisible = historyFile.getWindowVisibility(CONSOLE_WINDOW_NAME); if ((consoleVisible != null) && (consoleVisible.equals(Boolean.TRUE))) { consoleframe.show(); } } }
From source file:fr.gael.dhus.database.DatabasePostInit.java
private void doArchiveCheck() { boolean force_check = Boolean.getBoolean("Archive.check"); logger.info("Archives check (Archive.check) requested by user (" + force_check + ")"); if (!force_check) return;//from w w w. j a v a 2 s . co m try { logger.info("Control of Database coherence..."); long start = new Date().getTime(); productService.checkDBProducts(); logger.info("Control of Database coherence spent " + (new Date().getTime() - start) + " ms"); logger.info("Control of Indexes coherence..."); start = new Date().getTime(); searchService.checkIndex(); logger.info("Control of Indexes coherence spent " + (new Date().getTime() - start) + " ms"); logger.info("Control of incoming folder coherence..."); start = new Date().getTime(); incomingManager.checkIncomming(); logger.info("Control of incoming folder coherence spent " + (new Date().getTime() - start) + " ms"); logger.info("Optimizing database..."); DaoUtils.optimize(); } catch (Exception e) { logger.error("Cannot check DHus Archive.", e); } }
From source file:org.apache.axis2.deployment.util.Utils.java
private static boolean useJarFileClassLoader() { // The JarFileClassLoader was created to address a locking problem seen only on Windows platforms. // It carries with it a slight performance penalty that needs to be addressed. Rather than make // *nix OSes carry this burden we'll engage the JarFileClassLoader for Windows or if the user // specifically requests it. boolean useJarFileClassLoader; if (System.getProperty("org.apache.axis2.classloader.JarFileClassLoader") == null) { useJarFileClassLoader = System.getProperty("os.name").startsWith("Windows"); } else {/*from w w w .j av a 2s.c om*/ useJarFileClassLoader = Boolean.getBoolean("org.apache.axis2.classloader.JarFileClassLoader"); } return useJarFileClassLoader; }