Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 9168b1afd -> 5ea887d68


AMBARI-17684. Minor refactoring and java doc for code introduced in 
AMBARI-17317. (dipayanb)


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

Branch: refs/heads/branch-2.4
Commit: 5ea887d685e29f749cdfc4c000a7a88b35abca87
Parents: 9168b1a
Author: Dipayan Bhowmick <[email protected]>
Authored: Wed Jul 13 12:56:36 2016 +0530
Committer: Dipayan Bhowmick <[email protected]>
Committed: Thu Jul 14 11:18:50 2016 +0530

----------------------------------------------------------------------
 .../ambari/server/upgrade/AbstractUpgradeCatalog.java | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5ea887d6/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
index 64e1c75..b958f3a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
@@ -917,7 +917,7 @@ public abstract class AbstractUpgradeCatalog implements 
UpgradeCatalog {
             Config tezSite = cluster.getDesiredConfigByType("tez-site");
             if (tezSite != null) {
               String currentTezHistoryUrlBase = 
tezSite.getProperties().get("tez.tez-ui.history-url.base");
-              if(currentTezHistoryUrlBase != null && 
!currentTezHistoryUrlBase.isEmpty()) {
+              if (!StringUtils.isEmpty(currentTezHistoryUrlBase)) {
                 String newTezHistoryUrlBase = 
getUpdatedTezHistoryUrlBase(currentTezHistoryUrlBase);
                 updateConfigurationProperties("tez-site", 
Collections.singletonMap("tez.tez-ui.history-url.base", newTezHistoryUrlBase), 
true, false);
               }
@@ -928,6 +928,12 @@ public abstract class AbstractUpgradeCatalog implements 
UpgradeCatalog {
     }
   }
 
+  /**
+   * Transforms the existing tez history url base to the new url considering 
the latest tez view version.
+   * @param currentTezHistoryUrlBase Existing value of the tez history url base
+   * @return the updated tez history url base
+   * @throws AmbariException if currentTezHistoryUrlBase is malformed or is 
not compatible with the Tez View url REGEX
+     */
   protected String getUpdatedTezHistoryUrlBase(String 
currentTezHistoryUrlBase) throws AmbariException{
     String pattern = "(.*\\/TEZ\\/)(.*)(\\/TEZ_CLUSTER_INSTANCE)";
     Pattern regex = Pattern.compile(pattern);
@@ -948,6 +954,12 @@ public abstract class AbstractUpgradeCatalog implements 
UpgradeCatalog {
     return prefix + latestTezViewVersion + suffix;
   }
 
+  /**
+   * Given the old configured version, this method tries to get the new 
version of tez view by reading the tez-view jar.
+   * Assumption - only a single tez-view jar will be present in the views 
directory.
+   * @param oldVersion It is returned if there is a failure in finding the new 
version
+   * @return newVersion of the tez view. Returns oldVersion if there error 
encountered if finding the new version number.
+   */
   protected String getLatestTezViewVersion(String oldVersion) {
     File viewsDirectory = configuration.getViewsDir();
     File[] files = viewsDirectory.listFiles(new FilenameFilter() {

Reply via email to