/** * Constructor. A Local Configuration Datastore is passed to the engine. It will be used to store and retrieve data (engine Id, engine boots). * <P> WARNING : The SnmpEngineId is computed as follow: * <ul> * <li> If an lcd file is provided containing the property "localEngineID", this property value is used.</li>. * <li> If not, if the passed engineID is not null, this engine ID is used.</li> * <li> If not, a time based engineID is computed.</li> * </ul> * This constructor should be called by an <CODE>SnmpEngineFactory</CODE>. Don't call it directly. * @param fact The factory used to instantiate this engine. * @param lcd The local configuration datastore. * @param engineid The engine ID to use. If null is provided, an SnmpEngineId is computed using the current time. * @throws UnknownHostException Exception thrown, if the host name located in the property "localEngineID" is invalid. */ public SnmpEngineImpl(SnmpEngineFactory fact, SnmpLcd lcd, SnmpEngineId engineid) throws UnknownHostException { init(lcd, fact); initEngineID(); if(this.engineid == null) { if(engineid != null) this.engineid = engineid; else this.engineid = SnmpEngineId.createEngineId(); } lcd.storeEngineId(this.engineid); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpEngineImpl.class.getName(), "SnmpEngineImpl(SnmpEngineFactory,SnmpLcd,SnmpEngineId)", "LOCAL ENGINE ID: " + this.engineid); } }
/** * Constructor. A Local Configuration Datastore is passed to the engine. It will be used to store and retrieve data (engine ID, engine boots). * <P> WARNING : The SnmpEngineId is computed as follow: * <ul> * <li> If an lcd file is provided containing the property "localEngineID", this property value is used.</li>. * <li> If not, the passed address and port are used to compute one.</li> * </ul> * This constructor should be called by an <CODE>SnmpEngineFactory</CODE>. Don't call it directly. * @param fact The factory used to instantiate this engine. * @param lcd The local configuration datastore. * @param port UDP port to use in order to calculate the engine ID. * @param address An IP address used to calculate the engine ID. * @throws UnknownHostException Exception thrown, if the host name located in the property "localEngineID" is invalid. */ public SnmpEngineImpl(SnmpEngineFactory fact, SnmpLcd lcd, InetAddress address, int port) throws UnknownHostException { init(lcd, fact); initEngineID(); if(engineid == null) engineid = SnmpEngineId.createEngineId(address, port); lcd.storeEngineId(engineid); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpEngineImpl.class.getName(), "SnmpEngineImpl(SnmpEngineFactory,SnmpLcd,InetAddress,int)", "LOCAL ENGINE ID: " + engineid + " / " + "LOCAL ENGINE NB BOOTS: " + boot + " / " + "LOCAL ENGINE START TIME: " + getEngineTime()); } }
/** * Constructor. A Local Configuration Datastore is passed to the engine. It will be used to store and retrieve data (engine ID, engine boots). * <P> WARNING : The SnmpEngineId is computed as follow: * <ul> * <li> If an lcd file is provided containing the property "localEngineID", this property value is used.</li>. * <li> If not, The passed port is used to compute one.</li> * </ul> * This constructor should be called by an <CODE>SnmpEngineFactory</CODE>. Don't call it directly. * @param fact The factory used to instantiate this engine. * @param lcd The local configuration datastore * @param port UDP port to use in order to calculate the engine ID. * @throws UnknownHostException Exception thrown, if the host name located in the property "localEngineID" is invalid. */ public SnmpEngineImpl(SnmpEngineFactory fact, SnmpLcd lcd, int port) throws UnknownHostException { init(lcd, fact); initEngineID(); if(engineid == null) engineid = SnmpEngineId.createEngineId(port); lcd.storeEngineId(engineid); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpEngineImpl.class.getName(), "SnmpEngineImpl(SnmpEngineFactory,SnmpLcd,int)", "LOCAL ENGINE ID: " + engineid + " / " + "LOCAL ENGINE NB BOOTS: " + boot + " / " + "LOCAL ENGINE START TIME: " + getEngineTime()); } }
/** * Constructor. A Local Configuration Datastore is passed to the engine. It will be used to store and retrieve data (engine ID, engine boots). * <P> WARNING : The SnmpEngineId is computed as follow: * <ul> * <li> If an lcd file is provided containing the property "localEngineID", this property value is used.</li>. * <li> If not, a time based engineID is computed.</li> * </ul> * When no configuration nor java property is set for the engine ID value, a unique time based engine ID will be generated. * This constructor should be called by an <CODE>SnmpEngineFactory</CODE>. Don't call it directly. * @param fact The factory used to instantiate this engine. * @param lcd The local configuration datastore. */ public SnmpEngineImpl(SnmpEngineFactory fact, SnmpLcd lcd) throws UnknownHostException { init(lcd, fact); initEngineID(); if(engineid == null) engineid = SnmpEngineId.createEngineId(); lcd.storeEngineId(engineid); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpEngineImpl.class.getName(), "SnmpEngineImpl(SnmpEngineFactory,SnmpLcd)", "LOCAL ENGINE ID: " + engineid + " / " + "LOCAL ENGINE NB BOOTS: " + boot + " / " + "LOCAL ENGINE START TIME: " + getEngineTime()); } }