List of usage examples for java.util Collections emptyMap
@SuppressWarnings("unchecked") public static final <K, V> Map<K, V> emptyMap()
From source file:com.hp.autonomy.searchcomponents.idol.search.fields.FieldsParserImpl.java
@Override public void parseDocumentFields(final Hit hit, final IdolSearchResult.Builder searchResultBuilder) { final FieldsInfo fieldsInfo = configService.getConfig().getFieldsInfo(); final Map<String, FieldInfo<?>> fieldConfig = fieldsInfo.getFieldConfigByName(); final DocContent content = hit.getContent(); Map<String, FieldInfo<?>> fieldMap = Collections.emptyMap(); String qmsId = null;// w w w . j a v a2 s . c om PromotionCategory promotionCategory = PromotionCategory.NONE; if (content != null) { final Element docContent = (Element) content.getContent().get(0); if (docContent.hasChildNodes()) { final NodeList childNodes = docContent.getChildNodes(); fieldMap = new HashMap<>(childNodes.getLength()); parseAllFields(fieldConfig, childNodes, fieldMap, docContent.getNodeName()); qmsId = parseField(docContent, IdolDocumentFieldsService.QMS_ID_FIELD_INFO, String.class); promotionCategory = determinePromotionCategory(docContent, hit.getPromotionname(), hit.getDatabase()); } } searchResultBuilder.setFieldMap(fieldMap).setQmsId(qmsId).setPromotionCategory(promotionCategory); }
From source file:org.elasticsearch.smoketest.MonitoringWithWatcherRestIT.java
@After public void cleanExporters() throws Exception { String body = Strings.toString(jsonBuilder().startObject().startObject("transient") .nullField("xpack.monitoring.exporters.*").endObject().endObject()); assertOK(adminClient().performRequest("PUT", "_cluster/settings", Collections.emptyMap(), new StringEntity(body, ContentType.APPLICATION_JSON))); assertOK(adminClient().performRequest("DELETE", ".watch*", Collections.emptyMap())); }
From source file:com.marvelution.hudson.plugins.jirareporter.utils.IssueTextUtils.java
/** * Create the text content for a specific issue field * // w w w. j a v a 2 s . c o m * @param type the {@link Type} of text to create * @param build the {@link AbstractBuild} * @param site the {@link JIRASite} * @return the created text content */ public static String createFieldText(Type type, AbstractBuild<?, ?> build, JIRASite site) { final StringWriter writer = new StringWriter(); final XMLOutput output = XMLOutput.createXMLOutput(writer); final JellyContext context = new JellyContext(); context.setVariable("rootURL", Hudson.getInstance().getRootUrl()); context.setVariable("build", build); context.setVariable("site", site); try { Class.forName("jenkins.model.Jenkins"); context.setVariable("system", "Jenkins"); } catch (ClassNotFoundException e) { context.setVariable("system", "Hudson"); } context.setVariable("version", Hudson.getVersion().toString()); try { context.setVariable("environment", build.getEnvironment(new LogTaskListener(LOGGER, Level.INFO))); } catch (Exception e) { context.setVariable("environment", Collections.emptyMap()); } // Utilize the Dozer Mapper and its convertors of the API V2 plugin to get the ChangeLog and TestResults try { context.setVariable("changelog", DozerUtils.getMapper().map(build.getChangeSet(), ChangeLog.class)); } catch (Exception e) { context.setVariable("changelog", new ChangeLog()); } try { context.setVariable("testresults", DozerUtils.getMapper().map(build, TestResult.class)); } catch (Exception e) { context.setVariable("testresults", new TestResult()); } try { context.runScript( HudsonPluginUtils.getPluginClassloader().getResource("fields/" + type.field(site) + ".jelly"), output); } catch (JellyException e) { LOGGER.log(Level.SEVERE, "Failed to create Text of type " + type.name(), e); throw new IllegalStateException("Cannot raise an issue if no text is available", e); } return writer.toString().trim(); }
From source file:com.inspiresoftware.lib.dto.geda.interceptor.impl.TransferableUtils.java
private static Map<Occurrence, AdviceConfig> resolveConfiguration(final Method method, final Class<?> targetClass, final boolean trySpecific) { Method specificMethod = method; Transferable annotation = specificMethod.getAnnotation(Transferable.class); if (annotation == null && trySpecific) { specificMethod = AopUtils.getMostSpecificMethod(method, targetClass); annotation = specificMethod.getAnnotation(Transferable.class); }//from w w w. ja va2s . c o m if (annotation == null) { return Collections.emptyMap(); } final Map<Occurrence, AdviceConfig> cfg = new HashMap<Occurrence, AdviceConfig>(); resolveConfiguration(cfg, specificMethod.getName(), specificMethod.getParameterTypes(), specificMethod.getReturnType(), annotation); return cfg; }
From source file:com.simplymeasured.prognosticator.HiveJDBCQueryImpl.java
@Override public Iterator<Map<String, Object>> runQuery(String resultTable, String queryStatement, Map<String, Object> parameters) { final ArrayBlockingQueue<Map<String, Object>> rowQueue = new ArrayBlockingQueue<Map<String, Object>>(1000); ThreadedQueryRunnable runnable = new ThreadedQueryRunnable(dataSource, queryStatement, parameters, rowQueue);//from w ww . jav a 2 s. co m executorService.submit(runnable); return new Iterator<Map<String, Object>>() { private boolean done = false; private Map<String, Object> cachedRow = null; private final Map<String, Object> emptyMap = Collections.emptyMap(); @Override public boolean hasNext() { try { if (done) return false; cachedRow = rowQueue.take(); if (cachedRow == null || cachedRow == emptyMap) { done = true; return false; } return true; } catch (InterruptedException ie) { throw new RuntimeException("Iterator thread killed!", ie); } } @Override public Map<String, Object> next() { if (done || cachedRow == emptyMap) { throw new IllegalStateException("End of iterator reached"); } else if (cachedRow == null) { boolean hasMore = hasNext(); if (!hasMore) { done = true; throw new IllegalStateException("End of iterator reached"); } } return cachedRow; } @Override public void remove() { // intentionally non-op } }; }
From source file:com.garrettwu.spring.view.soy.AbstractTemplateManager.java
/** * Gets the data that should be bound to global variables available in all templates. * * @return A map from global variable name to its bound data value. *///w w w . j a va 2s . c o m protected Map<String, ?> getGlobalTemplateDataBindings() { return Collections.emptyMap(); }
From source file:ch.ralscha.extdirectspring.bean.ExtDirectStoreReadRequest.java
public ExtDirectStoreReadRequest() { this.filters = Collections.emptyList(); this.sorters = Collections.emptyList(); this.groups = Collections.emptyList(); this.params = Collections.emptyMap(); }
From source file:org.elasticsearch.plugins.ResponseHeaderPluginIT.java
public void testThatSettingHeadersWorks() throws Exception { ensureGreen();//ww w .ja v a 2 s .c o m try { getRestClient().performRequest("GET", "/_protected", Collections.emptyMap(), null); fail("request should have failed"); } catch (ResponseException e) { Response response = e.getResponse(); assertThat(response.getStatusLine().getStatusCode(), equalTo(401)); assertThat(response.getHeader("Secret"), equalTo("required")); } try (Response authResponse = getRestClient().performRequest("GET", "/_protected", Collections.emptyMap(), null, new BasicHeader("Secret", "password"))) { assertThat(authResponse.getStatusLine().getStatusCode(), equalTo(200)); assertThat(authResponse.getHeader("Secret"), equalTo("granted")); } }
From source file:net.firejack.platform.core.utils.MiscUtils.java
/** * @param properties// ww w .j a va2 s. co m * @return */ public static Map<String, String> getProperties(File properties) { if (properties == null || !properties.exists()) { return Collections.emptyMap(); } Properties props = new Properties(); FileInputStream stream = null; try { stream = new FileInputStream(properties); props.load(stream); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { IOUtils.closeQuietly(stream); } Map<String, String> propertiesMap = new HashMap<String, String>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { propertiesMap.put((String) entry.getKey(), (String) entry.getValue()); } return propertiesMap; }
From source file:org.apache.metamodel.elasticsearch.rest.ElasticSearchRestClient.java
private static Request refresh(final String indexName) { return new Request(HttpPost.METHOD_NAME, "/" + indexName + "/_refresh", Collections.emptyMap(), null); }