use of org.opennms.netmgt.rtc.datablock.RTCHashMap in project opennms by OpenNMS.
the class DataManager method afterPropertiesSet.
/**
* Constructor. Parses categories from the categories.xml and populates them
* with 'RTCNode' objects created from data read from the database (services
* and outage tables)
*
* @exception SQLException
* if there is an error reading initial data from the
* database
* @exception FilterParseException
* if a rule in the categories.xml was incorrect
* @exception RTCException
* if the initialization/data reading does not go through
* @throws org.xml.sax.SAXException if any.
* @throws java.io.IOException if any.
* @throws java.sql.SQLException if any.
* @throws org.opennms.netmgt.filter.api.FilterParseException if any.
* @throws org.opennms.netmgt.rtc.RTCException if any.
*/
@Override
public void afterPropertiesSet() throws Exception {
// read the categories.xml to get all the categories
m_categories = RTCUtils.createCategoriesMap();
if (m_categories == null || m_categories.isEmpty()) {
throw new RTCException("No categories found in categories.xml");
}
LOG.debug("Number of categories read: {}", m_categories.size());
// create data holder
m_map = new RTCHashMap(30000);
m_transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus arg0) {
// Populate the nodes initially from the database
try {
populateNodesFromDB(null, null);
} catch (FilterParseException e) {
throw new IllegalStateException("Cannot load RTC data from the database: " + e.getMessage(), e);
} catch (SQLException e) {
throw new IllegalStateException("Cannot load RTC data from the database: " + e.getMessage(), e);
} catch (RTCException e) {
throw new IllegalStateException("Cannot load RTC data from the database: " + e.getMessage(), e);
}
}
});
}
Aggregations