private String startConnector(String remoteDomain, HostAndPort address)
      throws ExecutionException, InterruptedException {
    String cellName = "c-" + remoteDomain + "*";
    String clientKey = args.getOpt("clientKey");
    clientKey = (clientKey != null) && (clientKey.length() > 0) ? ("-clientKey=" + clientKey) : "";
    String clientName = args.getOpt("clientUserName");
    clientName =
        (clientName != null) && (clientName.length() > 0) ? ("-clientUserName="******"";

    String cellArgs =
        "-domain="
            + remoteDomain
            + " "
            + "-lm="
            + getCellName()
            + " "
            + "-role="
            + role
            + " "
            + "-where="
            + address
            + " "
            + clientKey
            + " "
            + clientName;
    LOGGER.info("Starting connector with {}", cellArgs);
    LocationManagerConnector c = new LocationManagerConnector(cellName, cellArgs);
    c.start().get();
    LOGGER.info("Created : {}", c);
    return c.getCellName();
  }
Exemple #2
0
  public VspCheck1(String[] arg) throws Exception {
    Args args = new Args(arg);
    if (args.argc() < 1) {
      System.err.println("Usage : ...[options] <pnfsId1> [pnfsids ...]");
      System.err.println("      Options : [-host=<host>] [-port=<port>] [-parallel=<count>]");
      System.exit(4);
    }

    String tmp = args.getOpt("host");

    _host = tmp == null ? "localhost" : tmp;

    tmp = args.getOpt("port");
    tmp = tmp == null ? "22125" : tmp;
    _port = Integer.parseInt(tmp);

    tmp = args.getOpt("parallel");
    tmp = tmp == null ? "1" : tmp;
    _count = Integer.parseInt(tmp);

    _pnfsid = new String[args.argc()];
    for (int i = 0; i < args.argc(); i++) {
      _pnfsid[i] = args.argv(i);
    }

    for (int i = 0; i < _count; i++) {
      new WorkerThread(i).start();
    }
  }
  @Override
  protected void startUp() throws Exception {
    _poolManager = new CellStub(this, new CellPath("PoolManager"), 30, SECONDS);
    Args args = getArgs();
    checkArgument(args.argc() >= 1, "Usage : ... <pgroup0> [<pgroup1>[...]]");

    for (int i = 0, n = args.argc(); i < n; i++) {
      _poolGroupList.add(args.argv(0));
      args.shift();
    }
    String tmp = args.getOpt("scheduler");
    if ((tmp != null) && (!tmp.equals(""))) {
      _eventDispatcher.loadHandler(tmp, false, args);
    }

    _queueWatch = new QueueWatch();

    tmp = args.getOpt("poolCollectionUpdate");
    if ((tmp != null) && (!tmp.equals(""))) {
      try {
        _getPoolCollectionTicker = Long.parseLong(tmp) * 60L * 1000L;
      } catch (Exception ee) {
        _log.warn(
            "Illegal value for poolCollectionUpdate : {} (choosing {} millis)",
            tmp,
            _getPoolCollectionTicker);
      }
    }
    tmp = args.getOpt("gainControlUpdate");
    if ((tmp != null) && (!tmp.equals(""))) {
      long gainControlTicker = 0L;
      try {
        _queueWatch.setGainControlTicker(gainControlTicker = Long.parseLong(tmp) * 60L * 1000L);
      } catch (Exception ee) {
        _log.warn(
            "Illegal value for gainControlUpdate : {} (choosing {} millis)",
            tmp,
            gainControlTicker);
      }
    }
    tmp = args.getOpt("timer");
    if ((tmp != null) && (!tmp.equals(""))) {
      try {
        _timerInterval = Long.parseLong(tmp) * 1000L;
      } catch (Exception ee) {
        _log.warn("Illegal value for timer : {} (choosing {} millis)", tmp, _timerInterval);
      }
    }
    useInterpreter(true);
  }
 public String ac_whatToDo_$_1(Args args) {
   String domainName = args.argv(0);
   String serial = args.getOpt("serial");
   Map<String, HostAndPort> cores = coreDomains.cores();
   switch (cores.size()) {
     case 0:
       return null;
     case 1:
       String broker = Iterables.get(cores.keySet(), 0);
       return "do"
           + (serial != null ? " -serial=" + serial : "")
           + " "
           + domainName
           + " "
           + "nl"
           + " c:"
           + broker
           + " d:"
           + broker;
     default:
       LOGGER.warn(
           "Legacy domain {} tried to connect, but are not supported in multi-core topologies.",
           domainName);
       return "do" + (serial != null ? " -serial=" + serial : "") + " " + domainName;
   }
 }
  public String ac_set_control_$_1(Args args) {
    String mode = args.argv(0);
    String iString = args.getOpt("interval");
    long interval = 0L;
    if (iString != null) {
      interval = Long.parseLong(iString) * 1000L;
      if (interval < 30000L) {
        throw new IllegalArgumentException("interval must be greater than 30");
      }
    }

    switch (mode) {
      case "on":
        _flushController.setControl(true);
        break;
      case "off":
        _flushController.setControl(false);
        break;
      default:
        throw new IllegalArgumentException("set control on|off");
    }
    if (interval > 0L) {
      _queueWatch.setGainControlTicker(interval);
    }
    return "";
  }
 public String ac_driver_properties(Args args) {
   Map<String, String> map = new HashMap<>();
   for (int i = 0, n = args.optc(); i < n; i++) {
     String key = args.optv(i);
     String value = args.getOpt(key);
     map.put(key, value);
   }
   _eventDispatcher.propertiesUpdated(map);
   return "Properties sent to driver, check with 'info'";
 }
  public GFtpProtocol_2_nio(CellEndpoint cell) {
    _cell = cell;

    String range = System.getProperty("org.globus.tcp.port.range");
    if (range != null) {
      _portRange = PortRange.valueOf(range);
    } else {
      _portRange = new PortRange(0);
    }

    if (_cell != null) {
      Args args = _cell.getArgs();
      if (args.hasOption("ftpProxyPassive")) {
        _allowPassivePool = !Boolean.parseBoolean(args.getOpt("ftpProxyPassive"));
      }

      if (args.hasOption("gsiftpBlockSize")) {
        _blockSize = Integer.valueOf(args.getOpt("gsiftpBlockSize"));
      }
    }
  }
      public String ac_whereIs_$_1(Args args) {
        String domainName = args.argv(0);

        HostAndPort address = coreDomains.readAddressOf(domainName);
        if (address == null) {
          throw new IllegalArgumentException("Domain not listening: " + domainName);
        }

        StringBuilder sb = new StringBuilder();
        sb.append("location");
        String serial = args.getOpt("serial");
        if (serial != null) {
          sb.append(" -serial=").append(serial);
        }
        sb.append(" ").append(domainName);
        sb.append(" ").append(address);
        return sb.toString();
      }
  public String ac_flush_pool_$_2(Args args) throws Exception {
    String poolName = args.argv(0);
    String storageClass = args.argv(1);
    String countString = args.getOpt("count");

    int count = (countString == null) || countString.equals("") ? 0 : Integer.parseInt(countString);

    HFCPool pool = _poolCollector.getPoolByName(poolName);
    if (pool == null) {
      throw new NoSuchElementException("Pool not found : " + poolName);
    }

    HsmFlushControlCore.FlushInfo info = pool.getFlushInfoByStorageClass(storageClass);
    if (info == null) {
      throw new NoSuchElementException("StorageClass not found : " + storageClass);
    }

    info.flush(count);

    return "Flush initiated for (" + poolName + "," + storageClass + ")";
  }
 /** Returns the value of an option, or a default value if the option has not been set. */
 public static String getOption(Args args, String name, String defaultValue) {
   String value = args.getOpt(name);
   return value == null ? defaultValue : value;
 }