示例#1
0
 @Override
 protected boolean hideAction(RepositoryNode node) {
   HadoopClusterConnectionItem hcConnectionItem =
       HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
   if (hcConnectionItem != null) {
     HadoopClusterConnection hcConnection =
         (HadoopClusterConnection) hcConnectionItem.getConnection();
     DistributionBean hdfsDistribution =
         HadoopDistributionsHelper.HDFS.getDistribution(hcConnection.getDistribution(), false);
     if (hdfsDistribution != null) {
       IHDistributionVersion hdVersion =
           hdfsDistribution.getHDVersion(hcConnection.getDfVersion(), false);
       if (hdVersion != null) { // found, don't hide
         return false;
       }
     }
   }
   return true;
 }
示例#2
0
  @Override
  protected JSONObject getTokenDetailsForCurrentProject() throws Exception {
    JSONObject typesHadoop = new JSONObject();

    for (IRepositoryViewObject rvo :
        ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.getType(HADOOPCLUSTER))) {
      HadoopClusterConnectionItem item = (HadoopClusterConnectionItem) rvo.getProperty().getItem();
      HadoopClusterConnection connection = (HadoopClusterConnection) item.getConnection();
      String distrib =
          connection.getDistribution() + "/" + connection.getDfVersion(); // $NON-NLS-1$
      int nbDbTypes = 1;
      if (typesHadoop.has(distrib)) {
        nbDbTypes = typesHadoop.getInt(distrib);
        nbDbTypes++;
      }
      typesHadoop.put(distrib, nbDbTypes);
    }

    JSONObject hadoopCluster = new JSONObject();
    JSONObject types = new JSONObject();
    types.put("types", typesHadoop);
    hadoopCluster.put(HADOOPCLUSTER, types);
    return hadoopCluster;
  }