ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beny...@apache.org
Subject [02/17] ambari git commit: AMBARI-22380 : Add stack name and version to registry API (mradhakrishnan)
Date Tue, 14 Nov 2017 11:14:35 GMT
AMBARI-22380 : Add stack name and version to registry API (mradhakrishnan)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: b558eda2d45724c865914e3f49a2af16abe43f86
Parents: 5301b3f
Author: Madhuvanthi Radhakrishnan <mradhakrishnan@hortonworks.com>
Authored: Wed Nov 8 09:52:54 2017 -0800
Committer: Madhuvanthi Radhakrishnan <mradhakrishnan@hortonworks.com>
Committed: Wed Nov 8 09:52:54 2017 -0800

----------------------------------------------------------------------
 .../controller/RegistryMpackVersionResponse.java   | 14 +++++++++++++-
 .../RegistryMpackVersionResourceProvider.java      | 17 ++++++++++++++---
 .../server/registry/RegistryMpackVersion.java      |  7 +++++++
 .../registry/json/JsonRegistryMpackVersion.java    |  8 ++++++++
 4 files changed, 42 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b558eda2/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
index a0674ee..5929c4c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
@@ -33,6 +33,7 @@ public class RegistryMpackVersionResponse {
   private String mpackName;
   private String mpackVersion;
   private String mpackBuildNumber;
+  private String stackId;
   private String mpackUrl;
   private String mpackDocUrl;
   private List<? extends RegistryMpackService> mpackServices;
@@ -48,12 +49,13 @@ public class RegistryMpackVersionResponse {
    * @param mpackDocUrl       mpack documentation url
    * @param mpackServices     list of mpack services
    * @param compatibleMpacks  list of compatible mpacks
+   * @param stackId           stack id of the mpack version
    */
   public RegistryMpackVersionResponse(
     Long registryId, String mpackName, String mpackVersion, String mpackBuildNumber,
     String mpackUrl, String mpackDocUrl,
     List<? extends RegistryMpackService> mpackServices,
-    List<? extends RegistryMpackCompatiblity> compatibleMpacks) {
+    List<? extends RegistryMpackCompatiblity> compatibleMpacks, String stackId) {
     this.registryId = registryId;
     this.mpackName = mpackName;
     this.mpackVersion = mpackVersion;
@@ -62,6 +64,7 @@ public class RegistryMpackVersionResponse {
     this.mpackDocUrl = mpackDocUrl;
     this.mpackServices = mpackServices;
     this.compatibleMpacks = compatibleMpacks;
+    this.stackId = stackId;
   }
 
   public Long getRegistryId() {
@@ -96,6 +99,15 @@ public class RegistryMpackVersionResponse {
     return compatibleMpacks;
   }
 
+
+  public String getStackId() {
+    return stackId;
+  }
+
+  public void setStackId(String stackId) {
+    this.stackId = stackId;
+  }
+
   @Override
   public int hashCode() {
     int result = 1;

http://git-wip-us.apache.org/repos/asf/ambari/blob/b558eda2/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
index 3b8a3f5..9020146 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
@@ -65,6 +65,10 @@ public class RegistryMpackVersionResourceProvider extends AbstractControllerReso
   public static final String REGISTRY_MPACK_DOC_URL = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP
+ "mpack_doc_url";
   public static final String REGISTRY_MPACK_SERVICES = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP
+ "services";
   public static final String REGISTRY_MPACK_COMPATIBLE_MPACKS = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP
+ "compatible_mpacks";
+  public static final String REGISTRY_MPACK_STACK_NAME_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP
+ "stack_name";
+  public static final String REGISTRY_MPACK_STACK_VERSION_PROPERTY_ID =
+          RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "stack_version";
+
 
   private static Set<String> pkPropertyIds = new HashSet<>(
     Arrays.asList(REGISTRY_ID, REGISTRY_MPACK_NAME));
@@ -94,6 +98,9 @@ public class RegistryMpackVersionResourceProvider extends AbstractControllerReso
     PROPERTY_IDS.add(REGISTRY_MPACK_DOC_URL);
     PROPERTY_IDS.add(REGISTRY_MPACK_SERVICES);
     PROPERTY_IDS.add(REGISTRY_MPACK_COMPATIBLE_MPACKS);
+    PROPERTY_IDS.add(REGISTRY_MPACK_STACK_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(REGISTRY_MPACK_STACK_VERSION_PROPERTY_ID);
+
 
     // keys
     KEY_PROPERTY_IDS.put(Resource.Type.Registry, REGISTRY_ID);
@@ -156,7 +163,9 @@ public class RegistryMpackVersionResourceProvider extends AbstractControllerReso
       setResourceProperty(resource, REGISTRY_MPACK_URL, response.getMpackUrl(), requestedIds);
       setResourceProperty(resource, REGISTRY_MPACK_DOC_URL, response.getMpackDocUrl(), requestedIds);
       setResourceProperty(resource, REGISTRY_MPACK_SERVICES, response.getMpackServices(),
requestedIds);
-      setResourceProperty(resource, REGISTRY_MPACK_COMPATIBLE_MPACKS, response.getCompatibleMpacks(),
requestedIds);
+      String[] stackid = ((String) response.getStackId()).split("-");
+      setResourceProperty(resource, REGISTRY_MPACK_STACK_NAME_PROPERTY_ID, stackid[0], requestedIds);
+      setResourceProperty(resource, REGISTRY_MPACK_STACK_VERSION_PROPERTY_ID, stackid[1],
requestedIds);
       sortedResources.add(resource);
     }
     sortedResources.sort(new Comparator<Resource>() {
@@ -241,7 +250,8 @@ public class RegistryMpackVersionResourceProvider extends AbstractControllerReso
           registryMpackVersion.getMpackUrl(),
           registryMpackVersion.getMpackDocUrl(),
           registryMpackVersion.getMpackServices(),
-          registryMpackVersion.getCompatibleMpacks());
+          registryMpackVersion.getCompatibleMpacks(),
+          registryMpackVersion.getMpackStackId());
         responses.add(response);
       }
     } else {
@@ -255,7 +265,8 @@ public class RegistryMpackVersionResourceProvider extends AbstractControllerReso
           registryMpackVersion.getMpackUrl(),
           registryMpackVersion.getMpackDocUrl(),
           registryMpackVersion.getMpackServices(),
-          registryMpackVersion.getCompatibleMpacks());
+          registryMpackVersion.getCompatibleMpacks(),
+          registryMpackVersion.getMpackStackId());
         responses.add(response);
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b558eda2/ambari-server/src/main/java/org/apache/ambari/server/registry/RegistryMpackVersion.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/registry/RegistryMpackVersion.java
b/ambari-server/src/main/java/org/apache/ambari/server/registry/RegistryMpackVersion.java
index 4a4b780..ed7abc2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/registry/RegistryMpackVersion.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/registry/RegistryMpackVersion.java
@@ -47,6 +47,13 @@ public interface RegistryMpackVersion {
    */
   public String getMpackDocUrl();
 
+
+  /**
+   * Get mpack stack id
+   * @return
+   */
+  public String getMpackStackId();
+
   /**
    * Get list of services in the mpack version
    * @return

http://git-wip-us.apache.org/repos/asf/ambari/blob/b558eda2/ambari-server/src/main/java/org/apache/ambari/server/registry/json/JsonRegistryMpackVersion.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/registry/json/JsonRegistryMpackVersion.java
b/ambari-server/src/main/java/org/apache/ambari/server/registry/json/JsonRegistryMpackVersion.java
index 39ebf17..51aa0ca 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/registry/json/JsonRegistryMpackVersion.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/registry/json/JsonRegistryMpackVersion.java
@@ -42,6 +42,9 @@ public class JsonRegistryMpackVersion implements RegistryMpackVersion {
   @SerializedName("docUrl")
   private String docUrl;
 
+  @SerializedName("stack-id")
+  private String stackId;
+
   @SerializedName("services")
   private ArrayList<JsonRegistryMpackService> services;
 
@@ -77,4 +80,9 @@ public class JsonRegistryMpackVersion implements RegistryMpackVersion {
   public List<? extends RegistryMpackCompatiblity> getCompatibleMpacks() {
     return compatibleMpacks;
   }
+
+  @Override
+  public String getMpackStackId() {
+    return stackId;
+  }
 }


Mime
View raw message