Repository: ambari Updated Branches: refs/heads/trunk 04f6da277 -> 4388baf10
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/4388baf1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4388baf1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4388baf1 Branch: refs/heads/trunk Commit: 4388baf10b97866bd18991db1d87be1cbf0b915c Parents: 04f6da2 Author: Gaurav Nagar <[email protected]> Authored: Fri Jan 6 13:04:50 2017 +0530 Committer: Gaurav Nagar <[email protected]> Committed: Fri Jan 6 13:05:24 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/4388baf1/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/4388baf1/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/4388baf1/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/4388baf1/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(); } }
