You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by db...@apache.org on 2016/06/03 03:19:49 UTC

ambari git commit: AMBARI-17009 Removed Dead code from hive view jdbc implementation.(Ashwin Rajeev via dipayanb)

Repository: ambari
Updated Branches:
  refs/heads/trunk b8c1cb699 -> e663b5cf4


AMBARI-17009  Removed Dead code from hive view jdbc implementation.(Ashwin Rajeev via dipayanb)


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

Branch: refs/heads/trunk
Commit: e663b5cf40dd88c0ba47df922fd7dc71083c3bfa
Parents: b8c1cb6
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Fri Jun 3 08:49:28 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Fri Jun 3 08:49:28 2016 +0530

----------------------------------------------------------------------
 .../view/hive2/resources/jobs/Aggregator.java   |  38 +----
 .../hive2/resources/jobs/FileResourceShort.java |  55 --------
 .../jobs/IOperationHandleResourceManager.java   |  39 ------
 .../view/hive2/resources/jobs/JobService.java   |  10 +-
 .../view/hive2/resources/jobs/LogParser.java    | 139 ------------------
 .../jobs/OperationHandleResourceManager.java    | 110 ---------------
 .../resources/jobs/StoredOperationHandle.java   | 140 -------------------
 .../view/hive2/resources/jobs/viewJobs/Job.java |  16 +--
 .../resources/jobs/viewJobs/JobController.java  |  10 --
 .../jobs/viewJobs/JobControllerFactory.java     |   1 -
 .../jobs/viewJobs/JobControllerImpl.java        |  90 +-----------
 11 files changed, 15 insertions(+), 633 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/Aggregator.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/Aggregator.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/Aggregator.java
index 0f6a938..e7553dd 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/Aggregator.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/Aggregator.java
@@ -21,7 +21,6 @@ package org.apache.ambari.view.hive2.resources.jobs;
 import org.apache.ambari.view.hive2.persistence.utils.FilteringStrategy;
 import org.apache.ambari.view.hive2.persistence.utils.Indexed;
 import org.apache.ambari.view.hive2.persistence.utils.ItemNotFound;
-import org.apache.ambari.view.hive2.persistence.utils.OnlyOwnersFilteringStrategy;
 import org.apache.ambari.view.hive2.resources.IResourceManager;
 import org.apache.ambari.view.hive2.resources.files.FileService;
 import org.apache.ambari.view.hive2.resources.jobs.atsJobs.HiveQueryId;
@@ -63,21 +62,18 @@ public class Aggregator {
     LoggerFactory.getLogger(Aggregator.class);
 
   private final IATSParser ats;
-  private final IOperationHandleResourceManager operationHandleResourceManager;
   private IResourceManager<Job> viewJobResourceManager;
 
   public Aggregator(IResourceManager<Job> jobResourceManager,
-                    IOperationHandleResourceManager operationHandleResourceManager,
                     IATSParser ats) {
     this.viewJobResourceManager = jobResourceManager;
-    this.operationHandleResourceManager = operationHandleResourceManager;
     this.ats = ats;
   }
 
   public List<Job> readAll(String username) {
-    Set<String> addedOperationIds = new HashSet<String>();
+    Set<String> addedOperationIds = new HashSet<>();
 
-    List<Job> allJobs = new LinkedList<Job>();
+    List<Job> allJobs = new LinkedList<>();
     for (HiveQueryId atsHiveQuery : ats.getHiveQueryIdsList(username)) {
 
       TezDagId atsTezDag = getTezDagFromHiveQueryId(atsHiveQuery);
@@ -101,22 +97,6 @@ public class Aggregator {
       addedOperationIds.add(atsHiveQuery.operationId);
     }
 
-    //cover case when operationId is present, but not exists in ATS
-    //e.g. optimized queries without executing jobs, like "SELECT * FROM TABLE"
-    for (Job job : viewJobResourceManager.readAll(new OnlyOwnersFilteringStrategy(username))) {
-      List<StoredOperationHandle> operationHandles = operationHandleResourceManager.readJobRelatedHandles(job);
-      assert operationHandles.size() <= 1;
-
-      if (operationHandles.size() > 0) {
-        StoredOperationHandle operationHandle = operationHandles.get(0);
-
-        if (!addedOperationIds.contains(hexStringToUrlSafeBase64(operationHandle.getGuid()))) {
-          //e.g. query without hadoop job: select * from table
-          allJobs.add(job);
-        }
-      }
-    }
-
     return allJobs;
   }
 
@@ -219,10 +199,10 @@ public class Aggregator {
   }
 
   protected Job getJobByOperationId(final String opId) throws ItemNotFound {
-    List<StoredOperationHandle> operationHandles = operationHandleResourceManager.readAll(new FilteringStrategy() {
+    List<Job> operationHandles = viewJobResourceManager.readAll(new FilteringStrategy() {
       @Override
       public boolean isConform(Indexed item) {
-        StoredOperationHandle opHandle = (StoredOperationHandle) item;
+        Job opHandle = (Job) item;
         return opHandle.getGuid().equals(opId);
       }
 
@@ -235,7 +215,7 @@ public class Aggregator {
     if (operationHandles.size() != 1)
       throw new ItemNotFound();
 
-    return viewJobResourceManager.read(operationHandles.get(0).getJobId());
+    return viewJobResourceManager.read(operationHandles.get(0).getId());
   }
 
   protected static String urlSafeBase64ToHexString(String urlsafeBase64) {
@@ -248,12 +228,4 @@ public class Aggregator {
     return sb.toString();
   }
 
-  protected static String hexStringToUrlSafeBase64(String hexString) {
-    byte[] decoded = new byte[hexString.length() / 2];
-
-    for (int i = 0; i < hexString.length(); i += 2) {
-      decoded[i / 2] = (byte) Integer.parseInt(String.format("%c%c", hexString.charAt(i), hexString.charAt(i + 1)), 16);
-    }
-    return Base64.encodeBase64URLSafeString(decoded);
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/FileResourceShort.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/FileResourceShort.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/FileResourceShort.java
deleted file mode 100644
index 7a47a40..0000000
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/FileResourceShort.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.view.hive2.resources.jobs;
-
-import org.apache.commons.beanutils.BeanUtils;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-public class FileResourceShort {
-  public FileResourceShort() {}
-  public FileResourceShort(Map<String, Object> stringObjectMap) throws InvocationTargetException, IllegalAccessException {
-    BeanUtils.populate(this, stringObjectMap);
-  }
-
-  private Integer id;
-  private String path;
-
-  public FileResourceShort(Integer id, String path) {
-    this.id = id;
-    this.path = path;
-  }
-
-  public Integer getId() {
-    return id;
-  }
-
-  public void setId(Integer id) {
-    this.id = id;
-  }
-
-  public String getPath() {
-    return path;
-  }
-
-  public void setPath(String path) {
-    this.path = path;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/IOperationHandleResourceManager.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/IOperationHandleResourceManager.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/IOperationHandleResourceManager.java
deleted file mode 100644
index 8b8f6a2..0000000
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/IOperationHandleResourceManager.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.view.hive2.resources.jobs;
-
-import org.apache.ambari.view.hive2.persistence.utils.ItemNotFound;
-import org.apache.ambari.view.hive2.resources.IResourceManager;
-import org.apache.ambari.view.hive2.resources.jobs.viewJobs.Job;
-
-import java.util.List;
-
-public interface IOperationHandleResourceManager extends IResourceManager<StoredOperationHandle> {
-  List<StoredOperationHandle> readJobRelatedHandles(Job job);
-
-  List<Job> getHandleRelatedJobs(StoredOperationHandle operationHandle);
-
-  Job getJobByHandle(StoredOperationHandle handle) throws ItemNotFound;
-
-  //void putHandleForJob(TOperationHandle h, ExecuteJob job);
-
-  boolean containsHandleForJob(Job job);
-
-  StoredOperationHandle getHandleForJob(Job job) throws ItemNotFound;
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/JobService.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/JobService.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/JobService.java
index d94057a..4fa7f2a 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/JobService.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/JobService.java
@@ -93,8 +93,6 @@ public class JobService extends BaseService {
   ViewResourceHandler handler;
 
   private JobResourceManager resourceManager;
-  private IOperationHandleResourceManager opHandleResourceManager;
-  //private UserLocalConnection connectionLocal = new UserLocalConnection();
 
   protected final static Logger LOG =
       LoggerFactory.getLogger(JobService.class);
@@ -108,17 +106,11 @@ public class JobService extends BaseService {
     return resourceManager;
   }
 
-  protected IOperationHandleResourceManager getOperationHandleResourceManager() {
-    if (opHandleResourceManager == null) {
-      opHandleResourceManager = new OperationHandleResourceManager(getSharedObjectsFactory());
-    }
-    return opHandleResourceManager;
-  }
 
   protected Aggregator getAggregator() {
     if (aggregator == null) {
       IATSParser atsParser = getSharedObjectsFactory().getATSParser();
-      aggregator = new Aggregator(getResourceManager(), getOperationHandleResourceManager(), atsParser);
+      aggregator = new Aggregator(getResourceManager(), atsParser);
     }
     return aggregator;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/LogParser.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/LogParser.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/LogParser.java
deleted file mode 100644
index 70a736f..0000000
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/LogParser.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.view.hive2.resources.jobs;
-
-import java.util.LinkedHashSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class LogParser {
-  public static final Pattern HADOOP_MR_APPS_RE = Pattern.compile("(http[^\\s]*/proxy/([a-z0-9_]+?)/)");
-  public static final Pattern HADOOP_TEZ_APPS_RE = Pattern.compile("\\(Executing on YARN cluster with App id ([a-z0-9_]+?)\\)");
-  private LinkedHashSet<AppId> appsList;
-
-  private LogParser() {}
-
-  public static LogParser parseLog(String logs) {
-    LogParser parser = new LogParser();
-
-    parser.setAppsList(parseApps(logs, parser));
-    return parser;
-  }
-
-  public static LinkedHashSet<AppId> parseApps(String logs, LogParser parser) {
-    LinkedHashSet<AppId> mrAppIds = getMRAppIds(logs);
-    LinkedHashSet<AppId> tezAppIds = getTezAppIds(logs);
-
-    LinkedHashSet<AppId> appIds = new LinkedHashSet<AppId>();
-    appIds.addAll(mrAppIds);
-    appIds.addAll(tezAppIds);
-
-    return appIds;
-  }
-
-  private static LinkedHashSet<AppId> getMRAppIds(String logs) {
-    Matcher m = HADOOP_MR_APPS_RE.matcher(logs);
-    LinkedHashSet<AppId> list = new LinkedHashSet<AppId>();
-    while (m.find()) {
-      AppId applicationInfo = new AppId();
-      applicationInfo.setTrackingUrl(m.group(1));
-      applicationInfo.setIdentifier(m.group(2));
-      list.add(applicationInfo);
-    }
-    return list;
-  }
-
-  private static LinkedHashSet<AppId> getTezAppIds(String logs) {
-    Matcher m = HADOOP_TEZ_APPS_RE.matcher(logs);
-    LinkedHashSet<AppId> list = new LinkedHashSet<AppId>();
-    while (m.find()) {
-      AppId applicationInfo = new AppId();
-      applicationInfo.setTrackingUrl("");
-      applicationInfo.setIdentifier(m.group(1));
-      list.add(applicationInfo);
-    }
-    return list;
-  }
-
-  public void setAppsList(LinkedHashSet<AppId> appsList) {
-    this.appsList = appsList;
-  }
-
-  public LinkedHashSet<AppId> getAppsList() {
-    return appsList;
-  }
-
-  public AppId getLastAppInList() {
-    Object[] appIds = appsList.toArray();
-    if (appIds.length == 0) {
-      return null;
-    }
-    return (AppId) appIds[appsList.size()-1];
-  }
-
-  public static class AppId {
-    private String trackingUrl;
-    private String identifier;
-
-    public String getTrackingUrl() {
-      return trackingUrl;
-    }
-
-    public void setTrackingUrl(String trackingUrl) {
-      this.trackingUrl = trackingUrl;
-    }
-
-    public String getIdentifier() {
-      return identifier;
-    }
-
-    public void setIdentifier(String identifier) {
-      this.identifier = identifier;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (this == o) return true;
-      if (!(o instanceof AppId)) return false;
-
-      AppId appId = (AppId) o;
-
-      if (!identifier.equals(appId.identifier)) return false;
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      return identifier.hashCode();
-    }
-  }
-
-  public static class EmptyAppId extends AppId {
-    @Override
-    public String getTrackingUrl() {
-      return "";
-    }
-
-    @Override
-    public String getIdentifier() {
-      return "";
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/OperationHandleResourceManager.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/OperationHandleResourceManager.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/OperationHandleResourceManager.java
deleted file mode 100644
index 93c4f0a..0000000
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/OperationHandleResourceManager.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.view.hive2.resources.jobs;
-
-import org.apache.ambari.view.hive2.persistence.IStorageFactory;
-import org.apache.ambari.view.hive2.persistence.utils.FilteringStrategy;
-import org.apache.ambari.view.hive2.persistence.utils.Indexed;
-import org.apache.ambari.view.hive2.persistence.utils.ItemNotFound;
-import org.apache.ambari.view.hive2.resources.SharedCRUDResourceManager;
-import org.apache.ambari.view.hive2.resources.jobs.viewJobs.Job;
-
-import java.util.List;
-
-public class OperationHandleResourceManager extends SharedCRUDResourceManager<StoredOperationHandle>
-    implements IOperationHandleResourceManager {
-  /**
-   * Constructor
-   */
-  public OperationHandleResourceManager(IStorageFactory storageFabric) {
-    super(StoredOperationHandle.class, storageFabric);
-  }
-
-  @Override
-  public List<StoredOperationHandle> readJobRelatedHandles(final Job job) {
-    return storageFactory.getStorage().loadAll(StoredOperationHandle.class, new FilteringStrategy() {
-      @Override
-      public boolean isConform(Indexed item) {
-        StoredOperationHandle handle = (StoredOperationHandle) item;
-        return (handle.getJobId() != null && handle.getJobId().equals(job.getId()));
-      }
-
-      @Override
-      public String whereStatement() {
-        return "jobId = '" + job.getId() + "'";
-      }
-    });
-  }
-
-  @Override
-  public StoredOperationHandle getHandleForJob(Job job) throws ItemNotFound {
-    List<StoredOperationHandle> jobRelatedHandles = readJobRelatedHandles(job);
-    if (jobRelatedHandles.size() == 0)
-      throw new ItemNotFound();
-    return jobRelatedHandles.get(0);
-  }
-
-  @Override
-  public List<Job> getHandleRelatedJobs(final StoredOperationHandle operationHandle) {
-    return storageFactory.getStorage().loadAll(Job.class, new FilteringStrategy() {
-      @Override
-      public boolean isConform(Indexed item) {
-        Job job = (Job) item;
-        return (job.getId() != null && job.getId().equals(operationHandle.getJobId()));
-      }
-
-      @Override
-      public String whereStatement() {
-        return "id = '" + operationHandle.getJobId() + "'";
-      }
-    });
-  }
-
-  @Override
-  public Job getJobByHandle(StoredOperationHandle handle) throws ItemNotFound {
-    List<Job> handleRelatedJobs = getHandleRelatedJobs(handle);
-    if (handleRelatedJobs.size() == 0)
-      throw new ItemNotFound();
-    return handleRelatedJobs.get(0);
-  }
-
-  /*@Override
-  public void putHandleForJob(TOperationHandle h, ExecuteJob job) {
-    StoredOperationHandle handle = StoredOperationHandle.buildFromTOperationHandle(h);
-    handle.setJobId(job.getId());
-
-    List<StoredOperationHandle> jobRelatedHandles = readJobRelatedHandles(job);
-    if (jobRelatedHandles.size() > 0) {
-      handle.setId(jobRelatedHandles.get(0).getId());  // update existing
-      try {
-        update(handle, jobRelatedHandles.get(0).getId());
-      } catch (ItemNotFound itemNotFound) {
-        throw new ServiceFormattedException("E050 Error when updating operation handle: " + itemNotFound.toString(), itemNotFound);
-      }
-    } else {
-      create(handle);
-    }
-  }*/
-
-  @Override
-  public boolean containsHandleForJob(Job job) {
-    List<StoredOperationHandle> jobRelatedHandles = readJobRelatedHandles(job);
-    return jobRelatedHandles.size() > 0;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/StoredOperationHandle.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/StoredOperationHandle.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/StoredOperationHandle.java
deleted file mode 100644
index 68f2487..0000000
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/StoredOperationHandle.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.view.hive2.resources.jobs;
-
-import org.apache.ambari.view.hive2.persistence.utils.Indexed;
-import org.apache.commons.beanutils.PropertyUtils;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-/**
- * Bean to represent TOperationHandle stored in DB
- */
-public class StoredOperationHandle implements Indexed {
-  private boolean hasResultSet;
-  private double modifiedRowCount;
-  private int operationType;
-  private String guid;
-  private String secret;
-
-  private String jobId;
-
-  private String id;
-
-  public StoredOperationHandle() {}
-  public StoredOperationHandle(Map<String, Object> stringObjectMap) throws InvocationTargetException, IllegalAccessException {
-    for (Map.Entry<String, Object> entry : stringObjectMap.entrySet())  {
-      try {
-        PropertyUtils.setProperty(this, entry.getKey(), entry.getValue());
-      } catch (NoSuchMethodException e) {
-        //do nothing, skip
-      }
-    }
-  }
-
-
-  /*public static StoredOperationHandle buildFromTOperationHandle(TOperationHandle handle) {
-    StoredOperationHandle storedHandle = new StoredOperationHandle();
-    //bool hasResultSet
-    storedHandle.setHasResultSet(handle.isHasResultSet());
-    //optional double modifiedRowCount
-    storedHandle.setModifiedRowCount(handle.getModifiedRowCount());
-    //TOperationType operationType
-    storedHandle.setOperationType(handle.getOperationType().getValue());
-    //THandleIdentifier operationId
-    storedHandle.setGuid(Hex.encodeHexString(handle.getOperationId().getGuid()));
-    storedHandle.setSecret(Hex.encodeHexString(handle.getOperationId().getSecret()));
-    return storedHandle;
-  }*/
-
-  /*public TOperationHandle toTOperationHandle() {
-    TOperationHandle handle = new TOperationHandle();
-    handle.setHasResultSet(isHasResultSet());
-    handle.setModifiedRowCount(getModifiedRowCount());
-    handle.setOperationType(TOperationType.findByValue(getOperationType()));
-    THandleIdentifier identifier = new THandleIdentifier();
-    try {
-      identifier.setGuid(Hex.decodeHex(getGuid().toCharArray()));
-      identifier.setSecret(Hex.decodeHex(getSecret().toCharArray()));
-    } catch (DecoderException e) {
-      throw new ServiceFormattedException("E060 Wrong identifier of OperationHandle is stored in DB");
-    }
-    handle.setOperationId(identifier);
-    return handle;
-  }*/
-
-  public boolean isHasResultSet() {
-    return hasResultSet;
-  }
-
-  public void setHasResultSet(boolean hasResultSet) {
-    this.hasResultSet = hasResultSet;
-  }
-
-  public double getModifiedRowCount() {
-    return modifiedRowCount;
-  }
-
-  public void setModifiedRowCount(double modifiedRowCount) {
-    this.modifiedRowCount = modifiedRowCount;
-  }
-
-  public int getOperationType() {
-    return operationType;
-  }
-
-  public void setOperationType(int operationType) {
-    this.operationType = operationType;
-  }
-
-  public String getGuid() {
-    return guid;
-  }
-
-  public void setGuid(String guid) {
-    this.guid = guid;
-  }
-
-  public String getSecret() {
-    return secret;
-  }
-
-  public void setSecret(String secret) {
-    this.secret = secret;
-  }
-
-  public String getJobId() {
-    return jobId;
-  }
-
-  public void setJobId(String jobId) {
-    this.jobId = jobId;
-  }
-
-  @Override
-  public String getId() {
-    return id;
-  }
-
-  @Override
-  public void setId(String id) {
-    this.id = id;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/Job.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/Job.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/Job.java
index 2caba5e..816e77a 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/Job.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/Job.java
@@ -28,14 +28,14 @@ import java.io.Serializable;
  * Interface for ExecuteJob bean to create Proxy for it
  */
 public interface Job extends Serializable,Indexed,PersonalResource {
-  public static final String JOB_STATE_UNKNOWN = "UNKNOWN";
-  public static final String JOB_STATE_INITIALIZED = "INITIALIZED";
-  public static final String JOB_STATE_RUNNING = "RUNNING";
-  public static final String JOB_STATE_FINISHED = "SUCCEEDED";
-  public static final String JOB_STATE_CANCELED = "CANCELED";
-  public static final String JOB_STATE_CLOSED = "CLOSED";
-  public static final String JOB_STATE_ERROR = "ERROR";
-  public static final String JOB_STATE_PENDING = "PENDING";
+  String JOB_STATE_UNKNOWN = "UNKNOWN";
+  String JOB_STATE_INITIALIZED = "INITIALIZED";
+  String JOB_STATE_RUNNING = "RUNNING";
+  String JOB_STATE_FINISHED = "SUCCEEDED";
+  String JOB_STATE_CANCELED = "CANCELED";
+  String JOB_STATE_CLOSED = "CLOSED";
+  String JOB_STATE_ERROR = "ERROR";
+  String JOB_STATE_PENDING = "PENDING";
 
   String getId();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobController.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobController.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobController.java
index 8cc120b..46a87d9 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobController.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobController.java
@@ -22,10 +22,6 @@ import org.apache.ambari.view.hive2.persistence.utils.ItemNotFound;
 
 public interface JobController {
 
-  //OperationHandleController.OperationStatus getStatus() throws ItemNotFound, HiveClientException, NoOperationStatusSetException;
-
-  //TODO: New implementation
-
   void submit() throws Throwable;
 
   void cancel() throws ItemNotFound;
@@ -38,12 +34,6 @@ public interface JobController {
    */
   Job getJobPOJO();
 
-  //Cursor getResults() throws ItemNotFound;
-
-  //TODO: New implementation
-
-  boolean hasResults() throws ItemNotFound;
-
   void afterCreation();
 
   void update();

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerFactory.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerFactory.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerFactory.java
index 45c7379..8428a87 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerFactory.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerFactory.java
@@ -33,7 +33,6 @@ public class JobControllerFactory implements IJobControllerFactory {
   @Override
   public JobController createControllerForJob(Job job) {
     return new JobControllerImpl(context, job,
-        //sharedObjectsFactory.getOperationHandleControllerFactory(),
         sharedObjectsFactory.getSavedQueryResourceManager(),
         sharedObjectsFactory.getATSParser(),
         sharedObjectsFactory.getHdfsApi());

http://git-wip-us.apache.org/repos/asf/ambari/blob/e663b5cf/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerImpl.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerImpl.java
index 31b531b..a3edc8f 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerImpl.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/jobs/viewJobs/JobControllerImpl.java
@@ -22,7 +22,6 @@ import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.hive2.client.AsyncJobRunner;
 import org.apache.ambari.view.hive2.client.AsyncJobRunnerImpl;
 import org.apache.ambari.view.hive2.client.ConnectionConfig;
-import org.apache.ambari.view.hive2.client.HiveClientRuntimeException;
 import org.apache.ambari.view.hive2.persistence.utils.ItemNotFound;
 import org.apache.ambari.view.hive2.resources.jobs.ModifyNotificationDelegate;
 import org.apache.ambari.view.hive2.resources.jobs.ModifyNotificationInvocationHandler;
@@ -36,9 +35,6 @@ import org.apache.ambari.view.hive2.utils.ServiceFormattedException;
 import org.apache.ambari.view.hive2.ConnectionFactory;
 import org.apache.ambari.view.hive2.ConnectionSystem;
 import org.apache.ambari.view.hive2.actor.message.AsyncJob;
-import org.apache.ambari.view.hive2.actor.message.job.AsyncExecutionFailed;
-import org.apache.ambari.view.hive2.internal.AsyncExecutionSuccess;
-import org.apache.ambari.view.hive2.internal.Either;
 import org.apache.ambari.view.utils.hdfs.HdfsApi;
 import org.apache.ambari.view.utils.hdfs.HdfsApiException;
 import org.apache.ambari.view.utils.hdfs.HdfsUtil;
@@ -49,9 +45,7 @@ import org.slf4j.LoggerFactory;
 import java.io.IOException;
 import java.lang.reflect.Proxy;
 import java.text.SimpleDateFormat;
-import java.util.Arrays;
 import java.util.Date;
-import java.util.List;
 
 public class JobControllerImpl implements JobController, ModifyNotificationDelegate {
     private final static Logger LOG =
@@ -63,7 +57,6 @@ public class JobControllerImpl implements JobController, ModifyNotificationDeleg
     private Job job;
     private boolean modified;
 
-    //private OperationHandleControllerFactory opHandleControllerFactory;
     private SavedQueryResourceManager savedQueryResourceManager;
     private IATSParser atsParser;
 
@@ -72,19 +65,15 @@ public class JobControllerImpl implements JobController, ModifyNotificationDeleg
      * Warning: Create JobControllers ONLY using JobControllerFactory!
      */
     public JobControllerImpl(ViewContext context, Job job,
-                             //OperationHandleControllerFactory opHandleControllerFactory,
                              SavedQueryResourceManager savedQueryResourceManager,
                              IATSParser atsParser,
                              HdfsApi hdfsApi) {
         this.context = context;
         setJobPOJO(job);
-        //this.opHandleControllerFactory = opHandleControllerFactory;
         this.savedQueryResourceManager = savedQueryResourceManager;
         this.atsParser = atsParser;
         this.hdfsApi = hdfsApi;
 
-        //UserLocalConnection connectionLocal = new UserLocalConnection();
-        //this.hiveConnection = new ConnectionController(opHandleControllerFactory, connectionLocal.get(context));
     }
 
     public String getQueryForJob() {
@@ -110,11 +99,6 @@ public class JobControllerImpl implements JobController, ModifyNotificationDeleg
         }
     }
 
-  /*@Override
-  public OperationHandleController.OperationStatus getStatus() throws ItemNotFound, HiveClientException, NoOperationStatusSetException {
-    OperationHandleController handle = opHandleControllerFactory.getHandleForJob(job);
-    return handle.getOperationStatus();
-  }*/
 
     @Override
     public void submit() throws Throwable {
@@ -122,8 +106,6 @@ public class JobControllerImpl implements JobController, ModifyNotificationDeleg
         String query = getQueryForJob();
         ConnectionSystem system = ConnectionSystem.getInstance();
         AsyncJobRunner asyncJobRunner = new AsyncJobRunnerImpl(context, system.getOperationController(context), system.getActorSystem());
-        // create async Job
-        //
         AsyncJob asyncJob = new AsyncJob(job.getId(), context.getUsername(), getStatements(jobDatabase, query), job.getLogFile(), context);
         asyncJobRunner.submitJob(getHiveConnectionConfig(), asyncJob, job);
 
@@ -140,72 +122,14 @@ public class JobControllerImpl implements JobController, ModifyNotificationDeleg
 
     @Override
     public void cancel() throws ItemNotFound {
-        //OperationHandleController handle = opHandleControllerFactory.getHandleForJob(job);
-        //handle.cancel();
+        //TODO: Cancel job
     }
 
     @Override
     public void update() {
-        updateOperationStatus();
-        updateOperationLogs();
-
         updateJobDuration();
     }
 
-    public void updateOperationStatus() {
-        try {
-
-            //OperationHandleController handle = opHandleControllerFactory.getHandleForJob(job);
-            //OperationHandleController.OperationStatus status = handle.getOperationStatus();
-      /*job.setStatus(status.status);
-      job.setStatusMessage(status.message);
-      job.setSqlState(status.sqlState);*/
-            LOG.debug("Status of job#" + job.getId() + " is " + job.getStatus());
-
-        } catch (Exception /*NoOperationStatusSetException*/ e) {
-            LOG.info("Operation state is not set for job#" + job.getId());
-
-        } /*catch (HiveErrorStatusException e) {
-      LOG.debug("Error updating status for job#" + job.getId() + ": " + e.getMessage());
-      job.setStatus(ExecuteJob.JOB_STATE_UNKNOWN);
-
-    } catch (HiveClientException e) {
-      throw new HiveClientFormattedException(e);
-
-    } catch (ItemNotFound itemNotFound) {
-      LOG.debug("No TOperationHandle for job#" + job.getId() + ", can't update status");
-    }*/
-    }
-
-    public void updateOperationLogs() {
-        try {
-            //OperationHandleController handle = opHandleControllerFactory.getHandleForJob(job);
-            //String logs = handle.getLogs();
-
-            //LogParser info = LogParser.parseLog(logs);
-            //LogParser.AppId app = info.getLastAppInList();
-      /*if (app != null) {
-        job.setApplicationId(app.getIdentifier());
-      }*/
-
-            String logFilePath = job.getLogFile();
-            //HdfsUtil.putStringToFile(hdfsApi, logFilePath, logs);
-
-        } catch (HiveClientRuntimeException ex) {
-            LOG.error("Error while fetching logs: " + ex.getMessage());
-        } /*catch (ItemNotFound itemNotFound) {
-      LOG.debug("No TOperationHandle for job#" + job.getId() + ", can't read logs");
-    } catch (HdfsApiException e) {
-      throw new ServiceFormattedException(e);
-    }*/
-    }
-
-    public boolean isJobEnded() {
-        String status = job.getStatus();
-        return status.equals(Job.JOB_STATE_FINISHED) || status.equals(Job.JOB_STATE_CANCELED) ||
-                status.equals(Job.JOB_STATE_CLOSED) || status.equals(Job.JOB_STATE_ERROR) ||
-                status.equals(Job.JOB_STATE_UNKNOWN); // Unknown is not finished, but polling makes no sense
-    }
 
     @Override
     public Job getJob() {
@@ -230,18 +154,6 @@ public class JobControllerImpl implements JobController, ModifyNotificationDeleg
         this.jobUnproxied = jobPOJO;
     }
 
-  /*@Override
-  public Cursor getResults() throws ItemNotFound {
-    OperationHandleController handle = opHandleControllerFactory.getHandleForJob(job);
-    return handle.getResults();
-  }*/
-
-    @Override
-    public boolean hasResults() throws ItemNotFound {
-        //OperationHandleController handle = opHandleControllerFactory.getHandleForJob(job);
-        //return handle.hasResults();
-        return false;
-    }
 
     @Override
     public void afterCreation() {