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 <[email protected]>
Authored: Fri Feb 13 11:18:39 2015 +0000
Committer: Steve Loughran <[email protected]>
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
   }
 

Reply via email to