Exemplo n.º 1
0
  public Object ac_ls_pool_$_0_1(Args args) {
    String poolName = args.argc() == 0 ? null : args.argv(0);
    boolean detail = args.hasOption("l");
    boolean binary = args.hasOption("binary");

    StringBuffer sb = new StringBuffer();
    if (poolName == null) {
      if (binary) {
        Collection<HsmFlushControlCore.PoolDetails> list = new ArrayList<>();
        for (Object pool : _eventDispatcher.getConfiguredPools()) {
          list.add(((HFCPool) pool).getDetails());
        }
        return list;
      } else {
        Set<String> set = new TreeSet<>(_poolCollector.getConfiguredPoolNames());
        for (Object configuredPoolName : set) {
          String name = configuredPoolName.toString();
          if (!detail) {
            sb.append(name).append("\n");
          } else {
            HFCPool pool = _poolCollector.getPoolByName(name);
            printPoolDetails2(pool, sb);
          }
        }
      }
    } else {
      HFCPool pool = _poolCollector.getPoolByName(poolName);
      if (pool == null) {
        throw new NoSuchElementException("Pool not found : " + poolName);
      }

      if (binary) {
        return pool.getDetails();
        /*
        HsmFlushControlCore.PoolDetails details = pool.getDetails() ;
        sb.append("PoolDetails\n").
           append("   Name ").append(details.getName()).append("\n").
           append("   CellInfo ").append(details.getCellInfo()).append("\n").
           append("   isActive ").append(details.isActive()).append("\n") ;
        for( Iterator i = details.getFlushInfos().iterator() ; i.hasNext() ; ){
           HsmFlushControlCore.FlushInfoDetails flush = (HsmFlushControlCore.FlushInfoDetails)i.next() ;
           sb.append("   StorageClass ").append(flush.getName()).append("\n").
              append("     isFlushing   ").append(flush.isFlushing()).append("\n").
              append("     FlushInfo    ").append(flush.getStorageClassFlushInfo()).append("\n");
        }
        */
      } else {
        printPoolDetails2(pool, sb);
      }
    }
    return sb.toString();
  }