| | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.server.MonitorProviderCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.MonitorData; |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryConfig; |
| | | import org.opends.server.types.ObjectClass; |
| | | |
| | |
| | | @Override |
| | | public MonitorData getMonitorData() |
| | | { |
| | | DN[] baseDNs = backend.getBaseDNs(); |
| | | Set<DN> baseDNs = backend.getBaseDNs(); |
| | | |
| | | MonitorData attrs = new MonitorData(6); |
| | | attrs.add(ATTR_MONITOR_BACKEND_ID, backend.getBackendID()); |
| | |
| | | return attrs; |
| | | } |
| | | |
| | | private Collection<String> getBackendEntryCounts(DN[] baseDNs) |
| | | private Collection<String> getBackendEntryCounts(Set<DN> baseDNs) |
| | | { |
| | | Collection<String> results = new ArrayList<>(); |
| | | if (baseDNs.length != 1) |
| | | if (baseDNs.size() == 1) |
| | | { |
| | | // This is done to avoid recalculating the number of entries |
| | | // using the numSubordinates method in the case where the |
| | | // backend has a single base DN. |
| | | results.add(backend.getEntryCount() + " " + baseDNs.iterator().next()); |
| | | } |
| | | else |
| | | { |
| | | for (DN dn : baseDNs) |
| | | { |
| | |
| | | results.add(entryCount + " " + dn); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // This is done to avoid recalculating the number of entries |
| | | // using the numSubordinates method in the case where the |
| | | // backend has a single base DN. |
| | | results.add(backend.getEntryCount() + " " + baseDNs[0]); |
| | | } |
| | | return results; |
| | | } |
| | | } |