List of usage examples for java.lang Boolean getBoolean
public static boolean getBoolean(String name)
From source file:org.apache.juneau.rest.client.RestClient.java
/** * Same as {@link #close()}, but ignores any exceptions. *//*from w w w .j a va 2s. c om*/ public void closeQuietly() { isClosed = true; try { if (httpClient != null && !keepHttpClientOpen) httpClient.close(); if (executorService != null && executorServiceShutdownOnClose) executorService.shutdown(); } catch (Throwable t) { } if (Boolean.getBoolean("org.apache.juneau.rest.client.RestClient.trackLifecycle")) closedStack = Thread.currentThread().getStackTrace(); }
From source file:org.sonar.plugins.php.pmd.configuration.PhpPmdConfiguration.java
/** * @see org.sonar.plugins.php.core.configuration.PhpPluginAbstractConfiguration #shouldAnalyseOnlyDefault() *//*w w w . ja va 2 s.c o m*/ @Override protected boolean shouldAnalyseOnlyDefault() { return Boolean.getBoolean(DEFAULT_ANALYSE_ONLY); }
From source file:io.jenkins.blueocean.blueocean_git_pipeline.GitReadSaveTest.java
private void startSSH(@Nullable User u) throws Exception { if (sshd == null) { // Set up an SSH server with access to a git repo User user;/*ww w . j a v a2s.c o m*/ if (u == null) { user = login(); } else { user = u; } final BasicSSHUserPrivateKey key = UserSSHKeyManager.getOrCreate(user); final JSch jsch = new JSch(); final KeyPair pair = KeyPair.load(jsch, key.getPrivateKey().getBytes(), null); File keyFile = new File(System.getProperty("TEST_SSH_SERVER_KEY_FILE", File.createTempFile("hostkey", "ser").getCanonicalPath())); int port = Integer.parseInt(System.getProperty("TEST_SSH_SERVER_PORT", "0")); boolean allowLocalUser = Boolean.getBoolean("TEST_SSH_SERVER_ALLOW_LOCAL"); String userPublicKey = Base64.encode(pair.getPublicKeyBlob()); sshd = new SSHServer(repoForSSH.getRoot(), keyFile, port, allowLocalUser, ImmutableMap.of("bob", userPublicKey), true); // Go, go, go sshd.start(); } }
From source file:fr.gael.dhus.database.DatabasePostInit.java
private boolean doIncomingRepopulate() { boolean force_relocate = Boolean.getBoolean("Archive.incoming.relocate"); logger.info("Archives incoming relocate (Archive.incoming.relocate)" + " requested by user (" + force_relocate + ")"); if (!force_relocate) return false; String incoming_path = System.getProperty("Archive.incoming.relocate.path", incomingManager.getIncomingBuilder().getRoot().getPath()); // Force reset the counter. HierarchicalDirectoryBuilder output_builder = new HierarchicalDirectoryBuilder(new File(incoming_path), cfgManager.getArchiveConfiguration().getIncomingConfiguration().getMaxFileNo()); Iterator<Product> products = productDao.getAllProducts(); while (products.hasNext()) { Product product = products.next(); boolean shared_path = false; // Copy the product path File old_path = new File(product.getPath().getPath()); File new_path = null; // Check is same products are use for path and download if (product.getDownloadablePath().equals(old_path.getPath())) shared_path = true;/*from w w w . ja v a2s.c o m*/ if (incomingManager.isInIncoming(old_path)) { new_path = getNewProductPath(output_builder); try { logger.info("Relocate " + old_path.getPath() + " to " + new_path.getPath()); FileUtils.moveToDirectory(old_path, new_path, true); File path = old_path; while (!incomingManager.isAnIncomingElement(path)) { path = path.getParentFile(); } FileUtils.cleanDirectory(path); } catch (IOException e) { logger.error("Cannot move directory " + old_path.getPath() + " to " + new_path.getPath(), e); logger.error("Aborting relocation process."); return false; } URL product_path = null; try { product_path = new File(new_path, old_path.getName()).toURI().toURL(); } catch (MalformedURLException e) { logger.error("Unrecoverable error : aboting relocate.", e); return false; } product.setPath(product_path); // Commit this change productDao.update(product); searchService.index(product); } // copy the downloadable path if (product.getDownload().getPath() != null) { if (shared_path) { product.getDownload().setPath(product.getPath().getPath()); } else { new_path = getNewProductPath(output_builder); old_path = new File(product.getDownload().getPath()); try { logger.info("Relocate " + old_path.getPath() + " to " + new_path.getPath()); FileUtils.moveFileToDirectory(old_path, new_path, false); } catch (IOException e) { logger.error( "Cannot move downloadable file " + old_path.getPath() + " to " + new_path.getPath(), e); logger.error("Aborting relocation process."); return false; } product.getDownload().setPath(new File(new_path, old_path.getName()).getPath()); // Commit this change } productDao.update(product); } // Copy Quicklooks new_path = null; if (product.getQuicklookFlag()) { old_path = new File(product.getQuicklookPath()); if (new_path == null) new_path = output_builder.getDirectory(); try { logger.info("Relocate " + old_path.getPath() + " to " + new_path.getPath()); FileUtils.moveToDirectory(old_path, new_path, false); } catch (IOException e) { logger.error("Cannot move quicklook file " + old_path.getPath() + " to " + new_path.getPath(), e); logger.error("Aborting relocation process."); return false; } File f = new File(new_path, old_path.getName()); product.setQuicklookPath(f.getPath()); product.setQuicklookSize(f.length()); productDao.update(product); } // Copy Thumbnails in the same incoming path as quicklook if (product.getThumbnailFlag()) { old_path = new File(product.getThumbnailPath()); if (new_path == null) new_path = output_builder.getDirectory(); try { logger.info("Relocate " + old_path.getPath() + " to " + new_path.getPath()); FileUtils.moveToDirectory(old_path, new_path, false); } catch (IOException e) { logger.error("Cannot move thumbnail file " + old_path.getPath() + " to " + new_path.getPath(), e); logger.error("Aborting relocation process."); return false; } File f = new File(new_path, old_path.getName()); product.setThumbnailPath(f.getPath()); product.setThumbnailSize(f.length()); productDao.update(product); } } // Remove unused directories try { cleanupIncoming(incomingManager.getIncomingBuilder().getRoot()); } catch (Exception e) { logger.error("Cannot cleanup incoming folder", e); } return true; }
From source file:com.ericsson.eiffel.remrem.publish.cli.CLI.java
@Override public void run(String... args) throws Exception { if (CliOptions.hasParsedOptions()) handleOptions();//from w w w. ja va 2 s . c om boolean cliMode = Boolean.getBoolean(PropertiesConfig.CLI_MODE); if (cliMode) CliOptions.help(CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION); }
From source file:org.exoplatform.social.core.space.impl.SpaceServiceImpl.java
/** * SpaceServiceImpl constructor Initialize * <tt>org.exoplatform.social.space.impl.JCRStorage</tt> * /*from w w w .j a v a 2s . c o m*/ * @param params * @throws Exception */ @SuppressWarnings("unchecked") public SpaceServiceImpl(InitParams params, SpaceStorage spaceStorage, IdentityStorage identityStorage, ActivityStreamStorage streamStorage) throws Exception { this.spaceStorage = spaceStorage; this.identityStorage = identityStorage; this.streamStorage = streamStorage; //backward compatible if (params != null) { LOG.warn("The SpaceService configuration you attempt to use is deprecated, please update it by" + "using external-component-plugins configuration"); spaceApplicationConfigPlugin = new SpaceApplicationConfigPlugin(); Iterator<?> it = params.getValuesParamIterator(); while (it.hasNext()) { ValuesParam param = (ValuesParam) it.next(); String name = param.getName(); if (name.endsWith("homeNodeApp")) { String homeNodeApp = param.getValue(); SpaceApplication spaceHomeApplication = new SpaceApplication(); spaceHomeApplication.setPortletName(homeNodeApp); spaceHomeApplication.setAppTitle(homeNodeApp); spaceHomeApplication.setIcon("SpaceHomeIcon"); spaceApplicationConfigPlugin.setHomeApplication(spaceHomeApplication); } if (name.endsWith("apps")) { List<String> apps = param.getValues(); for (String app : apps) { String[] splitedString = app.trim().split(":"); String appName; boolean isRemovable; if (splitedString.length >= 2) { appName = splitedString[0]; isRemovable = Boolean.getBoolean(splitedString[1]); } else { //suppose app is just the name appName = app; isRemovable = false; } SpaceApplication spaceApplication = new SpaceApplication(); spaceApplication.setPortletName(appName); spaceApplication.isRemovable(isRemovable); spaceApplicationConfigPlugin.addToSpaceApplicationList(spaceApplication); } } } } }
From source file:org.mili.core.resource.ResourceUtilImpl.java
@Override public String getString(Locale locale, String baseName, String key) { Validate.notNull(locale, "locale cannot be null!"); Validate.notEmpty(baseName, "basename cannot be empty!"); Validate.notEmpty(key, "key cannot be empty!"); Map<String, String> bundle = getBundle(locale, baseName, key); try {// w w w . jav a 2 s .com String res = bundle.get(key); if (res == null) { throw new MissingResourceException("missing resource!", null, key); } return res; } catch (MissingResourceException e) { setUpMissingResourceHandler(locale, baseName, key); if (Boolean.getBoolean(PROP_LOGMISSINGRESOURCE)) { MissingResourceLogger.INSTANCE.log(locale, key); } if (Boolean.getBoolean(PROP_THROWEXCEPTIONONMISSINGRESOURCE)) { throw new MissingResourceException( "Missing resource for locale ! " + getInfo(locale, baseName, key), e.getClassName(), key); } else { if (Boolean.getBoolean(PROP_LOGMISSINGRESOURCEASWARNING)) { log.warn("Missing resource for locale! ", getInfo(locale, baseName, key)); } return createMissingResource(key); } } }
From source file:org.eclipse.cdt.arduino.core.internal.board.ArduinoManager.java
public boolean licenseAccepted() throws CoreException { init();/* www . j av a 2s. c o m*/ return Boolean.getBoolean(props.getProperty(ACCEPTED_KEY, Boolean.FALSE.toString())); }
From source file:org.sonar.plugins.php.pmd.configuration.PhpPmdConfiguration.java
/** * @see org.sonar.plugins.php.core.configuration.PhpPluginAbstractConfiguration #shouldRunDefault() */// ww w.j a v a2 s . c o m @Override protected boolean shouldRunDefault() { return Boolean.getBoolean(DEFAULT_SHOULD_RUN); }
From source file:com.ericsson.eiffel.remrem.generate.cli.CLI.java
private MsgService getMessageService(CommandLine commandLine) { if (commandLine.hasOption("mp")) { String protocol = commandLine.getOptionValue("mp"); for (MsgService service : msgServices) { if (service.getServiceName().equals(protocol)) { return service; }// w w w . j ava2 s . co m } } else { for (MsgService service : msgServices) { if (service instanceof SemanticsService) return service; } } boolean testMode = Boolean.getBoolean(PropertiesConfig.TEST_MODE); if (testMode && msgServices.size() > 0) return msgServices.get(0); //return msgServices[0]; System.out.println("No protocol service has been found registered."); CLIOptions.exit(CLIExitCodes.MESSAGE_PROTOCOL_NOT_FOUND); return null; }