*/
public BandwidthCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
DeviceDAO deviceDAO;
String name;
Device device;
PortsSelectorSNMP portsSNMP;
BandwidthSNMP bandwidthSNMP;
long pollInterval;
boolean prefer64BitCounters;
String[] ifDescriptions;
int[] ifIndicies;
name = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DEVICE, sessionID));
deviceDAO = DAOFactory.getDeviceDAO();
device = deviceDAO.retrieveDevice(name, false);
deviceDAO.closeConnection();
bandwidthSNMP = new BandwidthSNMP(device);
pollInterval = ((Long)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_POLLINTERVAL, sessionID))).longValue();
prefer64BitCounters = ((Byte)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_USE64BITCOUNTERS, sessionID))).intValue() == 1;
ifDescriptions = retrieveBandwidthCollectorPorts(sessionID);
portsSNMP = new PortsSelectorSNMP(device);
/*
portsSNMP.enumeratePorts();
ifIndicies = new int[ifDescriptions.length];
for ( int i = 0 ; i < portsSNMP.getPortsIndex().length ; i++ ) {
for ( int j = 0 ; j < ifDescriptions.length ; j++ ) {
if ( portsSNMP.getPortsDescr()[i].equals(ifDescriptions[j]) ) {
ifIndicies[j] = portsSNMP.getPortsIndex()[i];
}
}
}
*/
ifIndicies = portsSNMP.getIfIndexArray(ifDescriptions);
bandwidthSNMP = new BandwidthSNMP(device);
return new BandwidthCollector(bandwidthSNMP, pollInterval, ifIndicies, ifDescriptions, prefer64BitCounters);
}