You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2015/02/14 19:29:19 UTC

[01/20] incubator-slider git commit: SLIDER-782 moving all of AM IPC operations out of AM, moving to async queued events for all mutating operations

Repository: incubator-slider
Updated Branches:
  refs/heads/develop 0b0022185 -> 67938ee99


SLIDER-782 moving all of AM IPC operations out of AM, moving to async queued events for all mutating operations


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/7632f5de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/7632f5de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/7632f5de

Branch: refs/heads/develop
Commit: 7632f5de400ef7174bec7692db3a7201b12b83c5
Parents: c4a21ad
Author: Steve Loughran <st...@apache.org>
Authored: Tue Feb 10 21:35:18 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Feb 10 21:35:18 2015 +0000

----------------------------------------------------------------------
 .../apache/slider/common/SliderXmlConfKeys.java |  11 +
 .../exceptions/ServiceNotReadyException.java    |  43 +++
 .../providers/AbstractProviderService.java      |  12 +-
 .../appmaster/AppMasterActionOperations.java    |  32 ++
 .../server/appmaster/SliderAppMaster.java       |  60 +++-
 .../appmaster/actions/ActionFlexCluster.java    |  44 +++
 .../appmaster/actions/ActionKillContainer.java  |   5 +-
 .../actions/ReviewAndFlexApplicationSize.java   |   2 +-
 .../operations/AbstractRMOperation.java         |   3 +-
 .../operations/CancelRequestOperation.java      |   2 +-
 .../operations/ContainerReleaseOperation.java   |   2 +-
 .../operations/ContainerRequestOperation.java   |   2 +-
 .../operations/RMOperationHandler.java          |   7 +-
 .../operations/RMOperationHandlerActions.java   |   8 +
 .../slider/server/appmaster/rpc/RpcBinder.java  |  39 ++-
 .../rpc/SliderClusterProtocolService.java       | 299 +++++++++++++++++++
 .../slider/server/appmaster/state/AppState.java |   4 +-
 .../appmaster/state/ProviderAppState.java       |  18 +-
 .../state/StateAccessForProviders.java          |   9 +-
 .../slider/server/appmaster/web/WebAppApi.java  |   5 +-
 .../server/appmaster/web/WebAppApiImpl.java     |  11 +-
 .../appstate/StubSliderClusterProtocol.groovy   |   3 +
 .../TestMockAppStateAppRestIntegration.groovy   |   2 +-
 .../model/mock/MockProviderService.groovy       |   6 +
 .../view/TestClusterSpecificationBlock.groovy   |   2 +-
 .../web/view/TestContainerStatsBlock.groovy     |   2 +-
 .../appmaster/web/view/TestIndexBlock.groovy    |   2 +-
 .../agent/TestAgentProviderService.java         |   3 +-
 .../web/rest/agent/TestAMAgentWebServices.java  |   2 +-
 .../management/TestAMManagementWebServices.java |   2 +-
 30 files changed, 591 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java b/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
index a89ae20..a808058 100644
--- a/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
+++ b/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
@@ -161,4 +161,15 @@ public interface SliderXmlConfKeys {
    */
   boolean X_DEV_INSECURE_REQUIRED = true;
 
+  /**
+   *
+   */
+  String KEY_IPC_CLIENT_RETRY_POLICY_ENABLED =
+      "slider.ipc.client.retry.enabled";
+  public static final boolean IPC_CLIENT_RETRY_POLICY_ENABLED_DEFAULT = true;
+  public static final String KEY_IPC_CLIENT_RETRY_POLICY_SPEC =
+      "slider.ipc.client.retry.policy.spec";
+  public static final String IPC_CLIENT_RETRY_POLICY_SPEC_DEFAULT =
+      "10000,6,60000,10"; //t1,n1,t2,n2,... 
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
new file mode 100644
index 0000000..435bc1a
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
@@ -0,0 +1,43 @@
+/*
+ * 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.slider.core.exceptions;
+
+import java.io.IOException;
+
+/**
+ * This is an exception raised when the service does not consider itself
+ * live (yet)
+ */
+public class ServiceNotReadyException extends IOException {
+
+  public static final String E_NOT_READY =
+      "Service not ready for access: please retry";
+
+  public ServiceNotReadyException(String message) {
+    super(message);
+  }
+
+  public ServiceNotReadyException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+  public ServiceNotReadyException(Throwable cause) {
+    super(cause);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
index 6856400..fd7df73 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
@@ -39,6 +39,7 @@ import org.apache.slider.core.exceptions.BadCommandArgumentsException;
 import org.apache.slider.core.exceptions.SliderException;
 import org.apache.slider.core.main.ExitCodeProvider;
 import org.apache.slider.server.appmaster.actions.QueueAccess;
+import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
 import org.apache.slider.server.appmaster.state.ContainerReleaseSelector;
 import org.apache.slider.server.appmaster.state.MostRecentContainerReleaseSelector;
 import org.apache.slider.server.appmaster.state.StateAccessForProviders;
@@ -180,9 +181,8 @@ public abstract class AbstractProviderService
   @Override
   public void validateApplicationConfiguration(AggregateConf instance,
                                                File confDir,
-                                               boolean secure) throws
-      IOException,
-      SliderException {
+                                               boolean secure)
+      throws IOException, SliderException {
 
   }
 
@@ -411,6 +411,12 @@ public abstract class AbstractProviderService
     return 0;
   }
 
+  @Override
+  public void execute(List<AbstractRMOperation> operations) {
+    for (AbstractRMOperation operation : operations) {
+      operation.execute(this);
+    }
+  }
   /**
    * No-op implementation of this method.
    */

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/AppMasterActionOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/AppMasterActionOperations.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/AppMasterActionOperations.java
new file mode 100644
index 0000000..d78b718
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/AppMasterActionOperations.java
@@ -0,0 +1,32 @@
+/*
+ * 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.slider.server.appmaster;
+
+import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
+import org.apache.slider.server.appmaster.operations.RMOperationHandlerActions;
+
+import java.util.List;
+
+/**
+ * Interface of AM operations
+ */
+public interface AppMasterActionOperations extends RMOperationHandlerActions {
+
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index f1e3a84..ab67b16 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -54,7 +54,9 @@ import org.apache.hadoop.yarn.api.records.ContainerState;
 import org.apache.hadoop.yarn.api.records.ContainerStatus;
 import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.NodeReport;
+import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.client.api.AMRMClient;
 import org.apache.hadoop.yarn.client.api.async.AMRMClientAsync;
 import org.apache.hadoop.yarn.client.api.async.NMClientAsync;
 import org.apache.hadoop.yarn.client.api.async.impl.NMClientAsyncImpl;
@@ -83,7 +85,6 @@ import org.apache.slider.api.proto.Messages;
 import org.apache.slider.api.proto.SliderClusterAPI;
 import org.apache.slider.common.SliderExitCodes;
 import org.apache.slider.common.SliderKeys;
-import static org.apache.slider.common.SliderXmlConfKeys.*;
 import org.apache.slider.common.params.AbstractActionArgs;
 import org.apache.slider.common.params.SliderAMArgs;
 import org.apache.slider.common.params.SliderAMCreateAction;
@@ -138,6 +139,7 @@ import org.apache.slider.server.appmaster.rpc.RpcBinder;
 import org.apache.slider.server.appmaster.rpc.SliderAMPolicyProvider;
 import org.apache.slider.server.appmaster.rpc.SliderClusterProtocolPBImpl;
 import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
+import org.apache.slider.server.appmaster.rpc.SliderClusterProtocolService;
 import org.apache.slider.server.appmaster.security.SecurityConfiguration;
 import org.apache.slider.server.appmaster.state.AppState;
 import org.apache.slider.server.appmaster.state.ContainerAssignment;
@@ -195,7 +197,8 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
     SliderClusterProtocol,
     ServiceStateChangeListener,
     RoleKeys,
-    ProviderCompleted {
+    ProviderCompleted,
+    AppMasterActionOperations {
 
   protected static final Logger log =
     LoggerFactory.getLogger(SliderAppMaster.class);
@@ -246,6 +249,13 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
    */
   private Credentials containerCredentials;
 
+  /**
+   * Slider IPC: Real service handler
+   */
+  private SliderClusterProtocolService sliderIPCService;
+  /**
+   * Slider IPC: binding
+   */
   private WorkflowRpcService rpcService;
 
   /**
@@ -744,9 +754,11 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
       appInformation.put(StatusKeys.INFO_AM_WEB_URL, appMasterTrackingUrl + "/");
       appInformation.set(StatusKeys.INFO_AM_WEB_PORT, webAppPort);
 
+      // *****************************************************
       // Register self with ResourceManager
       // This will start heartbeating to the RM
       // address = SliderUtils.getRmSchedulerAddress(asyncRMClient.getConfig());
+      // *****************************************************
       log.info("Connecting to RM at {},address tracking URL={}",
                appMasterRpcPort, appMasterTrackingUrl);
       amRegistrationData = asyncRMClient
@@ -805,8 +817,8 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
       providerService
           .initializeApplicationConfiguration(instanceDefinition, fs);
 
-      providerService.validateApplicationConfiguration(instanceDefinition, 
-                                                       confDir,
+      providerService.validateApplicationConfiguration(instanceDefinition,
+          confDir,
           securityEnabled);
 
       //determine the location for the role history data
@@ -903,13 +915,17 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
               certificateManager,
               registryOperations,
               metricsAndMonitoring,
-              actionQueues);
+              actionQueues,
+              this);
       initAMFilterOptions(serviceConf);
 
       // start the agent web app
       startAgentWebApp(appInformation, serviceConf, webAppApi);
       deployWebApplication(webAppPort, webAppApi);
 
+      // bind the IPC service to the API
+      sliderIPCService.bind(webAppApi);
+      
       // schedule YARN Registry registration
       queue(new ActionRegisterServiceInstance(clustername, appid));
 
@@ -1473,9 +1489,11 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
       throws IOException, SliderException {
     verifyIPCAccess();
 
+    sliderIPCService = new SliderClusterProtocolService();
 
+    deployChildService(sliderIPCService);
     SliderClusterProtocolPBImpl protobufRelay =
-        new SliderClusterProtocolPBImpl(this);
+        new SliderClusterProtocolPBImpl(sliderIPCService);
     BlockingService blockingService = SliderClusterAPI.SliderClusterProtocolPB
         .newReflectiveBlockingService(
             protobufRelay);
@@ -1545,7 +1563,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
     }
     
     //for all the operations, exec them
-    executeRMOperations(operations);
+    execute(operations);
     log.info("Diagnostics: {}", getContainerDiagnosticInfo());
   }
 
@@ -1590,7 +1608,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
    * @throws SliderException slider problems, including invalid configs
    * @throws IOException IO problems
    */
-  private void flexCluster(ConfTree resources)
+  public void flexCluster(ConfTree resources)
       throws IOException, SliderException {
 
     AggregateConf newConf =
@@ -1685,7 +1703,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
       // tell the provider
       providerRMOperationHandler.execute(allOperations);
       //now apply the operations
-      executeRMOperations(allOperations);
+      execute(allOperations);
     } catch (TriggerClusterTeardownException e) {
       //App state has decided that it is time to exit
       log.error("Cluster teardown triggered {}", e, e);
@@ -1698,7 +1716,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
    */
   private void releaseAllContainers() {
     //now apply the operations
-    executeRMOperations(appState.releaseAllContainers());
+    execute(appState.releaseAllContainers());
   }
 
   /**
@@ -1939,11 +1957,29 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
     return builder.build();
   }
 
-  public void executeRMOperations(List<AbstractRMOperation> operations) {
+  @Override
+  public void execute(List<AbstractRMOperation> operations) {
     rmOperationHandler.execute(operations);
   }
 
   @Override
+  public void releaseAssignedContainer(ContainerId containerId) {
+    rmOperationHandler.releaseAssignedContainer(containerId);
+  }
+
+  @Override
+  public void addContainerRequest(AMRMClient.ContainerRequest req) {
+    rmOperationHandler.addContainerRequest(req);
+  }
+
+  @Override
+  public int cancelContainerRequests(Priority priority1,
+      Priority priority2,
+      int count) {
+    return rmOperationHandler.cancelContainerRequests(priority1, priority2, count);
+  }
+
+  @Override
   public Messages.AMSuicideResponseProto amSuicide(
       Messages.AMSuicideRequestProto request)
       throws IOException, YarnException {
@@ -2030,7 +2066,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
         containerId);
     RoleInstance activeContainer = appState.getOwnedContainer(containerId);
     if (activeContainer != null) {
-      executeRMOperations(appState.releaseContainer(containerId));
+      execute(appState.releaseContainer(containerId));
       // ask for more containers if needed
       log.info("Container released; triggering review");
       reviewRequestAndReleaseNodes("Loss of container");

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionFlexCluster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionFlexCluster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionFlexCluster.java
new file mode 100644
index 0000000..6b61681
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionFlexCluster.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.slider.server.appmaster.actions;
+
+import org.apache.slider.core.conf.ConfTree;
+import org.apache.slider.server.appmaster.SliderAppMaster;
+import org.apache.slider.server.appmaster.state.AppState;
+
+import java.util.concurrent.TimeUnit;
+
+public class ActionFlexCluster extends AsyncAction {
+
+  public final ConfTree resources;
+  
+  public ActionFlexCluster(String name,
+      long delay,
+      TimeUnit timeUnit, ConfTree resources) {
+    super(name, delay, timeUnit, ATTR_CHANGES_APP_SIZE);
+    this.resources = resources;
+  }
+
+  @Override
+  public void execute(SliderAppMaster appMaster,
+      QueueAccess queueService,
+      AppState appState) throws Exception {
+    appMaster.flexCluster(resources);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionKillContainer.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionKillContainer.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionKillContainer.java
index 95bf067..1aa9088 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionKillContainer.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionKillContainer.java
@@ -24,6 +24,7 @@ import org.apache.slider.server.appmaster.SliderAppMaster;
 import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
 import org.apache.slider.server.appmaster.operations.ContainerReleaseOperation;
 import org.apache.slider.server.appmaster.operations.RMOperationHandler;
+import org.apache.slider.server.appmaster.operations.RMOperationHandlerActions;
 import org.apache.slider.server.appmaster.state.AppState;
 
 import java.util.LinkedList;
@@ -43,7 +44,7 @@ public class ActionKillContainer extends AsyncAction {
   /**
    *  handler for the operation
    */
-  private final RMOperationHandler operationHandler;
+  private final RMOperationHandlerActions operationHandler;
 
   /**
    * Kill a container
@@ -56,7 +57,7 @@ public class ActionKillContainer extends AsyncAction {
       ContainerId containerId,
       long delay,
       TimeUnit timeUnit,
-      RMOperationHandler operationHandler) {
+      RMOperationHandlerActions operationHandler) {
     super("kill container", delay, timeUnit, ATTR_CHANGES_APP_SIZE);
     this.operationHandler = operationHandler;
     Preconditions.checkArgument(containerId != null);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ReviewAndFlexApplicationSize.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ReviewAndFlexApplicationSize.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ReviewAndFlexApplicationSize.java
index 273f599..bf7edf9 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ReviewAndFlexApplicationSize.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ReviewAndFlexApplicationSize.java
@@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
 /**
  * Tell the AM to execute the full flex review operation
  */
-public class ReviewAndFlexApplicationSize extends AsyncAction{
+public class ReviewAndFlexApplicationSize extends AsyncAction {
 
   public ReviewAndFlexApplicationSize(String name,
       long delay,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AbstractRMOperation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AbstractRMOperation.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AbstractRMOperation.java
index 2c55215..da8d646 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AbstractRMOperation.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AbstractRMOperation.java
@@ -23,7 +23,8 @@ public abstract class AbstractRMOperation {
   /**
    * Execute the operation
    * @param asyncRMClient client
+   * @param handler
    */
-  public abstract void execute(RMOperationHandler handler);
+  public abstract void execute(RMOperationHandlerActions handler);
   
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/CancelRequestOperation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/CancelRequestOperation.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/CancelRequestOperation.java
index be5dbab..9e9f277 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/CancelRequestOperation.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/CancelRequestOperation.java
@@ -37,7 +37,7 @@ public class CancelRequestOperation extends AbstractRMOperation {
   }
 
   @Override
-  public void execute(RMOperationHandler handler) {
+  public void execute(RMOperationHandlerActions handler) {
     handler.cancelContainerRequests(priority1, priority2, count);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerReleaseOperation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerReleaseOperation.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerReleaseOperation.java
index 3d2016b..46da536 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerReleaseOperation.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerReleaseOperation.java
@@ -33,7 +33,7 @@ public class ContainerReleaseOperation extends AbstractRMOperation {
   }
 
   @Override
-  public void execute(RMOperationHandler handler) {
+  public void execute(RMOperationHandlerActions handler) {
     handler.releaseAssignedContainer(containerId);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerRequestOperation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerRequestOperation.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerRequestOperation.java
index 203f898..b8120ca 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerRequestOperation.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerRequestOperation.java
@@ -34,7 +34,7 @@ public class ContainerRequestOperation extends AbstractRMOperation {
   }
 
   @Override
-  public void execute(RMOperationHandler handler) {
+  public void execute(RMOperationHandlerActions handler) {
     handler.addContainerRequest(request);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandler.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandler.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandler.java
index 3ab9d89..d0d038a 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandler.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandler.java
@@ -18,16 +18,11 @@
 
 package org.apache.slider.server.appmaster.operations;
 
-import org.apache.hadoop.yarn.api.records.Priority;
-
 import java.util.List;
 
 public abstract class RMOperationHandler implements RMOperationHandlerActions {
 
-  /**
-   * Execute an entire list of operations
-   * @param operations ops
-   */
+  @Override
   public void execute(List<AbstractRMOperation> operations) {
     for (AbstractRMOperation operation : operations) {
       operation.execute(this);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandlerActions.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandlerActions.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandlerActions.java
index e6d6c9d..97fde09 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandlerActions.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandlerActions.java
@@ -22,6 +22,8 @@ import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.client.api.AMRMClient;
 
+import java.util.List;
+
 public interface RMOperationHandlerActions {
   void releaseAssignedContainer(ContainerId containerId);
 
@@ -34,4 +36,10 @@ public interface RMOperationHandlerActions {
    * @param count number to remove
    */
   int cancelContainerRequests(Priority priority1, Priority priority2, int count);
+
+  /**
+   * Execute an entire list of operations
+   * @param operations ops
+   */
+  void execute(List<AbstractRMOperation> operations);
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
index 4cb6ee1..080d0f2 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
@@ -20,6 +20,8 @@ package org.apache.slider.server.appmaster.rpc;
 
 import com.google.protobuf.BlockingService;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.retry.RetryPolicy;
+import org.apache.hadoop.io.retry.RetryUtils;
 import org.apache.hadoop.ipc.ProtobufRpcEngine;
 import org.apache.hadoop.ipc.ProtocolProxy;
 import org.apache.hadoop.ipc.RPC;
@@ -43,7 +45,11 @@ import org.apache.slider.common.SliderExitCodes;
 import org.apache.slider.common.tools.Duration;
 import org.apache.slider.core.exceptions.BadClusterStateException;
 import org.apache.slider.core.exceptions.ErrorStrings;
+import org.apache.slider.core.exceptions.ServiceNotReadyException;
 import org.apache.slider.core.exceptions.SliderException;
+
+import static org.apache.slider.common.SliderXmlConfKeys.*; 
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -112,6 +118,15 @@ public class RpcBinder {
   }
 
 
+  /**
+   * Connect to a server. May include setting up retry policies
+   * @param addr
+   * @param currentUser
+   * @param conf
+   * @param rpcTimeout
+   * @return
+   * @throws IOException
+   */
   public static SliderClusterProtocol connectToServer(InetSocketAddress addr,
                                                     UserGroupInformation currentUser,
                                                     Configuration conf,
@@ -119,16 +134,24 @@ public class RpcBinder {
     Class<SliderClusterProtocolPB> sliderClusterAPIClass = registerSliderAPI(
         conf);
 
+    final RetryPolicy retryPolicy =
+        RetryUtils.getDefaultRetryPolicy(
+            conf,
+            KEY_IPC_CLIENT_RETRY_POLICY_ENABLED,
+            IPC_CLIENT_RETRY_POLICY_ENABLED_DEFAULT,
+            KEY_IPC_CLIENT_RETRY_POLICY_SPEC,
+            IPC_CLIENT_RETRY_POLICY_SPEC_DEFAULT,
+            ServiceNotReadyException.class);
     log.debug("Connecting to Slider AM at {}", addr);
     ProtocolProxy<SliderClusterProtocolPB> protoProxy =
-      RPC.getProtocolProxy(sliderClusterAPIClass,
-                           1,
-                           addr,
-                           currentUser,
-                           conf,
-                           NetUtils.getDefaultSocketFactory(conf),
-                           rpcTimeout,
-                           null);
+        RPC.getProtocolProxy(sliderClusterAPIClass,
+            1,
+            addr,
+            currentUser,
+            conf,
+            NetUtils.getDefaultSocketFactory(conf),
+            rpcTimeout,
+            retryPolicy);
     SliderClusterProtocolPB endpoint = protoProxy.getProxy();
     return new SliderClusterProtocolProxy(endpoint, addr);
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
new file mode 100644
index 0000000..613bda4
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
@@ -0,0 +1,299 @@
+/*
+ * 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.slider.server.appmaster.rpc;
+
+import org.apache.hadoop.ipc.ProtocolSignature;
+import org.apache.hadoop.service.AbstractService;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.slider.api.ClusterDescription;
+import org.apache.slider.api.SliderClusterProtocol;
+import org.apache.slider.api.proto.Messages;
+import org.apache.slider.core.conf.AggregateConf;
+import org.apache.slider.core.conf.ConfTree;
+import org.apache.slider.core.exceptions.ServiceNotReadyException;
+import org.apache.slider.core.main.LauncherExitCodes;
+import org.apache.slider.core.persist.ConfTreeSerDeser;
+import org.apache.slider.server.appmaster.actions.ActionFlexCluster;
+import org.apache.slider.server.appmaster.actions.ActionHalt;
+import org.apache.slider.server.appmaster.actions.ActionKillContainer;
+import org.apache.slider.server.appmaster.actions.ActionStopSlider;
+import org.apache.slider.server.appmaster.actions.AsyncAction;
+import org.apache.slider.server.appmaster.actions.QueueAccess;
+import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
+import org.apache.slider.server.appmaster.state.RoleInstance;
+import org.apache.slider.server.appmaster.state.StateAccessForProviders;
+import org.apache.slider.server.appmaster.web.WebAppApi;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Implement the {@link SliderClusterProtocol}.
+ * Important: not live until {@link #bind(WebAppApi)}
+ * is invoked. Until then all RPC calls will raise an exception.
+ */
+public class SliderClusterProtocolService extends AbstractService
+    implements SliderClusterProtocol {
+
+  protected static final Logger log =
+      LoggerFactory.getLogger(SliderClusterProtocol.class);
+
+  private WebAppApi appmaster;
+  private QueueAccess actionQueues;
+  private StateAccessForProviders appState;
+  private MetricsAndMonitoring metricsAndMonitoring;
+  public static final String PROTOCOL_PREFIX =
+      "org.apache.slider.api.SliderClusterProtocol.";
+
+  public SliderClusterProtocolService() {
+    super("SliderClusterProtocolService");
+  }
+
+  /**
+   * Bind to the AM API
+   * @param appmaster api binding.
+   */
+  public void bind(WebAppApi appmaster) {
+    this.appmaster = appmaster;
+    actionQueues = appmaster.getQueues();
+    appState = appmaster.getAppState();
+    metricsAndMonitoring = appmaster.getMetricsAndMonitoring();
+  }
+  
+
+  @Override   //SliderClusterProtocol
+  public ProtocolSignature getProtocolSignature(String protocol,
+      long clientVersion,
+      int clientMethodsHash) throws IOException {
+    return ProtocolSignature.getProtocolSignature(
+        this, protocol, clientVersion, clientMethodsHash);
+  }
+
+
+  @Override   //SliderClusterProtocol
+  public long getProtocolVersion(String protocol, long clientVersion)
+      throws IOException {
+    return SliderClusterProtocol.versionID;
+  }
+
+  /**
+   * General actions to perform on a slider RPC call coming in
+   * @param operation operation to log
+   * @throws IOException problems
+   * @throws ServiceNotReadyException if the RPC service is constructed
+   * but not fully initialized
+   */
+  protected void onRpcCall(String operation) throws IOException {
+    log.debug("Received call to {}", operation);
+    if (appmaster == null) {
+      // fail fast if the service is not ready
+      log.warn("Rejecting {} as service is not ready", operation);
+      throw new ServiceNotReadyException(ServiceNotReadyException.E_NOT_READY);
+    }
+    metricsAndMonitoring.markMeterAndCounter(PROTOCOL_PREFIX + operation);
+  }
+
+  /**
+   * Schedule an action
+   * @param action for delayed execution
+   */
+  public void schedule(AsyncAction action) {
+    actionQueues.schedule(action);
+  }
+
+  /**
+   * Queue an action for immediate execution in the executor thread
+   * @param action action to execute
+   */
+  public void queue(AsyncAction action) {
+    actionQueues.put(action);
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.StopClusterResponseProto stopCluster(Messages.StopClusterRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("stop");
+    String message = request.getMessage();
+    if (message == null) {
+      message = "application stopped by client";
+    }
+    ActionStopSlider stopSlider =
+        new ActionStopSlider(message,
+            1000, TimeUnit.MILLISECONDS,
+            LauncherExitCodes.EXIT_SUCCESS,
+            FinalApplicationStatus.SUCCEEDED,
+            message);
+    log.info("SliderAppMasterApi.stopCluster: {}", stopSlider);
+    schedule(stopSlider);
+    return Messages.StopClusterResponseProto.getDefaultInstance();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.FlexClusterResponseProto flexCluster(Messages.FlexClusterRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("flex");
+    String payload = request.getClusterSpec();
+    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
+    ConfTree updatedResources = confTreeSerDeser.fromJson(payload);
+    schedule(new ActionFlexCluster("flex", 1, TimeUnit.MILLISECONDS,
+        updatedResources));
+    return Messages.FlexClusterResponseProto.newBuilder().setResponse(
+        true).build();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(
+      Messages.GetJSONClusterStatusRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("getstatus");
+    String result;
+    //quick update
+    //query and json-ify
+    ClusterDescription cd = appState.refreshClusterStatus();
+    result = cd.toJsonString();
+    String stat = result;
+    return Messages.GetJSONClusterStatusResponseProto.newBuilder()
+                                                     .setClusterSpec(stat)
+                                                     .build();
+  }
+
+  @Override
+  public Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
+      Messages.GetInstanceDefinitionRequestProto request)
+      throws IOException, YarnException {
+
+    onRpcCall("getinstancedefinition");
+    String internal;
+    String resources;
+    String app;
+    AggregateConf instanceDefinition =
+        appState.getInstanceDefinitionSnapshot();
+    internal = instanceDefinition.getInternal().toJson();
+    resources = instanceDefinition.getResources().toJson();
+    app = instanceDefinition.getAppConf().toJson();
+    assert internal != null;
+    assert resources != null;
+    assert app != null;
+    log.debug("Generating getInstanceDefinition Response");
+    Messages.GetInstanceDefinitionResponseProto.Builder builder =
+        Messages.GetInstanceDefinitionResponseProto.newBuilder();
+    builder.setInternal(internal);
+    builder.setResources(resources);
+    builder.setApplication(app);
+    return builder.build();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(Messages.ListNodeUUIDsByRoleRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("listnodes)");
+    String role = request.getRole();
+    Messages.ListNodeUUIDsByRoleResponseProto.Builder builder =
+        Messages.ListNodeUUIDsByRoleResponseProto.newBuilder();
+    List<RoleInstance> nodes = appState.enumLiveNodesInRole(role);
+    for (RoleInstance node : nodes) {
+      builder.addUuid(node.id);
+    }
+    return builder.build();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("getnode");
+    RoleInstance instance = appState.getLiveInstanceByContainerID(
+        request.getUuid());
+    return Messages.GetNodeResponseProto.newBuilder()
+                                        .setClusterNode(instance.toProtobuf())
+                                        .build();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.GetClusterNodesResponseProto getClusterNodes(
+      Messages.GetClusterNodesRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("getclusternodes");
+    List<RoleInstance>
+        clusterNodes = appState.getLiveInstancesByContainerIDs(
+        request.getUuidList());
+
+    Messages.GetClusterNodesResponseProto.Builder builder =
+        Messages.GetClusterNodesResponseProto.newBuilder();
+    for (RoleInstance node : clusterNodes) {
+      builder.addClusterNode(node.toProtobuf());
+    }
+    //at this point: a possibly empty list of nodes
+    return builder.build();
+  }
+
+  @Override
+  public Messages.EchoResponseProto echo(Messages.EchoRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("echo");
+    Messages.EchoResponseProto.Builder builder =
+        Messages.EchoResponseProto.newBuilder();
+    String text = request.getText();
+    log.info("Echo request size ={}", text.length());
+    log.info(text);
+    //now return it
+    builder.setText(text);
+    return builder.build();
+  }
+
+  @Override
+  public Messages.KillContainerResponseProto killContainer(Messages.KillContainerRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("killcontainer");
+    String containerID = request.getId();
+    log.info("Kill Container {}", containerID);
+    //throws NoSuchNodeException if it is missing
+    RoleInstance instance =
+        appState.getLiveInstanceByContainerID(containerID);
+    queue(new ActionKillContainer(instance.getId(), 0, TimeUnit.MILLISECONDS,
+        appmaster.getAMOperations()));
+    Messages.KillContainerResponseProto.Builder builder =
+        Messages.KillContainerResponseProto.newBuilder();
+    builder.setSuccess(true);
+    return builder.build();
+  }
+
+
+  @Override
+  public Messages.AMSuicideResponseProto amSuicide(
+      Messages.AMSuicideRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("amsuicide");
+    int signal = request.getSignal();
+    String text = request.getText();
+    if (text == null) {
+      text = "";
+    }
+    int delay = request.getDelay();
+    log.info("AM Suicide with signal {}, message {} delay = {}", signal, text,
+        delay);
+    ActionHalt action = new ActionHalt(signal, text, delay,
+        TimeUnit.MILLISECONDS);
+    schedule(action);
+    return Messages.AMSuicideResponseProto.getDefaultInstance();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
index a4ca130..854a706 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
@@ -1631,8 +1631,8 @@ public class AppState {
    * Update the cluster description with the current application state
    */
 
-  public void refreshClusterStatus() {
-    refreshClusterStatus(null);
+  public ClusterDescription refreshClusterStatus() {
+    return refreshClusterStatus(null);
   }
   
   /**

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
index da91bbf..b5b2cb7 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
@@ -215,8 +215,8 @@ public class ProviderAppState implements StateAccessForProviders {
   }
 
   @Override
-  public void refreshClusterStatus() {
-    appState.refreshClusterStatus();
+  public ClusterDescription refreshClusterStatus() {
+    return appState.refreshClusterStatus();
   }
 
   @Override
@@ -243,4 +243,18 @@ public class ProviderAppState implements StateAccessForProviders {
   public Map<String, Map<String, ClusterNode>> getRoleClusterNodeMapping() {
     return appState.createRoleToClusterNodeMap();
   }
+
+  @Override
+  public List<RoleInstance> enumLiveNodesInRole(String role) {
+    List<RoleInstance> nodes = new ArrayList<RoleInstance>();
+    Collection<RoleInstance> allRoleInstances = cloneLiveContainerInfoList();
+        getLiveNodes().values();
+    for (RoleInstance node : allRoleInstances) {
+      if (role.isEmpty() || role.equals(node.role)) {
+        nodes.add(node);
+      }
+    }
+    return nodes;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
index a1c6f24..0ea5428 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
@@ -229,7 +229,7 @@ public interface StateAccessForProviders {
   /**
    * Update the cluster description with anything interesting
    */
-  void refreshClusterStatus();
+  ClusterDescription refreshClusterStatus();
 
   /**
    * Get a deep clone of the role status list. Concurrent events may mean this
@@ -265,4 +265,11 @@ public interface StateAccessForProviders {
    * @return 
    */
   Map<String, Map<String, ClusterNode>> getRoleClusterNodeMapping();
+
+  /**
+   * Enum all nodes by role. 
+   * @param role role, or "" for all roles
+   * @return a list of nodes, may be empty
+   */
+  List<RoleInstance> enumLiveNodesInRole(String role);
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
index db32e48..e198e35 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
@@ -19,6 +19,7 @@ package org.apache.slider.server.appmaster.web;
 import org.apache.hadoop.registry.client.api.RegistryOperations;
 import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.providers.ProviderService;
+import org.apache.slider.server.appmaster.AppMasterActionOperations;
 import org.apache.slider.server.appmaster.actions.QueueAccess;
 import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
 import org.apache.slider.server.appmaster.state.AppState;
@@ -65,8 +66,7 @@ public interface WebAppApi {
    * Returns an interface that can support the agent-based REST operations.
    */
   AgentRestOperations getAgentRestOperations();
-
-
+  
   /**
    * Registry operations accessor
    * @return registry access
@@ -85,4 +85,5 @@ public interface WebAppApi {
    */
   QueueAccess getQueues();
 
+  AppMasterActionOperations getAMOperations();
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
index 0597c39..4eb984f 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
@@ -19,6 +19,7 @@ package org.apache.slider.server.appmaster.web;
 import org.apache.hadoop.registry.client.api.RegistryOperations;
 import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.providers.ProviderService;
+import org.apache.slider.server.appmaster.AppMasterActionOperations;
 import org.apache.slider.server.appmaster.actions.QueueAccess;
 import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
 import org.apache.slider.server.appmaster.state.RoleStatus;
@@ -47,6 +48,7 @@ public class WebAppApiImpl implements WebAppApi {
   private final RegistryOperations registryOperations;
   private final MetricsAndMonitoring metricsAndMonitoring;
   private final QueueAccess queues;
+  private final AppMasterActionOperations appMasterOperations;
 
   public WebAppApiImpl(SliderClusterProtocol clusterProto,
       StateAccessForProviders appState,
@@ -54,7 +56,9 @@ public class WebAppApiImpl implements WebAppApi {
       CertificateManager certificateManager,
       RegistryOperations registryOperations,
       MetricsAndMonitoring metricsAndMonitoring,
-      QueueAccess queues) {
+      QueueAccess queues,
+      AppMasterActionOperations appMasterOperations) {
+    this.appMasterOperations = appMasterOperations;
     checkNotNull(clusterProto);
     checkNotNull(appState);
     checkNotNull(provider);
@@ -118,4 +122,9 @@ public class WebAppApiImpl implements WebAppApi {
   public QueueAccess getQueues() {
     return queues;
   }
+
+  @Override
+  public AppMasterActionOperations getAMOperations() {
+    return appMasterOperations;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/StubSliderClusterProtocol.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/StubSliderClusterProtocol.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/StubSliderClusterProtocol.groovy
index 0836dcb..eb05d61 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/StubSliderClusterProtocol.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/StubSliderClusterProtocol.groovy
@@ -23,6 +23,9 @@ import org.apache.hadoop.yarn.exceptions.YarnException
 import org.apache.slider.api.SliderClusterProtocol
 import org.apache.slider.api.proto.Messages
 
+/**
+ * Stub implementation of the Protobuf <code>SliderClusterProtocol</code>
+ */
 class StubSliderClusterProtocol implements SliderClusterProtocol {
   @Override
   Messages.StopClusterResponseProto stopCluster(

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
index 4fc82b9..a43ee1e 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
@@ -118,7 +118,7 @@ class TestMockAppStateAppRestIntegration extends BaseMockAppStateTest implements
         stateAccess,
         new MockProviderService(),
         null, null,
-        new MetricsAndMonitoring("metrics"), null)
+        new MetricsAndMonitoring("metrics"), null, null)
     return api
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockProviderService.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockProviderService.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockProviderService.groovy
index e62c24e..f8ab56d 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockProviderService.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockProviderService.groovy
@@ -39,6 +39,7 @@ import org.apache.slider.providers.ProviderCompleted
 import org.apache.slider.providers.ProviderRole
 import org.apache.slider.providers.ProviderService
 import org.apache.slider.server.appmaster.actions.QueueAccess
+import org.apache.slider.server.appmaster.operations.AbstractRMOperation
 import org.apache.slider.server.appmaster.state.ContainerReleaseSelector
 import org.apache.slider.server.appmaster.state.MostRecentContainerReleaseSelector
 import org.apache.slider.server.appmaster.state.StateAccessForProviders
@@ -275,6 +276,11 @@ class MockProviderService implements ProviderService {
   }
 
   @Override
+  void execute(List<AbstractRMOperation> operations) {
+
+  }
+
+  @Override
   int cancelContainerRequests(
       Priority priority1,
       Priority priority2,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
index 7ea5a2a..8976f1c 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
@@ -57,7 +57,7 @@ public class TestClusterSpecificationBlock {
         providerAppState,
         providerService,
         null,
-        null, null, null);
+        null, null, null, null);
 
     Injector injector = Guice.createInjector(new AbstractModule() {
           @Override

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
index abd8477..297b8e7 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
@@ -64,7 +64,7 @@ public class TestContainerStatsBlock extends BaseMockAppStateTest {
         providerAppState,
         providerService,
         null,
-        null, metrics, null);
+        null, metrics, null, null);
 
     Injector injector = Guice.createInjector(new AbstractModule() {
           @Override

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
index 324aa38..4a053fd 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
@@ -56,7 +56,7 @@ public class TestIndexBlock extends BaseMockAppStateTest {
         providerAppState,
         providerService,
         null,
-        null, metrics, null);
+        null, metrics, null, null);
 
     Injector injector = Guice.createInjector(new AbstractModule() {
           @Override

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java b/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
index 1a10ee3..38e7db1 100644
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
+++ b/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
@@ -792,8 +792,9 @@ public class TestAgentProviderService {
       }
 
       @Override
-      public void refreshClusterStatus() {
+      public ClusterDescription refreshClusterStatus() {
         // do nothing
+        return null;
       }
     };
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
index 4aac2f1..b75d51d 100644
--- a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
+++ b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
@@ -145,7 +145,7 @@ public class TestAMAgentWebServices {
 
     slider = new WebAppApiImpl(new MockSliderClusterProtocol(), providerAppState,
                                new MockProviderService(), null, null, null,
-        null);
+        null, null);
 
     MapOperations compOperations = new MapOperations();
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7632f5de/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
index f19f8f3..5a6ec96 100644
--- a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
+++ b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
@@ -193,7 +193,7 @@ public class TestAMManagementWebServices extends JerseyTest {
 
         slider = new WebAppApiImpl(new MockSliderClusterProtocol(), providerAppState,
                                    new MockProviderService(), null, null, null,
-            null);
+            null, null);
 
         bind(SliderJacksonJaxbJsonProvider.class);
         bind(MockSliderAMWebServices.class);


[05/20] incubator-slider git commit: SLIDER-782 drop AM implementation of the SliderClusterProtocol

Posted by st...@apache.org.
SLIDER-782 drop AM implementation of the SliderClusterProtocol


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/ae6f813e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/ae6f813e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/ae6f813e

Branch: refs/heads/develop
Commit: ae6f813ee36a548bed1496aafb093a3bdecbb521
Parents: c94965f
Author: Steve Loughran <st...@apache.org>
Authored: Wed Feb 11 20:53:15 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Feb 11 20:53:15 2015 +0000

----------------------------------------------------------------------
 .../server/appmaster/SliderAppMaster.java       | 218 +------------------
 1 file changed, 3 insertions(+), 215 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ae6f813e/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index f18fb2c..61e3692 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -33,7 +33,6 @@ import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifie
 import org.apache.hadoop.http.HttpConfig;
 import org.apache.hadoop.io.DataOutputBuffer;
 import org.apache.hadoop.io.Text;
-import org.apache.hadoop.ipc.ProtocolSignature;
 import org.apache.hadoop.registry.client.binding.RegistryTypeUtils;
 import org.apache.hadoop.registry.client.binding.RegistryUtils;
 import org.apache.hadoop.security.Credentials;
@@ -79,9 +78,7 @@ import org.apache.slider.api.ClusterDescription;
 import org.apache.slider.api.InternalKeys;
 import org.apache.slider.api.ResourceKeys;
 import org.apache.slider.api.RoleKeys;
-import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.api.StatusKeys;
-import org.apache.slider.api.proto.Messages;
 import org.apache.slider.api.proto.SliderClusterAPI;
 import org.apache.slider.common.SliderExitCodes;
 import org.apache.slider.common.SliderKeys;
@@ -107,7 +104,6 @@ import org.apache.slider.core.main.ExitCodeProvider;
 import org.apache.slider.core.main.LauncherExitCodes;
 import org.apache.slider.core.main.RunService;
 import org.apache.slider.core.main.ServiceLauncher;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
 import org.apache.slider.core.registry.info.CustomRegistryConstants;
 import org.apache.slider.providers.ProviderCompleted;
 import org.apache.slider.providers.ProviderRole;
@@ -116,11 +112,9 @@ import org.apache.slider.providers.SliderProviderFactory;
 import org.apache.slider.providers.agent.AgentKeys;
 import org.apache.slider.providers.slideram.SliderAMClientProvider;
 import org.apache.slider.providers.slideram.SliderAMProviderService;
-import org.apache.slider.server.appmaster.actions.ActionKillContainer;
 import org.apache.slider.server.appmaster.actions.ActionRegisterServiceInstance;
 import org.apache.slider.server.appmaster.actions.RegisterComponentInstance;
 import org.apache.slider.server.appmaster.actions.QueueExecutor;
-import org.apache.slider.server.appmaster.actions.ActionHalt;
 import org.apache.slider.server.appmaster.actions.QueueService;
 import org.apache.slider.server.appmaster.actions.ActionStopSlider;
 import org.apache.slider.server.appmaster.actions.AsyncAction;
@@ -194,7 +188,6 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
     RunService,
     SliderExitCodes,
     SliderKeys,
-    SliderClusterProtocol,
     ServiceStateChangeListener,
     RoleKeys,
     ProviderCompleted,
@@ -1777,199 +1770,10 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
   }
   
 /* =================================================================== */
-/* SliderClusterProtocol */
+/* RMOperationHandlerActions */
 /* =================================================================== */
 
-  @Override   //SliderClusterProtocol
-  public ProtocolSignature getProtocolSignature(String protocol,
-                                                long clientVersion,
-                                                int clientMethodsHash) throws
-      IOException {
-    return ProtocolSignature.getProtocolSignature(
-      this, protocol, clientVersion, clientMethodsHash);
-  }
-
-
-
-  @Override   //SliderClusterProtocol
-  public long getProtocolVersion(String protocol, long clientVersion) throws
-                                                                      IOException {
-    return SliderClusterProtocol.versionID;
-  }
-
-  
-/* =================================================================== */
-/* SliderClusterProtocol */
-/* =================================================================== */
-
-  /**
-   * General actions to perform on a slider RPC call coming in
-   * @param operation operation to log
-   * @throws IOException problems
-   */
-  protected void onRpcCall(String operation) throws IOException {
-    // it's not clear why this is here —it has been present since the
-    // code -> git change. Leaving it in
-    SliderUtils.getCurrentUser();
-    log.debug("Received call to {}", operation);
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.StopClusterResponseProto stopCluster(Messages.StopClusterRequestProto request) throws
-                                                                                                 IOException,
-                                                                                                 YarnException {
-    onRpcCall("stopCluster()");
-    String message = request.getMessage();
-    if (message == null) {
-      message = "application frozen by client";
-    }
-    ActionStopSlider stopSlider =
-        new ActionStopSlider(message,
-            1000, TimeUnit.MILLISECONDS,
-            LauncherExitCodes.EXIT_SUCCESS,
-            FinalApplicationStatus.SUCCEEDED,
-            message);
-    log.info("SliderAppMasterApi.stopCluster: {}", stopSlider);
-    schedule(stopSlider);
-    return Messages.StopClusterResponseProto.getDefaultInstance();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.FlexClusterResponseProto flexCluster(Messages.FlexClusterRequestProto request) throws
-                                                                                                 IOException,
-                                                                                                 YarnException {
-    onRpcCall("flexCluster()");
-    String payload = request.getClusterSpec();
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-    ConfTree updatedResources = confTreeSerDeser.fromJson(payload);
-    flexCluster(updatedResources);
-    return Messages.FlexClusterResponseProto.newBuilder().setResponse(
-        true).build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(
-    Messages.GetJSONClusterStatusRequestProto request) throws
-                                                       IOException,
-                                                       YarnException {
-    onRpcCall("getJSONClusterStatus()");
-    String result;
-    //quick update
-    //query and json-ify
-    ClusterDescription cd = updateClusterStatus();
-    result = cd.toJsonString();
-    String stat = result;
-    return Messages.GetJSONClusterStatusResponseProto.newBuilder()
-      .setClusterSpec(stat)
-      .build();
-  }
-
-  @Override
-  public Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
-    Messages.GetInstanceDefinitionRequestProto request) throws
-                                                        IOException,
-                                                        YarnException {
-
-    onRpcCall("getInstanceDefinition()");
-    String internal;
-    String resources;
-    String app;
-    synchronized (appState) {
-      AggregateConf instanceDefinition = appState.getInstanceDefinition();
-      internal = instanceDefinition.getInternal().toJson();
-      resources = instanceDefinition.getResources().toJson();
-      app = instanceDefinition.getAppConf().toJson();
-    }
-    assert internal != null;
-    assert resources != null;
-    assert app != null;
-    log.debug("Generating getInstanceDefinition Response");
-    Messages.GetInstanceDefinitionResponseProto.Builder builder =
-      Messages.GetInstanceDefinitionResponseProto.newBuilder();
-    builder.setInternal(internal);
-    builder.setResources(resources);
-    builder.setApplication(app);
-    return builder.build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(Messages.ListNodeUUIDsByRoleRequestProto request) throws
-                                                                                                                         IOException,
-                                                                                                                         YarnException {
-    onRpcCall("listNodeUUIDsByRole()");
-    String role = request.getRole();
-    Messages.ListNodeUUIDsByRoleResponseProto.Builder builder =
-      Messages.ListNodeUUIDsByRoleResponseProto.newBuilder();
-    List<RoleInstance> nodes = appState.enumLiveNodesInRole(role);
-    for (RoleInstance node : nodes) {
-      builder.addUuid(node.id);
-    }
-    return builder.build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request) throws
-                                                                                     IOException,
-                                                                                     YarnException {
-    onRpcCall("getNode()");
-    RoleInstance instance = appState.getLiveInstanceByContainerID(
-        request.getUuid());
-    return Messages.GetNodeResponseProto.newBuilder()
-                                        .setClusterNode(instance.toProtobuf())
-                   .build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.GetClusterNodesResponseProto getClusterNodes(Messages.GetClusterNodesRequestProto request) throws
-                                                                                                             IOException,
-                                                                                                             YarnException {
-    onRpcCall("getClusterNodes()");
-    List<RoleInstance>
-      clusterNodes = appState.getLiveInstancesByContainerIDs(
-        request.getUuidList());
-
-    Messages.GetClusterNodesResponseProto.Builder builder =
-      Messages.GetClusterNodesResponseProto.newBuilder();
-    for (RoleInstance node : clusterNodes) {
-      builder.addClusterNode(node.toProtobuf());
-    }
-    //at this point: a possibly empty list of nodes
-    return builder.build();
-  }
-
-  @Override
-  public Messages.EchoResponseProto echo(Messages.EchoRequestProto request) throws
-                                                                            IOException,
-                                                                            YarnException {
-    onRpcCall("echo()");
-    Messages.EchoResponseProto.Builder builder =
-      Messages.EchoResponseProto.newBuilder();
-    String text = request.getText();
-    log.info("Echo request size ={}", text.length());
-    log.info(text);
-    //now return it
-    builder.setText(text);
-    return builder.build();
-  }
-
-  @Override
-  public Messages.KillContainerResponseProto killContainer(Messages.KillContainerRequestProto request) throws
-                                                                                                       IOException,
-                                                                                                       YarnException {
-    onRpcCall("killContainer()");
-    String containerID = request.getId();
-    log.info("Kill Container {}", containerID);
-    //throws NoSuchNodeException if it is missing
-    RoleInstance instance =
-      appState.getLiveInstanceByContainerID(containerID);
-    queue(new ActionKillContainer(instance.getId(), 0, TimeUnit.MILLISECONDS,
-        rmOperationHandler));
-    Messages.KillContainerResponseProto.Builder builder =
-      Messages.KillContainerResponseProto.newBuilder();
-    builder.setSuccess(true);
-    return builder.build();
-  }
-
+ 
   @Override
   public void execute(List<AbstractRMOperation> operations) {
     rmOperationHandler.execute(operations);
@@ -1992,23 +1796,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
     return rmOperationHandler.cancelContainerRequests(priority1, priority2, count);
   }
 
-  @Override
-  public Messages.AMSuicideResponseProto amSuicide(
-      Messages.AMSuicideRequestProto request)
-      throws IOException, YarnException {
-    int signal = request.getSignal();
-    String text = request.getText();
-    if (text == null) {
-      text = "";
-    }
-    int delay = request.getDelay();
-    log.info("AM Suicide with signal {}, message {} delay = {}", signal, text, delay);
-    ActionHalt action = new ActionHalt(signal, text, delay,
-        TimeUnit.MILLISECONDS);
-    schedule(action);
-    return Messages.AMSuicideResponseProto.getDefaultInstance();
-  }
-
+ 
 /* =================================================================== */
 /* END */
 /* =================================================================== */


[20/20] incubator-slider git commit: Merge branch 'feature/SLIDER-782_SLIDER_RPC_Client_API_in_sync_with_REST_API' into develop

Posted by st...@apache.org.
Merge branch 'feature/SLIDER-782_SLIDER_RPC_Client_API_in_sync_with_REST_API' into develop


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/67938ee9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/67938ee9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/67938ee9

Branch: refs/heads/develop
Commit: 67938ee99a5115910f90c5f31c00c2a87a8d5638
Parents: 0b00221 c8ddd60
Author: Steve Loughran <st...@apache.org>
Authored: Sat Feb 14 18:28:55 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Sat Feb 14 18:28:55 2015 +0000

----------------------------------------------------------------------
 .../apache/slider/api/SliderApplicationApi.java |   145 +
 .../slider/api/SliderClusterProtocol.java       |    48 +-
 .../org/apache/slider/api/proto/Messages.java   | 12514 ++++++++++++++++-
 .../slider/api/proto/RestTypeMarshalling.java   |   193 +
 .../slider/api/proto/SliderClusterAPI.java      |   967 +-
 .../slider/api/types/ComponentInformation.java  |    25 +-
 .../slider/api/types/ContainerInformation.java  |     4 +-
 .../slider/client/ClientRegistryBinder.java     |   201 +
 .../org/apache/slider/client/SliderClient.java  |     3 +-
 .../apache/slider/client/SliderClientAPI.java   |     3 -
 .../slider/client/SliderClusterOperations.java  |   327 -
 .../slider/client/SliderYarnClientImpl.java     |     1 -
 .../client/ipc/SliderApplicationIpcClient.java  |   214 +
 .../client/ipc/SliderClusterOperations.java     |   490 +
 .../slider/client/rest/RestClientFactory.java   |    15 +-
 .../client/rest/RestClientRegistryBinder.java   |   201 -
 .../client/rest/SliderApplicationApi.java       |   145 -
 .../client/rest/SliderApplicationApiClient.java |   255 -
 .../rest/SliderApplicationApiRestClient.java    |   265 +
 .../apache/slider/common/SliderXmlConfKeys.java |    11 +
 .../core/exceptions/NoSuchNodeException.java    |     2 +-
 .../exceptions/ServiceNotReadyException.java    |    43 +
 .../registry/retrieve/RegistryRetriever.java    |     2 +-
 .../providers/AbstractProviderService.java      |    12 +-
 .../appmaster/AppMasterActionOperations.java    |    32 +
 .../server/appmaster/SliderAppMaster.java       |   314 +-
 .../appmaster/actions/ActionFlexCluster.java    |    44 +
 .../appmaster/actions/ActionKillContainer.java  |     5 +-
 .../actions/ReviewAndFlexApplicationSize.java   |     2 +-
 .../operations/AbstractRMOperation.java         |     3 +-
 .../operations/CancelRequestOperation.java      |     2 +-
 .../operations/ContainerReleaseOperation.java   |     2 +-
 .../operations/ContainerRequestOperation.java   |     2 +-
 .../operations/RMOperationHandler.java          |     7 +-
 .../operations/RMOperationHandlerActions.java   |     8 +
 .../slider/server/appmaster/rpc/RpcBinder.java  |   136 +-
 .../rpc/SliderClusterProtocolPBImpl.java        |   123 +-
 .../rpc/SliderClusterProtocolProxy.java         |   165 +-
 .../server/appmaster/rpc/SliderIPCService.java  |   466 +
 .../slider/server/appmaster/state/AppState.java |     6 +-
 .../appmaster/state/ProviderAppState.java       |    46 +-
 .../state/StateAccessForProviders.java          |    18 +-
 .../slider/server/appmaster/web/WebAppApi.java  |    13 +-
 .../server/appmaster/web/WebAppApiImpl.java     |    32 +-
 .../ApplicationResouceContentCacheFactory.java  |    91 +
 .../rest/application/ApplicationResource.java   |    77 +-
 .../application/resources/ContentCache.java     |    33 +-
 .../appmaster/web/view/ContainerStatsBlock.java |    48 +-
 .../src/main/proto/SliderClusterMessages.proto  |   141 +-
 .../src/main/proto/SliderClusterProtocol.proto  |    84 +-
 .../rest/AbstractAppApiTestDelegates.groovy     |   235 +
 .../agent/rest/IpcApiClientTestDelegates.java   |    29 +
 .../agent/rest/JerseyTestDelegates.groovy       |     6 +-
 .../rest/RestAPIClientTestDelegates.groovy      |   222 +-
 .../slider/agent/rest/TestStandaloneREST.groovy |    12 +
 .../appstate/StubSliderClusterProtocol.groovy   |   108 -
 .../TestMockAppStateAppRestIntegration.groovy   |     8 +-
 .../model/mock/MockProviderService.groovy       |     6 +
 .../model/mock/MockSliderClusterProtocol.groovy |   108 -
 .../view/TestClusterSpecificationBlock.groovy   |     6 +-
 .../web/view/TestContainerStatsBlock.groovy     |     5 +-
 .../appmaster/web/view/TestIndexBlock.groovy    |     5 +-
 .../agent/TestAgentProviderService.java         |     3 +-
 .../web/rest/agent/TestAMAgentWebServices.java  |     5 +-
 .../management/TestAMManagementWebServices.java |     5 +-
 .../funtest/lifecycle/AgentWebPagesIT.groovy    |    32 +-
 66 files changed, 16896 insertions(+), 1885 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/67938ee9/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------


[03/20] incubator-slider git commit: SLIDER-782: all tests passing; rename protocol service: SliderIPCService

Posted by st...@apache.org.
SLIDER-782: all tests passing; rename protocol service: SliderIPCService


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/4b56e54d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/4b56e54d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/4b56e54d

Branch: refs/heads/develop
Commit: 4b56e54d40c6c2f8e7b79f800efa6811b9defce6
Parents: ca1e008
Author: Steve Loughran <st...@apache.org>
Authored: Wed Feb 11 16:31:59 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Feb 11 16:31:59 2015 +0000

----------------------------------------------------------------------
 .../server/appmaster/SliderAppMaster.java       |   6 +-
 .../rpc/SliderClusterProtocolService.java       | 303 -------------------
 .../server/appmaster/rpc/SliderIPCService.java  | 303 +++++++++++++++++++
 3 files changed, 306 insertions(+), 306 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4b56e54d/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index 8a33735..7f3211e 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -139,7 +139,7 @@ import org.apache.slider.server.appmaster.rpc.RpcBinder;
 import org.apache.slider.server.appmaster.rpc.SliderAMPolicyProvider;
 import org.apache.slider.server.appmaster.rpc.SliderClusterProtocolPBImpl;
 import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
-import org.apache.slider.server.appmaster.rpc.SliderClusterProtocolService;
+import org.apache.slider.server.appmaster.rpc.SliderIPCService;
 import org.apache.slider.server.appmaster.security.SecurityConfiguration;
 import org.apache.slider.server.appmaster.state.AppState;
 import org.apache.slider.server.appmaster.state.ContainerAssignment;
@@ -253,7 +253,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
   /**
    * Slider IPC: Real service handler
    */
-  private SliderClusterProtocolService sliderIPCService;
+  private SliderIPCService sliderIPCService;
   /**
    * Slider IPC: binding
    */
@@ -1498,7 +1498,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
       throws IOException, SliderException {
     verifyIPCAccess();
 
-    sliderIPCService = new SliderClusterProtocolService(
+    sliderIPCService = new SliderIPCService(
         this,
         stateForProviders,
         actionQueues,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4b56e54d/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
deleted file mode 100644
index d467414..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * 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.slider.server.appmaster.rpc;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.ipc.ProtocolSignature;
-import org.apache.hadoop.service.AbstractService;
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.proto.Messages;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.exceptions.ServiceNotReadyException;
-import org.apache.slider.core.main.LauncherExitCodes;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.apache.slider.server.appmaster.AppMasterActionOperations;
-import org.apache.slider.server.appmaster.actions.ActionFlexCluster;
-import org.apache.slider.server.appmaster.actions.ActionHalt;
-import org.apache.slider.server.appmaster.actions.ActionKillContainer;
-import org.apache.slider.server.appmaster.actions.ActionStopSlider;
-import org.apache.slider.server.appmaster.actions.AsyncAction;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Implement the {@link SliderClusterProtocol}.
- */
-public class SliderClusterProtocolService extends AbstractService
-    implements SliderClusterProtocol {
-
-  protected static final Logger log =
-      LoggerFactory.getLogger(SliderClusterProtocol.class);
-
-  private final QueueAccess actionQueues;
-  private final StateAccessForProviders appState;
-  private final MetricsAndMonitoring metricsAndMonitoring;
-  private final AppMasterActionOperations amOperations;
-  
-  /**
-   * This is the prefix used for metrics
-   */
-  public static final String PROTOCOL_PREFIX =
-      "org.apache.slider.api.SliderClusterProtocol.";
-
-  /**
-   * Constructor
-   * @param amOperations access to any AM operations
-   * @param appState state view
-   * @param actionQueues queues for actions
-   * @param metricsAndMonitoring metrics
-   */
-  public SliderClusterProtocolService(AppMasterActionOperations amOperations,
-      StateAccessForProviders appState,
-      QueueAccess actionQueues,
-      MetricsAndMonitoring metricsAndMonitoring) {
-    super("SliderClusterProtocolService");
-    Preconditions.checkArgument(amOperations != null, "null amOperations");
-    Preconditions.checkArgument(appState != null, "null appState");
-    Preconditions.checkArgument(actionQueues != null, "null actionQueues");
-    Preconditions.checkArgument(metricsAndMonitoring != null, "null metricsAndMonitoring");
-    this.appState = appState;
-    this.actionQueues = actionQueues;
-    this.metricsAndMonitoring = metricsAndMonitoring;
-    this.amOperations = amOperations;
-  }
-
-  @Override   //SliderClusterProtocol
-  public ProtocolSignature getProtocolSignature(String protocol,
-      long clientVersion,
-      int clientMethodsHash) throws IOException {
-    return ProtocolSignature.getProtocolSignature(
-        this, protocol, clientVersion, clientMethodsHash);
-  }
-
-
-  @Override   //SliderClusterProtocol
-  public long getProtocolVersion(String protocol, long clientVersion)
-      throws IOException {
-    return SliderClusterProtocol.versionID;
-  }
-
-  /**
-   * General actions to perform on a slider RPC call coming in
-   * @param operation operation to log
-   * @throws IOException problems
-   * @throws ServiceNotReadyException if the RPC service is constructed
-   * but not fully initialized
-   */
-  protected void onRpcCall(String operation) throws IOException {
-    log.debug("Received call to {}", operation);
-    metricsAndMonitoring.markMeterAndCounter(PROTOCOL_PREFIX + operation);
-  }
-
-  /**
-   * Schedule an action
-   * @param action for delayed execution
-   */
-  public void schedule(AsyncAction action) {
-    actionQueues.schedule(action);
-  }
-
-  /**
-   * Queue an action for immediate execution in the executor thread
-   * @param action action to execute
-   */
-  public void queue(AsyncAction action) {
-    actionQueues.put(action);
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.StopClusterResponseProto stopCluster(Messages.StopClusterRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("stop");
-    String message = request.getMessage();
-    if (message == null) {
-      message = "application stopped by client";
-    }
-    ActionStopSlider stopSlider =
-        new ActionStopSlider(message,
-            1000, TimeUnit.MILLISECONDS,
-            LauncherExitCodes.EXIT_SUCCESS,
-            FinalApplicationStatus.SUCCEEDED,
-            message);
-    log.info("SliderAppMasterApi.stopCluster: {}", stopSlider);
-    schedule(stopSlider);
-    return Messages.StopClusterResponseProto.getDefaultInstance();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.FlexClusterResponseProto flexCluster(Messages.FlexClusterRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("flex");
-    String payload = request.getClusterSpec();
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-    ConfTree updatedResources = confTreeSerDeser.fromJson(payload);
-    schedule(new ActionFlexCluster("flex", 1, TimeUnit.MILLISECONDS,
-        updatedResources));
-    return Messages.FlexClusterResponseProto.newBuilder().setResponse(
-        true).build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(
-      Messages.GetJSONClusterStatusRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("getstatus");
-    String result;
-    //quick update
-    //query and json-ify
-    ClusterDescription cd = appState.refreshClusterStatus();
-    result = cd.toJsonString();
-    String stat = result;
-    return Messages.GetJSONClusterStatusResponseProto.newBuilder()
-                                                     .setClusterSpec(stat)
-                                                     .build();
-  }
-
-  @Override
-  public Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
-      Messages.GetInstanceDefinitionRequestProto request)
-      throws IOException, YarnException {
-
-    onRpcCall("getinstancedefinition");
-    String internal;
-    String resources;
-    String app;
-    AggregateConf instanceDefinition =
-        appState.getInstanceDefinitionSnapshot();
-    internal = instanceDefinition.getInternal().toJson();
-    resources = instanceDefinition.getResources().toJson();
-    app = instanceDefinition.getAppConf().toJson();
-    assert internal != null;
-    assert resources != null;
-    assert app != null;
-    log.debug("Generating getInstanceDefinition Response");
-    Messages.GetInstanceDefinitionResponseProto.Builder builder =
-        Messages.GetInstanceDefinitionResponseProto.newBuilder();
-    builder.setInternal(internal);
-    builder.setResources(resources);
-    builder.setApplication(app);
-    return builder.build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(Messages.ListNodeUUIDsByRoleRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("listnodes)");
-    String role = request.getRole();
-    Messages.ListNodeUUIDsByRoleResponseProto.Builder builder =
-        Messages.ListNodeUUIDsByRoleResponseProto.newBuilder();
-    List<RoleInstance> nodes = appState.enumLiveNodesInRole(role);
-    for (RoleInstance node : nodes) {
-      builder.addUuid(node.id);
-    }
-    return builder.build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("getnode");
-    RoleInstance instance = appState.getLiveInstanceByContainerID(
-        request.getUuid());
-    return Messages.GetNodeResponseProto.newBuilder()
-                                        .setClusterNode(instance.toProtobuf())
-                                        .build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.GetClusterNodesResponseProto getClusterNodes(
-      Messages.GetClusterNodesRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("getclusternodes");
-    List<RoleInstance>
-        clusterNodes = appState.getLiveInstancesByContainerIDs(
-        request.getUuidList());
-
-    Messages.GetClusterNodesResponseProto.Builder builder =
-        Messages.GetClusterNodesResponseProto.newBuilder();
-    for (RoleInstance node : clusterNodes) {
-      builder.addClusterNode(node.toProtobuf());
-    }
-    //at this point: a possibly empty list of nodes
-    return builder.build();
-  }
-
-  @Override
-  public Messages.EchoResponseProto echo(Messages.EchoRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("echo");
-    Messages.EchoResponseProto.Builder builder =
-        Messages.EchoResponseProto.newBuilder();
-    String text = request.getText();
-    log.info("Echo request size ={}", text.length());
-    log.info(text);
-    //now return it
-    builder.setText(text);
-    return builder.build();
-  }
-
-  @Override
-  public Messages.KillContainerResponseProto killContainer(Messages.KillContainerRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("killcontainer");
-    String containerID = request.getId();
-    log.info("Kill Container {}", containerID);
-    //throws NoSuchNodeException if it is missing
-    RoleInstance instance =
-        appState.getLiveInstanceByContainerID(containerID);
-    queue(new ActionKillContainer(instance.getId(), 0, TimeUnit.MILLISECONDS,
-        amOperations));
-    Messages.KillContainerResponseProto.Builder builder =
-        Messages.KillContainerResponseProto.newBuilder();
-    builder.setSuccess(true);
-    return builder.build();
-  }
-
-
-  @Override
-  public Messages.AMSuicideResponseProto amSuicide(
-      Messages.AMSuicideRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("amsuicide");
-    int signal = request.getSignal();
-    String text = request.getText();
-    if (text == null) {
-      text = "";
-    }
-    int delay = request.getDelay();
-    log.info("AM Suicide with signal {}, message {} delay = {}", signal, text,
-        delay);
-    ActionHalt action = new ActionHalt(signal, text, delay,
-        TimeUnit.MILLISECONDS);
-    schedule(action);
-    return Messages.AMSuicideResponseProto.getDefaultInstance();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4b56e54d/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
new file mode 100644
index 0000000..e2f3644
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
@@ -0,0 +1,303 @@
+/*
+ * 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.slider.server.appmaster.rpc;
+
+import com.google.common.base.Preconditions;
+import org.apache.hadoop.ipc.ProtocolSignature;
+import org.apache.hadoop.service.AbstractService;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.slider.api.ClusterDescription;
+import org.apache.slider.api.SliderClusterProtocol;
+import org.apache.slider.api.proto.Messages;
+import org.apache.slider.core.conf.AggregateConf;
+import org.apache.slider.core.conf.ConfTree;
+import org.apache.slider.core.exceptions.ServiceNotReadyException;
+import org.apache.slider.core.main.LauncherExitCodes;
+import org.apache.slider.core.persist.ConfTreeSerDeser;
+import org.apache.slider.server.appmaster.AppMasterActionOperations;
+import org.apache.slider.server.appmaster.actions.ActionFlexCluster;
+import org.apache.slider.server.appmaster.actions.ActionHalt;
+import org.apache.slider.server.appmaster.actions.ActionKillContainer;
+import org.apache.slider.server.appmaster.actions.ActionStopSlider;
+import org.apache.slider.server.appmaster.actions.AsyncAction;
+import org.apache.slider.server.appmaster.actions.QueueAccess;
+import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
+import org.apache.slider.server.appmaster.state.RoleInstance;
+import org.apache.slider.server.appmaster.state.StateAccessForProviders;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Implement the {@link SliderClusterProtocol}.
+ */
+public class SliderIPCService extends AbstractService
+    implements SliderClusterProtocol {
+
+  protected static final Logger log =
+      LoggerFactory.getLogger(SliderClusterProtocol.class);
+
+  private final QueueAccess actionQueues;
+  private final StateAccessForProviders appState;
+  private final MetricsAndMonitoring metricsAndMonitoring;
+  private final AppMasterActionOperations amOperations;
+  
+  /**
+   * This is the prefix used for metrics
+   */
+  public static final String METRICS_PREFIX =
+      "org.apache.slider.api.SliderIPCService.";
+
+  /**
+   * Constructor
+   * @param amOperations access to any AM operations
+   * @param appState state view
+   * @param actionQueues queues for actions
+   * @param metricsAndMonitoring metrics
+   */
+  public SliderIPCService(AppMasterActionOperations amOperations,
+      StateAccessForProviders appState,
+      QueueAccess actionQueues,
+      MetricsAndMonitoring metricsAndMonitoring) {
+    super("SliderIPCService");
+    Preconditions.checkArgument(amOperations != null, "null amOperations");
+    Preconditions.checkArgument(appState != null, "null appState");
+    Preconditions.checkArgument(actionQueues != null, "null actionQueues");
+    Preconditions.checkArgument(metricsAndMonitoring != null, "null metricsAndMonitoring");
+    this.appState = appState;
+    this.actionQueues = actionQueues;
+    this.metricsAndMonitoring = metricsAndMonitoring;
+    this.amOperations = amOperations;
+  }
+
+  @Override   //SliderClusterProtocol
+  public ProtocolSignature getProtocolSignature(String protocol,
+      long clientVersion,
+      int clientMethodsHash) throws IOException {
+    return ProtocolSignature.getProtocolSignature(
+        this, protocol, clientVersion, clientMethodsHash);
+  }
+
+
+  @Override   //SliderClusterProtocol
+  public long getProtocolVersion(String protocol, long clientVersion)
+      throws IOException {
+    return SliderClusterProtocol.versionID;
+  }
+
+  /**
+   * General actions to perform on a slider RPC call coming in
+   * @param operation operation to log
+   * @throws IOException problems
+   * @throws ServiceNotReadyException if the RPC service is constructed
+   * but not fully initialized
+   */
+  protected void onRpcCall(String operation) throws IOException {
+    log.debug("Received call to {}", operation);
+    metricsAndMonitoring.markMeterAndCounter(METRICS_PREFIX + operation);
+  }
+
+  /**
+   * Schedule an action
+   * @param action for delayed execution
+   */
+  public void schedule(AsyncAction action) {
+    actionQueues.schedule(action);
+  }
+
+  /**
+   * Queue an action for immediate execution in the executor thread
+   * @param action action to execute
+   */
+  public void queue(AsyncAction action) {
+    actionQueues.put(action);
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.StopClusterResponseProto stopCluster(Messages.StopClusterRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("stop");
+    String message = request.getMessage();
+    if (message == null) {
+      message = "application stopped by client";
+    }
+    ActionStopSlider stopSlider =
+        new ActionStopSlider(message,
+            1000, TimeUnit.MILLISECONDS,
+            LauncherExitCodes.EXIT_SUCCESS,
+            FinalApplicationStatus.SUCCEEDED,
+            message);
+    log.info("SliderAppMasterApi.stopCluster: {}", stopSlider);
+    schedule(stopSlider);
+    return Messages.StopClusterResponseProto.getDefaultInstance();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.FlexClusterResponseProto flexCluster(Messages.FlexClusterRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("flex");
+    String payload = request.getClusterSpec();
+    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
+    ConfTree updatedResources = confTreeSerDeser.fromJson(payload);
+    schedule(new ActionFlexCluster("flex", 1, TimeUnit.MILLISECONDS,
+        updatedResources));
+    return Messages.FlexClusterResponseProto.newBuilder().setResponse(
+        true).build();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(
+      Messages.GetJSONClusterStatusRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("getstatus");
+    String result;
+    //quick update
+    //query and json-ify
+    ClusterDescription cd = appState.refreshClusterStatus();
+    result = cd.toJsonString();
+    String stat = result;
+    return Messages.GetJSONClusterStatusResponseProto.newBuilder()
+                                                     .setClusterSpec(stat)
+                                                     .build();
+  }
+
+  @Override
+  public Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
+      Messages.GetInstanceDefinitionRequestProto request)
+      throws IOException, YarnException {
+
+    onRpcCall("getinstancedefinition");
+    String internal;
+    String resources;
+    String app;
+    AggregateConf instanceDefinition =
+        appState.getInstanceDefinitionSnapshot();
+    internal = instanceDefinition.getInternal().toJson();
+    resources = instanceDefinition.getResources().toJson();
+    app = instanceDefinition.getAppConf().toJson();
+    assert internal != null;
+    assert resources != null;
+    assert app != null;
+    log.debug("Generating getInstanceDefinition Response");
+    Messages.GetInstanceDefinitionResponseProto.Builder builder =
+        Messages.GetInstanceDefinitionResponseProto.newBuilder();
+    builder.setInternal(internal);
+    builder.setResources(resources);
+    builder.setApplication(app);
+    return builder.build();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(Messages.ListNodeUUIDsByRoleRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("listnodes)");
+    String role = request.getRole();
+    Messages.ListNodeUUIDsByRoleResponseProto.Builder builder =
+        Messages.ListNodeUUIDsByRoleResponseProto.newBuilder();
+    List<RoleInstance> nodes = appState.enumLiveNodesInRole(role);
+    for (RoleInstance node : nodes) {
+      builder.addUuid(node.id);
+    }
+    return builder.build();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("getnode");
+    RoleInstance instance = appState.getLiveInstanceByContainerID(
+        request.getUuid());
+    return Messages.GetNodeResponseProto.newBuilder()
+                                        .setClusterNode(instance.toProtobuf())
+                                        .build();
+  }
+
+  @Override //SliderClusterProtocol
+  public Messages.GetClusterNodesResponseProto getClusterNodes(
+      Messages.GetClusterNodesRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("getclusternodes");
+    List<RoleInstance>
+        clusterNodes = appState.getLiveInstancesByContainerIDs(
+        request.getUuidList());
+
+    Messages.GetClusterNodesResponseProto.Builder builder =
+        Messages.GetClusterNodesResponseProto.newBuilder();
+    for (RoleInstance node : clusterNodes) {
+      builder.addClusterNode(node.toProtobuf());
+    }
+    //at this point: a possibly empty list of nodes
+    return builder.build();
+  }
+
+  @Override
+  public Messages.EchoResponseProto echo(Messages.EchoRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("echo");
+    Messages.EchoResponseProto.Builder builder =
+        Messages.EchoResponseProto.newBuilder();
+    String text = request.getText();
+    log.info("Echo request size ={}", text.length());
+    log.info(text);
+    //now return it
+    builder.setText(text);
+    return builder.build();
+  }
+
+  @Override
+  public Messages.KillContainerResponseProto killContainer(Messages.KillContainerRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("killcontainer");
+    String containerID = request.getId();
+    log.info("Kill Container {}", containerID);
+    //throws NoSuchNodeException if it is missing
+    RoleInstance instance =
+        appState.getLiveInstanceByContainerID(containerID);
+    queue(new ActionKillContainer(instance.getId(), 0, TimeUnit.MILLISECONDS,
+        amOperations));
+    Messages.KillContainerResponseProto.Builder builder =
+        Messages.KillContainerResponseProto.newBuilder();
+    builder.setSuccess(true);
+    return builder.build();
+  }
+
+
+  @Override
+  public Messages.AMSuicideResponseProto amSuicide(
+      Messages.AMSuicideRequestProto request)
+      throws IOException, YarnException {
+    onRpcCall("amsuicide");
+    int signal = request.getSignal();
+    String text = request.getText();
+    if (text == null) {
+      text = "";
+    }
+    int delay = request.getDelay();
+    log.info("AM Suicide with signal {}, message {} delay = {}", signal, text,
+        delay);
+    ActionHalt action = new ActionHalt(signal, text, delay,
+        TimeUnit.MILLISECONDS);
+    schedule(action);
+    return Messages.AMSuicideResponseProto.getDefaultInstance();
+  }
+}


[16/20] incubator-slider git commit: SLIDER-782 API test delegate now abstracted away for reuse by IPC client

Posted by st...@apache.org.
SLIDER-782 API test delegate now abstracted away for reuse by IPC client


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/1474abc4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/1474abc4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/1474abc4

Branch: refs/heads/develop
Commit: 1474abc4594654791a39be51ef27f630136ef1d1
Parents: 7e29699
Author: Steve Loughran <st...@apache.org>
Authored: Fri Feb 13 12:11:02 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Feb 13 12:11:02 2015 +0000

----------------------------------------------------------------------
 .../rest/AbstractAppApiTestDelegates.groovy     | 208 +++++++++++++++++++
 .../rest/RestAPIClientTestDelegates.groovy      | 183 +---------------
 2 files changed, 211 insertions(+), 180 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1474abc4/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
new file mode 100644
index 0000000..f510c5a
--- /dev/null
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
@@ -0,0 +1,208 @@
+/*
+ * 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.slider.agent.rest
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.slider.api.SliderApplicationApi
+import org.apache.slider.api.StateValues
+import org.apache.slider.api.types.ComponentInformation
+import org.apache.slider.api.types.ContainerInformation
+import org.apache.slider.core.conf.ConfTreeOperations
+import org.apache.slider.test.Outcome
+
+import static org.apache.slider.api.ResourceKeys.*
+import static org.apache.slider.api.StatusKeys.*
+import static org.apache.slider.common.SliderKeys.COMPONENT_AM
+
+@CompileStatic
+@Slf4j
+public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelegate {
+
+  protected SliderApplicationApi appAPI;
+
+  AbstractAppApiTestDelegates(
+      boolean enableComplexVerbs,
+      SliderApplicationApi appAPI) {
+    super(enableComplexVerbs)
+    this.appAPI = appAPI
+  }
+
+
+  public void testGetDesiredModel() throws Throwable {
+    appAPI.getDesiredModel()
+    appAPI.getDesiredAppconf()
+    appAPI.getDesiredResources()
+  }
+
+  public void testGetResolvedModel() throws Throwable {
+    appAPI.getResolvedModel()
+    appAPI.getResolvedAppconf()
+    appAPI.getResolvedResources()
+  }
+
+  public void testLiveResources() throws Throwable {
+    describe "Live Resources"
+
+    ConfTreeOperations tree = appAPI.getLiveResources()
+
+    log.info tree.toString()
+    def liveAM = tree.getComponent(COMPONENT_AM)
+    def desiredInstances = liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES);
+    assert desiredInstances ==
+           liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_ACTUAL)
+
+    assert 1 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_STARTED)
+    assert 0 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_REQUESTING)
+    assert 0 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_FAILED)
+    assert 0 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_COMPLETED)
+    assert 0 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_RELEASING)
+  }
+
+
+  public void testLiveContainers() throws Throwable {
+    describe "Application REST /live/containers"
+
+    Map<String, ContainerInformation> containers = appAPI.enumContainers()
+    assert containers.size() == 1
+    log.info "${containers}"
+    ContainerInformation amContainerInfo =
+        (ContainerInformation) containers.values()[0]
+    assert amContainerInfo.containerId
+
+    def amContainerId = amContainerInfo.containerId
+    assert containers[amContainerId]
+
+    assert amContainerInfo.component == COMPONENT_AM
+    assert amContainerInfo.createTime > 0
+    assert amContainerInfo.exitCode == null
+    assert amContainerInfo.output == null
+    assert amContainerInfo.released == null
+    assert amContainerInfo.state == StateValues.STATE_LIVE
+
+    describe "containers"
+
+    ContainerInformation amContainerInfo2 =
+        appAPI.getContainer(amContainerId)
+    assert amContainerInfo2.containerId == amContainerId
+
+    // fetch missing
+    try {
+      def result = appAPI.getContainer("unknown")
+      fail("expected an error, got $result")
+    } catch (FileNotFoundException expected) {
+      // expected
+    }
+
+
+    describe "components"
+
+    Map<String, ComponentInformation> components =
+        appAPI.enumComponents()
+
+    // two components
+    assert components.size() >= 1
+    log.info "${components}"
+
+    (ComponentInformation) components[COMPONENT_AM]
+
+    ComponentInformation amFullInfo = appAPI.getComponent(COMPONENT_AM)
+
+    assert amFullInfo.containers.size() == 1
+    assert amFullInfo.containers[0] == amContainerId
+
+  }
+
+  /**
+   * Test the rest model. For this to work the cluster has to be configured
+   * with the global option
+   * @param appmaster
+   */
+  public void testRESTModel() {
+    describe "model"
+
+    def unresolvedConf = appAPI.getDesiredModel() 
+//    log.info "Unresolved \n$unresolvedConf"
+    def unresolvedAppConf = unresolvedConf.appConfOperations
+
+    def sam = "slider-appmaster"
+    assert unresolvedAppConf.getComponentOpt(sam,
+        TEST_GLOBAL_OPTION, "") == ""
+    def resolvedConf = appAPI.getResolvedModel() 
+    assert resolvedConf.appConfOperations.getComponentOpt(
+        sam, TEST_GLOBAL_OPTION, "") == TEST_GLOBAL_OPTION_PRESENT
+
+    def unresolved = appAPI.getDesiredModel() 
+    assert null == 
+           unresolved.resources.components[sam][TEST_GLOBAL_OPTION] 
+    
+    
+    def resolvedAppconf = appAPI.getResolvedAppconf() 
+    assert TEST_GLOBAL_OPTION_PRESENT==
+           resolvedAppconf. components[sam][TEST_GLOBAL_OPTION]
+  }
+
+  public void testPing() {
+    // GET
+    describe "pinging"
+    
+    appAPI.ping("hello")
+  }
+  /**
+   * Test the stop command.
+   * Important: once executed, the AM is no longer there.
+   * This must be the last test in the sequence.
+   */
+  public void testStop() {
+
+    appAPI.stop("stop")
+
+    repeatUntilSuccess("probe for liveness",
+        this.&probeForLivenessFailing, STOP_WAIT_TIME, STOP_PROBE_INTERVAL,
+        [:],
+        true,
+        "AM failed to shut down") {
+      appAPI.getApplicationLiveness()
+    }
+    
+  }
+
+  public void testAppLiveness() {
+    def liveness = appAPI.applicationLiveness
+    describe "Liveness:\n$liveness"
+    
+    assert liveness.allRequestsSatisfied
+    assert !liveness.requestsOutstanding
+  }
+
+  /**
+   * Probe that spins until the liveness query fails
+   * @param args argument map
+   * @return the outcome
+   */
+  Outcome probeForLivenessFailing(Map args) {
+    try {
+      appAPI.getApplicationLiveness()
+      return Outcome.Retry
+    } catch (IOException expected) {
+      // expected
+      return Outcome.Success
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1474abc4/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
index 4532808..d57a2a1 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
@@ -22,20 +22,10 @@ import com.sun.jersey.api.client.Client
 import com.sun.jersey.api.client.WebResource
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
-import org.apache.slider.api.SliderApplicationApi
-import org.apache.slider.api.StateValues
-import org.apache.slider.api.types.ComponentInformation
-import org.apache.slider.api.types.ContainerInformation
 import org.apache.slider.client.rest.SliderApplicationApiRestClient
-import org.apache.slider.core.conf.ConfTreeOperations
-import org.apache.slider.test.Outcome
 
 import javax.ws.rs.core.MediaType
 
-import static org.apache.slider.api.ResourceKeys.COMPONENT_INSTANCES
-import static org.apache.slider.api.StatusKeys.*
-import static org.apache.slider.common.SliderKeys.COMPONENT_AM
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_CONTAINERS
 import static org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_APPLICATION
 
 /**
@@ -44,15 +34,12 @@ import static org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_
  */
 @CompileStatic
 @Slf4j
-class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
-
- 
-  final SliderApplicationApi appAPI;
+class RestAPIClientTestDelegates extends AbstractAppApiTestDelegates {
 
 
   RestAPIClientTestDelegates(String appmaster, Client jersey,
       boolean enableComplexVerbs = true) {
-    super(enableComplexVerbs)
+    super(enableComplexVerbs, null)
     WebResource amResource = jersey.resource(appmaster)
     amResource.type(MediaType.APPLICATION_JSON)
     def appResource = amResource.path(SLIDER_PATH_APPLICATION);
@@ -60,163 +47,6 @@ class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
   }
 
 
-  public void testGetDesiredModel() throws Throwable {
-      appAPI.getDesiredModel()  
-      appAPI.getDesiredAppconf()  
-      appAPI.getDesiredResources()  
-  }
-
-  public void testGetResolvedModel() throws Throwable {
-      appAPI.getResolvedModel()  
-      appAPI.getResolvedAppconf()  
-      appAPI.getResolvedResources()  
-  }
-
-  
-  public void testLiveResources() throws Throwable {
-    describe "Live Resources"
-
-    ConfTreeOperations tree = appAPI.getLiveResources()
-
-    log.info tree.toString()
-    def liveAM = tree.getComponent(COMPONENT_AM)
-    def desiredInstances = liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES);
-    assert desiredInstances ==
-           liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_ACTUAL)
-
-    assert 1 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_STARTED)
-    assert 0 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_REQUESTING)
-    assert 0 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_FAILED)
-    assert 0 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_COMPLETED)
-    assert 0 == liveAM.getMandatoryOptionInt(COMPONENT_INSTANCES_RELEASING)
-  }
-
-  public void testLiveContainers() throws Throwable {
-    describe "Application REST ${LIVE_CONTAINERS}"
-
-    Map<String, ContainerInformation> containers = appAPI.enumContainers()
-    assert containers.size() == 1
-    log.info "${containers}"
-    ContainerInformation amContainerInfo =
-        (ContainerInformation) containers.values()[0]
-    assert amContainerInfo.containerId
-
-    def amContainerId = amContainerInfo.containerId
-    assert containers[amContainerId]
-
-    assert amContainerInfo.component == COMPONENT_AM
-    assert amContainerInfo.createTime > 0
-    assert amContainerInfo.exitCode == null
-    assert amContainerInfo.output == null
-    assert amContainerInfo.released == null
-    assert amContainerInfo.state == StateValues.STATE_LIVE
-
-    describe "containers"
-
-    ContainerInformation amContainerInfo2 =
-        appAPI.getContainer(amContainerId)
-    assert amContainerInfo2.containerId == amContainerId
-
-    // fetch missing
-    try {
-      def result = appAPI.getContainer("unknown")
-      fail("expected an error, got $result")
-    } catch (FileNotFoundException e) {
-      // expected
-    }
-
-
-    describe "components"
-
-    Map<String, ComponentInformation> components =
-        appAPI.enumComponents()
-
-    // two components
-    assert components.size() >= 1
-    log.info "${components}"
-
-    ComponentInformation amComponentInfo =
-        (ComponentInformation) components[COMPONENT_AM]
-
-    ComponentInformation amFullInfo = appAPI.getComponent(COMPONENT_AM) 
-
-    assert amFullInfo.containers.size() == 1
-    assert amFullInfo.containers[0] == amContainerId
-
-  }
-
-  /**
-   * Test the rest model. For this to work the cluster has to be configured
-   * with the global option
-   * @param appmaster
-   */
-  public void testRESTModel() {
-    describe "model"
-
-    def unresolvedConf = appAPI.getDesiredModel() 
-//    log.info "Unresolved \n$unresolvedConf"
-    def unresolvedAppConf = unresolvedConf.appConfOperations
-
-    def sam = "slider-appmaster"
-    assert unresolvedAppConf.getComponentOpt(sam,
-        TEST_GLOBAL_OPTION, "") == ""
-    def resolvedConf = appAPI.getResolvedModel() 
-    assert resolvedConf.appConfOperations.getComponentOpt(
-        sam, TEST_GLOBAL_OPTION, "") == TEST_GLOBAL_OPTION_PRESENT
-
-    def unresolved = appAPI.getDesiredModel() 
-    assert null == 
-           unresolved.resources.components[sam][TEST_GLOBAL_OPTION] 
-    
-    
-    def resolvedAppconf = appAPI.getResolvedAppconf() 
-    assert TEST_GLOBAL_OPTION_PRESENT==
-           resolvedAppconf. components[sam][TEST_GLOBAL_OPTION]
-  }
-
-  public void testPing() {
-    // GET
-    describe "pinging"
-    
-    appAPI.ping("hello")
-  }
-
-
-  /**
-   * Test the stop command.
-   * Important: once executed, the AM is no longer there.
-   * This must be the last test in the sequence.
-   */
-
-  public void testStop() {
-
-    appAPI.stop("stop")
-
-    repeatUntilSuccess("probe for liveness",
-        this.&probeForLivenessFailing, STOP_WAIT_TIME, STOP_PROBE_INTERVAL,
-        [:],
-        true,
-        "AM failed to shut down") {
-      appAPI.getApplicationLiveness()
-    }
-    
-  }
-
-  /**
-   * Probe that spins until the liveness query fails
-   * @param args argument map
-   * @return the outcome
-   */
-  Outcome probeForLivenessFailing(Map args) {
-    try {
-      appAPI.getApplicationLiveness()
-      return Outcome.Retry
-    } catch (IOException e) {
-      // expected
-      return Outcome.Success
-    }
-  }
-
   public void testSuiteGetOperations() {
     testGetDesiredModel()
     testGetResolvedModel()
@@ -229,12 +59,5 @@ class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
   public void testSuiteComplexVerbs() {
     testPing();
   }
-  
-  public void testAppLiveness() {
-    def liveness = appAPI.applicationLiveness
-    describe "Liveness:\n$liveness"
-    
-    assert liveness.allRequestsSatisfied
-    assert !liveness.requestsOutstanding
-  }
+
 }


[13/20] incubator-slider git commit: SLIDER-782 rename RESTy API client to emphasise its not the IPC one

Posted by st...@apache.org.
SLIDER-782 rename RESTy API client to emphasise its not the IPC one


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/e155f649
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/e155f649
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/e155f649

Branch: refs/heads/develop
Commit: e155f649e72a70c1acf15d2e076b790305e1cf08
Parents: 77d3154
Author: Steve Loughran <st...@apache.org>
Authored: Thu Feb 12 18:17:24 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Feb 12 18:17:24 2015 +0000

----------------------------------------------------------------------
 .../slider/client/rest/RestClientFactory.java   |   2 +-
 .../client/rest/SliderApplicationApiClient.java | 255 -------------------
 .../rest/SliderApplicationApiRestClient.java    | 255 +++++++++++++++++++
 .../rest/RestAPIClientTestDelegates.groovy      |   8 +-
 4 files changed, 260 insertions(+), 260 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e155f649/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java b/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
index d337ffd..f0f7868 100644
--- a/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
+++ b/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
@@ -76,7 +76,7 @@ public class RestClientFactory {
    */
   public SliderApplicationApi createSliderAppApiClient(WebResource appmaster) {
     WebResource appResource = appmaster.path(SLIDER_PATH_APPLICATION);
-    return new SliderApplicationApiClient(jerseyClient, appResource);
+    return new SliderApplicationApiRestClient(jerseyClient, appResource);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e155f649/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiClient.java
deleted file mode 100644
index 8c920d5..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiClient.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * 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.slider.client.rest;
-
-import com.google.common.base.Preconditions;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.representation.Form;
-import org.apache.commons.lang.StringUtils;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.restclient.HttpVerb;
-import org.apache.slider.api.types.PingInformation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.util.Map;
-
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
-
-/**
- * Implementation of the {@link SliderApplicationApi}
- */
-public class SliderApplicationApiClient extends BaseRestClient
-      implements SliderApplicationApi {
-  private static final Logger log =
-      LoggerFactory.getLogger(SliderApplicationApiClient.class);
-  private WebResource appResource;
-
-  /**
-   * Create an instance
-   * @param jerseyClient jersey client for operations
-   * @param appResource resource of application API
-   */
-  public SliderApplicationApiClient(Client jerseyClient,
-      WebResource appResource) {
-    super(jerseyClient);
-    this.appResource = appResource;
-  }
-
-  /**
-   * Create a resource under the application path set up to accept
-   * JSON
-   * @param subpath path under application
-   * @return a resource under the application path
-   */
-  public WebResource applicationResource(String subpath) {
-    Preconditions.checkArgument(!StringUtils.isEmpty(subpath),
-        "empty path");
-    Preconditions.checkNotNull(appResource, "Null app resource");
-    WebResource resource = appResource.path(subpath);
-    resource.accept(MediaType.APPLICATION_JSON_TYPE);
-    return resource;
-  }
-  
-  /**
-   * Get operation against a path under the Application
-   * @param <T> type expected
-   * @param subpath path
-   * @param c class to instantiate
-   * @return instance
-   * @throws IOException on any problem
-   */
-  public <T> T getApplicationResource(String subpath, Class<T> c)
-      throws IOException {
-    return appResourceOperation(HttpVerb.GET, subpath, c);
-  } 
-  
-  /**
-   * Get operation against a path under the Application
-   * @param <T> type expected
-   * @param subpath path
-   * @param t type info
-   * @return instance
-   * @throws IOException on any problem
-   */
-  public <T> T getApplicationResource(String subpath, GenericType<T> t)
-      throws IOException {
-    return appResourceOperation(HttpVerb.GET, subpath, t);
-  }
-
-  /**
-   * 
-   * @param method method to exec
-   * @param <T> type expected
-   * @param subpath path
-   * @param c class to instantiate
-   * @return instance
-   * @throws IOException on any problem
-   */
-  public <T> T appResourceOperation(HttpVerb method, String subpath, Class<T> c)
-      throws IOException {
-    WebResource resource = applicationResource(subpath);
-    return exec(method, resource, c);
-  }
-  
-  
-  /**
-   * Get operation against a path under the Application
-   * @param <T> type expected
-   * @param subpath path
-   * @param t type info
-   * @return instance
-   * @throws IOException on any problem
-   */
-  public <T> T appResourceOperation(HttpVerb method, String subpath,
-      GenericType<T> t)
-      throws IOException {
-    WebResource resource = applicationResource(subpath);
-    return exec(method, resource, t);
-  }
-
-
-  @Override
-  public AggregateConf getDesiredModel() throws IOException {
-    return getApplicationResource(MODEL_DESIRED, AggregateConf.class);
-  }
-  
-  @Override
-  public ConfTreeOperations getDesiredAppconf() throws IOException {
-    ConfTree resource =
-        getApplicationResource(MODEL_DESIRED_APPCONF, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public ConfTreeOperations getDesiredYarnResources() throws IOException {
-    ConfTree resource =
-        getApplicationResource(MODEL_DESIRED_RESOURCES, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public AggregateConf getResolvedModel() throws IOException {
-    return getApplicationResource(MODEL_RESOLVED, AggregateConf.class);
-  }
-
-
-  @Override
-  public ConfTreeOperations getResolvedAppconf() throws IOException {
-    ConfTree resource =
-        getApplicationResource(MODEL_RESOLVED_APPCONF, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public ConfTreeOperations getResolvedYarnResources() throws IOException {
-    ConfTree resource =
-        getApplicationResource(MODEL_RESOLVED_RESOURCES, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public ConfTreeOperations getLiveYarnResources() throws IOException {
-    ConfTree resource =
-        getApplicationResource(LIVE_RESOURCES, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public Map<String, ContainerInformation> enumContainers() throws
-      IOException {
-    return getApplicationResource(LIVE_CONTAINERS,
-        new GenericType<Map<String, ContainerInformation>>() {
-        });
-  }
-
-  @Override
-  public ContainerInformation getContainer(String containerId) throws
-      IOException {
-    return getApplicationResource(LIVE_CONTAINERS + "/" + containerId,
-        ContainerInformation.class);
-  }
-
-  @Override
-  public Map<String, ComponentInformation> enumComponents() throws
-      IOException {
-    return getApplicationResource(LIVE_COMPONENTS,
-        new GenericType<Map<String, ComponentInformation>>() {
-        });
-  }
-
-  @Override
-  public ComponentInformation getComponent(String componentName) throws
-      IOException {
-    return getApplicationResource(LIVE_COMPONENTS + "/" + componentName,
-        ComponentInformation.class);
-  }
-
-  @Override
-  public PingInformation ping(String text) throws IOException {
-    return pingPost(text);
-  }
-  
-  /**
-   * Ping as a GET
-   * @param text text to include
-   * @return the response
-   * @throws IOException on any failure
-   */
-  public PingInformation pingGet(String text) throws IOException {
-    WebResource pingResource = applicationResource(ACTION_PING);
-    pingResource.getUriBuilder().queryParam("body", text);
-    return pingResource.get(PingInformation.class);
-  }
-  
-  /**
-   * Ping as a POST
-   * @param text text to include
-   * @return the response
-   * @throws IOException on any failure
-   */
-  public PingInformation pingPost(String text) throws IOException {
-    WebResource pingResource = applicationResource(ACTION_PING);
-    pingResource.type(MediaType.APPLICATION_JSON_TYPE);
-    Form f = new Form();
-    f.add("text", text);
-    return pingResource.post(PingInformation.class, f);
-  }
-
-  @Override
-  public void stop(String text) throws IOException {
-    WebResource resource = applicationResource(ACTION_STOP);
-    resource.post(text);
-  }
-
-  @Override
-  public ApplicationLivenessInformation getApplicationLiveness() throws IOException {
-    return getApplicationResource(LIVE_LIVENESS,
-        ApplicationLivenessInformation.class);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e155f649/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
new file mode 100644
index 0000000..ddb78ed
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
@@ -0,0 +1,255 @@
+/*
+ * 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.slider.client.rest;
+
+import com.google.common.base.Preconditions;
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.GenericType;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.representation.Form;
+import org.apache.commons.lang.StringUtils;
+import org.apache.slider.api.types.ApplicationLivenessInformation;
+import org.apache.slider.api.types.ComponentInformation;
+import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.core.conf.AggregateConf;
+import org.apache.slider.core.conf.ConfTree;
+import org.apache.slider.core.conf.ConfTreeOperations;
+import org.apache.slider.core.restclient.HttpVerb;
+import org.apache.slider.api.types.PingInformation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.core.MediaType;
+import java.io.IOException;
+import java.util.Map;
+
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
+
+/**
+ * Implementation of the {@link SliderApplicationApi}
+ */
+public class SliderApplicationApiRestClient extends BaseRestClient
+      implements SliderApplicationApi {
+  private static final Logger log =
+      LoggerFactory.getLogger(SliderApplicationApiRestClient.class);
+  private WebResource appResource;
+
+  /**
+   * Create an instance
+   * @param jerseyClient jersey client for operations
+   * @param appResource resource of application API
+   */
+  public SliderApplicationApiRestClient(Client jerseyClient,
+      WebResource appResource) {
+    super(jerseyClient);
+    this.appResource = appResource;
+  }
+
+  /**
+   * Create a resource under the application path set up to accept
+   * JSON
+   * @param subpath path under application
+   * @return a resource under the application path
+   */
+  public WebResource applicationResource(String subpath) {
+    Preconditions.checkArgument(!StringUtils.isEmpty(subpath),
+        "empty path");
+    Preconditions.checkNotNull(appResource, "Null app resource");
+    WebResource resource = appResource.path(subpath);
+    resource.accept(MediaType.APPLICATION_JSON_TYPE);
+    return resource;
+  }
+  
+  /**
+   * Get operation against a path under the Application
+   * @param <T> type expected
+   * @param subpath path
+   * @param c class to instantiate
+   * @return instance
+   * @throws IOException on any problem
+   */
+  public <T> T getApplicationResource(String subpath, Class<T> c)
+      throws IOException {
+    return appResourceOperation(HttpVerb.GET, subpath, c);
+  } 
+  
+  /**
+   * Get operation against a path under the Application
+   * @param <T> type expected
+   * @param subpath path
+   * @param t type info
+   * @return instance
+   * @throws IOException on any problem
+   */
+  public <T> T getApplicationResource(String subpath, GenericType<T> t)
+      throws IOException {
+    return appResourceOperation(HttpVerb.GET, subpath, t);
+  }
+
+  /**
+   * 
+   * @param method method to exec
+   * @param <T> type expected
+   * @param subpath path
+   * @param c class to instantiate
+   * @return instance
+   * @throws IOException on any problem
+   */
+  public <T> T appResourceOperation(HttpVerb method, String subpath, Class<T> c)
+      throws IOException {
+    WebResource resource = applicationResource(subpath);
+    return exec(method, resource, c);
+  }
+  
+  
+  /**
+   * Get operation against a path under the Application
+   * @param <T> type expected
+   * @param subpath path
+   * @param t type info
+   * @return instance
+   * @throws IOException on any problem
+   */
+  public <T> T appResourceOperation(HttpVerb method, String subpath,
+      GenericType<T> t)
+      throws IOException {
+    WebResource resource = applicationResource(subpath);
+    return exec(method, resource, t);
+  }
+
+
+  @Override
+  public AggregateConf getDesiredModel() throws IOException {
+    return getApplicationResource(MODEL_DESIRED, AggregateConf.class);
+  }
+  
+  @Override
+  public ConfTreeOperations getDesiredAppconf() throws IOException {
+    ConfTree resource =
+        getApplicationResource(MODEL_DESIRED_APPCONF, ConfTree.class);
+    return new ConfTreeOperations(resource); 
+  }
+
+  @Override
+  public ConfTreeOperations getDesiredYarnResources() throws IOException {
+    ConfTree resource =
+        getApplicationResource(MODEL_DESIRED_RESOURCES, ConfTree.class);
+    return new ConfTreeOperations(resource); 
+  }
+
+  @Override
+  public AggregateConf getResolvedModel() throws IOException {
+    return getApplicationResource(MODEL_RESOLVED, AggregateConf.class);
+  }
+
+
+  @Override
+  public ConfTreeOperations getResolvedAppconf() throws IOException {
+    ConfTree resource =
+        getApplicationResource(MODEL_RESOLVED_APPCONF, ConfTree.class);
+    return new ConfTreeOperations(resource); 
+  }
+
+  @Override
+  public ConfTreeOperations getResolvedYarnResources() throws IOException {
+    ConfTree resource =
+        getApplicationResource(MODEL_RESOLVED_RESOURCES, ConfTree.class);
+    return new ConfTreeOperations(resource); 
+  }
+
+  @Override
+  public ConfTreeOperations getLiveYarnResources() throws IOException {
+    ConfTree resource =
+        getApplicationResource(LIVE_RESOURCES, ConfTree.class);
+    return new ConfTreeOperations(resource); 
+  }
+
+  @Override
+  public Map<String, ContainerInformation> enumContainers() throws
+      IOException {
+    return getApplicationResource(LIVE_CONTAINERS,
+        new GenericType<Map<String, ContainerInformation>>() {
+        });
+  }
+
+  @Override
+  public ContainerInformation getContainer(String containerId) throws
+      IOException {
+    return getApplicationResource(LIVE_CONTAINERS + "/" + containerId,
+        ContainerInformation.class);
+  }
+
+  @Override
+  public Map<String, ComponentInformation> enumComponents() throws
+      IOException {
+    return getApplicationResource(LIVE_COMPONENTS,
+        new GenericType<Map<String, ComponentInformation>>() {
+        });
+  }
+
+  @Override
+  public ComponentInformation getComponent(String componentName) throws
+      IOException {
+    return getApplicationResource(LIVE_COMPONENTS + "/" + componentName,
+        ComponentInformation.class);
+  }
+
+  @Override
+  public PingInformation ping(String text) throws IOException {
+    return pingPost(text);
+  }
+  
+  /**
+   * Ping as a GET
+   * @param text text to include
+   * @return the response
+   * @throws IOException on any failure
+   */
+  public PingInformation pingGet(String text) throws IOException {
+    WebResource pingResource = applicationResource(ACTION_PING);
+    pingResource.getUriBuilder().queryParam("body", text);
+    return pingResource.get(PingInformation.class);
+  }
+  
+  /**
+   * Ping as a POST
+   * @param text text to include
+   * @return the response
+   * @throws IOException on any failure
+   */
+  public PingInformation pingPost(String text) throws IOException {
+    WebResource pingResource = applicationResource(ACTION_PING);
+    pingResource.type(MediaType.APPLICATION_JSON_TYPE);
+    Form f = new Form();
+    f.add("text", text);
+    return pingResource.post(PingInformation.class, f);
+  }
+
+  @Override
+  public void stop(String text) throws IOException {
+    WebResource resource = applicationResource(ACTION_STOP);
+    resource.post(text);
+  }
+
+  @Override
+  public ApplicationLivenessInformation getApplicationLiveness() throws IOException {
+    return getApplicationResource(LIVE_LIVENESS,
+        ApplicationLivenessInformation.class);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e155f649/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
index ca4be4d..d6cabfa 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
@@ -25,7 +25,7 @@ import groovy.util.logging.Slf4j
 import org.apache.slider.api.StateValues
 import org.apache.slider.api.types.ComponentInformation
 import org.apache.slider.api.types.ContainerInformation
-import org.apache.slider.client.rest.SliderApplicationApiClient
+import org.apache.slider.client.rest.SliderApplicationApiRestClient
 import org.apache.slider.core.conf.ConfTree
 import org.apache.slider.core.conf.ConfTreeOperations
 import org.apache.slider.server.appmaster.web.rest.application.ApplicationResource
@@ -40,7 +40,7 @@ import static org.apache.slider.server.appmaster.web.rest.RestPaths.*
 
 /**
  * Uses the Slider Application API for the tests.
- * {@link SliderApplicationApiClient}
+ * {@link SliderApplicationApiRestClient}
  */
 @CompileStatic
 @Slf4j
@@ -49,7 +49,7 @@ class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
   final String appmaster;
   final String application;
   final Client jersey;
-  final SliderApplicationApiClient appAPI;
+  final SliderApplicationApiRestClient appAPI;
 
 
   RestAPIClientTestDelegates(String appmaster, Client jersey,
@@ -61,7 +61,7 @@ class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
     WebResource amResource = jersey.resource(appmaster)
     amResource.type(MediaType.APPLICATION_JSON)
     def appResource = amResource.path(SLIDER_PATH_APPLICATION);
-    appAPI = new SliderApplicationApiClient(jersey, appResource)
+    appAPI = new SliderApplicationApiRestClient(jersey, appResource)
   }
 
 


[04/20] incubator-slider git commit: SLIDER-782: cut out the SliderClusterProtocol element from the WebAppAPI; it should not be needed

Posted by st...@apache.org.
SLIDER-782: cut out the SliderClusterProtocol element from the WebAppAPI; it should not be needed


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/c94965f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/c94965f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/c94965f5

Branch: refs/heads/develop
Commit: c94965f59a75317fee13fab3a3a72bd9e43aab08
Parents: 4b56e54
Author: Steve Loughran <st...@apache.org>
Authored: Wed Feb 11 20:52:50 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Feb 11 20:52:50 2015 +0000

----------------------------------------------------------------------
 .../server/appmaster/SliderAppMaster.java       |   2 +-
 .../slider/server/appmaster/web/WebAppApi.java  |   5 -
 .../server/appmaster/web/WebAppApiImpl.java     |  12 +-
 .../appmaster/web/view/ContainerStatsBlock.java |  48 ++++----
 .../appstate/StubSliderClusterProtocol.groovy   | 111 -------------------
 .../TestMockAppStateAppRestIntegration.groovy   |   3 +-
 .../view/TestClusterSpecificationBlock.groovy   |   1 -
 .../web/view/TestContainerStatsBlock.groovy     |   1 -
 .../appmaster/web/view/TestIndexBlock.groovy    |   1 -
 .../web/rest/agent/TestAMAgentWebServices.java  |   3 +-
 .../management/TestAMManagementWebServices.java |   3 +-
 11 files changed, 31 insertions(+), 159 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index 7f3211e..f18fb2c 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -922,7 +922,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
       // Web service endpoints: initialize
 
       WebAppApiImpl webAppApi =
-          new WebAppApiImpl(this,
+          new WebAppApiImpl(
               stateForProviders,
               providerService,
               certificateManager,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
index e198e35..f1bff64 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
@@ -52,11 +52,6 @@ public interface WebAppApi {
   CertificateManager getCertificateManager();
 
   /**
-   * The {@link SliderClusterProtocol} for the current cluster
-   */
-  SliderClusterProtocol getClusterProtocol();
-  
-  /**
    * Generate a mapping from role name to its {@link RoleStatus}. Be aware that this
    * is a computed value and not just a getter
    */

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
index 4eb984f..a7d85af 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
@@ -17,7 +17,6 @@
 package org.apache.slider.server.appmaster.web;
 
 import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.providers.ProviderService;
 import org.apache.slider.server.appmaster.AppMasterActionOperations;
 import org.apache.slider.server.appmaster.actions.QueueAccess;
@@ -41,7 +40,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
 public class WebAppApiImpl implements WebAppApi {
   private static final Logger log = LoggerFactory.getLogger(WebAppApiImpl.class);
 
-  protected final SliderClusterProtocol clusterProto;
   protected final StateAccessForProviders appState;
   protected final ProviderService provider;
   protected final CertificateManager certificateManager;
@@ -50,8 +48,7 @@ public class WebAppApiImpl implements WebAppApi {
   private final QueueAccess queues;
   private final AppMasterActionOperations appMasterOperations;
 
-  public WebAppApiImpl(SliderClusterProtocol clusterProto,
-      StateAccessForProviders appState,
+  public WebAppApiImpl(StateAccessForProviders appState,
       ProviderService provider,
       CertificateManager certificateManager,
       RegistryOperations registryOperations,
@@ -59,13 +56,11 @@ public class WebAppApiImpl implements WebAppApi {
       QueueAccess queues,
       AppMasterActionOperations appMasterOperations) {
     this.appMasterOperations = appMasterOperations;
-    checkNotNull(clusterProto);
     checkNotNull(appState);
     checkNotNull(provider);
     this.queues = queues;
 
     this.registryOperations = registryOperations;
-    this.clusterProto = clusterProto;
     this.appState = appState;
     this.provider = provider;
     this.certificateManager = certificateManager;
@@ -88,11 +83,6 @@ public class WebAppApiImpl implements WebAppApi {
   }
 
   @Override
-  public SliderClusterProtocol getClusterProtocol() {
-    return clusterProto;
-  }
-  
-  @Override
   public Map<String,RoleStatus> getRoleStatusByName() {
     List<RoleStatus> roleStatuses = appState.cloneRoleStatusList();
     Map<String, RoleStatus> map =

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ContainerStatsBlock.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ContainerStatsBlock.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ContainerStatsBlock.java
index 95f0417..da5ff05 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ContainerStatsBlock.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ContainerStatsBlock.java
@@ -29,13 +29,14 @@ import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR;
 import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
 import org.apache.slider.api.ClusterDescription;
 import org.apache.slider.api.ClusterNode;
-import org.apache.slider.client.SliderClusterOperations;
+import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.state.RoleStatus;
+import org.apache.slider.server.appmaster.state.StateAccessForProviders;
 import org.apache.slider.server.appmaster.web.WebAppApi;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -55,12 +56,10 @@ public class ContainerStatsBlock extends HtmlBlock {
   protected static final Function<Entry<String,String>,Entry<TableContent,String>> stringStringPairFunc = toTableContentFunction();
 
   private WebAppApi slider;
-  private SliderClusterOperations clusterOps;
 
   @Inject
   public ContainerStatsBlock(WebAppApi slider) {
     this.slider = slider;
-    clusterOps = new SliderClusterOperations(slider.getClusterProtocol());
   }
 
   /**
@@ -94,29 +93,33 @@ public class ContainerStatsBlock extends HtmlBlock {
 
   @Override
   protected void render(Block html) {
-    // TODO Probably better to just get a copy of this list for us to avoid the repeated synchronization?
-    // does this change if we have 50 node, 100node, 500 node clusters?
-    final Map<String,RoleInstance> containerInstances = getContainerInstances(slider.getAppState().cloneOwnedContainerList());
+    StateAccessForProviders appState = slider.getAppState();
+    final Map<String,RoleInstance> containerInstances = getContainerInstances(
+        appState.cloneOwnedContainerList());
 
-    for (Entry<String,RoleStatus> entry : slider.getRoleStatusByName().entrySet()) {
+    Map<String, Map<String, ClusterNode>> clusterNodeMap =
+        appState.getRoleClusterNodeMapping();
+    Map<String, ComponentInformation> componentInfoMap = appState.getComponentInfoSnapshot();
+
+    for (Entry<String, Map<String, ClusterNode>> entry : clusterNodeMap.entrySet()) {
       final String name = entry.getKey();
-      final RoleStatus roleStatus = entry.getValue();
+      Map<String, ClusterNode> clusterNodesInRole = entry.getValue();
+      //final RoleStatus roleStatus = entry.getValue();
 
       DIV<Hamlet> div = html.div("role-info ui-widget-content ui-corner-all");
 
-      List<ClusterNode> nodesInRole;
-      try {
-        nodesInRole = clusterOps.listClusterNodesInRole(name);
-      } catch (Exception e) {
-        log.error("Could not fetch containers for role: " + name, e);
-        nodesInRole = Collections.emptyList();
-      }
+      List<ClusterNode> nodesInRole =
+          new ArrayList<ClusterNode>(clusterNodesInRole.values());
 
       div.h2(BOLD, StringUtils.capitalize(name));
 
       // Generate the details on this role
-      Iterable<Entry<String,Integer>> stats = roleStatus.buildStatistics().entrySet();
-      generateRoleDetails(div,"role-stats-wrap", "Specifications", Iterables.transform(stats, stringIntPairFunc));
+      ComponentInformation componentInfo = componentInfoMap.get(name);
+      if (componentInfo != null) {
+        Iterable<Entry<String,Integer>> stats = componentInfo.buildStatistics().entrySet();
+        generateRoleDetails(div,"role-stats-wrap", "Specifications", 
+            Iterables.transform(stats, stringIntPairFunc));
+      }
 
       // Sort the ClusterNodes by their name (containerid)
       Collections.sort(nodesInRole, new ClusterNodeNameComparator());
@@ -133,7 +136,8 @@ public class ContainerStatsBlock extends HtmlBlock {
                 RoleInstance roleInst = containerInstances.get(containerId);
                 if (roleInst.container.getNodeHttpAddress() != null) {
                   return Maps.<TableContent,String> immutableEntry(
-                    new TableAnchorContent(containerId, buildNodeUrlForContainer(roleInst.container.getNodeHttpAddress(), containerId)), null);
+                    new TableAnchorContent(containerId,
+                        buildNodeUrlForContainer(roleInst.container.getNodeHttpAddress(), containerId)), null);
                 }
               }
               return Maps.immutableEntry(new TableContent(input.name), null);
@@ -141,9 +145,9 @@ public class ContainerStatsBlock extends HtmlBlock {
 
           }));
 
-      ClusterDescription desc = slider.getAppState().getClusterStatus();
-      Map<String,String> options = desc.getRole(name);
-      Iterable<Entry<TableContent,String>> tableContent;
+      ClusterDescription desc = appState.getClusterStatus();
+      Map<String, String> options = desc.getRole(name);
+      Iterable<Entry<TableContent, String>> tableContent;
       
       // Generate the pairs of data in the expected form
       if (null != options) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/StubSliderClusterProtocol.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/StubSliderClusterProtocol.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/StubSliderClusterProtocol.groovy
deleted file mode 100644
index eb05d61..0000000
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/StubSliderClusterProtocol.groovy
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.slider.server.appmaster.model.appstate
-
-import org.apache.hadoop.ipc.ProtocolSignature
-import org.apache.hadoop.yarn.exceptions.YarnException
-import org.apache.slider.api.SliderClusterProtocol
-import org.apache.slider.api.proto.Messages
-
-/**
- * Stub implementation of the Protobuf <code>SliderClusterProtocol</code>
- */
-class StubSliderClusterProtocol implements SliderClusterProtocol {
-  @Override
-  Messages.StopClusterResponseProto stopCluster(
-      Messages.StopClusterRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  Messages.FlexClusterResponseProto flexCluster(
-      Messages.FlexClusterRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(
-      Messages.GetJSONClusterStatusRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(
-      Messages.ListNodeUUIDsByRoleRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  Messages.GetClusterNodesResponseProto getClusterNodes(
-      Messages.GetClusterNodesRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  Messages.EchoResponseProto echo(Messages.EchoRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  Messages.KillContainerResponseProto killContainer(
-      Messages.KillContainerRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  Messages.AMSuicideResponseProto amSuicide(
-      Messages.AMSuicideRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
-      Messages.GetInstanceDefinitionRequestProto request)
-  throws IOException, YarnException {
-    throw new UnsupportedOperationException()
-  }
-
-  @Override
-  long getProtocolVersion(String protocol, long clientVersion)
-  throws IOException {
-    return 0
-  }
-
-  @Override
-  ProtocolSignature getProtocolSignature(
-      String protocol,
-      long clientVersion,
-      int clientMethodsHash) throws IOException {
-    throw new UnsupportedOperationException()
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
index a43ee1e..e42f13c 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
@@ -114,8 +114,7 @@ class TestMockAppStateAppRestIntegration extends BaseMockAppStateTest implements
   }
 
   public WebAppApi getWebAppApi() {
-    WebAppApi api = new WebAppApiImpl(new StubSliderClusterProtocol(),
-        stateAccess,
+    WebAppApi api = new WebAppApiImpl(stateAccess,
         new MockProviderService(),
         null, null,
         new MetricsAndMonitoring("metrics"), null, null)

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
index 8976f1c..d6482a5 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
@@ -53,7 +53,6 @@ public class TestClusterSpecificationBlock {
     ProviderService providerService = new MockProviderService();
 
     WebAppApiImpl inst = new WebAppApiImpl(
-        clusterProto,
         providerAppState,
         providerService,
         null,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
index 297b8e7..f3283c4 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
@@ -60,7 +60,6 @@ public class TestContainerStatsBlock extends BaseMockAppStateTest {
         appState)
 
     WebAppApiImpl inst = new WebAppApiImpl(
-        clusterProto,
         providerAppState,
         providerService,
         null,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
index 4a053fd..4b91ca0 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
@@ -52,7 +52,6 @@ public class TestIndexBlock extends BaseMockAppStateTest {
         appState)
 
     WebAppApiImpl inst = new WebAppApiImpl(
-        clusterProto,
         providerAppState,
         providerService,
         null,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
index b75d51d..edfebbd 100644
--- a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
+++ b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
@@ -38,7 +38,6 @@ import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
 import org.apache.slider.server.appmaster.model.mock.MockFactory;
 import org.apache.slider.server.appmaster.model.mock.MockProviderService;
 import org.apache.slider.server.appmaster.model.mock.MockRecordFactory;
-import org.apache.slider.server.appmaster.model.mock.MockSliderClusterProtocol;
 import org.apache.slider.server.appmaster.state.AppState;
 import org.apache.slider.server.appmaster.state.ProviderAppState;
 import org.apache.slider.server.appmaster.state.SimpleReleaseSelector;
@@ -143,7 +142,7 @@ public class TestAMAgentWebServices {
     ProviderAppState providerAppState = new ProviderAppState("undefined",
                                                              appState);
 
-    slider = new WebAppApiImpl(new MockSliderClusterProtocol(), providerAppState,
+    slider = new WebAppApiImpl(providerAppState,
                                new MockProviderService(), null, null, null,
         null, null);
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c94965f5/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
index 5a6ec96..badfbc3 100644
--- a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
+++ b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
@@ -43,7 +43,6 @@ import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
 import org.apache.slider.server.appmaster.model.mock.MockFactory;
 import org.apache.slider.server.appmaster.model.mock.MockProviderService;
 import org.apache.slider.server.appmaster.model.mock.MockRecordFactory;
-import org.apache.slider.server.appmaster.model.mock.MockSliderClusterProtocol;
 import org.apache.slider.server.appmaster.state.AppState;
 import org.apache.slider.server.appmaster.state.ProviderAppState;
 import org.apache.slider.server.appmaster.state.SimpleReleaseSelector;
@@ -191,7 +190,7 @@ public class TestAMManagementWebServices extends JerseyTest {
         ProviderAppState providerAppState = new ProviderAppState("undefined",
             appState);
 
-        slider = new WebAppApiImpl(new MockSliderClusterProtocol(), providerAppState,
+        slider = new WebAppApiImpl(providerAppState,
                                    new MockProviderService(), null, null, null,
             null, null);
 


[08/20] incubator-slider git commit: SLIDER-782 new messages & RPC calls defined; , marshall and indirect code in progress

Posted by st...@apache.org.
SLIDER-782 new messages & RPC calls defined;, marshall and indirect code in progress


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/bc15807c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/bc15807c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/bc15807c

Branch: refs/heads/develop
Commit: bc15807cbfe32b0dc4ea9591d7a9a64ba2e1055b
Parents: ae6f813
Author: Steve Loughran <st...@apache.org>
Authored: Thu Feb 12 14:48:59 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Feb 12 14:48:59 2015 +0000

----------------------------------------------------------------------
 .../slider/api/SliderClusterProtocol.java       |    11 +
 .../org/apache/slider/api/proto/Messages.java   | 11626 ++++++++++++++++-
 .../slider/api/proto/RestTypeMarshalling.java   |   133 +
 .../slider/api/proto/SliderClusterAPI.java      |   396 +-
 .../slider/api/types/ComponentInformation.java  |     2 +-
 .../slider/client/SliderClusterOperations.java  |    23 +-
 .../rpc/SliderClusterProtocolPBImpl.java        |    12 +-
 .../rpc/SliderClusterProtocolProxy.java         |    54 +-
 .../server/appmaster/rpc/SliderIPCService.java  |    34 +-
 .../src/main/proto/SliderClusterMessages.proto  |   131 +-
 .../src/main/proto/SliderClusterProtocol.proto  |    55 +-
 .../model/mock/MockSliderClusterProtocol.groovy |   108 -
 .../view/TestClusterSpecificationBlock.groovy   |     3 -
 .../web/view/TestContainerStatsBlock.groovy     |     1 -
 .../appmaster/web/view/TestIndexBlock.groovy    |     1 -
 15 files changed, 12374 insertions(+), 216 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java b/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
index fc5c21b..556e918 100644
--- a/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
+++ b/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
@@ -22,6 +22,7 @@ import org.apache.hadoop.ipc.VersionedProtocol;
 import org.apache.hadoop.security.KerberosInfo;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.slider.api.proto.Messages;
+import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.common.SliderXmlConfKeys;
 
 import java.io.IOException;
@@ -118,4 +119,14 @@ public interface SliderClusterProtocol extends VersionedProtocol {
   Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
     Messages.GetInstanceDefinitionRequestProto request)
     throws IOException, YarnException;
+
+  /**
+   * Get the application liveness
+   * @return current liveness information
+   * @throws IOException
+   */
+  Messages.ApplicationLivenessInformationProto getLivenessInformation(
+      Messages.GetApplicationLivenessRequestProto request
+  ) throws IOException;
+
 }


[12/20] incubator-slider git commit: SLIDER-782 import cleanup

Posted by st...@apache.org.
SLIDER-782 import cleanup


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/77d3154b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/77d3154b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/77d3154b

Branch: refs/heads/develop
Commit: 77d3154b4ffa2d78203caf97959651e3a8a59a70
Parents: eb14df4
Author: Steve Loughran <st...@apache.org>
Authored: Thu Feb 12 18:16:24 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Feb 12 18:16:24 2015 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/slider/client/SliderClientAPI.java   | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/77d3154b/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java b/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
index 836891d..4fd4136 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
@@ -18,8 +18,6 @@
 
 package org.apache.slider.client;
 
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.registry.client.api.RegistryOperations;
 import org.apache.hadoop.service.Service;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
@@ -47,7 +45,6 @@ import org.apache.slider.core.exceptions.SliderException;
 import org.apache.slider.providers.AbstractClientProvider;
 
 import java.io.IOException;
-import java.util.List;
 import java.util.Map;
 
 /**


[06/20] incubator-slider git commit: SLIDER-782 new messages & RPC calls defined; , marshall and indirect code in progress

Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
new file mode 100644
index 0000000..dffe239
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
@@ -0,0 +1,133 @@
+/*
+ * 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.slider.api.proto;
+
+import org.apache.slider.api.types.ApplicationLivenessInformation;
+import org.apache.slider.api.types.ComponentInformation;
+import org.apache.slider.api.types.ContainerInformation;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+
+/**
+ * Class to handle marshalling of REST
+ * types to/from Protobuf records.
+ */
+public class RestTypeMarshalling {
+
+  public static Messages.ApplicationLivenessInformationProto
+  marshall(ApplicationLivenessInformation info) {
+
+    Messages.ApplicationLivenessInformationProto.Builder builder =
+        Messages.ApplicationLivenessInformationProto.newBuilder();
+    builder.setAllRequestsSatisfied(info.allRequestsSatisfied);
+    builder.setRequestsOutstanding(info.requestsOutstanding);
+    return builder.build();
+  }
+
+  public static ApplicationLivenessInformation
+  unmarshall(Messages.ApplicationLivenessInformationProto wire) {
+    ApplicationLivenessInformation info = new ApplicationLivenessInformation();
+    info.allRequestsSatisfied = wire.getAllRequestsSatisfied();
+    info.requestsOutstanding = wire.getRequestsOutstanding();
+    return info;
+  }
+
+  public static Messages.ComponentInformationProto
+  marshall(ComponentInformation info) {
+
+    Messages.ComponentInformationProto.Builder builder =
+        Messages.ComponentInformationProto.newBuilder();
+    builder.setName(info.name);
+    builder.setPriority(info.priority);
+    builder.setPlacementPolicy(info.placementPolicy);
+    builder.setDesired(info.desired);
+    builder.setActual(info.actual);
+    builder.setReleasing(info.releasing);
+    builder.setRequested(info.requested);
+    builder.setFailed(info.failed);
+    builder.setStarted(info.started);
+    builder.setStartFailed(info.startFailed);
+    builder.setCompleted(info.completed);
+    builder.setTotalRequested(info.totalRequested);
+    if (info.failureMessage !=null) {
+      builder.setFailureMessage(info.failureMessage);
+    }
+    if (info.containers != null) {
+      builder.addAllContainers(info.containers);
+    }
+    return builder.build();
+  }
+
+  public static ContainerInformation
+  unmarshall(Messages.ContainerInformationProto wire) {
+    ContainerInformation info = new ContainerInformation();
+    info.containerId = wire.getContainerId();
+    info.component = wire.getComponent();
+    info.released = wire.getReleased();
+    if (wire.hasReleased()) {
+    }
+    info.state = wire.getDesired();
+    info.exitCode = wire.getActual();
+    info.released = wire.getReleasing();
+    info.diagnostics = wire.getRequested();
+    info.createTime = wire.getFailed();
+    info.startTime = wire.getStarted();
+    info.host = wire.getStartFailed();
+    info.hostURL = wire.getCompleted();
+    info.totalRequested = wire.getTotalRequested();
+    if (wire.hasFailureMessage()) {
+      info.failureMessage = wire.getFailureMessage();
+    }
+    info.output = Collections.a 
+        new ArrayList<String>(wire.getOutputList());
+    return info;
+  }
+
+  public static Messages.ContainerInformationProto
+  marshall(ContainerInformation info) {
+
+    Messages.ContainerInformationProto.Builder builder =
+        Messages.ContainerInformationProto.newBuilder();
+    return builder.build();
+  }
+
+  public static ContainerInformation
+  unmarshall(Messages.ContainerInformationProto wire) {
+    ContainerInformation info = new ContainerInformation();
+    info.name = wire.getName();
+    info.priority = wire.getPriority();
+    info.placementPolicy = wire.getPlacementPolicy();
+    info.desired = wire.getDesired();
+    info.actual = wire.getActual();
+    info.releasing = wire.getReleasing();
+    info.requested = wire.getRequested();
+    info.failed = wire.getFailed();
+    info.started = wire.getStarted();
+    info.startFailed = wire.getStartFailed();
+    info.completed = wire.getCompleted();
+    info.totalRequested = wire.getTotalRequested();
+    if (wire.hasFailureMessage()) {
+      info.failureMessage = wire.getFailureMessage();
+    }
+    info.containers = new ArrayList<String>(wire.getContainersList());
+    return info;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java b/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
index 75bf05b..b97a6e6 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
@@ -1,22 +1,6 @@
-/*
- * 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.
- */
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: SliderClusterProtocol.proto
+
 package org.apache.slider.api.proto;
 
 public final class SliderClusterAPI {
@@ -165,6 +149,46 @@ public final class SliderClusterAPI {
           org.apache.slider.api.proto.Messages.AMSuicideRequestProto request,
           com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.AMSuicideResponseProto> done);
 
+      /**
+       * <code>rpc getLivenessInformation(.org.apache.slider.api.GetApplicationLivenessRequestProto) returns (.org.apache.slider.api.ApplicationLivenessInformationProto);</code>
+       */
+      public abstract void getLivenessInformation(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto> done);
+
+      /**
+       * <code>rpc getLiveContainers(.org.apache.slider.api.GetLiveContainersRequestProto) returns (.org.apache.slider.api.GetLiveContainersResponseProto);</code>
+       */
+      public abstract void getLiveContainers(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto> done);
+
+      /**
+       * <code>rpc getLiveContainer(.org.apache.slider.api.GetLiveContainerRequestProto) returns (.org.apache.slider.api.ContainerInformationProto);</code>
+       */
+      public abstract void getLiveContainer(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ContainerInformationProto> done);
+
+      /**
+       * <code>rpc getLiveComponents(.org.apache.slider.api.GetLiveComponentsRequestProto) returns (.org.apache.slider.api.GetLiveComponentsResponseProto);</code>
+       */
+      public abstract void getLiveComponents(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto> done);
+
+      /**
+       * <code>rpc getLiveComponent(.org.apache.slider.api.GetLiveComponentRequestProto) returns (.org.apache.slider.api.ComponentInformationProto);</code>
+       */
+      public abstract void getLiveComponent(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done);
+
     }
 
     public static com.google.protobuf.Service newReflectiveService(
@@ -250,6 +274,46 @@ public final class SliderClusterAPI {
           impl.amSuicide(controller, request, done);
         }
 
+        @java.lang.Override
+        public  void getLivenessInformation(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto> done) {
+          impl.getLivenessInformation(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getLiveContainers(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto> done) {
+          impl.getLiveContainers(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getLiveContainer(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ContainerInformationProto> done) {
+          impl.getLiveContainer(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getLiveComponents(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto> done) {
+          impl.getLiveComponents(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getLiveComponent(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done) {
+          impl.getLiveComponent(controller, request, done);
+        }
+
       };
     }
 
@@ -292,6 +356,16 @@ public final class SliderClusterAPI {
               return impl.killContainer(controller, (org.apache.slider.api.proto.Messages.KillContainerRequestProto)request);
             case 9:
               return impl.amSuicide(controller, (org.apache.slider.api.proto.Messages.AMSuicideRequestProto)request);
+            case 10:
+              return impl.getLivenessInformation(controller, (org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto)request);
+            case 11:
+              return impl.getLiveContainers(controller, (org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto)request);
+            case 12:
+              return impl.getLiveContainer(controller, (org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto)request);
+            case 13:
+              return impl.getLiveComponents(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto)request);
+            case 14:
+              return impl.getLiveComponent(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto)request);
             default:
               throw new java.lang.AssertionError("Can't get here.");
           }
@@ -326,6 +400,16 @@ public final class SliderClusterAPI {
               return org.apache.slider.api.proto.Messages.KillContainerRequestProto.getDefaultInstance();
             case 9:
               return org.apache.slider.api.proto.Messages.AMSuicideRequestProto.getDefaultInstance();
+            case 10:
+              return org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto.getDefaultInstance();
+            case 11:
+              return org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto.getDefaultInstance();
+            case 12:
+              return org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto.getDefaultInstance();
+            case 13:
+              return org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto.getDefaultInstance();
+            case 14:
+              return org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto.getDefaultInstance();
             default:
               throw new java.lang.AssertionError("Can't get here.");
           }
@@ -360,6 +444,16 @@ public final class SliderClusterAPI {
               return org.apache.slider.api.proto.Messages.KillContainerResponseProto.getDefaultInstance();
             case 9:
               return org.apache.slider.api.proto.Messages.AMSuicideResponseProto.getDefaultInstance();
+            case 10:
+              return org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance();
+            case 11:
+              return org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.getDefaultInstance();
+            case 12:
+              return org.apache.slider.api.proto.Messages.ContainerInformationProto.getDefaultInstance();
+            case 13:
+              return org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance();
+            case 14:
+              return org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance();
             default:
               throw new java.lang.AssertionError("Can't get here.");
           }
@@ -496,6 +590,46 @@ public final class SliderClusterAPI {
         org.apache.slider.api.proto.Messages.AMSuicideRequestProto request,
         com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.AMSuicideResponseProto> done);
 
+    /**
+     * <code>rpc getLivenessInformation(.org.apache.slider.api.GetApplicationLivenessRequestProto) returns (.org.apache.slider.api.ApplicationLivenessInformationProto);</code>
+     */
+    public abstract void getLivenessInformation(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto> done);
+
+    /**
+     * <code>rpc getLiveContainers(.org.apache.slider.api.GetLiveContainersRequestProto) returns (.org.apache.slider.api.GetLiveContainersResponseProto);</code>
+     */
+    public abstract void getLiveContainers(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto> done);
+
+    /**
+     * <code>rpc getLiveContainer(.org.apache.slider.api.GetLiveContainerRequestProto) returns (.org.apache.slider.api.ContainerInformationProto);</code>
+     */
+    public abstract void getLiveContainer(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ContainerInformationProto> done);
+
+    /**
+     * <code>rpc getLiveComponents(.org.apache.slider.api.GetLiveComponentsRequestProto) returns (.org.apache.slider.api.GetLiveComponentsResponseProto);</code>
+     */
+    public abstract void getLiveComponents(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto> done);
+
+    /**
+     * <code>rpc getLiveComponent(.org.apache.slider.api.GetLiveComponentRequestProto) returns (.org.apache.slider.api.ComponentInformationProto);</code>
+     */
+    public abstract void getLiveComponent(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done);
+
     public static final
         com.google.protobuf.Descriptors.ServiceDescriptor
         getDescriptor() {
@@ -568,6 +702,31 @@ public final class SliderClusterAPI {
             com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.AMSuicideResponseProto>specializeCallback(
               done));
           return;
+        case 10:
+          this.getLivenessInformation(controller, (org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto>specializeCallback(
+              done));
+          return;
+        case 11:
+          this.getLiveContainers(controller, (org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto>specializeCallback(
+              done));
+          return;
+        case 12:
+          this.getLiveContainer(controller, (org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.ContainerInformationProto>specializeCallback(
+              done));
+          return;
+        case 13:
+          this.getLiveComponents(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto>specializeCallback(
+              done));
+          return;
+        case 14:
+          this.getLiveComponent(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.ComponentInformationProto>specializeCallback(
+              done));
+          return;
         default:
           throw new java.lang.AssertionError("Can't get here.");
       }
@@ -602,6 +761,16 @@ public final class SliderClusterAPI {
           return org.apache.slider.api.proto.Messages.KillContainerRequestProto.getDefaultInstance();
         case 9:
           return org.apache.slider.api.proto.Messages.AMSuicideRequestProto.getDefaultInstance();
+        case 10:
+          return org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto.getDefaultInstance();
+        case 11:
+          return org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto.getDefaultInstance();
+        case 12:
+          return org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto.getDefaultInstance();
+        case 13:
+          return org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto.getDefaultInstance();
+        case 14:
+          return org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto.getDefaultInstance();
         default:
           throw new java.lang.AssertionError("Can't get here.");
       }
@@ -636,6 +805,16 @@ public final class SliderClusterAPI {
           return org.apache.slider.api.proto.Messages.KillContainerResponseProto.getDefaultInstance();
         case 9:
           return org.apache.slider.api.proto.Messages.AMSuicideResponseProto.getDefaultInstance();
+        case 10:
+          return org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance();
+        case 11:
+          return org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.getDefaultInstance();
+        case 12:
+          return org.apache.slider.api.proto.Messages.ContainerInformationProto.getDefaultInstance();
+        case 13:
+          return org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance();
+        case 14:
+          return org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance();
         default:
           throw new java.lang.AssertionError("Can't get here.");
       }
@@ -806,6 +985,81 @@ public final class SliderClusterAPI {
             org.apache.slider.api.proto.Messages.AMSuicideResponseProto.class,
             org.apache.slider.api.proto.Messages.AMSuicideResponseProto.getDefaultInstance()));
       }
+
+      public  void getLivenessInformation(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(10),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.class,
+            org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance()));
+      }
+
+      public  void getLiveContainers(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(11),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.class,
+            org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.getDefaultInstance()));
+      }
+
+      public  void getLiveContainer(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ContainerInformationProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(12),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.ContainerInformationProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.ContainerInformationProto.class,
+            org.apache.slider.api.proto.Messages.ContainerInformationProto.getDefaultInstance()));
+      }
+
+      public  void getLiveComponents(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(13),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.class,
+            org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance()));
+      }
+
+      public  void getLiveComponent(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(14),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.ComponentInformationProto.class,
+            org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance()));
+      }
     }
 
     public static BlockingInterface newBlockingStub(
@@ -863,6 +1117,31 @@ public final class SliderClusterAPI {
           com.google.protobuf.RpcController controller,
           org.apache.slider.api.proto.Messages.AMSuicideRequestProto request)
           throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto getLivenessInformation(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto getLiveContainers(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.ContainerInformationProto getLiveContainer(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto getLiveComponents(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.ComponentInformationProto getLiveComponent(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request)
+          throws com.google.protobuf.ServiceException;
     }
 
     private static final class BlockingStub implements BlockingInterface {
@@ -991,6 +1270,66 @@ public final class SliderClusterAPI {
           org.apache.slider.api.proto.Messages.AMSuicideResponseProto.getDefaultInstance());
       }
 
+
+      public org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto getLivenessInformation(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(10),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto getLiveContainers(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(11),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.ContainerInformationProto getLiveContainer(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.ContainerInformationProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(12),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.ContainerInformationProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto getLiveComponents(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(13),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.ComponentInformationProto getLiveComponent(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.ComponentInformationProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(14),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance());
+      }
+
     }
 
     // @@protoc_insertion_point(class_scope:org.apache.slider.api.SliderClusterProtocolPB)
@@ -1007,7 +1346,7 @@ public final class SliderClusterAPI {
     java.lang.String[] descriptorData = {
       "\n\033SliderClusterProtocol.proto\022\025org.apach" +
       "e.slider.api\032\033SliderClusterMessages.prot" +
-      "o2\270\t\n\027SliderClusterProtocolPB\022n\n\013stopClu" +
+      "o2\306\016\n\027SliderClusterProtocolPB\022n\n\013stopClu" +
       "ster\022..org.apache.slider.api.StopCluster" +
       "RequestProto\032/.org.apache.slider.api.Sto" +
       "pClusterResponseProto\022n\n\013flexCluster\022..o" +
@@ -1037,8 +1376,25 @@ public final class SliderClusterAPI {
       "KillContainerResponseProto\022h\n\tamSuicide\022",
       ",.org.apache.slider.api.AMSuicideRequest" +
       "Proto\032-.org.apache.slider.api.AMSuicideR" +
-      "esponseProtoB5\n\033org.apache.slider.api.pr" +
-      "otoB\020SliderClusterAPI\210\001\001\240\001\001"
+      "esponseProto\022\217\001\n\026getLivenessInformation\022" +
+      "9.org.apache.slider.api.GetApplicationLi" +
+      "venessRequestProto\032:.org.apache.slider.a" +
+      "pi.ApplicationLivenessInformationProto\022\200" +
+      "\001\n\021getLiveContainers\0224.org.apache.slider" +
+      ".api.GetLiveContainersRequestProto\0325.org" +
+      ".apache.slider.api.GetLiveContainersResp" +
+      "onseProto\022y\n\020getLiveContainer\0223.org.apac",
+      "he.slider.api.GetLiveContainerRequestPro" +
+      "to\0320.org.apache.slider.api.ContainerInfo" +
+      "rmationProto\022\200\001\n\021getLiveComponents\0224.org" +
+      ".apache.slider.api.GetLiveComponentsRequ" +
+      "estProto\0325.org.apache.slider.api.GetLive" +
+      "ComponentsResponseProto\022y\n\020getLiveCompon" +
+      "ent\0223.org.apache.slider.api.GetLiveCompo" +
+      "nentRequestProto\0320.org.apache.slider.api" +
+      ".ComponentInformationProtoB5\n\033org.apache" +
+      ".slider.api.protoB\020SliderClusterAPI\210\001\001\240\001",
+      "\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
index 67a3053..ce36922 100644
--- a/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
+++ b/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
@@ -37,10 +37,10 @@ public class ComponentInformation {
   public String name;
   public int priority;
   public int desired, actual, releasing;
+  public int placementPolicy;
   public int requested;
   public int failed, started, startFailed, completed, totalRequested;
   public String failureMessage;
-  public int placementPolicy;
   public List<String> containers;
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java b/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
index d722902..e711a0d 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
@@ -25,6 +25,9 @@ import org.apache.slider.api.ClusterNode;
 import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.api.StateValues;
 import org.apache.slider.api.proto.Messages;
+
+import static org.apache.slider.api.proto.RestTypeMarshalling.*;
+import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.common.tools.Duration;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
@@ -307,9 +310,8 @@ public class SliderClusterOperations {
    * @throws YarnException
    * @throws IOException
    */
-  public void amSuicide(String text, int signal, int delay) throws
-                                  YarnException,
-                                  IOException {
+  public void amSuicide(String text, int signal, int delay)
+      throws YarnException, IOException {
     Messages.AMSuicideRequestProto.Builder builder =
       Messages.AMSuicideRequestProto.newBuilder();
     if (text != null) {
@@ -323,5 +325,20 @@ public class SliderClusterOperations {
       appMaster.amSuicide(req);
   }
 
+  /**
+   * Get the application liveness
+   * @return current liveness information
+   * @throws IOException
+   */
+  public ApplicationLivenessInformation getLivenessInformation() throws IOException {
+    Messages.GetApplicationLivenessRequestProto.Builder builder =
+        Messages.GetApplicationLivenessRequestProto.newBuilder();
+    Messages.ApplicationLivenessInformationProto wire =
+        appMaster.getLivenessInformation(builder.build());
+    ApplicationLivenessInformation result = unmarshall(wire);
+    return result;
+
+  }
+
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
index d3bc98a..69ab0ee 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
@@ -161,5 +161,15 @@ public class SliderClusterProtocolPBImpl implements SliderClusterProtocolPB {
       throw wrap(e);
     }
   }
-  
+
+  @Override
+  public Messages.ApplicationLivenessInformationProto getLivenessInformation(
+      RpcController controller,
+      Messages.GetApplicationLivenessRequestProto request) throws
+      ServiceException {
+    try {
+      return real.getLivenessInformation(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
index c1e0886..3f4c16b 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
@@ -43,6 +43,31 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
     this.address = address;
   }
 
+
+  @Override
+  public ProtocolSignature getProtocolSignature(String protocol,
+      long clientVersion,
+      int clientMethodsHash)
+      throws IOException {
+    if (!protocol.equals(RPC.getProtocolName(SliderClusterProtocolPB.class))) {
+      throw new IOException("Serverside implements " +
+                            RPC.getProtocolName(SliderClusterProtocolPB.class) +
+                            ". The following requested protocol is unknown: " +
+                            protocol);
+    }
+
+    return ProtocolSignature.getProtocolSignature(clientMethodsHash,
+        RPC.getProtocolVersion(
+            SliderClusterProtocol.class),
+        SliderClusterProtocol.class);
+  }
+
+  @Override
+  public long getProtocolVersion(String protocol, long clientVersion)
+      throws IOException {
+    return SliderClusterProtocol.versionID;
+  }
+  
   private IOException convert(ServiceException se) {
     IOException ioe = ProtobufHelper.getRemoteException(se);
     if (ioe instanceof RemoteException) {
@@ -170,26 +195,11 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
   }
 
   @Override
-  public ProtocolSignature getProtocolSignature(String protocol,
-                                                long clientVersion,
-                                                int clientMethodsHash) throws
-                                                                       IOException {
-    if (!protocol.equals(RPC.getProtocolName(SliderClusterProtocolPB.class))) {
-      throw new IOException("Serverside implements " +
-                            RPC.getProtocolName(SliderClusterProtocolPB.class) +
-                            ". The following requested protocol is unknown: " +
-                            protocol);
-    }
-
-    return ProtocolSignature.getProtocolSignature(clientMethodsHash,
-                                                  RPC.getProtocolVersion(
-                                                    SliderClusterProtocol.class),
-                                                  SliderClusterProtocol.class);
-  }
-
-  @Override
-  public long getProtocolVersion(String protocol, long clientVersion) throws
-                                                                      IOException {
-    return SliderClusterProtocol.versionID;
-  }
+  public Messages.ApplicationLivenessInformationProto getLivenessInformation(
+      Messages.GetApplicationLivenessRequestProto request) throws IOException {
+    try {
+      return endpoint.getLivenessInformation(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    } }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
index e2f3644..596edaf 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
@@ -26,6 +26,8 @@ import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.slider.api.ClusterDescription;
 import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.api.proto.Messages;
+
+import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.exceptions.ServiceNotReadyException;
@@ -48,6 +50,8 @@ import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 
+import static org.apache.slider.api.proto.RestTypeMarshalling.*;
+
 /**
  * Implement the {@link SliderClusterProtocol}.
  */
@@ -58,7 +62,7 @@ public class SliderIPCService extends AbstractService
       LoggerFactory.getLogger(SliderClusterProtocol.class);
 
   private final QueueAccess actionQueues;
-  private final StateAccessForProviders appState;
+  private final StateAccessForProviders state;
   private final MetricsAndMonitoring metricsAndMonitoring;
   private final AppMasterActionOperations amOperations;
   
@@ -71,20 +75,20 @@ public class SliderIPCService extends AbstractService
   /**
    * Constructor
    * @param amOperations access to any AM operations
-   * @param appState state view
+   * @param state state view
    * @param actionQueues queues for actions
    * @param metricsAndMonitoring metrics
    */
   public SliderIPCService(AppMasterActionOperations amOperations,
-      StateAccessForProviders appState,
+      StateAccessForProviders state,
       QueueAccess actionQueues,
       MetricsAndMonitoring metricsAndMonitoring) {
     super("SliderIPCService");
     Preconditions.checkArgument(amOperations != null, "null amOperations");
-    Preconditions.checkArgument(appState != null, "null appState");
+    Preconditions.checkArgument(state != null, "null appState");
     Preconditions.checkArgument(actionQueues != null, "null actionQueues");
     Preconditions.checkArgument(metricsAndMonitoring != null, "null metricsAndMonitoring");
-    this.appState = appState;
+    this.state = state;
     this.actionQueues = actionQueues;
     this.metricsAndMonitoring = metricsAndMonitoring;
     this.amOperations = amOperations;
@@ -173,7 +177,7 @@ public class SliderIPCService extends AbstractService
     String result;
     //quick update
     //query and json-ify
-    ClusterDescription cd = appState.refreshClusterStatus();
+    ClusterDescription cd = state.refreshClusterStatus();
     result = cd.toJsonString();
     String stat = result;
     return Messages.GetJSONClusterStatusResponseProto.newBuilder()
@@ -191,7 +195,7 @@ public class SliderIPCService extends AbstractService
     String resources;
     String app;
     AggregateConf instanceDefinition =
-        appState.getInstanceDefinitionSnapshot();
+        state.getInstanceDefinitionSnapshot();
     internal = instanceDefinition.getInternal().toJson();
     resources = instanceDefinition.getResources().toJson();
     app = instanceDefinition.getAppConf().toJson();
@@ -214,7 +218,7 @@ public class SliderIPCService extends AbstractService
     String role = request.getRole();
     Messages.ListNodeUUIDsByRoleResponseProto.Builder builder =
         Messages.ListNodeUUIDsByRoleResponseProto.newBuilder();
-    List<RoleInstance> nodes = appState.enumLiveNodesInRole(role);
+    List<RoleInstance> nodes = state.enumLiveNodesInRole(role);
     for (RoleInstance node : nodes) {
       builder.addUuid(node.id);
     }
@@ -225,7 +229,7 @@ public class SliderIPCService extends AbstractService
   public Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request)
       throws IOException, YarnException {
     onRpcCall("getnode");
-    RoleInstance instance = appState.getLiveInstanceByContainerID(
+    RoleInstance instance = state.getLiveInstanceByContainerID(
         request.getUuid());
     return Messages.GetNodeResponseProto.newBuilder()
                                         .setClusterNode(instance.toProtobuf())
@@ -238,7 +242,7 @@ public class SliderIPCService extends AbstractService
       throws IOException, YarnException {
     onRpcCall("getclusternodes");
     List<RoleInstance>
-        clusterNodes = appState.getLiveInstancesByContainerIDs(
+        clusterNodes = state.getLiveInstancesByContainerIDs(
         request.getUuidList());
 
     Messages.GetClusterNodesResponseProto.Builder builder =
@@ -272,7 +276,7 @@ public class SliderIPCService extends AbstractService
     log.info("Kill Container {}", containerID);
     //throws NoSuchNodeException if it is missing
     RoleInstance instance =
-        appState.getLiveInstanceByContainerID(containerID);
+        state.getLiveInstanceByContainerID(containerID);
     queue(new ActionKillContainer(instance.getId(), 0, TimeUnit.MILLISECONDS,
         amOperations));
     Messages.KillContainerResponseProto.Builder builder =
@@ -300,4 +304,12 @@ public class SliderIPCService extends AbstractService
     schedule(action);
     return Messages.AMSuicideResponseProto.getDefaultInstance();
   }
+
+  @Override
+  public Messages.ApplicationLivenessInformationProto getLivenessInformation(
+      Messages.GetApplicationLivenessRequestProto request) throws IOException {
+    ApplicationLivenessInformation info =
+        state.getApplicationLivenessInformation();
+    return marshall(info);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/proto/SliderClusterMessages.proto
----------------------------------------------------------------------
diff --git a/slider-core/src/main/proto/SliderClusterMessages.proto b/slider-core/src/main/proto/SliderClusterMessages.proto
index 6b30846..2c31c2e 100644
--- a/slider-core/src/main/proto/SliderClusterMessages.proto
+++ b/slider-core/src/main/proto/SliderClusterMessages.proto
@@ -16,19 +16,6 @@
  * limitations under the License.
  */
 
-/**
- * These .proto interfaces are private and stable.
- * Please see http://wiki.apache.org/hadoop/Compatibility
- * for what changes are allowed for a *stable* .proto interface.
- *
- * The generated java files are checked in to the Slider code base, so
- * if this file is changed, the java must be generated again with
- * mvn clean package -Pcompile-protobuf -DskipTests
- */
-
-// This file contains protocol buffers that are used throughout HDFS -- i.e.
-// by the client, server, and data transfer protocols.
-
 option java_package = "org.apache.slider.api.proto";
 option java_outer_classname = "Messages";
 option java_generic_services = true;
@@ -203,3 +190,121 @@ message GetInstanceDefinitionResponseProto {
   required string resources = 2;
   required string application = 3;
 }
+
+
+  /* ************************************************************************
+  
+  REST model and operations.
+  Below here the operations and payloads designed to mimic
+  the REST API. That API is now the source of those
+  specificatations; this is simply a derivative.
+  
+  **************************************************************************/
+
+/**
+ * See org.apache.slider.api.types.ApplicationLivenessInformation
+ */
+message ApplicationLivenessInformationProto {
+  optional bool allRequestsSatisfied = 1;
+  optional int32 requestsOutstanding = 2;
+}
+
+/*
+ * see org.apache.slider.api.types.ComponentInformation
+ */
+message ComponentInformationProto {
+  optional string name =  1;
+  optional int32 priority =  2;
+  optional int32 desired =  3;
+  optional int32 actual =  4;
+  optional int32 releasing =  5;
+  optional int32 requested =  6;
+  optional int32 failed =  7;
+  optional int32 started =  8;
+  optional int32 startFailed = 9;
+  optional int32 completed =  10;
+  optional int32 totalRequested =  11;
+  optional string failureMessage = 12  ;
+  optional int32 placementPolicy =  13;
+  repeated string containers =  14;   
+}
+
+/*
+ * see org.apache.slider.api.types.ContainerInformation
+ */
+message ContainerInformationProto {
+  optional string containerId = 1;
+  optional string component = 2;
+  optional bool released = 3;
+  optional int32 state = 4;
+  optional int32 exitCode = 5;
+  optional string diagnostics = 6;
+  optional int64 createTime = 7;
+  optional int64 startTime = 8;
+  repeated string output = 9;
+  optional string host = 10;
+  optional string hostURL = 11;
+}
+
+
+/*
+ * see org.apache.slider.api.types.PingInformation
+ */
+message PingInformationProto {
+  optional string text = 1;
+  optional string verb = 2;
+  optional string body = 3;
+  optional int64 time = 4;
+}
+
+
+
+message GetModelRequestProto {
+}
+
+message GetModelDesiredRequestProto {
+}
+
+message GetModelDesiredAppconfRequestProto {
+}
+
+message GetModelDesiredResourcesRequestProto {
+}
+
+message GetModelResolvedAppconfRequestProto {
+}
+
+message GetModelResolvedResourcesRequestProto {
+}
+
+message GetModelLiveResourcesRequestProto {
+}
+
+message GetLiveContainersRequestProto {
+}
+
+message GetLiveContainersResponseProto {
+  repeated string names = 1;
+  repeated ContainerInformationProto containers = 2;
+}
+
+message GetLiveContainerRequestProto {
+  required string containerId = 1;
+}
+
+
+message GetLiveComponentsRequestProto {
+}
+
+message GetLiveComponentsResponseProto {
+
+  repeated string names = 1;
+  repeated ComponentInformationProto components = 2;
+}
+
+message GetLiveComponentRequestProto {
+  required string name = 1;
+}
+
+message GetApplicationLivenessRequestProto {
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/proto/SliderClusterProtocol.proto
----------------------------------------------------------------------
diff --git a/slider-core/src/main/proto/SliderClusterProtocol.proto b/slider-core/src/main/proto/SliderClusterProtocol.proto
index 2f5289d..da09f3c 100644
--- a/slider-core/src/main/proto/SliderClusterProtocol.proto
+++ b/slider-core/src/main/proto/SliderClusterProtocol.proto
@@ -16,25 +16,29 @@
  * limitations under the License.
  */
 
-/**
- * These .proto interfaces are private and stable.
- * Please see http://wiki.apache.org/hadoop/Compatibility
- * for what changes are allowed for a *stable* .proto interface.
- *
- * The generated java files are checked in to the Slider code base, so
- * if this file is changed, the java must be generated again with
- * mvn clean package -Pcompile-protobuf -DskipTests
- */
-
-// This file contains protocol buffers that are used throughout HDFS -- i.e.
-// by the client, server, and data transfer protocols.
-
 option java_package = "org.apache.slider.api.proto";
 option java_outer_classname = "SliderClusterAPI";
 option java_generic_services = true;
 option java_generate_equals_and_hash = true;
 package org.apache.slider.api;
 
+/*
+
+Compiling
+
+Maven: How to do it as part of the build
+ mvn -Pcompile-protobuf
+
+How to do it so as to get error messages
+
+protoc --java_out=src/main/java \
+ -Isrc/main/proto src/main/proto/SliderClusterMessages.proto \
+  src/main/proto/SliderClusterProtocol.proto
+
+Once happy: commit the changes
+
+*/
+
 //import "Security.proto";
 import "SliderClusterMessages.proto";
 
@@ -108,4 +112,29 @@ service SliderClusterProtocolPB {
    rpc amSuicide(AMSuicideRequestProto)
      returns(AMSuicideResponseProto);
 
+  /* ************************************************************************
+  
+  REST model and operations.
+  Below here the operations and payloads designed to mimic
+  the REST API. That API is now the source of those
+  specificatations; this is simply a derivative.
+  
+  **************************************************************************/
+
+  rpc getLivenessInformation(GetApplicationLivenessRequestProto) 
+    returns(ApplicationLivenessInformationProto);
+ 
+  rpc getLiveContainers(GetLiveContainersRequestProto) 
+    returns(GetLiveContainersResponseProto);
+
+  rpc getLiveContainer(GetLiveContainerRequestProto) 
+    returns(ContainerInformationProto);
+  
+  rpc getLiveComponents(GetLiveComponentsRequestProto) 
+    returns(GetLiveComponentsResponseProto);
+  
+  rpc getLiveComponent(GetLiveComponentRequestProto) 
+    returns(ComponentInformationProto);
+  
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockSliderClusterProtocol.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockSliderClusterProtocol.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockSliderClusterProtocol.groovy
deleted file mode 100644
index e02b5b5..0000000
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockSliderClusterProtocol.groovy
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.slider.server.appmaster.model.mock
-
-import org.apache.hadoop.ipc.ProtocolSignature
-import org.apache.hadoop.yarn.exceptions.YarnException
-import org.apache.slider.api.SliderClusterProtocol
-import org.apache.slider.api.proto.Messages
-import org.apache.slider.api.proto.Messages.AMSuicideRequestProto
-import org.apache.slider.api.proto.Messages.AMSuicideResponseProto
-import org.apache.slider.api.proto.Messages.EchoRequestProto
-import org.apache.slider.api.proto.Messages.EchoResponseProto
-import org.apache.slider.api.proto.Messages.FlexClusterRequestProto
-import org.apache.slider.api.proto.Messages.FlexClusterResponseProto
-import org.apache.slider.api.proto.Messages.GetClusterNodesRequestProto
-import org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto
-import org.apache.slider.api.proto.Messages.GetJSONClusterStatusRequestProto
-import org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto
-import org.apache.slider.api.proto.Messages.GetNodeRequestProto
-import org.apache.slider.api.proto.Messages.GetNodeResponseProto
-import org.apache.slider.api.proto.Messages.KillContainerRequestProto
-import org.apache.slider.api.proto.Messages.KillContainerResponseProto
-import org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleRequestProto
-import org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto
-import org.apache.slider.api.proto.Messages.StopClusterRequestProto
-import org.apache.slider.api.proto.Messages.StopClusterResponseProto
-
-/**
- * 
- */
-class MockSliderClusterProtocol implements SliderClusterProtocol {
-
-  @Override
-  public long getProtocolVersion(String protocol, long clientVersion) throws IOException {
-    return 0;
-  }
-
-  @Override
-  public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException {
-    return null;
-  }
-
-  @Override
-  public StopClusterResponseProto stopCluster(StopClusterRequestProto request) throws IOException, YarnException {
-    return null;
-  }
-
-  @Override
-  public FlexClusterResponseProto flexCluster(FlexClusterRequestProto request) throws IOException, YarnException {
-    return null;
-  }
-
-  @Override
-  public GetJSONClusterStatusResponseProto getJSONClusterStatus(GetJSONClusterStatusRequestProto request) throws IOException, YarnException {
-    return null;
-  }
-
-  @Override
-  public ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(ListNodeUUIDsByRoleRequestProto request) throws IOException, YarnException {
-    return null;
-  }
-
-  @Override
-  public GetNodeResponseProto getNode(GetNodeRequestProto request) throws IOException, YarnException {
-    return null;
-  }
-
-  @Override
-  public GetClusterNodesResponseProto getClusterNodes(GetClusterNodesRequestProto request) throws IOException, YarnException {
-    return null;
-  }
-
-  @Override
-  public EchoResponseProto echo(EchoRequestProto request) throws IOException, YarnException {
-    return null;
-  }
-
-  @Override
-  public KillContainerResponseProto killContainer(KillContainerRequestProto request) throws IOException, YarnException {
-    return null;
-  }
-
-  @Override
-  public AMSuicideResponseProto amSuicide(AMSuicideRequestProto request) throws IOException, YarnException {
-    return null;
-  }
-
-  @Override
-  Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
-      Messages.GetInstanceDefinitionRequestProto request)
-  throws IOException, YarnException {
-    return null
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
index d6482a5..62ceca5 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
@@ -23,12 +23,10 @@ import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet
 import org.apache.slider.api.ClusterDescription
-import org.apache.slider.api.SliderClusterProtocol
 import org.apache.slider.providers.ProviderService
 import org.apache.slider.server.appmaster.model.mock.MockAppState
 import org.apache.slider.server.appmaster.model.mock.MockProviderService
 import org.apache.slider.server.appmaster.model.mock.MockRecordFactory
-import org.apache.slider.server.appmaster.model.mock.MockSliderClusterProtocol
 import org.apache.slider.server.appmaster.state.AbstractRecordFactory
 import org.apache.slider.server.appmaster.state.AppState
 import org.apache.slider.server.appmaster.state.ProviderAppState
@@ -45,7 +43,6 @@ public class TestClusterSpecificationBlock {
 
   @Before
   public void setup() {
-    SliderClusterProtocol clusterProto = new MockSliderClusterProtocol();
     AppState appState = new MyAppState(new MockRecordFactory());
     ProviderAppState providerAppState = new ProviderAppState(
         "undefined",

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
index f3283c4..16bf23b 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
@@ -53,7 +53,6 @@ public class TestContainerStatsBlock extends BaseMockAppStateTest {
 
   @Before
   public void setup() {
-    SliderClusterProtocol clusterProto = new MockSliderClusterProtocol();
     ProviderService providerService = new MockProviderService();
     ProviderAppState providerAppState = new ProviderAppState(
         "undefined",

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
index 4b91ca0..eb68c8a 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
@@ -45,7 +45,6 @@ public class TestIndexBlock extends BaseMockAppStateTest {
   public void setup() {
     super.setup()
     assert appState
-    SliderClusterProtocol clusterProto = new MockSliderClusterProtocol();
     ProviderService providerService = new MockProviderService();
     ProviderAppState providerAppState = new ProviderAppState(
         "undefined",


[15/20] incubator-slider git commit: SLIDER-782 about to make RestAPI delegates independent of REST vs IPC client

Posted by st...@apache.org.
SLIDER-782 about to make RestAPI delegates independent of REST vs IPC client


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/7e296990
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/7e296990
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/7e296990

Branch: refs/heads/develop
Commit: 7e296990ca7a66c340d240c48742caa19a0df3f2
Parents: ddf06ab
Author: Steve Loughran <st...@apache.org>
Authored: Fri Feb 13 11:57:13 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Feb 13 11:57:13 2015 +0000

----------------------------------------------------------------------
 .../agent/rest/JerseyTestDelegates.groovy       |  6 +++-
 .../rest/RestAPIClientTestDelegates.groovy      | 29 ++++++--------------
 2 files changed, 13 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7e296990/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy
index a7a5432..5eb14e3 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/JerseyTestDelegates.groovy
@@ -103,6 +103,8 @@ class JerseyTestDelegates extends AbstractRestTestDelegate {
       (T) resource.method(method.verb, c);
     } catch (UniformInterfaceException ex) {
       uprateFaults(method, resource, ex);
+      // never reached as the uprate throws the new exception
+      return null;
     }
   }
 
@@ -122,7 +124,7 @@ class JerseyTestDelegates extends AbstractRestTestDelegate {
    * @param ex
    * @return
    */
-  public uprateFaults(
+  public void uprateFaults(
       HttpVerb method,
       WebResource webResource,
       UniformInterfaceException ex) {
@@ -170,6 +172,7 @@ class JerseyTestDelegates extends AbstractRestTestDelegate {
   public void testJerseyGetConftree() throws Throwable {
     jGetApplicationResource(LIVE_RESOURCES, ConfTree.class);
   }
+  
   public void testCodahaleOperations() throws Throwable {
     describe "Codahale operations"
     
@@ -466,6 +469,7 @@ class JerseyTestDelegates extends AbstractRestTestDelegate {
 
     testCodahaleOperations()
     testMimeTypes()
+    testJerseyGetConftree()
     testLiveResources()
     testLiveContainers();
     testRESTModel()

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7e296990/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
index dce26ce..4532808 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
@@ -22,13 +22,12 @@ import com.sun.jersey.api.client.Client
 import com.sun.jersey.api.client.WebResource
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
+import org.apache.slider.api.SliderApplicationApi
 import org.apache.slider.api.StateValues
 import org.apache.slider.api.types.ComponentInformation
 import org.apache.slider.api.types.ContainerInformation
 import org.apache.slider.client.rest.SliderApplicationApiRestClient
-import org.apache.slider.core.conf.ConfTree
 import org.apache.slider.core.conf.ConfTreeOperations
-import org.apache.slider.server.appmaster.web.rest.application.ApplicationResource
 import org.apache.slider.test.Outcome
 
 import javax.ws.rs.core.MediaType
@@ -36,7 +35,8 @@ import javax.ws.rs.core.MediaType
 import static org.apache.slider.api.ResourceKeys.COMPONENT_INSTANCES
 import static org.apache.slider.api.StatusKeys.*
 import static org.apache.slider.common.SliderKeys.COMPONENT_AM
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.*
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_CONTAINERS
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_APPLICATION
 
 /**
  * Uses the Slider Application API for the tests.
@@ -46,18 +46,13 @@ import static org.apache.slider.server.appmaster.web.rest.RestPaths.*
 @Slf4j
 class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
 
-  final String appmaster;
-  final String application;
-  final Client jersey;
-  final SliderApplicationApiRestClient appAPI;
+ 
+  final SliderApplicationApi appAPI;
 
 
   RestAPIClientTestDelegates(String appmaster, Client jersey,
       boolean enableComplexVerbs = true) {
     super(enableComplexVerbs)
-    this.jersey = jersey
-    this.appmaster = appmaster
-    application = appendToURL(appmaster, SLIDER_PATH_APPLICATION)
     WebResource amResource = jersey.resource(appmaster)
     amResource.type(MediaType.APPLICATION_JSON)
     def appResource = amResource.path(SLIDER_PATH_APPLICATION);
@@ -150,7 +145,6 @@ class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
 
   }
 
- 
   /**
    * Test the rest model. For this to work the cluster has to be configured
    * with the global option
@@ -159,10 +153,6 @@ class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
   public void testRESTModel() {
     describe "model"
 
-    assertPathServesList(appmaster,
-        MODEL,
-        ApplicationResource.MODEL_ENTRIES)
-
     def unresolvedConf = appAPI.getDesiredModel() 
 //    log.info "Unresolved \n$unresolvedConf"
     def unresolvedAppConf = unresolvedConf.appConfOperations
@@ -174,12 +164,10 @@ class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
     assert resolvedConf.appConfOperations.getComponentOpt(
         sam, TEST_GLOBAL_OPTION, "") == TEST_GLOBAL_OPTION_PRESENT
 
-    def unresolved = fetchTypeList(ConfTree, appmaster,
-        [MODEL_DESIRED_APPCONF, MODEL_DESIRED_RESOURCES])
+    def unresolved = appAPI.getDesiredModel() 
     assert null == 
-           unresolved[MODEL_DESIRED_APPCONF].components[sam][TEST_GLOBAL_OPTION] 
-
-
+           unresolved.resources.components[sam][TEST_GLOBAL_OPTION] 
+    
     
     def resolvedAppconf = appAPI.getResolvedAppconf() 
     assert TEST_GLOBAL_OPTION_PRESENT==
@@ -230,7 +218,6 @@ class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
   }
 
   public void testSuiteGetOperations() {
-
     testGetDesiredModel()
     testGetResolvedModel()
     testLiveResources()


[19/20] incubator-slider git commit: SLIDER-782 improving tests with better printing

Posted by st...@apache.org.
SLIDER-782 improving tests with better printing


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/c8ddd608
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/c8ddd608
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/c8ddd608

Branch: refs/heads/develop
Commit: c8ddd608120060ee9b017e735a66ae9f67d91a24
Parents: ef6fb9e
Author: Steve Loughran <st...@apache.org>
Authored: Fri Feb 13 20:33:59 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Feb 13 20:33:59 2015 +0000

----------------------------------------------------------------------
 .../slider/api/types/ComponentInformation.java  | 23 ++++++++++++++++++++
 .../rest/AbstractAppApiTestDelegates.groovy     | 17 ++++++++-------
 2 files changed, 32 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c8ddd608/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
index ce36922..286c3a1 100644
--- a/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
+++ b/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
@@ -60,4 +60,27 @@ public class ComponentInformation {
     return stats;
   }
 
+  @Override
+  public String toString() {
+    final StringBuilder sb =
+        new StringBuilder("ComponentInformation{");
+    sb.append("failureMessage='").append(failureMessage).append('\'');
+    sb.append(", totalRequested=").append(totalRequested);
+    sb.append(", completed=").append(completed);
+    sb.append(", startFailed=").append(startFailed);
+    sb.append(", started=").append(started);
+    sb.append(", failed=").append(failed);
+    sb.append(", requested=").append(requested);
+    sb.append(", placementPolicy=").append(placementPolicy);
+    sb.append(", releasing=").append(releasing);
+    sb.append(", actual=").append(actual);
+    sb.append(", desired=").append(desired);
+    sb.append(", priority=").append(priority);
+    sb.append(", name='").append(name).append('\'');
+    sb.append(", container count='")
+      .append(containers== null ? 0: containers.size())
+      .append('\'');
+    sb.append('}');
+    return sb.toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c8ddd608/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
index 0310be5..aaa0fd6 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
@@ -68,7 +68,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
   }
 
   public void testLiveResources() throws Throwable {
-    describe "Live Resources"
+    describe "Live Resources via $appAPI"
 
     ConfTreeOperations tree = appAPI.getLiveResources()
 
@@ -87,7 +87,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
 
 
   public void testLiveContainers() throws Throwable {
-    describe "Application REST /live/containers"
+    describe "Application /live/containers from $appAPI"
 
     Map<String, ContainerInformation> containers = appAPI.enumContainers()
     assert containers.size() == 1
@@ -106,7 +106,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
     assert amContainerInfo.released == null
     assert amContainerInfo.state == StateValues.STATE_LIVE
 
-    describe "containers"
+    describe "containers via $appAPI"
 
     ContainerInformation amContainerInfo2 =
         appAPI.getContainer(amContainerId)
@@ -121,7 +121,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
     }
 
 
-    describe "components"
+    describe "components via $appAPI"
 
     Map<String, ComponentInformation> components =
         appAPI.enumComponents()
@@ -145,7 +145,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
    * @param appmaster
    */
   public void testRESTModel() {
-    describe "model"
+    describe "model via $appAPI"
 
     def unresolvedConf = appAPI.getDesiredModel() 
 //    log.info "Unresolved \n$unresolvedConf"
@@ -170,7 +170,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
 
   public void testPing() {
     // GET
-    describe "pinging"
+    describe "pinging via $appAPI"
     
     appAPI.ping("hello")
   }
@@ -194,9 +194,10 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
   }
 
   public void testAppLiveness() {
+    describe "Liveness: check via $appAPI"
     def liveness = appAPI.applicationLiveness
     describe "Liveness:\n$liveness"
-    
+
     assert liveness.allRequestsSatisfied
     assert !liveness.requestsOutstanding
   }
@@ -210,7 +211,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
     try {
       appAPI.getApplicationLiveness()
       return Outcome.Retry
-    } catch (IOException expected) {
+    } catch (IOException success) {
       // expected
       return Outcome.Success
     }


[18/20] incubator-slider git commit: SLIDER-782: run IPC tests against remote AM provided cluster is insecure

Posted by st...@apache.org.
SLIDER-782: run IPC tests against remote AM provided cluster is insecure


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/ef6fb9e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/ef6fb9e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/ef6fb9e3

Branch: refs/heads/develop
Commit: ef6fb9e3b83aceca3403a2c30773f92a1ae23e1c
Parents: 4124489
Author: Steve Loughran <st...@apache.org>
Authored: Fri Feb 13 16:53:52 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Feb 13 16:53:52 2015 +0000

----------------------------------------------------------------------
 .../slider/client/SliderYarnClientImpl.java     |  1 -
 .../slider/server/appmaster/rpc/RpcBinder.java  | 33 ++++++++++++++++++--
 .../funtest/lifecycle/AgentWebPagesIT.groovy    | 32 ++++++++++++++++++-
 3 files changed, 61 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ef6fb9e3/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java b/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
index 209169b..3b7a65c 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
@@ -73,7 +73,6 @@ public class SliderYarnClientImpl extends YarnClientImpl {
     return rmClient;
   }
 
-
   /**
    * List Slider <i>running</i>instances belonging to a specific user.
    * @deprecated use {@link #listDeployedInstances(String)}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ef6fb9e3/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
index 9cc612e..9381b76 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
@@ -18,6 +18,7 @@
 
 package org.apache.slider.server.appmaster.rpc;
 
+import com.google.common.base.Preconditions;
 import com.google.protobuf.BlockingService;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.retry.RetryPolicy;
@@ -248,10 +249,36 @@ public class RpcBinder {
 
     String host = application.getHost();
     int port = application.getRpcPort();
+    org.apache.hadoop.yarn.api.records.Token clientToAMToken =
+        application.getClientToAMToken();
+    return createProxy(conf, host, port, clientToAMToken, rpcTimeout);
+  }
+
+  /**
+   *
+   * @param conf config to use
+   * @param host hosname
+   * @param port port
+   * @param clientToAMToken auth token: only used in a secure cluster.
+   * converted via {@link ConverterUtils#convertFromYarn(org.apache.hadoop.yarn.api.records.Token, InetSocketAddress)}
+   * @param rpcTimeout timeout in RPC operations
+   * @return the proxy
+   * @throws SliderException
+   * @throws IOException
+   * @throws InterruptedException
+   */
+  public static SliderClusterProtocol createProxy(final Configuration conf,
+      String host,
+      int port,
+      org.apache.hadoop.yarn.api.records.Token clientToAMToken,
+      final int rpcTimeout) throws
+      SliderException,
+      IOException,
+      InterruptedException {
     String address = host + ":" + port;
     if (SliderUtils.isUnset(host) || 0 == port) {
       throw new SliderException(SliderExitCodes.EXIT_CONNECTIVITY_PROBLEM,
-                              "Slider instance " + application.getName()
+                              "Slider instance "
                               + " isn't providing a valid address for the" +
                               " Slider RPC protocol: " + address);
     }
@@ -265,8 +292,8 @@ public class RpcBinder {
 
     log.debug("Connecting to {}", serviceAddr);
     if (UserGroupInformation.isSecurityEnabled()) {
-      org.apache.hadoop.yarn.api.records.Token clientToAMToken =
-        application.getClientToAMToken();
+      Preconditions.checkArgument(clientToAMToken != null,
+          "Null clientToAMToken");
       Token<ClientToAMTokenIdentifier> token =
         ConverterUtils.convertFromYarn(clientToAMToken, serviceAddr);
       newUgi.addToken(token);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ef6fb9e3/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
index bb82a86..f1e61f3 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
@@ -23,12 +23,16 @@ import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.hadoop.registry.client.api.RegistryOperations
 import org.apache.hadoop.security.UserGroupInformation
+import org.apache.hadoop.yarn.api.ApplicationClientProtocol
+import org.apache.hadoop.yarn.client.ClientRMProxy
 import org.apache.hadoop.yarn.webapp.ForbiddenException
+import org.apache.slider.agent.rest.IpcApiClientTestDelegates
 import org.apache.slider.agent.rest.JerseyTestDelegates
 import org.apache.slider.agent.rest.AbstractRestTestDelegate
 import org.apache.slider.agent.rest.LowLevelRestTestDelegates
 import org.apache.slider.agent.rest.RestAPIClientTestDelegates
 import org.apache.slider.client.SliderClient
+import org.apache.slider.client.ipc.SliderApplicationIpcClient
 import org.apache.slider.client.rest.RestClientFactory
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.SliderKeys
@@ -39,6 +43,7 @@ import org.apache.slider.common.tools.ConfigHelper
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
+import org.apache.slider.server.appmaster.rpc.RpcBinder
 import org.junit.After
 import org.junit.Before
 import org.junit.Test
@@ -179,7 +184,32 @@ public class AgentWebPagesIT extends AgentCommandTestBase
     if (proxyComplexVerbs) {
       sliderApplicationApi.ping("registry located")
     }
-    
+
+
+    // maybe execute IPC operations.
+    // these are skipped when security is enabled, until
+    // there's some code set up to do the tokens properly
+    if (!UserGroupInformation.isSecurityEnabled()) {
+      describe("IPC equivalent operations")
+/*
+      def rmClient = ClientRMProxy.createRMProxy(conf,
+          ApplicationClientProtocol.class);
+*/
+      def sliderClusterProtocol =
+          RpcBinder.createProxy(conf,
+              report.host,
+              report.rpcPort,
+              null,
+              1000)
+      SliderApplicationIpcClient ipcClient =
+          new SliderApplicationIpcClient(sliderClusterProtocol)
+      IpcApiClientTestDelegates ipcDelegates =
+          new IpcApiClientTestDelegates(ipcClient)
+      ipcDelegates.testSuiteAll()
+    } else {
+      describe( "skipping IPC API operations against secure cluster")
+    }
+
     // finally, stop the AM
     if (directComplexVerbs) {
       describe "Stopping AM via REST API"


[10/20] incubator-slider git commit: SLIDER-782 new messages & RPC calls defined; , marshall and indirect code completed

Posted by st...@apache.org.
SLIDER-782 new messages & RPC calls defined;, marshall and indirect code completed


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/84134031
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/84134031
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/84134031

Branch: refs/heads/develop
Commit: 841340314cb79c9d99acd947955c1b7f4c65c11b
Parents: bc15807
Author: Steve Loughran <st...@apache.org>
Authored: Thu Feb 12 18:06:19 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Feb 12 18:06:19 2015 +0000

----------------------------------------------------------------------
 .../slider/api/SliderClusterProtocol.java       |  44 +-
 .../org/apache/slider/api/proto/Messages.java   | 894 ++++++++++++++++++-
 .../slider/api/proto/RestTypeMarshalling.java   |  79 +-
 .../slider/api/proto/SliderClusterAPI.java      | 579 +++++++++++-
 .../slider/api/types/ContainerInformation.java  |   4 +-
 .../slider/client/SliderClusterOperations.java  |   3 +-
 .../server/appmaster/SliderAppMaster.java       |  17 +-
 .../rpc/SliderClusterProtocolPBImpl.java        |  86 +-
 .../rpc/SliderClusterProtocolProxy.java         | 114 ++-
 .../server/appmaster/rpc/SliderIPCService.java  | 168 +++-
 .../appmaster/state/ProviderAppState.java       |  28 +
 .../state/StateAccessForProviders.java          |   9 +
 .../slider/server/appmaster/web/WebAppApi.java  |   3 +
 .../server/appmaster/web/WebAppApiImpl.java     |  11 +-
 .../ApplicationResouceContentCacheFactory.java  |  91 ++
 .../rest/application/ApplicationResource.java   |  77 +-
 .../application/resources/ContentCache.java     |  33 +-
 .../src/main/proto/SliderClusterMessages.proto  |  10 +
 .../src/main/proto/SliderClusterProtocol.proto  |  29 +
 .../TestMockAppStateAppRestIntegration.groovy   |   2 +-
 .../view/TestClusterSpecificationBlock.groovy   |   2 +-
 .../web/view/TestContainerStatsBlock.groovy     |   3 +-
 .../appmaster/web/view/TestIndexBlock.groovy    |   3 +-
 .../web/rest/agent/TestAMAgentWebServices.java  |   2 +-
 .../management/TestAMManagementWebServices.java |   2 +-
 25 files changed, 2154 insertions(+), 139 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java b/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
index 556e918..8e2f46d 100644
--- a/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
+++ b/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
@@ -18,11 +18,11 @@
 
 package org.apache.slider.api;
 
+import com.google.protobuf.RpcController;
 import org.apache.hadoop.ipc.VersionedProtocol;
 import org.apache.hadoop.security.KerberosInfo;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.slider.api.proto.Messages;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.common.SliderXmlConfKeys;
 
 import java.io.IOException;
@@ -34,7 +34,7 @@ import java.io.IOException;
 @KerberosInfo(
   serverPrincipal = SliderXmlConfKeys.KEY_KERBEROS_PRINCIPAL)
 public interface SliderClusterProtocol extends VersionedProtocol {
-  public static final long versionID = 0x01;
+  long versionID = 0x01;
 
   /**
    * Stop the cluster
@@ -129,4 +129,44 @@ public interface SliderClusterProtocol extends VersionedProtocol {
       Messages.GetApplicationLivenessRequestProto request
   ) throws IOException;
 
+  Messages.GetLiveContainersResponseProto getLiveContainers(
+      Messages.GetLiveContainersRequestProto request
+  ) throws IOException;
+
+  Messages.ContainerInformationProto getLiveContainer(
+      Messages.GetLiveContainerRequestProto request
+  ) throws IOException;
+
+  Messages.GetLiveComponentsResponseProto getLiveComponents(
+      Messages.GetLiveComponentsRequestProto request
+  ) throws IOException;
+
+  Messages.ComponentInformationProto getLiveComponent(
+      Messages.GetLiveComponentRequestProto request
+  ) throws IOException;
+
+  
+  Messages.WrappedJsonProto getModelDesired(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException;
+
+  
+  Messages.WrappedJsonProto getModelDesiredAppconf(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException;
+    
+  Messages.WrappedJsonProto getModelDesiredResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException;
+   
+  Messages.WrappedJsonProto getModelResolved(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException;
+  
+  Messages.WrappedJsonProto getModelResolvedAppconf(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException;
+  
+  Messages.WrappedJsonProto getModelResolvedResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException;
+   
+  Messages.WrappedJsonProto getLiveResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException;
+    
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java b/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
index 3a495e7..65f243d 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
@@ -24264,6 +24264,871 @@ public final class Messages {
     // @@protoc_insertion_point(class_scope:org.apache.slider.api.GetApplicationLivenessRequestProto)
   }
 
+  public interface EmptyPayloadProtoOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.apache.slider.api.EmptyPayloadProto}
+   */
+  public static final class EmptyPayloadProto extends
+      com.google.protobuf.GeneratedMessage
+      implements EmptyPayloadProtoOrBuilder {
+    // Use EmptyPayloadProto.newBuilder() to construct.
+    private EmptyPayloadProto(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private EmptyPayloadProto(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final EmptyPayloadProto defaultInstance;
+    public static EmptyPayloadProto getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public EmptyPayloadProto getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private EmptyPayloadProto(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_EmptyPayloadProto_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_EmptyPayloadProto_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.slider.api.proto.Messages.EmptyPayloadProto.class, org.apache.slider.api.proto.Messages.EmptyPayloadProto.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<EmptyPayloadProto> PARSER =
+        new com.google.protobuf.AbstractParser<EmptyPayloadProto>() {
+      public EmptyPayloadProto parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new EmptyPayloadProto(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<EmptyPayloadProto> getParserForType() {
+      return PARSER;
+    }
+
+    private void initFields() {
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    @java.lang.Override
+    public boolean equals(final java.lang.Object obj) {
+      if (obj == this) {
+       return true;
+      }
+      if (!(obj instanceof org.apache.slider.api.proto.Messages.EmptyPayloadProto)) {
+        return super.equals(obj);
+      }
+      org.apache.slider.api.proto.Messages.EmptyPayloadProto other = (org.apache.slider.api.proto.Messages.EmptyPayloadProto) obj;
+
+      boolean result = true;
+      result = result &&
+          getUnknownFields().equals(other.getUnknownFields());
+      return result;
+    }
+
+    private int memoizedHashCode = 0;
+    @java.lang.Override
+    public int hashCode() {
+      if (memoizedHashCode != 0) {
+        return memoizedHashCode;
+      }
+      int hash = 41;
+      hash = (19 * hash) + getDescriptorForType().hashCode();
+      hash = (29 * hash) + getUnknownFields().hashCode();
+      memoizedHashCode = hash;
+      return hash;
+    }
+
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.EmptyPayloadProto parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.slider.api.proto.Messages.EmptyPayloadProto prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.apache.slider.api.EmptyPayloadProto}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.slider.api.proto.Messages.EmptyPayloadProtoOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_EmptyPayloadProto_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_EmptyPayloadProto_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.slider.api.proto.Messages.EmptyPayloadProto.class, org.apache.slider.api.proto.Messages.EmptyPayloadProto.Builder.class);
+      }
+
+      // Construct using org.apache.slider.api.proto.Messages.EmptyPayloadProto.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_EmptyPayloadProto_descriptor;
+      }
+
+      public org.apache.slider.api.proto.Messages.EmptyPayloadProto getDefaultInstanceForType() {
+        return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+      }
+
+      public org.apache.slider.api.proto.Messages.EmptyPayloadProto build() {
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.slider.api.proto.Messages.EmptyPayloadProto buildPartial() {
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto result = new org.apache.slider.api.proto.Messages.EmptyPayloadProto(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.slider.api.proto.Messages.EmptyPayloadProto) {
+          return mergeFrom((org.apache.slider.api.proto.Messages.EmptyPayloadProto)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.slider.api.proto.Messages.EmptyPayloadProto other) {
+        if (other == org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance()) return this;
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.slider.api.proto.Messages.EmptyPayloadProto) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.apache.slider.api.EmptyPayloadProto)
+    }
+
+    static {
+      defaultInstance = new EmptyPayloadProto(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.apache.slider.api.EmptyPayloadProto)
+  }
+
+  public interface WrappedJsonProtoOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string json = 1;
+    /**
+     * <code>required string json = 1;</code>
+     */
+    boolean hasJson();
+    /**
+     * <code>required string json = 1;</code>
+     */
+    java.lang.String getJson();
+    /**
+     * <code>required string json = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getJsonBytes();
+  }
+  /**
+   * Protobuf type {@code org.apache.slider.api.WrappedJsonProto}
+   *
+   * <pre>
+   **
+   *Generic JSON, often containing data structures serialized as a string
+   * </pre>
+   */
+  public static final class WrappedJsonProto extends
+      com.google.protobuf.GeneratedMessage
+      implements WrappedJsonProtoOrBuilder {
+    // Use WrappedJsonProto.newBuilder() to construct.
+    private WrappedJsonProto(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private WrappedJsonProto(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final WrappedJsonProto defaultInstance;
+    public static WrappedJsonProto getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public WrappedJsonProto getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private WrappedJsonProto(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              json_ = input.readBytes();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_WrappedJsonProto_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_WrappedJsonProto_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.slider.api.proto.Messages.WrappedJsonProto.class, org.apache.slider.api.proto.Messages.WrappedJsonProto.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<WrappedJsonProto> PARSER =
+        new com.google.protobuf.AbstractParser<WrappedJsonProto>() {
+      public WrappedJsonProto parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new WrappedJsonProto(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<WrappedJsonProto> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string json = 1;
+    public static final int JSON_FIELD_NUMBER = 1;
+    private java.lang.Object json_;
+    /**
+     * <code>required string json = 1;</code>
+     */
+    public boolean hasJson() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string json = 1;</code>
+     */
+    public java.lang.String getJson() {
+      java.lang.Object ref = json_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          json_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string json = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getJsonBytes() {
+      java.lang.Object ref = json_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        json_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    private void initFields() {
+      json_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasJson()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getJsonBytes());
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getJsonBytes());
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    @java.lang.Override
+    public boolean equals(final java.lang.Object obj) {
+      if (obj == this) {
+       return true;
+      }
+      if (!(obj instanceof org.apache.slider.api.proto.Messages.WrappedJsonProto)) {
+        return super.equals(obj);
+      }
+      org.apache.slider.api.proto.Messages.WrappedJsonProto other = (org.apache.slider.api.proto.Messages.WrappedJsonProto) obj;
+
+      boolean result = true;
+      result = result && (hasJson() == other.hasJson());
+      if (hasJson()) {
+        result = result && getJson()
+            .equals(other.getJson());
+      }
+      result = result &&
+          getUnknownFields().equals(other.getUnknownFields());
+      return result;
+    }
+
+    private int memoizedHashCode = 0;
+    @java.lang.Override
+    public int hashCode() {
+      if (memoizedHashCode != 0) {
+        return memoizedHashCode;
+      }
+      int hash = 41;
+      hash = (19 * hash) + getDescriptorForType().hashCode();
+      if (hasJson()) {
+        hash = (37 * hash) + JSON_FIELD_NUMBER;
+        hash = (53 * hash) + getJson().hashCode();
+      }
+      hash = (29 * hash) + getUnknownFields().hashCode();
+      memoizedHashCode = hash;
+      return hash;
+    }
+
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.WrappedJsonProto parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.slider.api.proto.Messages.WrappedJsonProto prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.apache.slider.api.WrappedJsonProto}
+     *
+     * <pre>
+     **
+     *Generic JSON, often containing data structures serialized as a string
+     * </pre>
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.slider.api.proto.Messages.WrappedJsonProtoOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_WrappedJsonProto_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_WrappedJsonProto_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.slider.api.proto.Messages.WrappedJsonProto.class, org.apache.slider.api.proto.Messages.WrappedJsonProto.Builder.class);
+      }
+
+      // Construct using org.apache.slider.api.proto.Messages.WrappedJsonProto.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        json_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_WrappedJsonProto_descriptor;
+      }
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getDefaultInstanceForType() {
+        return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+      }
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto build() {
+        org.apache.slider.api.proto.Messages.WrappedJsonProto result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto buildPartial() {
+        org.apache.slider.api.proto.Messages.WrappedJsonProto result = new org.apache.slider.api.proto.Messages.WrappedJsonProto(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.json_ = json_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.slider.api.proto.Messages.WrappedJsonProto) {
+          return mergeFrom((org.apache.slider.api.proto.Messages.WrappedJsonProto)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.slider.api.proto.Messages.WrappedJsonProto other) {
+        if (other == org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()) return this;
+        if (other.hasJson()) {
+          bitField0_ |= 0x00000001;
+          json_ = other.json_;
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasJson()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.slider.api.proto.Messages.WrappedJsonProto parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.slider.api.proto.Messages.WrappedJsonProto) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string json = 1;
+      private java.lang.Object json_ = "";
+      /**
+       * <code>required string json = 1;</code>
+       */
+      public boolean hasJson() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string json = 1;</code>
+       */
+      public java.lang.String getJson() {
+        java.lang.Object ref = json_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          json_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string json = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getJsonBytes() {
+        java.lang.Object ref = json_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          json_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string json = 1;</code>
+       */
+      public Builder setJson(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        json_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string json = 1;</code>
+       */
+      public Builder clearJson() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        json_ = getDefaultInstance().getJson();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string json = 1;</code>
+       */
+      public Builder setJsonBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        json_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.apache.slider.api.WrappedJsonProto)
+    }
+
+    static {
+      defaultInstance = new WrappedJsonProto(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.apache.slider.api.WrappedJsonProto)
+  }
+
   private static com.google.protobuf.Descriptors.Descriptor
     internal_static_org_apache_slider_api_RoleInstanceState_descriptor;
   private static
@@ -24459,6 +25324,16 @@ public final class Messages {
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_org_apache_slider_api_GetApplicationLivenessRequestProto_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_apache_slider_api_EmptyPayloadProto_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_apache_slider_api_EmptyPayloadProto_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_apache_slider_api_WrappedJsonProto_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_apache_slider_api_WrappedJsonProto_fieldAccessorTable;
 
   public static com.google.protobuf.Descriptors.FileDescriptor
       getDescriptor() {
@@ -24535,9 +25410,10 @@ public final class Messages {
       "\001 \003(\t\022D\n\ncomponents\030\002 \003(\01320.org.apache.s" +
       "lider.api.ComponentInformationProto\",\n\034G" +
       "etLiveComponentRequestProto\022\014\n\004name\030\001 \002(" +
-      "\t\"$\n\"GetApplicationLivenessRequestProtoB" +
-      "-\n\033org.apache.slider.api.protoB\010Messages" +
-      "\210\001\001\240\001\001"
+      "\t\"$\n\"GetApplicationLivenessRequestProto\"" +
+      "\023\n\021EmptyPayloadProto\" \n\020WrappedJsonProto" +
+      "\022\014\n\004json\030\001 \002(\tB-\n\033org.apache.slider.api.",
+      "protoB\010Messages\210\001\001\240\001\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -24778,6 +25654,18 @@ public final class Messages {
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_apache_slider_api_GetApplicationLivenessRequestProto_descriptor,
               new java.lang.String[] { });
+          internal_static_org_apache_slider_api_EmptyPayloadProto_descriptor =
+            getDescriptor().getMessageTypes().get(39);
+          internal_static_org_apache_slider_api_EmptyPayloadProto_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_apache_slider_api_EmptyPayloadProto_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_apache_slider_api_WrappedJsonProto_descriptor =
+            getDescriptor().getMessageTypes().get(40);
+          internal_static_org_apache_slider_api_WrappedJsonProto_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_apache_slider_api_WrappedJsonProto_descriptor,
+              new java.lang.String[] { "Json", });
           return null;
         }
       };

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
index dffe239..4652763 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
@@ -67,7 +67,7 @@ public class RestTypeMarshalling {
     builder.setStartFailed(info.startFailed);
     builder.setCompleted(info.completed);
     builder.setTotalRequested(info.totalRequested);
-    if (info.failureMessage !=null) {
+    if (info.failureMessage != null) {
       builder.setFailureMessage(info.failureMessage);
     }
     if (info.containers != null) {
@@ -81,23 +81,27 @@ public class RestTypeMarshalling {
     ContainerInformation info = new ContainerInformation();
     info.containerId = wire.getContainerId();
     info.component = wire.getComponent();
-    info.released = wire.getReleased();
+    info.state = wire.getState();
     if (wire.hasReleased()) {
+      info.released = wire.getReleased();
     }
-    info.state = wire.getDesired();
-    info.exitCode = wire.getActual();
-    info.released = wire.getReleasing();
-    info.diagnostics = wire.getRequested();
-    info.createTime = wire.getFailed();
-    info.startTime = wire.getStarted();
-    info.host = wire.getStartFailed();
-    info.hostURL = wire.getCompleted();
-    info.totalRequested = wire.getTotalRequested();
-    if (wire.hasFailureMessage()) {
-      info.failureMessage = wire.getFailureMessage();
+    if (wire.hasExitCode()) {
+      info.exitCode = wire.getExitCode();
     }
-    info.output = Collections.a 
-        new ArrayList<String>(wire.getOutputList());
+    if (wire.hasDiagnostics()) {
+      info.diagnostics = wire.getDiagnostics();
+    }
+    if (wire.hasHost()) {
+      info.host = wire.getHost();
+    }
+    if (wire.hasHostURL()) {
+      info.host = wire.getHostURL();
+    }
+    info.createTime = wire.getCreateTime();
+    info.startTime = wire.getStartTime();
+    info.output = wire.getOutputList().toArray(
+        new String[wire.getOutputCount()]
+    );
     return info;
   }
 
@@ -106,28 +110,31 @@ public class RestTypeMarshalling {
 
     Messages.ContainerInformationProto.Builder builder =
         Messages.ContainerInformationProto.newBuilder();
+    if (info.containerId != null) {
+      builder.setContainerId(info.containerId);
+    }
+    if (info.component != null) {
+      builder.setComponent(info.component);
+    }
+    if (info.diagnostics != null) {
+      builder.setDiagnostics(info.diagnostics);
+    }
+    if (info.host != null) {
+      builder.setHost(info.host);
+    }
+    if (info.hostURL != null) {
+      builder.setHostURL(info.hostURL);
+    }
+    if (info.released != null) {
+      builder.setReleased(info.released);
+    }
+    if (info.output != null) {
+      builder.addAllOutput(Arrays.asList(info.output));
+    }
+    builder.setCreateTime(info.createTime);
+    builder.setStartTime(info.startTime);
     return builder.build();
   }
 
-  public static ContainerInformation
-  unmarshall(Messages.ContainerInformationProto wire) {
-    ContainerInformation info = new ContainerInformation();
-    info.name = wire.getName();
-    info.priority = wire.getPriority();
-    info.placementPolicy = wire.getPlacementPolicy();
-    info.desired = wire.getDesired();
-    info.actual = wire.getActual();
-    info.releasing = wire.getReleasing();
-    info.requested = wire.getRequested();
-    info.failed = wire.getFailed();
-    info.started = wire.getStarted();
-    info.startFailed = wire.getStartFailed();
-    info.completed = wire.getCompleted();
-    info.totalRequested = wire.getTotalRequested();
-    if (wire.hasFailureMessage()) {
-      info.failureMessage = wire.getFailureMessage();
-    }
-    info.containers = new ArrayList<String>(wire.getContainersList());
-    return info;
-  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java b/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
index b97a6e6..85ea328 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
@@ -189,6 +189,90 @@ public final class SliderClusterAPI {
           org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
           com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done);
 
+      /**
+       * <code>rpc getModelDesired(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+       *
+       * <pre>
+       * AggregateConf getModelDesired()
+       * </pre>
+       */
+      public abstract void getModelDesired(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+      /**
+       * <code>rpc getModelDesiredAppconf(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+       *
+       * <pre>
+       * ConfTree getModelDesiredAppconf
+       * </pre>
+       */
+      public abstract void getModelDesiredAppconf(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+      /**
+       * <code>rpc getModelDesiredResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+       *
+       * <pre>
+       * ConfTree getModelDesiredResources
+       * </pre>
+       */
+      public abstract void getModelDesiredResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+      /**
+       * <code>rpc getModelResolved(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+       *
+       * <pre>
+       * AggregateConf getModelResolved()
+       * </pre>
+       */
+      public abstract void getModelResolved(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+      /**
+       * <code>rpc getModelResolvedAppconf(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+       *
+       * <pre>
+       * ConfTree getModelResolvedAppconf
+       * </pre>
+       */
+      public abstract void getModelResolvedAppconf(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+      /**
+       * <code>rpc getModelResolvedResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+       *
+       * <pre>
+       * ConfTree getModelResolvedResources
+       * </pre>
+       */
+      public abstract void getModelResolvedResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+      /**
+       * <code>rpc getLiveResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+       *
+       * <pre>
+       * ConfTree getLiveResources
+       * </pre>
+       */
+      public abstract void getLiveResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
     }
 
     public static com.google.protobuf.Service newReflectiveService(
@@ -314,6 +398,62 @@ public final class SliderClusterAPI {
           impl.getLiveComponent(controller, request, done);
         }
 
+        @java.lang.Override
+        public  void getModelDesired(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+          impl.getModelDesired(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getModelDesiredAppconf(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+          impl.getModelDesiredAppconf(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getModelDesiredResources(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+          impl.getModelDesiredResources(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getModelResolved(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+          impl.getModelResolved(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getModelResolvedAppconf(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+          impl.getModelResolvedAppconf(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getModelResolvedResources(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+          impl.getModelResolvedResources(controller, request, done);
+        }
+
+        @java.lang.Override
+        public  void getLiveResources(
+            com.google.protobuf.RpcController controller,
+            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+          impl.getLiveResources(controller, request, done);
+        }
+
       };
     }
 
@@ -366,6 +506,20 @@ public final class SliderClusterAPI {
               return impl.getLiveComponents(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto)request);
             case 14:
               return impl.getLiveComponent(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto)request);
+            case 15:
+              return impl.getModelDesired(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+            case 16:
+              return impl.getModelDesiredAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+            case 17:
+              return impl.getModelDesiredResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+            case 18:
+              return impl.getModelResolved(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+            case 19:
+              return impl.getModelResolvedAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+            case 20:
+              return impl.getModelResolvedResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
+            case 21:
+              return impl.getLiveResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
             default:
               throw new java.lang.AssertionError("Can't get here.");
           }
@@ -410,6 +564,20 @@ public final class SliderClusterAPI {
               return org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto.getDefaultInstance();
             case 14:
               return org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto.getDefaultInstance();
+            case 15:
+              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+            case 16:
+              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+            case 17:
+              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+            case 18:
+              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+            case 19:
+              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+            case 20:
+              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+            case 21:
+              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
             default:
               throw new java.lang.AssertionError("Can't get here.");
           }
@@ -454,6 +622,20 @@ public final class SliderClusterAPI {
               return org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance();
             case 14:
               return org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance();
+            case 15:
+              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+            case 16:
+              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+            case 17:
+              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+            case 18:
+              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+            case 19:
+              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+            case 20:
+              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+            case 21:
+              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
             default:
               throw new java.lang.AssertionError("Can't get here.");
           }
@@ -630,6 +812,90 @@ public final class SliderClusterAPI {
         org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
         com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done);
 
+    /**
+     * <code>rpc getModelDesired(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+     *
+     * <pre>
+     * AggregateConf getModelDesired()
+     * </pre>
+     */
+    public abstract void getModelDesired(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+    /**
+     * <code>rpc getModelDesiredAppconf(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+     *
+     * <pre>
+     * ConfTree getModelDesiredAppconf
+     * </pre>
+     */
+    public abstract void getModelDesiredAppconf(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+    /**
+     * <code>rpc getModelDesiredResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+     *
+     * <pre>
+     * ConfTree getModelDesiredResources
+     * </pre>
+     */
+    public abstract void getModelDesiredResources(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+    /**
+     * <code>rpc getModelResolved(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+     *
+     * <pre>
+     * AggregateConf getModelResolved()
+     * </pre>
+     */
+    public abstract void getModelResolved(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+    /**
+     * <code>rpc getModelResolvedAppconf(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+     *
+     * <pre>
+     * ConfTree getModelResolvedAppconf
+     * </pre>
+     */
+    public abstract void getModelResolvedAppconf(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+    /**
+     * <code>rpc getModelResolvedResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+     *
+     * <pre>
+     * ConfTree getModelResolvedResources
+     * </pre>
+     */
+    public abstract void getModelResolvedResources(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
+    /**
+     * <code>rpc getLiveResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
+     *
+     * <pre>
+     * ConfTree getLiveResources
+     * </pre>
+     */
+    public abstract void getLiveResources(
+        com.google.protobuf.RpcController controller,
+        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
+
     public static final
         com.google.protobuf.Descriptors.ServiceDescriptor
         getDescriptor() {
@@ -727,6 +993,41 @@ public final class SliderClusterAPI {
             com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.ComponentInformationProto>specializeCallback(
               done));
           return;
+        case 15:
+          this.getModelDesired(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
+              done));
+          return;
+        case 16:
+          this.getModelDesiredAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
+              done));
+          return;
+        case 17:
+          this.getModelDesiredResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
+              done));
+          return;
+        case 18:
+          this.getModelResolved(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
+              done));
+          return;
+        case 19:
+          this.getModelResolvedAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
+              done));
+          return;
+        case 20:
+          this.getModelResolvedResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
+              done));
+          return;
+        case 21:
+          this.getLiveResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
+            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
+              done));
+          return;
         default:
           throw new java.lang.AssertionError("Can't get here.");
       }
@@ -771,6 +1072,20 @@ public final class SliderClusterAPI {
           return org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto.getDefaultInstance();
         case 14:
           return org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto.getDefaultInstance();
+        case 15:
+          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+        case 16:
+          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+        case 17:
+          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+        case 18:
+          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+        case 19:
+          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+        case 20:
+          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
+        case 21:
+          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
         default:
           throw new java.lang.AssertionError("Can't get here.");
       }
@@ -815,6 +1130,20 @@ public final class SliderClusterAPI {
           return org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance();
         case 14:
           return org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance();
+        case 15:
+          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+        case 16:
+          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+        case 17:
+          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+        case 18:
+          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+        case 19:
+          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+        case 20:
+          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
+        case 21:
+          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
         default:
           throw new java.lang.AssertionError("Can't get here.");
       }
@@ -1060,6 +1389,111 @@ public final class SliderClusterAPI {
             org.apache.slider.api.proto.Messages.ComponentInformationProto.class,
             org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance()));
       }
+
+      public  void getModelDesired(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(15),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
+      }
+
+      public  void getModelDesiredAppconf(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(16),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
+      }
+
+      public  void getModelDesiredResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(17),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
+      }
+
+      public  void getModelResolved(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(18),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
+      }
+
+      public  void getModelResolvedAppconf(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(19),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
+      }
+
+      public  void getModelResolvedResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(20),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
+      }
+
+      public  void getLiveResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
+          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(21),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
+            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
+      }
     }
 
     public static BlockingInterface newBlockingStub(
@@ -1142,6 +1576,41 @@ public final class SliderClusterAPI {
           com.google.protobuf.RpcController controller,
           org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request)
           throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelDesired(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelDesiredAppconf(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelDesiredResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelResolved(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelResolvedAppconf(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelResolvedResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException;
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getLiveResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException;
     }
 
     private static final class BlockingStub implements BlockingInterface {
@@ -1330,6 +1799,90 @@ public final class SliderClusterAPI {
           org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance());
       }
 
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelDesired(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(15),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelDesiredAppconf(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(16),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelDesiredResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(17),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelResolved(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(18),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelResolvedAppconf(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(19),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getModelResolvedResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(20),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
+      }
+
+
+      public org.apache.slider.api.proto.Messages.WrappedJsonProto getLiveResources(
+          com.google.protobuf.RpcController controller,
+          org.apache.slider.api.proto.Messages.EmptyPayloadProto request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.slider.api.proto.Messages.WrappedJsonProto) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(21),
+          controller,
+          request,
+          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance());
+      }
+
     }
 
     // @@protoc_insertion_point(class_scope:org.apache.slider.api.SliderClusterProtocolPB)
@@ -1346,7 +1899,7 @@ public final class SliderClusterAPI {
     java.lang.String[] descriptorData = {
       "\n\033SliderClusterProtocol.proto\022\025org.apach" +
       "e.slider.api\032\033SliderClusterMessages.prot" +
-      "o2\306\016\n\027SliderClusterProtocolPB\022n\n\013stopClu" +
+      "o2\264\024\n\027SliderClusterProtocolPB\022n\n\013stopClu" +
       "ster\022..org.apache.slider.api.StopCluster" +
       "RequestProto\032/.org.apache.slider.api.Sto" +
       "pClusterResponseProto\022n\n\013flexCluster\022..o" +
@@ -1392,9 +1945,27 @@ public final class SliderClusterAPI {
       "ComponentsResponseProto\022y\n\020getLiveCompon" +
       "ent\0223.org.apache.slider.api.GetLiveCompo" +
       "nentRequestProto\0320.org.apache.slider.api" +
-      ".ComponentInformationProtoB5\n\033org.apache" +
-      ".slider.api.protoB\020SliderClusterAPI\210\001\001\240\001",
-      "\001"
+      ".ComponentInformationProto\022d\n\017getModelDe" +
+      "sired\022(.org.apache.slider.api.EmptyPaylo",
+      "adProto\032\'.org.apache.slider.api.WrappedJ" +
+      "sonProto\022k\n\026getModelDesiredAppconf\022(.org" +
+      ".apache.slider.api.EmptyPayloadProto\032\'.o" +
+      "rg.apache.slider.api.WrappedJsonProto\022m\n" +
+      "\030getModelDesiredResources\022(.org.apache.s" +
+      "lider.api.EmptyPayloadProto\032\'.org.apache" +
+      ".slider.api.WrappedJsonProto\022e\n\020getModel" +
+      "Resolved\022(.org.apache.slider.api.EmptyPa" +
+      "yloadProto\032\'.org.apache.slider.api.Wrapp" +
+      "edJsonProto\022l\n\027getModelResolvedAppconf\022(",
+      ".org.apache.slider.api.EmptyPayloadProto" +
+      "\032\'.org.apache.slider.api.WrappedJsonProt" +
+      "o\022n\n\031getModelResolvedResources\022(.org.apa" +
+      "che.slider.api.EmptyPayloadProto\032\'.org.a" +
+      "pache.slider.api.WrappedJsonProto\022e\n\020get" +
+      "LiveResources\022(.org.apache.slider.api.Em" +
+      "ptyPayloadProto\032\'.org.apache.slider.api." +
+      "WrappedJsonProtoB5\n\033org.apache.slider.ap" +
+      "i.protoB\020SliderClusterAPI\210\001\001\240\001\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java
index 14fa491..ccadd9c 100644
--- a/slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java
+++ b/slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java
@@ -39,13 +39,13 @@ public class ContainerInformation {
   public long createTime;
   public long startTime;
 
+  public String host;
+  public String hostURL;
   /**
    * What is the tail output from the executed process (or [] if not started
    * or the log cannot be picked up
    */
   public String[] output;
-  public String host;
-  public String hostURL;
 
   @Override
   public String toString() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java b/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
index e711a0d..7191c66 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
@@ -335,8 +335,7 @@ public class SliderClusterOperations {
         Messages.GetApplicationLivenessRequestProto.newBuilder();
     Messages.ApplicationLivenessInformationProto wire =
         appMaster.getLivenessInformation(builder.build());
-    ApplicationLivenessInformation result = unmarshall(wire);
-    return result;
+    return unmarshall(wire);
 
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index 61e3692..21c6eaf 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -149,6 +149,8 @@ import org.apache.slider.server.appmaster.web.SliderAMWebApp;
 import org.apache.slider.server.appmaster.web.WebAppApi;
 import org.apache.slider.server.appmaster.web.WebAppApiImpl;
 import org.apache.slider.server.appmaster.web.rest.RestPaths;
+import org.apache.slider.server.appmaster.web.rest.application.ApplicationResouceContentCacheFactory;
+import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
 import org.apache.slider.server.services.security.CertificateManager;
 import org.apache.slider.server.services.utility.AbstractSliderLaunchedService;
 import org.apache.slider.server.services.utility.WebAppService;
@@ -404,6 +406,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
    * Set early on in the {@link #createAndRunCluster(String)} operation.
    */
   private boolean securityEnabled;
+  private ContentCache contentCache;
 
   /**
    * Service Constructor
@@ -478,7 +481,11 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
     addService(metricsAndMonitoring);
     metrics = metricsAndMonitoring.getMetrics();
 
-    
+
+    contentCache = ApplicationResouceContentCacheFactory.createContentCache(
+        stateForProviders);
+
+
     executorService = new WorkflowExecutorService<ExecutorService>("AmExecutor",
         Executors.newFixedThreadPool(2,
             new ServiceThreadFactory("AmExecutor", true)));
@@ -713,8 +720,8 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
           getConfig().set(KEY_PROTOCOL_ACL, "*");
         }
       }
+      
       //bring up the Slider RPC service
-
       buildPortScanner(instanceDefinition);
       startSliderRPCServer(instanceDefinition);
 
@@ -922,7 +929,8 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
               registryOperations,
               metricsAndMonitoring,
               actionQueues,
-              this);
+              this,
+              contentCache);
       initAMFilterOptions(serviceConf);
 
       // start the agent web app
@@ -1495,7 +1503,8 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
         this,
         stateForProviders,
         actionQueues,
-        metricsAndMonitoring);
+        metricsAndMonitoring,
+        contentCache);
 
     deployChildService(sliderIPCService);
     SliderClusterProtocolPBImpl protobufRelay =

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
index 69ab0ee..d34ce42 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
@@ -171,5 +171,89 @@ public class SliderClusterProtocolPBImpl implements SliderClusterProtocolPB {
       return real.getLivenessInformation(request);
     } catch (Exception e) {
       throw wrap(e);
-    }  }
+    }
+  }
+
+
+  @Override
+  public Messages.GetLiveContainersResponseProto getLiveContainers(RpcController controller,
+      Messages.GetLiveContainersRequestProto request) throws ServiceException {
+    try {
+      return real.getLiveContainers(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
+  }
+
+  @Override
+  public Messages.ContainerInformationProto getLiveContainer(RpcController controller,
+      Messages.GetLiveContainerRequestProto request) throws ServiceException {
+    try {
+      return real.getLiveContainer(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
+  }
+
+  @Override
+  public Messages.GetLiveComponentsResponseProto getLiveComponents(RpcController controller,
+      Messages.GetLiveComponentsRequestProto request) throws ServiceException {
+    try {
+      return real.getLiveComponents(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
+  }
+
+  @Override
+  public Messages.ComponentInformationProto getLiveComponent(RpcController controller,
+      Messages.GetLiveComponentRequestProto request) throws ServiceException {
+    try {
+      return real.getLiveComponent(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelDesired(RpcController controller,
+      Messages.EmptyPayloadProto request) throws ServiceException {
+    return null;
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelDesiredAppconf(RpcController controller,
+      Messages.EmptyPayloadProto request) throws ServiceException {
+    return null;
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelDesiredResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws ServiceException {
+    return null;
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelResolved(RpcController controller,
+      Messages.EmptyPayloadProto request) throws ServiceException {
+    return null;
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelResolvedAppconf(RpcController controller,
+      Messages.EmptyPayloadProto request) throws ServiceException {
+    return null;
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelResolvedResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws ServiceException {
+    return null;
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getLiveResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws ServiceException {
+    return null;
+  }
 }


[09/20] incubator-slider git commit: SLIDER-782 new messages & RPC calls defined; , marshall and indirect code completed

Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
index 3f4c16b..39f1349 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
@@ -201,5 +201,117 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
       return endpoint.getLivenessInformation(NULL_CONTROLLER, request);
     } catch (ServiceException e) {
       throw convert(e);
-    } }
+    }
+  }
+
+  @Override
+  public Messages.GetLiveContainersResponseProto getLiveContainers(Messages.GetLiveContainersRequestProto request) throws
+      IOException {
+    try {
+      return endpoint.getLiveContainers(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.ContainerInformationProto getLiveContainer(Messages.GetLiveContainerRequestProto request) throws
+      IOException {
+    try {
+      return endpoint.getLiveContainer(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.GetLiveComponentsResponseProto getLiveComponents(Messages.GetLiveComponentsRequestProto request) throws
+      IOException {
+    try {
+      return endpoint.getLiveComponents(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.ComponentInformationProto getLiveComponent(Messages.GetLiveComponentRequestProto request) throws
+      IOException {
+    try {
+      return endpoint.getLiveComponent(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelDesired(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    try {
+      return endpoint.getModelDesired(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelDesiredAppconf(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    try {
+      return endpoint.getModelDesiredAppconf(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelDesiredResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    try {
+      return endpoint.getModelDesiredResources(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelResolved(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    try {
+      return endpoint.getModelResolved(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelResolvedAppconf(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    try {
+      return endpoint.getModelResolvedAppconf(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelResolvedResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    try {
+      return endpoint.getModelResolvedResources(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getLiveResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    try {
+      return endpoint.getLiveResources(NULL_CONTROLLER, request);
+    } catch (ServiceException e) {
+      throw convert(e);
+    }
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
index 596edaf..5a9f319 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
@@ -19,19 +19,23 @@
 package org.apache.slider.server.appmaster.rpc;
 
 import com.google.common.base.Preconditions;
+import com.google.protobuf.RpcController;
 import org.apache.hadoop.ipc.ProtocolSignature;
 import org.apache.hadoop.service.AbstractService;
 import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
 import org.apache.slider.api.ClusterDescription;
 import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.api.proto.Messages;
-
 import org.apache.slider.api.types.ApplicationLivenessInformation;
+import org.apache.slider.api.types.ComponentInformation;
+import org.apache.slider.api.types.ContainerInformation;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.exceptions.ServiceNotReadyException;
 import org.apache.slider.core.main.LauncherExitCodes;
+import org.apache.slider.core.persist.AggregateConfSerDeser;
 import org.apache.slider.core.persist.ConfTreeSerDeser;
 import org.apache.slider.server.appmaster.AppMasterActionOperations;
 import org.apache.slider.server.appmaster.actions.ActionFlexCluster;
@@ -43,18 +47,32 @@ import org.apache.slider.server.appmaster.actions.QueueAccess;
 import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
 import org.apache.slider.server.appmaster.state.RoleInstance;
 import org.apache.slider.server.appmaster.state.StateAccessForProviders;
+import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
-import static org.apache.slider.api.proto.RestTypeMarshalling.*;
+import static org.apache.slider.api.proto.RestTypeMarshalling.marshall;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_COMPONENTS;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_CONTAINERS;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_RESOURCES;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED_APPCONF;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED_RESOURCES;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_RESOLVED;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_RESOLVED_APPCONF;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_RESOLVED_RESOURCES;
 
 /**
  * Implement the {@link SliderClusterProtocol}.
  */
+@SuppressWarnings("unchecked")
+
 public class SliderIPCService extends AbstractService
     implements SliderClusterProtocol {
 
@@ -65,7 +83,8 @@ public class SliderIPCService extends AbstractService
   private final StateAccessForProviders state;
   private final MetricsAndMonitoring metricsAndMonitoring;
   private final AppMasterActionOperations amOperations;
-  
+  private final ContentCache cache;
+
   /**
    * This is the prefix used for metrics
    */
@@ -78,20 +97,24 @@ public class SliderIPCService extends AbstractService
    * @param state state view
    * @param actionQueues queues for actions
    * @param metricsAndMonitoring metrics
+   * @param cache
    */
   public SliderIPCService(AppMasterActionOperations amOperations,
       StateAccessForProviders state,
       QueueAccess actionQueues,
-      MetricsAndMonitoring metricsAndMonitoring) {
+      MetricsAndMonitoring metricsAndMonitoring, ContentCache cache) {
     super("SliderIPCService");
     Preconditions.checkArgument(amOperations != null, "null amOperations");
     Preconditions.checkArgument(state != null, "null appState");
     Preconditions.checkArgument(actionQueues != null, "null actionQueues");
-    Preconditions.checkArgument(metricsAndMonitoring != null, "null metricsAndMonitoring");
+    Preconditions.checkArgument(metricsAndMonitoring != null,
+        "null metricsAndMonitoring");
+    Preconditions.checkArgument(cache != null, "null cache");
     this.state = state;
     this.actionQueues = actionQueues;
     this.metricsAndMonitoring = metricsAndMonitoring;
     this.amOperations = amOperations;
+    this.cache = cache;
   }
 
   @Override   //SliderClusterProtocol
@@ -312,4 +335,139 @@ public class SliderIPCService extends AbstractService
         state.getApplicationLivenessInformation();
     return marshall(info);
   }
+
+  @Override
+  public Messages.GetLiveContainersResponseProto getLiveContainers(
+      Messages.GetLiveContainersRequestProto request)
+      throws IOException {
+    Map<String, ContainerInformation> infoMap =
+        (Map<String, ContainerInformation>) cache.lookupWithIOE(
+            LIVE_CONTAINERS);
+    Messages.GetLiveContainersResponseProto.Builder builder =
+        Messages.GetLiveContainersResponseProto.newBuilder();
+
+    for (Map.Entry<String, ContainerInformation> entry : infoMap
+        .entrySet()) {
+      builder.addNames(entry.getKey());
+      builder.addContainers(marshall(entry.getValue()));
+    }
+    return builder.build();
+  }
+
+  @Override
+  public Messages.ContainerInformationProto getLiveContainer(Messages.GetLiveContainerRequestProto request) throws
+      IOException {
+    String containerId = request.getContainerId();
+    RoleInstance id = state.getLiveInstanceByContainerID(containerId);
+    ContainerInformation containerInformation = id.serialize();
+    return marshall(containerInformation);
+  }
+
+  @Override
+  public Messages.GetLiveComponentsResponseProto getLiveComponents(Messages.GetLiveComponentsRequestProto request) throws
+      IOException {
+    Map<String, ComponentInformation> infoMap =
+        (Map<String, ComponentInformation>) cache.lookupWithIOE(
+            LIVE_COMPONENTS);
+    Messages.GetLiveComponentsResponseProto.Builder builder =
+        Messages.GetLiveComponentsResponseProto.newBuilder();
+
+    for (Map.Entry<String, ComponentInformation> entry : infoMap
+        .entrySet()) {
+      builder.addNames(entry.getKey());
+      builder.addComponents(marshall(entry.getValue()));
+    }
+    return builder.build();
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelDesired(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    return lookupAggregateConf(MODEL_DESIRED);
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelDesiredAppconf(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    return lookupConfTree(MODEL_DESIRED_APPCONF);
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelDesiredResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    return lookupConfTree(MODEL_DESIRED_RESOURCES);
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelResolved(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    return lookupAggregateConf(MODEL_RESOLVED);
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelResolvedAppconf(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    return lookupConfTree(MODEL_RESOLVED_APPCONF);
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getModelResolvedResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    return lookupConfTree(MODEL_RESOLVED_RESOURCES);
+  }
+
+  @Override
+  public Messages.WrappedJsonProto getLiveResources(RpcController controller,
+      Messages.EmptyPayloadProto request) throws IOException {
+    return lookupConfTree(LIVE_RESOURCES);
+  }
+
+  @Override
+  public Messages.ComponentInformationProto getLiveComponent(Messages.GetLiveComponentRequestProto request) throws
+      IOException {
+    String name = request.getName();
+    try {
+      return marshall(state.getComponentInformation(name));
+    } catch (YarnRuntimeException e) {
+      throw new FileNotFoundException("Unknown component: " + name);
+    }
+  }
+
+  /**
+   * Helper method; look up an aggregate configuration in the cache from
+   * a key, or raise an exception
+   * @param key key to resolve
+   * @return the configuration
+   * @throws IOException on a failure
+   */
+
+  protected Messages.WrappedJsonProto lookupAggregateConf(String key) throws
+      IOException {
+    AggregateConf aggregateConf = (AggregateConf) cache.lookupWithIOE(key);
+    String json = AggregateConfSerDeser.toString(aggregateConf);
+    return wrap(json);
+  }
+
+  /**
+   * Helper method; look up an conf tree in the cache from
+   * a key, or raise an exception
+   * @param key key to resolve
+   * @return the configuration
+   * @throws IOException on a failure
+   */
+  protected Messages.WrappedJsonProto lookupConfTree(String key) throws
+      IOException {
+    ConfTree conf = (ConfTree) cache.lookupWithIOE(key);
+    String json = ConfTreeSerDeser.toString(conf);
+    return wrap(json);
+  }
+
+  private Messages.WrappedJsonProto wrap(String json) {
+    Messages.WrappedJsonProto.Builder builder =
+        Messages.WrappedJsonProto.newBuilder();
+    builder.setJson(json);
+    return builder.build();
+  }
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
index b5b2cb7..d237f42 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
@@ -257,4 +257,32 @@ public class ProviderAppState implements StateAccessForProviders {
     return nodes;
   }
 
+  @Override
+  public List<RoleInstance> lookupRoleContainers(String component) {
+    RoleStatus roleStatus = lookupRoleStatus(component);
+    List<RoleInstance> ownedContainerList = cloneOwnedContainerList();
+    List<RoleInstance> matching =
+        new ArrayList<RoleInstance>(ownedContainerList.size());
+    int roleId = roleStatus.getPriority();
+    for (RoleInstance instance : ownedContainerList) {
+      if (instance.roleId == roleId) {
+        matching.add(instance);
+      }
+    }
+    return matching;
+  }
+  
+  @Override
+  public ComponentInformation getComponentInformation(String component) {
+    RoleStatus roleStatus = lookupRoleStatus(component);
+    ComponentInformation info = roleStatus.serialize();
+    List<RoleInstance> containers = lookupRoleContainers(component);
+    info.containers = new ArrayList<String>(containers.size());
+    for (RoleInstance container : containers) {
+      info.containers.add(container.id);
+    }
+    return info;
+
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
index 0ea5428..eef178a 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
@@ -272,4 +272,13 @@ public interface StateAccessForProviders {
    * @return a list of nodes, may be empty
    */
   List<RoleInstance> enumLiveNodesInRole(String role);
+
+  /**
+   * Look up all containers of a specific component name 
+   * @param component component/role name
+   * @return list of instances. This is a snapshot
+   */
+  List<RoleInstance> lookupRoleContainers(String component);
+
+  ComponentInformation getComponentInformation(String component);
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
index f1bff64..179ae8c 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
@@ -26,6 +26,7 @@ import org.apache.slider.server.appmaster.state.AppState;
 import org.apache.slider.server.appmaster.state.RoleStatus;
 import org.apache.slider.server.appmaster.state.StateAccessForProviders;
 import org.apache.slider.server.appmaster.web.rest.agent.AgentRestOperations;
+import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
 import org.apache.slider.server.services.security.CertificateManager;
 
 import java.util.Map;
@@ -81,4 +82,6 @@ public interface WebAppApi {
   QueueAccess getQueues();
 
   AppMasterActionOperations getAMOperations();
+
+  ContentCache getContentCache();
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
index a7d85af..0730a21 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
@@ -24,6 +24,7 @@ import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
 import org.apache.slider.server.appmaster.state.RoleStatus;
 import org.apache.slider.server.appmaster.state.StateAccessForProviders;
 import org.apache.slider.server.appmaster.web.rest.agent.AgentRestOperations;
+import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
 import org.apache.slider.server.services.security.CertificateManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,6 +48,7 @@ public class WebAppApiImpl implements WebAppApi {
   private final MetricsAndMonitoring metricsAndMonitoring;
   private final QueueAccess queues;
   private final AppMasterActionOperations appMasterOperations;
+  private final ContentCache contentCache;
 
   public WebAppApiImpl(StateAccessForProviders appState,
       ProviderService provider,
@@ -54,8 +56,10 @@ public class WebAppApiImpl implements WebAppApi {
       RegistryOperations registryOperations,
       MetricsAndMonitoring metricsAndMonitoring,
       QueueAccess queues,
-      AppMasterActionOperations appMasterOperations) {
+      AppMasterActionOperations appMasterOperations,
+      ContentCache contentCache) {
     this.appMasterOperations = appMasterOperations;
+    this.contentCache = contentCache;
     checkNotNull(appState);
     checkNotNull(provider);
     this.queues = queues;
@@ -117,4 +121,9 @@ public class WebAppApiImpl implements WebAppApi {
   public AppMasterActionOperations getAMOperations() {
     return appMasterOperations;
   }
+
+  @Override
+  public ContentCache getContentCache() {
+    return contentCache;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResouceContentCacheFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResouceContentCacheFactory.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResouceContentCacheFactory.java
new file mode 100644
index 0000000..e7b8fc7
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResouceContentCacheFactory.java
@@ -0,0 +1,91 @@
+/*
+ * 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.slider.server.appmaster.web.rest.application;
+
+import org.apache.slider.api.types.ComponentInformation;
+import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.core.conf.AggregateConf;
+import org.apache.slider.core.conf.ConfTree;
+import org.apache.slider.server.appmaster.state.StateAccessForProviders;
+import org.apache.slider.server.appmaster.web.rest.application.resources.AggregateModelRefresher;
+import org.apache.slider.server.appmaster.web.rest.application.resources.AppconfRefresher;
+import org.apache.slider.server.appmaster.web.rest.application.resources.CachedContent;
+import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
+import org.apache.slider.server.appmaster.web.rest.application.resources.LiveComponentsRefresher;
+import org.apache.slider.server.appmaster.web.rest.application.resources.LiveContainersRefresher;
+import org.apache.slider.server.appmaster.web.rest.application.resources.LiveResourcesRefresher;
+import org.apache.slider.server.appmaster.web.rest.application.resources.LiveStatisticsRefresher;
+
+import java.util.Map;
+
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_COMPONENTS;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_CONTAINERS;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_RESOURCES;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_STATISTICS;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED_APPCONF;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED_RESOURCES;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_RESOLVED;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_RESOLVED_APPCONF;
+import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_RESOLVED_RESOURCES;
+
+public class ApplicationResouceContentCacheFactory {
+  public static final int LIFESPAN = 500;
+
+  /**
+   * Build the content cache
+   * @param cache cache to construct
+   * @param state state view
+   */
+  public static ContentCache createContentCache(
+      StateAccessForProviders state) {
+    ContentCache cache = new ContentCache();
+    cache.put(LIVE_RESOURCES,
+        new CachedContent<ConfTree>(LIFESPAN,
+            new LiveResourcesRefresher(state)));
+    cache.put(LIVE_CONTAINERS,
+        new CachedContent<Map<String, ContainerInformation>>(LIFESPAN,
+            new LiveContainersRefresher(state)));
+    cache.put(LIVE_COMPONENTS,
+        new CachedContent<Map<String, ComponentInformation>>(LIFESPAN,
+            new LiveComponentsRefresher(state)));
+    cache.put(MODEL_DESIRED,
+        new CachedContent<AggregateConf>(LIFESPAN,
+            new AggregateModelRefresher(state, false)));
+    cache.put(MODEL_RESOLVED,
+        new CachedContent<AggregateConf>(LIFESPAN,
+            new AggregateModelRefresher(state, true)));
+    cache.put(MODEL_RESOLVED_APPCONF,
+        new CachedContent<ConfTree>(LIFESPAN,
+            new AppconfRefresher(state, false, false)));
+    cache.put(MODEL_RESOLVED_RESOURCES,
+        new CachedContent<ConfTree>(LIFESPAN,
+            new AppconfRefresher(state, false, true)));
+    cache.put(MODEL_DESIRED_APPCONF,
+        new CachedContent<ConfTree>(LIFESPAN,
+            new AppconfRefresher(state, true, false)));
+    cache.put(MODEL_DESIRED_RESOURCES,
+        new CachedContent<ConfTree>(LIFESPAN,
+            new AppconfRefresher(state, true, true)));
+    cache.put(LIVE_STATISTICS,
+        new CachedContent<Map<String, Integer>>(LIFESPAN,
+            new LiveStatisticsRefresher(state)));
+    return cache;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
index 9fd59c1..2dedfb8 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
@@ -28,7 +28,6 @@ import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.exceptions.NoSuchNodeException;
 import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.state.RoleStatus;
 import org.apache.slider.server.appmaster.state.StateAccessForProviders;
 import org.apache.slider.server.appmaster.web.WebAppApi;
 import org.apache.slider.server.appmaster.web.rest.AbstractSliderResource;
@@ -36,16 +35,9 @@ import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
 
 import org.apache.slider.server.appmaster.web.rest.application.actions.RestActionStop;
 import org.apache.slider.server.appmaster.web.rest.application.actions.StopResponse;
-import org.apache.slider.server.appmaster.web.rest.application.resources.AggregateModelRefresher;
-import org.apache.slider.server.appmaster.web.rest.application.resources.AppconfRefresher;
-import org.apache.slider.server.appmaster.web.rest.application.resources.CachedContent;
-import org.apache.slider.server.appmaster.web.rest.application.resources.LiveContainersRefresher;
 import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
-import org.apache.slider.server.appmaster.web.rest.application.resources.LiveComponentsRefresher;
-import org.apache.slider.server.appmaster.web.rest.application.resources.LiveResourcesRefresher;
 import org.apache.slider.server.appmaster.web.rest.application.actions.RestActionPing;
 import org.apache.slider.api.types.PingInformation;
-import org.apache.slider.server.appmaster.web.rest.application.resources.LiveStatisticsRefresher;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -75,7 +67,6 @@ public class ApplicationResource extends AbstractSliderResource {
   private static final Logger log =
       LoggerFactory.getLogger(ApplicationResource.class);
 
-  public static final int LIFESPAN = 500;
   public static final List<String> LIVE_ENTRIES = toJsonList("resources",
       "containers",
       "components",
@@ -95,42 +86,13 @@ public class ApplicationResource extends AbstractSliderResource {
    * so is never very out of date, yet many GETs don't
    * overload the rest of the system.
    */
-  private final ContentCache cache = new ContentCache();
+  private final ContentCache cache;
   private final StateAccessForProviders state;
 
   public ApplicationResource(WebAppApi slider) {
     super(slider);
     state = slider.getAppState();
-    cache.put(LIVE_RESOURCES,
-        new CachedContent<ConfTree>(LIFESPAN,
-            new LiveResourcesRefresher(state)));
-    cache.put(LIVE_CONTAINERS,
-        new CachedContent<Map<String, ContainerInformation>>(LIFESPAN,
-            new LiveContainersRefresher(state)));
-    cache.put(LIVE_COMPONENTS,
-        new CachedContent<Map<String, ComponentInformation>> (LIFESPAN,
-            new LiveComponentsRefresher(state)));
-    cache.put(MODEL_DESIRED,
-        new CachedContent<AggregateConf>(LIFESPAN,
-            new AggregateModelRefresher(state, false)));
-    cache.put(MODEL_RESOLVED,
-        new CachedContent<AggregateConf>(LIFESPAN,
-            new AggregateModelRefresher(state, true)));
-    cache.put(MODEL_RESOLVED_APPCONF,
-        new CachedContent<ConfTree>(LIFESPAN,
-            new AppconfRefresher(state, false, false)));
-    cache.put(MODEL_RESOLVED_RESOURCES,
-        new CachedContent<ConfTree>(LIFESPAN,
-            new AppconfRefresher(state, false, true)));
-    cache.put(MODEL_DESIRED_APPCONF,
-        new CachedContent<ConfTree>(LIFESPAN,
-            new AppconfRefresher(state, true, false)));
-    cache.put(MODEL_DESIRED_RESOURCES,
-        new CachedContent<ConfTree>(LIFESPAN,
-            new AppconfRefresher(state, true, true)));
-    cache.put(LIVE_STATISTICS,
-        new CachedContent<Map<String, Integer>>(LIFESPAN,
-            new LiveStatisticsRefresher(state)));
+    cache = slider.getContentCache();
   }
 
   /**
@@ -275,14 +237,7 @@ public class ApplicationResource extends AbstractSliderResource {
       @PathParam("component") String component) {
     markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS);
     try {
-      RoleStatus roleStatus = state.lookupRoleStatus(component);
-      ComponentInformation info = roleStatus.serialize();
-      List<RoleInstance> containers = lookupRoleContainers(component);
-      info.containers = new ArrayList<String>(containers.size());
-      for (RoleInstance container : containers) {
-        info.containers.add(container.id);
-      }
-      return info;
+      return state.getComponentInformation(component);
     } catch (YarnRuntimeException e) {
       throw new NotFoundException("Unknown component: " + component);
     } catch (Exception e) {
@@ -344,24 +299,6 @@ TODO: decide what structure to return here, then implement
       throw buildException(LIVE_STATISTICS, e);
     }
   }
-  
-  /**
-   * Look up all containers of a specific component name 
-   * @param component component/role name
-   * @return list of instances. This is a snapshot
-   */
-  private List<RoleInstance> lookupRoleContainers(String component) {
-    RoleStatus roleStatus = state.lookupRoleStatus(component);
-    List<RoleInstance> ownedContainerList = state.cloneOwnedContainerList();
-    List<RoleInstance> matching = new ArrayList<RoleInstance>(ownedContainerList.size());
-    int roleId = roleStatus.getPriority();
-    for (RoleInstance instance : ownedContainerList) {
-      if (instance.roleId == roleId) {
-        matching.add(instance);
-      }
-    }
-    return matching;
-  }
 
   /**
    * Helper method; look up an aggregate configuration in the cache from
@@ -378,6 +315,14 @@ TODO: decide what structure to return here, then implement
     }
   }
 
+
+  /**
+   * Helper method; look up an conf tree in the cache from
+   * a key, or raise an exception
+   * @param key key to resolve
+   * @return the configuration
+   * @throws WebApplicationException on a failure
+   */
   protected ConfTree lookupConfTree(String key) {
     try {
       return (ConfTree) cache.lookup(key);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ContentCache.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ContentCache.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ContentCache.java
index b60e9b3..8f026a1 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ContentCache.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ContentCache.java
@@ -18,8 +18,8 @@
 
 package org.apache.slider.server.appmaster.web.rest.application.resources;
 
-import com.google.common.base.Preconditions;
-
+import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
@@ -33,10 +33,35 @@ public class ContentCache extends ConcurrentHashMap<String, CachedContent> {
 
   public ContentCache() {
   }
-  
+
+
   public Object lookup(String key) throws Exception {
     CachedContent content = get(key);
-    Preconditions.checkNotNull(content, "no content for path " + key);
+    if (content == null) {
+      throw new FileNotFoundException("no content for path " + key);
+    }
     return content.get();
   }
+
+
+  /**
+   * Lookup a cached item. If an exception is raised on the refresh...
+   * <ol>
+   *   <li>IOExceptions are thrown directly</li>
+   *   <li>Other exceptions are wrapped with an IOExceptions</li>
+   * </ol>
+   * @param key
+   * @return
+   * @throws IOException
+   */
+  public Object lookupWithIOE(String key) throws IOException {
+    try {
+      return lookup(key);
+    } catch (IOException e) {
+      throw e;
+    } catch (Exception e) {
+      throw new IOException("Looking up " + key + ": " + e, e);
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/proto/SliderClusterMessages.proto
----------------------------------------------------------------------
diff --git a/slider-core/src/main/proto/SliderClusterMessages.proto b/slider-core/src/main/proto/SliderClusterMessages.proto
index 2c31c2e..bcf3fb7 100644
--- a/slider-core/src/main/proto/SliderClusterMessages.proto
+++ b/slider-core/src/main/proto/SliderClusterMessages.proto
@@ -308,3 +308,13 @@ message GetLiveComponentRequestProto {
 
 message GetApplicationLivenessRequestProto {
 }
+
+message EmptyPayloadProto {
+}
+
+/**
+  Generic JSON, often containing data structures serialized as a string
+*/
+message WrappedJsonProto {
+  required string json = 1;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/main/proto/SliderClusterProtocol.proto
----------------------------------------------------------------------
diff --git a/slider-core/src/main/proto/SliderClusterProtocol.proto b/slider-core/src/main/proto/SliderClusterProtocol.proto
index da09f3c..437e06f 100644
--- a/slider-core/src/main/proto/SliderClusterProtocol.proto
+++ b/slider-core/src/main/proto/SliderClusterProtocol.proto
@@ -136,5 +136,34 @@ service SliderClusterProtocolPB {
   rpc getLiveComponent(GetLiveComponentRequestProto) 
     returns(ComponentInformationProto);
   
+// AggregateConf getModelDesired()
+  rpc getModelDesired(EmptyPayloadProto) 
+    returns(WrappedJsonProto);
+
+  // ConfTree getModelDesiredAppconf
+  rpc getModelDesiredAppconf(EmptyPayloadProto) 
+    returns(WrappedJsonProto);
+
+    // ConfTree getModelDesiredResources
+  rpc getModelDesiredResources(EmptyPayloadProto) 
+    returns(WrappedJsonProto);
+  
+// AggregateConf getModelResolved()
+  rpc getModelResolved(EmptyPayloadProto) 
+    returns(WrappedJsonProto);
+
+  // ConfTree getModelResolvedAppconf
+  rpc getModelResolvedAppconf(EmptyPayloadProto) 
+    returns(WrappedJsonProto);
+
+    // ConfTree getModelResolvedResources
+  rpc getModelResolvedResources(EmptyPayloadProto) 
+    returns(WrappedJsonProto);
+
+    // ConfTree getLiveResources
+  rpc getLiveResources(EmptyPayloadProto) 
+    returns(WrappedJsonProto);
+
+  
   
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
index e42f13c..5d9d1d1 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
@@ -117,7 +117,7 @@ class TestMockAppStateAppRestIntegration extends BaseMockAppStateTest implements
     WebAppApi api = new WebAppApiImpl(stateAccess,
         new MockProviderService(),
         null, null,
-        new MetricsAndMonitoring("metrics"), null, null)
+        new MetricsAndMonitoring("metrics"), null, null, null)
     return api
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
index 62ceca5..9907b94 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestClusterSpecificationBlock.groovy
@@ -53,7 +53,7 @@ public class TestClusterSpecificationBlock {
         providerAppState,
         providerService,
         null,
-        null, null, null, null);
+        null, null, null, null, null);
 
     Injector injector = Guice.createInjector(new AbstractModule() {
           @Override

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
index 16bf23b..4ef70a3 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestContainerStatsBlock.groovy
@@ -29,7 +29,6 @@ import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR
 import org.apache.hadoop.yarn.webapp.hamlet.HamletImpl.EImp
 import org.apache.slider.api.ClusterNode
-import org.apache.slider.api.SliderClusterProtocol
 import org.apache.slider.providers.ProviderService
 import org.apache.slider.server.appmaster.model.mock.*
 import org.apache.slider.server.appmaster.state.ProviderAppState
@@ -62,7 +61,7 @@ public class TestContainerStatsBlock extends BaseMockAppStateTest {
         providerAppState,
         providerService,
         null,
-        null, metrics, null, null);
+        null, metrics, null, null, null);
 
     Injector injector = Guice.createInjector(new AbstractModule() {
           @Override

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
index eb68c8a..c44baee 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
@@ -24,7 +24,6 @@ import groovy.util.logging.Slf4j
 import org.apache.hadoop.yarn.api.records.Container
 import org.apache.hadoop.yarn.api.records.Priority
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet
-import org.apache.slider.api.SliderClusterProtocol
 import org.apache.slider.providers.ProviderService
 import org.apache.slider.server.appmaster.model.mock.*
 import org.apache.slider.server.appmaster.state.ProviderAppState
@@ -54,7 +53,7 @@ public class TestIndexBlock extends BaseMockAppStateTest {
         providerAppState,
         providerService,
         null,
-        null, metrics, null, null);
+        null, metrics, null, null, null);
 
     Injector injector = Guice.createInjector(new AbstractModule() {
           @Override

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
index edfebbd..d37fcea 100644
--- a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
+++ b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/agent/TestAMAgentWebServices.java
@@ -144,7 +144,7 @@ public class TestAMAgentWebServices {
 
     slider = new WebAppApiImpl(providerAppState,
                                new MockProviderService(), null, null, null,
-        null, null);
+        null, null, null);
 
     MapOperations compOperations = new MapOperations();
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/84134031/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
index badfbc3..90d40c6 100644
--- a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
+++ b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/management/TestAMManagementWebServices.java
@@ -192,7 +192,7 @@ public class TestAMManagementWebServices extends JerseyTest {
 
         slider = new WebAppApiImpl(providerAppState,
                                    new MockProviderService(), null, null, null,
-            null, null);
+            null, null, null);
 
         bind(SliderJacksonJaxbJsonProvider.class);
         bind(MockSliderAMWebServices.class);


[02/20] incubator-slider git commit: SLIDER-782: changing how the SliderClusterProtocolService gets inited; eliminates that race condition at startup where the ports live but the service not fully inited

Posted by st...@apache.org.
SLIDER-782: changing how the SliderClusterProtocolService gets inited; eliminates that race condition at startup where the ports live but the service not fully inited


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/ca1e0088
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/ca1e0088
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/ca1e0088

Branch: refs/heads/develop
Commit: ca1e0088a733f4ea3b44b6ec4fe7ec85b47f007c
Parents: 7632f5d
Author: Steve Loughran <st...@apache.org>
Authored: Wed Feb 11 16:05:47 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Feb 11 16:05:47 2015 +0000

----------------------------------------------------------------------
 .../server/appmaster/SliderAppMaster.java       | 39 +++++++++-----
 .../rpc/SliderClusterProtocolService.java       | 54 +++++++++++---------
 2 files changed, 55 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ca1e0088/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index ab67b16..8a33735 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -217,7 +217,8 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
   public static final int NUM_RPC_HANDLERS = 5;
 
   /**
-   * Metrics and monitoring services
+   * Metrics and monitoring services.
+   * Deployed in {@link #serviceInit(Configuration)}
    */
   private final MetricsAndMonitoring metricsAndMonitoring = new MetricsAndMonitoring(); 
   /**
@@ -292,6 +293,11 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
   private final AppState appState =
       new AppState(new ProtobufRecordFactory(), metricsAndMonitoring);
 
+  /**
+   * App state for external objects. This is almost entirely
+   * a read-only view of the application state. To change the state,
+   * Providers (or anything else) are expected to queue async changes.
+   */
   private final ProviderAppState stateForProviders =
       new ProviderAppState("undefined", appState);
 
@@ -303,12 +309,6 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
   private final Condition isAMCompleted = AMExecutionStateLock.newCondition();
 
   /**
-   * Exit code for the AM to return
-   */
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private int amExitCode =  0;
-  
-  /**
    * Flag set if the AM is to be shutdown
    */
   private final AtomicBoolean amCompletionFlag = new AtomicBoolean(false);
@@ -382,8 +382,16 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
   private SliderAMProviderService sliderAMProvider;
   private CertificateManager certificateManager;
 
+  /**
+   * Executor.
+   * Assigned in {@link #serviceInit(Configuration)}
+   */
   private WorkflowExecutorService<ExecutorService> executorService;
-  
+
+  /**
+   * Action queues. Created at instance creation, but
+   * added as a child and inited in {@link #serviceInit(Configuration)}
+   */
   private final QueueService actionQueues = new QueueService();
   private String agentOpsUrl;
   private String agentStatusUrl;
@@ -397,6 +405,11 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
    * The port for the web application
    */
   private int webAppPort;
+
+  /**
+   * Is security enabled?
+   * Set early on in the {@link #createAndRunCluster(String)} operation.
+   */
   private boolean securityEnabled;
 
   /**
@@ -923,9 +936,6 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
       startAgentWebApp(appInformation, serviceConf, webAppApi);
       deployWebApplication(webAppPort, webAppApi);
 
-      // bind the IPC service to the API
-      sliderIPCService.bind(webAppApi);
-      
       // schedule YARN Registry registration
       queue(new ActionRegisterServiceInstance(clustername, appid));
 
@@ -1425,7 +1435,6 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
     String appMessage = stopAction.getMessage();
     //stop the daemon & grab its exit code
     int exitCode = stopAction.getExitCode();
-    amExitCode = exitCode;
 
     appStatus = stopAction.getFinalApplicationStatus();
     if (!spawnedProcessExitedBeforeShutdownTriggered) {
@@ -1489,7 +1498,11 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
       throws IOException, SliderException {
     verifyIPCAccess();
 
-    sliderIPCService = new SliderClusterProtocolService();
+    sliderIPCService = new SliderClusterProtocolService(
+        this,
+        stateForProviders,
+        actionQueues,
+        metricsAndMonitoring);
 
     deployChildService(sliderIPCService);
     SliderClusterProtocolPBImpl protobufRelay =

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ca1e0088/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
index 613bda4..d467414 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolService.java
@@ -18,6 +18,7 @@
 
 package org.apache.slider.server.appmaster.rpc;
 
+import com.google.common.base.Preconditions;
 import org.apache.hadoop.ipc.ProtocolSignature;
 import org.apache.hadoop.service.AbstractService;
 import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
@@ -30,6 +31,7 @@ import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.exceptions.ServiceNotReadyException;
 import org.apache.slider.core.main.LauncherExitCodes;
 import org.apache.slider.core.persist.ConfTreeSerDeser;
+import org.apache.slider.server.appmaster.AppMasterActionOperations;
 import org.apache.slider.server.appmaster.actions.ActionFlexCluster;
 import org.apache.slider.server.appmaster.actions.ActionHalt;
 import org.apache.slider.server.appmaster.actions.ActionKillContainer;
@@ -39,7 +41,6 @@ import org.apache.slider.server.appmaster.actions.QueueAccess;
 import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
 import org.apache.slider.server.appmaster.state.RoleInstance;
 import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.WebAppApi;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -49,8 +50,6 @@ import java.util.concurrent.TimeUnit;
 
 /**
  * Implement the {@link SliderClusterProtocol}.
- * Important: not live until {@link #bind(WebAppApi)}
- * is invoked. Until then all RPC calls will raise an exception.
  */
 public class SliderClusterProtocolService extends AbstractService
     implements SliderClusterProtocol {
@@ -58,28 +57,38 @@ public class SliderClusterProtocolService extends AbstractService
   protected static final Logger log =
       LoggerFactory.getLogger(SliderClusterProtocol.class);
 
-  private WebAppApi appmaster;
-  private QueueAccess actionQueues;
-  private StateAccessForProviders appState;
-  private MetricsAndMonitoring metricsAndMonitoring;
+  private final QueueAccess actionQueues;
+  private final StateAccessForProviders appState;
+  private final MetricsAndMonitoring metricsAndMonitoring;
+  private final AppMasterActionOperations amOperations;
+  
+  /**
+   * This is the prefix used for metrics
+   */
   public static final String PROTOCOL_PREFIX =
       "org.apache.slider.api.SliderClusterProtocol.";
 
-  public SliderClusterProtocolService() {
-    super("SliderClusterProtocolService");
-  }
-
   /**
-   * Bind to the AM API
-   * @param appmaster api binding.
+   * Constructor
+   * @param amOperations access to any AM operations
+   * @param appState state view
+   * @param actionQueues queues for actions
+   * @param metricsAndMonitoring metrics
    */
-  public void bind(WebAppApi appmaster) {
-    this.appmaster = appmaster;
-    actionQueues = appmaster.getQueues();
-    appState = appmaster.getAppState();
-    metricsAndMonitoring = appmaster.getMetricsAndMonitoring();
+  public SliderClusterProtocolService(AppMasterActionOperations amOperations,
+      StateAccessForProviders appState,
+      QueueAccess actionQueues,
+      MetricsAndMonitoring metricsAndMonitoring) {
+    super("SliderClusterProtocolService");
+    Preconditions.checkArgument(amOperations != null, "null amOperations");
+    Preconditions.checkArgument(appState != null, "null appState");
+    Preconditions.checkArgument(actionQueues != null, "null actionQueues");
+    Preconditions.checkArgument(metricsAndMonitoring != null, "null metricsAndMonitoring");
+    this.appState = appState;
+    this.actionQueues = actionQueues;
+    this.metricsAndMonitoring = metricsAndMonitoring;
+    this.amOperations = amOperations;
   }
-  
 
   @Override   //SliderClusterProtocol
   public ProtocolSignature getProtocolSignature(String protocol,
@@ -105,11 +114,6 @@ public class SliderClusterProtocolService extends AbstractService
    */
   protected void onRpcCall(String operation) throws IOException {
     log.debug("Received call to {}", operation);
-    if (appmaster == null) {
-      // fail fast if the service is not ready
-      log.warn("Rejecting {} as service is not ready", operation);
-      throw new ServiceNotReadyException(ServiceNotReadyException.E_NOT_READY);
-    }
     metricsAndMonitoring.markMeterAndCounter(PROTOCOL_PREFIX + operation);
   }
 
@@ -270,7 +274,7 @@ public class SliderClusterProtocolService extends AbstractService
     RoleInstance instance =
         appState.getLiveInstanceByContainerID(containerID);
     queue(new ActionKillContainer(instance.getId(), 0, TimeUnit.MILLISECONDS,
-        appmaster.getAMOperations()));
+        amOperations));
     Messages.KillContainerResponseProto.Builder builder =
         Messages.KillContainerResponseProto.newBuilder();
     builder.setSuccess(true);


[17/20] incubator-slider git commit: SLIDER-782: "REST" test delegate for the IPC API; shares all the tests with the REST Slider Client API. Some exception translation now takes place, though only a little.

Posted by st...@apache.org.
SLIDER-782: "REST" test delegate for the IPC API; shares all the tests with the REST Slider Client API. Some exception translation now takes place, though only a little.


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/41244893
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/41244893
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/41244893

Branch: refs/heads/develop
Commit: 41244893c792d8c4932c8aa2683e4aaa8ea5de3a
Parents: 1474abc
Author: Steve Loughran <st...@apache.org>
Authored: Fri Feb 13 15:20:08 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Feb 13 15:20:08 2015 +0000

----------------------------------------------------------------------
 .../slider/api/proto/RestTypeMarshalling.java   |   9 +-
 .../client/ipc/SliderApplicationIpcClient.java  | 121 ++++++++++++++++---
 .../client/ipc/SliderClusterOperations.java     |   9 ++
 .../rest/SliderApplicationApiRestClient.java    |   9 ++
 .../core/exceptions/NoSuchNodeException.java    |   2 +-
 .../server/appmaster/SliderAppMaster.java       |   8 +-
 .../slider/server/appmaster/rpc/RpcBinder.java  |  64 ++++++----
 .../rpc/SliderClusterProtocolPBImpl.java        |  49 ++++++--
 .../rpc/SliderClusterProtocolProxy.java         |  15 ++-
 .../server/appmaster/rpc/SliderIPCService.java  |   1 +
 .../slider/server/appmaster/state/AppState.java |   2 +-
 .../rest/AbstractAppApiTestDelegates.groovy     |  32 ++++-
 .../agent/rest/IpcApiClientTestDelegates.java   |  29 +++++
 .../rest/RestAPIClientTestDelegates.groovy      |  20 +--
 .../slider/agent/rest/TestStandaloneREST.groovy |  12 ++
 15 files changed, 302 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
index 5c854a0..fcd8582 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
@@ -149,6 +149,7 @@ public class RestTypeMarshalling {
     if (info.component != null) {
       builder.setComponent(info.component);
     }
+    builder.setCreateTime(info.createTime);
     if (info.diagnostics != null) {
       builder.setDiagnostics(info.diagnostics);
     }
@@ -158,14 +159,14 @@ public class RestTypeMarshalling {
     if (info.hostURL != null) {
       builder.setHostURL(info.hostURL);
     }
-    if (info.released != null) {
-      builder.setReleased(info.released);
-    }
     if (info.output != null) {
       builder.addAllOutput(Arrays.asList(info.output));
     }
-    builder.setCreateTime(info.createTime);
+    if (info.released != null) {
+      builder.setReleased(info.released);
+    }
     builder.setStartTime(info.startTime);
+    builder.setState(info.state);
     return builder.build();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
index 6abbd85..13a2e03 100644
--- a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
@@ -18,6 +18,8 @@
 
 package org.apache.slider.client.ipc;
 
+import com.google.common.base.Preconditions;
+import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
@@ -25,14 +27,20 @@ import org.apache.slider.api.types.PingInformation;
 import org.apache.slider.api.SliderApplicationApi;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTreeOperations;
+import org.apache.slider.core.exceptions.NoSuchNodeException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Map;
 
 /**
  * Implementation of the Slider RESTy Application API over IPC.
+ * <p>
+ * Operations are executed via the {@link SliderClusterOperations}
+ * instance passed in; raised exceptions may be converted into ones
+ * consistent with the REST API.
  */
 public class SliderApplicationIpcClient implements SliderApplicationApi {
 
@@ -42,65 +50,137 @@ public class SliderApplicationIpcClient implements SliderApplicationApi {
   private final SliderClusterOperations operations;
 
   public SliderApplicationIpcClient(SliderClusterOperations operations) {
+    Preconditions.checkArgument(operations != null, "null operations");
     this.operations = operations;
   }
 
+  /**
+   * Convert received (And potentially unmarshalled) local/remote
+   * exceptions into the equivalents in the REST API.
+   * Best effort. 
+   * <p>
+   * If there is no translation, the original exception is returned.
+   * <p>
+   * If a new exception was created, it will have the message of the 
+   * string value of the original exception, and that original
+   * exception will be the nested cause of this one
+   * @param exception IOException to convert
+   * @return an exception to throw
+   */
+  private IOException convert(IOException exception) {
+    IOException result = exception;
+    if (exception instanceof NoSuchNodeException) {
+      result = new FileNotFoundException(exception.toString());
+      result.initCause(exception);
+    } else {
+      // TODO: remap any other exceptions
+    }
+    return result;
+  }
+  
+  public SliderApplicationIpcClient(SliderClusterProtocol proxy) {
+    this(new SliderClusterOperations(proxy));
+  }
+
   @Override
   public AggregateConf getDesiredModel() throws IOException {
-    return operations.getModelDesired();
+    try {
+      return operations.getModelDesired();
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public ConfTreeOperations getDesiredAppconf() throws IOException {
-    return operations.getModelDesiredAppconf();
+    try {
+      return operations.getModelDesiredAppconf();
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public ConfTreeOperations getDesiredResources() throws IOException {
-    return operations.getModelDesiredResources();
+    try {
+      return operations.getModelDesiredResources();
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public AggregateConf getResolvedModel() throws IOException {
-    return operations.getModelResolved();
+    try {
+      return operations.getModelResolved();
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public ConfTreeOperations getResolvedAppconf() throws IOException {
-    return operations.getModelResolvedAppconf();
+    try {
+      return operations.getModelResolvedAppconf();
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public ConfTreeOperations getResolvedResources() throws IOException {
-    return operations.getModelResolvedResources();
+    try {
+      return operations.getModelResolvedResources();
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public ConfTreeOperations getLiveResources() throws IOException {
-    return operations.getLiveResources();
+    try {
+      return operations.getLiveResources();
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public Map<String, ContainerInformation> enumContainers() throws IOException {
-    return operations.enumContainers();
+    try {
+      return operations.enumContainers();
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public ContainerInformation getContainer(String containerId) throws
       IOException {
-    return operations.getContainer(containerId);
+    try {
+      return operations.getContainer(containerId);
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public Map<String, ComponentInformation> enumComponents() throws IOException {
-    return operations.enumComponents();
+    try {
+      return operations.enumComponents();
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public ComponentInformation getComponent(String componentName) throws
       IOException {
-    return operations.getComponent(componentName);
-
+    try {
+      return operations.getComponent(componentName);
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
@@ -110,12 +190,25 @@ public class SliderApplicationIpcClient implements SliderApplicationApi {
 
   @Override
   public void stop(String text) throws IOException {
-    operations.stop(text);
+    try {
+      operations.stop(text);
+    } catch (IOException e) {
+      throw convert(e);
+    }
   }
 
   @Override
   public ApplicationLivenessInformation getApplicationLiveness() throws
       IOException {
-    return operations.getApplicationLiveness();
+    try {
+      return operations.getApplicationLiveness();
+    } catch (IOException e) {
+      throw convert(e);
+    }
+  }
+
+  @Override
+  public String toString() {
+    return "IPC implementation of SliderApplicationApi bonded to " + operations;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
index a78d539..faaf619 100644
--- a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
+++ b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
@@ -68,6 +68,15 @@ public class SliderClusterOperations {
     this.appMaster = appMaster;
   }
 
+  @Override
+  public String toString() {
+    final StringBuilder sb =
+        new StringBuilder("SliderClusterOperations{");
+    sb.append("IPC binding=").append(appMaster);
+    sb.append('}');
+    return sb.toString();
+  }
+
   /**
    * Get a node from the AM
    * @param uuid uuid of node

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
index c38d5b1..d1c81b0 100644
--- a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
@@ -62,6 +62,15 @@ public class SliderApplicationApiRestClient extends BaseRestClient
     this.appResource = appResource;
   }
 
+  @Override
+  public String toString() {
+    final StringBuilder sb =
+        new StringBuilder("SliderApplicationApiRestClient{");
+    sb.append("appResource=").append(appResource);
+    sb.append('}');
+    return sb.toString();
+  }
+
   /**
    * Create a resource under the application path set up to accept
    * JSON

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
index f86b336..ad2f1a4 100644
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
+++ b/slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
@@ -27,6 +27,6 @@ import java.io.IOException;
 public class NoSuchNodeException extends IOException {
 
   public NoSuchNodeException(String uuid) {
-    super("Unknown node: " + uuid);
+    super(uuid);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index 21c6eaf..f778138 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -1514,11 +1514,11 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
             protobufRelay);
 
     int port = getPortToRequest();
+    InetSocketAddress rpcAddress = new InetSocketAddress("0.0.0.0", port);
     rpcService =
-        new WorkflowRpcService("SliderRPC", RpcBinder.createProtobufServer(
-            new InetSocketAddress("0.0.0.0", port),
-            getConfig(),
-            secretManager,
+        new WorkflowRpcService("SliderRPC",
+            RpcBinder.createProtobufServer(rpcAddress, getConfig(),
+                secretManager,
             NUM_RPC_HANDLERS,
             blockingService,
             null));

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
index 080d0f2..9cc612e 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
@@ -43,6 +43,7 @@ import org.apache.hadoop.yarn.util.ConverterUtils;
 import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.common.SliderExitCodes;
 import org.apache.slider.common.tools.Duration;
+import org.apache.slider.common.tools.SliderUtils;
 import org.apache.slider.core.exceptions.BadClusterStateException;
 import org.apache.slider.core.exceptions.ErrorStrings;
 import org.apache.slider.core.exceptions.ServiceNotReadyException;
@@ -61,6 +62,17 @@ public class RpcBinder {
   protected static final Logger log =
     LoggerFactory.getLogger(RpcBinder.class);
 
+  /**
+   * Create a protobuf server bonded to the specific socket address
+   * @param addr address to listen to; 0.0.0.0 as hostname acceptable
+   * @param conf config
+   * @param secretManager token secret handler
+   * @param numHandlers threads to service requests
+   * @param blockingService service to handle
+   * @param portRangeConfig range of ports
+   * @return the IPC server itself
+   * @throws IOException
+   */
   public static Server createProtobufServer(InetSocketAddress addr,
                                             Configuration conf,
                                             SecretManager<? extends TokenIdentifier> secretManager,
@@ -89,7 +101,7 @@ public class RpcBinder {
 
   /**
    * Add the protobuf engine to the configuration. Harmless and inexpensive
-   * if repeated
+   * if repeated.
    * @param conf configuration to patch
    * @return the protocol class
    */
@@ -109,7 +121,7 @@ public class RpcBinder {
    * Verify that the conf is set up for protobuf transport of Slider RPC
    * @param conf configuration
    * @param sliderClusterAPIClass class for the API
-   * @return
+   * @return true if the RPC engine is protocol buffers
    */
   public static boolean verifyBondedToProtobuf(Configuration conf,
                                                 Class<SliderClusterProtocolPB> sliderClusterAPIClass) {
@@ -131,8 +143,8 @@ public class RpcBinder {
                                                     UserGroupInformation currentUser,
                                                     Configuration conf,
                                                     int rpcTimeout) throws IOException {
-    Class<SliderClusterProtocolPB> sliderClusterAPIClass = registerSliderAPI(
-        conf);
+    Class<SliderClusterProtocolPB> sliderClusterAPIClass =
+        registerSliderAPI(conf);
 
     final RetryPolicy retryPolicy =
         RetryUtils.getDefaultRetryPolicy(
@@ -178,20 +190,17 @@ public class RpcBinder {
                                       final ApplicationClientProtocol rmClient,
                                       ApplicationReport application,
                                       final int connectTimeout,
-                                      
-                                      final int rpcTimeout) throws
-                                                            IOException,
-                                                            YarnException,
-                                                            InterruptedException {
+                                      final int rpcTimeout)
+      throws IOException, YarnException, InterruptedException {
     ApplicationId appId;
     appId = application.getApplicationId();
     Duration timeout = new Duration(connectTimeout);
     timeout.start();
     Exception exception = null;
     YarnApplicationState state = null;
-    while (application != null && 
-           (state= application.getYarnApplicationState()).equals(
-             YarnApplicationState.RUNNING)) {
+    while (application != null &&
+           (state = application.getYarnApplicationState()).equals(
+               YarnApplicationState.RUNNING)) {
 
       try {
         return getProxy(conf, application, rpcTimeout);
@@ -205,7 +214,6 @@ public class RpcBinder {
           throw e;
         }
         exception = e;
-
       }
       //at this point: app failed to work
       log.debug("Could not connect to {}. Waiting for getting the latest AM address...",
@@ -213,8 +221,8 @@ public class RpcBinder {
       Thread.sleep(1000);
       //or get the app report
       application =
-        rmClient.getApplicationReport(GetApplicationReportRequest.newInstance(
-          appId)).getApplicationReport();
+        rmClient.getApplicationReport(
+            GetApplicationReportRequest.newInstance(appId)).getApplicationReport();
     }
     //get here if the app is no longer running. Raise a specific
     //exception but init it with the previous failure
@@ -223,17 +231,25 @@ public class RpcBinder {
                             ErrorStrings.E_FINISHED_APPLICATION, appId, state );
   }
 
+  /**
+   * Get a proxy from the application report
+   * @param conf config to use
+   * @param application app report
+   * @param rpcTimeout timeout in RPC operations
+   * @return the proxy
+   * @throws IOException
+   * @throws SliderException
+   * @throws InterruptedException
+   */
   public static SliderClusterProtocol getProxy(final Configuration conf,
-      ApplicationReport application,
-      final int rpcTimeout) throws
-      IOException,
-      SliderException,
-      InterruptedException {
+      final ApplicationReport application,
+      final int rpcTimeout)
+      throws IOException, SliderException, InterruptedException {
 
     String host = application.getHost();
     int port = application.getRpcPort();
     String address = host + ":" + port;
-    if (host == null || 0 == port) {
+    if (SliderUtils.isUnset(host) || 0 == port) {
       throw new SliderException(SliderExitCodes.EXIT_CONNECTIVITY_PROBLEM,
                               "Slider instance " + application.getName()
                               + " isn't providing a valid address for the" +
@@ -243,8 +259,8 @@ public class RpcBinder {
     UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
     final UserGroupInformation newUgi = UserGroupInformation.createRemoteUser(
       currentUser.getUserName());
-    final InetSocketAddress serviceAddr = NetUtils.createSocketAddrForHost(
-      application.getHost(), application.getRpcPort());
+    final InetSocketAddress serviceAddr =
+        NetUtils.createSocketAddrForHost(host, port);
     SliderClusterProtocol realProxy;
 
     log.debug("Connecting to {}", serviceAddr);
@@ -262,7 +278,7 @@ public class RpcBinder {
           }
         });
     } else {
-      return connectToServer(serviceAddr, newUgi, conf, rpcTimeout);
+      realProxy = connectToServer(serviceAddr, newUgi, conf, rpcTimeout);
     }
     return realProxy;
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
index d34ce42..dded9b9 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
@@ -149,8 +149,7 @@ public class SliderClusterProtocolPBImpl implements SliderClusterProtocolPB {
       throw wrap(e);
     }
   }
-
-
+  
   @Override
   public Messages.AMSuicideResponseProto amSuicide(RpcController controller,
                                                    Messages.AMSuicideRequestProto request) throws
@@ -173,8 +172,7 @@ public class SliderClusterProtocolPBImpl implements SliderClusterProtocolPB {
       throw wrap(e);
     }
   }
-
-
+  
   @Override
   public Messages.GetLiveContainersResponseProto getLiveContainers(RpcController controller,
       Messages.GetLiveContainersRequestProto request) throws ServiceException {
@@ -218,42 +216,69 @@ public class SliderClusterProtocolPBImpl implements SliderClusterProtocolPB {
   @Override
   public Messages.WrappedJsonProto getModelDesired(RpcController controller,
       Messages.EmptyPayloadProto request) throws ServiceException {
-    return null;
+    try {
+      return real.getModelDesired(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
   }
 
   @Override
   public Messages.WrappedJsonProto getModelDesiredAppconf(RpcController controller,
       Messages.EmptyPayloadProto request) throws ServiceException {
-    return null;
-  }
+    try {
+      return real.getModelDesiredAppconf(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }  }
 
   @Override
   public Messages.WrappedJsonProto getModelDesiredResources(RpcController controller,
       Messages.EmptyPayloadProto request) throws ServiceException {
-    return null;
+    try {
+      return real.getModelDesiredResources(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
   }
 
   @Override
   public Messages.WrappedJsonProto getModelResolved(RpcController controller,
       Messages.EmptyPayloadProto request) throws ServiceException {
-    return null;
+    try {
+      return real.getModelResolved(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
   }
 
   @Override
   public Messages.WrappedJsonProto getModelResolvedAppconf(RpcController controller,
       Messages.EmptyPayloadProto request) throws ServiceException {
-    return null;
+    try {
+      return real.getModelResolvedAppconf(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
   }
 
   @Override
   public Messages.WrappedJsonProto getModelResolvedResources(RpcController controller,
       Messages.EmptyPayloadProto request) throws ServiceException {
-    return null;
+    try {
+      return real.getModelResolvedResources(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
   }
 
   @Override
   public Messages.WrappedJsonProto getLiveResources(RpcController controller,
       Messages.EmptyPayloadProto request) throws ServiceException {
-    return null;
+    try {
+      return real.getLiveResources(request);
+    } catch (Exception e) {
+      throw wrap(e);
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
index a5e80fd..7ecbbb6 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
@@ -18,6 +18,7 @@
 
 package org.apache.slider.server.appmaster.rpc;
 
+import com.google.common.base.Preconditions;
 import com.google.protobuf.RpcController;
 import com.google.protobuf.ServiceException;
 import org.apache.hadoop.ipc.ProtobufHelper;
@@ -39,10 +40,20 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
 
   public SliderClusterProtocolProxy(SliderClusterProtocolPB endpoint,
       InetSocketAddress address) {
+    Preconditions.checkArgument(endpoint != null, "null endpoint");
+    Preconditions.checkNotNull(address != null, "null address");
     this.endpoint = endpoint;
     this.address = address;
   }
 
+  @Override
+  public String toString() {
+    final StringBuilder sb =
+        new StringBuilder("SliderClusterProtocolProxy{");
+    sb.append("address=").append(address);
+    sb.append('}');
+    return sb.toString();
+  }
 
   @Override
   public ProtocolSignature getProtocolSignature(String protocol,
@@ -72,9 +83,7 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
     IOException ioe = ProtobufHelper.getRemoteException(se);
     if (ioe instanceof RemoteException) {
       RemoteException remoteException = (RemoteException) ioe;
-      return new RemoteException(
-          remoteException.getClassName(),
-          address.toString() + ": " + remoteException.getMessage());
+      return remoteException.unwrapRemoteException();
     }
     return ioe;
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
index 07b91b8..882c963 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
@@ -32,6 +32,7 @@ import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
+import org.apache.slider.core.exceptions.NoSuchNodeException;
 import org.apache.slider.core.exceptions.ServiceNotReadyException;
 import org.apache.slider.core.main.LauncherExitCodes;
 import org.apache.slider.core.persist.AggregateConfSerDeser;

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
index 854a706..4652701 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
@@ -1037,7 +1037,7 @@ public class AppState {
       return found;
     } else {
       //at this point: no node
-      throw new NoSuchNodeException(containerId);
+      throw new NoSuchNodeException("Unknown node: " + containerId);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
index f510c5a..0310be5 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
@@ -35,15 +35,25 @@ import static org.apache.slider.common.SliderKeys.COMPONENT_AM
 @Slf4j
 public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelegate {
 
-  protected SliderApplicationApi appAPI;
+  private SliderApplicationApi appAPI;
 
   AbstractAppApiTestDelegates(
       boolean enableComplexVerbs,
       SliderApplicationApi appAPI) {
     super(enableComplexVerbs)
-    this.appAPI = appAPI
+    if (appAPI) {
+      setAppAPI(appAPI)
+    }
   }
 
+  SliderApplicationApi getAppAPI() {
+    return appAPI
+  }
+
+  protected void setAppAPI(SliderApplicationApi appAPI) {
+    log.info("Setting API implementation to $appAPI")
+    this.appAPI = appAPI
+  }
 
   public void testGetDesiredModel() throws Throwable {
     appAPI.getDesiredModel()
@@ -92,7 +102,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
     assert amContainerInfo.component == COMPONENT_AM
     assert amContainerInfo.createTime > 0
     assert amContainerInfo.exitCode == null
-    assert amContainerInfo.output == null
+    assert amContainerInfo.output == null || !amContainerInfo.output.length
     assert amContainerInfo.released == null
     assert amContainerInfo.state == StateValues.STATE_LIVE
 
@@ -205,4 +215,20 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
       return Outcome.Success
     }
   }
+  
+  @Override
+  public void testSuiteGetOperations() {
+    testGetDesiredModel()
+    testGetResolvedModel()
+    testLiveResources()
+    testLiveContainers();
+    testRESTModel()
+    testAppLiveness()
+  }
+
+  @Override
+  public void testSuiteComplexVerbs() {
+    testPing();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/test/groovy/org/apache/slider/agent/rest/IpcApiClientTestDelegates.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/IpcApiClientTestDelegates.java b/slider-core/src/test/groovy/org/apache/slider/agent/rest/IpcApiClientTestDelegates.java
new file mode 100644
index 0000000..9411c3c
--- /dev/null
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/IpcApiClientTestDelegates.java
@@ -0,0 +1,29 @@
+/*
+ * 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.slider.agent.rest;
+
+import org.apache.slider.api.SliderApplicationApi;
+
+public class IpcApiClientTestDelegates extends AbstractAppApiTestDelegates {
+
+  public IpcApiClientTestDelegates(SliderApplicationApi appAPI) {
+    super(true, appAPI);
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
index d57a2a1..99129e5 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
@@ -36,7 +36,12 @@ import static org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_
 @Slf4j
 class RestAPIClientTestDelegates extends AbstractAppApiTestDelegates {
 
-
+  /**
+   * constructor
+   * @param appmaster AM URL
+   * @param jersey jersey impl
+   * @param enableComplexVerbs flag to enable complex verbs
+   */
   RestAPIClientTestDelegates(String appmaster, Client jersey,
       boolean enableComplexVerbs = true) {
     super(enableComplexVerbs, null)
@@ -47,17 +52,4 @@ class RestAPIClientTestDelegates extends AbstractAppApiTestDelegates {
   }
 
 
-  public void testSuiteGetOperations() {
-    testGetDesiredModel()
-    testGetResolvedModel()
-    testLiveResources()
-    testLiveContainers();
-    testRESTModel()
-    testAppLiveness()
-  }
-
-  public void testSuiteComplexVerbs() {
-    testPing();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/41244893/slider-core/src/test/groovy/org/apache/slider/agent/rest/TestStandaloneREST.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/TestStandaloneREST.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/TestStandaloneREST.groovy
index 7306c48..7e10d30 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/TestStandaloneREST.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/TestStandaloneREST.groovy
@@ -32,12 +32,14 @@ import org.apache.hadoop.registry.client.api.RegistryOperations
 import org.apache.hadoop.yarn.api.records.ApplicationReport
 import org.apache.slider.agent.AgentMiniClusterTestBase
 import org.apache.slider.client.SliderClient
+import org.apache.slider.client.ipc.SliderApplicationIpcClient
 import org.apache.slider.client.rest.RestClientFactory
 import org.apache.slider.common.SliderKeys
 import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.core.main.ServiceLauncher
 import org.apache.slider.core.restclient.HttpOperationResponse
+import org.apache.slider.server.appmaster.rpc.RpcBinder
 import org.junit.Test
 
 import static org.apache.slider.server.appmaster.management.MetricsKeys.METRICS_LOGGING_ENABLED
@@ -73,6 +75,7 @@ class TestStandaloneREST extends AgentMiniClusterTestBase {
     def proxyAM = report.trackingUrl
     def directAM = report.originalTrackingUrl
     
+    
     // set up url config to match
     initHttpTestSupport(launcher.configuration)
 
@@ -171,6 +174,15 @@ class TestStandaloneREST extends AgentMiniClusterTestBase {
       sliderApplicationApi.ping("registry located")
     }
 
+    describe( "IPC equivalent operations")
+    def sliderClusterProtocol = RpcBinder.getProxy(conf, report, 1000)
+    SliderApplicationIpcClient ipcClient =
+        new SliderApplicationIpcClient(sliderClusterProtocol)
+    IpcApiClientTestDelegates ipcDelegates =
+        new IpcApiClientTestDelegates(ipcClient)
+    ipcDelegates.testSuiteAll()
+    
+    
     // log the metrics to show what's up
     direct.logCodahaleMetrics();
 


[11/20] incubator-slider git commit: SLIDER-782 move IPC class SliderClusterOperations under IPC package

Posted by st...@apache.org.
SLIDER-782 move IPC class SliderClusterOperations under IPC package


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/eb14df4a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/eb14df4a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/eb14df4a

Branch: refs/heads/develop
Commit: eb14df4a3e2fa0d68dd95da523a0d5a9c5209f1d
Parents: 8413403
Author: Steve Loughran <st...@apache.org>
Authored: Thu Feb 12 18:16:00 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Feb 12 18:16:00 2015 +0000

----------------------------------------------------------------------
 .../org/apache/slider/client/SliderClient.java  |   3 +-
 .../slider/client/SliderClusterOperations.java  | 343 -------------------
 .../client/ipc/SliderClusterOperations.java     | 343 +++++++++++++++++++
 3 files changed, 345 insertions(+), 344 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eb14df4a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index 27716bd..5cbe945 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -71,6 +71,7 @@ import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.api.StateValues;
 import org.apache.slider.api.proto.Messages;
 import org.apache.slider.api.types.SliderInstanceDescription;
+import org.apache.slider.client.ipc.SliderClusterOperations;
 import org.apache.slider.common.Constants;
 import org.apache.slider.common.SliderExitCodes;
 import org.apache.slider.common.SliderKeys;
@@ -2696,7 +2697,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
    * @throws YarnException YARN issues
    * @throws IOException IO problems
    */
-  public SliderClusterOperations createClusterOperations() throws
+  private SliderClusterOperations createClusterOperations() throws
                                                          YarnException,
                                                          IOException {
     if (sliderClusterOperations == null) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eb14df4a/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java b/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
deleted file mode 100644
index 7191c66..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClusterOperations.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * 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.slider.client;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.StateValues;
-import org.apache.slider.api.proto.Messages;
-
-import static org.apache.slider.api.proto.RestTypeMarshalling.*;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.common.tools.Duration;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.WaitTimeoutException;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.codehaus.jackson.JsonParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Cluster operations at a slightly higher level than the RPC code
- */
-public class SliderClusterOperations {
-  protected static final Logger
-    log = LoggerFactory.getLogger(SliderClusterOperations.class);
-  
-  private final SliderClusterProtocol appMaster;
-
-  public SliderClusterOperations(SliderClusterProtocol appMaster) {
-    this.appMaster = appMaster;
-  }
-
-  /**
-   * Get a node from the AM
-   * @param uuid uuid of node
-   * @return deserialized node
-   * @throws IOException IO problems
-   * @throws NoSuchNodeException if the node isn't found
-   */
-  public ClusterNode getNode(String uuid)
-    throws IOException, NoSuchNodeException, YarnException {
-    Messages.GetNodeRequestProto req =
-      Messages.GetNodeRequestProto.newBuilder().setUuid(uuid).build();
-    Messages.GetNodeResponseProto node = appMaster.getNode(req);
-    return ClusterNode.fromProtobuf(node.getClusterNode());
-  }
-
-  public List<ClusterNode> convertNodeWireToClusterNodes(List<Messages.RoleInstanceState> nodes)
-    throws IOException {
-    List<ClusterNode> nodeList = new ArrayList<ClusterNode>(nodes.size());
-    for (Messages.RoleInstanceState node : nodes) {
-      nodeList.add(ClusterNode.fromProtobuf(node));
-    }
-    return nodeList;
-  }
-
-  /**
-   * Echo text (debug action)
-   * @param text text
-   * @return the text, echoed back
-   * @throws YarnException
-   * @throws IOException
-   */
-  public String echo(String text) throws
-                                          YarnException,
-                                          IOException {
-    Messages.EchoRequestProto.Builder builder =
-      Messages.EchoRequestProto.newBuilder();
-    builder.setText(text);
-    Messages.EchoRequestProto req =
-      builder.build();
-    Messages.EchoResponseProto response =
-      appMaster.echo(req);
-    return response.getText();
-  }
-
-
-  /**
-   * Connect to a live cluster and get its current state
-   * @return its description
-   */
-  public ClusterDescription getClusterDescription()
-    throws YarnException, IOException {
-    
-    Messages.GetJSONClusterStatusRequestProto req =
-      Messages.GetJSONClusterStatusRequestProto.newBuilder().build();
-    Messages.GetJSONClusterStatusResponseProto resp =
-      appMaster.getJSONClusterStatus(req);
-    String statusJson = resp.getClusterSpec();
-    try {
-      return ClusterDescription.fromJson(statusJson);
-    } catch (JsonParseException e) {
-      log.error(
-        "Exception " + e + " parsing:\n" + statusJson,
-        e);
-      throw e;
-    }
-  }
-
-  public AggregateConf getInstanceDefinition()
-    throws YarnException, IOException {
-    Messages.GetInstanceDefinitionRequestProto.Builder builder =
-      Messages.GetInstanceDefinitionRequestProto.newBuilder();
-
-    Messages.GetInstanceDefinitionRequestProto request = builder.build();
-    Messages.GetInstanceDefinitionResponseProto response =
-      appMaster.getInstanceDefinition(request);
-
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-
-    ConfTree internal = confTreeSerDeser.fromJson(response.getInternal());
-    ConfTree resources = confTreeSerDeser.fromJson(response.getResources());
-    ConfTree app = confTreeSerDeser.fromJson(response.getApplication());
-    AggregateConf instanceDefinition =
-      new AggregateConf(resources, app, internal);
-    return instanceDefinition;
-  }
-  /**
-   * Kill a container
-   * @param id container ID
-   * @return a success flag
-   * @throws YarnException
-   * @throws IOException
-   */
-  public boolean killContainer(String id) throws
-                                          YarnException,
-                                          IOException {
-    Messages.KillContainerRequestProto.Builder builder =
-      Messages.KillContainerRequestProto.newBuilder();
-    builder.setId(id);
-    Messages.KillContainerRequestProto req =
-      builder.build();
-    Messages.KillContainerResponseProto response =
-      appMaster.killContainer(req);
-    return response.getSuccess();
-  }
-
-  /**
-   * List all node UUIDs in a role
-   * @param role role name or "" for all
-   * @return an array of UUID strings
-   * @throws IOException
-   * @throws YarnException
-   */
-  public String[] listNodeUUIDsByRole(String role) throws
-                                                   IOException,
-                                                   YarnException {
-    Collection<String> uuidList = innerListNodeUUIDSByRole(role);
-    String[] uuids = new String[uuidList.size()];
-    return uuidList.toArray(uuids);
-  }
-
-  public List<String> innerListNodeUUIDSByRole(String role) throws
-                                                             IOException,
-                                                             YarnException {
-    Messages.ListNodeUUIDsByRoleRequestProto req =
-      Messages.ListNodeUUIDsByRoleRequestProto
-              .newBuilder()
-              .setRole(role)
-              .build();
-    Messages.ListNodeUUIDsByRoleResponseProto resp =
-      appMaster.listNodeUUIDsByRole(req);
-    return resp.getUuidList();
-  }
-
-  /**
-   * List all nodes in a role. This is a double round trip: once to list
-   * the nodes in a role, another to get their details
-   * @param role
-   * @return an array of ContainerNode instances
-   * @throws IOException
-   * @throws YarnException
-   */
-  public List<ClusterNode> listClusterNodesInRole(String role) throws
-                                                               IOException,
-                                                               YarnException {
-
-    Collection<String> uuidList = innerListNodeUUIDSByRole(role);
-    Messages.GetClusterNodesRequestProto req =
-      Messages.GetClusterNodesRequestProto
-              .newBuilder()
-              .addAllUuid(uuidList)
-              .build();
-    Messages.GetClusterNodesResponseProto resp = appMaster.getClusterNodes(req);
-    return convertNodeWireToClusterNodes(resp.getClusterNodeList());
-  }
-
-  /**
-   * Get the details on a list of uuids
-   * @param uuids
-   * @return a possibly empty list of node details
-   * @throws IOException
-   * @throws YarnException
-   */
-  @VisibleForTesting
-  public List<ClusterNode> listClusterNodes(String[] uuids) throws
-                                                            IOException,
-                                                            YarnException {
-
-    Messages.GetClusterNodesRequestProto req =
-      Messages.GetClusterNodesRequestProto
-              .newBuilder()
-              .addAllUuid(Arrays.asList(uuids))
-              .build();
-    Messages.GetClusterNodesResponseProto resp = appMaster.getClusterNodes(req);
-    return convertNodeWireToClusterNodes(resp.getClusterNodeList());
-  }
-
-  /**
-   * Wait for an instance of a named role to be live (or past it in the lifecycle)
-   * @param role role to look for
-   * @param timeout time to wait
-   * @return the state. If still in CREATED, the cluster didn't come up
-   * in the time period. If LIVE, all is well. If >LIVE, it has shut for a reason
-   * @throws IOException IO
-   * @throws SliderException Slider
-   * @throws WaitTimeoutException if the wait timed out
-   */
-  @VisibleForTesting
-  public int waitForRoleInstanceLive(String role, long timeout)
-    throws WaitTimeoutException, IOException, YarnException {
-    Duration duration = new Duration(timeout).start();
-    boolean live = false;
-    int state = StateValues.STATE_CREATED;
-
-    log.info("Waiting {} millis for a live node in role {}", timeout, role);
-    while (!live) {
-      // see if there is a node in that role yet
-      List<String> uuids = innerListNodeUUIDSByRole(role);
-      String[] containers = uuids.toArray(new String[uuids.size()]);
-      int roleCount = containers.length;
-      ClusterNode roleInstance = null;
-      if (roleCount != 0) {
-
-        // if there is, get the node
-        roleInstance = getNode(containers[0]);
-        if (roleInstance != null) {
-          state = roleInstance.state;
-          live = state >= StateValues.STATE_LIVE;
-        }
-      }
-      if (!live) {
-        if (duration.getLimitExceeded()) {
-          throw new WaitTimeoutException(
-            String.format("Timeout after %d millis" +
-                          " waiting for a live instance of type %s; " +
-                          "instances found %d %s",
-                          timeout, role, roleCount,
-                          (roleInstance != null
-                           ? (" instance -\n" + roleInstance.toString())
-                           : "")
-                         ));
-        } else {
-          try {
-            Thread.sleep(1000);
-          } catch (InterruptedException ignored) {
-            // ignored
-          }
-        }
-      }
-    }
-    return state;
-  }
-  
-  public boolean flex(ConfTree resources) throws IOException, YarnException {
-    Messages.FlexClusterRequestProto request =
-      Messages.FlexClusterRequestProto.newBuilder()
-              .setClusterSpec(resources.toJson())
-              .build();
-    Messages.FlexClusterResponseProto response =
-      appMaster.flexCluster(request);
-    return response.getResponse();
-  }
-
-
-  /**
-   * Commit (possibly delayed) AM suicide
-   *
-   * @param signal exit code
-   * @param text text text to log
-   * @param delay delay in millis
-   * @throws YarnException
-   * @throws IOException
-   */
-  public void amSuicide(String text, int signal, int delay)
-      throws YarnException, IOException {
-    Messages.AMSuicideRequestProto.Builder builder =
-      Messages.AMSuicideRequestProto.newBuilder();
-    if (text != null) {
-      builder.setText(text);
-    }
-    builder.setSignal(signal);
-    builder.setDelay(delay);
-    Messages.AMSuicideRequestProto req =
-      builder.build();
-    Messages.AMSuicideResponseProto response =
-      appMaster.amSuicide(req);
-  }
-
-  /**
-   * Get the application liveness
-   * @return current liveness information
-   * @throws IOException
-   */
-  public ApplicationLivenessInformation getLivenessInformation() throws IOException {
-    Messages.GetApplicationLivenessRequestProto.Builder builder =
-        Messages.GetApplicationLivenessRequestProto.newBuilder();
-    Messages.ApplicationLivenessInformationProto wire =
-        appMaster.getLivenessInformation(builder.build());
-    return unmarshall(wire);
-
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eb14df4a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
new file mode 100644
index 0000000..2e8042d
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
@@ -0,0 +1,343 @@
+/*
+ * 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.slider.client.ipc;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.slider.api.ClusterDescription;
+import org.apache.slider.api.ClusterNode;
+import org.apache.slider.api.SliderClusterProtocol;
+import org.apache.slider.api.StateValues;
+import org.apache.slider.api.proto.Messages;
+
+import static org.apache.slider.api.proto.RestTypeMarshalling.*;
+import org.apache.slider.api.types.ApplicationLivenessInformation;
+import org.apache.slider.common.tools.Duration;
+import org.apache.slider.core.conf.AggregateConf;
+import org.apache.slider.core.conf.ConfTree;
+import org.apache.slider.core.exceptions.NoSuchNodeException;
+import org.apache.slider.core.exceptions.SliderException;
+import org.apache.slider.core.exceptions.WaitTimeoutException;
+import org.apache.slider.core.persist.ConfTreeSerDeser;
+import org.codehaus.jackson.JsonParseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Cluster operations at a slightly higher level than the RPC code
+ */
+public class SliderClusterOperations {
+  protected static final Logger
+    log = LoggerFactory.getLogger(SliderClusterOperations.class);
+  
+  private final SliderClusterProtocol appMaster;
+
+  public SliderClusterOperations(SliderClusterProtocol appMaster) {
+    this.appMaster = appMaster;
+  }
+
+  /**
+   * Get a node from the AM
+   * @param uuid uuid of node
+   * @return deserialized node
+   * @throws IOException IO problems
+   * @throws NoSuchNodeException if the node isn't found
+   */
+  public ClusterNode getNode(String uuid)
+    throws IOException, NoSuchNodeException, YarnException {
+    Messages.GetNodeRequestProto req =
+      Messages.GetNodeRequestProto.newBuilder().setUuid(uuid).build();
+    Messages.GetNodeResponseProto node = appMaster.getNode(req);
+    return ClusterNode.fromProtobuf(node.getClusterNode());
+  }
+
+  public List<ClusterNode> convertNodeWireToClusterNodes(List<Messages.RoleInstanceState> nodes)
+    throws IOException {
+    List<ClusterNode> nodeList = new ArrayList<ClusterNode>(nodes.size());
+    for (Messages.RoleInstanceState node : nodes) {
+      nodeList.add(ClusterNode.fromProtobuf(node));
+    }
+    return nodeList;
+  }
+
+  /**
+   * Echo text (debug action)
+   * @param text text
+   * @return the text, echoed back
+   * @throws YarnException
+   * @throws IOException
+   */
+  public String echo(String text) throws
+                                          YarnException,
+                                          IOException {
+    Messages.EchoRequestProto.Builder builder =
+      Messages.EchoRequestProto.newBuilder();
+    builder.setText(text);
+    Messages.EchoRequestProto req =
+      builder.build();
+    Messages.EchoResponseProto response =
+      appMaster.echo(req);
+    return response.getText();
+  }
+
+
+  /**
+   * Connect to a live cluster and get its current state
+   * @return its description
+   */
+  public ClusterDescription getClusterDescription()
+    throws YarnException, IOException {
+    
+    Messages.GetJSONClusterStatusRequestProto req =
+      Messages.GetJSONClusterStatusRequestProto.newBuilder().build();
+    Messages.GetJSONClusterStatusResponseProto resp =
+      appMaster.getJSONClusterStatus(req);
+    String statusJson = resp.getClusterSpec();
+    try {
+      return ClusterDescription.fromJson(statusJson);
+    } catch (JsonParseException e) {
+      log.error(
+        "Exception " + e + " parsing:\n" + statusJson,
+        e);
+      throw e;
+    }
+  }
+
+  public AggregateConf getInstanceDefinition()
+    throws YarnException, IOException {
+    Messages.GetInstanceDefinitionRequestProto.Builder builder =
+      Messages.GetInstanceDefinitionRequestProto.newBuilder();
+
+    Messages.GetInstanceDefinitionRequestProto request = builder.build();
+    Messages.GetInstanceDefinitionResponseProto response =
+      appMaster.getInstanceDefinition(request);
+
+    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
+
+    ConfTree internal = confTreeSerDeser.fromJson(response.getInternal());
+    ConfTree resources = confTreeSerDeser.fromJson(response.getResources());
+    ConfTree app = confTreeSerDeser.fromJson(response.getApplication());
+    AggregateConf instanceDefinition =
+      new AggregateConf(resources, app, internal);
+    return instanceDefinition;
+  }
+  /**
+   * Kill a container
+   * @param id container ID
+   * @return a success flag
+   * @throws YarnException
+   * @throws IOException
+   */
+  public boolean killContainer(String id) throws
+                                          YarnException,
+                                          IOException {
+    Messages.KillContainerRequestProto.Builder builder =
+      Messages.KillContainerRequestProto.newBuilder();
+    builder.setId(id);
+    Messages.KillContainerRequestProto req =
+      builder.build();
+    Messages.KillContainerResponseProto response =
+      appMaster.killContainer(req);
+    return response.getSuccess();
+  }
+
+  /**
+   * List all node UUIDs in a role
+   * @param role role name or "" for all
+   * @return an array of UUID strings
+   * @throws IOException
+   * @throws YarnException
+   */
+  public String[] listNodeUUIDsByRole(String role) throws
+                                                   IOException,
+                                                   YarnException {
+    Collection<String> uuidList = innerListNodeUUIDSByRole(role);
+    String[] uuids = new String[uuidList.size()];
+    return uuidList.toArray(uuids);
+  }
+
+  public List<String> innerListNodeUUIDSByRole(String role) throws
+                                                             IOException,
+                                                             YarnException {
+    Messages.ListNodeUUIDsByRoleRequestProto req =
+      Messages.ListNodeUUIDsByRoleRequestProto
+              .newBuilder()
+              .setRole(role)
+              .build();
+    Messages.ListNodeUUIDsByRoleResponseProto resp =
+      appMaster.listNodeUUIDsByRole(req);
+    return resp.getUuidList();
+  }
+
+  /**
+   * List all nodes in a role. This is a double round trip: once to list
+   * the nodes in a role, another to get their details
+   * @param role
+   * @return an array of ContainerNode instances
+   * @throws IOException
+   * @throws YarnException
+   */
+  public List<ClusterNode> listClusterNodesInRole(String role) throws
+                                                               IOException,
+                                                               YarnException {
+
+    Collection<String> uuidList = innerListNodeUUIDSByRole(role);
+    Messages.GetClusterNodesRequestProto req =
+      Messages.GetClusterNodesRequestProto
+              .newBuilder()
+              .addAllUuid(uuidList)
+              .build();
+    Messages.GetClusterNodesResponseProto resp = appMaster.getClusterNodes(req);
+    return convertNodeWireToClusterNodes(resp.getClusterNodeList());
+  }
+
+  /**
+   * Get the details on a list of uuids
+   * @param uuids
+   * @return a possibly empty list of node details
+   * @throws IOException
+   * @throws YarnException
+   */
+  @VisibleForTesting
+  public List<ClusterNode> listClusterNodes(String[] uuids) throws
+                                                            IOException,
+                                                            YarnException {
+
+    Messages.GetClusterNodesRequestProto req =
+      Messages.GetClusterNodesRequestProto
+              .newBuilder()
+              .addAllUuid(Arrays.asList(uuids))
+              .build();
+    Messages.GetClusterNodesResponseProto resp = appMaster.getClusterNodes(req);
+    return convertNodeWireToClusterNodes(resp.getClusterNodeList());
+  }
+
+  /**
+   * Wait for an instance of a named role to be live (or past it in the lifecycle)
+   * @param role role to look for
+   * @param timeout time to wait
+   * @return the state. If still in CREATED, the cluster didn't come up
+   * in the time period. If LIVE, all is well. If >LIVE, it has shut for a reason
+   * @throws IOException IO
+   * @throws SliderException Slider
+   * @throws WaitTimeoutException if the wait timed out
+   */
+  @VisibleForTesting
+  public int waitForRoleInstanceLive(String role, long timeout)
+    throws WaitTimeoutException, IOException, YarnException {
+    Duration duration = new Duration(timeout).start();
+    boolean live = false;
+    int state = StateValues.STATE_CREATED;
+
+    log.info("Waiting {} millis for a live node in role {}", timeout, role);
+    while (!live) {
+      // see if there is a node in that role yet
+      List<String> uuids = innerListNodeUUIDSByRole(role);
+      String[] containers = uuids.toArray(new String[uuids.size()]);
+      int roleCount = containers.length;
+      ClusterNode roleInstance = null;
+      if (roleCount != 0) {
+
+        // if there is, get the node
+        roleInstance = getNode(containers[0]);
+        if (roleInstance != null) {
+          state = roleInstance.state;
+          live = state >= StateValues.STATE_LIVE;
+        }
+      }
+      if (!live) {
+        if (duration.getLimitExceeded()) {
+          throw new WaitTimeoutException(
+            String.format("Timeout after %d millis" +
+                          " waiting for a live instance of type %s; " +
+                          "instances found %d %s",
+                          timeout, role, roleCount,
+                          (roleInstance != null
+                           ? (" instance -\n" + roleInstance.toString())
+                           : "")
+                         ));
+        } else {
+          try {
+            Thread.sleep(1000);
+          } catch (InterruptedException ignored) {
+            // ignored
+          }
+        }
+      }
+    }
+    return state;
+  }
+  
+  public boolean flex(ConfTree resources) throws IOException, YarnException {
+    Messages.FlexClusterRequestProto request =
+      Messages.FlexClusterRequestProto.newBuilder()
+              .setClusterSpec(resources.toJson())
+              .build();
+    Messages.FlexClusterResponseProto response =
+      appMaster.flexCluster(request);
+    return response.getResponse();
+  }
+
+
+  /**
+   * Commit (possibly delayed) AM suicide
+   *
+   * @param signal exit code
+   * @param text text text to log
+   * @param delay delay in millis
+   * @throws YarnException
+   * @throws IOException
+   */
+  public void amSuicide(String text, int signal, int delay)
+      throws YarnException, IOException {
+    Messages.AMSuicideRequestProto.Builder builder =
+      Messages.AMSuicideRequestProto.newBuilder();
+    if (text != null) {
+      builder.setText(text);
+    }
+    builder.setSignal(signal);
+    builder.setDelay(delay);
+    Messages.AMSuicideRequestProto req =
+      builder.build();
+    Messages.AMSuicideResponseProto response =
+      appMaster.amSuicide(req);
+  }
+
+  /**
+   * Get the application liveness
+   * @return current liveness information
+   * @throws IOException
+   */
+  public ApplicationLivenessInformation getLivenessInformation() throws IOException {
+    Messages.GetApplicationLivenessRequestProto.Builder builder =
+        Messages.GetApplicationLivenessRequestProto.newBuilder();
+    Messages.ApplicationLivenessInformationProto wire =
+        appMaster.getLivenessInformation(builder.build());
+    return unmarshall(wire);
+
+  }
+
+
+}


[14/20] incubator-slider git commit: SLIDER-782 some renaming and moving of interfaces, to be more independent of REST vs IPC

Posted by st...@apache.org.
SLIDER-782 some renaming and moving of interfaces, to be more independent of REST vs IPC


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/ddf06ab1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/ddf06ab1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/ddf06ab1

Branch: refs/heads/develop
Commit: ddf06ab1448dedef5c0dacd1dd51dbeea417c2dc
Parents: e155f64
Author: Steve Loughran <st...@apache.org>
Authored: Fri Feb 13 11:18:39 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Feb 13 11:18:39 2015 +0000

----------------------------------------------------------------------
 .../apache/slider/api/SliderApplicationApi.java | 145 +++++++++++++
 .../slider/api/SliderClusterProtocol.java       |  23 +--
 .../slider/api/proto/RestTypeMarshalling.java   |  60 +++++-
 .../slider/client/ClientRegistryBinder.java     | 201 +++++++++++++++++++
 .../client/ipc/SliderApplicationIpcClient.java  | 121 +++++++++++
 .../client/ipc/SliderClusterOperations.java     | 140 ++++++++++++-
 .../slider/client/rest/RestClientFactory.java   |  13 +-
 .../client/rest/RestClientRegistryBinder.java   | 201 -------------------
 .../client/rest/SliderApplicationApi.java       | 145 -------------
 .../rest/SliderApplicationApiRestClient.java    |   7 +-
 .../registry/retrieve/RegistryRetriever.java    |   2 +-
 .../rpc/SliderClusterProtocolProxy.java         |  24 +--
 .../server/appmaster/rpc/SliderIPCService.java  |  24 +--
 .../rest/RestAPIClientTestDelegates.groovy      |   6 +-
 .../TestMockAppStateAppRestIntegration.groovy   |   5 +-
 15 files changed, 708 insertions(+), 409 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java b/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
new file mode 100644
index 0000000..6b591fd
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
@@ -0,0 +1,145 @@
+/*
+ * 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.slider.api;
+
+import org.apache.slider.api.types.ApplicationLivenessInformation;
+import org.apache.slider.api.types.ComponentInformation;
+import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.api.types.PingInformation;
+import org.apache.slider.core.conf.AggregateConf;
+import org.apache.slider.core.conf.ConfTreeOperations;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * API exported by the slider remote REST/IPC endpoints.
+ */
+public interface SliderApplicationApi {
+  /**
+   * Get the aggregate desired model
+   * @return the aggregate configuration of what was asked for
+   * —before resolution has taken place
+   * @throws IOException on any failure
+   */
+  AggregateConf getDesiredModel() throws IOException;
+
+  /**
+   * Get the desired application configuration
+   * @return the application configuration asked for
+   * —before resolution has taken place
+   * @throws IOException on any failure
+   */
+  ConfTreeOperations getDesiredAppconf() throws IOException;
+
+  /**
+   * Get the desired YARN resources
+   * @return the resources asked for
+   * —before resolution has taken place
+   * @throws IOException on any failure
+   */
+  ConfTreeOperations getDesiredResources() throws IOException;
+
+  /**
+   * Get the aggregate resolved model
+   * @return the aggregate configuration of what was asked for
+   * —after resolution has taken place
+   * @throws IOException on any failure
+   */
+  AggregateConf getResolvedModel() throws IOException;
+
+  /**
+   * Get the resolved application configuration
+   * @return the application configuration asked for
+   * —after resolution has taken place
+   * @throws IOException on any failure
+   */
+  ConfTreeOperations getResolvedAppconf() throws IOException;
+
+  /**
+   * Get the resolved YARN resources
+   * @return the resources asked for
+   * —after resolution has taken place
+   * @throws IOException on any failure
+   */
+  ConfTreeOperations getResolvedResources() throws IOException;
+
+  /**
+   * Get the live YARN resources
+   * @return the live set of resources in the cluster
+   * @throws IOException on any failure
+   */
+  ConfTreeOperations getLiveResources() throws IOException;
+
+  /**
+   * Get a map of live containers [containerId:info]
+   * @return a possibly empty list of serialized containers
+   * @throws IOException on any failure
+   */
+  Map<String, ContainerInformation> enumContainers() throws
+      IOException;
+
+  /**
+   * Get a container from the container Id
+   * @param containerId YARN container ID
+   * @return the container information
+   * @throws IOException on any failure
+   */
+  ContainerInformation getContainer(String containerId) throws
+      IOException;
+
+  /**
+   * List all components into a map of [name:info]
+   * @return a possibly empty map of components
+   * @throws IOException on any failure
+   */
+  Map<String, ComponentInformation> enumComponents() throws
+      IOException;
+
+  /**
+   * Get information about a component
+   * @param componentName name of the component
+   * @return the component details
+   * @throws IOException on any failure
+   */
+  ComponentInformation getComponent(String componentName) throws
+      IOException;
+
+  /**
+   * Ping as a GET
+   * @param text text to include
+   * @return the response
+   * @throws IOException on any failure
+   */
+  PingInformation ping(String text) throws IOException;
+
+  /**
+   * Stop the AM (async operation)
+   * @param text text to include
+   * @throws IOException on any failure
+   */
+  void stop(String text) throws IOException;
+
+  /**
+   * Get the application liveness
+   * @return current liveness information
+   * @throws IOException
+   */
+  ApplicationLivenessInformation getApplicationLiveness() throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java b/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
index 8e2f46d..7babab7 100644
--- a/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
+++ b/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
@@ -111,7 +111,7 @@ public interface SliderClusterProtocol extends VersionedProtocol {
    * @throws YarnException
    */
   Messages.AMSuicideResponseProto amSuicide(Messages.AMSuicideRequestProto request)
-      throws IOException, YarnException;
+      throws IOException;
 
   /**
    * Get the instance definition
@@ -146,27 +146,20 @@ public interface SliderClusterProtocol extends VersionedProtocol {
   ) throws IOException;
 
   
-  Messages.WrappedJsonProto getModelDesired(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException;
+  Messages.WrappedJsonProto getModelDesired(Messages.EmptyPayloadProto request) throws IOException;
 
   
-  Messages.WrappedJsonProto getModelDesiredAppconf(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException;
+  Messages.WrappedJsonProto getModelDesiredAppconf(Messages.EmptyPayloadProto request) throws IOException;
     
-  Messages.WrappedJsonProto getModelDesiredResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException;
+  Messages.WrappedJsonProto getModelDesiredResources(Messages.EmptyPayloadProto request) throws IOException;
    
-  Messages.WrappedJsonProto getModelResolved(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException;
+  Messages.WrappedJsonProto getModelResolved(Messages.EmptyPayloadProto request) throws IOException;
   
-  Messages.WrappedJsonProto getModelResolvedAppconf(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException;
+  Messages.WrappedJsonProto getModelResolvedAppconf(Messages.EmptyPayloadProto request) throws IOException;
   
-  Messages.WrappedJsonProto getModelResolvedResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException;
+  Messages.WrappedJsonProto getModelResolvedResources(Messages.EmptyPayloadProto request) throws IOException;
    
-  Messages.WrappedJsonProto getLiveResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException;
+  Messages.WrappedJsonProto getLiveResources(Messages.EmptyPayloadProto request) throws IOException;
     
   
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
index 4652763..5c854a0 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
@@ -21,7 +21,14 @@ package org.apache.slider.api.proto;
 import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.core.conf.AggregateConf;
+import org.apache.slider.core.conf.ConfTree;
+import org.apache.slider.core.conf.ConfTreeOperations;
+import org.apache.slider.core.persist.AggregateConfSerDeser;
+import org.apache.slider.core.persist.ConfTreeSerDeser;
+import org.codehaus.jackson.JsonParseException;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -50,6 +57,31 @@ public class RestTypeMarshalling {
     return info;
   }
 
+  public static ComponentInformation
+  unmarshall(Messages.ComponentInformationProto wire) {
+    ComponentInformation info = new ComponentInformation();
+    info.name = wire.getName();
+    info.priority = wire.getPriority();
+    info.placementPolicy = wire.getPlacementPolicy();
+    
+    info.actual = wire.getActual();
+    info.completed = wire.getCompleted();
+    info.desired = wire.getDesired();
+    info.failed = wire.getFailed();
+    info.releasing = wire.getReleasing();
+    info.requested = wire.getRequested();
+    info.started = wire.getStarted();
+    info.startFailed = wire.getStartFailed();
+    info.totalRequested = wire.getTotalRequested();
+    info.containers = new ArrayList<String>(wire.getContainersList());
+    if (wire.hasFailureMessage()) {
+      info.failureMessage = wire.getFailureMessage();
+    }
+
+    return info;
+  }
+
+
   public static Messages.ComponentInformationProto
   marshall(ComponentInformation info) {
 
@@ -58,14 +90,15 @@ public class RestTypeMarshalling {
     builder.setName(info.name);
     builder.setPriority(info.priority);
     builder.setPlacementPolicy(info.placementPolicy);
-    builder.setDesired(info.desired);
+    
     builder.setActual(info.actual);
+    builder.setCompleted(info.completed);
+    builder.setDesired(info.desired);
+    builder.setFailed(info.failed);
     builder.setReleasing(info.releasing);
     builder.setRequested(info.requested);
-    builder.setFailed(info.failed);
     builder.setStarted(info.started);
     builder.setStartFailed(info.startFailed);
-    builder.setCompleted(info.completed);
     builder.setTotalRequested(info.totalRequested);
     if (info.failureMessage != null) {
       builder.setFailureMessage(info.failureMessage);
@@ -106,7 +139,7 @@ public class RestTypeMarshalling {
   }
 
   public static Messages.ContainerInformationProto
-  marshall(ContainerInformation info) {
+     marshall(ContainerInformation info) {
 
     Messages.ContainerInformationProto.Builder builder =
         Messages.ContainerInformationProto.newBuilder();
@@ -136,5 +169,24 @@ public class RestTypeMarshalling {
     return builder.build();
   }
 
+  public static String
+    unmarshall(Messages.WrappedJsonProto wire) {
+    return wire.getJson();
+  }
+
+  public static ConfTree unmarshallToConfTree(Messages.WrappedJsonProto wire) throws
+      IOException {
+    return new ConfTreeSerDeser().fromJson(wire.getJson());
+  }
+  
+  public static ConfTreeOperations unmarshallToCTO(Messages.WrappedJsonProto wire) throws
+      IOException {
+    return new ConfTreeOperations(new ConfTreeSerDeser().fromJson(wire.getJson()));
+  }
+
+  public static AggregateConf unmarshallToAggregateConf(Messages.WrappedJsonProto wire) throws
+      IOException {
+    return new AggregateConfSerDeser().fromJson(wire.getJson());
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java b/slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java
new file mode 100644
index 0000000..da37d11
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java
@@ -0,0 +1,201 @@
+/*
+ * 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.slider.client;
+
+import com.google.common.base.Preconditions;
+import org.apache.hadoop.fs.PathNotFoundException;
+import org.apache.hadoop.registry.client.api.RegistryConstants;
+import org.apache.hadoop.registry.client.api.RegistryOperations;
+import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
+import org.apache.hadoop.registry.client.binding.RegistryTypeUtils;
+import org.apache.hadoop.registry.client.exceptions.InvalidRecordException;
+import org.apache.hadoop.registry.client.impl.zk.RegistryInternalConstants;
+import org.apache.hadoop.registry.client.types.Endpoint;
+import org.apache.hadoop.registry.client.types.ServiceRecord;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.apache.hadoop.registry.client.binding.RegistryPathUtils.encodeForRegistry;
+import static org.apache.hadoop.registry.client.binding.RegistryUtils.convertUsername;
+import static org.apache.hadoop.registry.client.binding.RegistryUtils.getCurrentUsernameUnencoded;
+import static org.apache.hadoop.registry.client.binding.RegistryUtils.servicePath;
+
+/**
+ * Generic code to get the URLs for clients via the registry
+ */
+public class ClientRegistryBinder {
+  private static final Logger log =
+      LoggerFactory.getLogger(ClientRegistryBinder.class);
+
+  private final RegistryOperations operations;
+
+  public ClientRegistryBinder(RegistryOperations operations) {
+    this.operations = operations;
+  }
+
+  /**
+   * Buld the user path -switches to the system path if the user is "".
+   * It also cross-converts the username to ascii via punycode
+   * @param username username or ""
+   * @return the path to the user
+   */
+  public static String homePathForUser(String username) {
+    Preconditions.checkArgument(username != null, "null user");
+
+    // catch recursion
+    if (username.startsWith(RegistryConstants.PATH_USERS)) {
+      return username;
+    }
+
+    if (username.isEmpty()) {
+      return RegistryConstants.PATH_SYSTEM_SERVICES;
+    }
+
+    // convert username to registry name
+    String convertedName = convertUsername(username);
+
+    return RegistryPathUtils.join(RegistryConstants.PATH_USERS,
+        encodeForRegistry(convertedName));
+  }
+
+  /**
+   * Get the current username, before any encoding has been applied.
+   * @return the current user from the kerberos identity, falling back
+   * to the user and/or env variables.
+   */
+  public static String currentUsernameUnencoded() {
+    String env_hadoop_username = System.getenv(
+        RegistryInternalConstants.HADOOP_USER_NAME);
+    return getCurrentUsernameUnencoded(env_hadoop_username);
+  }
+
+  /**
+   * Qualify a user.
+   * <ol>
+   *   <li> <code>"~"</code> maps to user home path home</li>
+   *   <li> <code>"~user"</code> maps to <code>/users/$user</code></li>
+   *   <li> <code>"/"</code> maps to <code>/services/</code></li>
+   * </ol>
+   * @param user the username
+   * @return the base path
+   */
+  public static String qualifyUser(String user) {
+    // qualify the user
+    String t = user.trim();
+    if (t.startsWith("/")) {
+      // already resolved
+      return t;
+    } else if (t.equals("~")) {
+      // self
+      return currentUsernameUnencoded();
+    } else if (t.startsWith("~")) {
+      // another user
+      // convert username to registry name
+      String convertedName = convertUsername(t.substring(1));
+
+      return RegistryPathUtils.join(RegistryConstants.PATH_USERS,
+          encodeForRegistry(convertedName));
+    } else {
+      return "/" + t;
+    }
+  }
+
+  /**
+   * Look up an external REST API
+   * @param user user which will be qualified as per {@link #qualifyUser(String)}
+   * @param serviceClass service class
+   * @param instance instance name
+   * @param api API
+   * @return the API, or an exception is raised.
+   * @throws IOException
+   */
+  public String lookupExternalRestAPI(String user,
+      String serviceClass,
+      String instance,
+      String api)
+      throws IOException {
+    String qualified = qualifyUser(user);
+    String path = servicePath(qualified, serviceClass, instance);
+    String restAPI = resolveExternalRestAPI(api, path);
+    if (restAPI == null) {
+      throw new PathNotFoundException(path + " API " + api);
+    }
+    return restAPI;
+  }
+
+  /**
+   * Resolve a service record then return an external REST API exported it.
+   *
+   * @param api API to resolve
+   * @param path path of the service record
+   * @return null if the record exists but the API is absent or it has no
+   * REST endpoints.
+   * @throws IOException resolution problems, as covered in
+   * {@link RegistryOperations#resolve(String)}
+   */
+  protected String resolveExternalRestAPI(String api, String path) throws
+      IOException {
+    ServiceRecord record = operations.resolve(path);
+    return lookupRestAPI(record, api, true);
+  }
+
+  /**
+   * Look up an external REST API endpoint
+   * @param record service record
+   * @param api URI of api
+   * @param external flag to indicate this is an external record
+   * @return the first endpoint of the implementation, or null if there
+   * is no entry for the API, implementation or it's the wrong type.
+   */
+  public static String lookupRestAPI(ServiceRecord record,
+      String api, boolean external) throws InvalidRecordException {
+    try {
+      String url = null;
+      Endpoint endpoint = getEndpoint(record, api, external);
+      List<String> addresses =
+          RegistryTypeUtils.retrieveAddressesUriType(endpoint);
+      if (addresses != null && !addresses.isEmpty()) {
+        url = addresses.get(0);
+      }
+      return url;
+    } catch (InvalidRecordException e) {
+      log.debug("looking for API {}", api, e);
+      return null;
+    }
+  }
+
+  /**
+   * Get an endpont by API
+   * @param record service record
+   * @param api API
+   * @param external flag to indicate this is an external record
+   * @return the endpoint or null
+   */
+  public static Endpoint getEndpoint(ServiceRecord record,
+      String api,
+      boolean external) {
+    return external ? record.getExternalEndpoint(api)
+                    : record.getInternalEndpoint(api);
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
new file mode 100644
index 0000000..6abbd85
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
@@ -0,0 +1,121 @@
+/*
+ * 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.slider.client.ipc;
+
+import org.apache.slider.api.types.ApplicationLivenessInformation;
+import org.apache.slider.api.types.ComponentInformation;
+import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.api.types.PingInformation;
+import org.apache.slider.api.SliderApplicationApi;
+import org.apache.slider.core.conf.AggregateConf;
+import org.apache.slider.core.conf.ConfTreeOperations;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * Implementation of the Slider RESTy Application API over IPC.
+ */
+public class SliderApplicationIpcClient implements SliderApplicationApi {
+
+  private static final Logger log =
+      LoggerFactory.getLogger(SliderApplicationIpcClient.class);
+
+  private final SliderClusterOperations operations;
+
+  public SliderApplicationIpcClient(SliderClusterOperations operations) {
+    this.operations = operations;
+  }
+
+  @Override
+  public AggregateConf getDesiredModel() throws IOException {
+    return operations.getModelDesired();
+  }
+
+  @Override
+  public ConfTreeOperations getDesiredAppconf() throws IOException {
+    return operations.getModelDesiredAppconf();
+  }
+
+  @Override
+  public ConfTreeOperations getDesiredResources() throws IOException {
+    return operations.getModelDesiredResources();
+  }
+
+  @Override
+  public AggregateConf getResolvedModel() throws IOException {
+    return operations.getModelResolved();
+  }
+
+  @Override
+  public ConfTreeOperations getResolvedAppconf() throws IOException {
+    return operations.getModelResolvedAppconf();
+  }
+
+  @Override
+  public ConfTreeOperations getResolvedResources() throws IOException {
+    return operations.getModelResolvedResources();
+  }
+
+  @Override
+  public ConfTreeOperations getLiveResources() throws IOException {
+    return operations.getLiveResources();
+  }
+
+  @Override
+  public Map<String, ContainerInformation> enumContainers() throws IOException {
+    return operations.enumContainers();
+  }
+
+  @Override
+  public ContainerInformation getContainer(String containerId) throws
+      IOException {
+    return operations.getContainer(containerId);
+  }
+
+  @Override
+  public Map<String, ComponentInformation> enumComponents() throws IOException {
+    return operations.enumComponents();
+  }
+
+  @Override
+  public ComponentInformation getComponent(String componentName) throws
+      IOException {
+    return operations.getComponent(componentName);
+
+  }
+
+  @Override
+  public PingInformation ping(String text) throws IOException {
+    return null;
+  }
+
+  @Override
+  public void stop(String text) throws IOException {
+    operations.stop(text);
+  }
+
+  @Override
+  public ApplicationLivenessInformation getApplicationLiveness() throws
+      IOException {
+    return operations.getApplicationLiveness();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
index 2e8042d..a78d539 100644
--- a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
+++ b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
@@ -28,9 +28,13 @@ import org.apache.slider.api.proto.Messages;
 
 import static org.apache.slider.api.proto.RestTypeMarshalling.*;
 import org.apache.slider.api.types.ApplicationLivenessInformation;
+import org.apache.slider.api.types.ComponentInformation;
+import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.api.types.PingInformation;
 import org.apache.slider.common.tools.Duration;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
+import org.apache.slider.core.conf.ConfTreeOperations;
 import org.apache.slider.core.exceptions.NoSuchNodeException;
 import org.apache.slider.core.exceptions.SliderException;
 import org.apache.slider.core.exceptions.WaitTimeoutException;
@@ -43,7 +47,9 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Cluster operations at a slightly higher level than the RPC code
@@ -53,6 +59,10 @@ public class SliderClusterOperations {
     log = LoggerFactory.getLogger(SliderClusterOperations.class);
   
   private final SliderClusterProtocol appMaster;
+  private static final Messages.EmptyPayloadProto EMPTY;
+  static {
+    EMPTY = Messages.EmptyPayloadProto.newBuilder().build(); 
+  }
 
   public SliderClusterOperations(SliderClusterProtocol appMaster) {
     this.appMaster = appMaster;
@@ -311,7 +321,7 @@ public class SliderClusterOperations {
    * @throws IOException
    */
   public void amSuicide(String text, int signal, int delay)
-      throws YarnException, IOException {
+      throws IOException {
     Messages.AMSuicideRequestProto.Builder builder =
       Messages.AMSuicideRequestProto.newBuilder();
     if (text != null) {
@@ -339,5 +349,133 @@ public class SliderClusterOperations {
 
   }
 
+  
+  
+  public AggregateConf getModelDesired() throws IOException {
+    return unmarshallToAggregateConf(appMaster.getModelDesired(EMPTY));
+  }
+
+  
+  public ConfTreeOperations getModelDesiredAppconf() throws IOException {
+    return unmarshallToCTO(
+        appMaster.getModelDesiredAppconf(EMPTY));
+  }
+
+  
+  public ConfTreeOperations getModelDesiredResources() throws IOException {
+    return unmarshallToCTO(
+        appMaster.getModelDesiredResources(EMPTY));
+  }
+
+  
+  public AggregateConf getModelResolved() throws IOException {
+    return unmarshallToAggregateConf(
+        appMaster.getModelResolved(EMPTY));
+  }
+
+  
+  public ConfTreeOperations getModelResolvedAppconf() throws IOException {
+    return unmarshallToCTO(
+        appMaster.getModelResolvedAppconf(EMPTY));
+  }
+
+  
+  public ConfTreeOperations getModelResolvedResources() throws IOException {
+    return unmarshallToCTO(
+        appMaster.getModelDesiredResources(EMPTY));
+  }
+
+  
+  public ConfTreeOperations getLiveResources() throws IOException {
+    return unmarshallToCTO(
+        appMaster.getLiveResources(EMPTY));
+  }
+
+  
+  public Map<String, ContainerInformation> enumContainers() throws IOException {
+    Messages.GetLiveContainersResponseProto response =
+        appMaster.getLiveContainers(
+            Messages.GetLiveContainersRequestProto.newBuilder().build());
+
+    int namesCount = response.getNamesCount();
+    int records = response.getContainersCount();
+    if (namesCount != records) {
+      throw new IOException("Number of names returned (" + namesCount
+                      + ") does not match the number of records returned: " 
+                      + records);
+    }
+    Map<String, ContainerInformation> map =
+        new HashMap<String, ContainerInformation>(namesCount);
+    for (int i = 0; i < namesCount; i++) {
+      map.put(response.getNames(i), unmarshall(response.getContainers(i)));
+    }
+    return map;
+  }
+
+  
+  public ContainerInformation getContainer(String containerId) throws
+      IOException {
+    Messages.ContainerInformationProto response =
+        appMaster.getLiveContainer(
+            Messages.GetLiveContainerRequestProto.newBuilder()
+                                                 .setContainerId(containerId)
+                                                 .build());
+    return unmarshall(response);
+  }
+
+  
+  public Map<String, ComponentInformation> enumComponents() throws IOException {
+    Messages.GetLiveComponentsResponseProto response =
+        appMaster.getLiveComponents(
+            Messages.GetLiveComponentsRequestProto.newBuilder().build());
+
+    int namesCount = response.getNamesCount();
+    int records = response.getComponentsCount();
+    if (namesCount != records) {
+      throw new IOException("Number of names returned (" + namesCount
+                            +
+                            ") does not match the number of records returned: "
+                            + records);
+    }
+    Map<String, ComponentInformation> map =
+        new HashMap<String, ComponentInformation>(namesCount);
+    for (int i = 0; i < namesCount; i++) {
+      map.put(response.getNames(i), unmarshall(response.getComponents(i)));
+    }
+    return map;
+  }
+
+  
+  public ComponentInformation getComponent(String componentName)
+      throws IOException {
+    Messages.GetLiveComponentRequestProto.Builder builder =
+        Messages.GetLiveComponentRequestProto.newBuilder();
+    builder.setName(componentName);
+    Messages.ComponentInformationProto proto =
+        appMaster.getLiveComponent(builder.build());
+    
+    return unmarshall(proto);
+  }
+
+  
+  public PingInformation ping(String text) throws IOException {
+    return null;
+  }
+
+  
+  public void stop(String text) throws IOException {
+    amSuicide(text, 3, 0);
+  }
+
+  
+  public ApplicationLivenessInformation getApplicationLiveness() throws
+      IOException {
+    Messages.ApplicationLivenessInformationProto proto =
+        appMaster.getLivenessInformation(
+            Messages.GetApplicationLivenessRequestProto.newBuilder().build()
+        );
+    return unmarshall(proto);
+  }
+
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java b/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
index f0f7868..9c18036 100644
--- a/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
+++ b/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
@@ -21,15 +21,22 @@ package org.apache.slider.client.rest;
 import com.sun.jersey.api.client.Client;
 import com.sun.jersey.api.client.WebResource;
 import org.apache.hadoop.registry.client.api.RegistryOperations;
+import org.apache.slider.client.ClientRegistryBinder;
+import org.apache.slider.api.SliderApplicationApi;
 import org.apache.slider.core.registry.info.CustomRegistryConstants;
 
 import java.io.IOException;
 
 import static org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_APPLICATION;
 
+/**
+ * Factory for the Rest cilent; hides the lookup and instantiation.
+ * <p>
+ * 
+ */
 public class RestClientFactory {
 
-  private final RestClientRegistryBinder binder;
+  private final ClientRegistryBinder binder;
   private final Client jerseyClient;
   private final String user, serviceclass, instance;
 
@@ -42,7 +49,7 @@ public class RestClientFactory {
     this.user = user;
     this.serviceclass = serviceclass;
     this.instance = instance;
-    binder = new RestClientRegistryBinder(operations);
+    binder = new ClientRegistryBinder(operations);
   }
 
   /**
@@ -50,7 +57,7 @@ public class RestClientFactory {
    * @return a resource to the AM
    * @throws IOException any failure to resolve to the AM
    */
-  WebResource locateAppmaster() throws IOException {
+  private WebResource locateAppmaster() throws IOException {
     String restAPI = binder.lookupExternalRestAPI(user, serviceclass, instance,
         CustomRegistryConstants.AM_REST_BASE);
     return jerseyClient.resource(restAPI);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/client/rest/RestClientRegistryBinder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/RestClientRegistryBinder.java b/slider-core/src/main/java/org/apache/slider/client/rest/RestClientRegistryBinder.java
deleted file mode 100644
index 048a07b..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/rest/RestClientRegistryBinder.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * 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.slider.client.rest;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.fs.PathNotFoundException;
-import org.apache.hadoop.registry.client.api.RegistryConstants;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
-import org.apache.hadoop.registry.client.binding.RegistryTypeUtils;
-import org.apache.hadoop.registry.client.exceptions.InvalidRecordException;
-import org.apache.hadoop.registry.client.impl.zk.RegistryInternalConstants;
-import org.apache.hadoop.registry.client.types.Endpoint;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-
-import static org.apache.hadoop.registry.client.binding.RegistryPathUtils.encodeForRegistry;
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.convertUsername;
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.getCurrentUsernameUnencoded;
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.servicePath;
-
-/**
- * Generic code to get the URLs for clients via the registry
- */
-public class RestClientRegistryBinder {
-  private static final Logger log =
-      LoggerFactory.getLogger(RestClientRegistryBinder.class);
-
-  private final RegistryOperations operations;
-
-  public RestClientRegistryBinder(RegistryOperations operations) {
-    this.operations = operations;
-  }
-
-  /**
-   * Buld the user path -switches to the system path if the user is "".
-   * It also cross-converts the username to ascii via punycode
-   * @param username username or ""
-   * @return the path to the user
-   */
-  public static String homePathForUser(String username) {
-    Preconditions.checkArgument(username != null, "null user");
-
-    // catch recursion
-    if (username.startsWith(RegistryConstants.PATH_USERS)) {
-      return username;
-    }
-
-    if (username.isEmpty()) {
-      return RegistryConstants.PATH_SYSTEM_SERVICES;
-    }
-
-    // convert username to registry name
-    String convertedName = convertUsername(username);
-
-    return RegistryPathUtils.join(RegistryConstants.PATH_USERS,
-        encodeForRegistry(convertedName));
-  }
-
-  /**
-   * Get the current username, before any encoding has been applied.
-   * @return the current user from the kerberos identity, falling back
-   * to the user and/or env variables.
-   */
-  public static String currentUsernameUnencoded() {
-    String env_hadoop_username = System.getenv(
-        RegistryInternalConstants.HADOOP_USER_NAME);
-    return getCurrentUsernameUnencoded(env_hadoop_username);
-  }
-
-  /**
-   * Qualify a user.
-   * <ol>
-   *   <li> <code>"~"</code> maps to user home path home</li>
-   *   <li> <code>"~user"</code> maps to <code>/users/$user</code></li>
-   *   <li> <code>"/"</code> maps to <code>/services/</code></li>
-   * </ol>
-   * @param user the username
-   * @return the base path
-   */
-  public static String qualifyUser(String user) {
-    // qualify the user
-    String t = user.trim();
-    if (t.startsWith("/")) {
-      // already resolved
-      return t;
-    } else if (t.equals("~")) {
-      // self
-      return currentUsernameUnencoded();
-    } else if (t.startsWith("~")) {
-      // another user
-      // convert username to registry name
-      String convertedName = convertUsername(t.substring(1));
-
-      return RegistryPathUtils.join(RegistryConstants.PATH_USERS,
-          encodeForRegistry(convertedName));
-    } else {
-      return "/" + t;
-    }
-  }
-
-  /**
-   * Look up an external REST API
-   * @param user user which will be qualified as per {@link #qualifyUser(String)}
-   * @param serviceClass service class
-   * @param instance instance name
-   * @param api API
-   * @return the API, or an exception is raised.
-   * @throws IOException
-   */
-  public String lookupExternalRestAPI(String user,
-      String serviceClass,
-      String instance,
-      String api)
-      throws IOException {
-    String qualified = qualifyUser(user);
-    String path = servicePath(qualified, serviceClass, instance);
-    String restAPI = resolveExternalRestAPI(api, path);
-    if (restAPI == null) {
-      throw new PathNotFoundException(path + " API " + api);
-    }
-    return restAPI;
-  }
-
-  /**
-   * Resolve a service record then return an external REST API exported it.
-   *
-   * @param api API to resolve
-   * @param path path of the service record
-   * @return null if the record exists but the API is absent or it has no
-   * REST endpoints.
-   * @throws IOException resolution problems, as covered in
-   * {@link RegistryOperations#resolve(String)}
-   */
-  protected String resolveExternalRestAPI(String api, String path) throws
-      IOException {
-    ServiceRecord record = operations.resolve(path);
-    return lookupRestAPI(record, api, true);
-  }
-
-  /**
-   * Look up an external REST API endpoint
-   * @param record service record
-   * @param api URI of api
-   * @param external flag to indicate this is an external record
-   * @return the first endpoint of the implementation, or null if there
-   * is no entry for the API, implementation or it's the wrong type.
-   */
-  public static String lookupRestAPI(ServiceRecord record,
-      String api, boolean external) throws InvalidRecordException {
-    try {
-      String url = null;
-      Endpoint endpoint = getEndpoint(record, api, external);
-      List<String> addresses =
-          RegistryTypeUtils.retrieveAddressesUriType(endpoint);
-      if (addresses != null && !addresses.isEmpty()) {
-        url = addresses.get(0);
-      }
-      return url;
-    } catch (InvalidRecordException e) {
-      log.debug("looking for API {}", api, e);
-      return null;
-    }
-  }
-
-  /**
-   * Get an endpont by API
-   * @param record service record
-   * @param api API
-   * @param external flag to indicate this is an external record
-   * @return the endpoint or null
-   */
-  public static Endpoint getEndpoint(ServiceRecord record,
-      String api,
-      boolean external) {
-    return external ? record.getExternalEndpoint(api)
-                    : record.getInternalEndpoint(api);
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApi.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApi.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApi.java
deleted file mode 100644
index f284075..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApi.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.slider.client.rest;
-
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.PingInformation;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTreeOperations;
-
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * API exported by the slider client REST API
- */
-public interface SliderApplicationApi {
-  /**
-   * Get the aggregate desired model
-   * @return the aggregate configuration of what was asked for
-   * —before resolution has taken place
-   * @throws IOException on any failure
-   */
-  AggregateConf getDesiredModel() throws IOException;
-
-  /**
-   * Get the desired application configuration
-   * @return the application configuration asked for
-   * —before resolution has taken place
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getDesiredAppconf() throws IOException;
-
-  /**
-   * Get the desired YARN resources
-   * @return the resources asked for
-   * —before resolution has taken place
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getDesiredYarnResources() throws IOException;
-
-  /**
-   * Get the aggregate resolved model
-   * @return the aggregate configuration of what was asked for
-   * —after resolution has taken place
-   * @throws IOException on any failure
-   */
-  AggregateConf getResolvedModel() throws IOException;
-
-  /**
-   * Get the resolved application configuration
-   * @return the application configuration asked for
-   * —after resolution has taken place
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getResolvedAppconf() throws IOException;
-
-  /**
-   * Get the resolved YARN resources
-   * @return the resources asked for
-   * —after resolution has taken place
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getResolvedYarnResources() throws IOException;
-
-  /**
-   * Get the live YARN resources
-   * @return the live set of resources in the cluster
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getLiveYarnResources() throws IOException;
-
-  /**
-   * Get a map of live containers [containerId:info]
-   * @return a possibly empty list of serialized containers
-   * @throws IOException on any failure
-   */
-  Map<String, ContainerInformation> enumContainers() throws
-      IOException;
-
-  /**
-   * Get a container from the container Id
-   * @param containerId YARN container ID
-   * @return the container information
-   * @throws IOException on any failure
-   */
-  ContainerInformation getContainer(String containerId) throws
-      IOException;
-
-  /**
-   * List all components into a map of [name:info]
-   * @return a possibly empty map of components
-   * @throws IOException on any failure
-   */
-  Map<String, ComponentInformation> enumComponents() throws
-      IOException;
-
-  /**
-   * Get information about a component
-   * @param componentName name of the component
-   * @return the component details
-   * @throws IOException on any failure
-   */
-  ComponentInformation getComponent(String componentName) throws
-      IOException;
-
-  /**
-   * Ping as a GET
-   * @param text text to include
-   * @return the response
-   * @throws IOException on any failure
-   */
-  PingInformation ping(String text) throws IOException;
-
-  /**
-   * Stop the AM (async operation)
-   * @param text text to include
-   * @throws IOException on any failure
-   */
-  void stop(String text) throws IOException;
-
-  /**
-   * Get the application liveness
-   * @return current liveness information
-   * @throws IOException
-   */
-  ApplicationLivenessInformation getApplicationLiveness() throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
index ddb78ed..c38d5b1 100644
--- a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
@@ -27,6 +27,7 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.api.SliderApplicationApi;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.conf.ConfTreeOperations;
@@ -147,7 +148,7 @@ public class SliderApplicationApiRestClient extends BaseRestClient
   }
 
   @Override
-  public ConfTreeOperations getDesiredYarnResources() throws IOException {
+  public ConfTreeOperations getDesiredResources() throws IOException {
     ConfTree resource =
         getApplicationResource(MODEL_DESIRED_RESOURCES, ConfTree.class);
     return new ConfTreeOperations(resource); 
@@ -167,14 +168,14 @@ public class SliderApplicationApiRestClient extends BaseRestClient
   }
 
   @Override
-  public ConfTreeOperations getResolvedYarnResources() throws IOException {
+  public ConfTreeOperations getResolvedResources() throws IOException {
     ConfTree resource =
         getApplicationResource(MODEL_RESOLVED_RESOURCES, ConfTree.class);
     return new ConfTreeOperations(resource); 
   }
 
   @Override
-  public ConfTreeOperations getLiveYarnResources() throws IOException {
+  public ConfTreeOperations getLiveResources() throws IOException {
     ConfTree resource =
         getApplicationResource(LIVE_RESOURCES, ConfTree.class);
     return new ConfTreeOperations(resource); 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
index 364c661..6cae70c 100644
--- a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
+++ b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
@@ -23,7 +23,7 @@ import com.sun.jersey.api.client.UniformInterfaceException;
 import com.sun.jersey.api.client.WebResource;
 import org.apache.hadoop.registry.client.exceptions.RegistryIOException;
 import org.apache.hadoop.registry.client.types.ServiceRecord;
-import static org.apache.slider.client.rest.RestClientRegistryBinder.*;
+import static org.apache.slider.client.ClientRegistryBinder.*;
 import org.apache.slider.common.tools.SliderUtils;
 import org.apache.slider.core.exceptions.ExceptionConverter;
 import org.apache.slider.core.registry.docstore.PublishedConfigSet;

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
index 39f1349..a5e80fd 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
@@ -185,8 +185,7 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
 
   @Override
   public Messages.AMSuicideResponseProto amSuicide(Messages.AMSuicideRequestProto request) throws
-                                                                                           IOException,
-                                                                                           YarnException {
+                                                                                           IOException {
     try {
       return endpoint.amSuicide(NULL_CONTROLLER, request);
     } catch (ServiceException e) {
@@ -245,8 +244,7 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelDesired(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelDesired(Messages.EmptyPayloadProto request) throws IOException {
     try {
       return endpoint.getModelDesired(NULL_CONTROLLER, request);
     } catch (ServiceException e) {
@@ -255,8 +253,7 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelDesiredAppconf(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelDesiredAppconf(Messages.EmptyPayloadProto request) throws IOException {
     try {
       return endpoint.getModelDesiredAppconf(NULL_CONTROLLER, request);
     } catch (ServiceException e) {
@@ -265,8 +262,7 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelDesiredResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelDesiredResources(Messages.EmptyPayloadProto request) throws IOException {
     try {
       return endpoint.getModelDesiredResources(NULL_CONTROLLER, request);
     } catch (ServiceException e) {
@@ -275,8 +271,7 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelResolved(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelResolved(Messages.EmptyPayloadProto request) throws IOException {
     try {
       return endpoint.getModelResolved(NULL_CONTROLLER, request);
     } catch (ServiceException e) {
@@ -285,8 +280,7 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelResolvedAppconf(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelResolvedAppconf(Messages.EmptyPayloadProto request) throws IOException {
     try {
       return endpoint.getModelResolvedAppconf(NULL_CONTROLLER, request);
     } catch (ServiceException e) {
@@ -295,8 +289,7 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelResolvedResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelResolvedResources(Messages.EmptyPayloadProto request) throws IOException {
     try {
       return endpoint.getModelResolvedResources(NULL_CONTROLLER, request);
     } catch (ServiceException e) {
@@ -305,8 +298,7 @@ public class SliderClusterProtocolProxy implements SliderClusterProtocol {
   }
 
   @Override
-  public Messages.WrappedJsonProto getLiveResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getLiveResources(Messages.EmptyPayloadProto request) throws IOException {
     try {
       return endpoint.getLiveResources(NULL_CONTROLLER, request);
     } catch (ServiceException e) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
index 5a9f319..07b91b8 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
@@ -19,7 +19,6 @@
 package org.apache.slider.server.appmaster.rpc;
 
 import com.google.common.base.Preconditions;
-import com.google.protobuf.RpcController;
 import org.apache.hadoop.ipc.ProtocolSignature;
 import org.apache.hadoop.service.AbstractService;
 import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
@@ -312,7 +311,7 @@ public class SliderIPCService extends AbstractService
   @Override
   public Messages.AMSuicideResponseProto amSuicide(
       Messages.AMSuicideRequestProto request)
-      throws IOException, YarnException {
+      throws IOException {
     onRpcCall("amsuicide");
     int signal = request.getSignal();
     String text = request.getText();
@@ -381,44 +380,37 @@ public class SliderIPCService extends AbstractService
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelDesired(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelDesired(Messages.EmptyPayloadProto request) throws IOException {
     return lookupAggregateConf(MODEL_DESIRED);
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelDesiredAppconf(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelDesiredAppconf(Messages.EmptyPayloadProto request) throws IOException {
     return lookupConfTree(MODEL_DESIRED_APPCONF);
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelDesiredResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelDesiredResources(Messages.EmptyPayloadProto request) throws IOException {
     return lookupConfTree(MODEL_DESIRED_RESOURCES);
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelResolved(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelResolved(Messages.EmptyPayloadProto request) throws IOException {
     return lookupAggregateConf(MODEL_RESOLVED);
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelResolvedAppconf(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelResolvedAppconf(Messages.EmptyPayloadProto request) throws IOException {
     return lookupConfTree(MODEL_RESOLVED_APPCONF);
   }
 
   @Override
-  public Messages.WrappedJsonProto getModelResolvedResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getModelResolvedResources(Messages.EmptyPayloadProto request) throws IOException {
     return lookupConfTree(MODEL_RESOLVED_RESOURCES);
   }
 
   @Override
-  public Messages.WrappedJsonProto getLiveResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws IOException {
+  public Messages.WrappedJsonProto getLiveResources(Messages.EmptyPayloadProto request) throws IOException {
     return lookupConfTree(LIVE_RESOURCES);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
index d6cabfa..dce26ce 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/RestAPIClientTestDelegates.groovy
@@ -68,20 +68,20 @@ class RestAPIClientTestDelegates extends AbstractRestTestDelegate {
   public void testGetDesiredModel() throws Throwable {
       appAPI.getDesiredModel()  
       appAPI.getDesiredAppconf()  
-      appAPI.getDesiredYarnResources()  
+      appAPI.getDesiredResources()  
   }
 
   public void testGetResolvedModel() throws Throwable {
       appAPI.getResolvedModel()  
       appAPI.getResolvedAppconf()  
-      appAPI.getResolvedYarnResources()  
+      appAPI.getResolvedResources()  
   }
 
   
   public void testLiveResources() throws Throwable {
     describe "Live Resources"
 
-    ConfTreeOperations tree = appAPI.getLiveYarnResources()
+    ConfTreeOperations tree = appAPI.getLiveResources()
 
     log.info tree.toString()
     def liveAM = tree.getComponent(COMPONENT_AM)

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ddf06ab1/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
index 5d9d1d1..7838886 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAppRestIntegration.groovy
@@ -30,6 +30,7 @@ import org.apache.slider.server.appmaster.state.RoleInstance
 import org.apache.slider.server.appmaster.state.StateAccessForProviders
 import org.apache.slider.server.appmaster.web.WebAppApi
 import org.apache.slider.server.appmaster.web.WebAppApiImpl
+import org.apache.slider.server.appmaster.web.rest.application.ApplicationResouceContentCacheFactory
 import org.apache.slider.server.appmaster.web.rest.application.ApplicationResource
 import org.apache.slider.server.appmaster.web.rest.application.resources.CachedContent
 import org.apache.slider.server.appmaster.web.rest.application.resources.LiveContainersRefresher
@@ -117,7 +118,9 @@ class TestMockAppStateAppRestIntegration extends BaseMockAppStateTest implements
     WebAppApi api = new WebAppApiImpl(stateAccess,
         new MockProviderService(),
         null, null,
-        new MetricsAndMonitoring("metrics"), null, null, null)
+        new MetricsAndMonitoring("metrics"), null,null,
+        ApplicationResouceContentCacheFactory.createContentCache(stateAccess)
+    )
     return api
   }
 


[07/20] incubator-slider git commit: SLIDER-782 new messages & RPC calls defined; , marshall and indirect code in progress

Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bc15807c/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java b/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
index 9174f88..3a495e7 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
@@ -1,20 +1,3 @@
-/*
- * 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.
- */
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: SliderClusterMessages.proto
 
@@ -12909,6 +12892,11378 @@ public final class Messages {
     // @@protoc_insertion_point(class_scope:org.apache.slider.api.GetInstanceDefinitionResponseProto)
   }
 
+  public interface ApplicationLivenessInformationProtoOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // optional bool allRequestsSatisfied = 1;
+    /**
+     * <code>optional bool allRequestsSatisfied = 1;</code>
+     */
+    boolean hasAllRequestsSatisfied();
+    /**
+     * <code>optional bool allRequestsSatisfied = 1;</code>
+     */
+    boolean getAllRequestsSatisfied();
+
+    // optional int32 requestsOutstanding = 2;
+    /**
+     * <code>optional int32 requestsOutstanding = 2;</code>
+     */
+    boolean hasRequestsOutstanding();
+    /**
+     * <code>optional int32 requestsOutstanding = 2;</code>
+     */
+    int getRequestsOutstanding();
+  }
+  /**
+   * Protobuf type {@code org.apache.slider.api.ApplicationLivenessInformationProto}
+   *
+   * <pre>
+   **
+   * See org.apache.slider.api.types.ApplicationLivenessInformation
+   * </pre>
+   */
+  public static final class ApplicationLivenessInformationProto extends
+      com.google.protobuf.GeneratedMessage
+      implements ApplicationLivenessInformationProtoOrBuilder {
+    // Use ApplicationLivenessInformationProto.newBuilder() to construct.
+    private ApplicationLivenessInformationProto(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private ApplicationLivenessInformationProto(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final ApplicationLivenessInformationProto defaultInstance;
+    public static ApplicationLivenessInformationProto getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public ApplicationLivenessInformationProto getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private ApplicationLivenessInformationProto(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 8: {
+              bitField0_ |= 0x00000001;
+              allRequestsSatisfied_ = input.readBool();
+              break;
+            }
+            case 16: {
+              bitField0_ |= 0x00000002;
+              requestsOutstanding_ = input.readInt32();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ApplicationLivenessInformationProto_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ApplicationLivenessInformationProto_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.class, org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<ApplicationLivenessInformationProto> PARSER =
+        new com.google.protobuf.AbstractParser<ApplicationLivenessInformationProto>() {
+      public ApplicationLivenessInformationProto parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new ApplicationLivenessInformationProto(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<ApplicationLivenessInformationProto> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // optional bool allRequestsSatisfied = 1;
+    public static final int ALLREQUESTSSATISFIED_FIELD_NUMBER = 1;
+    private boolean allRequestsSatisfied_;
+    /**
+     * <code>optional bool allRequestsSatisfied = 1;</code>
+     */
+    public boolean hasAllRequestsSatisfied() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional bool allRequestsSatisfied = 1;</code>
+     */
+    public boolean getAllRequestsSatisfied() {
+      return allRequestsSatisfied_;
+    }
+
+    // optional int32 requestsOutstanding = 2;
+    public static final int REQUESTSOUTSTANDING_FIELD_NUMBER = 2;
+    private int requestsOutstanding_;
+    /**
+     * <code>optional int32 requestsOutstanding = 2;</code>
+     */
+    public boolean hasRequestsOutstanding() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional int32 requestsOutstanding = 2;</code>
+     */
+    public int getRequestsOutstanding() {
+      return requestsOutstanding_;
+    }
+
+    private void initFields() {
+      allRequestsSatisfied_ = false;
+      requestsOutstanding_ = 0;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBool(1, allRequestsSatisfied_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeInt32(2, requestsOutstanding_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBoolSize(1, allRequestsSatisfied_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(2, requestsOutstanding_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    @java.lang.Override
+    public boolean equals(final java.lang.Object obj) {
+      if (obj == this) {
+       return true;
+      }
+      if (!(obj instanceof org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto)) {
+        return super.equals(obj);
+      }
+      org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto other = (org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto) obj;
+
+      boolean result = true;
+      result = result && (hasAllRequestsSatisfied() == other.hasAllRequestsSatisfied());
+      if (hasAllRequestsSatisfied()) {
+        result = result && (getAllRequestsSatisfied()
+            == other.getAllRequestsSatisfied());
+      }
+      result = result && (hasRequestsOutstanding() == other.hasRequestsOutstanding());
+      if (hasRequestsOutstanding()) {
+        result = result && (getRequestsOutstanding()
+            == other.getRequestsOutstanding());
+      }
+      result = result &&
+          getUnknownFields().equals(other.getUnknownFields());
+      return result;
+    }
+
+    private int memoizedHashCode = 0;
+    @java.lang.Override
+    public int hashCode() {
+      if (memoizedHashCode != 0) {
+        return memoizedHashCode;
+      }
+      int hash = 41;
+      hash = (19 * hash) + getDescriptorForType().hashCode();
+      if (hasAllRequestsSatisfied()) {
+        hash = (37 * hash) + ALLREQUESTSSATISFIED_FIELD_NUMBER;
+        hash = (53 * hash) + hashBoolean(getAllRequestsSatisfied());
+      }
+      if (hasRequestsOutstanding()) {
+        hash = (37 * hash) + REQUESTSOUTSTANDING_FIELD_NUMBER;
+        hash = (53 * hash) + getRequestsOutstanding();
+      }
+      hash = (29 * hash) + getUnknownFields().hashCode();
+      memoizedHashCode = hash;
+      return hash;
+    }
+
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.apache.slider.api.ApplicationLivenessInformationProto}
+     *
+     * <pre>
+     **
+     * See org.apache.slider.api.types.ApplicationLivenessInformation
+     * </pre>
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProtoOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ApplicationLivenessInformationProto_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ApplicationLivenessInformationProto_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.class, org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.Builder.class);
+      }
+
+      // Construct using org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        allRequestsSatisfied_ = false;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        requestsOutstanding_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ApplicationLivenessInformationProto_descriptor;
+      }
+
+      public org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto getDefaultInstanceForType() {
+        return org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance();
+      }
+
+      public org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto build() {
+        org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto buildPartial() {
+        org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto result = new org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.allRequestsSatisfied_ = allRequestsSatisfied_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.requestsOutstanding_ = requestsOutstanding_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto) {
+          return mergeFrom((org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto other) {
+        if (other == org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance()) return this;
+        if (other.hasAllRequestsSatisfied()) {
+          setAllRequestsSatisfied(other.getAllRequestsSatisfied());
+        }
+        if (other.hasRequestsOutstanding()) {
+          setRequestsOutstanding(other.getRequestsOutstanding());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // optional bool allRequestsSatisfied = 1;
+      private boolean allRequestsSatisfied_ ;
+      /**
+       * <code>optional bool allRequestsSatisfied = 1;</code>
+       */
+      public boolean hasAllRequestsSatisfied() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional bool allRequestsSatisfied = 1;</code>
+       */
+      public boolean getAllRequestsSatisfied() {
+        return allRequestsSatisfied_;
+      }
+      /**
+       * <code>optional bool allRequestsSatisfied = 1;</code>
+       */
+      public Builder setAllRequestsSatisfied(boolean value) {
+        bitField0_ |= 0x00000001;
+        allRequestsSatisfied_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional bool allRequestsSatisfied = 1;</code>
+       */
+      public Builder clearAllRequestsSatisfied() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        allRequestsSatisfied_ = false;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 requestsOutstanding = 2;
+      private int requestsOutstanding_ ;
+      /**
+       * <code>optional int32 requestsOutstanding = 2;</code>
+       */
+      public boolean hasRequestsOutstanding() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional int32 requestsOutstanding = 2;</code>
+       */
+      public int getRequestsOutstanding() {
+        return requestsOutstanding_;
+      }
+      /**
+       * <code>optional int32 requestsOutstanding = 2;</code>
+       */
+      public Builder setRequestsOutstanding(int value) {
+        bitField0_ |= 0x00000002;
+        requestsOutstanding_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 requestsOutstanding = 2;</code>
+       */
+      public Builder clearRequestsOutstanding() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        requestsOutstanding_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.apache.slider.api.ApplicationLivenessInformationProto)
+    }
+
+    static {
+      defaultInstance = new ApplicationLivenessInformationProto(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.apache.slider.api.ApplicationLivenessInformationProto)
+  }
+
+  public interface ComponentInformationProtoOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // optional string name = 1;
+    /**
+     * <code>optional string name = 1;</code>
+     */
+    boolean hasName();
+    /**
+     * <code>optional string name = 1;</code>
+     */
+    java.lang.String getName();
+    /**
+     * <code>optional string name = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getNameBytes();
+
+    // optional int32 priority = 2;
+    /**
+     * <code>optional int32 priority = 2;</code>
+     */
+    boolean hasPriority();
+    /**
+     * <code>optional int32 priority = 2;</code>
+     */
+    int getPriority();
+
+    // optional int32 desired = 3;
+    /**
+     * <code>optional int32 desired = 3;</code>
+     */
+    boolean hasDesired();
+    /**
+     * <code>optional int32 desired = 3;</code>
+     */
+    int getDesired();
+
+    // optional int32 actual = 4;
+    /**
+     * <code>optional int32 actual = 4;</code>
+     */
+    boolean hasActual();
+    /**
+     * <code>optional int32 actual = 4;</code>
+     */
+    int getActual();
+
+    // optional int32 releasing = 5;
+    /**
+     * <code>optional int32 releasing = 5;</code>
+     */
+    boolean hasReleasing();
+    /**
+     * <code>optional int32 releasing = 5;</code>
+     */
+    int getReleasing();
+
+    // optional int32 requested = 6;
+    /**
+     * <code>optional int32 requested = 6;</code>
+     */
+    boolean hasRequested();
+    /**
+     * <code>optional int32 requested = 6;</code>
+     */
+    int getRequested();
+
+    // optional int32 failed = 7;
+    /**
+     * <code>optional int32 failed = 7;</code>
+     */
+    boolean hasFailed();
+    /**
+     * <code>optional int32 failed = 7;</code>
+     */
+    int getFailed();
+
+    // optional int32 started = 8;
+    /**
+     * <code>optional int32 started = 8;</code>
+     */
+    boolean hasStarted();
+    /**
+     * <code>optional int32 started = 8;</code>
+     */
+    int getStarted();
+
+    // optional int32 startFailed = 9;
+    /**
+     * <code>optional int32 startFailed = 9;</code>
+     */
+    boolean hasStartFailed();
+    /**
+     * <code>optional int32 startFailed = 9;</code>
+     */
+    int getStartFailed();
+
+    // optional int32 completed = 10;
+    /**
+     * <code>optional int32 completed = 10;</code>
+     */
+    boolean hasCompleted();
+    /**
+     * <code>optional int32 completed = 10;</code>
+     */
+    int getCompleted();
+
+    // optional int32 totalRequested = 11;
+    /**
+     * <code>optional int32 totalRequested = 11;</code>
+     */
+    boolean hasTotalRequested();
+    /**
+     * <code>optional int32 totalRequested = 11;</code>
+     */
+    int getTotalRequested();
+
+    // optional string failureMessage = 12;
+    /**
+     * <code>optional string failureMessage = 12;</code>
+     */
+    boolean hasFailureMessage();
+    /**
+     * <code>optional string failureMessage = 12;</code>
+     */
+    java.lang.String getFailureMessage();
+    /**
+     * <code>optional string failureMessage = 12;</code>
+     */
+    com.google.protobuf.ByteString
+        getFailureMessageBytes();
+
+    // optional int32 placementPolicy = 13;
+    /**
+     * <code>optional int32 placementPolicy = 13;</code>
+     */
+    boolean hasPlacementPolicy();
+    /**
+     * <code>optional int32 placementPolicy = 13;</code>
+     */
+    int getPlacementPolicy();
+
+    // repeated string containers = 14;
+    /**
+     * <code>repeated string containers = 14;</code>
+     */
+    java.util.List<java.lang.String>
+    getContainersList();
+    /**
+     * <code>repeated string containers = 14;</code>
+     */
+    int getContainersCount();
+    /**
+     * <code>repeated string containers = 14;</code>
+     */
+    java.lang.String getContainers(int index);
+    /**
+     * <code>repeated string containers = 14;</code>
+     */
+    com.google.protobuf.ByteString
+        getContainersBytes(int index);
+  }
+  /**
+   * Protobuf type {@code org.apache.slider.api.ComponentInformationProto}
+   *
+   * <pre>
+   *
+   * see org.apache.slider.api.types.ComponentInformation
+   * </pre>
+   */
+  public static final class ComponentInformationProto extends
+      com.google.protobuf.GeneratedMessage
+      implements ComponentInformationProtoOrBuilder {
+    // Use ComponentInformationProto.newBuilder() to construct.
+    private ComponentInformationProto(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private ComponentInformationProto(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final ComponentInformationProto defaultInstance;
+    public static ComponentInformationProto getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public ComponentInformationProto getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private ComponentInformationProto(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              name_ = input.readBytes();
+              break;
+            }
+            case 16: {
+              bitField0_ |= 0x00000002;
+              priority_ = input.readInt32();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              desired_ = input.readInt32();
+              break;
+            }
+            case 32: {
+              bitField0_ |= 0x00000008;
+              actual_ = input.readInt32();
+              break;
+            }
+            case 40: {
+              bitField0_ |= 0x00000010;
+              releasing_ = input.readInt32();
+              break;
+            }
+            case 48: {
+              bitField0_ |= 0x00000020;
+              requested_ = input.readInt32();
+              break;
+            }
+            case 56: {
+              bitField0_ |= 0x00000040;
+              failed_ = input.readInt32();
+              break;
+            }
+            case 64: {
+              bitField0_ |= 0x00000080;
+              started_ = input.readInt32();
+              break;
+            }
+            case 72: {
+              bitField0_ |= 0x00000100;
+              startFailed_ = input.readInt32();
+              break;
+            }
+            case 80: {
+              bitField0_ |= 0x00000200;
+              completed_ = input.readInt32();
+              break;
+            }
+            case 88: {
+              bitField0_ |= 0x00000400;
+              totalRequested_ = input.readInt32();
+              break;
+            }
+            case 98: {
+              bitField0_ |= 0x00000800;
+              failureMessage_ = input.readBytes();
+              break;
+            }
+            case 104: {
+              bitField0_ |= 0x00001000;
+              placementPolicy_ = input.readInt32();
+              break;
+            }
+            case 114: {
+              if (!((mutable_bitField0_ & 0x00002000) == 0x00002000)) {
+                containers_ = new com.google.protobuf.LazyStringArrayList();
+                mutable_bitField0_ |= 0x00002000;
+              }
+              containers_.add(input.readBytes());
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00002000) == 0x00002000)) {
+          containers_ = new com.google.protobuf.UnmodifiableLazyStringList(containers_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ComponentInformationProto_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ComponentInformationProto_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.slider.api.proto.Messages.ComponentInformationProto.class, org.apache.slider.api.proto.Messages.ComponentInformationProto.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<ComponentInformationProto> PARSER =
+        new com.google.protobuf.AbstractParser<ComponentInformationProto>() {
+      public ComponentInformationProto parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new ComponentInformationProto(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<ComponentInformationProto> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // optional string name = 1;
+    public static final int NAME_FIELD_NUMBER = 1;
+    private java.lang.Object name_;
+    /**
+     * <code>optional string name = 1;</code>
+     */
+    public boolean hasName() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional string name = 1;</code>
+     */
+    public java.lang.String getName() {
+      java.lang.Object ref = name_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          name_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string name = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getNameBytes() {
+      java.lang.Object ref = name_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        name_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional int32 priority = 2;
+    public static final int PRIORITY_FIELD_NUMBER = 2;
+    private int priority_;
+    /**
+     * <code>optional int32 priority = 2;</code>
+     */
+    public boolean hasPriority() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional int32 priority = 2;</code>
+     */
+    public int getPriority() {
+      return priority_;
+    }
+
+    // optional int32 desired = 3;
+    public static final int DESIRED_FIELD_NUMBER = 3;
+    private int desired_;
+    /**
+     * <code>optional int32 desired = 3;</code>
+     */
+    public boolean hasDesired() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional int32 desired = 3;</code>
+     */
+    public int getDesired() {
+      return desired_;
+    }
+
+    // optional int32 actual = 4;
+    public static final int ACTUAL_FIELD_NUMBER = 4;
+    private int actual_;
+    /**
+     * <code>optional int32 actual = 4;</code>
+     */
+    public boolean hasActual() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional int32 actual = 4;</code>
+     */
+    public int getActual() {
+      return actual_;
+    }
+
+    // optional int32 releasing = 5;
+    public static final int RELEASING_FIELD_NUMBER = 5;
+    private int releasing_;
+    /**
+     * <code>optional int32 releasing = 5;</code>
+     */
+    public boolean hasReleasing() {
+      return ((bitField0_ & 0x00000010) == 0x00000010);
+    }
+    /**
+     * <code>optional int32 releasing = 5;</code>
+     */
+    public int getReleasing() {
+      return releasing_;
+    }
+
+    // optional int32 requested = 6;
+    public static final int REQUESTED_FIELD_NUMBER = 6;
+    private int requested_;
+    /**
+     * <code>optional int32 requested = 6;</code>
+     */
+    public boolean hasRequested() {
+      return ((bitField0_ & 0x00000020) == 0x00000020);
+    }
+    /**
+     * <code>optional int32 requested = 6;</code>
+     */
+    public int getRequested() {
+      return requested_;
+    }
+
+    // optional int32 failed = 7;
+    public static final int FAILED_FIELD_NUMBER = 7;
+    private int failed_;
+    /**
+     * <code>optional int32 failed = 7;</code>
+     */
+    public boolean hasFailed() {
+      return ((bitField0_ & 0x00000040) == 0x00000040);
+    }
+    /**
+     * <code>optional int32 failed = 7;</code>
+     */
+    public int getFailed() {
+      return failed_;
+    }
+
+    // optional int32 started = 8;
+    public static final int STARTED_FIELD_NUMBER = 8;
+    private int started_;
+    /**
+     * <code>optional int32 started = 8;</code>
+     */
+    public boolean hasStarted() {
+      return ((bitField0_ & 0x00000080) == 0x00000080);
+    }
+    /**
+     * <code>optional int32 started = 8;</code>
+     */
+    public int getStarted() {
+      return started_;
+    }
+
+    // optional int32 startFailed = 9;
+    public static final int STARTFAILED_FIELD_NUMBER = 9;
+    private int startFailed_;
+    /**
+     * <code>optional int32 startFailed = 9;</code>
+     */
+    public boolean hasStartFailed() {
+      return ((bitField0_ & 0x00000100) == 0x00000100);
+    }
+    /**
+     * <code>optional int32 startFailed = 9;</code>
+     */
+    public int getStartFailed() {
+      return startFailed_;
+    }
+
+    // optional int32 completed = 10;
+    public static final int COMPLETED_FIELD_NUMBER = 10;
+    private int completed_;
+    /**
+     * <code>optional int32 completed = 10;</code>
+     */
+    public boolean hasCompleted() {
+      return ((bitField0_ & 0x00000200) == 0x00000200);
+    }
+    /**
+     * <code>optional int32 completed = 10;</code>
+     */
+    public int getCompleted() {
+      return completed_;
+    }
+
+    // optional int32 totalRequested = 11;
+    public static final int TOTALREQUESTED_FIELD_NUMBER = 11;
+    private int totalRequested_;
+    /**
+     * <code>optional int32 totalRequested = 11;</code>
+     */
+    public boolean hasTotalRequested() {
+      return ((bitField0_ & 0x00000400) == 0x00000400);
+    }
+    /**
+     * <code>optional int32 totalRequested = 11;</code>
+     */
+    public int getTotalRequested() {
+      return totalRequested_;
+    }
+
+    // optional string failureMessage = 12;
+    public static final int FAILUREMESSAGE_FIELD_NUMBER = 12;
+    private java.lang.Object failureMessage_;
+    /**
+     * <code>optional string failureMessage = 12;</code>
+     */
+    public boolean hasFailureMessage() {
+      return ((bitField0_ & 0x00000800) == 0x00000800);
+    }
+    /**
+     * <code>optional string failureMessage = 12;</code>
+     */
+    public java.lang.String getFailureMessage() {
+      java.lang.Object ref = failureMessage_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          failureMessage_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string failureMessage = 12;</code>
+     */
+    public com.google.protobuf.ByteString
+        getFailureMessageBytes() {
+      java.lang.Object ref = failureMessage_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        failureMessage_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional int32 placementPolicy = 13;
+    public static final int PLACEMENTPOLICY_FIELD_NUMBER = 13;
+    private int placementPolicy_;
+    /**
+     * <code>optional int32 placementPolicy = 13;</code>
+     */
+    public boolean hasPlacementPolicy() {
+      return ((bitField0_ & 0x00001000) == 0x00001000);
+    }
+    /**
+     * <code>optional int32 placementPolicy = 13;</code>
+     */
+    public int getPlacementPolicy() {
+      return placementPolicy_;
+    }
+
+    // repeated string containers = 14;
+    public static final int CONTAINERS_FIELD_NUMBER = 14;
+    private com.google.protobuf.LazyStringList containers_;
+    /**
+     * <code>repeated string containers = 14;</code>
+     */
+    public java.util.List<java.lang.String>
+        getContainersList() {
+      return containers_;
+    }
+    /**
+     * <code>repeated string containers = 14;</code>
+     */
+    public int getContainersCount() {
+      return containers_.size();
+    }
+    /**
+     * <code>repeated string containers = 14;</code>
+     */
+    public java.lang.String getContainers(int index) {
+      return containers_.get(index);
+    }
+    /**
+     * <code>repeated string containers = 14;</code>
+     */
+    public com.google.protobuf.ByteString
+        getContainersBytes(int index) {
+      return containers_.getByteString(index);
+    }
+
+    private void initFields() {
+      name_ = "";
+      priority_ = 0;
+      desired_ = 0;
+      actual_ = 0;
+      releasing_ = 0;
+      requested_ = 0;
+      failed_ = 0;
+      started_ = 0;
+      startFailed_ = 0;
+      completed_ = 0;
+      totalRequested_ = 0;
+      failureMessage_ = "";
+      placementPolicy_ = 0;
+      containers_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getNameBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeInt32(2, priority_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeInt32(3, desired_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeInt32(4, actual_);
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        output.writeInt32(5, releasing_);
+      }
+      if (((bitField0_ & 0x00000020) == 0x00000020)) {
+        output.writeInt32(6, requested_);
+      }
+      if (((bitField0_ & 0x00000040) == 0x00000040)) {
+        output.writeInt32(7, failed_);
+      }
+      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+        output.writeInt32(8, started_);
+      }
+      if (((bitField0_ & 0x00000100) == 0x00000100)) {
+        output.writeInt32(9, startFailed_);
+      }
+      if (((bitField0_ & 0x00000200) == 0x00000200)) {
+        output.writeInt32(10, completed_);
+      }
+      if (((bitField0_ & 0x00000400) == 0x00000400)) {
+        output.writeInt32(11, totalRequested_);
+      }
+      if (((bitField0_ & 0x00000800) == 0x00000800)) {
+        output.writeBytes(12, getFailureMessageBytes());
+      }
+      if (((bitField0_ & 0x00001000) == 0x00001000)) {
+        output.writeInt32(13, placementPolicy_);
+      }
+      for (int i = 0; i < containers_.size(); i++) {
+        output.writeBytes(14, containers_.getByteString(i));
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getNameBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(2, priority_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(3, desired_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(4, actual_);
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(5, releasing_);
+      }
+      if (((bitField0_ & 0x00000020) == 0x00000020)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(6, requested_);
+      }
+      if (((bitField0_ & 0x00000040) == 0x00000040)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(7, failed_);
+      }
+      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(8, started_);
+      }
+      if (((bitField0_ & 0x00000100) == 0x00000100)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(9, startFailed_);
+      }
+      if (((bitField0_ & 0x00000200) == 0x00000200)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(10, completed_);
+      }
+      if (((bitField0_ & 0x00000400) == 0x00000400)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(11, totalRequested_);
+      }
+      if (((bitField0_ & 0x00000800) == 0x00000800)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(12, getFailureMessageBytes());
+      }
+      if (((bitField0_ & 0x00001000) == 0x00001000)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(13, placementPolicy_);
+      }
+      {
+        int dataSize = 0;
+        for (int i = 0; i < containers_.size(); i++) {
+          dataSize += com.google.protobuf.CodedOutputStream
+            .computeBytesSizeNoTag(containers_.getByteString(i));
+        }
+        size += dataSize;
+        size += 1 * getContainersList().size();
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    @java.lang.Override
+    public boolean equals(final java.lang.Object obj) {
+      if (obj == this) {
+       return true;
+      }
+      if (!(obj instanceof org.apache.slider.api.proto.Messages.ComponentInformationProto)) {
+        return super.equals(obj);
+      }
+      org.apache.slider.api.proto.Messages.ComponentInformationProto other = (org.apache.slider.api.proto.Messages.ComponentInformationProto) obj;
+
+      boolean result = true;
+      result = result && (hasName() == other.hasName());
+      if (hasName()) {
+        result = result && getName()
+            .equals(other.getName());
+      }
+      result = result && (hasPriority() == other.hasPriority());
+      if (hasPriority()) {
+        result = result && (getPriority()
+            == other.getPriority());
+      }
+      result = result && (hasDesired() == other.hasDesired());
+      if (hasDesired()) {
+        result = result && (getDesired()
+            == other.getDesired());
+      }
+      result = result && (hasActual() == other.hasActual());
+      if (hasActual()) {
+        result = result && (getActual()
+            == other.getActual());
+      }
+      result = result && (hasReleasing() == other.hasReleasing());
+      if (hasReleasing()) {
+        result = result && (getReleasing()
+            == other.getReleasing());
+      }
+      result = result && (hasRequested() == other.hasRequested());
+      if (hasRequested()) {
+        result = result && (getRequested()
+            == other.getRequested());
+      }
+      result = result && (hasFailed() == other.hasFailed());
+      if (hasFailed()) {
+        result = result && (getFailed()
+            == other.getFailed());
+      }
+      result = result && (hasStarted() == other.hasStarted());
+      if (hasStarted()) {
+        result = result && (getStarted()
+            == other.getStarted());
+      }
+      result = result && (hasStartFailed() == other.hasStartFailed());
+      if (hasStartFailed()) {
+        result = result && (getStartFailed()
+            == other.getStartFailed());
+      }
+      result = result && (hasCompleted() == other.hasCompleted());
+      if (hasCompleted()) {
+        result = result && (getCompleted()
+            == other.getCompleted());
+      }
+      result = result && (hasTotalRequested() == other.hasTotalRequested());
+      if (hasTotalRequested()) {
+        result = result && (getTotalRequested()
+            == other.getTotalRequested());
+      }
+      result = result && (hasFailureMessage() == other.hasFailureMessage());
+      if (hasFailureMessage()) {
+        result = result && getFailureMessage()
+            .equals(other.getFailureMessage());
+      }
+      result = result && (hasPlacementPolicy() == other.hasPlacementPolicy());
+      if (hasPlacementPolicy()) {
+        result = result && (getPlacementPolicy()
+            == other.getPlacementPolicy());
+      }
+      result = result && getContainersList()
+          .equals(other.getContainersList());
+      result = result &&
+          getUnknownFields().equals(other.getUnknownFields());
+      return result;
+    }
+
+    private int memoizedHashCode = 0;
+    @java.lang.Override
+    public int hashCode() {
+      if (memoizedHashCode != 0) {
+        return memoizedHashCode;
+      }
+      int hash = 41;
+      hash = (19 * hash) + getDescriptorForType().hashCode();
+      if (hasName()) {
+        hash = (37 * hash) + NAME_FIELD_NUMBER;
+        hash = (53 * hash) + getName().hashCode();
+      }
+      if (hasPriority()) {
+        hash = (37 * hash) + PRIORITY_FIELD_NUMBER;
+        hash = (53 * hash) + getPriority();
+      }
+      if (hasDesired()) {
+        hash = (37 * hash) + DESIRED_FIELD_NUMBER;
+        hash = (53 * hash) + getDesired();
+      }
+      if (hasActual()) {
+        hash = (37 * hash) + ACTUAL_FIELD_NUMBER;
+        hash = (53 * hash) + getActual();
+      }
+      if (hasReleasing()) {
+        hash = (37 * hash) + RELEASING_FIELD_NUMBER;
+        hash = (53 * hash) + getReleasing();
+      }
+      if (hasRequested()) {
+        hash = (37 * hash) + REQUESTED_FIELD_NUMBER;
+        hash = (53 * hash) + getRequested();
+      }
+      if (hasFailed()) {
+        hash = (37 * hash) + FAILED_FIELD_NUMBER;
+        hash = (53 * hash) + getFailed();
+      }
+      if (hasStarted()) {
+        hash = (37 * hash) + STARTED_FIELD_NUMBER;
+        hash = (53 * hash) + getStarted();
+      }
+      if (hasStartFailed()) {
+        hash = (37 * hash) + STARTFAILED_FIELD_NUMBER;
+        hash = (53 * hash) + getStartFailed();
+      }
+      if (hasCompleted()) {
+        hash = (37 * hash) + COMPLETED_FIELD_NUMBER;
+        hash = (53 * hash) + getCompleted();
+      }
+      if (hasTotalRequested()) {
+        hash = (37 * hash) + TOTALREQUESTED_FIELD_NUMBER;
+        hash = (53 * hash) + getTotalRequested();
+      }
+      if (hasFailureMessage()) {
+        hash = (37 * hash) + FAILUREMESSAGE_FIELD_NUMBER;
+        hash = (53 * hash) + getFailureMessage().hashCode();
+      }
+      if (hasPlacementPolicy()) {
+        hash = (37 * hash) + PLACEMENTPOLICY_FIELD_NUMBER;
+        hash = (53 * hash) + getPlacementPolicy();
+      }
+      if (getContainersCount() > 0) {
+        hash = (37 * hash) + CONTAINERS_FIELD_NUMBER;
+        hash = (53 * hash) + getContainersList().hashCode();
+      }
+      hash = (29 * hash) + getUnknownFields().hashCode();
+      memoizedHashCode = hash;
+      return hash;
+    }
+
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.slider.api.proto.Messages.ComponentInformationProto parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.slider.api.proto.Messages.ComponentInformationProto prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.apache.slider.api.ComponentInformationProto}
+     *
+     * <pre>
+     *
+     * see org.apache.slider.api.types.ComponentInformation
+     * </pre>
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.slider.api.proto.Messages.ComponentInformationProtoOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ComponentInformationProto_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ComponentInformationProto_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.slider.api.proto.Messages.ComponentInformationProto.class, org.apache.slider.api.proto.Messages.ComponentInformationProto.Builder.class);
+      }
+
+      // Construct using org.apache.slider.api.proto.Messages.ComponentInformationProto.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        name_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        priority_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000002);
+        desired_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        actual_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000008);
+        releasing_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000010);
+        requested_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000020);
+        failed_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000040);
+        started_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000080);
+        startFailed_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000100);
+        completed_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000200);
+        totalRequested_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000400);
+        failureMessage_ = "";
+        bitField0_ = (bitField0_ & ~0x00000800);
+        placementPolicy_ = 0;
+        bitField0_ = (bitField0_ & ~0x00001000);
+        containers_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00002000);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_ComponentInformationProto_descriptor;
+      }
+
+      public org.apache.slider.api.proto.Messages.ComponentInformationProto getDefaultInstanceForType() {
+        return org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance();
+      }
+
+      public org.apache.slider.api.proto.Messages.ComponentInformationProto build() {
+        org.apache.slider.api.proto.Messages.ComponentInformationProto result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.slider.api.proto.Messages.ComponentInformationProto buildPartial() {
+        org.apache.slider.api.proto.Messages.ComponentInformationProto result = new org.apache.slider.api.proto.Messages.ComponentInformationProto(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.name_ = name_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.priority_ = priority_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.desired_ = desired_;
+        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.actual_ = actual_;
+        if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+          to_bitField0_ |= 0x00000010;
+        }
+        result.releasing_ = releasing_;
+        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+          to_bitField0_ |= 0x00000020;
+        }
+        result.requested_ = requested_;
+        if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
+          to_bitField0_ |= 0x00000040;
+        }
+        result.failed_ = failed_;
+        if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
+          to_bitField0_ |= 0x00000080;
+        }
+        result.started_ = started_;
+        if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
+          to_bitField0_ |= 0x00000100;
+        }
+        result.startFailed_ = startFailed_;
+        if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
+          to_bitField0_ |= 0x00000200;
+        }
+        result.completed_ = completed_;
+        if (((from_bitField0_ & 0x00000400) == 0x00000400)) {
+          to_bitField0_ |= 0x00000400;
+        }
+        result.totalRequested_ = totalRequested_;
+        if (((from_bitField0_ & 0x00000800) == 0x00000800)) {
+          to_bitField0_ |= 0x00000800;
+        }
+        result.failureMessage_ = failureMessage_;
+        if (((from_bitField0_ & 0x00001000) == 0x00001000)) {
+          to_bitField0_ |= 0x00001000;
+        }
+        result.placementPolicy_ = placementPolicy_;
+        if (((bitField0_ & 0x00002000) == 0x00002000)) {
+          containers_ = new com.google.protobuf.UnmodifiableLazyStringList(
+              containers_);
+          bitField0_ = (bitField0_ & ~0x00002000);
+        }
+        result.containers_ = containers_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.slider.api.proto.Messages.ComponentInformationProto) {
+          return mergeFrom((org.apache.slider.api.proto.Messages.ComponentInformationProto)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.slider.api.proto.Messages.ComponentInformationProto other) {
+        if (other == org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance()) return this;
+        if (other.hasName()) {
+          bitField0_ |= 0x00000001;
+          name_ = other.name_;
+          onChanged();
+        }
+        if (other.hasPriority()) {
+          setPriority(other.getPriority());
+        }
+        if (other.hasDesired()) {
+          setDesired(other.getDesired());
+        }
+        if (other.hasActual()) {
+          setActual(other.getActual());
+        }
+        if (other.hasReleasing()) {
+          setReleasing(other.getReleasing());
+        }
+        if (other.hasRequested()) {
+          setRequested(other.getRequested());
+        }
+        if (other.hasFailed()) {
+          setFailed(other.getFailed());
+        }
+        if (other.hasStarted()) {
+          setStarted(other.getStarted());
+        }
+        if (other.hasStartFailed()) {
+          setStartFailed(other.getStartFailed());
+        }
+        if (other.hasCompleted()) {
+          setCompleted(other.getCompleted());
+        }
+        if (other.hasTotalRequested()) {
+          setTotalRequested(other.getTotalRequested());
+        }
+        if (other.hasFailureMessage()) {
+          bitField0_ |= 0x00000800;
+          failureMessage_ = other.failureMessage_;
+          onChanged();
+        }
+        if (other.hasPlacementPolicy()) {
+          setPlacementPolicy(other.getPlacementPolicy());
+        }
+        if (!other.containers_.isEmpty()) {
+          if (containers_.isEmpty()) {
+            containers_ = other.containers_;
+            bitField0_ = (bitField0_ & ~0x00002000);
+          } else {
+            ensureContainersIsMutable();
+            containers_.addAll(other.containers_);
+          }
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.slider.api.proto.Messages.ComponentInformationProto parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.slider.api.proto.Messages.ComponentInformationProto) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // optional string name = 1;
+      private java.lang.Object name_ = "";
+      /**
+       * <code>optional string name = 1;</code>
+       */
+      public boolean hasName() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional string name = 1;</code>
+       */
+      public java.lang.String getName() {
+        java.lang.Object ref = name_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          name_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string name = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getNameBytes() {
+        java.lang.Object ref = name_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          name_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string name = 1;</code>
+       */
+      public Builder setName(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        name_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string name = 1;</code>
+       */
+      public Builder clearName() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        name_ = getDefaultInstance().getName();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string name = 1;</code>
+       */
+      public Builder setNameBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        name_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 priority = 2;
+      private int priority_ ;
+      /**
+       * <code>optional int32 priority = 2;</code>
+       */
+      public boolean hasPriority() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional int32 priority = 2;</code>
+       */
+      public int getPriority() {
+        return priority_;
+      }
+      /**
+       * <code>optional int32 priority = 2;</code>
+       */
+      public Builder setPriority(int value) {
+        bitField0_ |= 0x00000002;
+        priority_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 priority = 2;</code>
+       */
+      public Builder clearPriority() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        priority_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 desired = 3;
+      private int desired_ ;
+      /**
+       * <code>optional int32 desired = 3;</code>
+       */
+      public boolean hasDesired() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional int32 desired = 3;</code>
+       */
+      public int getDesired() {
+        return desired_;
+      }
+      /**
+       * <code>optional int32 desired = 3;</code>
+       */
+      public Builder setDesired(int value) {
+        bitField0_ |= 0x00000004;
+        desired_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 desired = 3;</code>
+       */
+      public Builder clearDesired() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        desired_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 actual = 4;
+      private int actual_ ;
+      /**
+       * <code>optional int32 actual = 4;</code>
+       */
+      public boolean hasActual() {
+        return ((bitField0_ & 0x00000008) == 0x00000008);
+      }
+      /**
+       * <code>optional int32 actual = 4;</code>
+       */
+      public int getActual() {
+        return actual_;
+      }
+      /**
+       * <code>optional int32 actual = 4;</code>
+       */
+      public Builder setActual(int value) {
+        bitField0_ |= 0x00000008;
+        actual_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 actual = 4;</code>
+       */
+      public Builder clearActual() {
+        bitField0_ = (bitField0_ & ~0x00000008);
+        actual_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 releasing = 5;
+      private int releasing_ ;
+      /**
+       * <code>optional int32 releasing = 5;</code>
+       */
+      public boolean hasReleasing() {
+        return ((bitField0_ & 0x00000010) == 0x00000010);
+      }
+      /**
+       * <code>optional int32 releasing = 5;</code>
+       */
+      public int getReleasing() {
+        return releasing_;
+      }
+      /**
+       * <code>optional int32 releasing = 5;</code>
+       */
+      public Builder setReleasing(int value) {
+        bitField0_ |= 0x00000010;
+        releasing_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 releasing = 5;</code>
+       */
+      public Builder clearReleasing() {
+        bitField0_ = (bitField0_ & ~0x00000010);
+        releasing_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 requested = 6;
+      private int requested_ ;
+      /**
+       * <code>optional int32 requested = 6;</code>
+       */
+      public boolean hasRequested() {
+        return ((bitField0_ & 0x00000020) == 0x00000020);
+      }
+      /**
+       * <code>optional int32 requested = 6;</code>
+       */
+      public int getRequested() {
+        return requested_;
+      }
+      /**
+       * <code>optional int32 requested = 6;</code>
+       */
+      public Builder setRequested(int value) {
+        bitField0_ |= 0x00000020;
+        requested_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 requested = 6;</code>
+       */
+      public Builder clearRequested() {
+        bitField0_ = (bitField0_ & ~0x00000020);
+        requested_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 failed = 7;
+      private int failed_ ;
+      /**
+       * <code>optional int32 failed = 7;</code>
+       */
+      public boolean hasFailed() {
+        return ((bitField0_ & 0x00000040) == 0x00000040);
+      }
+      /**
+       * <code>optional int32 failed = 7;</code>
+       */
+      public int getFailed() {
+        return failed_;
+      }
+      /**
+       * <code>optional int32 failed = 7;</code>
+       */
+      public Builder setFailed(int value) {
+        bitField0_ |= 0x00000040;
+        failed_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 failed = 7;</code>
+       */
+      public Builder clearFailed() {
+        bitField0_ = (bitField0_ & ~0x00000040);
+        failed_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 started = 8;
+      private int started_ ;
+      /**
+       * <code>optional int32 started = 8;</code>
+       */
+      public boolean hasStarted() {
+        return ((bitField0_ & 0x00000080) == 0x00000080);
+      }
+      /**
+       * <code>optional int32 started = 8;</code>
+       */
+      public int getStarted() {
+        return started_;
+      }
+      /**
+       * <code>optional int32 started = 8;</code>
+       */
+      public Builder setStarted(int value) {
+        bitField0_ |= 0x00000080;
+        started_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 started = 8;</code>
+       */
+      public Builder clearStarted() {
+        bitField0_ = (bitField0_ & ~0x00000080);
+        started_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 startFailed = 9;
+      private int startFailed_ ;
+      /**
+       * <code>optional int32 startFailed = 9;</code>
+       */
+      public boolean hasStartFailed() {
+        return ((bitField0_ & 0x00000100) == 0x00000100);
+      }
+      /**
+       * <code>optional int32 startFailed = 9;</code>
+       */
+      public int getStartFailed() {
+        return startFailed_;
+      }
+      /**
+       * <code>optional int32 startFailed = 9;</code>
+       */
+      public Builder setStartFailed(int value) {
+        bitField0_ |= 0x00000100;
+        startFailed_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 startFailed = 9;</code>
+       */
+      public Builder clearStartFailed() {
+        bitField0_ = (bitField0_ & ~0x00000100);
+        startFailed_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 completed = 10;
+      private int completed_ ;
+      /**
+       * <code>optional int32 completed = 10;</code>
+       */
+      public boolean hasCompleted() {
+        return ((bitField0_ & 0x00000200) == 0x00000200);
+      }
+      /**
+       * <code>optional int32 completed = 10;</code>
+       */
+      public int getCompleted() {
+        return completed_;
+      }
+      /**
+       * <code>optional int32 completed = 10;</code>
+       */
+      public Builder setCompleted(int value) {
+        bitField0_ |= 0x00000200;
+        completed_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 completed = 10;</code>
+       */
+      public Builder clearCompleted() {
+        bitField0_ = (bitField0_ & ~0x00000200);
+        completed_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 totalRequested = 11;
+      private int totalRequested_ ;
+      /**
+       * <code>optional int32 totalRequested = 11;</code>
+       */
+      public boolean hasTotalRequested() {
+        return ((bitField0_ & 0x00000400) == 0x00000400);
+      }
+      /**
+       * <code>optional int32 totalRequested = 11;</code>
+       */
+      public int getTotalRequested() {
+        return totalRequested_;
+      }
+      /**
+       * <code>optional int32 totalRequested = 11;</code>
+       */
+      public Builder setTotalRequested(int value) {
+        bitField0_ |= 0x00000400;
+        totalRequested_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 totalRequested = 11;</code>
+       */
+      public Builder clearTotalRequested() {
+        bitField0_ = (bitField0_ & ~0x00000400);
+        totalRequested_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional string failureMessage = 12;
+      private java.lang.Object failureMessage_ = "";
+      /**
+       * <code>optional string failureMessage = 12;</code>
+       */
+      public boolean hasFailureMessage() {
+        return ((bitField0_ & 0x00000800) == 0x00000800);
+      }
+      /**
+       * <code>optional string failureMessage = 12;</code>
+       */
+      public java.lang.String getFailureMessage() {
+        java.lang.Object ref = failureMessage_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          failureMessage_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string failureMessage = 12;</code>
+       */
+      public com.google.protobuf.ByteString
+          getFailureMessageBytes() {
+        java.lang.Object ref = failureMessage_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          failureMessage_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string failureMessage = 12;</code>
+       */
+      public Builder setFailureMessage(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000800;
+        failureMessage_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string failureMessage = 12;</code>
+       */
+      public Builder clearFailureMessage() {
+        bitField0_ = (bitField0_ & ~0x00000800);
+        failureMessage_ = getDefaultInstance().getFailureMessage();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string failureMessage = 12;</code>
+       */
+      public Builder setFailureMessageBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000800;
+        failureMessage_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 placementPolicy = 13;
+      private int placementPolicy_ ;
+      /**
+       * <code>optional int32 placementPolicy = 13;</code>
+       */
+      public boolean hasPlacementPolicy() {
+        return ((bitField0_ & 0x00001000) == 0x00001000);
+      }
+      /**
+       * <code>optional int32 placementPolicy = 13;</code>
+       */
+      public int getPlacementPolicy() {
+        return placementPolicy_;
+      }
+      /**
+       * <code>optional int32 placementPolicy = 13;</code>
+       */
+      public Builder setPlacementPolicy(int value) {
+        bitField0_ |= 0x00001000;
+        placementPolicy_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 placementPolicy = 13;</code>
+       */
+      public Builder clearPlacementPolicy() {
+        bitField0_ = (bitField0_ & ~0x00001000);
+        placementPolicy_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // repeated string containers = 14;
+      private com.google.protobuf.LazyStringList containers_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+      private void ensureContainersIsMutable() {
+        if (!((bitField0_ & 0x00002000) == 0x00002000)) {
+          containers_ = new com.google.protobuf.LazyStringArrayList(containers_);
+          bitField0_ |= 0x00002000;
+         }
+      }
+      /**
+       * <code>repeated string containers = 14;</code>
+       */
+      public java.util.List<java.lang.String>
+          getContainersList() {
+        return java.util.Collections.unmodifiableList(containers_);
+      }
+      /**
+       * <code>repeated string containers = 14;</code>
+       */
+      public int getContainersCount() {
+        return containers_.size();
+      }
+      /**
+       * <code>repeated string containers = 14;</code>
+       */
+      public java.lang.String getContainers(int index) {
+        return containers_.get(index);
+      }
+      /**
+       * <code>repeated string containers = 14;</code>
+       */
+      public com.google.protobuf.ByteString
+          getContainersBytes(int index) {
+        return containers_.getByteString(index);
+      }
+      /**
+       * <code>repeated string containers = 14;</code>
+       */
+      public Builder setContainers(
+          int index, java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureContainersIsMutable();
+        containers_.set(index, value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string containers = 14;</code>
+       */
+      public Builder addContainers(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureContainersIsMutable();
+        containers_.add(value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string containers = 14;</code>
+       */
+      public Builder addAllContainers(
+          java.lang.Iterable<java.lang.String> values) {
+        ensureContainersIsMutable();
+        super.addAll(values, containers_);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string containers = 14;</code>
+       */
+      public Builder clearContainers() {
+        containers_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00002000);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string containers = 14;</code>
+       */
+      public Builder addContainersBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureContainersIsMutable();
+        containers_.add(value);
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.apache.slider.api.ComponentInformationProto)
+    }
+
+    static {
+      defaultInstance = new ComponentInformationProto(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.apache.slider.api.ComponentInformationProto)
+  }
+
+  public interface ContainerInformationProtoOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // optional string containerId = 1;
+    /**
+     * <code>optional string containerId = 1;</code>
+     */
+    boolean hasContainerId();
+    /**
+     * <code>optional string containerId = 1;</code>
+     */
+    java.lang.String getContainerId();
+    /**
+     * <code>optional string containerId = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getContainerIdBytes();
+
+    // optional string component = 2;
+    /**
+     * <code>optional string component = 2;</code>
+     */
+    boolean hasComponent();
+    /**
+     * <code>optional string component = 2;</code>
+     */
+    java.lang.String getComponent();
+    /**
+     * <code>optional string component = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getComponentBytes();
+
+    // optional bool released = 3;
+    /**
+     * <code>optional bool released = 3;</code>
+     */
+    boolean hasReleased();
+    /**
+     * <code>optional bool released = 3;</code>
+     */
+    boolean getReleased();
+
+    // optional int32 state = 4;
+    /**
+     * <code>optional int32 state = 4;</code>
+     */
+    boolean hasState();
+    /**
+     * <code>optional int32 state = 4;</code>
+     */
+    int getState();
+
+    // optional int32 exitCode = 5;
+    /**
+     * <code>optional int32 exitCode = 5;</code>
+     */
+    boolean hasExitCode();
+    /**
+     * <code>optional int32 exitCode = 5;</code>
+     */
+    int getExitCode();
+
+    // optional string diagnostics = 6;
+    /**
+     * <code>optional string diagnostics = 6;</code>
+     */
+    boolean hasDiagnostics();
+    /**
+     * <code>optional string diagnostics = 6;</code>
+     */
+    java.lang.String getDiagnostics();
+    /**
+     * <code>optional string diagnostics = 6;</code>
+     */
+    com.google.protobuf.ByteString
+        getDiagnosticsBytes();
+
+    // optional int64 createTime = 7;
+    /**
+     * <code>optional int64 createTime = 7;</code>
+     */
+    boolean hasCreateTime();
+    /**
+     * <code>optional int64 createTime = 7;</code>
+     */
+    long getCreateTime();
+
+    // optional int64 startTime = 8;
+    /**
+     * <code>optional int64 startTime = 8;</code>
+     */
+    boolean hasStartTime();
+    /**
+     * <code>optional int64 startTime = 8;</code>
+     */
+    long getStartTime();
+
+    // repeated string output = 9;
+    /**
+     * <code>repeated string output = 9;</code>
+     */
+    java.util.List<java.lang.String>
+    getOutputList();
+    /**
+     * <code>repeated string output = 9;</code>
+     */
+    int getOutputCount();
+    /**
+     * <code>repeated string output = 9;</code>
+     */
+    java.lang.String getOutput(int index);
+    /**
+     * <code>repeated string output = 9;</code>
+     */
+    com.google.protobuf.ByteString
+        getOutputBytes(int index);
+
+    // optional string host = 10;
+    /**
+     * <code>optional string host = 10;</code>
+     */
+    boolean hasHost();
+    /**
+     * <code>optional string host = 10;</code>
+     */
+    java.lang.String getHost();
+    /**
+     * <code>optional string host = 10;</code>
+     */
+    com.google.protobuf.ByteString
+        getHostBytes();
+
+    // optional string hostURL = 11;
+    /**
+     * <code>optional string hostURL = 11;</code>
+     */
+    boolean hasHostURL();
+    /**
+     * <code>optional string hostURL = 11;</code>
+     */
+    java.lang.String getHostURL();
+    /**
+     * <code>optional string hostURL = 11;</code>
+     */
+    com.google.protobuf.ByteString
+        getHostURLBytes();
+  }
+  /**
+   * Protobuf type {@code org.apache.slider.api.ContainerInformationProto}
+   *
+   * <pre>
+   *
+   * see org.apache.slider.api.types.ContainerInformation
+   * </pre>
+   */
+  public static final class ContainerInformationProto extends
+      com.google.protobuf.GeneratedMessage
+      implements ContainerInformationProtoOrBuilder {
+    // Use ContainerInformationProto.newBuilder() to construct.
+    private ContainerInformationProto(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private ContainerInformationProto(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final ContainerInformationProto defaultInstance;
+    public static ContainerInformationProto getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public ContainerInformationProto getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private ContainerInformationProto(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              containerId_ = input.readBytes();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              component_ = input.readBytes();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              released_ = input.readBool();
+              break;
+            }
+            case 32: {
+              bitField0_ |= 0x00000008;
+              state_ = input.readInt32();
+              break;
+            }
+            case 40: {
+              bitField0_ |= 0x00000010;
+              exitCode_ = input.readInt32();
+              break;
+            }
+            case 50: {
+              bitField0_ |= 0x00

<TRUNCATED>