예제 #1
0
  public InetAddress getRmtAddress() {
    if (rmtAddress == null) {
      rmtAddress = Util.getInetAddress(rmt_ip);
    }

    return rmtAddress;
  }
예제 #2
0
파일: Main.java 프로젝트: nologic/nabs
  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();
  }
예제 #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));
     }
   }
 }
예제 #4
0
파일: Main.java 프로젝트: nologic/nabs
  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();
    }
  }
예제 #5
0
파일: Main.java 프로젝트: nologic/nabs
  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());
    }
  }
예제 #6
0
파일: Main.java 프로젝트: nologic/nabs
 public void addHost(InetAddress host) {
   addHost(Util.getLongIp(host), host);
 }