List of usage examples for java.util Collections emptyMap
@SuppressWarnings("unchecked") public static final <K, V> Map<K, V> emptyMap()
From source file:de.micromata.genome.gwiki.controls.GWikiViewAllPagesActionBean.java
public Map<String, String> decode(String search) { if (StringUtils.isEmpty(search) == true) { return Collections.emptyMap(); }/* w w w .ja v a 2 s . com*/ Map<String, String> parmsMap = new HashMap<String, String>(); String params[] = search.split("&"); for (String param : params) { String temp[] = param.split("="); if (temp.length < 2) { continue; } if (StringUtils.isEmpty(temp[0]) == true || StringUtils.isEmpty(temp[1]) == true) { continue; } try { parmsMap.put(temp[0], java.net.URLDecoder.decode(temp[1], "UTF-8")); } catch (UnsupportedEncodingException ex) { throw new RuntimeException( "Cannot decode url param: " + temp[0] + "=" + temp[1] + "; " + ex.getMessage(), ex); } } return parmsMap; }
From source file:ch.cyberduck.core.openstack.SwiftUrlProvider.java
public SwiftUrlProvider(final SwiftSession session) { this(session, Collections.emptyMap()); }
From source file:org.codegist.crest.HttpClientRestService.java
private static Map<String, List<String>> toHeaders(Header[] headers) { if (headers == null) return Collections.emptyMap(); Map<String, List<String>> map = new HashMap<String, List<String>>(); for (Header h : headers) { map.put(h.getName(), Arrays.asList(h.getValue()));/*is that good enough ?????*/ }//from ww w . j av a 2 s .c o m return map; }
From source file:org.apache.metamodel.elasticsearch.rest.ElasticSearchRestClient.java
private static Request delete(final String indexName) { return new Request(HttpDelete.METHOD_NAME, "/" + indexName, Collections.emptyMap(), null); }
From source file:org.hawkular.apm.tests.dist.AbstractITest.java
protected Response post(Server server, String path, String tenant, Object payload) throws IOException { return post(server, path, tenant, payload, Collections.emptyMap()); }
From source file:com.ikanow.aleph2.analytics.storm.assets.SampleStormStreamTopology1.java
@Override public Tuple2<Object, Map<String, String>> getTopologyAndConfiguration(final DataBucketBean bucket, final IEnrichmentModuleContext context) { final TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("spout1", new SampleWebReaderSpout("https://raw.githubusercontent.com/IKANOW/Aleph2/master/README.md")); builder.setBolt("bolt1", new SampleWordParserBolt()).shuffleGrouping("spout1"); return Tuples._2T(builder.createTopology(), Collections.emptyMap()); }
From source file:org.elasticsearch.smoketest.SmokeTestWatcherWithSecurityClientYamlTestSuiteIT.java
@Before public void startWatcher() throws Exception { // delete the watcher history to not clutter with entries from other test getAdminExecutionContext().callApi("indices.delete", Collections.singletonMap("index", ".watcher-history-*"), emptyList(), emptyMap()); // create one document in this index, so we can test in the YAML tests, that the index cannot be accessed Response resp = adminClient().performRequest("PUT", "/index_not_allowed_to_read/doc/1", Collections.emptyMap(), new StringEntity("{\"foo\":\"bar\"}", ContentType.APPLICATION_JSON)); assertThat(resp.getStatusLine().getStatusCode(), is(201)); assertBusy(() -> {/*from w w w . java 2s .c o m*/ ClientYamlTestResponse response = getAdminExecutionContext().callApi("xpack.watcher.stats", emptyMap(), emptyList(), emptyMap()); String state = (String) response.evaluate("stats.0.watcher_state"); switch (state) { case "stopped": ClientYamlTestResponse startResponse = getAdminExecutionContext().callApi("xpack.watcher.start", emptyMap(), emptyList(), emptyMap()); boolean isAcknowledged = (boolean) startResponse.evaluate("acknowledged"); assertThat(isAcknowledged, is(true)); break; case "stopping": throw new AssertionError("waiting until stopping state reached stopped state to start again"); case "starting": throw new AssertionError("waiting until starting state reached started state"); case "started": // all good here, we are done break; default: throw new AssertionError("unknown state[" + state + "]"); } }); assertBusy(() -> { for (String template : WatcherIndexTemplateRegistryField.TEMPLATE_NAMES) { ClientYamlTestResponse templateExistsResponse = getAdminExecutionContext().callApi( "indices.exists_template", singletonMap("name", template), emptyList(), emptyMap()); assertThat(templateExistsResponse.getStatusCode(), is(200)); } }); }
From source file:com.liferay.wiki.util.WikiCacheUtil.java
public static Map<String, Boolean> getOutgoingLinks(WikiPage page, WikiEngineRenderer wikiEngineRenderer) throws PageContentException { String key = _encodeKey(page.getNodeId(), page.getTitle(), _OUTGOING_LINKS); Map<String, Boolean> links = (Map<String, Boolean>) _portalCache.get(key); if (links == null) { WikiEngine wikiEngine = wikiEngineRenderer.fetchWikiEngine(page.getFormat()); if (wikiEngine != null) { links = wikiEngine.getOutgoingLinks(page); } else {/* w ww.j a va 2s . c om*/ links = Collections.emptyMap(); } PortalCacheHelperUtil.putWithoutReplicator(_portalCache, key, (Serializable) links); } return links; }
From source file:ch.cyberduck.core.sds.SDSErrorResponseInterceptor.java
@Override public boolean retryRequest(final HttpResponse response, final int executionCount, final HttpContext context) { switch (response.getStatusLine().getStatusCode()) { case HttpStatus.SC_UNAUTHORIZED: if (executionCount <= MAX_RETRIES) { final ApiException failure; try { EntityUtils.updateEntity(response, new BufferedHttpEntity(response.getEntity())); failure = new ApiException(response.getStatusLine().getStatusCode(), Collections.emptyMap(), EntityUtils.toString(response.getEntity())); if (new SDSExceptionMappingService().map(failure) instanceof ExpiredTokenException) { // The provided token is valid for two hours, every usage resets this period to two full hours again. Logging off invalidates the token. try { token = new AuthApi(session.getClient()).login( new LoginRequest().authType(session.getHost().getProtocol().getAuthorization()) .login(user).password(password)) .getToken(); return true; } catch (ApiException e) { // {"code":401,"message":"Unauthorized","debugInfo":"Wrong username or password","errorCode":-10011} log.warn(String.format("Attempt to renew expired auth token failed. %s", e.getMessage())); return false; }/* w ww . j av a 2 s. co m*/ } } catch (IOException e) { log.warn(String.format("Failure parsing response entity from %s", response)); return false; } } } return false; }
From source file:se.uu.it.cs.recsys.ruleminer.api.RuleMiner.java
@Cacheable("FPPatterns") public Map<Set<Integer>, Integer> getPatterns(Integer threshold) { int minSupport = threshold == null ? FPGrowthImpl.DEFAULT_MIN_SUPPORT : threshold; FPTree tree = treeBuilder.buildTreeFromDB(minSupport); if (tree == null) { LOGGER.debug("No FP tree can be built to meet the min support {} ", minSupport); return Collections.emptyMap(); }/*from w w w. java 2 s. co m*/ return fpGrowthImpl.getAllFrequentPattern(tree, minSupport); }