Package org.apache.ambari.server

Examples of org.apache.ambari.server.AmbariException


        } catch (AmbariException e) {
          LOG.error("Upgrade failed. ", e);
          throw e;
        } catch (SQLException e) {
          LOG.error("Upgrade failed. ", e);
          throw new AmbariException(e.getMessage(), e);
        } catch (Exception e) {
          LOG.error("Upgrade failed. ", e);
          throw new AmbariException(e.getMessage(), e);
        }
      }
    }
  }
View Full Code Here


        } catch (AmbariException e) {
          LOG.error("Upgrade failed. ", e);
          throw e;
        } catch (SQLException e) {
          LOG.error("Upgrade failed. ", e);
          throw new AmbariException(e.getMessage());
        } catch (Exception e) {
          LOG.error("Upgrade failed. ", e);
          throw new AmbariException(e.getMessage(), e);
        }
      }
    }
  }
View Full Code Here

    injector.getInstance(GuiceJpaInitializer.class);

    try {
      String tag = "version1";
      String type = "core-site";
      AmbariException exception = null;
      try {
        AmbariManagementController amc = injector.getInstance(AmbariManagementController.class);
        Clusters clusters = injector.getInstance(Clusters.class);
        Gson gson = new Gson();

        clusters.addHost("host1");
        clusters.addHost("host2");
        clusters.addHost("host3");
        Host host = clusters.getHost("host1");
        host.setOsType("centos6");
        host.persist();
        host = clusters.getHost("host2");
        host.setOsType("centos6");
        host.persist();
        host = clusters.getHost("host3");
        host.setOsType("centos6");
        host.persist();

        ClusterRequest clusterRequest = new ClusterRequest(null, "c1", "HDP-1.2.0", null);
        amc.createCluster(clusterRequest);

        Set<ServiceRequest> serviceRequests = new HashSet<ServiceRequest>();
        serviceRequests.add(new ServiceRequest("c1", "HDFS", null));

        ServiceResourceProviderTest.createServices(amc, serviceRequests);

        Type confType = new TypeToken<Map<String, String>>() {
        }.getType();

        ConfigurationRequest configurationRequest = new ConfigurationRequest("c1", type, tag,
            gson.<Map<String, String>>fromJson("{ \"fs.default.name\" : \"localhost:8020\"}", confType));
        amc.createConfiguration(configurationRequest);

        amc.createConfiguration(configurationRequest);
      } catch (AmbariException e) {
        exception = e;
      }

      assertNotNull(exception);
      String exceptionMessage = MessageFormat.format("Configuration with tag ''{0}'' exists for ''{1}''",
          tag, type);
      org.junit.Assert.assertEquals(exceptionMessage, exception.getMessage());
    } finally {
      injector.getInstance(PersistService.class).stop();
    }
  }
View Full Code Here

      String error = "Current database store version is not compatible with " +
          "current server version"
          + ", serverVersion=" + serverVersion
          + ", schemaVersion=" + schemaVersion;
      LOG.warn(error);
      throw new AmbariException(error);
    }

    LOG.info("DB store version is compatible");
  }
View Full Code Here

      }

      Cluster cl = clusterFsm.getCluster(report.getClusterName());
      String service = report.getServiceName();
      if (service == null || service.isEmpty()) {
        throw new AmbariException("Invalid command report, service: " + service);
      }
      if (actionMetadata.getActions(service.toLowerCase()).contains(report.getRole())) {
        LOG.debug(report.getRole() + " is an action - skip component lookup");
      } else {
        try {
View Full Code Here

        try {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Sending command string = " + StageUtils.jaxbToString(ac));
          }
        } catch (Exception e) {
          throw new AmbariException("Could not get jaxb string for command", e);
        }
        switch (ac.getCommandType()) {
          case EXECUTION_COMMAND: {
            response.addExecutionCommand((ExecutionCommand) ac);
            break;
View Full Code Here

      LOG.warn("Received registration request from host with non compatible"
          + " agent version"
          + ", hostname=" + hostname
          + ", agentVersion=" + agentVersion
          + ", serverVersion=" + serverVersion);
      throw new AmbariException("Cannot register host with non compatible"
          + " agent version"
          + ", hostname=" + hostname
          + ", agentVersion=" + agentVersion
          + ", serverVersion=" + serverVersion);
    }

    String agentOsType = getOsType(register.getHardwareProfile().getOS(),
        register.getHardwareProfile().getOSRelease());
    if (!ambariMetaInfo.isOsSupported(agentOsType)) {
      LOG.warn("Received registration request from host with not supported"
          + " os type"
          + ", hostname=" + hostname
          + ", serverOsType=" + config.getServerOsType()
          + ", agentOstype=" + agentOsType);
      throw new AmbariException("Cannot register host with not supported"
          + " os type"
          + ", hostname=" + hostname
          + ", serverOsType=" + config.getServerOsType()
          + ", agentOstype=" + agentOsType);
    }
View Full Code Here

    // Request Entries
    String tableName = "request";
    if (!dbAccessor.tableExists(tableName)) {
      String msg = String.format("Table \"%s\" was not created during schema upgrade", tableName);
      LOG.error(msg);
      throw new AmbariException(msg);
    } else if (!dbAccessor.tableHasData(tableName)) {
      String query;
      if (dbType.equals(Configuration.POSTGRES_DB_NAME)) {
        query = getPostgresRequestUpgradeQuery();
      } else if (dbType.equals(Configuration.ORACLE_DB_NAME)) {
View Full Code Here

    if (null == configs) {
      configs = new HashMap<String, Config>();
    }

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

    Config config = configFactory.createNew (cluster, request.getType(),
View Full Code Here

    for (UserRequest request : requests) {

      if (null == request.getUsername() || request.getUsername().isEmpty() ||
          null == request.getPassword() || request.getPassword().isEmpty()) {
        throw new AmbariException("Username and password must be supplied.");
      }

      User user = users.getAnyUser(request.getUsername());
      if (null != user)
        throw new AmbariException("User already exists.");

      users.createUser(request.getUsername(), request.getPassword());

      if (0 != request.getRoles().size()) {
        user = users.getAnyUser(request.getUsername());
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.AmbariException

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.