Example usage for com.google.common.collect ImmutableMultimap get

List of usage examples for com.google.common.collect ImmutableMultimap get

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableMultimap get.

Prototype

@Override
public abstract ImmutableCollection<V> get(K key);

Source Link

Document

Returns an immutable collection of the values for the given key.

Usage

From source file:org.stuartgunter.dropwizard.logging.LogConfigurationTask.java

private List<String> getLoggerNames(ImmutableMultimap<String, String> parameters) {
    return parameters.get("logger").asList();
}

From source file:org.icgc.dcc.portal.task.LogConfigurationTask.java

private Level getLoggerLevel(ImmutableMultimap<String, String> parameters) {
    val loggerLevels = parameters.get("level").asList();

    return loggerLevels.isEmpty() ? null : Level.valueOf(loggerLevels.get(0));
}

From source file:org.stuartgunter.dropwizard.logging.LogConfigurationTask.java

private Level getLoggerLevel(ImmutableMultimap<String, String> parameters) {
    List<String> loggerLevels = parameters.get("level").asList();
    return loggerLevels.isEmpty() ? null : Level.valueOf(loggerLevels.get(0));
}

From source file:com.vsct.dt.strowgr.admin.gui.tasks.HaproxyVipTask.java

@Override
public void execute(ImmutableMultimap<String, String> parameters, PrintWriter printWriter) throws Exception {
    haproxyRepository.setHaproxyProperty(parameters.get("haproxy").asList().get(0), "vip",
            parameters.get("vip").asList().get(0));
}

From source file:org.knowm.dropwizard.sundial.tasks.AddCronJobTriggerTask.java

@Override
public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception {

    String triggerName = (String) parameters.get("TRIGGER_NAME").toArray()[0];
    String jobName = (String) parameters.get("JOB_NAME").toArray()[0];
    String cronExpression = (String) parameters.get("CRON_EXPRESSION").toArray()[0];

    logger.debug(triggerName + " " + jobName + " " + cronExpression);

    SundialJobScheduler.addCronTrigger(triggerName, jobName, cronExpression);

}

From source file:org.knowm.dropwizard.sundial.tasks.RemoveJobTriggerTask.java

@Override
public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception {

    ImmutableCollection<String> triggerNames = parameters.get("TRIGGER_NAME");

    for (String triggerName : triggerNames) {

        SundialJobScheduler.removeTrigger(triggerName);
    }//from w  ww .  ja  v  a  2  s  . com

}

From source file:org.camunda.bpm.extension.dropwizard.task.StartProcessTask.java

@Override
public void execute(ImmutableMultimap<String, String> immutableMultimap, final PrintWriter out)
        throws Exception {
    if ("true".equals(immutableMultimap.get("shutdown"))) {
        stopProcess();//from   w w w.  j av a2  s  .co m
        out.println("Process Stopped: " + processKey);
    } else {
        startProcess();
        out.println("Process Started: " + processKey);
    }
}

From source file:com.google.idea.blaze.base.rulemaps.SourceToRuleMapImpl.java

@Override
public ImmutableCollection<Label> getTargetsForSourceFile(File file) {
    ImmutableMultimap<File, Label> sourceToTargetMap = getSourceToTargetMap();
    return sourceToTargetMap != null ? sourceToTargetMap.get(file) : ImmutableList.of();
}

From source file:com.google.idea.blaze.cpp.BlazeResolveConfigurationTemporaryBase.java

public static ImmutableMap<TargetKey, CToolchainIdeInfo> buildToolchainLookupMap(BlazeContext context,
        TargetMap targetMap, ImmutableMultimap<TargetKey, TargetKey> reverseDependencies) {
    return Scope.push(context, childContext -> {
        childContext.push(new TimingScope("Build toolchain lookup map"));

        List<TargetKey> seeds = Lists.newArrayList();
        for (TargetIdeInfo target : targetMap.targets()) {
            CToolchainIdeInfo cToolchainIdeInfo = target.cToolchainIdeInfo;
            if (cToolchainIdeInfo != null) {
                seeds.add(target.key);/*from  w  ww . jav  a 2 s. c  o  m*/
            }
        }

        Map<TargetKey, CToolchainIdeInfo> lookupTable = Maps.newHashMap();
        for (TargetKey seed : seeds) {
            CToolchainIdeInfo toolchainInfo = targetMap.get(seed).cToolchainIdeInfo;
            LOG.assertTrue(toolchainInfo != null);
            List<TargetKey> worklist = Lists.newArrayList(reverseDependencies.get(seed));
            while (!worklist.isEmpty()) {
                // We should never see a label depend on two different toolchains.
                TargetKey l = worklist.remove(0);
                CToolchainIdeInfo previousValue = lookupTable.putIfAbsent(l, toolchainInfo);
                // Don't propagate the toolchain twice.
                if (previousValue == null) {
                    worklist.addAll(reverseDependencies.get(l));
                } else {
                    LOG.assertTrue(previousValue.equals(toolchainInfo));
                }
            }
        }
        return ImmutableMap.copyOf(lookupTable);
    });
}

From source file:org.kiji.rest.resources.ShutdownTask.java

/** {@inheritDoc} */
@Override/*w w w  .  j  av a  2 s.c  o  m*/
public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception {
    final Collection<String> commands = parameters.get("force");

    if (mKijiRESTConfiguration.isShutdownEnabled()) {
        // Presence of "force" parameter will trigger a forced shutdown.
        if (commands.size() == 0) {
            mManagedKijiClient.stop();
            output.println("Server has been shutdown");
            output.flush();
        }
        System.exit(0);
    } else {
        throw new WebApplicationException(
                new IllegalArgumentException("Remote shutdown is disabled. Enable by setting the "
                        + "remote-shutdown command to true in the configuration file."),
                Response.Status.BAD_REQUEST);
    }
}