private Boolean isValidCustomCommand(String clusterName,
      String serviceName, String componentName, String commandName)
      throws AmbariException {

    if (componentName == null) {
      return false;
    }

    Cluster cluster = clusters.getCluster(clusterName);
    Service service = cluster.getService(serviceName);
    ServiceComponent component = service.getServiceComponent(componentName);
    StackId stackId = component.getDesiredStackId();

    ComponentInfo componentInfo = ambariMetaInfo.getComponent(
        stackId.getStackName(), stackId.getStackVersion(),
        serviceName, componentName);

    return !(!componentInfo.isCustomCommand(commandName) &&
      !actionMetadata.isDefaultHostComponentCommand(commandName));
  }
Helper class containing logic to process custom command execution requests .
This class has special support needed for SERVICE_CHECK and DECOMMISSION.
These commands are not pass through as Ambari has specific persistence requirements.
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java