示例#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);
 }