protected void initTransportMappings() throws IOException { transportMappings = new TransportMapping<?>[1]; Address addr = GenericAddress.parse(address); TransportMapping<? extends Address> tm = TransportMappings.getInstance().createTransportMapping(addr); transportMappings[0] = tm; }
/** * Returns the <code>TransportMappings</code> singleton. * @return * the <code>TransportMappings</code> instance. */ public static TransportMappings getInstance() { if (instance == null) { instance = new TransportMappings(); } return instance; }
public TransportMapping<? extends Address> createTransportMapping(Address transportAddress) { if (transportMappings == null) { registerTransportMappings();
protected void initTransportMappings() throws IOException { transportMappings = new TransportMapping[1]; Address addr = GenericAddress.parse(address); TransportMapping tm = TransportMappings.getInstance().createTransportMapping(addr); transportMappings[0] = tm; }
/** * Returns the <code>TransportMappings</code> singleton. * @return * the <code>TransportMappings</code> instance. */ public static TransportMappings getInstance() { if (instance == null) { instance = new TransportMappings(); } return instance; }
public <A extends Address> TransportMapping<A> createTransportMapping(A transportAddress) { if (transportMappings == null) { registerTransportMappings();
protected void initTransportMappings() throws IOException { transportMappings = new TransportMapping[1]; Address addr = GenericAddress.parse(address); TransportMapping tm = TransportMappings.getInstance().createTransportMapping(addr); transportMappings[0] = tm; }
/** * Returns the <code>TransportMappings</code> singleton. * * @return the <code>TransportMappings</code> instance. */ public static TransportMappings getInstance() { if (instance == null) { instance = new TransportMappings(); } return instance; }
protected void initTransportMappings() throws IOException { transportMappings = new TransportMapping[1]; Address addr = GenericAddress.parse(address); TransportMapping tm = TransportMappings.getInstance().createTransportMapping(addr); transportMappings[0] = tm; }
protected void initTransportMappings() throws IOException { transportMappings = new TransportMapping<?>[1]; Address addr = GenericAddress.parse(address); TransportMapping<?> tm = TransportMappings.getInstance().createTransportMapping(addr); transportMappings[0] = tm; }
@Override protected void initTransportMappings() throws IOException { transportMappings = new TransportMapping[1]; Address addr = GenericAddress.parse(address); TransportMapping tm = TransportMappings.getInstance().createTransportMapping(addr); transportMappings[0] = tm; }
protected void initTransportMappings() throws IOException { transportMappings = new TransportMapping[1]; Address addr = GenericAddress.parse(address); TransportMapping tm = TransportMappings.getInstance() .createTransportMapping(addr); transportMappings[0] = tm; }
@Override protected void initTransportMappings() throws IOException { String host = getProperty(SNMPConstants.SNMP_HOST, SNMPConstants.SNMP_DEFAULT_HOST); int port = Integer.parseInt(getProperty(SNMPConstants.SNMP_PORT, String.valueOf(SNMPConstants.SNMP_DEFAULT_PORT))); String address = host + "/" + port; Address adr = GenericAddress.parse(address); TransportMapping tm = TransportMappings.getInstance().createTransportMapping(adr); transportMappings = new TransportMapping[] { tm }; log.info("SNMP transport adapter initialized on udp:" + address); }
@Override protected void initTransportMappings() throws IOException { String host = getProperty(SNMPConstants.SNMP_HOST, SNMPConstants.SNMP_DEFAULT_HOST); int port = Integer.parseInt(getProperty(SNMPConstants.SNMP_PORT, String.valueOf(SNMPConstants.SNMP_DEFAULT_PORT))); String address = host + "/" + port; Address adr = GenericAddress.parse(address); TransportMapping tm = TransportMappings.getInstance().createTransportMapping(adr); transportMappings = new TransportMapping[] { tm }; log.info("SNMP transport adapter initialized on udp:" + address); }
protected void addListenAddresses(MessageDispatcher md, List addresses) { for (Iterator it = addresses.iterator(); it.hasNext();) { Address address = GenericAddress.parse((String)it.next()); try { TransportMapping tm = TransportMappings.getInstance().createTransportMapping(address); if (tm != null) { md.addTransportMapping(tm); } else { logger.warn("No transport mapping available for address '" + address + "'."); } } catch (Exception iox) { logger.warn("Failed to create transport mapping for address '" + address + "': "+iox.getCause()); } } }
TransportMappings.getInstance().createTransportMapping(listenAddress); if (tm == null) { if (logger.isInfoEnabled()) {
protected void addListenAddresses(MessageDispatcher md, List<String> addresses) { for (String addressString : addresses) { Address address = GenericAddress.parse(addressString); if (address == null) { logger.fatal("Could not parse address string '"+addressString+"'"); return; } TransportMapping<? extends Address> tm = TransportMappings.getInstance().createTransportMapping(address); if (tm != null) { md.addTransportMapping(tm); } else { logger.warn("No transport mapping available for address '" + address + "'."); } } }
/** * Adds a notification listener to this Snmp instance. Calling this method * will create a transport mapping for the specified listening address and * registers the provided <code>CommandResponder</code> with the internal * <code>NotificationDispatcher</code>. * * @param listenAddress * the <code>Address</code> denoting the transport end-point * (interface and port) to listen for incoming notifications. * @param listener * the <code>CommandResponder</code> instance that should handle * the received notifications. * * @return <code>true</code> if registration was successful and <code>false</code> * if, for example, the transport mapping for the listen address could not * be created. * @since 1.6 */ public synchronized boolean addNotificationListener(Address listenAddress, CommandResponder listener) { TransportMapping<?> tm = TransportMappings.getInstance().createTransportMapping(listenAddress); if (tm == null) { if (logger.isInfoEnabled()) { logger.info("Failed to add notification listener for address: " + listenAddress); } return false; } return addNotificationListener(tm, listenAddress, listener); }
TransportMappings.getInstance().createTransportMapping(listenAddress); if (tm == null) { if (logger.isInfoEnabled()) {