1 14 package org.jmanage.core.modules.snmp; 15 16 import org.jmanage.core.management.ServerConnectionFactory; 17 import org.jmanage.core.management.ServerConnection; 18 import org.jmanage.core.management.ConnectionFailedException; 19 import org.jmanage.core.config.ApplicationConfig; 20 import snmp.SNMPv1CommunicationInterface; 21 22 import java.net.InetAddress ; 23 24 28 public class SNMPAgentConnectionFactory implements ServerConnectionFactory{ 29 30 36 public ServerConnection getServerConnection(ApplicationConfig config) 37 throws ConnectionFailedException { 38 try{ 39 InetAddress hostAddress = InetAddress.getByName(config.getHost()); 40 SNMPv1CommunicationInterface commIntf = 41 new SNMPv1CommunicationInterface(1, hostAddress, "public", 42 config.getPort().intValue()); 43 SNMPAgentConnection connection = new SNMPAgentConnection(commIntf); 44 return connection; 45 }catch(Throwable e){ 46 throw new ConnectionFailedException(e); 47 } 48 } 49 } 50 | Popular Tags |