Tabnine Logo
StringConfigMap
Code IndexAdd Tabnine to your IDE (free)

How to use
StringConfigMap
in
brooklyn.config

Best Java code snippets using brooklyn.config.StringConfigMap (Showing top 18 results out of 315)

origin: io.brooklyn/brooklyn-launcher

public boolean getHttpsEnabled() {
  if (httpsEnabled!=null) return httpsEnabled;
  httpsEnabled = managementContext.getConfig().getConfig(BrooklynWebConfig.HTTPS_REQUIRED);
  return httpsEnabled;
}

origin: io.brooklyn/brooklyn-core

@Override
public Map getProperties() {
  return mgmt.getConfig().asMapWithStringKeys();
}
origin: io.brooklyn/brooklyn-rest

private synchronized void initialize() {
  if (allowedUsers!=null) return;
  StringConfigMap properties = mgmt.getConfig();
  allowedUsers = new LinkedHashSet<String>();
  String users = properties.getConfig(BrooklynWebConfig.SECURITY_PROVIDER_EXPLICIT__USERS);
  if (users==null) {
    LOG.info("Web console allowing default user (admin)");
    allowDefaultUsers = true;
  } else if ("*".equals(users)) {
    LOG.info("Web console allowing any users");
    allowAnyUserWithValidPass = true;
  } else {
    LOG.info("Web console allowing users "+users);
    StringTokenizer t = new StringTokenizer(users, ",");
    while (t.hasMoreElements()) {
      allowedUsers.add((""+t.nextElement()).trim());
    }
  }       
  if (properties.getFirst(BrooklynServiceAttributes.BROOKLYN_AUTOLOGIN_USERNAME)!=null) {
    LOG.warn("Use of legacy AUTOLOGIN; replace with setting BrooklynSystemProperties.SECURITY_PROVIDER to "+AnyoneSecurityProvider.class.getCanonicalName());
    allowAnyUser = true;
  }
}

origin: io.brooklyn/brooklyn-software-base

/** extracts the values for the main brooklyn.ssh.config.* config keys (i.e. those declared in ConfigKeys) 
 * as declared on the entity, and inserts them in a map using the unprefixed state, for ssh. */
/* currently this is computed for each call, which may be wasteful, but it is reliable in the face of config changes. 
 * we could cache the Map.  note that we do _not_ cache (or even own) the SshTool; 
 * the SshTool is created or re-used by the SshMachineLocation making use of these properties */
protected Map<String, Object> getSshFlags() {
  Map<String, Object> result = Maps.newLinkedHashMap();
  StringConfigMap globalConfig = ((EntityInternal)getEntity()).getManagementContext().getConfig();
  Map<ConfigKey<?>, Object> mgmtConfig = globalConfig.getAllConfig();
  Map<ConfigKey<?>, Object> entityConfig = ((EntityInternal)getEntity()).getAllConfig();
  Map<ConfigKey<?>, Object> allConfig = MutableMap.<ConfigKey<?>, Object>builder().putAll(mgmtConfig).putAll(entityConfig).build();
  
  for (ConfigKey<?> key : allConfig.keySet()) {
    if (key.getName().startsWith(SshTool.BROOKLYN_CONFIG_KEY_PREFIX)) {
      // have to use raw config to test whether the config is set
      Object val = ((EntityInternal)getEntity()).getConfigMap().getRawConfig(key);
      if (val!=null) {
        val = getEntity().getConfig(key);
      } else {
        val = globalConfig.getRawConfig(key);
        if (val!=null) val = globalConfig.getConfig(key);
      }
      if (val!=null) {
        result.put(ConfigUtils.unprefixedKey(SshTool.BROOKLYN_CONFIG_KEY_PREFIX, key).getName(), val);
      }
    }
  }
  return result;
}
origin: io.brooklyn/brooklyn-core

String catalogUrl = getConfig().getConfig(BROOKLYN_CATALOG_URL);
    Object nonDefaultUrl = getConfig().getRawConfig(BROOKLYN_CATALOG_URL);
    if (nonDefaultUrl!=null && !"".equals(nonDefaultUrl)) {
      log.warn("Could not find catalog XML specified at "+nonDefaultUrl+"; using default (local classpath) catalog. Error was: "+e);
origin: io.brooklyn/brooklyn-software-base

public String getInstallDir() {
  // Cache it; evaluate lazily (and late) to ensure managementContext.config is accessible and completed its setup
  // Caching has the benefit that the driver is usable, even if the entity is unmanaged (useful in some tests!)
  if (installDir == null) {
    String installBasedir = ((EntityInternal)entity).getManagementContext().getConfig().getFirst("brooklyn.dirs.install");
    if (installBasedir == null) installBasedir = DEFAULT_INSTALL_BASEDIR;
    if (installBasedir.endsWith(File.separator)) installBasedir.substring(0, installBasedir.length()-1);
    
    installDir = elvis(entity.getConfig(SoftwareProcess.SUGGESTED_INSTALL_DIR),
        installBasedir+"/"+getEntityVersionLabel("/"));
  }
  return installDir;
}

origin: io.brooklyn/brooklyn-core

ConfigMap namedLocationProps = mgmt.getConfig().submap(ConfigPredicates.startingWith(NAMED_LOCATION_PREFIX));
for (String k: namedLocationProps.asMapWithStringKeys().keySet()) {
  String name = k.substring(NAMED_LOCATION_PREFIX.length());
origin: io.brooklyn/brooklyn-software-base

public String getRunDir() {
  if (runDir == null) {
    String runBasedir = ((EntityInternal)entity).getManagementContext().getConfig().getFirst("brooklyn.dirs.run");
    if (runBasedir == null) runBasedir = DEFAULT_RUN_BASEDIR;
    if (runBasedir.endsWith(File.separator)) runBasedir.substring(0, runBasedir.length()-1);
    
    runDir = elvis(entity.getConfig(SoftwareProcess.SUGGESTED_RUN_DIR), 
        runBasedir+"/"+entity.getApplication().getId()+"/"+"entities"+"/"+
        getEntityVersionLabel()+"_"+entity.getId());
  }
  return runDir;
}
origin: io.brooklyn/brooklyn-rest

public LdapSecurityProvider(ManagementContext mgmt) {
  StringConfigMap properties = mgmt.getConfig();
  ldapUrl = properties.getConfig(BrooklynWebConfig.LDAP_URL);
  Strings.checkNonEmpty(ldapUrl, "LDAP security provider configuration missing required property "+BrooklynWebConfig.LDAP_URL);
  ldapRealm = properties.getConfig(BrooklynWebConfig.LDAP_REALM);
  Strings.checkNonEmpty(ldapRealm, "LDAP security provider configuration missing required property "+BrooklynWebConfig.LDAP_REALM);
}
origin: io.brooklyn/brooklyn-software-base

public String processTemplateContents(String templateContents, Map<String,? extends Object> extraSubstitutions) {
  Map<String, Object> config = getEntity().getApplication().getManagementContext().getConfig().asMapWithStringKeys();
  Map<String, Object> substitutions = ImmutableMap.<String, Object>builder()
      .putAll(config)
      .put("entity", entity)
      .put("driver", this)
      .put("location", getLocation())
      .putAll(extraSubstitutions)
      .build();
  return TemplateProcessor.processTemplateContents(templateContents, substitutions);
  /*
  try {
    Configuration cfg = new Configuration();
    StringTemplateLoader templateLoader = new StringTemplateLoader();
    templateLoader.putTemplate("config", templateContents);
    cfg.setTemplateLoader(templateLoader);
    Template template = cfg.getTemplate("config");
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Writer out = new OutputStreamWriter(baos);
    template.process(substitutions, out);
    out.flush();
    return new String(baos.toByteArray());
  } catch (Exception e) {
    log.warn("Error creating configuration file for "+entity, e);
    throw Exceptions.propagate(e);
  }
  */
}

origin: io.brooklyn/brooklyn-launcher

/**
 * accepts flags:  port,
 * war (url of war file which is the root),
 * wars (map of context-prefix to url),
 * attrs (map of attribute-name : object pairs passed to the servlet)
 */
public BrooklynWebServer(Map flags, ManagementContext managementContext) {
  this.managementContext = managementContext;
  Map leftovers = FlagUtils.setFieldsFromFlags(flags, this);
  if (!leftovers.isEmpty())
    log.warn("Ignoring unknown flags " + leftovers);
  
  String brooklynDataDir = checkNotNull(managementContext.getConfig().getConfig(BrooklynConfigKeys.BROOKLYN_DATA_DIR));
  this.webappTempDir = new File(brooklynDataDir, "jetty");
}
origin: io.brooklyn/brooklyn-core

Map<String, String> subconfig = filterAndStripPrefix(config.asMapWithStringKeys(), DOWNLOAD_CONF_PREFIX);
origin: io.brooklyn/brooklyn-rest-server

public LdapSecurityProvider(ManagementContext mgmt) {
  StringConfigMap properties = mgmt.getConfig();
  ldapUrl = properties.getConfig(BrooklynWebConfig.LDAP_URL);
  Strings.checkNonEmpty(ldapUrl, "LDAP security provider configuration missing required property "+BrooklynWebConfig.LDAP_URL);
  ldapRealm = properties.getConfig(BrooklynWebConfig.LDAP_REALM);
  Strings.checkNonEmpty(ldapRealm, "LDAP security provider configuration missing required property "+BrooklynWebConfig.LDAP_REALM);
}
origin: io.brooklyn/brooklyn-rest-server

@SuppressWarnings("deprecation")
private synchronized void initialize() {
  if (allowedUsers!=null) return;
  StringConfigMap properties = mgmt.getConfig();
  allowedUsers = new LinkedHashSet<String>();
  String users = properties.getConfig(BrooklynWebConfig.USERS);
  if (users==null) {
    users = properties.getConfig(BrooklynWebConfig.SECURITY_PROVIDER_EXPLICIT__USERS);
    if (users!=null) 
      LOG.warn("Using deprecated config key "+BrooklynWebConfig.SECURITY_PROVIDER_EXPLICIT__USERS.getName()+"; " +
        "use "+BrooklynWebConfig.USERS.getName()+" instead");
  }
  if (users==null) {
    LOG.warn("Web console has no users configured; no one will be able to log in!");
  } else if ("*".equals(users)) {
    LOG.info("Web console allowing any user (so long as valid password is set)");
    allowAnyUserWithValidPass = true;
  } else {
    StringTokenizer t = new StringTokenizer(users, ",");
    while (t.hasMoreElements()) {
      allowedUsers.add((""+t.nextElement()).trim());
    }
    LOG.info("Web console allowing users: "+allowedUsers);
  }       
}

origin: io.brooklyn/brooklyn-rest-server

String className = brooklynProperties.getConfig(BrooklynWebConfig.SECURITY_PROVIDER_CLASSNAME);
log.info("Web console using security provider "+className);
origin: io.brooklyn/brooklyn-rest

String className = brooklynProperties.getConfig(BrooklynWebConfig.SECURITY_PROVIDER_CLASSNAME);
log.info("Web console using security provider "+className);
origin: io.brooklyn/brooklyn-core

  public DownloadTargets apply(DownloadRequirement req) {
    Boolean enabled = config.getConfig(LOCAL_REPO_ENABLED);
    String path = config.getConfig(LOCAL_REPO_PATH);
    String url = String.format(LOCAL_REPO_URL_PATTERN, path);
    
    if (enabled) {
      Map<String, ?> subs = DownloadSubstituters.getBasicSubstitutions(req);
      String result = DownloadSubstituters.substitute(url, subs);
      return BasicDownloadTargets.builder().addPrimary(result).build();
      
    } else {
      return BasicDownloadTargets.empty();
    }
  }
}
origin: io.brooklyn/brooklyn-core

  public DownloadTargets apply(DownloadRequirement req) {
    Boolean enabled = config.getConfig(CLOUDSOFT_REPO_ENABLED);
    String baseUrl = config.getConfig(CLOUDSOFT_REPO_URL);
    String url = String.format(CLOUDSOFT_REPO_URL_PATTERN, baseUrl);
    
    if (enabled) {
      Map<String, ?> subs = DownloadSubstituters.getBasicSubstitutions(req);
      String result = DownloadSubstituters.substitute(url, subs);
      return BasicDownloadTargets.builder().addPrimary(result).build();
      
    } else {
      return BasicDownloadTargets.empty();
    }
  }
}
brooklyn.configStringConfigMap

Javadoc

convenience extension where map is principally strings or converted to strings (supporting BrooklynProperties)

Most used methods

  • getConfig
  • asMapWithStringKeys
  • getFirst
  • getRawConfig
  • getAllConfig
  • submap

Popular in Java

  • Start an intent from android
  • notifyDataSetChanged (ArrayAdapter)
  • onCreateOptionsMenu (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now