http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
index 0ed4860..1049698 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
@@ -22,6 +22,8 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.retry.RetryNTimes;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -40,6 +42,7 @@ import 
org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsReque
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
+import org.apache.hadoop.yarn.api.records.ApplicationTimeout;
 import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType;
 import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
 import org.apache.hadoop.yarn.api.records.LocalResource;
@@ -58,34 +61,32 @@ import 
org.apache.hadoop.yarn.proto.ClientAMProtocol.GetStatusResponseProto;
 import org.apache.hadoop.yarn.proto.ClientAMProtocol.StopRequestProto;
 import org.apache.hadoop.yarn.service.ClientAMProtocol;
 import org.apache.hadoop.yarn.service.ServiceMaster;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.api.records.Component;
+import 
org.apache.hadoop.yarn.service.client.params.AbstractClusterBuildingActionArgs;
 import org.apache.hadoop.yarn.service.client.params.ActionDependencyArgs;
 import org.apache.hadoop.yarn.service.client.params.ActionFlexArgs;
 import org.apache.hadoop.yarn.service.client.params.Arguments;
 import org.apache.hadoop.yarn.service.client.params.ClientArgs;
 import org.apache.hadoop.yarn.service.client.params.CommonArgs;
 import org.apache.hadoop.yarn.service.conf.SliderExitCodes;
-import org.apache.hadoop.yarn.service.conf.SliderKeys;
-import org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys;
+import org.apache.hadoop.yarn.service.conf.YarnServiceConstants;
 import org.apache.hadoop.yarn.service.conf.YarnServiceConf;
 import org.apache.hadoop.yarn.service.provider.AbstractClientProvider;
 import org.apache.hadoop.yarn.service.provider.ProviderUtils;
+import org.apache.hadoop.yarn.service.utils.ServiceApiUtil;
+import org.apache.hadoop.yarn.service.utils.ServiceRegistryUtils;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
 import org.apache.hadoop.yarn.util.Records;
 import org.apache.hadoop.yarn.util.Times;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.Component;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.UsageException;
-import org.apache.slider.core.launch.ClasspathConstructor;
-import org.apache.slider.core.launch.JavaCommandLineBuilder;
-import org.apache.slider.core.registry.SliderRegistryUtils;
-import org.apache.slider.core.zk.ZKIntegration;
-import org.apache.slider.core.zk.ZookeeperUtils;
-import org.apache.hadoop.yarn.service.utils.ServiceApiUtil;
+import org.apache.hadoop.yarn.service.exceptions.BadClusterStateException;
+import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.containerlaunch.ClasspathConstructor;
+import org.apache.hadoop.yarn.service.containerlaunch.JavaCommandLineBuilder;
+import org.apache.hadoop.yarn.service.utils.ZookeeperUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -105,17 +106,21 @@ import java.util.concurrent.ConcurrentHashMap;
 import static org.apache.hadoop.yarn.api.records.YarnApplicationState.*;
 import static 
org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_CREATE;
 import static 
org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_FLEX;
-import static org.apache.slider.common.Constants.HADOOP_JAAS_DEBUG;
-import static org.apache.slider.common.tools.SliderUtils.*;
+import static org.apache.hadoop.yarn.service.conf.YarnServiceConf.YARN_QUEUE;
+import static org.apache.hadoop.yarn.service.utils.SliderUtils.*;
 
+@InterfaceAudience.Public
+@InterfaceStability.Unstable
 public class ServiceClient extends CompositeService
-    implements SliderExitCodes, SliderKeys {
+    implements SliderExitCodes, YarnServiceConstants {
   private static final Logger LOG =
       LoggerFactory.getLogger(ServiceClient.class);
   private SliderFileSystem fs;
   private YarnClient yarnClient;
   // Avoid looking up applicationId from fs all the time.
   private Map<String, ApplicationId> cachedAppIds = new ConcurrentHashMap<>();
+  private Map<String, ClientAMProtocol> cachedAMProxies = new 
ConcurrentHashMap<>();
+
   private RegistryOperations registryClient;
   private CuratorFramework curatorClient;
   private YarnRPC rpc;
@@ -293,7 +298,12 @@ public class ServiceClient extends CompositeService
     ServiceApiUtil.jsonSerDeser
         .save(fs.getFileSystem(), ServiceApiUtil.getAppJsonPath(fs, appName),
             persistedApp, true);
-    ClientAMProtocol proxy = connectToAM(appName);
+    ClientAMProtocol proxy = getAMProxy(appName);
+    if (proxy == null) {
+      String message = appName + " is not running";
+      LOG.error(message);
+      throw new YarnException(message);
+    }
     proxy.flexComponents(requestBuilder.build());
     for (Map.Entry<String, Long> entry : original.entrySet()) {
       LOG.info("[COMPONENT {}]: number of containers changed from {} to {}",
@@ -303,9 +313,10 @@ public class ServiceClient extends CompositeService
     return original;
   }
 
-  public int actionStop(String appName) throws YarnException, IOException {
+  public int actionStop(String appName, boolean waitForAppStopped)
+      throws YarnException, IOException {
     validateClusterName(appName);
-    getAppIdFromPersistedApp(appName);
+    getAppId(appName);
     ApplicationId currentAppId = cachedAppIds.get(appName);
     ApplicationReport report = yarnClient.getApplicationReport(currentAppId);
     if (terminatedStates.contains(report.getYarnApplicationState())) {
@@ -315,17 +326,29 @@ public class ServiceClient extends CompositeService
     }
     LOG.info("Stopping application {}, with appId = {}", appName, 
currentAppId);
     try {
-      // try to stop the app gracefully.
-      ClientAMProtocol proxy = connectToAM(appName);
-      StopRequestProto request = StopRequestProto.newBuilder().build();
-      proxy.stop(request);
-      LOG.info("Application " + appName + " is being gracefully stopped...");
+      ClientAMProtocol proxy = getAMProxy(appName, report);
+      cachedAppIds.remove(appName);
+      cachedAMProxies.remove(appName);
+      if (proxy != null) {
+        // try to stop the app gracefully.
+        StopRequestProto request = StopRequestProto.newBuilder().build();
+        proxy.stop(request);
+        LOG.info("Application " + appName + " is being gracefully stopped...");
+      } else {
+        yarnClient.killApplication(currentAppId,
+            appName + " is forcefully killed by user!");
+        LOG.info("Forcefully kill the application: " + appName);
+        return EXIT_SUCCESS;
+      }
 
+      if (!waitForAppStopped) {
+        return EXIT_SUCCESS;
+      }
       // Wait until the app is killed.
       long startTime = System.currentTimeMillis();
       int pollCount = 0;
       while (true) {
-        Thread.sleep(1000);
+        Thread.sleep(2000);
         report = yarnClient.getApplicationReport(currentAppId);
         if (terminatedStates.contains(report.getYarnApplicationState())) {
           LOG.info("Application " + appName + " is stopped.");
@@ -358,6 +381,7 @@ public class ServiceClient extends CompositeService
     FileSystem fileSystem = fs.getFileSystem();
     // remove from the appId cache
     cachedAppIds.remove(appName);
+    cachedAMProxies.remove(appName);
     if (fileSystem.exists(appDir)) {
       if (fileSystem.delete(appDir, true)) {
         LOG.info("Successfully deleted application dir for " + appName + ": "
@@ -370,7 +394,7 @@ public class ServiceClient extends CompositeService
       }
     }
     deleteZKNode(appName);
-    String registryPath = SliderRegistryUtils.registryPathForInstance(appName);
+    String registryPath = 
ServiceRegistryUtils.registryPathForInstance(appName);
     try {
       getRegistryClient().delete(registryPath, true);
     } catch (IOException e) {
@@ -395,7 +419,7 @@ public class ServiceClient extends CompositeService
   private void deleteZKNode(String clusterName) throws Exception {
     CuratorFramework curatorFramework = getCuratorClient();
     String user = RegistryUtils.currentUser();
-    String zkPath = ZKIntegration.mkClusterPath(user, clusterName);
+    String zkPath = ServiceRegistryUtils.mkClusterPath(user, clusterName);
     if (curatorFramework.checkExists().forPath(zkPath) != null) {
       curatorFramework.delete().deletingChildrenIfNeeded().forPath(zkPath);
       LOG.info("Deleted zookeeper path: " + zkPath);
@@ -418,7 +442,7 @@ public class ServiceClient extends CompositeService
     if (curatorClient == null) {
       curatorClient =
           CuratorFrameworkFactory.builder().connectString(registryQuorum)
-              .sessionTimeoutMs(10000).retryPolicy(new RetryNTimes(10, 2000))
+              .sessionTimeoutMs(10000).retryPolicy(new RetryNTimes(5, 2000))
               .build();
       curatorClient.start();
     }
@@ -433,7 +457,7 @@ public class ServiceClient extends CompositeService
   private void verifyNoLiveAppInRM(String appname, String action)
       throws IOException, YarnException {
     Set<String> types = new HashSet<>(1);
-    types.add(SliderKeys.APP_TYPE);
+    types.add(YarnServiceConstants.APP_TYPE);
     Set<String> tags = null;
     if (appname != null) {
       tags = Collections.singleton(SliderUtils.createNameTag(appname));
@@ -469,12 +493,13 @@ public class ServiceClient extends CompositeService
       appTimeout.put(ApplicationTimeoutType.LIFETIME, app.getLifetime());
       submissionContext.setApplicationTimeouts(appTimeout);
     }
-    submissionContext.setMaxAppAttempts(conf.getInt(KEY_AM_RESTART_LIMIT, 2));
+    submissionContext.setMaxAppAttempts(conf.getInt(
+        YarnServiceConf.AM_RESTART_MAX, 2));
 
     Map<String, LocalResource> localResources = new HashMap<>();
 
     // copy local slideram-log4j.properties to hdfs and add to localResources
-    boolean hasSliderAMLog4j =
+    boolean hasAMLog4j =
         addAMLog4jResource(appName, conf, localResources);
     // copy jars to hdfs and add to localResources
     addJarResource(appName, localResources);
@@ -487,17 +512,17 @@ public class ServiceClient extends CompositeService
 
     // create AM CLI
     String cmdStr =
-        buildCommandLine(appName, conf, appRootDir, hasSliderAMLog4j);
+        buildCommandLine(appName, conf, appRootDir, hasAMLog4j);
     submissionContext.setResource(Resource.newInstance(YarnServiceConf
-        .getLong(KEY_AM_RESOURCE_MEM, DEFAULT_KEY_AM_RESOURCE_MEM,
+        .getLong(YarnServiceConf.AM_RESOURCE_MEM, 
YarnServiceConf.DEFAULT_KEY_AM_RESOURCE_MEM,
             app.getConfiguration(), conf), 1));
     String queue = app.getQueue();
     if (StringUtils.isEmpty(queue)) {
-      queue = conf.get(KEY_YARN_QUEUE, "default");
+      queue = conf.get(YARN_QUEUE, "default");
     }
     submissionContext.setQueue(queue);
     submissionContext.setApplicationName(appName);
-    submissionContext.setApplicationType(SliderKeys.APP_TYPE);
+    submissionContext.setApplicationType(YarnServiceConstants.APP_TYPE);
     Set<String> appTags =
         AbstractClientProvider.createApplicationTags(appName, null, null);
     if (!appTags.isEmpty()) {
@@ -531,7 +556,7 @@ public class ServiceClient extends CompositeService
     //TODO CLI.setJVMHeap
     //TODO CLI.addJVMOPTS
     if (hasSliderAMLog4j) {
-      CLI.sysprop(SYSPROP_LOG4J_CONFIGURATION, LOG4J_SERVER_PROP_FILENAME);
+      CLI.sysprop(SYSPROP_LOG4J_CONFIGURATION, YARN_SERVICE_LOG4J_FILENAME);
       CLI.sysprop(SYSPROP_LOG_DIR, ApplicationConstants.LOG_DIR_EXPANSION_VAR);
     }
     CLI.add(ServiceMaster.class.getCanonicalName());
@@ -553,15 +578,15 @@ public class ServiceClient extends CompositeService
   private Map<String, String> addAMEnv(Configuration conf) throws IOException {
     Map<String, String> env = new HashMap<>();
     ClasspathConstructor classpath =
-        buildClasspath(SliderKeys.SUBMITTED_CONF_DIR, "lib", fs, getConfig()
+        buildClasspath(YarnServiceConstants.SUBMITTED_CONF_DIR, "lib", fs, 
getConfig()
             .getBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER, false));
     env.put("CLASSPATH", classpath.buildClasspath());
     env.put("LANG", "en_US.UTF-8");
     env.put("LC_ALL", "en_US.UTF-8");
     env.put("LANGUAGE", "en_US.UTF-8");
-    String jaas = System.getenv(HADOOP_JAAS_DEBUG);
+    String jaas = System.getenv("HADOOP_JAAS_DEBUG");
     if (jaas != null) {
-      env.put(HADOOP_JAAS_DEBUG, jaas);
+      env.put("HADOOP_JAAS_DEBUG", jaas);
     }
     if (!UserGroupInformation.isSecurityEnabled()) {
       String userName = UserGroupInformation.getCurrentUser().getUserName();
@@ -579,11 +604,11 @@ public class ServiceClient extends CompositeService
       throws IOException, SliderException {
     Path libPath = fs.buildClusterDirPath(appName);
     ProviderUtils
-        .addProviderJar(localResources, ServiceMaster.class, SLIDER_JAR, fs,
+        .addProviderJar(localResources, ServiceMaster.class, SERVICE_CORE_JAR, 
fs,
             libPath, "lib", false);
     Path dependencyLibTarGzip = fs.getDependencyTarGzip();
     if (fs.isFile(dependencyLibTarGzip)) {
-      LOG.info("Loading lib tar from " + fs.getFileSystem().getScheme() + ": "
+      LOG.info("Loading lib tar from " + fs.getFileSystem().getScheme() + ":/"
           + dependencyLibTarGzip);
       SliderUtils.putAmTarGzipAndUpdate(localResources, fs);
     } else {
@@ -599,27 +624,29 @@ public class ServiceClient extends CompositeService
   private boolean addAMLog4jResource(String appName, Configuration conf,
       Map<String, LocalResource> localResources)
       throws IOException, BadClusterStateException {
-    boolean hasSliderAMLog4j = false;
+    boolean hasAMLog4j = false;
     String hadoopConfDir =
         System.getenv(ApplicationConstants.Environment.HADOOP_CONF_DIR.name());
     if (hadoopConfDir != null) {
       File localFile =
-          new File(hadoopConfDir, SliderKeys.LOG4J_SERVER_PROP_FILENAME);
+          new File(hadoopConfDir, 
YarnServiceConstants.YARN_SERVICE_LOG4J_FILENAME);
       if (localFile.exists()) {
         Path localFilePath = createLocalPath(localFile);
         Path appDirPath = fs.buildClusterDirPath(appName);
         Path remoteConfPath =
-            new Path(appDirPath, SliderKeys.SUBMITTED_CONF_DIR);
+            new Path(appDirPath, YarnServiceConstants.SUBMITTED_CONF_DIR);
         Path remoteFilePath =
-            new Path(remoteConfPath, SliderKeys.LOG4J_SERVER_PROP_FILENAME);
+            new Path(remoteConfPath, 
YarnServiceConstants.YARN_SERVICE_LOG4J_FILENAME);
         copy(conf, localFilePath, remoteFilePath);
         LocalResource localResource =
             fs.createAmResource(remoteConfPath, LocalResourceType.FILE);
         localResources.put(localFilePath.getName(), localResource);
-        hasSliderAMLog4j = true;
+        hasAMLog4j = true;
+      } else {
+        LOG.warn("AM log4j property file doesn't exist: " + localFile);
       }
     }
-    return hasSliderAMLog4j;
+    return hasAMLog4j;
   }
 
   public int actionStart(String appName) throws YarnException, IOException {
@@ -674,22 +701,22 @@ public class ServiceClient extends CompositeService
       return;
     }
     String keytabPreInstalledOnHost =
-        conf.get(SliderXmlConfKeys.KEY_AM_KEYTAB_LOCAL_PATH);
+        conf.get(YarnServiceConf.KEY_AM_KEYTAB_LOCAL_PATH);
     if (StringUtils.isEmpty(keytabPreInstalledOnHost)) {
       String amKeytabName =
-          conf.get(SliderXmlConfKeys.KEY_AM_LOGIN_KEYTAB_NAME);
-      String keytabDir = conf.get(SliderXmlConfKeys.KEY_HDFS_KEYTAB_DIR);
+          conf.get(YarnServiceConf.KEY_AM_LOGIN_KEYTAB_NAME);
+      String keytabDir = conf.get(YarnServiceConf.KEY_HDFS_KEYTAB_DIR);
       Path keytabPath =
           fileSystem.buildKeytabPath(keytabDir, amKeytabName, appName);
       if (fileSystem.getFileSystem().exists(keytabPath)) {
         LocalResource keytabRes =
             fileSystem.createAmResource(keytabPath, LocalResourceType.FILE);
         localResource
-            .put(SliderKeys.KEYTAB_DIR + "/" + amKeytabName, keytabRes);
+            .put(YarnServiceConstants.KEYTAB_DIR + "/" + amKeytabName, 
keytabRes);
         LOG.info("Adding AM keytab on hdfs: " + keytabPath);
       } else {
         LOG.warn("No keytab file was found at {}.", keytabPath);
-        if (conf.getBoolean(KEY_AM_LOGIN_KEYTAB_REQUIRED, false)) {
+        if (conf.getBoolean(YarnServiceConf.KEY_AM_LOGIN_KEYTAB_REQUIRED, 
false)) {
           throw new BadConfigException("No keytab file was found at %s.",
               keytabPath);
         } else {
@@ -704,7 +731,7 @@ public class ServiceClient extends CompositeService
 
   public String updateLifetime(String appName, long lifetime)
       throws YarnException, IOException {
-    getAppIdFromPersistedApp(appName);
+    getAppId(appName);
     ApplicationId currentAppId = cachedAppIds.get(appName);
     ApplicationReport report = yarnClient.getApplicationReport(currentAppId);
     if (report == null) {
@@ -729,11 +756,25 @@ public class ServiceClient extends CompositeService
 
   public Application getStatus(String appName)
       throws IOException, YarnException {
-    ClientAMProtocol proxy = connectToAM(appName);
-    GetStatusResponseProto response =
-        proxy.getStatus(GetStatusRequestProto.newBuilder().build());
-    return ServiceApiUtil.jsonSerDeser.fromJson(response.getStatus());
-
+    validateClusterName(appName);
+    ApplicationId currentAppId = getAppId(appName);
+    ApplicationReport appReport = 
yarnClient.getApplicationReport(currentAppId);
+    ClientAMProtocol amProxy = getAMProxy(appName, appReport);
+    Application appSpec;
+    if (amProxy != null) {
+      GetStatusResponseProto response =
+          amProxy.getStatus(GetStatusRequestProto.newBuilder().build());
+      appSpec = ServiceApiUtil.jsonSerDeser.fromJson(response.getStatus());
+    } else {
+      appSpec = new Application();
+      appSpec.setName(appName);
+    }
+    ApplicationTimeout lifetime =
+        
appReport.getApplicationTimeouts().get(ApplicationTimeoutType.LIFETIME);
+    if (lifetime != null) {
+      appSpec.setLifetime(lifetime.getRemainingTime());
+    }
+    return appSpec;
   }
 
   public YarnClient getYarnClient() {
@@ -760,71 +801,61 @@ public class ServiceClient extends CompositeService
     String[] libDirs = SliderUtils.getLibDirs();
     if (libDirs.length > 0) {
       File tempLibTarGzipFile = File.createTempFile(
-          SliderKeys.SLIDER_DEPENDENCY_TAR_GZ_FILE_NAME + "_",
-          SliderKeys.SLIDER_DEPENDENCY_TAR_GZ_FILE_EXT);
+          YarnServiceConstants.DEPENDENCY_TAR_GZ_FILE_NAME + "_",
+          YarnServiceConstants.DEPENDENCY_TAR_GZ_FILE_EXT);
       // copy all jars
       tarGzipFolder(libDirs, tempLibTarGzipFile, createJarFilter());
 
-      LOG.info("Uploading dependency for AM (version {}) from {} to {}",
-          VersionInfo.getBuildVersion(), tempLibTarGzipFile.toURI(),
-          dependencyLibTarGzip.toUri());
+      LOG.info("Version Info: " + VersionInfo.getBuildVersion());
       fs.copyLocalFileToHdfs(tempLibTarGzipFile, dependencyLibTarGzip,
-          new FsPermission(SliderKeys.SLIDER_DEPENDENCY_DIR_PERMISSIONS));
+          new FsPermission(YarnServiceConstants.DEPENDENCY_DIR_PERMISSIONS));
       return EXIT_SUCCESS;
     } else {
       return EXIT_FALSE;
     }
   }
 
-  protected ClientAMProtocol connectToAM(String appName)
+  // Get AMProxy with the appReport provided
+  protected ClientAMProtocol getAMProxy(String appName, ApplicationReport 
report)
+      throws IOException {
+    if (!cachedAMProxies.containsKey(appName) && !StringUtils
+        .isEmpty(report.getHost())) {
+      insertAMProxy(appName, report.getHost(), report.getRpcPort());
+    }
+    return cachedAMProxies.get(appName);
+  }
+
+  // Get AMProxy without appReport provided - it'll getAppReport from RM
+  protected ClientAMProtocol getAMProxy(String appName)
       throws IOException, YarnException {
-    ApplicationId currentAppId = getAppIdFromPersistedApp(appName);
-    // Wait until app becomes running.
-    long startTime = System.currentTimeMillis();
-    int pollCount = 0;
-    ApplicationReport appReport = null;
-    while (true) {
-      appReport = yarnClient.getApplicationReport(currentAppId);
-      YarnApplicationState state = appReport.getYarnApplicationState();
-      if (state == RUNNING) {
-        break;
-      }
-      if (terminatedStates.contains(state)) {
-        throw new YarnException(
-            "Failed to getStatus " + currentAppId + ": " + appReport
-                .getDiagnostics());
-      }
-      long elapsedMillis = System.currentTimeMillis() - startTime;
-      // if over 5 min, quit
-      if (elapsedMillis >= 300000) {
-        throw new YarnException(
-            "Timed out while waiting for application " + currentAppId
-                + " to be running");
-      }
+    ApplicationId currentAppId = getAppId(appName);
 
-      if (++pollCount % 10 == 0) {
-        LOG.info(
-            "Waiting for application {} to be running, current state is {}",
-            currentAppId, state);
-      }
-      try {
-        Thread.sleep(3000);
-      } catch (InterruptedException ie) {
-        String msg =
-            "Interrupted while waiting for application " + currentAppId
-                + " to be running.";
-        throw new YarnException(msg, ie);
+    if (cachedAMProxies.containsKey(appName)) {
+      return cachedAMProxies.get(appName);
+    } else {
+      ApplicationReport appReport =
+          yarnClient.getApplicationReport(currentAppId);
+      String host = appReport.getHost();
+      int port = appReport.getRpcPort();
+      if (!StringUtils.isEmpty(host)) {
+        return insertAMProxy(appName, host, port);
       }
+      return null;
     }
+  }
 
-    // Make the connection
-    InetSocketAddress address = NetUtils
-        .createSocketAddrForHost(appReport.getHost(), appReport.getRpcPort());
-    return ClientAMProxy.createProxy(getConfig(), ClientAMProtocol.class,
+  private ClientAMProtocol insertAMProxy(String appName, String host, int port)
+      throws IOException {
+    InetSocketAddress address =
+        NetUtils.createSocketAddrForHost(host, port);
+    ClientAMProtocol amProxy =
+        ClientAMProxy.createProxy(getConfig(), ClientAMProtocol.class,
         UserGroupInformation.getCurrentUser(), rpc, address);
+    cachedAMProxies.put(appName, amProxy);
+    return amProxy;
   }
 
-  private synchronized ApplicationId getAppIdFromPersistedApp(String appName)
+  private synchronized ApplicationId getAppId(String appName)
       throws IOException, YarnException {
     if (cachedAppIds.containsKey(appName)) {
       return cachedAppIds.get(appName);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java
index 05c6501..ea3bb0a 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java
@@ -20,10 +20,9 @@ package org.apache.hadoop.yarn.service.client.params;
 
 import com.beust.jcommander.Parameter;
 import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.params.PathArgumentConverter;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.ErrorStrings;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -49,7 +48,7 @@ public abstract class AbstractActionArgs extends ArgOps 
implements Arguments {
   public String filesystemBinding;
 
   @Parameter(names = {ARG_BASE_PATH},
-             description = "Slider base path on the filesystem",
+             description = "Service base path on the filesystem",
              converter =  PathArgumentConverter.class)
   public Path basePath;
 
@@ -129,7 +128,7 @@ public abstract class AbstractActionArgs extends ArgOps 
implements Arguments {
     if (minArgs > actionArgSize) {
       throw new BadCommandArgumentsException(
         ErrorStrings.ERROR_NOT_ENOUGH_ARGUMENTS + getActionName() +
-        " Expected minimum " + minArgs + " but got " + actionArgSize);
+        ", Expected minimum " + minArgs + " but got " + actionArgSize);
     }
     int maxArgs = getMaxParams();
     if (maxArgs == -1) {
@@ -146,7 +145,7 @@ public abstract class AbstractActionArgs extends ArgOps 
implements Arguments {
       StringBuilder buf = new StringBuilder(message);
       for (String actionArg : parameters) {
         log.error("[{}] \"{}\"", index++, actionArg);
-        buf.append(" \"" + actionArg + "\" ");
+        buf.append(" \"").append(actionArg).append("\" ");
       }
       throw new BadCommandArgumentsException(buf.toString());
     }
@@ -156,25 +155,4 @@ public abstract class AbstractActionArgs extends ArgOps 
implements Arguments {
   public String toString() {
     return super.toString() + ": " + getActionName();
   }
-
-  /**
-   * Override point: 
-   * Flag to indicate that core hadoop API services are needed (HDFS, YARN, 
etc)
-   * —and that validation of the client state should take place.
-   * 
-   * @return a flag to indicate that the core hadoop services will be needed.
-   */
-  public boolean getHadoopServicesRequired() {
-    return true;
-  }
-
-  /**
-   * Flag to disable secure login.
-   * This MUST only be set if the action is bypassing security or setting
-   * it itself
-   * @return true if login at slider client init time is to be skipped
-   */
-  public boolean disableSecureLogin() {
-    return false;
-  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractArgsDelegate.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractArgsDelegate.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractArgsDelegate.java
new file mode 100644
index 0000000..457e357
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractArgsDelegate.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import org.apache.hadoop.yarn.service.client.params.ArgOps;
+import org.apache.hadoop.yarn.service.client.params.Arguments;
+
+/**
+ * Base class for all the delegates
+ */
+public class AbstractArgsDelegate extends ArgOps implements Arguments {
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java
new file mode 100644
index 0000000..017286f
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.ParametersDelegate;
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Abstract Action to build things; shares args across build and
+ * list
+ */
+public abstract class AbstractClusterBuildingActionArgs
+    extends AbstractActionArgs {
+  @Parameter(names = {ARG_APPDEF},
+      description = "Template application definition file in JSON format.")
+  public File appDef;
+
+  public File getAppDef() {
+    return appDef;
+  }
+
+  @Parameter(names = {
+      ARG_QUEUE }, description = "Queue to submit the application")
+  public String queue;
+
+  @Parameter(names = {
+      ARG_LIFETIME }, description = "Lifetime of the application from the time 
of request")
+  public long lifetime;
+
+  @ParametersDelegate
+  public ComponentArgsDelegate componentDelegate = new ComponentArgsDelegate();
+
+  @ParametersDelegate
+  public OptionArgsDelegate optionsDelegate =
+      new OptionArgsDelegate();
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java
index 28381cf..c2ff545 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java
@@ -18,8 +18,6 @@
 package org.apache.hadoop.yarn.service.client.params;
 
 import com.beust.jcommander.Parameters;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
 
 @Parameters(commandNames = { SliderActions.ACTION_BUILD},
             commandDescription = SliderActions.DESCRIBE_ACTION_BUILD)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionClientArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionClientArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionClientArgs.java
new file mode 100644
index 0000000..0097b4e
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionClientArgs.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
+import org.apache.hadoop.yarn.service.client.params.SliderActions;
+
+import java.io.File;
+
+@Parameters(commandNames = { SliderActions.ACTION_CLIENT},
+    commandDescription = SliderActions.DESCRIBE_ACTION_CLIENT)
+
+public class ActionClientArgs extends AbstractActionArgs {
+
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_CLIENT;
+  }
+
+  @Parameter(names = {ARG_INSTALL},
+      description = "Install client")
+  public boolean install;
+
+  @Parameter(names = {ARG_NAME},
+      description = "The name of the application")
+  public String name;
+
+  @Parameter(names = {ARG_PACKAGE},
+      description = "Path to app package")
+  public String packageURI;
+
+  @Parameter(names = {ARG_DEST},
+      description = "The location where to install the client")
+  public File installLocation;
+
+  @Parameter(names = {ARG_CONFIG},
+      description = "Client configuration")
+  public File clientConfig;
+
+  /**
+   * Get the min #of params expected
+   *
+   * @return the min number of params in the {@link #parameters} field
+   */
+  public int getMinParams() {
+    return 0;
+  }
+
+  @Override
+  public int getMaxParams() {
+    return 1;
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java
index 35cef5a..eecffb6 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java
@@ -19,8 +19,6 @@
 package org.apache.hadoop.yarn.service.client.params;
 
 import com.beust.jcommander.Parameters;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
 
 @Parameters(commandNames = { SliderActions.ACTION_CREATE},
             commandDescription = SliderActions.DESCRIBE_ACTION_CREATE)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java
index b41b2af..51e07c9 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java
@@ -17,8 +17,8 @@
  */
 package org.apache.hadoop.yarn.service.client.params;
 
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
 
 import com.beust.jcommander.Parameter;
 import com.beust.jcommander.Parameters;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionExistsArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionExistsArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionExistsArgs.java
new file mode 100644
index 0000000..ba3c5a9
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionExistsArgs.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
+import org.apache.hadoop.yarn.service.client.params.SliderActions;
+
+import java.io.File;
+
+@Parameters(commandNames = { SliderActions.ACTION_EXISTS},
+            commandDescription = SliderActions.DESCRIBE_ACTION_EXISTS)
+
+public class ActionExistsArgs extends AbstractActionArgs {
+
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_EXISTS;
+  }
+
+  @Parameter(names = {ARG_LIVE},
+             description = "verify that the application is running")
+  public boolean live;
+  
+  @Parameter(names = {ARG_STATE},
+             description = "verify that the application is in the specific 
YARN state")
+  public String state = "";
+
+  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
+      description = "output file for any application report")
+  public File out;
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java
index fcbb803..b7acf58 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java
@@ -20,7 +20,7 @@ package org.apache.hadoop.yarn.service.client.params;
 
 import com.beust.jcommander.Parameters;
 import com.beust.jcommander.ParametersDelegate;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
 
 import java.util.List;
 import java.util.Map;
@@ -47,9 +47,4 @@ public class ActionFlexArgs extends AbstractActionArgs {
       BadCommandArgumentsException {
     return componentDelegate.getComponentMap();
   }
-
-  public List<String> getComponentTuples() {
-    return componentDelegate.getComponentTuples();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFreezeArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFreezeArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFreezeArgs.java
new file mode 100644
index 0000000..aecf0eb
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFreezeArgs.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import com.beust.jcommander.ParametersDelegate;
+
+@Parameters(commandNames = { SliderActions.ACTION_STOP },
+            commandDescription = SliderActions.DESCRIBE_ACTION_FREEZE)
+
+public class ActionFreezeArgs extends AbstractActionArgs implements
+                                                         WaitTimeAccessor {
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_STOP;
+  }
+  
+  public static final String FREEZE_COMMAND_ISSUED = "stop command issued";
+  @ParametersDelegate
+  public WaitArgsDelegate waitDelegate = new WaitArgsDelegate();
+
+  @Override
+  public int getWaittime() {
+    return waitDelegate.getWaittime();
+  }
+
+  @Override
+  public void setWaittime(int waittime) {
+    waitDelegate.setWaittime(waittime);
+  }
+
+  @Parameter(names={ARG_MESSAGE},
+             description = "reason for the operation")
+  public String message = FREEZE_COMMAND_ISSUED;
+
+  @Parameter(names = {ARG_FORCE},
+             description = "force the operation")
+  public boolean force;
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionHelpArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionHelpArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionHelpArgs.java
new file mode 100644
index 0000000..51aa88a
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionHelpArgs.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
+import org.apache.hadoop.yarn.service.client.params.SliderActions;
+
+/**
+ * The Help command
+ */
+@Parameters(commandNames = { SliderActions.ACTION_HELP},
+            commandDescription = SliderActions.DESCRIBE_ACTION_HELP)
+public class ActionHelpArgs extends AbstractActionArgs {
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_HELP;
+  }
+
+  /**
+   * Get the min #of params expected
+   * @return the min number of params in the {@link #parameters} field
+   */
+  @Override
+  public int getMinParams() {
+    return 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKDiagArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKDiagArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKDiagArgs.java
new file mode 100644
index 0000000..061121e
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKDiagArgs.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+@Parameters(commandNames = { SliderActions.ACTION_KDIAG},
+            commandDescription = SliderActions.DESCRIBE_ACTION_KDIAG)
+
+public class ActionKDiagArgs extends AbstractActionArgs {
+
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_KDIAG;
+  }
+
+  @Parameter(names = {ARG_SERVICES}, variableArity = true,
+    description =" list of services to check")
+  public List<String> services = new ArrayList<>();
+
+  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
+      description = "output file for report")
+  public File out;
+
+  @Parameter(names = {ARG_KEYTAB}, description = "keytab to use")
+  public File keytab;
+
+  @Parameter(names = {ARG_KEYLEN}, description = "minimum key length")
+  public int keylen = 256;
+
+  @Parameter(names = {ARG_PRINCIPAL}, description = "principal to log in from 
a keytab")
+  public String principal;
+
+  @Parameter(names = {ARG_SECURE}, description = "Is security required")
+  public boolean secure = false;
+
+  @Override
+  public int getMinParams() {
+    return 0;
+  }
+
+  @Override
+  public void validate() throws BadCommandArgumentsException, UsageException {
+    super.validate();
+    if (keytab != null && SliderUtils.isUnset(principal)) {
+      throw new UsageException("Missing argument " + ARG_PRINCIPAL);
+    }
+    if (keytab == null && SliderUtils.isSet(principal)) {
+      throw new UsageException("Missing argument " + ARG_KEYTAB);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKeytabArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKeytabArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKeytabArgs.java
new file mode 100644
index 0000000..7e51457
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKeytabArgs.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
+import org.apache.hadoop.yarn.service.client.params.SliderActions;
+
+@Parameters(commandNames = { SliderActions.ACTION_KEYTAB},
+            commandDescription = SliderActions.DESCRIBE_ACTION_KEYTAB)
+
+public class ActionKeytabArgs extends AbstractActionArgs {
+
+  public ActionKeytabArgs() {
+    super();
+  }
+
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_INSTALL_KEYTAB;
+  }
+
+  @Parameter(names = {ARG_KEYTABINSTALL},
+             description = "Install the keytab")
+  public boolean install;
+
+  @Parameter(names = {ARG_KEYTABDELETE},
+             description = "Delete the keytab")
+  public boolean delete;
+
+  @Parameter(names = {ARG_KEYTABLIST},
+             description = "List of installed keytabs")
+  public boolean list;
+
+  @Parameter(names = {ARG_KEYTAB},
+             description = "Path or name of the keytab")
+  public String keytab;
+
+  @Parameter(names = {ARG_FOLDER},
+             description = "The name of the folder in which to store the 
keytab")
+  public String folder;
+
+  @Parameter(names = {ARG_OVERWRITE}, description = "Overwrite existing 
keytab")
+  public boolean overwrite = false;
+
+  /**
+   * Get the min #of params expected
+   * @return the min number of params in the {@link #parameters} field
+   */
+  public int getMinParams() {
+    return 0;
+  }
+
+  @Override
+  public int getMaxParams() {
+    return 3;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.java
new file mode 100644
index 0000000..005c172
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
+import org.apache.hadoop.yarn.service.client.params.SliderActions;
+
+@Parameters(commandNames = { SliderActions.ACTION_LIST},
+            commandDescription = SliderActions.DESCRIBE_ACTION_LIST)
+
+public class ActionListArgs extends AbstractActionArgs {
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_LIST;
+  }
+
+  @Parameter(names = {ARG_LIVE},
+          description = "List only live application instances")
+  public boolean live;
+
+  @Parameter(names = {ARG_STATE},
+      description = "list only applications in the specific YARN state")
+  public String state = "";
+  
+  @Parameter(names = {ARG_VERBOSE},
+      description = "print out information in details")
+  public boolean verbose = false;
+
+  @Parameter(names = {ARG_CONTAINERS},
+      description = "List containers of an application instance")
+  public boolean containers;
+
+  @Parameter(names = {ARG_VERSION},
+      description = "Filter containers by app version (used with " +
+                    ARG_CONTAINERS + ")")
+  public String version;
+
+  @Parameter(names = {ARG_COMPONENTS}, variableArity = true,
+      description = "Filter containers by component names (used with " +
+                    ARG_CONTAINERS + ")")
+  public Set<String> components = new HashSet<>(0);
+
+  /**
+   * Get the min #of params expected
+   * @return the min number of params in the {@link #parameters} field
+   */
+  public int getMinParams() {
+    return 0;
+  }
+
+  @Override
+  public int getMaxParams() {
+    return 1;
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java
new file mode 100644
index 0000000..c2866cf
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.conf.YarnServiceConstants;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.api.records.ConfigFormat;
+
+import static 
org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_REGISTRY;
+import static 
org.apache.hadoop.yarn.service.client.params.SliderActions.DESCRIBE_ACTION_REGISTRY;
+import java.io.File;
+
+/**
+ * Registry actions
+ * 
+ * --instance {app name}, if  a / is in it, refers underneath?
+ * --dest {destfile}
+ * --list : list instances of slider service
+ * --listfiles 
+ */
+@Parameters(commandNames = {ACTION_REGISTRY},
+            commandDescription = DESCRIBE_ACTION_REGISTRY)
+
+public class ActionRegistryArgs extends AbstractActionArgs {
+
+  public static final String USAGE =
+      "Usage: " + SliderActions.ACTION_REGISTRY
+      + " ("
+      + Arguments.ARG_LIST + "|"
+      + Arguments.ARG_LISTCONF + "|"
+      + Arguments.ARG_LISTEXP + "|"
+      + Arguments.ARG_LISTFILES + "|"
+      + Arguments.ARG_GETCONF + "|"
+      + Arguments.ARG_GETEXP + "> "
+      + Arguments.ARG_NAME + " <name> "
+      + " )"
+      + "[" + Arguments.ARG_VERBOSE + "] "
+      + "[" + Arguments.ARG_USER + "] "
+      + "[" + Arguments.ARG_OUTPUT + " <filename> ] "
+      + "[" + Arguments.ARG_SERVICETYPE + " <servicetype> ] "
+      + "[" + Arguments.ARG_FORMAT + " <xml|json|properties>] "
+      + System.getProperty("line.separator")
+      + "Arguments.ARG_GETEXP only supports " + Arguments.ARG_FORMAT + " json"
+      ;
+  public ActionRegistryArgs() {
+  }
+
+  public ActionRegistryArgs(String name) {
+    this.name = name;
+  }
+
+  @Override
+  public String getActionName() {
+    return ACTION_REGISTRY;
+  }
+
+  /**
+   * Get the min #of params expected
+   * @return the min number of params in the {@link #parameters} field
+   */
+  @Override
+  public int getMinParams() {
+    return 0;
+  }
+  
+  @Parameter(names = {ARG_LIST}, 
+      description = "list services")
+  public boolean list;
+
+  @Parameter(names = {ARG_LISTCONF}, 
+      description = "list configurations")
+  public boolean listConf;
+
+  @Parameter(names = {ARG_GETCONF},
+      description = "get configuration")
+  public String getConf;
+
+  @Parameter(names = {ARG_LISTEXP},
+             description = "list exports")
+  public boolean listExports;
+
+  @Parameter(names = {ARG_GETEXP},
+             description = "get export")
+  public String getExport;
+
+  @Parameter(names = {ARG_LISTFILES},
+      description = "list files")
+  public String listFiles;
+
+  @Parameter(names = {ARG_GETFILES},
+      description = "get files")
+  public String getFiles;
+
+  //--format 
+  @Parameter(names = ARG_FORMAT,
+      description = "Format for a response: <xml|json|properties>")
+  public String format = ConfigFormat.XML.toString() ;
+
+  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT, ARG_DEST},
+      description = "Output destination")
+  public File out;
+
+  @Parameter(names = {ARG_NAME},
+      description = "name of an instance")
+  public String name;
+
+  @Parameter(names = {ARG_SERVICETYPE},
+      description = "optional service type")
+  public String serviceType = YarnServiceConstants.APP_TYPE;
+
+  @Parameter(names = {ARG_VERBOSE},
+      description = "verbose output")
+  public boolean verbose;
+
+  @Parameter(names = {ARG_INTERNAL},
+      description = "fetch internal registry entries")
+  public boolean internal;
+
+  @Parameter(names = {ARG_USER},
+      description = "the name of the user whose application is being resolved")
+  public String user;
+
+  /**
+   * validate health of all the different operations
+   * @throws BadCommandArgumentsException
+   */
+  @Override
+  public void validate() throws BadCommandArgumentsException, UsageException {
+    super.validate();
+
+    //verify that at most one of the operations is set
+    int gets = s(getConf) + s(getFiles) + s(getExport);
+    int lists = s(list) + s(listConf) + s(listFiles) + s(listExports);
+    int set = lists + gets;
+    if (set > 1) {
+      throw new UsageException(USAGE);
+    }
+
+    if (out != null && ( set == 0)) {
+      throw new UsageException("output path"
+           + " is only supported on 'get' operations: ");
+    }
+    if (!list && !is(name)) {
+      throw new UsageException("Argument " + ARG_NAME
+           +" missing: ");
+
+    }
+  }
+  
+  private int s(String arg) {
+    return is(arg) ? 1 : 0;
+  }
+
+  private boolean is(String arg) {
+    return arg != null;
+  }
+
+  private int s(boolean arg) {
+    return arg ? 1 : 0;
+  }
+
+  private String ifdef(String arg, boolean val) {
+    return val ? (arg + " "): "";
+  }
+
+  private String ifdef(String arg, String val) {
+    if (is(val)) {
+      return arg + " " + val + " ";
+    } else {
+      return "";
+    }
+  }
+
+  @Override
+  public String toString() {
+    final StringBuilder sb =
+        new StringBuilder(ACTION_REGISTRY);
+    sb.append(' ');
+    sb.append(ifdef(ARG_LIST, list));
+    sb.append(ifdef(ARG_LISTCONF, listConf));
+    sb.append(ifdef(ARG_LISTFILES, listFiles));
+    sb.append(ifdef(ARG_GETCONF, getConf));
+    sb.append(ifdef(ARG_GETFILES, getFiles));
+
+    sb.append(ifdef(ARG_NAME, name));
+    sb.append(ifdef(ARG_SERVICETYPE, serviceType));
+
+
+    sb.append(ifdef(ARG_VERBOSE, verbose));
+    sb.append(ifdef(ARG_INTERNAL, internal));
+
+    if (out != null) {
+      sb.append(ifdef(ARG_OUTPUT, out.toString()));
+    }
+    sb.append(ifdef(ARG_FORMAT, format));
+
+    return sb.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java
new file mode 100644
index 0000000..65f0472
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.commons.lang.StringUtils;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
+
+import java.io.File;
+
+import static 
org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_RESOLVE;
+import static 
org.apache.hadoop.yarn.service.client.params.SliderActions.DESCRIBE_ACTION_REGISTRY;
+
+/**
+ * Resolve registry entries
+ * 
+ * --path {path}
+ * --out {destfile}
+ * --verbose
+ * --list
+ */
+@Parameters(commandNames = {ACTION_RESOLVE},
+            commandDescription = DESCRIBE_ACTION_REGISTRY)
+public class ActionResolveArgs extends AbstractActionArgs {
+
+  public static final String USAGE =
+      "Usage: " + SliderActions.ACTION_RESOLVE
+      + " "
+      + ARG_PATH + " <path> "
+      + "[" + ARG_LIST + "] "
+      + "[" + ARG_OUTPUT + " <filename> ] "
+      + "[" + ARG_DESTDIR + " <directory> ] "
+      ;
+  public ActionResolveArgs() {
+  }
+
+  @Override
+  public String getActionName() {
+    return ACTION_RESOLVE;
+  }
+
+  /**
+   * Get the min #of params expected
+   * @return the min number of params in the {@link #parameters} field
+   */
+  @Override
+  public int getMinParams() {
+    return 0;
+  }
+  
+  @Parameter(names = {ARG_LIST}, 
+      description = "list services")
+  public boolean list;
+
+  @Parameter(names = {ARG_PATH},
+      description = "resolve a path")
+  public String path;
+
+  @Parameter(names = {ARG_DESTDIR},
+      description = "destination directory for operations")
+  public File destdir;
+
+  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
+      description = "dest file")
+  public File out;
+
+  @Override
+  public String toString() {
+    final StringBuilder sb =
+        new StringBuilder(ACTION_RESOLVE).append(" ");
+    sb.append(ARG_PATH).append(" ").append(path).append(" ");
+    if (list) {
+      sb.append(ARG_LIST).append(" ");
+    }
+    if (destdir != null) {
+      sb.append(ARG_DESTDIR).append(" ").append(destdir).append(" ");
+    }
+    if (out != null) {
+      sb.append(ARG_OUTPUT).append(" ").append(out).append(" ");
+    }
+    return sb.toString();
+  }
+
+  @Override
+  public void validate() throws BadCommandArgumentsException, UsageException {
+    super.validate();
+    if (StringUtils.isEmpty(path)) {
+      throw new BadCommandArgumentsException("Missing mandatory argument "
+                                             + ARG_PATH);
+    }
+    if (list && out != null) {
+      throw new BadCommandArgumentsException("Argument "
+                                             + ARG_OUTPUT +
+                                             " not supported for " + ARG_LIST);
+    }
+    if (out != null && destdir != null) {
+      throw new BadCommandArgumentsException(
+          ARG_OUTPUT + " and " + ARG_DESTDIR + " cannot be used together"
+      );
+    }
+  }
+
+  public String getPath() {
+    return path;
+  }
+
+  public void setPath(String path) {
+    this.path = path;
+  }
+
+  public boolean isList() {
+    return list;
+  }
+
+  public void setList(boolean list) {
+    this.list = list;
+  }
+
+  public File getDestdir() {
+    return destdir;
+  }
+
+  public void setDestdir(File destdir) {
+    this.destdir = destdir;
+  }
+
+  public File getOut() {
+    return out;
+  }
+
+  public void setOut(File out) {
+    this.out = out;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java
new file mode 100644
index 0000000..b03dc92
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
+import org.apache.hadoop.yarn.service.client.params.SliderActions;
+
+@Parameters(commandNames = { SliderActions.ACTION_RESOURCE},
+    commandDescription = SliderActions.DESCRIBE_ACTION_RESOURCE)
+
+public class ActionResourceArgs  extends AbstractActionArgs {
+
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_RESOURCE;
+  }
+
+  @Parameter(names = {ARG_INSTALL},
+      description = "Install the resource(s)")
+  public boolean install;
+
+  @Parameter(names = {ARG_DELETE},
+      description = "Delete the file")
+  public boolean delete;
+
+  @Parameter(names = {ARG_LIST},
+      description = "List of installed files")
+  public boolean list;
+
+  @Parameter(names = {ARG_RESOURCE},
+      description = "Name of the file or directory")
+  public String resource;
+
+  @Parameter(names = {ARG_DESTDIR},
+      description = "The name of the folder in which to store the resources")
+  public String folder;
+
+  @Parameter(names = {ARG_OVERWRITE}, description = "Overwrite existing 
resource(s)")
+  public boolean overwrite = false;
+
+  /**
+   * Get the min #of params expected
+   * @return the min number of params in the {@link #parameters} field
+   */
+  public int getMinParams() {
+    return 0;
+  }
+
+  @Override
+  public int getMaxParams() {
+    return 3;
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java
new file mode 100644
index 0000000..622e77d
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
+import org.apache.hadoop.yarn.service.client.params.SliderActions;
+
+@Parameters(commandNames = { SliderActions.ACTION_STATUS},
+            commandDescription = SliderActions.DESCRIBE_ACTION_STATUS)
+
+public class ActionStatusArgs extends AbstractActionArgs {
+
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_STATUS;
+  }
+
+  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
+             description = "Output file for the status information")
+  public String output;
+
+  @Parameter(names = {ARG_LIFETIME},
+      description = "Lifetime of the application from the time of request")
+  public boolean lifetime;
+
+  public String getOutput() {
+    return output;
+  }
+
+  public void setOutput(String output) {
+    this.output = output;
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java
new file mode 100644
index 0000000..2b90479
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import com.beust.jcommander.ParametersDelegate;
+
+import java.io.File;
+
+@Parameters(commandNames = { SliderActions.ACTION_START },
+            commandDescription = SliderActions.DESCRIBE_ACTION_THAW)
+public class ActionThawArgs extends AbstractActionArgs implements
+                                                       WaitTimeAccessor,
+                                                       LaunchArgsAccessor {
+
+
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_START;
+  }
+
+  @Override
+  public int getWaittime() {
+    return launchArgs.getWaittime();
+  }
+
+  @ParametersDelegate
+  LaunchArgsDelegate launchArgs = new LaunchArgsDelegate();
+
+  @Parameter(names = {ARG_LIFETIME},
+      description = "Life time of the application since application started at"
+          + " running state")
+  public long lifetime;
+
+  @Override
+  public String getRmAddress() {
+    return launchArgs.getRmAddress();
+  }
+
+  @Override
+  public void setWaittime(int waittime) {
+    launchArgs.setWaittime(waittime);
+  }
+
+
+  @Override
+  public File getOutputFile() {
+    return launchArgs.getOutputFile();
+  }
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/727e6d78/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java
new file mode 100644
index 0000000..cf48513
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.service.client.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
+
+import java.io.File;
+
+@Parameters(commandNames = { SliderActions.ACTION_TOKENS},
+            commandDescription = "save tokens to a file or list tokens in a 
file")
+public class ActionTokensArgs extends AbstractActionArgs {
+
+  public static final String DUPLICATE_ARGS = "Only one of " +
+      ARG_SOURCE + " and " + ARG_OUTPUT + " allowed";
+
+  public static final String MISSING_KT_PROVIDER =
+      "Both " + ARG_KEYTAB + " and " + ARG_PRINCIPAL
+      + " must be provided";
+
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_TOKENS;
+  }
+
+  @Parameter(names = {ARG_OUTPUT},
+             description = "File to write")
+  public File output;
+
+  @Parameter(names = {ARG_SOURCE},
+             description = "source file")
+  public File source;
+
+  @Parameter(names = {ARG_KEYTAB}, description = "keytab to use")
+  public File keytab;
+
+  @Parameter(names = {ARG_PRINCIPAL}, description = "principal to log in from 
a keytab")
+  public String principal="";
+
+  /**
+   * Get the min #of params expected
+   * @return the min number of params in the {@link #parameters} field
+   */
+  public int getMinParams() {
+    return 0;
+  }
+
+  @Override
+  public void validate() throws BadCommandArgumentsException, UsageException {
+    super.validate();
+    if (output != null && source != null) {
+      throw new BadCommandArgumentsException(DUPLICATE_ARGS);
+    }
+
+    // this is actually a !xor
+    if (keytab != null ^ !principal.isEmpty()) {
+      throw new BadCommandArgumentsException(MISSING_KT_PROVIDER);
+    }
+  }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to