public JmxDatacollectionConfig merge(JmxDatacollectionConfig other) { if (other == null) { return this; } // Overwrite the rrdRepository iff it's null if (_rrdRepository == null && other._rrdRepository != null) { _rrdRepository = other._rrdRepository; } // Merge the lists of collections getJmxCollectionList().addAll(other.getJmxCollectionList()); return this; } }
/** * Checks if the given <code>rawModel</code> is not null and does have * Mbeans (count can be 0, but not NULL). * * @param rawModel * @return true if valid, false otherwise */ private boolean isValid(JmxDatacollectionConfig rawModel) { return !(rawModel.getJmxCollectionList().isEmpty() || rawModel.getJmxCollectionList().get(0) == null || rawModel.getJmxCollectionList().get(0).getMbeans() == null); }
/** * Checks if the given <code>rawModel</code> is not null and does have * Mbeans (count can be 0, but not NULL). * * @param rawModel * @return true if valid, false otherwise */ private boolean isValid(JmxDatacollectionConfig rawModel) { return !(rawModel.getJmxCollectionList().isEmpty() || rawModel.getJmxCollectionList().get(0) == null || rawModel.getJmxCollectionList().get(0).getMbeans() == null); }
public Collection<Report> generateReportsByJmxDatacollectionConfig(JmxDatacollectionConfig inputConfig) { Collection<Report> reports = new ArrayList<>(); for (JmxCollection jmxCollection : inputConfig.getJmxCollectionList()) { logger.debug("jmxCollection: '{}'", jmxCollection.getName()); for (Mbean mbean : jmxCollection.getMbeans()) { reports.addAll(generateMbeanReportsByMBean(mbean)); reports.addAll(generateAttributeReportsByMBean(mbean)); reports.addAll(generateCompositeReportsByMBean(mbean)); reports.addAll(generateCompositeMemberReportsByMBean(mbean)); } } return reports; }
@Override public JmxDatacollectionConfig translateConfig(JmxDatacollectionConfig config) { for (JmxCollection collection : config.getJmxCollectionList()) { if (collection.hasImportMbeans()) { for (String importMbeans : collection.getImportGroupsList()) { final File file = getOpennmsHome().resolve(Paths.get("etc", importMbeans)).toFile(); LOG.debug("parseJmxMbeans: parsing {}", file); final Mbeans mbeans = JaxbUtils.unmarshal(Mbeans.class, new FileSystemResource(file)); collection.addMbeans(mbeans.getMbeanList()); } } } return config; }
for (JmxCollection collection : config.getJmxCollectionList()) {
public Collection<Report> generateReportsByJmxDatacollectionConfig(JmxDatacollectionConfig inputConfig) { Collection<Report> reports = new ArrayList<>(); for (JmxCollection jmxCollection : inputConfig.getJmxCollectionList()) { logger.debug("jmxCollection: '{}'", jmxCollection.getName()); for (Mbean mbean : jmxCollection.getMbeans()) { reports.addAll(generateMbeanReportsByMBean(mbean)); reports.addAll(generateAttributeReportsByMBean(mbean)); reports.addAll(generateCompositeReportsByMBean(mbean)); reports.addAll(generateCompositeMemberReportsByMBean(mbean)); } } return reports; }
public void updateDataSource(UiModel newModel) { reset(); mbeansContainer.updateDataSource(newModel.getRawModel().getJmxCollectionList().get(0).getMbeans()); mbeansTree.expandAllItems(); mbeansTree.select(mbeansContainer.firstItemId()); validate(); }
public void updateDataSource(UiModel newModel) { reset(); mbeansContainer.updateDataSource(newModel.getRawModel().getJmxCollectionList().get(0).getMbeans()); mbeansTree.expandAllItems(); mbeansTree.select(mbeansContainer.firstItemId()); validate(); }
/** * Clones a whole JmxCollectionConfig. Makes a deep copy! * * @param input * @return */ public static JmxDatacollectionConfig clone(JmxDatacollectionConfig input) { JmxDatacollectionConfig output = new JmxDatacollectionConfig(); output.setRrdRepository(input.getRrdRepository()); for (JmxCollection jmxCollection : input.getJmxCollectionList()) { output.addJmxCollection(clone(jmxCollection)); } return output; }
/** * Clones a whole JmxCollectionConfig. Makes a deep copy! * * @param input * @return */ public static JmxDatacollectionConfig clone(JmxDatacollectionConfig input) { JmxDatacollectionConfig output = new JmxDatacollectionConfig(); output.setRrdRepository(input.getRrdRepository()); for (JmxCollection jmxCollection : input.getJmxCollectionList()) { output.addJmxCollection(clone(jmxCollection)); } return output; }
final JmxCollection xmlJmxCollection = xmlJmxDatacollectionConfig.getJmxCollectionList().get(0);
final JmxCollection xmlJmxCollection = xmlJmxDatacollectionConfig.getJmxCollectionList().get(0);
/** * The generated values for the JMX datacollection may not be correct. In detail the name/alias fields * of MBeans/Attribs/CompMembers/CompAttribs may be too long or not unique in the whole JMX datacollection. * In order to keep the usability up, this method allows to filter values retrieved from the * {@link javax.management.MBeanServerConnection} to fix naming issues. * * @param config The {@link JmxDatacollectionConfig} retrieved from the {@link javax.management.MBeanServerConnection}. */ private void applyFilters(JmxDatacollectionConfig config) { for (Mbean eachMbean : config.getJmxCollectionList().get(0).getMbeans()) { applyFilters(eachMbean); for (Attrib eachAttrib : eachMbean.getAttribList()) { applyFilters(eachAttrib); } for (CompAttrib eachCompAttrib : eachMbean.getCompAttribList()) { applyFilters(eachCompAttrib); for (CompMember eachCompMember : eachCompAttrib.getCompMemberList()) { applyFilters(eachCompMember); } } } } }
/** * The generated values for the JMX datacollection may not be correct. In detail the name/alias fields * of MBeans/Attribs/CompMembers/CompAttribs may be too long or not unique in the whole JMX datacollection. * In order to keep the usability up, this method allows to filter values retrieved from the * {@link javax.management.MBeanServerConnection} to fix naming issues. * * @param config The {@link JmxDatacollectionConfig} retrieved from the {@link javax.management.MBeanServerConnection}. */ private void applyFilters(JmxDatacollectionConfig config) { for (Mbean eachMbean : config.getJmxCollectionList().get(0).getMbeans()) { applyFilters(eachMbean); for (Attrib eachAttrib : eachMbean.getAttribList()) { applyFilters(eachAttrib); } for (CompAttrib eachCompAttrib : eachMbean.getCompAttribList()) { applyFilters(eachCompAttrib); for (CompMember eachCompMember : eachCompAttrib.getCompMemberList()) { applyFilters(eachCompMember); } } } } }
List<Mbean> exportBeans = clone.getJmxCollectionList().get(0).getMbeans(); exportBeans.clear(); Iterable<Mbean> selectedMbeans = selectionManager.getSelectedMbeans(); clone.getJmxCollectionList().get(0).setName(uiModel.getServiceName()); return clone;
List<Mbean> exportBeans = clone.getJmxCollectionList().get(0).getMbeans(); exportBeans.clear(); Iterable<Mbean> selectedMbeans = selectionManager.getSelectedMbeans(); clone.getJmxCollectionList().get(0).setName(uiModel.getServiceName()); return clone;