Exemplo n.º 1
0
 /**
  * Retrieves a current record from the database based upon the key fields of <em>nodeID</em> and
  * <em>ipAddr</em>. If the record cannot be found then a null reference is returned.
  *
  * @param db The database connection used to load the entry.
  * @param nid The node id key
  * @param addr The IP address.
  * @param ifIndex The interface index.
  * @return The loaded entry or null if one could not be found.
  */
 public static DbIpInterfaceEntry get(Connection db, long nid, InetAddress addr, int ifIndex)
     throws SQLException {
   DbIpInterfaceEntry entry = new DbIpInterfaceEntry(nid, addr, ifIndex, true);
   if (!entry.load(db)) {
     entry = null;
   }
   return entry;
 }
Exemplo n.º 2
0
 /**
  * Clones an existing entry.
  *
  * @param entry The entry to be cloned
  * @return a new DbIpInterfaceEntry identical to the original
  */
 public static DbIpInterfaceEntry clone(DbIpInterfaceEntry entry) {
   DbIpInterfaceEntry clonedEntry = create(entry.getNodeId(), entry.getIfAddress());
   clonedEntry.m_fromDb = entry.m_fromDb;
   clonedEntry.m_ifIndex = entry.m_ifIndex;
   clonedEntry.m_managedState = entry.m_managedState;
   clonedEntry.m_status = entry.m_status;
   clonedEntry.m_lastPoll = entry.m_lastPoll;
   clonedEntry.m_primaryState = entry.m_primaryState;
   clonedEntry.m_changed = entry.m_changed;
   return clonedEntry;
 }
Exemplo n.º 3
0
  /**
   * For debugging only
   *
   * @param args an array of {@link java.lang.String} objects.
   */
  public static void main(String[] args) {
    try {
      DbIpInterfaceEntry entry =
          DbIpInterfaceEntry.get(Integer.parseInt(args[0]), InetAddressUtils.addr(args[1]));
      System.out.println(entry.toString());

      DbIfServiceEntry[] services = entry.getServices();
      for (int i = 0; i < services.length; i++) {
        System.out.println(services[i].toString());
      }
    } catch (Throwable t) {
      t.printStackTrace();
    }
  }