/** * Removes an engine ID association from the local storage and fires the * corresponding {@link SnmpEngineEvent}. * @param address * the <code>Address</code> of the remote SNMP engine for whose engine ID * is to be removed. * @return * the removed engine ID of the remote SNMP engine or <code>null</code> if * there is no entry for <code>address</code> in the local storage. */ public OctetString removeEngineID(Address address) { OctetString engineID = (OctetString) engineIDs.remove(address); if ((engineID != null) && (snmpEngineListeners != null)) { fireEngineChanged(new SnmpEngineEvent(this, SnmpEngineEvent.REMOVED_ENGINE_ID, engineID, address)); } return engineID; }
/** * Removes an engine ID association from the local storage and fires the * corresponding {@link SnmpEngineEvent}. * @param address * the {@link Address} of the remote SNMP engine for whose engine ID * is to be removed. * @return * the removed engine ID of the remote SNMP engine or {@code null} if * there is no entry for {@code address} in the local storage. */ public OctetString removeEngineID(Address address) { OctetString engineID = engineIDs.remove(address); if ((engineID != null) && (snmpEngineListeners != null)) { fireEngineChanged(new SnmpEngineEvent(this, SnmpEngineEvent.REMOVED_ENGINE_ID, engineID, address)); } return engineID; }
/** * Removes an engine ID association from the local storage and fires the * corresponding {@link SnmpEngineEvent}. * @param address * the {@link Address} of the remote SNMP engine for whose engine ID * is to be removed. * @return * the removed engine ID of the remote SNMP engine or {@code null} if * there is no entry for {@code address} in the local storage. */ public OctetString removeEngineID(Address address) { OctetString engineID = engineIDs.remove(address); if ((engineID != null) && (snmpEngineListeners != null)) { fireEngineChanged(new SnmpEngineEvent(this, SnmpEngineEvent.REMOVED_ENGINE_ID, engineID, address)); } return engineID; }
/** * Adds an engine ID (other than the local engine ID) to the internal storage. * @param address * the <code>Address</code> of the remote SNMP engine. * @param engineID * the engine ID of the remote SNMP engine. * @return * <code>true</code> if the engine ID has been added, <code>false</code> * otherwise (if the supplied <code>engineID</code> equals the local one). */ public boolean addEngineID(Address address, OctetString engineID) { if (!Arrays.equals(this.localEngineID, engineID.getValue())) { engineIDs.put(address, engineID); if (snmpEngineListeners != null) { fireEngineChanged(new SnmpEngineEvent(this, SnmpEngineEvent.ADDED_ENGINE_ID, engineID, address)); } return true; } return false; }
/** * Adds an engine ID (other than the local engine ID) to the internal storage. * @param address * the {@link Address} of the remote SNMP engine. * @param engineID * the engine ID of the remote SNMP engine. * @return * {@code true} if the engine ID has been added, <code>false</code> * otherwise (if the supplied {@code engineID} equals the local one). */ public boolean addEngineID(Address address, OctetString engineID) { if (!Arrays.equals(this.localEngineID, engineID.getValue())) { try { OctetString previousEngineID = addEngineIdToCache(address, engineID); if ((snmpEngineListeners != null) && ((previousEngineID == null) || (!previousEngineID.equals(engineID)))) { fireEngineChanged(new SnmpEngineEvent(this, SnmpEngineEvent.ADDED_ENGINE_ID, engineID, address)); } } catch (IllegalArgumentException iaex) { fireEngineChanged(new SnmpEngineEvent(this, SnmpEngineEvent.IGNORED_ENGINE_ID, engineID, address)); return false; } return true; } return false; }
/** * Adds an engine ID (other than the local engine ID) to the internal storage. * @param address * the {@link Address} of the remote SNMP engine. * @param engineID * the engine ID of the remote SNMP engine. * @return * {@code true} if the engine ID has been added, <code>false</code> * otherwise (if the supplied {@code engineID} equals the local one). */ public boolean addEngineID(Address address, OctetString engineID) { if (!Arrays.equals(this.localEngineID, engineID.getValue())) { try { OctetString previousEngineID = addEngineIdToCache(address, engineID); if ((snmpEngineListeners != null) && ((previousEngineID == null) || (!previousEngineID.equals(engineID)))) { fireEngineChanged(new SnmpEngineEvent(this, SnmpEngineEvent.ADDED_ENGINE_ID, engineID, address)); } } catch (IllegalArgumentException iaex) { fireEngineChanged(new SnmpEngineEvent(this, SnmpEngineEvent.IGNORED_ENGINE_ID, engineID, address)); return false; } return true; } return false; }