Esempio n. 1
0
  public InetAddress getRmtAddress() {
    if (rmtAddress == null) {
      rmtAddress = Util.getInetAddress(rmt_ip);
    }

    return rmtAddress;
  }
Esempio n. 2
0
  public void updateStatus(InputStream in) throws IOException {
    DataInputStream din = new DataInputStream(in);
    Set curSet = new HashSet(ipToHost.keySet());

    int count = din.readInt();
    for (int i = 0; i < count; i++) {
      long ip = din.readLong();
      tmpLong.setLong(ip);
      Host host = (Host) ipToHost.get(tmpLong);
      if (host == null) {
        addHost(ip, Util.getInetAddress(ip));
        host = (Host) ipToHost.get(tmpLong);
      }

      curSet.remove(tmpLong);

      host.readHost(din);
      host.updateData();
    }

    Iterator it = curSet.iterator();
    while (it.hasNext()) {
      Long elem = (Long) it.next();
      removeHost(elem.longValue());
    }

    hostsHolder.revalidate();
    hostsHolder.repaint();
  }
Esempio n. 3
0
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     Object o = list.getSelectedValue();
     if (o != null) {
       String ip = o.toString();
       locateAndShowHost(Util.getLongIp(ip));
     }
   }
 }
Esempio n. 4
0
  private void sendAddRemoveHost(InetAddress host, boolean doAdd) {
    AddRemoveHostMessage arhm = new AddRemoveHostMessage();
    arhm.setDoAdd(doAdd);
    arhm.setIp(Util.getLongIp(host));

    try {
      ObjectOutput oo = new ObjectOutputStream(receptor.getManager().openInterModuleStream(this));
      oo.writeObject(arhm);
      oo.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 5
0
  private static void runStartupScript(File initsh)
      throws EvalError, URISyntaxException, FileNotFoundException, IOException {
    Interpreter bsh = new Interpreter();

    String initScript =
        new String(
            Util.catFile(
                ClassLoader.getSystemResource("eunomia/util/scripts/commands.esh").toURI()));
    bsh.eval(initScript);

    if (initsh.exists()) {
      bsh.source(initsh.toString());
    }
  }
Esempio n. 6
0
 public void addHost(InetAddress host) {
   addHost(Util.getLongIp(host), host);
 }