| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.responses.SearchResultEntry; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.opends.guitools.controlpanel.util.ConfigFromDirContext; |
| | |
| | | import com.forgerock.opendj.util.OperatingSystem; |
| | | |
| | | import static org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes.*; |
| | | import static org.opends.guitools.controlpanel.util.Utilities.*; |
| | | import static org.opends.server.types.CommonSchemaElements.*; |
| | | |
| | | /** |
| | |
| | | private boolean isSchemaEnabled; |
| | | private Schema schema; |
| | | |
| | | private CustomSearchResult rootMonitor; |
| | | private CustomSearchResult jvmMemoryUsage; |
| | | private CustomSearchResult systemInformation; |
| | | private CustomSearchResult entryCaches; |
| | | private CustomSearchResult workQueue; |
| | | private SearchResultEntry rootMonitor; |
| | | private SearchResultEntry jvmMemoryUsage; |
| | | private SearchResultEntry systemInformation; |
| | | private SearchResultEntry entryCaches; |
| | | private SearchResultEntry workQueue; |
| | | |
| | | private Set<TaskEntry> taskEntries = new HashSet<>(); |
| | | |
| | |
| | | { |
| | | return OperatingSystem.isWindows(); |
| | | } |
| | | CustomSearchResult sr = getSystemInformationMonitor(); |
| | | SearchResultEntry sr = getSystemInformationMonitor(); |
| | | if (sr == null) |
| | | { |
| | | return false; |
| | | } |
| | | String os = getFirstValueAsString(sr, "operatingSystem"); |
| | | String os = sr.getAttribute("operatingSystem").firstValueAsString(); |
| | | return os != null && OperatingSystem.WINDOWS.equals(OperatingSystem.forName(os)); |
| | | } |
| | | |
| | |
| | | * Sets the monitoring entry for the entry caches. |
| | | * @param entryCaches the monitoring entry for the entry caches. |
| | | */ |
| | | public void setEntryCachesMonitor(CustomSearchResult entryCaches) |
| | | public void setEntryCachesMonitor(SearchResultEntry entryCaches) |
| | | { |
| | | this.entryCaches = entryCaches; |
| | | } |
| | |
| | | * Sets the monitoring entry for the JVM memory usage. |
| | | * @param jvmMemoryUsage the monitoring entry for the JVM memory usage. |
| | | */ |
| | | public void setJvmMemoryUsageMonitor(CustomSearchResult jvmMemoryUsage) |
| | | public void setJvmMemoryUsageMonitor(SearchResultEntry jvmMemoryUsage) |
| | | { |
| | | this.jvmMemoryUsage = jvmMemoryUsage; |
| | | } |
| | |
| | | * Sets the root entry of the monitoring tree. |
| | | * @param rootMonitor the root entry of the monitoring tree. |
| | | */ |
| | | public void setRootMonitor(CustomSearchResult rootMonitor) |
| | | public void setRootMonitor(SearchResultEntry rootMonitor) |
| | | { |
| | | this.rootMonitor = rootMonitor; |
| | | runningTime = computeRunningTime(rootMonitor); |
| | | } |
| | | |
| | | private long computeRunningTime(CustomSearchResult rootMonitor) |
| | | private long computeRunningTime(SearchResultEntry rootMonitor) |
| | | { |
| | | if (rootMonitor != null) |
| | | { |
| | | try |
| | | { |
| | | String start = getFirstValueAsString(rootMonitor, START_DATE.getAttributeName()); |
| | | String current = getFirstValueAsString(rootMonitor, CURRENT_DATE.getAttributeName()); |
| | | String start = rootMonitor.getAttribute(START_DATE.getAttributeName()).firstValueAsString(); |
| | | String current = rootMonitor.getAttribute(CURRENT_DATE.getAttributeName()).firstValueAsString(); |
| | | Date startTime = ConfigFromDirContext.utcParser.parse(start); |
| | | Date currentTime = ConfigFromDirContext.utcParser.parse(current); |
| | | return currentTime.getTime() - startTime.getTime(); |
| | |
| | | * Sets the monitoring entry for the system information. |
| | | * @param systemInformation entry for the system information. |
| | | */ |
| | | public void setSystemInformationMonitor(CustomSearchResult systemInformation) |
| | | public void setSystemInformationMonitor(SearchResultEntry systemInformation) |
| | | { |
| | | this.systemInformation = systemInformation; |
| | | } |
| | |
| | | * Sets the monitoring entry of the work queue. |
| | | * @param workQueue entry of the work queue. |
| | | */ |
| | | public void setWorkQueueMonitor(CustomSearchResult workQueue) |
| | | public void setWorkQueueMonitor(SearchResultEntry workQueue) |
| | | { |
| | | this.workQueue = workQueue; |
| | | } |
| | |
| | | * Returns the monitoring entry for the entry caches. |
| | | * @return the monitoring entry for the entry caches. |
| | | */ |
| | | public CustomSearchResult getEntryCachesMonitor() |
| | | public SearchResultEntry getEntryCachesMonitor() |
| | | { |
| | | return entryCaches; |
| | | } |
| | |
| | | * Returns the monitoring entry for the JVM memory usage. |
| | | * @return the monitoring entry for the JVM memory usage. |
| | | */ |
| | | public CustomSearchResult getJvmMemoryUsageMonitor() |
| | | public SearchResultEntry getJvmMemoryUsageMonitor() |
| | | { |
| | | return jvmMemoryUsage; |
| | | } |
| | |
| | | * Returns the root entry of the monitoring tree. |
| | | * @return the root entry of the monitoring tree. |
| | | */ |
| | | public CustomSearchResult getRootMonitor() |
| | | public SearchResultEntry getRootMonitor() |
| | | { |
| | | return rootMonitor; |
| | | } |
| | |
| | | * Returns the monitoring entry for the system information. |
| | | * @return the monitoring entry for the system information. |
| | | */ |
| | | public CustomSearchResult getSystemInformationMonitor() |
| | | public SearchResultEntry getSystemInformationMonitor() |
| | | { |
| | | return systemInformation; |
| | | } |
| | |
| | | * Returns the monitoring entry for the work queue. |
| | | * @return the monitoring entry for the work queue. |
| | | */ |
| | | public CustomSearchResult getWorkQueueMonitor() |
| | | public SearchResultEntry getWorkQueueMonitor() |
| | | { |
| | | return workQueue; |
| | | } |