List of usage examples for java.lang Boolean toString
public static String toString(boolean b)
From source file:com.twinsoft.convertigo.engine.requesters.WebClippingServletRequester.java
@Override protected Object coreProcessRequest() throws Exception { try {//from w ww . j a v a 2 s . c o m if (context.getConnector() != null) { if (context.getConnector() instanceof HtmlConnector) { HtmlConnector connector = (HtmlConnector) context.getConnector(); if (bDirty) { return Boolean.toString(connector.getHtmlParser().getDomDirty(context)).getBytes(); } else { HttpServletRequest request = (HttpServletRequest) inputData; String webURL = request.getQueryString(); String contentType = null; if (webURL == null) { Engine.logEngine .debug("(WebClippingServletRequester) no webURL !!! return empty result"); return new byte[0]; } webURL = webURL.replace('\\', '/'); //TODO: q&d fix #419 [Invalid URI error if ressource image to get contains "\"] ; may be include it in httpClient ? Engine.logEngine.trace("(WebClippingServletRequester) weburl is " + webURL); InputStream is = bCache ? cache.getResource(webURL) : null; if (is == null) { String charset = null; byte[] data = null; synchronized (context) { connector.sUrl = webURL; if (context.requestedObject == null) { context.requestedObject = connector.getDefaultTransaction(); context.transaction = (HtmlTransaction) context.requestedObject; context.requestedObject.createRequestableThread(); } //save old context headers String exContentType = context.contentType; Header[] exHeaders = context.getResponseHeaders(); data = connector.getData(context); contentType = context.contentType; charset = connector.getCharset(); //restore old context headers context.contentType = exContentType; context.setResponseHeaders(exHeaders); Engine.logEngine .trace("(WebClippingServletRequester) contentType is " + contentType); Engine.logEngine.trace("(WebClippingServletRequester) charset is " + charset); } request.setAttribute("convertigo.charset", charset); data = rewriteCSS(data, webURL, contentType, charset); is = new ByteArrayInputStream(data); if (bCache) { CacheEntry c = cache.storeResponse(webURL, data); c.contentLength = data.length; c.contentType = contentType; } } else { contentType = cache.getCacheEntry(webURL).contentType; } request.setAttribute("convertigo.contentType", contentType); byte[] data = new byte[is.available()]; is.read(data); is.close(); return data; } } else if (context.getConnector() instanceof JavelinConnector && bDirty) { Session session = Engine.theApp.sessionManager.getSession(context.contextID); if (session != null) { return Boolean.toString(session.isSomethingChange()); } } } } catch (EngineException e) { Engine.logEngine.error("Error", e); } return null; }
From source file:com.francetelecom.clara.cloud.commons.toggles.PaasJndiStateRepository.java
@Override public void setFeatureState(FeatureState featureState) { String featureName = featureState.getFeature().name(); try {// www.j a v a 2 s . com InitialContext jndiContext = getInitialContext(); jndiContext.rebind(featureName, Boolean.toString(featureState.isEnabled())); String users = StringUtils.join(featureState.getUsers(), ", "); //for(String user:featureState.getUsers()) users += user+", "; jndiContext.rebind(featureName + ".users", users); } catch (NamingException e) { logger.error("unable to save state of feature " + featureName + " in jndi", e); } }
From source file:org.gravidence.gravifon.db.ViewQueryArguments.java
/** * Adds <code>include_docs</code> query argument. * //from ww w. jav a 2 s . com * @param value query argument value * @return reference to this object */ public ViewQueryArguments addIncludeDocs(boolean value) { arguments.put("include_docs", Boolean.toString(value)); return this; }
From source file:com.cognifide.maven.plugins.crx.CrxPackageInstallMojo.java
protected List<Part> createInstallParameters() { List<Part> partList = new ArrayList<Part>(); partList.add(new StringPart("recursive", Boolean.toString(this.recursive))); return partList; }
From source file:com.github.horrorho.liquiddonkey.settings.commandline.CommandLinePropertiesFactory.java
public Properties from(Properties parent, CommandLineOptions commandLineOptions, String[] args) throws ParseException { Properties properties = new Properties(parent); CommandLineParser parser = new DefaultParser(); Options options = commandLineOptions.options(); CommandLine cmd = parser.parse(options, args); switch (cmd.getArgList().size()) { case 0://from www. ja va 2s . c o m // No authentication credentials break; case 1: // Authentication token properties.put(Property.AUTHENTICATION_TOKEN.name(), cmd.getArgList().get(0)); break; case 2: // AppleId/ password pair properties.put(Property.AUTHENTICATION_APPLEID.name(), cmd.getArgList().get(0)); properties.put(Property.AUTHENTICATION_PASSWORD.name(), cmd.getArgList().get(1)); break; default: throw new ParseException( "Too many non-optional arguments, expected appleid/ password or authentication token only."); } Iterator<Option> it = cmd.iterator(); while (it.hasNext()) { Option option = it.next(); String opt = commandLineOptions.opt(option); String property = commandLineOptions.property(option).name(); if (option.hasArgs()) { // String array properties.put(property, joined(cmd.getOptionValues(opt))); } else if (option.hasArg()) { // String value properties.put(property, cmd.getOptionValue(opt)); } else { // String boolean properties.put(property, Boolean.toString(cmd.hasOption(opt))); } } return properties; }
From source file:com.inclouds.hbase.test.CoprocessorCachePersistenceTest.java
@Override public void setUp() throws Exception { // ConsoleAppender console = new ConsoleAppender(); // create appender // // configure the appender // String PATTERN = "%d [%p|%c|%C{1}] %m%n"; // console.setLayout(new PatternLayout(PATTERN)); // console.setThreshold(Level.ERROR); ///* w w w .j av a2s.c o m*/ // console.activateOptions(); // // add appender to any Logger (here is root) // Logger.getRootLogger().removeAllAppenders(); // Logger.getRootLogger().addAppender(console); Configuration conf = UTIL.getConfiguration(); conf.set(CoprocessorHost.USER_REGION_COPROCESSOR_CONF_KEY, CP_CLASS_NAME); conf.set("hbase.zookeeper.useMulti", "false"); // Cache configuration conf.set(RowCache.ROWCACHE_MAXMEMORY, "1000000000"); //conf.set(CacheConfiguration.EVICTION_POLICY, "LRU"); conf.set(RowCache.ROWCACHE_MAXITEMS, "10000000"); conf.set(RowCache.ROWCACHE_COMPRESSION, "LZ4"); // set persistent cache conf.set(RowCache.ROWCACHE_PERSISTENT, Boolean.toString(true)); conf.set(RowCache.ROWCACHE_CACHE_DATA_ROOTS, "/tmp/ramdisk/data"); File file = new File("/tmp/ramdisk/data/row-cache.dat"); if (file.exists()) { loadOnStartup = true; } // Enable snapshot UTIL.startMiniCluster(1); // Row Cache if (data != null) return; data = generateData(N); cluster = UTIL.getMiniHBaseCluster(); createTables(VERSIONS); createHBaseTables(); while (cache == null) { cache = RowCache.instance; Thread.sleep(1000); LOG.error("WAIT 1s for row cache to come up"); } LOG.error("cache = " + cache); }
From source file:com.linkedin.pinot.common.utils.KafkaStarterUtils.java
public static void configureTopicDeletion(Properties configuration, boolean topicDeletionEnabled) { configuration.put("delete.topic.enable", Boolean.toString(topicDeletionEnabled)); }
From source file:com.redhat.rcm.nexus.security.NxSecConfiguration.java
public void save() throws ConfigurationException { File configFile = new File(appConfiguration.getConfigurationDirectory(), NX_SEC_CONFIG_FILE); FileOutputStream fos = null;// www .jav a 2 s. com try { Properties props = new Properties(); props.setProperty(KEY_AUTOCREATE_ENABLED, Boolean.toString(autoCreateEnabled)); props.setProperty(KEY_AUTOCREATE_EMAIL_DOMAIN, autoCreateEmailDomain); fos = new FileOutputStream(configFile); props.store(fos, "Saved on: " + new Date()); } catch (IOException e) { throw new ConfigurationException("Cannot write " + configFile + ". Reason: " + e.getMessage(), e); } finally { closeQuietly(fos); } }
From source file:gobblin.writer.initializer.JdbcWriterInitializer.java
public JdbcWriterInitializer(State state, Collection<WorkUnit> workUnits, JdbcWriterCommandsFactory jdbcWriterCommandsFactory, int branches, int branchId) { validateInput(state);/*w w w . j a v a2 s .c o m*/ this.state = state; this.workUnits = Lists.newArrayList(workUnits); this.branches = branches; this.branchId = branchId; this.jdbcWriterCommandsFactory = jdbcWriterCommandsFactory; this.database = getProp(this.state, JdbcPublisher.JDBC_PUBLISHER_DATABASE_NAME, this.branches, this.branchId); this.createdStagingTables = Sets.newHashSet(); //AbstractJobLauncher assumes that the staging is in HDFS and trying to clean it. //As WriterInitializer will clean staging table, we don't need AbstractJobLauncher to clean. state.setProp(ConfigurationKeys.CLEANUP_STAGING_DATA_BY_INITIALIZER, Boolean.toString(true)); }