Package org.apache.ambari.server.state

Examples of org.apache.ambari.server.state.Config


  public Map<String, Config> getDesiredConfigs() {
    Map<String, Config> map = new HashMap<String, Config>();
    try {
      readLock.lock();
      for (Entry<String, String> entry : desiredConfigs.entrySet()) {
        Config config = clusters.getClusterById(getClusterId()).getDesiredConfig(
            entry.getKey(), entry.getValue());
        if (null != config) {
          map.put(entry.getKey(), config);
        }
      }
View Full Code Here


        Map<String, Map<String, String>> configurations = new TreeMap<String, Map<String, String>>();

        // get the cluster config for type 'global'
        // apply config group overrides

        Config clusterConfig = cl.getDesiredConfigByType("global");
        if (clusterConfig != null) {
          // cluster config for 'global'
          Map<String, String> props = new HashMap<String, String>(clusterConfig.getProperties());

          // Apply global properties for this host from all config groups
          Map<String, Map<String, String>> allConfigTags = configHelper
            .getEffectiveDesiredTags(cl, hostname);
View Full Code Here

      throw new AmbariException("No exclude file specified"
          + " when decommissioning datanodes. Provide parameter excludeFileTag with the tag for config type "
          + hdfsExcludeFileType);
    }

    Config config = clusters.getCluster(clusterName).getConfig(
        hdfsExcludeFileType, excludeFileTag);
    if (config == null) {
      throw new AmbariException("Decommissioning datanodes requires the cluster to be associated with config type " +
          hdfsExcludeFileType + " with a list of datanodes to be decommissioned (\"datanodes\" : list).");
    }

    LOG.info("Decommissioning data nodes: " + config.getProperties().get("datanodes") +
        " " + hdfsExcludeFileType + " tag: " + excludeFileTag);

    Map<String, Map<String, String>> configurations =
        new TreeMap<String, Map<String, String>>();


    Map<String, Map<String, String>> configTags = amcImpl.findConfigurationTagsWithOverrides(cluster, namenodeHost);

    // Add the tag for hdfs-exclude-file
    Map<String, String> excludeTags = new HashMap<String, String>();
    excludeTags.put(ConfigHelper.CLUSTER_DEFAULT_TAG, config.getVersionTag());
    configTags.put(hdfsExcludeFileType, excludeTags);

    stage.addHostRoleExecutionCommand(
        namenodeHost,
        Role.DECOMMISSION_DATANODE,
View Full Code Here

    // Populate configs
    for (ConfigGroupConfigMappingEntity configMappingEntity : configGroupEntity
      .getConfigGroupConfigMappingEntities()) {

      Config config = cluster.getConfig(configMappingEntity.getConfigType(),
        configMappingEntity.getVersionTag());

      if (config != null) {
        this.configurations.put(config.getType(), config);
      } else {
        LOG.warn("Unable to find config mapping for config group"
          + ", clusterName = " + cluster.getClusterName()
          + ", type = " + configMappingEntity.getConfigType()
          + ", tag = " + configMappingEntity.getVersionTag());
View Full Code Here

        if (!allConfigs.containsKey(entity.getType())) {
          allConfigs.put(entity.getType(), new HashMap<String, Config>());
        }

        Config config = configFactory.createExisting(this, entity);

        allConfigs.get(entity.getType()).put(entity.getTag(), config);
      }
    }
  }
View Full Code Here

    clusterGlobalLock.readLock().lock();
    try {
      readWriteLock.writeLock().lock();
      try {
        Config currentDesired = getDesiredConfigByType(config.getType());

        // do not set if it is already the current
        if (null != currentDesired && currentDesired.getVersionTag().equals(config.getVersionTag())) {
          return false;
        }

        Collection<ClusterConfigMappingEntity> entities = clusterEntity.getConfigMappingEntities();
View Full Code Here

            hostConfig = new HostConfig();
            hostConfigMap.put(configType, hostConfig);
            hostConfig.setDefaultVersionTag(cluster.getDesiredConfigByType
              (configType).getVersionTag());
          }
          Config config = configEntry.getValue();
          hostConfig.getConfigGroupOverrides().put(configGroup.getId(),
            config.getVersionTag());
        }
      }
    }
    return hostConfigMap;
  }
View Full Code Here

              configProperties.put(PropertyHelper.getPropertyName(entry.getKey()),
                entry.getValue().toString());
            }
          }

          Config config = new ConfigImpl(type);
          config.setVersionTag(tag);
          config.setProperties(configProperties);

          configurations.put(config.getType(), config);
        }
      } catch (Exception e) {
        LOG.warn("Config json in unparseable format. " + configObj, e);
      }
    }
View Full Code Here

      throw new AmbariException(MessageFormat.format("Configuration with tag ''{0}'' exists for ''{1}''",
          request.getVersionTag(),
          request.getType()));
    }

    Config config = configFactory.createNew (cluster, request.getType(),
        request.getProperties());
    config.setVersionTag(request.getVersionTag());

    config.persist();

    cluster.addConfig(config);
  }
View Full Code Here

    Set<ConfigurationResponse> responses = new HashSet<ConfigurationResponse>();

    // !!! if only one, then we need full properties
    if (null != request.getType() && null != request.getVersionTag()) {
      Config config = cluster.getConfig(request.getType(),
          request.getVersionTag());
      if (null != config) {
        ConfigurationResponse response = new ConfigurationResponse(
            cluster.getClusterName(), config.getType(), config.getVersionTag(),
            config.getProperties());
        responses.add(response);
      }
    }
    else {
      if (null != request.getType()) {
        Map<String, Config> configs = cluster.getConfigsByType(
            request.getType());

        if (null != configs) {
          for (Entry<String, Config> entry : configs.entrySet()) {
            ConfigurationResponse response = new ConfigurationResponse(
                cluster.getClusterName(), request.getType(),
                entry.getValue().getVersionTag(), new HashMap<String, String>());
            responses.add(response);
          }
        }
      } else {
        // !!! all configuration
        Collection<Config> all = cluster.getAllConfigs();

        for (Config config : all) {
          ConfigurationResponse response = new ConfigurationResponse(
             cluster.getClusterName(), config.getType(), config.getVersionTag(),
             new HashMap<String, String>());

          responses.add(response);
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.state.Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.