/** * Builds target resource. * @param context Process context */ private void buildTargetResource(ProcessContext context) { if((this.transportMapping == null) || !this.transportMapping.isListening() || (this.snmp == null)) { try { this.transportMapping = new DefaultUdpTransportMapping(); this.snmp = new Snmp(this.transportMapping); if("SNMPv3".equals(context.getProperty(SNMP_VERSION).getValue())) { USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0); SecurityModels.getInstance().addSecurityModel(usm); } this.transportMapping.listen(); } catch (Exception e) { throw new IllegalStateException("Failed to initialize UDP transport mapping", e); } } if (this.snmpTarget == null) { this.snmpTarget = this.createSnmpTarget(context); } if (this.targetResource == null) { this.targetResource = this.finishBuildingTargetResource(context); } }
public TSM(OctetString localEngineID, boolean usePrefix) { this.counterSupport = CounterSupport.getInstance(); this.localEngineID = localEngineID; this.usePrefix = usePrefix; }
/** * Creates a <code>PduHandle</code> for the supplied transaction ID. * @param transactionID * an unqiue transaction ID. */ public PduHandle(int transactionID) { setTransactionID(transactionID); }
/** * Creates a MPv3 with a supplied local engine ID. * @param localEngineID * the local engine ID. Its length must be greater or equal than 5 and less or equal than 32. */ public MPv3(byte[] localEngineID) { this(localEngineID, null); setLocalEngineID(localEngineID); }
/** * Gets the counter support singleton. * @return * the <code>CounterSupport</code> instance. */ public static CounterSupport getInstance() { if (instance == null) { instance = new CounterSupport(); } return instance; }
protected MessageID createMessageID(int msgID) { if (SNMP4JSettings.getSnmp4jStatistics() == SNMP4JSettings.Snmp4jStatistics.extended) { return new TimedMessageID(msgID); } return new SimpleMessageID(msgID); } }
/** * Fire a counter incrementation event. * @param e CounterEvent */ protected void fireIncrementCounter(CounterEvent e) { if (counterSupport != null) { counterSupport.fireIncrementCounter(e); } }
@Override public String toString() { return "TimedMessageID{" + "msgID="+getID()+ ",creationNanoTime=" + creationNanoTime + "}"; } }
/** * Sets the engine ID cache factory and resets (clears) the current cache. The maximum size of the * cache is determined using {@link #getMaxEngineIdCacheSize()} as this implements the {@link EngineIdCacheSize} * interface. By default the maximum cache size {@link SNMP4JSettings#getMaxEngineIdCacheSize()} is used. * @param engineIdCacheFactory * a {@link org.snmp4j.mp.MPv3.EngineIdCacheFactory} implementation that is used to create a new cache. * @since 2.3.4 */ public void setEngineIdCacheFactory(EngineIdCacheFactory engineIdCacheFactory) { engineIDs = engineIdCacheFactory.createEngineIdMap(this); this.engineIdCacheFactory = engineIdCacheFactory; }
/** * Constructs a SnmpTlsTmMib instance without actually creating its * <code>ManagedObject</code> instances. This has to be done in a * sub-class constructor or after construction by calling * {@link #createMO(MOFactory moFactory)}. */ protected SnmpTlsTmMib() { //--AgentGen BEGIN=_DEFAULTCONSTRUCTOR counterListener.setCountRegisteredOnly(true); //--AgentGen END }
/** * Creates a MPv3 with a default local engine ID. */ public MPv3() { this(createLocalEngineID(), null); }
public TSM(OctetString localEngineID, boolean usePrefix) { this.counterSupport = CounterSupport.getInstance(); this.localEngineID = localEngineID; this.usePrefix = usePrefix; }
/** * Copy all members from the supplied <code>PduHandle</code>. * @param other * a PduHandle. */ public void copyFrom(PduHandle other) { setTransactionID(other.transactionID); }
/** * Gets the counter support singleton. * @return * the <code>CounterSupport</code> instance. */ public static CounterSupport getInstance() { if (instance == null) { instance = new CounterSupport(); } return instance; }
/** * Fire a counter incrementation event. * @param e CounterEvent */ protected void fireIncrementCounter(CounterEvent e) { if (counterSupport != null) { counterSupport.fireIncrementCounter(e); } }
/** * Constructs a SnmpTsmMib instance without actually creating its * <code>ManagedObject</code> instances. This has to be done in a * sub-class constructor or after construction by calling * {@link #createMO(MOFactory moFactory)}. */ protected SnmpTsmMib() { //--AgentGen BEGIN=_DEFAULTCONSTRUCTOR counterListener.setCountRegisteredOnly(true); //--AgentGen END }
@Override public byte[] getLocalEngineID() { return MPv3.createLocalEngineID(); }
/** * Creates a <code>PduHandle</code> for the supplied transaction ID. * @param transactionID * an unqiue transaction ID. */ public PduHandle(int transactionID) { setTransactionID(transactionID); }
/** * Gets the counter support singleton. * * @return the <code>CounterSupport</code> instance. */ public static CounterSupport getInstance() { if (instance == null) { instance = new CounterSupport(); } return instance; }
throw new KettleException( "Null Usm" ); } else { usm = new USM( SecurityProtocols.getInstance(), new OctetString( MPv3.createLocalEngineID() ), 0 ); usm.addUser( new OctetString( userName ), uu ); if ( log.isDebug() ) {