You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mr...@apache.org on 2018/10/18 22:41:24 UTC
[ambari] 01/01: [AMBARI-24798] Add "maintainer" field to
StackService API (mradhakrishnan)
This is an automated email from the ASF dual-hosted git repository.
mradhakrishnan pushed a commit to branch AMBARI-24798
in repository https://gitbox.apache.org/repos/asf/ambari.git
commit 5fcb0cab0247159ebc42dc30e7ebdbbe1b1af3f2
Author: Madhuvanthi Radhakrishnan <mr...@hortonworks.com>
AuthorDate: Thu Oct 18 15:39:18 2018 -0700
[AMBARI-24798] Add "maintainer" field to StackService API (mradhakrishnan)
---
.../ambari/server/controller/StackServiceResponse.java | 7 +++++++
.../controller/internal/StackServiceResourceProvider.java | 7 +++++++
.../java/org/apache/ambari/server/stack/ServiceModule.java | 4 ++++
.../java/org/apache/ambari/server/state/ServiceInfo.java | 13 +++++++++++++
4 files changed, 31 insertions(+)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
index fda087a..6b579c6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
@@ -41,6 +41,7 @@ public class StackServiceResponse {
private String comments;
private String serviceVersion;
private ServiceInfo.Selection selection;
+ private String maintainer;
private boolean serviceCheckSupported;
private List<String> customCommands;
@@ -100,6 +101,7 @@ public class StackServiceResponse {
requiredServices = service.getRequiredServices();
serviceCheckSupported = null != service.getCommandScript();
selection = service.getSelection();
+ maintainer = service.getMaintainer();
// the custom command names defined at the service (not component) level
List<CustomCommandDefinition> definitions = service.getCustomCommands();
@@ -130,6 +132,11 @@ public class StackServiceResponse {
this.selection = selection;
}
+ @ApiModelProperty(name = "maintainer")
+ public String getMaintainer(){
+ return maintainer;
+ }
+
@ApiModelProperty(name = "stack_name")
public String getStackName() {
return stackName;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
index 7e07861..9395276 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
@@ -72,6 +72,9 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
private static final String SELECTION_PROPERTY_ID = PropertyHelper.getPropertyId(
"StackServices", "selection");
+ private static final String MAINTAINER_PROPERTY_ID = PropertyHelper.getPropertyId(
+ "StackServices", "maintainer");
+
private static final String VERSION_PROPERTY_ID = PropertyHelper.getPropertyId(
"StackServices", "service_version");
@@ -129,6 +132,7 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
USER_NAME_PROPERTY_ID,
COMMENTS_PROPERTY_ID,
SELECTION_PROPERTY_ID,
+ MAINTAINER_PROPERTY_ID,
VERSION_PROPERTY_ID,
CONFIG_TYPES,
REQUIRED_SERVICES_ID,
@@ -220,6 +224,9 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
setResourceProperty(resource, SELECTION_PROPERTY_ID,
response.getSelection(), requestedIds);
+ setResourceProperty(resource, MAINTAINER_PROPERTY_ID,
+ response.getMaintainer(), requestedIds);
+
setResourceProperty(resource, CONFIG_TYPES,
response.getConfigTypes(), requestedIds);
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
index b3d4b17..e9997b7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
@@ -300,6 +300,10 @@ public class ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implem
serviceInfo.setSelection(parent.getSelection());
}
+ if (serviceInfo.isMaintainerEmpty()) {
+ serviceInfo.setMaintainer(parent.getMaintainer());
+ }
+
if(null == serviceInfo.getSupportDeleteViaUIField()){
serviceInfo.setSupportDeleteViaUI(parent.isSupportDeleteViaUI());
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
index 59cee41..b8e1e94 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
@@ -77,6 +77,7 @@ public class ServiceInfo implements Validable {
private String comment;
private String serviceType;
private Selection selection;
+ private String maintainer;
/**
* Default to Python if not specified.
@@ -426,6 +427,18 @@ public class ServiceInfo implements Validable {
return selection == null;
}
+ public String getMaintainer() {
+ return maintainer;
+ }
+
+ public void setMaintainer(String maintainer) {
+ this.maintainer = maintainer;
+ }
+
+ public boolean isMaintainerEmpty() {
+ return maintainer == null;
+ }
+
public String getComment() {
return comment;
}