Repository: ambari Updated Branches: refs/heads/branch-2.5 d6affb415 -> 497b51398
AMBARI-19382. ATS service check failed on navigating to Hive View.(gauravn7) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/497b5139 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/497b5139 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/497b5139 Branch: refs/heads/branch-2.5 Commit: 497b51398976a211f50ea34b9041c93ae510d125 Parents: d6affb4 Author: Gaurav Nagar <[email protected]> Authored: Fri Jan 6 13:04:50 2017 +0530 Committer: Gaurav Nagar <[email protected]> Committed: Fri Jan 6 13:04:50 2017 +0530 ---------------------------------------------------------------------- .../java/org/apache/ambari/view/hive2/HelpService.java | 2 +- .../hive2/resources/jobs/atsJobs/ATSParserFactory.java | 13 +++++++------ .../org/apache/ambari/view/hive20/HelpService.java | 2 +- .../resources/jobs/atsJobs/ATSParserFactory.java | 9 ++++++--- 4 files changed, 15 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/497b5139/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/HelpService.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/HelpService.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/HelpService.java index 702b38a..afc2939 100644 --- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/HelpService.java +++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/HelpService.java @@ -100,7 +100,7 @@ public class HelpService extends BaseService { @Produces(MediaType.APPLICATION_JSON) public Response atsStatus() { try { - ATSRequestsDelegateImpl atsimpl = new ATSRequestsDelegateImpl(context, ATSParserFactory.getATSUrl(context)); + ATSRequestsDelegateImpl atsimpl = new ATSRequestsDelegateImpl(context, new ATSParserFactory(context).getATSUrl()); atsimpl.checkATSStatus(); return getOKResponse(); }catch (IOException e){ http://git-wip-us.apache.org/repos/asf/ambari/blob/497b5139/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/atsJobs/ATSParserFactory.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/atsJobs/ATSParserFactory.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/atsJobs/ATSParserFactory.java index 4ff2621..086e130 100644 --- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/atsJobs/ATSParserFactory.java +++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/atsJobs/ATSParserFactory.java @@ -19,24 +19,25 @@ package org.apache.ambari.view.hive2.resources.jobs.atsJobs; import org.apache.ambari.view.ViewContext; +import org.apache.ambari.view.utils.ambari.AmbariApi; -import java.util.HashMap; -import java.util.Map; public class ATSParserFactory { private ViewContext context; + private final AmbariApi ambariApi; public ATSParserFactory(ViewContext context) { this.context = context; + this.ambariApi = new AmbariApi(context); } public ATSParser getATSParser() { - ATSRequestsDelegateImpl delegate = new ATSRequestsDelegateImpl(context, getATSUrl(context)); + ATSRequestsDelegateImpl delegate = new ATSRequestsDelegateImpl(context, getATSUrl()); return new ATSParser(delegate); } - public static String getATSUrl(ViewContext context) { - return context.getProperties().get("yarn.ats.url"); + public String getATSUrl() { + return ambariApi.getServices().getTimelineServerUrl(); } -} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/497b5139/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HelpService.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HelpService.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HelpService.java index 9aaaafe..d846a9d 100644 --- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HelpService.java +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/HelpService.java @@ -100,7 +100,7 @@ public class HelpService extends BaseService { @Produces(MediaType.APPLICATION_JSON) public Response atsStatus() { try { - ATSRequestsDelegateImpl atsimpl = new ATSRequestsDelegateImpl(context, ATSParserFactory.getATSUrl(context)); + ATSRequestsDelegateImpl atsimpl = new ATSRequestsDelegateImpl(context, new ATSParserFactory(context).getATSUrl()); atsimpl.checkATSStatus(); return getOKResponse(); }catch (IOException e){ http://git-wip-us.apache.org/repos/asf/ambari/blob/497b5139/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/atsJobs/ATSParserFactory.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/atsJobs/ATSParserFactory.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/atsJobs/ATSParserFactory.java index 343202e..4208775 100644 --- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/atsJobs/ATSParserFactory.java +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/jobs/atsJobs/ATSParserFactory.java @@ -19,21 +19,24 @@ package org.apache.ambari.view.hive20.resources.jobs.atsJobs; import org.apache.ambari.view.ViewContext; +import org.apache.ambari.view.utils.ambari.AmbariApi; public class ATSParserFactory { private ViewContext context; + private final AmbariApi ambariApi; public ATSParserFactory(ViewContext context) { this.context = context; + this.ambariApi = new AmbariApi(context); } public ATSParser getATSParser() { - ATSRequestsDelegateImpl delegate = new ATSRequestsDelegateImpl(context, getATSUrl(context)); + ATSRequestsDelegateImpl delegate = new ATSRequestsDelegateImpl(context, getATSUrl()); return new ATSParser(delegate); } - public static String getATSUrl(ViewContext context) { - return context.getProperties().get("yarn.ats.url"); + public String getATSUrl() { + return ambariApi.getServices().getTimelineServerUrl(); } }
