예제 #1
0
 private void init(ArrayList<Object> in, D_Peer peer) {
   address = Util.getString(in.get(table.peer_address.PA_ADDRESS));
   instance_ID_str = Util.getString(in.get(table.peer_address.PA_INSTANCE_ID));
   _instance_ID = Util.lval(instance_ID_str, -1);
   if (_instance_ID > 0) {
     D_PeerInstance dpi = null;
     if (peer != null) {
       dpi = peer.getPeerInstance_ByID(instance_ID_str);
       // this._peer_ID = peer.get_ID();
     }
     if (dpi != null) {
       instance = dpi.peer_instance;
       this.branch = dpi.branch;
       this.agent_version = dpi.agent_version;
     } else {
       try {
         System.out.println("Address:init: should not come here!");
         ArrayList<ArrayList<Object>> inst =
             Application.db.select(
                 "SELECT "
                     + table.peer_instance.peer_instance
                     + " FROM "
                     + table.peer_instance.TNAME
                     + " WHERE "
                     + table.peer_instance.peer_instance_ID
                     + "=?;",
                 new String[] {instance_ID_str},
                 _DEBUG);
         if (inst.size() > 0) instance = Util.getString(inst.get(0));
       } catch (P2PDDSQLException e) {
         e.printStackTrace();
       }
     }
   }
   pure_protocol = Util.getString(in.get(table.peer_address.PA_TYPE));
   domain = Util.getString(in.get(table.peer_address.PA_DOMAIN));
   tcp_port = Util.ival(in.get(table.peer_address.PA_TCP_PORT), -1);
   udp_port = Util.ival(in.get(table.peer_address.PA_UDP_PORT), -1);
   certified = Util.stringInt2bool(in.get(table.peer_address.PA_CERTIFIED), false);
   priority = Util.ival(in.get(table.peer_address.PA_PRIORITY), 0);
   last_contact = Util.getString(in.get(table.peer_address.PA_CONTACT));
   arrival_date = Util.getString(in.get(table.peer_address.PA_ARRIVAL));
   peer_address_ID = Util.getString(in.get(table.peer_address.PA_PEER_ADDR_ID));
 }
예제 #2
0
 public Address(DirectoryAddress d) {
   this.pure_protocol = d.pure_protocol;
   this.branch = d.branch;
   this.agent_version = d.agent_version;
   this.domain = d.domain;
   this.tcp_port = d.tcp_port;
   this.udp_port = d.udp_port;
   this.name = d.name;
   this.active = d.active;
   this.instance = d.instance;
   this.version_structure = Util.ival(d.version, 0);
 }