Package org.apache.ambari.server.customactions

Examples of org.apache.ambari.server.customactions.ActionDefinition


      return new ActionExecutionContext(actionRequest.getClusterName(),
        actionRequest.getCommandName(), actionRequest.getResourceFilters(),
        actionRequest.getParameters());
    } else {

    ActionDefinition actionDef = ambariMetaInfo.getActionDefinition(actionRequest.getActionName());

    if (actionDef == null) {
      throw new AmbariException("Action " + actionRequest.getActionName() + " does not exist");
    }

    return new ActionExecutionContext(actionRequest.getClusterName(),
      actionRequest.getActionName(), actionRequest.getResourceFilters(),
      actionRequest.getParameters(), actionDef.getTargetType(),
      actionDef.getDefaultTimeout(), actionDef.getTargetService(),
      actionDef.getTargetComponent());

    }
  }
View Full Code Here


    hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h2").persist();

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a1", ActionType.SYSTEM, "test,[optional1]", "", "", "Does file exist",
        TargetHostType.SPECIFIC, Short.valueOf("100")));

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a2", ActionType.SYSTEM, "", "HDFS", "DATANODE", "Does file exist",
        TargetHostType.ALL, Short.valueOf("100")));

    Map<String, String> params = new HashMap<String, String>() {{
      put("test", "test");
View Full Code Here

    }};
    actionRequest = new ExecuteActionRequest("c1", "DECOMMISSION", null, resourceFilters, params2);
    expectActionCreationErrorWithMessage(actionRequest, requestProperties,
        "mark_draining_only is not a valid parameter for NAMENODE");

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a1", ActionType.SYSTEM, "test,dirName", "", "", "Does file exist",
        TargetHostType.SPECIFIC, Short.valueOf("100")));

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a2", ActionType.SYSTEM, "", "HDFS", "DATANODE", "Does file exist",
        TargetHostType.ANY, Short.valueOf("100")));

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a3", ActionType.SYSTEM, "", "MAPREDUCE", "MAPREDUCE_CLIENT", "Does file exist",
        TargetHostType.ANY, Short.valueOf("100")));

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a4", ActionType.SYSTEM, "", "HIVE", "", "Does file exist",
        TargetHostType.ANY, Short.valueOf("100")));

    actionRequest = new ExecuteActionRequest("c1", null, "a1", null, null);
    expectActionCreationErrorWithMessage(actionRequest, requestProperties,
View Full Code Here

    hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h2").persist();

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
      "a1", ActionType.SYSTEM, "", "HDFS", "", "Some custom action.",
      TargetHostType.ALL, Short.valueOf("100")));

    Map<String, String> params = new HashMap<String, String>() {{
      put("test", "test");
View Full Code Here

    hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h2").persist();

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a1", ActionType.SYSTEM, "test,[optional1]", "", "", "Does file exist",
        TargetHostType.SPECIFIC, Short.valueOf("100")));

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a2", ActionType.SYSTEM, "", "HDFS", "DATANODE", "Does file exist",
        TargetHostType.ALL, Short.valueOf("100")));

    Map<String, String> params = new HashMap<String, String>() {{
      put("test", "test");
View Full Code Here

    }};
    actionRequest = new ExecuteActionRequest("c1", "DECOMMISSION", null, resourceFilters, null, params2);
    expectActionCreationErrorWithMessage(actionRequest, requestProperties,
        "mark_draining_only is not a valid parameter for NAMENODE");

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a1", ActionType.SYSTEM, "test,dirName", "", "", "Does file exist",
        TargetHostType.SPECIFIC, Short.valueOf("100")));

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a2", ActionType.SYSTEM, "", "HDFS", "DATANODE", "Does file exist",
        TargetHostType.ANY, Short.valueOf("100")));

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a3", ActionType.SYSTEM, "", "MAPREDUCE", "MAPREDUCE_CLIENT", "Does file exist",
        TargetHostType.ANY, Short.valueOf("100")));

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
        "a4", ActionType.SYSTEM, "", "HIVE", "", "Does file exist",
        TargetHostType.ANY, Short.valueOf("100")));

    actionRequest = new ExecuteActionRequest("c1", null, "a1", null, null, null);
    expectActionCreationErrorWithMessage(actionRequest, requestProperties,
View Full Code Here

    hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h1").persist();
    hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost("h2").persist();

    controller.getAmbariMetaInfo().addActionDefinition(new ActionDefinition(
      "a1", ActionType.SYSTEM, "", "HDFS", "", "Some custom action.",
      TargetHostType.ALL, Short.valueOf("100")));

    Map<String, String> params = new HashMap<String, String>() {{
      put("test", "test");
View Full Code Here

    String hostname1 = "h1";
    String hostname2 = "h2";
    addHost(hostname1);
    addHost(hostname2);
   
    ambariMetaInfo.addActionDefinition(new ActionDefinition("a1", ActionType.SYSTEM,
        "", "", "", "action def description", TargetHostType.ANY,
        Short.valueOf("60")));
   
    Map<String, String> requestProperties = new HashMap<String, String>();
    requestProperties.put(REQUEST_CONTEXT_PROPERTY, "Called from a test");
View Full Code Here

        List<ActionDefinition> ads = getAmbariMetaInfo().getAllActionDefinition();
        for (ActionDefinition ad : ads) {
          responses.add(ad.convertToResponse());
        }
      } else {
        ActionDefinition ad = getAmbariMetaInfo().getActionDefinition(request.getActionName());
        if (ad != null) {
          responses.add(ad.convertToResponse());
        }
      }
    }

    return responses;
View Full Code Here

              actionRequest.getParameters());
      actionExecutionContext.setOperationLevel(operationLevel);
      return actionExecutionContext;
    } else { // If action

      ActionDefinition actionDef =
              ambariMetaInfo.getActionDefinition(actionRequest.getActionName());

      if (actionDef == null) {
        throw new AmbariException(
                "Action " + actionRequest.getActionName() + " does not exist");
      }

      ActionExecutionContext actionExecutionContext =
              new ActionExecutionContext(actionRequest.getClusterName(),
              actionRequest.getActionName(), actionRequest.getResourceFilters(),
              actionRequest.getParameters(), actionDef.getTargetType(),
              actionDef.getDefaultTimeout(), actionDef.getTargetService(),
              actionDef.getTargetComponent());
      actionExecutionContext.setOperationLevel(operationLevel);
      return actionExecutionContext;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.customactions.ActionDefinition

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.