brooklyn.util.collections.MutableMap.builder()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中brooklyn.util.collections.MutableMap.builder()方法的一些代码示例,展示了MutableMap.builder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MutableMap.builder()方法的具体详情如下:
包路径:brooklyn.util.collections.MutableMap
类名称:MutableMap
方法名:builder

MutableMap.builder介绍

暂无

代码示例

代码示例来源:origin: io.brooklyn/brooklyn-core

@SuppressWarnings("unchecked")
private <K,V> Map<K,V> concat(Map<? extends K,? extends V> map1, Map<? extends K,? extends V> map2) {
  if (map1 == null || map1.isEmpty()) return (Map<K,V>) map2;
  if (map2 == null || map2.isEmpty()) return (Map<K,V>) map1;
  
  // TODO Not using Immutable builder, because that fails if duplicates in map1 and map2
  return MutableMap.<K,V>builder().putAll(map1).putAll(map2).build();
}

代码示例来源:origin: io.brooklyn/brooklyn-core

/** @deprecated since 0.6.0 use no-arg constructor (and spec) then configure */
public LocalhostMachine(Map properties) {
  super(MutableMap.builder().putAll(properties).put("mutexSupport", mutexSupport).build());
}
public boolean obtainSpecificPort(int portNumber) {

代码示例来源:origin: io.brooklyn/brooklyn-core

public Map<String, String> buildHeaders(Map<String, String> baseHeaders) {
  return MutableMap.<String,String>builder()
      .putAll(baseHeaders)
      .putAll(headers)
      .build();
}

代码示例来源:origin: io.brooklyn/brooklyn-software-messaging

/**
 * Use RMI agent to provide JMX.
 */
@Override
public Map<String, String> getShellEnvironment() {
  Map<String, String> orig = super.getShellEnvironment();
  String kafkaJmxOpts = orig.remove("JAVA_OPTS");
  return MutableMap.<String, String>builder()
      .putAll(orig)
      .putIfNotNull("KAFKA_JMX_OPTS", kafkaJmxOpts)
      .build();
}

代码示例来源:origin: io.brooklyn/brooklyn-software-messaging

@Override
public Map<String, String> getShellEnvironment() {
  // kafka script sets JMX_PORT if it isn't set
  return MutableMap.<String, String> builder()
      .putAll(super.getShellEnvironment())
      // seems odd to pass RMI port here, as it gets assigned to com.sun.mgmt.jmx.port in kafka-run-class.sh
      // but RMI server port works, whereas JMX port does not
      .put("JMX_PORT", String.valueOf(getRmiServerPort()))
      .build();
}

代码示例来源:origin: io.brooklyn/brooklyn-core

@Override
public Map<String, ?> getFlags() {
  return Collections.unmodifiableMap(MutableMap.<String,Object>builder()
      .putAll(delegate.getFlags())
      .putAll(super.getFlags())
      .build());
}

代码示例来源:origin: io.brooklyn/brooklyn-core

public Map<ConfigKey<?>, Object> getConfig() {
  return Collections.unmodifiableMap(MutableMap.<ConfigKey<?>,Object>builder()
      .putAll(delegate.getConfig())
      .putAll(super.getConfig())
      .build());
}

代码示例来源:origin: io.brooklyn/brooklyn-core

public static Map<String,Object> getBasicAddonSubstitutions(EntityDriver driver, String addon) {
  return MutableMap.<String,Object>builder()
      .putAll(getBasicEntitySubstitutions(driver))
      .put("addon", addon)
      .build();
}

代码示例来源:origin: io.brooklyn/brooklyn-software-nosql

@Override
  public Map<String, String> getShellEnvironment() {
    return MutableMap.<String, String>builder()
        .putAll(super.getShellEnvironment())
        .put("CASSANDRA_CONF", String.format("%s/conf", getRunDir()))
        .renameKey("JAVA_OPTS", "JVM_OPTS")
        .build();
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-software-nosql

@Override
protected Map getCustomJavaSystemProperties() {
  return MutableMap.<String, String>builder()
      .putAll(super.getCustomJavaSystemProperties())
      .put("cassandra.confing", getCassandraConfigFileName())
      .build();
}

代码示例来源:origin: io.brooklyn/brooklyn-software-messaging

@Override
  public Map<String, String> getShellEnvironment() {
    Map<String,String> orig = super.getShellEnvironment();
    return MutableMap.<String,String>builder()
        .putAll(orig)
        .put("ACTIVEMQ_HOME", getRunDir())
        .put("ACTIVEMQ_PIDFILE", getPidFile())
        .put("ACTIVEMQ_OPTS", orig.get("JAVA_OPTS") != null ? orig.get("JAVA_OPTS") : "")
        .put("JAVA_OPTS", "")
        .build();
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-software-base

/**
 * Return the configuration properties required to enable JMX for a Java application.
 * 
 * These should be set as properties in the {@code JAVA_OPTS} environment variable when calling the
 * run script for the application.
 */
protected Map<String, ?> getJmxJavaSystemProperties() {
  MutableMap.Builder<String, Object> result = MutableMap.<String, Object> builder();
  
  if (isJmxEnabled()) {
    new JmxSupport(getEntity(), getRunDir()).applyJmxJavaSystemProperties(result);
  }
  
  return result.build();
}

代码示例来源:origin: io.brooklyn/brooklyn-software-webapp

@Override
  public Map<String, String> getShellEnvironment() {
    return MutableMap.<String,String>builder().putAll(super.getShellEnvironment())
        .put("JETTY_RUN",getRunDir())
        .renameKey("JAVA_OPTS", "JAVA_OPTIONS")
        .build();
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-core

/**
 * Constructs a new location, passing to its constructor the location id and all of memento.getFlags().
 */
private Policy newPolicy(PolicyMemento memento, Reflections reflections) {
  String id = memento.getId();
  String policyType = checkNotNull(memento.getType(), "policyType of "+id);
  Class<?> policyClazz = reflections.loadClass(policyType);
  Map<String, Object> flags = MutableMap.<String, Object>builder()
      .put("id", id)
      .putAll(memento.getFlags())
      .build();
  return (Policy) invokeConstructor(reflections, policyClazz, new Object[] {flags});
}

代码示例来源:origin: io.brooklyn/brooklyn-software-messaging

public Map<String, String> getShellEnvironment() {
    Map<String, String> orig = super.getShellEnvironment();
    return MutableMap.<String, String>builder()
        .putAll(orig)
        .put("QPID_HOME", getRunDir())
        .put("QPID_WORK", getRunDir())
        .renameKey("JAVA_OPTS", "QPID_OPTS")
        .putIfAbsent("QPID_OPTS", "")
        .build();
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-core

/** returns a (mutable) map of the standard flags which should be placed on an effector */
public static Map<Object,Object> getTaskFlagsForEffectorInvocation(Entity entity, Effector<?> effector) {
  return MutableMap.builder()
      .put("description", "Invoking effector "+effector.getName()+" on "+entity.getDisplayName())
      .put("displayName", effector.getName())
      .put("tags", MutableList.of(ManagementContextInternal.EFFECTOR_TAG, 
          BrooklynTasks.tagForTargetEntity(entity)))
      .build();
}

代码示例来源:origin: io.brooklyn/brooklyn-software-webapp

@Override
  public Map<String, String> getShellEnvironment() {
    return MutableMap.<String, String>builder()
        .putAll(super.getShellEnvironment())
        .renameKey("JAVA_OPTS", "CATALINA_OPTS")
        .put("CATALINA_PID", "pid.txt")
        .put("CATALINA_BASE", getRunDir())
        .put("RUN", getRunDir())
        .build();
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-core

/**
 * Copies the given DownloadRequirement, but overriding the original properties with the given additional properties.
 */
public static BasicDownloadRequirement copy(DownloadRequirement req, Map<String,?> additionalProperties) {
  Map<String,?> props = MutableMap.<String,Object>builder().putAll(req.getProperties()).putAll(additionalProperties).build();
  if (req.getAddonName() == null) {
    return new BasicDownloadRequirement(req.getEntityDriver(), props);
  } else {
    return new BasicDownloadRequirement(req.getEntityDriver(), req.getAddonName(), props);
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-software-messaging

@Override
  public Map<String, String> getShellEnvironment() {
    return MutableMap.<String, String>builder()
        .putAll(super.getShellEnvironment())
        .put("RABBITMQ_HOME", getRunDir())
        .put("RABBITMQ_LOG_BASE", getRunDir())
        .put("RABBITMQ_NODENAME", getEntity().getId())
        .put("RABBITMQ_NODE_PORT", getAmqpPort().toString())
        .put("RABBITMQ_PID_FILE", getRunDir()+"/"+getPidFile())
        .build();
  }
}

代码示例来源:origin: io.brooklyn/brooklyn-software-messaging

public Map<String, Object> getCustomJavaSystemProperties() {
  return MutableMap.<String, Object>builder()
      .putAll(super.getCustomJavaSystemProperties())
      .put("connector.port", getAmqpPort())
      .put("management.enabled", "true")
      .put("management.jmxport.registryServer", getRmiRegistryPort())
      .put("management.jmxport.connectorServer", getJmxPort())
      .put("management.http.enabled",  getHttpManagementPort() != null ? "true" : "false")
      .putIfNotNull("management.http.port", getHttpManagementPort())
      .build();
}

相关文章