Example usage for java.util Collections emptyMap

List of usage examples for java.util Collections emptyMap

Introduction

In this page you can find the example usage for java.util Collections emptyMap.

Prototype

@SuppressWarnings("unchecked")
public static final <K, V> Map<K, V> emptyMap() 

Source Link

Document

Returns an empty map (immutable).

Usage

From source file:com.espertech.esper.core.start.EPStatementStartMethodHelperPrior.java

public static Map<ExprPriorNode, ExprPriorEvalStrategy> compilePriorNodeStrategies(
        ViewResourceDelegateVerified viewResourceDelegate,
        AgentInstanceViewFactoryChainContext viewFactoryChainContexts[]) {

    if (!viewResourceDelegate.isHasPrior()) {
        return Collections.emptyMap();
    }//from   w  w w .j a v  a2 s. c om

    Map<ExprPriorNode, ExprPriorEvalStrategy> strategies = new HashMap<ExprPriorNode, ExprPriorEvalStrategy>();

    for (int streamNum = 0; streamNum < viewResourceDelegate.getPerStream().length; streamNum++) {
        ViewUpdatedCollection viewUpdatedCollection = viewFactoryChainContexts[streamNum]
                .getPriorViewUpdatedCollection();
        SortedMap<Integer, List<ExprPriorNode>> callbacksPerIndex = viewResourceDelegate
                .getPerStream()[streamNum].getPriorRequests();
        handlePrior(viewUpdatedCollection, callbacksPerIndex, strategies);
    }

    return strategies;
}

From source file:org.apache.nutch.webui.service.impl.NutchServiceImpl.java

@Override
public Map<String, String> getNutchConfig(Long instanceId) {
    NutchInstance instance = instanceService.getInstance(instanceId);
    try {/*from   w  ww . ja  v  a2  s .c  o m*/
        return nutchClientFactory.getClient(instance).getNutchConfig("default");
    } catch (ClientHandlerException exception) {
        return Collections.emptyMap();
    }
}

From source file:com.webcohesion.ofx4j.client.impl.OFXHomeFIDataStore.java

public synchronized Map<String, FinancialInstitutionData> getFiData() {
    if (this.fiData == null) {
        this.fiData = new HashMap<String, FinancialInstitutionData>();
        try {/*from  w  ww  .  j  a v  a2 s.com*/
            initializeFIData();
            if (LOG.isInfoEnabled()) {
                LOG.info(this.fiData.size() + " institutions loaded from " + getUrl());
            }
        } catch (Exception e) {
            fiData = Collections.emptyMap();
        }
    }

    return fiData;
}

From source file:io.syndesis.model.connection.Action.java

@JsonProperty(access = JsonProperty.Access.READ_ONLY)
default Map<String, ConfigurationProperty> getProperties() {
    ActionDefinition definition = getDefinition();

    return definition != null ? definition.getPropertyDefinitionSteps().stream()
            .flatMap(step -> step.getProperties().entrySet().stream())
            .collect(Collectors.toMap(Entry::getKey, Entry::getValue)) : Collections.emptyMap();
}

From source file:net.praqma.jenkins.plugin.prqa.QAFrameworkRemoteReport.java

private Map<String, String> expandEnvironment(Map<String, String> environment,
        PRQAApplicationSettings appSettings, QaFrameworkReportSettings reportSetting) {
    this.reportSetting = reportSetting;
    if (environment == null) {
        return Collections.emptyMap();
    }//from   ww  w.  j av a2s .co  m
    environment.put(QACli.QAF_BIN_PATH,
            PRQAApplicationSettings.addSlash(environment.get(QACli.QAF_INSTALL_PATH), File.separator) + "common"
                    + File.separator + "bin");
    return environment;
}

From source file:org.openmrs.module.metadatasharing.handler.impl.OpenmrsObjectHandler.java

@Override
public Map<String, Object> getProperties(OpenmrsObject object) {
    return Collections.emptyMap();
}

From source file:com.qualys.jserf.SerfClientHandler.java

@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf) throws Exception {
    byte[] bytes = new byte[byteBuf.readableBytes()];
    byteBuf.readBytes(bytes);//from ww  w.j a  v a  2s .  co  m
    InputStream inputStream = new ByteArrayInputStream(bytes);

    Map<String, Value> headerValues = messagePack.read(inputStream, templateMap);
    log.trace("Response header was {}", headerValues);
    Map<String, Value> bodyValues = Collections.emptyMap();
    if (inputStream.available() != 0) {
        bodyValues = messagePack.read(inputStream, templateMap);
    }
    log.trace("Response body was {}", bodyValues);

    int sequence = headerValues.get("Seq").asIntegerValue().getInt();
    String errorMessage = headerValues.get("Error").asRawValue().getString();
    ResponseHeader header = new ResponseHeader(errorMessage, sequence);

    Pair<Command, SerfResponseCallBack> commandCallBackPair = callBacksBySequence.getIfPresent(sequence);
    if (commandCallBackPair == null) {
        log.debug(
                "Couldn't find corresponding Command/SerfResponseCallBack pair for sequence={}. Maybe it was already stopped?",
                sequence);
        return;
    }

    Command command = commandCallBackPair.getLeft();

    if (StringUtils.isNotEmpty(errorMessage)) {
        log.debug("Received error message '{}' with response for command={} and sequence={}", errorMessage,
                command, sequence);
    }

    Optional<ResponseBodyExtractor> extractor = extractorManager.getExtractor(command);
    if (!extractor.isPresent()) {
        log.warn("Couldn't find extractor for command={}", command);
        return;
    }
    SerfResponse response = new SerfResponse<>(header,
            extractor.get().extractBody(bodyValues, extractorManager));

    if (Command.QUERY.equals(command)) {
        QueryResponseBody queryResponseBody = (QueryResponseBody) response.getBody();
        if (QueryResponseBody.Type.DONE.equals(queryResponseBody.getType())) {
            log.trace(
                    "Removing Command/SerfResponseCallBack pair for sequence={} because it query command and the returned 'type' value was 'done'",
                    sequence);
            callBacksBySequence.invalidate(sequence);
        }
    }

    if (!multipleResponseCommands.contains(command)) {
        log.trace(
                "Removing Command/SerfResponseCallBack pair for sequence={} because it wasn't a command that returns multiple responses (those commands are: {})",
                sequence, multipleResponseCommands);
        callBacksBySequence.invalidate(sequence);
    }

    if (commandCallBackPair.getRight() == null) {
        log.trace("Callback for Command/SerfResponseCallBack pair with sequence={} was null", sequence);
        return;
    }

    log.trace("Invoking callback for command={} with sequence={}", command, sequence);
    commandCallBackPair.getRight().call(response);
    log.trace("Invoked callback for command={} with sequence={}", command, sequence);
}

From source file:io.smartspaces.scheduling.quartz.orientdb.internal.util.SerialUtils.java

public static Map<String, ?> deserialize(JobDataMap jobDataMap, String clob) throws IOException {
    try {/*from   w ww  .j a va  2s.  co  m*/
        byte[] bytes = Base64.decodeBase64(clob);
        return stringMapFromBytes(bytes);
    } catch (NotSerializableException e) {
        rethrowEnhanced(jobDataMap, e);
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return Collections.emptyMap();
}

From source file:org.elasticsearch.smoketest.MonitoringWithWatcherRestIT.java

public void testThatLocalExporterAddsWatches() throws Exception {
    String watchId = createMonitoringWatch();

    String body = BytesReference.bytes(jsonBuilder().startObject().startObject("transient")
            .field("xpack.monitoring.exporters.my_local_exporter.type", "local")
            .field("xpack.monitoring.exporters.my_local_exporter.cluster_alerts.management.enabled", true)
            .endObject().endObject()).utf8ToString();

    adminClient().performRequest("PUT", "_cluster/settings", Collections.emptyMap(),
            new StringEntity(body, ContentType.APPLICATION_JSON));

    assertTotalWatchCount(ClusterAlertsUtil.WATCH_IDS.length);

    assertMonitoringWatchHasBeenOverWritten(watchId);
}

From source file:com.arpnetworking.metrics.vertx.SinkHandlerTest.java

@Test
public void testHandleWithMessageWithoutAnnotations() throws JsonProcessingException {
    final String messageBody = OBJECT_MAPPER
            .writeValueAsString(ImmutableMap.of(TIMER_SAMPLES_KEY, Collections.emptyMap(), COUNTER_SAMPLES_KEY,
                    Collections.emptyMap(), GAUGE_SAMPLES_KEY, Collections.emptyMap()));
    Mockito.doReturn(messageBody).when(_message).body();
    _handler.handle(_message);/*from w  w  w.ja v  a 2 s . c  om*/
    Mockito.verifyZeroInteractions(_mockSink);
}