ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlun...@apache.org
Subject [2/3] ambari git commit: AMBARI-21077: Refactor API endpoint to have a single entry point for an API version (jluniya)
Date Fri, 19 May 2017 20:33:36 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/PreUpgradeCheckService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/PreUpgradeCheckService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/PreUpgradeCheckService.java
index b43fc93..3071c5f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/PreUpgradeCheckService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/PreUpgradeCheckService.java
@@ -27,6 +27,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -44,7 +45,8 @@ public class PreUpgradeCheckService extends BaseService {
    *
    * @param clusterName cluster name
    */
-  public PreUpgradeCheckService(String clusterName) {
+  public PreUpgradeCheckService(ApiVersion apiVersion, String clusterName) {
+    super(apiVersion);
     this.clusterName = clusterName;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/PrivilegeService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/PrivilegeService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/PrivilegeService.java
index ab07bce..a2a970b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/PrivilegeService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/PrivilegeService.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 
 
 /**
@@ -38,6 +39,10 @@ import org.apache.ambari.server.api.resources.ResourceInstance;
  */
 public abstract class PrivilegeService extends BaseService {
 
+  public PrivilegeService(ApiVersion apiVersion) {
+    super(apiVersion);
+  }
+
   /**
    * Handles: GET /privileges/{privilegeID}
    * Get a specific privilege.

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/RecommendationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RecommendationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RecommendationService.java
index 8c8fb7f..4bb4b09 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RecommendationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RecommendationService.java
@@ -22,8 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
@@ -32,32 +30,50 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
- * Service responsible for preparing recommendations for host-layout and
- * configurations.
+ * Service responsible for preparing recommendations for host-layout and configurations.
  */
-@Path("/stacks/{stackName}/versions/{stackVersion}/recommendations")
 public class RecommendationService extends BaseService {
 
   /**
+   * Stack name.
+   */
+  private String m_stackName;
+
+  /**
+   * Stack version.
+   */
+  private String m_stackVersion;
+
+  /**
+   * Constructor.
+   *
+   * @param apiVersion API version
+   * @param stackName Stack name
+   * @param stackVersion Stack version
+   */
+  public RecommendationService(final ApiVersion apiVersion, String stackName, String stackVersion) {
+    super(apiVersion);
+    this.m_stackName = stackName;
+    this.m_stackVersion = stackVersion;
+  }
+
+  /**
    * Returns host-layout recommendations for list of hosts and services.
    * 
    * @param body http body
    * @param headers http headers
    * @param ui uri info
-   * @param stackName stack name
-   * @param stackVersion stack version
    * @return recommendations for host-layout
    */
   @POST
   @Produces(MediaType.TEXT_PLAIN)
-  public Response getRecommendation(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-      @PathParam("stackName") String stackName, @PathParam("stackVersion") String stackVersion) {
-
+  public Response getRecommendation(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
     return handleRequest(headers, body, ui, Request.Type.POST,
-        createRecommendationResource(stackName, stackVersion));
+        createRecommendationResource(m_stackName, m_stackVersion));
   }
 
   ResourceInstance createRecommendationResource(String stackName, String stackVersion) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/RemoteClustersService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RemoteClustersService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RemoteClustersService.java
index 799ae5f..d6b26fd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RemoteClustersService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RemoteClustersService.java
@@ -33,15 +33,19 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 
 /**
  * Service responsible for Remote Cluster resource requests.
  */
-@Path("/remoteclusters")
 public class RemoteClustersService extends BaseService {
 
+  public RemoteClustersService(ApiVersion apiVersion) {
+    super(apiVersion);
+  }
+
   /**
    * Get the list of all Remote Clusters
    * @param headers

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryService.java
index c88ca14..882d9b3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryService.java
@@ -49,6 +49,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -66,7 +67,8 @@ public class RepositoryService extends BaseService {
    *
    * @param parentKeyProperties extra properties to be inserted into created resource
    */
-  public RepositoryService(Map<Resource.Type, String> parentKeyProperties) {
+  public RepositoryService(ApiVersion apiVersion, Map<Resource.Type, String> parentKeyProperties) {
+    super(apiVersion);
     this.parentKeyProperties = parentKeyProperties;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryVersionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryVersionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryVersionService.java
index a3e707d..396f209 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryVersionService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RepositoryVersionService.java
@@ -33,6 +33,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -48,9 +49,11 @@ public class RepositoryVersionService extends BaseService {
   /**
    * Constructor.
    *
+   * @param apiVersion API version
    * @param parentKeyProperties extra properties to be inserted into created resource
    */
-  public RepositoryVersionService(Map<Resource.Type, String> parentKeyProperties) {
+  public RepositoryVersionService(ApiVersion apiVersion, Map<Resource.Type, String> parentKeyProperties) {
+    super(apiVersion);
     this.parentKeyProperties = parentKeyProperties;
   }
 
@@ -141,7 +144,7 @@ public class RepositoryVersionService extends BaseService {
     final Map<Resource.Type, String> mapIds = new HashMap<>();
     mapIds.putAll(parentKeyProperties);
     mapIds.put(Resource.Type.RepositoryVersion, repositoryVersionId);
-    return new OperatingSystemService(mapIds);
+    return new OperatingSystemService(m_apiVersion, mapIds);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestScheduleService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestScheduleService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestScheduleService.java
index cfcc2d7..d418214 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestScheduleService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestScheduleService.java
@@ -32,6 +32,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -48,7 +49,8 @@ public class RequestScheduleService extends BaseService {
    * Constructor
    * @param m_clusterName
    */
-  public RequestScheduleService(String m_clusterName) {
+  public RequestScheduleService(ApiVersion apiVersion, String m_clusterName) {
+    super(apiVersion);
     this.m_clusterName = m_clusterName;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java
index 936b857..4a63ff0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java
@@ -34,13 +34,13 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 
 /**
  * Service responsible for request resource requests.
  */
-@Path("/requests/")
 public class RequestService extends BaseService {
   /**
    * Parent cluster name.
@@ -48,7 +48,8 @@ public class RequestService extends BaseService {
   private String m_clusterName;
 
 
-  public RequestService() {
+  public RequestService(ApiVersion apiVersion) {
+    super(apiVersion);
   }
   
   /**
@@ -56,7 +57,8 @@ public class RequestService extends BaseService {
    *
    * @param clusterName cluster id
    */
-  public RequestService(String clusterName) {
+  public RequestService(ApiVersion apiVersion, String clusterName) {
+    super(apiVersion);
     m_clusterName = clusterName;
   }
 
@@ -102,7 +104,7 @@ public class RequestService extends BaseService {
    */
   @Path("{requestId}/stages")
   public StageService getStageHandler(@PathParam("requestId") String requestId) {
-    return new StageService(m_clusterName, requestId);
+    return new StageService(m_apiVersion, m_clusterName, requestId);
   }
 
   /**
@@ -110,7 +112,7 @@ public class RequestService extends BaseService {
    */
   @Path("{requestId}/tasks")
   public TaskService getTaskHandler(@PathParam("requestId") String requestId) {
-    return new TaskService(m_clusterName, requestId, null);
+    return new TaskService(m_apiVersion, m_clusterName, requestId, null);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/RoleAuthorizationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RoleAuthorizationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RoleAuthorizationService.java
index f7365a1..8f6985c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RoleAuthorizationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RoleAuthorizationService.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -39,15 +40,14 @@ import org.apache.ambari.server.controller.spi.Resource;
  * The result sets returned by this service are either the full set of available authorizations or
  * those related to a particular permission.
  */
-@Path("/authorizations/")
 public class RoleAuthorizationService extends BaseService {
   private String permissionId;
 
   /**
    * Constructs a new RoleAuthorizationService that is not linked to any role (or permission)
    */
-  public RoleAuthorizationService() {
-    this(null);
+  public RoleAuthorizationService(ApiVersion apiVersion) {
+    this(apiVersion, null);
   }
 
   /**
@@ -55,7 +55,8 @@ public class RoleAuthorizationService extends BaseService {
    *
    * @param permissionId the permission id of a permission (or role)
    */
-  public RoleAuthorizationService(String permissionId) {
+  public RoleAuthorizationService(ApiVersion apiVersion, String permissionId) {
+    super(apiVersion);
     this.permissionId = permissionId;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
index ce9240c..96ca167 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
@@ -32,11 +32,15 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
-@Path("/services/")
 public class RootServiceService extends BaseService {
-  
+
+  public RootServiceService(ApiVersion apiVersion) {
+    super(apiVersion);
+  }
+
   @GET
   @Produces("text/plain")
   public Response getServices(String body, @Context HttpHeaders headers, @Context UriInfo ui) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceConfigVersionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceConfigVersionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceConfigVersionService.java
index 43eabdc..6a76cf8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceConfigVersionService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceConfigVersionService.java
@@ -29,6 +29,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 public class ServiceConfigVersionService extends BaseService {
@@ -37,7 +38,8 @@ public class ServiceConfigVersionService extends BaseService {
    */
   private String m_clusterName;
 
-  public ServiceConfigVersionService(String m_clusterName) {
+  public ServiceConfigVersionService(ApiVersion apiVersion, String m_clusterName) {
+    super(apiVersion);
     this.m_clusterName = m_clusterName;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
index 52871f2..adbd31d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
@@ -34,6 +34,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -50,7 +51,8 @@ public class ServiceService extends BaseService {
    *
    * @param clusterName cluster id
    */
-  public ServiceService(String clusterName) {
+  public ServiceService(ApiVersion apiVersion, String clusterName) {
+    super(apiVersion);
     m_clusterName = clusterName;
   }
 
@@ -187,7 +189,7 @@ public class ServiceService extends BaseService {
   @Path("{serviceName}/components")
   public ComponentService getComponentHandler(@PathParam("serviceName") String serviceName) {
 
-    return new ComponentService(m_clusterName, serviceName);
+    return new ComponentService(m_apiVersion, m_clusterName, serviceName);
   }
 
   /**
@@ -196,7 +198,7 @@ public class ServiceService extends BaseService {
   @Path("{serviceName}/alerts")
   public AlertService getAlertHandler(
       @PathParam("serviceName") String serviceName) {
-    return new AlertService(m_clusterName, serviceName, null);
+    return new AlertService(m_apiVersion, m_clusterName, serviceName, null);
   }
 
   /**
@@ -379,7 +381,7 @@ public class ServiceService extends BaseService {
       @Context javax.ws.rs.core.Request request,
       @PathParam("serviceName") String serviceName) {
 
-    return new AlertHistoryService(m_clusterName, serviceName, null);
+    return new AlertHistoryService(m_apiVersion, m_clusterName, serviceName, null);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/SettingService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/SettingService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/SettingService.java
index e186be2..57bce21 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/SettingService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/SettingService.java
@@ -33,19 +33,19 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
  * Service responsible for setting resource requests.
  */
-@Path("/settings/")
 public class SettingService extends BaseService {
 
   /**
    * Construct a SettingService.
    */
-  public SettingService() {
-
+  public SettingService(ApiVersion apiVersion) {
+    super(apiVersion);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java
index 86bacf1..990bdd0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java
@@ -32,14 +32,18 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
  * Service for stacks management.
  */
-@Path("/stacks/")
 public class StacksService extends BaseService {
 
+  public StacksService(ApiVersion apiVersion) {
+    super(apiVersion);
+  }
+
   @GET
   @Produces("text/plain")
   public Response getStacks(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
@@ -345,7 +349,33 @@ public class StacksService extends BaseService {
     final Map<Resource.Type, String> stackProperties = new HashMap<>();
     stackProperties.put(Resource.Type.Stack, stackName);
     stackProperties.put(Resource.Type.StackVersion, stackVersion);
-    return new OperatingSystemService(stackProperties);
+    return new OperatingSystemService(m_apiVersion, stackProperties);
+  }
+
+  /**
+   * Returns host-layout recommendations for list of hosts and services.
+   *
+   * @param stackName stack name
+   * @param stackVersion stack version
+   * @return recommendations for host-layout
+   */
+  @Path("{stackName}/versions/{stackVersion}/recommendations")
+  public RecommendationService getRecommendationHandler(@PathParam("stackName") String stackName,
+          @PathParam("stackVersion") String stackVersion) {
+    return new RecommendationService(m_apiVersion, stackName, stackVersion);
+  }
+
+  /**
+   * Returns validation of host-layout.
+   *
+   * @param stackName stack name
+   * @param stackVersion stack version
+   * @return validation items if any
+   */
+  @Path("{stackName}/versions/{stackVersion}/validations")
+  public ValidationService getValidationHandler(@PathParam("stackName") String stackName,
+          @PathParam("stackVersion") String stackVersion) {
+    return new ValidationService(m_apiVersion, stackName, stackVersion);
   }
 
   /**
@@ -360,7 +390,7 @@ public class StacksService extends BaseService {
     final Map<Resource.Type, String> stackProperties = new HashMap<>();
     stackProperties.put(Resource.Type.Stack, stackName);
     stackProperties.put(Resource.Type.StackVersion, stackVersion);
-    return new RepositoryVersionService(stackProperties);
+    return new RepositoryVersionService(m_apiVersion, stackProperties);
   }
 
   /**
@@ -377,7 +407,7 @@ public class StacksService extends BaseService {
     final Map<Resource.Type, String> stackProperties = new HashMap<>();
     stackProperties.put(Resource.Type.Stack, stackName);
     stackProperties.put(Resource.Type.StackVersion, stackVersion);
-    return new CompatibleRepositoryVersionService(stackProperties);
+    return new CompatibleRepositoryVersionService(m_apiVersion, stackProperties);
   }
 
   ResourceInstance createStackServiceComponentResource(

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/StageService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/StageService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/StageService.java
index 6dc9010..428f8ae 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/StageService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/StageService.java
@@ -34,6 +34,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 
@@ -60,7 +61,8 @@ public class StageService extends BaseService {
    * @param clusterName  cluster id
    * @param requestId    request id
    */
-  public StageService(String clusterName, String requestId) {
+  public StageService(ApiVersion apiVersion, String clusterName, String requestId) {
+    super(apiVersion);
     m_clusterName = clusterName;
     m_requestId = requestId;
   }
@@ -110,7 +112,7 @@ public class StageService extends BaseService {
    */
   @Path("{stageId}/tasks")
   public TaskService getTaskHandler(@PathParam("stageId") String stageId) {
-    return new TaskService(m_clusterName, m_requestId, stageId);
+    return new TaskService(m_apiVersion, m_clusterName, m_requestId, stageId);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/TargetClusterService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/TargetClusterService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/TargetClusterService.java
index d022d73..abbd715 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/TargetClusterService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/TargetClusterService.java
@@ -33,14 +33,18 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
  * DR target cluster service.
  */
-@Path("/targets/")
 public class TargetClusterService extends BaseService {
 
+  public TargetClusterService(ApiVersion apiVersion) {
+    super(apiVersion);
+  }
+
   /**
    * Handles: GET /targets/{targetName}
    * Get a specific target.

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskAttemptService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskAttemptService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskAttemptService.java
index af7f378..9a5d9be 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskAttemptService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskAttemptService.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -51,7 +52,8 @@ public class TaskAttemptService extends BaseService {
    * @param jobId
    *          job id
    */
-  public TaskAttemptService(String clusterName, String workflowId, String jobId) {
+  public TaskAttemptService(ApiVersion apiVersion, String clusterName, String workflowId, String jobId) {
+    super(apiVersion);
     this.clusterName = clusterName;
     this.workflowId = workflowId;
     this.jobId = jobId;

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskService.java
index acc4eef..8a9749e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskService.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -58,7 +59,8 @@ public class TaskService extends BaseService {
    * @param requestId    request id
    * @param stageId      stage id
    */
-  public TaskService(String clusterName, String requestId, String stageId) {
+  public TaskService(ApiVersion apiVersion, String clusterName, String requestId, String stageId) {
+    super(apiVersion);
     m_clusterName = clusterName;
     m_requestId = requestId;
     m_stageId = stageId;

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java
index a3866be..4bd77bf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeGroupService.java
@@ -30,6 +30,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -40,7 +41,8 @@ public class UpgradeGroupService extends BaseService {
   private String m_clusterName = null;
   private String m_upgradeId = null;
 
-  UpgradeGroupService(String clusterName, String upgradeId) {
+  UpgradeGroupService(ApiVersion apiVersion, String clusterName, String upgradeId) {
+    super(apiVersion);
     m_clusterName = clusterName;
     m_upgradeId = upgradeId;
   }
@@ -68,7 +70,7 @@ public class UpgradeGroupService extends BaseService {
   public UpgradeItemService getUpgradeItemService(
       @Context HttpHeaders headers,
       @PathParam("upgradeGroupId") Long groupId) {
-    return new UpgradeItemService(m_clusterName, m_upgradeId, groupId.toString());
+    return new UpgradeItemService(m_apiVersion, m_clusterName, m_upgradeId, groupId.toString());
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeItemService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeItemService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeItemService.java
index 6d6c5e3..61c545a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeItemService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeItemService.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -42,7 +43,8 @@ public class UpgradeItemService extends BaseService {
   private String m_upgradeId = null;
   private String m_upgradeGroupId = null;
 
-  UpgradeItemService(String clusterName, String upgradeId, String upgradeGroupId) {
+  UpgradeItemService(ApiVersion apiVersion, String clusterName, String upgradeId, String upgradeGroupId) {
+    super(apiVersion);
     m_clusterName = clusterName;
     m_upgradeId = upgradeId;
     m_upgradeGroupId = upgradeGroupId;
@@ -94,7 +96,7 @@ public class UpgradeItemService extends BaseService {
       @Context HttpHeaders headers,
       @Context UriInfo ui,
       @PathParam("upgradeItemId") Long id) {
-    return new TaskService(m_clusterName, m_upgradeId, id.toString());
+    return new TaskService(m_apiVersion, m_clusterName, m_upgradeId, id.toString());
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeService.java
index dc54a0b..bb90d8a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeService.java
@@ -32,6 +32,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -46,7 +47,8 @@ public class UpgradeService extends BaseService {
    *
    * @param clusterName the cluster name (not {@code null}).
    */
-  UpgradeService(String clusterName) {
+  UpgradeService(ApiVersion apiVersion, String clusterName) {
+    super(apiVersion);
     m_clusterName = clusterName;
   }
 
@@ -90,7 +92,7 @@ public class UpgradeService extends BaseService {
    */
   @Path("{upgradeId}/upgrade_groups")
   public UpgradeGroupService getUpgradeGroupHandler(@PathParam("upgradeId") String upgradeId) {
-    return new UpgradeGroupService(m_clusterName, upgradeId);
+    return new UpgradeGroupService(m_apiVersion, m_clusterName, upgradeId);
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeSummaryService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeSummaryService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeSummaryService.java
index 36d0074..7e6c964 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeSummaryService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UpgradeSummaryService.java
@@ -30,6 +30,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 
@@ -45,7 +46,8 @@ public class UpgradeSummaryService extends BaseService {
    *
    * @param clusterName the cluster name (not {@code null}).
    */
-  UpgradeSummaryService(String clusterName) {
+  UpgradeSummaryService(ApiVersion apiVersion, String clusterName) {
+    super(apiVersion);
     m_clusterName = clusterName;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java
index 26d9c1d..910777c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserAuthorizationService.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.commons.lang.StringUtils;
 
@@ -53,7 +54,8 @@ public class UserAuthorizationService extends BaseService {
    *
    * @param username the username of the user to link thi UserAuthorizationService to
    */
-  public UserAuthorizationService(String username) {
+  public UserAuthorizationService(ApiVersion apiVersion, String username) {
+    super(apiVersion);
     this.username = username;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java
index 7df806d..30a791f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserPrivilegeService.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.api.services;
 
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -27,6 +28,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.commons.lang.StringUtils;
 /**
@@ -36,7 +38,8 @@ public class UserPrivilegeService extends PrivilegeService {
 
   private final String userName;
 
-  public UserPrivilegeService(String userName) {
+  public UserPrivilegeService(ApiVersion apiVersion, String userName) {
+    super(apiVersion);
     this.userName = userName;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
index 31f3a8c..9c7c9bc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/UserService.java
@@ -32,14 +32,18 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
  * Service responsible for user requests.
  */
-@Path("/users/")
 public class UserService extends BaseService {
 
+  public UserService(ApiVersion apiVersion) {
+    super(apiVersion);
+  }
+
   /**
    * Gets all users.
    * Handles: GET /users requests.
@@ -135,7 +139,7 @@ public class UserService extends BaseService {
   public PrivilegeService getPrivilegeService(@Context javax.ws.rs.core.Request request,
                                               @PathParam ("userName") String userName) {
 
-    return new UserPrivilegeService(userName);
+    return new UserPrivilegeService(m_apiVersion, userName);
   }
 
   /**
@@ -145,7 +149,7 @@ public class UserService extends BaseService {
   public ActiveWidgetLayoutService getWidgetLayoutService(@Context javax.ws.rs.core.Request request,
                                                     @PathParam ("userName") String userName) {
 
-    return new ActiveWidgetLayoutService(userName);
+    return new ActiveWidgetLayoutService(m_apiVersion, userName);
   }
 
   /**
@@ -158,7 +162,7 @@ public class UserService extends BaseService {
   @Path("{userName}/authorizations")
   public UserAuthorizationService getUserAuthorizations(
       @Context javax.ws.rs.core.Request request, @PathParam("userName") String username) {
-    return new UserAuthorizationService(username);
+    return new UserAuthorizationService(m_apiVersion, username);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/V1Service.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/V1Service.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/V1Service.java
new file mode 100644
index 0000000..9f8839c
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/V1Service.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.api.services;
+
+import javax.ws.rs.Path;
+
+/**
+ * Entry point for v1 API version
+ */
+@Path("/{apiVersion : v1}")
+public class V1Service extends AbstractVersionService {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/V2Service.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/V2Service.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/V2Service.java
new file mode 100644
index 0000000..b6ba06d
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/V2Service.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.api.services;
+
+import javax.ws.rs.Path;
+
+/**
+ * Entry point for v2 API version
+ */
+@Path("/{apiVersion : v2}")
+public class V2Service extends AbstractVersionService {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java
index b5b4a42..3bfdbc0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java
@@ -22,8 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
@@ -32,31 +30,50 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
  * Service responsible for validation of host-layout and configurations.
  */
-@Path("/stacks/{stackName}/versions/{stackVersion}/validations")
 public class ValidationService extends BaseService {
 
   /**
+   * Stack name.
+   */
+  private String m_stackName;
+
+  /**
+   * Stack version.
+   */
+  private String m_stackVersion;
+
+  /**
+   * Constructor.
+   *
+   * @param apiVersion API version
+   * @param stackName Stack name
+   * @param stackVersion Stack version
+   */
+  public ValidationService(final ApiVersion apiVersion, String stackName, String stackVersion) {
+    super(apiVersion);
+    this.m_stackName = stackName;
+    this.m_stackVersion = stackVersion;
+  }
+
+  /**
    * Returns validation of host-layout.
    * 
    * @param body http body
    * @param headers http headers
    * @param ui uri info
-   * @param stackName stack name
-   * @param stackVersion stack version
    * @return validation items if any
    */
   @POST
   @Produces(MediaType.TEXT_PLAIN)
-  public Response getValidation(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-      @PathParam("stackName") String stackName, @PathParam("stackVersion") String stackVersion) {
-
+  public Response getValidation(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
     return handleRequest(headers, body, ui, Request.Type.POST,
-        createValidationResource(stackName, stackVersion));
+        createValidationResource(m_stackName, m_stackVersion));
   }
 
   ResourceInstance createValidationResource(String stackName, String stackVersion) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java
index af1eb07..0573278 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java
@@ -35,15 +35,19 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.internal.VersionDefinitionResourceProvider;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.commons.codec.binary.Base64;
 
 import com.google.gson.JsonObject;
 
-@Path("/version_definitions/")
 public class VersionDefinitionService extends BaseService {
 
+  public VersionDefinitionService(ApiVersion apiVersion) {
+    super(apiVersion);
+  }
+
   @GET
   @Produces(MediaType.TEXT_PLAIN)
   public Response getServices(@Context HttpHeaders headers, @Context UriInfo ui) {
@@ -72,7 +76,7 @@ public class VersionDefinitionService extends BaseService {
   public OperatingSystemService getOperatingSystemsHandler(@PathParam("versionNumber") String versionNumber) {
     final Map<Resource.Type, String> mapIds = new HashMap<>();
     mapIds.put(Resource.Type.VersionDefinition, versionNumber);
-    return new OperatingSystemService(mapIds);
+    return new OperatingSystemService(m_apiVersion, mapIds);
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewDataMigrationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewDataMigrationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewDataMigrationService.java
index 2a9aa64..8303edf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewDataMigrationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewDataMigrationService.java
@@ -23,6 +23,7 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
 
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
 import org.apache.ambari.server.view.ViewDataMigrationUtility;
 import org.apache.ambari.server.view.ViewRegistry;
@@ -71,7 +72,8 @@ public class ViewDataMigrationService extends BaseService {
    * @param viewVersion    the current view version
    * @param instanceName   the current view instance name
    */
-  public ViewDataMigrationService(String viewName, String viewVersion, String instanceName) {
+  public ViewDataMigrationService(ApiVersion apiVersion, String viewName, String viewVersion, String instanceName) {
+    super(apiVersion);
     this.viewName = viewName;
     this.viewVersion = viewVersion;
     this.instanceName = instanceName;

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java
index 515d4ac..b301fd7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java
@@ -32,6 +32,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.orm.entities.ViewEntity;
 import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
@@ -69,7 +70,8 @@ public class ViewExternalSubResourceService  extends BaseService {
 
   // ----- Constructors ------------------------------------------------------
 
-  public ViewExternalSubResourceService(Resource.Type type, ViewInstanceEntity viewInstanceDefinition) {
+  public ViewExternalSubResourceService(ApiVersion apiVersion, Resource.Type type, ViewInstanceEntity viewInstanceDefinition) {
+    super(apiVersion);
     ViewEntity viewEntity = viewInstanceDefinition.getViewEntity();
 
     this.type         = type;

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java
index b10738d..2a3731e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
@@ -67,7 +68,8 @@ public class ViewInstanceService extends BaseService {
    * @param viewName  the view id
    * @param version   the version
    */
-  public ViewInstanceService(String viewName, String version) {
+  public ViewInstanceService(ApiVersion apiVersion, String viewName, String version) {
+    super(apiVersion);
     this.viewName = viewName;
     this.version = version;
 
@@ -238,13 +240,13 @@ public class ViewInstanceService extends BaseService {
 
     hasPermission(Request.Type.valueOf(request.getMethod()), instanceName);
 
-    return new ViewPrivilegeService(viewName, version, instanceName);
+    return new ViewPrivilegeService(m_apiVersion, viewName, version, instanceName);
   }
 
   @Path("{instanceName}/migrate")
   public ViewDataMigrationService migrateData(@Context javax.ws.rs.core.Request request,
                                               @PathParam ("instanceName") String instanceName) {
-    return new ViewDataMigrationService(viewName, version, instanceName);
+    return new ViewDataMigrationService(m_apiVersion, viewName, version, instanceName);
   }
   // ----- helper methods ----------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java
index 86bfa14..04bbdcc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java
@@ -34,6 +34,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 
@@ -61,7 +62,8 @@ public class ViewPermissionService extends BaseService {
    * @param viewName  the view id
    * @param version   the version
    */
-  public ViewPermissionService(String viewName, String version) {
+  public ViewPermissionService(ApiVersion apiVersion, String viewName, String version) {
+    super(apiVersion);
     this.viewName = viewName;
     this.version  = version;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java
index 34dd4c2..8e64388 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -33,7 +34,8 @@ public class ViewPrivilegeService extends PrivilegeService {
   private final String viewVersion;
   private final String instanceName;
 
-  public ViewPrivilegeService(String viewName, String viewVersion, String instanceName) {
+  public ViewPrivilegeService(ApiVersion apiVersion, String viewName, String viewVersion, String instanceName) {
+    super(apiVersion);
     this.viewName = viewName;
     this.viewVersion = viewVersion;
     this.instanceName = instanceName;

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewService.java
index 17a9f34..8e16fa6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewService.java
@@ -33,15 +33,19 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 
 /**
  * Service responsible for view resource requests.
  */
-@Path("/views/")
 public class ViewService extends BaseService {
 
+  public ViewService(ApiVersion apiVersion) {
+    super(apiVersion);
+  }
+
   /**
    * Handles: GET /views/{viewID}
    * Get a specific view.
@@ -142,7 +146,7 @@ public class ViewService extends BaseService {
    */
   @Path("{viewName}/versions")
   public ViewVersionService getInstanceHandler(@PathParam("viewName") String viewName) {
-    return new ViewVersionService(viewName);
+    return new ViewVersionService(m_apiVersion, viewName);
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java
index 6e00d10..2532a28 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java
@@ -26,6 +26,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.orm.entities.ViewEntity;
 import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
@@ -61,7 +62,8 @@ public class ViewSubResourceService extends BaseService implements ViewResourceH
   /**
    * Construct a view sub-resource service.
    */
-  public ViewSubResourceService(Resource.Type type, ViewInstanceEntity viewInstanceDefinition) {
+  public ViewSubResourceService(ApiVersion apiVersion, Resource.Type type, ViewInstanceEntity viewInstanceDefinition) {
+    super(apiVersion);
     ViewEntity viewEntity = viewInstanceDefinition.getViewEntity();
 
     this.type         = type;

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewUrlsService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewUrlsService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewUrlsService.java
index fa0be7d..8eaf496 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewUrlsService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewUrlsService.java
@@ -33,6 +33,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 
@@ -42,9 +43,12 @@ import com.google.common.base.Optional;
 /**
  * Service responsible for view resource requests.
  */
-@Path("/view/urls")
 public class ViewUrlsService extends BaseService {
 
+  public ViewUrlsService(ApiVersion apiVersion) {
+    super(apiVersion);
+  }
+
   /**
    * Get the list of all registered view URLs
    * @param headers

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java
index c10bf00..72b1d6e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java
@@ -34,6 +34,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 
@@ -55,7 +56,8 @@ public class ViewVersionService extends BaseService {
    *
    * @param viewName  the view name
    */
-  public ViewVersionService(String viewName) {
+  public ViewVersionService(ApiVersion apiVersion, String viewName) {
+    super(apiVersion);
     this.viewName = viewName;
   }
 
@@ -164,7 +166,7 @@ public class ViewVersionService extends BaseService {
   @Path("{version}/instances")
   public ViewInstanceService getInstanceHandler(@PathParam("version") String version) {
 
-    return new ViewInstanceService(viewName, version);
+    return new ViewInstanceService(m_apiVersion, viewName, version);
   }
 
   /**
@@ -177,7 +179,7 @@ public class ViewVersionService extends BaseService {
   @Path("{version}/permissions")
   public ViewPermissionService getPermissionHandler(@PathParam("version") String version) {
 
-    return new ViewPermissionService(viewName, version);
+    return new ViewPermissionService(m_apiVersion, viewName, version);
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
index 4886165..cccab69 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
@@ -33,6 +33,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -42,7 +43,8 @@ public class WidgetLayoutService extends BaseService {
   
   private final String clusterName;
 
-  public  WidgetLayoutService(String clusterName) {
+  public  WidgetLayoutService(ApiVersion apiVersion, String clusterName) {
+    super(apiVersion);
     this.clusterName = clusterName;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java
index e0fe801..1e7777b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java
@@ -33,6 +33,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -42,7 +43,8 @@ public class WidgetService extends BaseService {
 
   private final String clusterName;
 
-  public WidgetService(String clusterName) {
+  public WidgetService(ApiVersion apiVersion, String clusterName) {
+    super(apiVersion);
     this.clusterName = clusterName;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java
index abffedd..31faf96 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 
 /**
@@ -45,7 +46,8 @@ public class WorkflowService extends BaseService {
    * @param clusterName
    *          cluster id
    */
-  public WorkflowService(String clusterName) {
+  public WorkflowService(ApiVersion apiVersion, String clusterName) {
+    super(apiVersion);
     this.clusterName = clusterName;
   }
 
@@ -90,7 +92,7 @@ public class WorkflowService extends BaseService {
    */
   @Path("{workflowId}/jobs")
   public JobService getJobHandler(@PathParam("workflowId") String workflowId) {
-    return new JobService(clusterName, workflowId);
+    return new JobService(m_apiVersion, clusterName, workflowId);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java
index 05e7598..7ff2112 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java
@@ -31,6 +31,7 @@ import org.apache.ambari.server.api.services.stackadvisor.commands.Configuration
 import org.apache.ambari.server.api.services.stackadvisor.commands.StackAdvisorCommand;
 import org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse;
 import org.apache.ambari.server.api.services.stackadvisor.validations.ValidationResponse;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.configuration.Configuration;
 
 import com.google.inject.Inject;
@@ -82,10 +83,10 @@ public class StackAdvisorHelper {
       StackAdvisorRequestType requestType) throws StackAdvisorException {
     StackAdvisorCommand<ValidationResponse> command;
     if (requestType == StackAdvisorRequestType.HOST_GROUPS) {
-      command = new ComponentLayoutValidationCommand(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
+      command = new ComponentLayoutValidationCommand(ApiVersion.Default, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
           requestId, saRunner, metaInfo);
     } else if (requestType == StackAdvisorRequestType.CONFIGURATIONS) {
-      command = new ConfigurationValidationCommand(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
+      command = new ConfigurationValidationCommand(ApiVersion.Default, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
           requestId, saRunner, metaInfo);
     } else {
       throw new StackAdvisorRequestException(String.format("Unsupported request type, type=%s",
@@ -117,13 +118,13 @@ public class StackAdvisorHelper {
       StackAdvisorRequestType requestType) throws StackAdvisorException {
     StackAdvisorCommand<RecommendationResponse> command;
     if (requestType == StackAdvisorRequestType.HOST_GROUPS) {
-      command = new ComponentLayoutRecommendationCommand(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
+      command = new ComponentLayoutRecommendationCommand(ApiVersion.Default, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
           requestId, saRunner, metaInfo);
     } else if (requestType == StackAdvisorRequestType.CONFIGURATIONS) {
-      command = new ConfigurationRecommendationCommand(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
+      command = new ConfigurationRecommendationCommand(ApiVersion.Default, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
           requestId, saRunner, metaInfo);
     } else if (requestType == StackAdvisorRequestType.CONFIGURATION_DEPENDENCIES) {
-      command = new ConfigurationDependenciesRecommendationCommand(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
+      command = new ConfigurationDependenciesRecommendationCommand(ApiVersion.Default, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript,
           requestId, saRunner, metaInfo);
     } else {
       throw new StackAdvisorRequestException(String.format("Unsupported request type, type=%s",

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutRecommendationCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutRecommendationCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutRecommendationCommand.java
index 87725dc..35f7e0d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutRecommendationCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutRecommendationCommand.java
@@ -25,6 +25,7 @@ import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner;
 import org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse;
+import org.apache.ambari.server.api.util.ApiVersion;
 
 /**
  * {@link StackAdvisorCommand} implementation for component-layout
@@ -33,13 +34,13 @@ import org.apache.ambari.server.api.services.stackadvisor.recommendations.Recomm
 public class ComponentLayoutRecommendationCommand extends
     StackAdvisorCommand<RecommendationResponse> {
 
-  public ComponentLayoutRecommendationCommand(File recommendationsDir,
+  public ComponentLayoutRecommendationCommand(ApiVersion apiVersion, File recommendationsDir,
                                               String recommendationsArtifactsLifetime,
                                               String stackAdvisorScript,
                                               int requestId,
                                               StackAdvisorRunner saRunner,
                                               AmbariMetaInfo metaInfo) {
-    super(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
+    super(apiVersion, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutValidationCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutValidationCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutValidationCommand.java
index 310046f..b93cd81 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutValidationCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ComponentLayoutValidationCommand.java
@@ -25,15 +25,16 @@ import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner;
 import org.apache.ambari.server.api.services.stackadvisor.validations.ValidationResponse;
+import org.apache.ambari.server.api.util.ApiVersion;
 
 /**
  * {@link StackAdvisorCommand} implementation for component-layout validation.
  */
 public class ComponentLayoutValidationCommand extends StackAdvisorCommand<ValidationResponse> {
 
-  public ComponentLayoutValidationCommand(File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript,
+  public ComponentLayoutValidationCommand(ApiVersion apiVersion, File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript,
                                           int requestId, StackAdvisorRunner saRunner, AmbariMetaInfo metaInfo) {
-    super(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
+    super(apiVersion, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java
index 6a2adfa..b765689 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java
@@ -32,6 +32,7 @@ import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner;
 import org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse;
+import org.apache.ambari.server.api.util.ApiVersion;
 
 /**
  * {@link StackAdvisorCommand} implementation for
@@ -40,9 +41,9 @@ import org.apache.ambari.server.api.services.stackadvisor.recommendations.Recomm
 public class ConfigurationDependenciesRecommendationCommand extends
     StackAdvisorCommand<RecommendationResponse> {
 
-  public ConfigurationDependenciesRecommendationCommand(File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript, int requestId,
+  public ConfigurationDependenciesRecommendationCommand(ApiVersion apiVersion, File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript, int requestId,
                                                         StackAdvisorRunner saRunner, AmbariMetaInfo metaInfo) {
-    super(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
+    super(apiVersion, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java
index 6eaf19e..70b14fd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java
@@ -32,6 +32,7 @@ import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner;
 import org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse;
+import org.apache.ambari.server.api.util.ApiVersion;
 
 /**
  * {@link org.apache.ambari.server.api.services.stackadvisor.commands.StackAdvisorCommand} implementation for
@@ -40,9 +41,9 @@ import org.apache.ambari.server.api.services.stackadvisor.recommendations.Recomm
 public class ConfigurationRecommendationCommand extends
     StackAdvisorCommand<RecommendationResponse> {
 
-  public ConfigurationRecommendationCommand(File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript, int requestId,
+  public ConfigurationRecommendationCommand(ApiVersion apiVersion, File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript, int requestId,
                                             StackAdvisorRunner saRunner, AmbariMetaInfo metaInfo) {
-    super(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
+    super(apiVersion, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationValidationCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationValidationCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationValidationCommand.java
index 60132a1..a5717b9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationValidationCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationValidationCommand.java
@@ -25,15 +25,16 @@ import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner;
 import org.apache.ambari.server.api.services.stackadvisor.validations.ValidationResponse;
+import org.apache.ambari.server.api.util.ApiVersion;
 
 /**
  * {@link StackAdvisorCommand} implementation for configuration validation.
  */
 public class ConfigurationValidationCommand extends StackAdvisorCommand<ValidationResponse> {
 
-  public ConfigurationValidationCommand(File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript,
+  public ConfigurationValidationCommand(ApiVersion apiVersion, File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript,
                                         int requestId, StackAdvisorRunner saRunner, AmbariMetaInfo metaInfo) {
-    super(recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
+    super(apiVersion, recommendationsDir, recommendationsArtifactsLifetime, stackAdvisorScript, requestId, saRunner, metaInfo);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
index 74a2cf2..85fc13f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
@@ -45,6 +45,7 @@ import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorResponse;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.utils.DateUtils;
@@ -109,8 +110,9 @@ public abstract class StackAdvisorCommand<T extends StackAdvisorResponse> extend
   private final AmbariMetaInfo metaInfo;
 
   @SuppressWarnings("unchecked")
-  public StackAdvisorCommand(File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript, int requestId,
+  public StackAdvisorCommand(ApiVersion apiVersion, File recommendationsDir, String recommendationsArtifactsLifetime, String stackAdvisorScript, int requestId,
       StackAdvisorRunner saRunner, AmbariMetaInfo metaInfo) {
+    super(apiVersion);
     this.type = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass())
         .getActualTypeArguments()[0];
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/api/util/ApiVersion.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/util/ApiVersion.java b/ambari-server/src/main/java/org/apache/ambari/server/api/util/ApiVersion.java
new file mode 100644
index 0000000..f66f32e
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/util/ApiVersion.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.ambari.server.api.util;
+
+import java.util.EnumSet;
+
+public enum ApiVersion {
+  v1,
+  v2;
+
+  public static ApiVersion Default = v1;
+  public static EnumSet<ApiVersion> all = EnumSet.allOf(ApiVersion.class);
+  public static EnumSet<ApiVersion> v1Only = EnumSet.of(v1);
+  public static EnumSet<ApiVersion> v2Only = EnumSet.of(v2);
+  public static EnumSet<ApiVersion> v2Plus = EnumSet.complementOf(v1Only);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3dc9a0/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
index 96bab85..b6b481f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
@@ -29,6 +29,7 @@ import org.apache.ambari.server.actionmanager.ActionManager;
 import org.apache.ambari.server.agent.ExecutionCommand;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.api.services.LoggingService;
+import org.apache.ambari.server.api.util.ApiVersion;
 import org.apache.ambari.server.controller.internal.DeleteStatusMetaData;
 import org.apache.ambari.server.controller.internal.RequestStageContainer;
 import org.apache.ambari.server.controller.logging.LoggingSearchPropertyProvider;
@@ -878,11 +879,12 @@ public interface AmbariManagementController {
   /**
    * Gets the LoggingService instance from the dependency injection framework.
    *
+   * @param apiVersion API version
    * @param clusterName the cluster name associated with this LoggingService instance
    *
    * @return an instance of LoggingService associated with the specified cluster.
    */
-  LoggingService getLoggingService(String clusterName);
+  LoggingService getLoggingService(ApiVersion apiVersion, String clusterName);
 
 
   /**


Mime
View raw message