Package org.apache.ambari.server.orm.entities

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


  }
 
  @Transactional
  private void unmapHostClusterEntities(String hostName, long clusterId) {
    HostEntity hostEntity = hostDAO.findByName(hostName);
    ClusterEntity clusterEntity = clusterDAO.findById(clusterId);

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

    hostConfigMappingDAO.removeHost(clusterId, hostName);
   
    hostDAO.merge(hostEntity);
    clusterDAO.merge(clusterEntity);
View Full Code Here


        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

  }
 
  @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

  }
 
  @Transactional
  private void unmapHostClusterEntities(String hostName, long clusterId) {
    HostEntity hostEntity = hostDAO.findByName(hostName);
    ClusterEntity clusterEntity = clusterDAO.findById(clusterId);

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

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

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

      stageEntity.setCluster(clusterEntity);
      stageDAO.create(stageEntity);

      for (HostRoleCommand hostRoleCommand : stage.getOrderedHostRoleCommands()) {
View Full Code Here

   *
   * @throws Exception
   */
  @Transactional
  private void persistEntities() {
    ClusterEntity clusterEntity = clusterDAO.findById(cluster.getClusterId());
    configGroupEntity.setClusterEntity(clusterEntity);
    configGroupEntity.setTimestamp(System.currentTimeMillis());
    configGroupDAO.create(configGroupEntity);

    persistConfigMapping(clusterEntity);
View Full Code Here

    }
  }

  @Transactional
  private void saveIfPersisted() {
    ClusterEntity clusterEntity = clusterDAO.findById(cluster.getClusterId());

    if (isPersisted) {
      configGroupDAO.merge(configGroupEntity);
      persistHostMapping();
      persistConfigMapping(clusterEntity);
View Full Code Here

 
  @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

  }

  @Transactional
  protected void persistEntities() {
    ClusterEntity clusterEntity = clusterDAO.findById(cluster.getClusterId());
    serviceEntity.setClusterEntity(clusterEntity);
    clusterServiceDAO.create(serviceEntity);
    serviceDesiredStateDAO.create(serviceDesiredStateEntity);
    clusterEntity.getClusterServiceEntities().add(serviceEntity);
    clusterDAO.merge(clusterEntity);
//    serviceEntity =
        clusterServiceDAO.merge(serviceEntity);
//    serviceDesiredStateEntity =
        serviceDesiredStateDAO.merge(serviceDesiredStateEntity);
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.orm.entities.ClusterEntity

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.