Package org.apache.ambari.server.state

Examples of org.apache.ambari.server.state.DesiredConfig$HostOverride


    for (String hostname : hostnames) {
      desiredConfigsByHost.put(hostname, new HashMap<String, DesiredConfig>());
    }

    for (HostConfigMapping mappingEntity : mappingEntities) {
      DesiredConfig desiredConfig = new DesiredConfig();
      desiredConfig.setVersion(mappingEntity.getVersion());
      desiredConfig.setServiceName(mappingEntity.getServiceName());
      desiredConfig.setUser(mappingEntity.getUser());

      desiredConfigsByHost.get(mappingEntity.getHostName()).put(mappingEntity.getType(), desiredConfig);
    }

    return desiredConfigsByHost;
View Full Code Here


      Map<String, DesiredConfig> map = new HashMap<String, DesiredConfig>();
 
      for (ClusterConfigMappingEntity e : clusterEntity.getConfigMappingEntities()) {
        if (e.isSelected() > 0) {
          DesiredConfig c = new DesiredConfig();
          c.setServiceName(null);
          c.setVersion(e.getVersion());
 
          List<HostConfigMappingEntity> hostMappings =
              hostConfigMappingDAO.findSelectedHostsByType(clusterEntity.getClusterId().longValue(),
                  e.getType());
 
          List<DesiredConfig.HostOverride> hosts = new ArrayList<DesiredConfig.HostOverride>();
          for (HostConfigMappingEntity mappingEntity : hostMappings) {
            hosts.add (new DesiredConfig.HostOverride(mappingEntity.getHostName(),
                mappingEntity.getVersion()));
          }
 
          c.setHostOverrides(hosts);
 
          map.put(e.getType(), c);
 
        }
    }
View Full Code Here

        props.putAll(svcConfig.getProperties());
      }

      // 3) apply the host overrides, if any
      Host host = clusters.getHost(hostName);
      DesiredConfig dc = host.getDesiredConfigs(cluster.getClusterId()).get(type);
      if (null != dc) {
        Config hostConfig = cluster.getConfig(type, dc.getVersion());
        if (null != hostConfig) {
          props.putAll(hostConfig.getProperties());
          tags.put("host_override_tag", hostConfig.getVersionTag());
        }
      }
View Full Code Here

            props.putAll(svcConfig.getProperties());
          }
         
          // apply host overrides, if any
          Host host = fsm.getHost(hostname);
          DesiredConfig dc = host.getDesiredConfigs(cl.getClusterId()).get("global");
          if (null != dc) {
            Config hostConfig = cl.getConfig("global", dc.getVersion());
            if (null != hostConfig) {
              props.putAll(hostConfig.getProperties());
            }
          }
         
View Full Code Here

    Assert.assertFalse("Expect desired config not contain 'mapred-site'", desiredConfigs.containsKey("mapred-site"));
    Assert.assertTrue("Expect desired config contain " + config1.getType(), desiredConfigs.containsKey("global"));
    Assert.assertTrue("Expect desired config contain " + config3.getType(), desiredConfigs.containsKey("core-site"));
    Assert.assertEquals("Expect desired config for global should be " + config1.getVersionTag(),
        config1.getVersionTag(), desiredConfigs.get(config1.getType()).getVersion());
    DesiredConfig dc = desiredConfigs.get(config1.getType());
    Assert.assertTrue("Expect no host-level overrides",
        (null == dc.getHostOverrides() || dc.getHostOverrides().size() == 0));

    // setup a host that also has a config override
    Host host = clusters.getHost("h1");
    host.addDesiredConfig(c1.getClusterId(), true, config2);

    desiredConfigs = c1.getDesiredConfigs();
    dc = desiredConfigs.get(config1.getType());
   
    Assert.assertNotNull("Expect host-level overrides", dc.getHostOverrides());
    Assert.assertEquals("Expect one host-level override", 1, dc.getHostOverrides().size());
  }
View Full Code Here

    Map<String, DesiredConfig> map = new HashMap<String, DesiredConfig>();
   
    for (HostConfigMappingEntity e : hostConfigMappingDAO.findSelected(
        clusterId, hostEntity.getHostName())) {
     
      DesiredConfig dc = new DesiredConfig();
      dc.setVersion(e.getVersion());
      dc.setServiceName(e.getServiceName());
     
      map.put(e.getType(), dc);
     
    }
    return map;
View Full Code Here

      for (Resource resource : clusterResource) {
        Map<String, Object> configs =
        resource.getPropertiesMap().get(ClusterResourceProvider
          .CLUSTER_DESIRED_CONFIGS_PROPERTY_ID);
        if (configs != null) {
          DesiredConfig config = (DesiredConfig) configs.get(configType);
          if (config != null) {
            versionTag = config.getVersion();
          }
        }
      }
    }
    return versionTag;
View Full Code Here

        Map<String, DesiredConfig> map = new HashMap<String, DesiredConfig>();
        Collection<String> types = new HashSet<String>();

        for (ClusterConfigMappingEntity e : clusterEntity.getConfigMappingEntities()) {
          if (e.isSelected() > 0) {
            DesiredConfig c = new DesiredConfig();
            c.setServiceName(null);
            c.setVersion(e.getVersion());
            c.setUser(e.getUser());

            map.put(e.getType(), c);
            types.add(e.getType());
          }
        }
View Full Code Here

    for (String hostname : hostnames) {
      desiredConfigsByHost.put(hostname, new HashMap<String, DesiredConfig>());
    }

    for (HostConfigMapping mappingEntity : mappingEntities) {
      DesiredConfig desiredConfig = new DesiredConfig();
      desiredConfig.setVersion(mappingEntity.getVersion());
      desiredConfig.setServiceName(mappingEntity.getServiceName());
      desiredConfig.setUser(mappingEntity.getUser());

      desiredConfigsByHost.get(mappingEntity.getHostName()).put(mappingEntity.getType(), desiredConfig);
    }

    return desiredConfigsByHost;
View Full Code Here

      for (Resource resource : clusterResource) {
        Map<String, Object> configs =
        resource.getPropertiesMap().get(ClusterResourceProvider
          .CLUSTER_DESIRED_CONFIGS_PROPERTY_ID);
        if (configs != null) {
          DesiredConfig config = (DesiredConfig) configs.get(configType);
          if (config != null) {
            versionTag = config.getVersion();
          }
        }
      }
    }
    return versionTag;
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.state.DesiredConfig$HostOverride

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.