Examples of ClusterEntity


Examples of org.apache.ambari.server.orm.entities.ClusterEntity

 
  @Transactional
  @Override
  public synchronized void persist() {
   
    ClusterEntity clusterEntity = clusterDAO.findById(cluster.getClusterId());
   
    ClusterConfigEntity entity = new ClusterConfigEntity();
    entity.setClusterEntity(clusterEntity);
    entity.setClusterId(Long.valueOf(cluster.getClusterId()));
    entity.setType(type);
    entity.setTag(getVersionTag());
    entity.setTimestamp(new Date().getTime());
   
    entity.setData(gson.toJson(getProperties()));
    clusterDAO.createConfig(entity);

    clusterEntity.getClusterConfigEntities().add(entity);
    clusterDAO.merge(clusterEntity);
    cluster.refresh();

  }
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.ClusterEntity

        throw new DuplicateResourceException("Attempted to create a Cluster which already exists"
            + ", clusterName=" + clusterName);
      }
      // retrieve new cluster id
      // add cluster id -> cluster mapping into clustersById
      ClusterEntity clusterEntity = new ClusterEntity();
      clusterEntity.setClusterName(clusterName);
      clusterEntity.setDesiredStackVersion(gson.toJson(new StackId()));

      try {
        clusterDAO.create(clusterEntity);
        clusterEntity = clusterDAO.merge(clusterEntity);
      } catch (RollbackException e) {
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.ClusterEntity

  }

  @Transactional
  void mapHostClusterEntities(String hostName, Long clusterId) {
    HostEntity hostEntity = hostDAO.findByName(hostName);
    ClusterEntity clusterEntity = clusterDAO.findById(clusterId);

    hostEntity.getClusterEntities().add(clusterEntity);
    clusterEntity.getHostEntities().add(hostEntity);

    clusterDAO.merge(clusterEntity);
    hostDAO.merge(hostEntity);
  }
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.ClusterEntity

      try {
        cluster = clusters.getCluster(stage.getClusterName());
      } catch (AmbariException e) {
        throw new RuntimeException(e);
      }
      ClusterEntity clusterEntity = clusterDAO.findById(cluster.getClusterId());

      stageEntity.setCluster(clusterEntity);
      clusterEntity.getStages().add(stageEntity);

      for (HostRoleCommand hostRoleCommand : stage.getOrderedHostRoleCommands()) {
        HostRoleCommandEntity hostRoleCommandEntity = hostRoleCommand.constructNewPersistenceEntity();
        stageEntity.getHostRoleCommands().add(hostRoleCommandEntity);
        hostRoleCommandEntity.setStage(stageEntity);
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.ClusterEntity

          + ", clusterName=" + clusterName);
    }

    // retrieve new cluster id
    // add cluster id -> cluster mapping into clustersById
    ClusterEntity clusterEntity = new ClusterEntity();
    clusterEntity.setClusterName(clusterName);
    clusterEntity.setDesiredStackVersion(gson.toJson(new StackId()));
    try {
      clusterDAO.create(clusterEntity);
      clusterEntity = clusterDAO.merge(clusterEntity);
      Cluster cluster = clusterFactory.create(clusterEntity);
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.ClusterEntity

  @Override
  @Transactional
  public synchronized Cluster getCluster(String clusterName)
      throws AmbariException {
    if (!clusters.containsKey(clusterName)) {
      ClusterEntity clusterEntity = clusterDAO.findByName(clusterName);
      if (clusterEntity != null) {
        Cluster cl = getClusterById(clusterEntity.getClusterId());
        clustersById.put(cl.getClusterId(), cl);
        clusters.put(cl.getClusterName(), cl);
        if (!clusterHostMap.containsKey(clusterEntity.getClusterName()))
          clusterHostMap.put(clusterEntity.getClusterName(), new HashSet<Host>());
      } else {
        throw new ClusterNotFoundException(clusterName);
      }
    }
    return clusters.get(clusterName);
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.ClusterEntity

  @Override
  @Transactional
  public synchronized Cluster getClusterById(long id) throws AmbariException {
    if (!clustersById.containsKey(id)) {
      ClusterEntity clusterEntity = clusterDAO.findById(id);
      if (clusterEntity != null) {
        Cluster cluster = clusterFactory.create(clusterEntity);
        clustersById.put(cluster.getClusterId(), cluster);
        clusters.put(clusterEntity.getClusterName(), cluster);
        if (!clusterHostMap.containsKey(clusterEntity.getClusterName()))
          clusterHostMap.put(clusterEntity.getClusterName(), new HashSet<Host>());
      } else {
        throw new ClusterNotFoundException("clusterID=" + id);
      }
    }
    return clustersById.get(id);
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.ClusterEntity

  }

  @Transactional
  void mapHostClusterEntities(String hostName, Long clusterId) {
    HostEntity hostEntity = hostDAO.findByName(hostName);
    ClusterEntity clusterEntity = clusterDAO.findById(clusterId);

    hostEntity.getClusterEntities().add(clusterEntity);
    clusterEntity.getHostEntities().add(hostEntity);

    clusterDAO.merge(clusterEntity);
    hostDAO.merge(hostEntity);
  }
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.ClusterEntity

 
  @Transactional
  @Override
  public void persist() {
   
    ClusterEntity clusterEntity = clusterDAO.findById(cluster.getClusterId());
   
    ClusterConfigEntity entity = new ClusterConfigEntity();
    entity.setClusterEntity(clusterEntity);
    entity.setClusterId(Long.valueOf(cluster.getClusterId()));
    entity.setType(type);
    entity.setTag(getVersionTag());
    entity.setTimestamp(new Date().getTime());
   
    entity.setData(gson.toJson(getProperties()));
    clusterDAO.createConfig(entity);

    clusterEntity.getClusterConfigEntities().add(entity);
    clusterDAO.merge(clusterEntity);
    cluster.refresh();
   
  }
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.ClusterEntity

          + ", clusterName=" + clusterName);
    }

    // retrieve new cluster id
    // add cluster id -> cluster mapping into clustersById
    ClusterEntity clusterEntity = new ClusterEntity();
    clusterEntity.setClusterName(clusterName);
    clusterEntity.setDesiredStackVersion(gson.toJson(new StackId()));
    try {
      clusterDAO.create(clusterEntity);
      clusterEntity = clusterDAO.merge(clusterEntity);
      Cluster cluster = clusterFactory.create(clusterEntity);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.