/** * Constructor for StatsdConfig. * * @param castorConfig a {@link org.opennms.netmgt.config.statsd.StatisticsDaemonConfiguration} * object. */ public StatsdConfig(StatisticsDaemonConfiguration castorConfig) { m_castorConfig = castorConfig; for (org.opennms.netmgt.config.statsd.Report report : getCastorReports()) { Report r = new Report(); r.setName(report.getName()); r.setClassName(report.getClassName()); for (Parameter parameter : getParametersForReport(report)) { r.addParameter(parameter.getKey(), parameter.getValue()); } m_reports.add(r); } for (org.opennms.netmgt.config.statsd.Package pkg : getCastorPackages()) { StatsdPackage p = new StatsdPackage(); p.setName(pkg.getName()); p.setFilter(pkg.getFilter() != null ? pkg.getFilter().getContent() : null); for (org.opennms.netmgt.config.statsd.PackageReport packageReport : getPackageReportForPackage(pkg)) { PackageReport r = new PackageReport(); r.setPackage(p); try { r.setReport(loadReport(packageReport.getName())); } catch (DataAccessException e) { throw new ObjectRetrievalFailureException( "Could not get report named '" + packageReport.getName() + "' for package '" + pkg.getName() + "'", pkg.getName(), null, e); } r.setDescription(packageReport.getDescription()); r.setRetainInterval(Long.parseLong(packageReport.getRetainInterval())); r.setSchedule(packageReport.getSchedule()); r.setEnabled(packageReport.getStatus().equals(PackageReportStatusType.ON)); for (Parameter parameter : getParametersForPackageReport(packageReport)) { r.addParameter(parameter.getKey(), parameter.getValue()); } p.addReport(r); } m_packages.add(p); } }
private List<Parameter> getParametersForPackageReport( org.opennms.netmgt.config.statsd.PackageReport packageReport) { return packageReport.getParameterCollection(); }