001 /* 002 * Copyright 2008-2015 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005 /* 006 * Copyright (C) 2015 UnboundID Corp. 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021 package com.unboundid.ldap.sdk.unboundidds.monitors; 022 023 024 025 import java.util.ArrayList; 026 import java.util.Collections; 027 import java.util.List; 028 import java.util.logging.Level; 029 030 import com.unboundid.ldap.sdk.Entry; 031 import com.unboundid.ldap.sdk.Filter; 032 import com.unboundid.ldap.sdk.LDAPConnection; 033 import com.unboundid.ldap.sdk.LDAPInterface; 034 import com.unboundid.ldap.sdk.LDAPSearchException; 035 import com.unboundid.ldap.sdk.SearchResult; 036 import com.unboundid.ldap.sdk.SearchResultEntry; 037 import com.unboundid.ldap.sdk.SearchScope; 038 import com.unboundid.util.DebugType; 039 import com.unboundid.util.ThreadSafety; 040 import com.unboundid.util.ThreadSafetyLevel; 041 042 import static com.unboundid.util.Debug.*; 043 044 045 046 /** 047 * <BLOCKQUOTE> 048 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID 049 * LDAP SDK for Java. It is not available for use in applications that 050 * include only the Standard Edition of the LDAP SDK, and is not supported for 051 * use in conjunction with non-UnboundID products. 052 * </BLOCKQUOTE> 053 * This class provides a set of methods for retrieving Directory Server monitor 054 * entries. In particular, it provides methods for retrieving all monitor 055 * entries from the server, as well as retrieving monitor entries of specific 056 * types. 057 * <BR><BR> 058 * <H2>Example</H2> 059 * The following example demonstrates the process for retrieving all monitor 060 * entries published by the directory server and printing the information 061 * contained in each using the generic API for accessing monitor entry data: 062 * <PRE> 063 * List<MonitorEntry> allMonitorEntries = 064 * MonitorManager.getMonitorEntries(connection); 065 * for (MonitorEntry e : allMonitorEntries) 066 * { 067 * String monitorName = e.getMonitorName(); 068 * String displayName = e.getMonitorDisplayName(); 069 * Map<String,MonitorAttribute> monitorAttributes = 070 * e.getMonitorAttributes(); 071 * } 072 * </PRE> 073 */ 074 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 075 public final class MonitorManager 076 { 077 /** 078 * Prevent this class from being instantiated. 079 */ 080 private MonitorManager() 081 { 082 // No implementation is required. 083 } 084 085 086 087 /** 088 * Retrieves a list of all monitor entries available in the Directory Server. 089 * 090 * @param connection The connection to use to communicate with the Directory 091 * Server. 092 * 093 * @return A list of all monitor entries available in the Directory Server. 094 * 095 * @throws LDAPSearchException If a problem occurs while communicating with 096 * the Directory Server. 097 */ 098 public static List<MonitorEntry> getMonitorEntries( 099 final LDAPConnection connection) 100 throws LDAPSearchException 101 { 102 return getMonitorEntries((LDAPInterface) connection); 103 } 104 105 106 107 /** 108 * Retrieves a list of all monitor entries available in the Directory Server. 109 * 110 * @param connection The connection to use to communicate with the Directory 111 * Server. 112 * 113 * @return A list of all monitor entries available in the Directory Server. 114 * 115 * @throws LDAPSearchException If a problem occurs while communicating with 116 * the Directory Server. 117 */ 118 public static List<MonitorEntry> getMonitorEntries( 119 final LDAPInterface connection) 120 throws LDAPSearchException 121 { 122 final Filter filter = Filter.createEqualityFilter("objectClass", 123 MonitorEntry.GENERIC_MONITOR_OC); 124 125 final SearchResult searchResult = 126 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 127 filter); 128 129 final ArrayList<MonitorEntry> monitorEntries = 130 new ArrayList<MonitorEntry>(searchResult.getEntryCount()); 131 for (final SearchResultEntry e : searchResult.getSearchEntries()) 132 { 133 monitorEntries.add(MonitorEntry.decode(e)); 134 } 135 136 return Collections.unmodifiableList(monitorEntries); 137 } 138 139 140 141 /** 142 * Retrieves the general monitor entry from the Directory Server. 143 * 144 * @param connection The connection to use to communicate with the Directory 145 * Server. 146 * 147 * @return The general monitor entry from the Directory Server, or 148 * {@code null} if it is not available. 149 * 150 * @throws LDAPSearchException If a problem occurs while communicating with 151 * the Directory Server. 152 */ 153 public static GeneralMonitorEntry getGeneralMonitorEntry( 154 final LDAPConnection connection) 155 throws LDAPSearchException 156 { 157 return getGeneralMonitorEntry((LDAPInterface) connection); 158 } 159 160 161 162 /** 163 * Retrieves the general monitor entry from the Directory Server. 164 * 165 * @param connection The connection to use to communicate with the Directory 166 * Server. 167 * 168 * @return The general monitor entry from the Directory Server, or 169 * {@code null} if it is not available. 170 * 171 * @throws LDAPSearchException If a problem occurs while communicating with 172 * the Directory Server. 173 */ 174 public static GeneralMonitorEntry getGeneralMonitorEntry( 175 final LDAPInterface connection) 176 throws LDAPSearchException 177 { 178 final Filter filter = Filter.createPresenceFilter("objectClass"); 179 180 final SearchResult searchResult = 181 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.BASE, 182 filter); 183 184 final int numEntries = searchResult.getEntryCount(); 185 if (numEntries == 0) 186 { 187 debug(Level.FINE, DebugType.MONITOR, 188 "No entries returned in getGeneralMonitorEntry"); 189 190 return null; 191 } 192 193 return new GeneralMonitorEntry(searchResult.getSearchEntries().get(0)); 194 } 195 196 197 198 /** 199 * Retrieves the active operations monitor entry from the Directory Server. 200 * 201 * @param connection The connection to use to communicate with the Directory 202 * Server. 203 * 204 * @return The active operations monitor entry from the Directory Server, or 205 * {@code null} if it is not available. 206 * 207 * @throws LDAPSearchException If a problem occurs while communicating with 208 * the Directory Server. 209 */ 210 public static ActiveOperationsMonitorEntry 211 getActiveOperationsMonitorEntry( 212 final LDAPConnection connection) 213 throws LDAPSearchException 214 { 215 return getActiveOperationsMonitorEntry((LDAPInterface) connection); 216 } 217 218 219 220 /** 221 * Retrieves the active operations monitor entry from the Directory Server. 222 * 223 * @param connection The connection to use to communicate with the Directory 224 * Server. 225 * 226 * @return The active operations monitor entry from the Directory Server, or 227 * {@code null} if it is not available. 228 * 229 * @throws LDAPSearchException If a problem occurs while communicating with 230 * the Directory Server. 231 */ 232 public static ActiveOperationsMonitorEntry 233 getActiveOperationsMonitorEntry( 234 final LDAPInterface connection) 235 throws LDAPSearchException 236 { 237 final Filter filter = Filter.createEqualityFilter("objectClass", 238 ActiveOperationsMonitorEntry.ACTIVE_OPERATIONS_MONITOR_OC); 239 240 final SearchResult searchResult = 241 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 242 filter); 243 244 final int numEntries = searchResult.getEntryCount(); 245 if (numEntries == 0) 246 { 247 debug(Level.FINE, DebugType.MONITOR, 248 "No entries returned in getActiveOperationsMonitorEntry"); 249 250 return null; 251 } 252 else if (numEntries != 1) 253 { 254 debug(Level.FINE, DebugType.MONITOR, 255 "Multiple entries returned in getActiveOperationsMonitorEntry"); 256 } 257 258 return new ActiveOperationsMonitorEntry( 259 searchResult.getSearchEntries().get(0)); 260 } 261 262 263 264 /** 265 * Retrieves a list of all backend monitor entries available in the Directory 266 * Server. 267 * 268 * @param connection The connection to use to communicate with the Directory 269 * Server. 270 * 271 * @return A list of all backend monitor entries available in the Directory 272 * Server. 273 * 274 * @throws LDAPSearchException If a problem occurs while communicating with 275 * the Directory Server. 276 */ 277 public static List<BackendMonitorEntry> getBackendMonitorEntries( 278 final LDAPConnection connection) 279 throws LDAPSearchException 280 { 281 return getBackendMonitorEntries((LDAPInterface) connection); 282 } 283 284 285 286 /** 287 * Retrieves a list of all backend monitor entries available in the Directory 288 * Server. 289 * 290 * @param connection The connection to use to communicate with the Directory 291 * Server. 292 * 293 * @return A list of all backend monitor entries available in the Directory 294 * Server. 295 * 296 * @throws LDAPSearchException If a problem occurs while communicating with 297 * the Directory Server. 298 */ 299 public static List<BackendMonitorEntry> getBackendMonitorEntries( 300 final LDAPInterface connection) 301 throws LDAPSearchException 302 { 303 final Filter filter = Filter.createEqualityFilter("objectClass", 304 BackendMonitorEntry.BACKEND_MONITOR_OC); 305 306 final SearchResult searchResult = 307 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 308 filter); 309 310 final ArrayList<BackendMonitorEntry> monitorEntries = 311 new ArrayList<BackendMonitorEntry>(searchResult.getEntryCount()); 312 for (final SearchResultEntry e : searchResult.getSearchEntries()) 313 { 314 monitorEntries.add(new BackendMonitorEntry(e)); 315 } 316 317 return Collections.unmodifiableList(monitorEntries); 318 } 319 320 321 322 /** 323 * Retrieves the client connection monitor entry from the Directory Server. 324 * 325 * @param connection The connection to use to communicate with the Directory 326 * Server. 327 * 328 * @return The client connection monitor entry from the Directory Server, or 329 * {@code null} if it is not available. 330 * 331 * @throws LDAPSearchException If a problem occurs while communicating with 332 * the Directory Server. 333 */ 334 public static ClientConnectionMonitorEntry 335 getClientConnectionMonitorEntry( 336 final LDAPConnection connection) 337 throws LDAPSearchException 338 { 339 return getClientConnectionMonitorEntry((LDAPInterface) connection); 340 } 341 342 343 344 /** 345 * Retrieves the client connection monitor entry from the Directory Server. 346 * 347 * @param connection The connection to use to communicate with the Directory 348 * Server. 349 * 350 * @return The client connection monitor entry from the Directory Server, or 351 * {@code null} if it is not available. 352 * 353 * @throws LDAPSearchException If a problem occurs while communicating with 354 * the Directory Server. 355 */ 356 public static ClientConnectionMonitorEntry 357 getClientConnectionMonitorEntry( 358 final LDAPInterface connection) 359 throws LDAPSearchException 360 { 361 final Filter filter = Filter.createEqualityFilter("objectClass", 362 ClientConnectionMonitorEntry.CLIENT_CONNECTION_MONITOR_OC); 363 364 final SearchResult searchResult = 365 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 366 filter); 367 368 final int numEntries = searchResult.getEntryCount(); 369 if (numEntries == 0) 370 { 371 debug(Level.FINE, DebugType.MONITOR, 372 "No entries returned in getClientConnectionMonitorEntry"); 373 374 return null; 375 } 376 else if (numEntries != 1) 377 { 378 debug(Level.FINE, DebugType.MONITOR, 379 "Multiple entries returned in getClientConnectionMonitorEntry"); 380 } 381 382 return new ClientConnectionMonitorEntry( 383 searchResult.getSearchEntries().get(0)); 384 } 385 386 387 388 /** 389 * Retrieves a list of all connection handler monitor entries available in the 390 * Directory Server. 391 * 392 * @param connection The connection to use to communicate with the Directory 393 * Server. 394 * 395 * @return A list of all connection handler monitor entries available in the 396 * Directory Server. 397 * 398 * @throws LDAPSearchException If a problem occurs while communicating with 399 * the Directory Server. 400 */ 401 public static List<ConnectionHandlerMonitorEntry> 402 getConnectionHandlerMonitorEntries( 403 final LDAPConnection connection) 404 throws LDAPSearchException 405 { 406 return getConnectionHandlerMonitorEntries((LDAPInterface) connection); 407 } 408 409 410 411 /** 412 * Retrieves a list of all connection handler monitor entries available in the 413 * Directory Server. 414 * 415 * @param connection The connection to use to communicate with the Directory 416 * Server. 417 * 418 * @return A list of all connection handler monitor entries available in the 419 * Directory Server. 420 * 421 * @throws LDAPSearchException If a problem occurs while communicating with 422 * the Directory Server. 423 */ 424 public static List<ConnectionHandlerMonitorEntry> 425 getConnectionHandlerMonitorEntries( 426 final LDAPInterface connection) 427 throws LDAPSearchException 428 { 429 final Filter filter = Filter.createEqualityFilter("objectClass", 430 ConnectionHandlerMonitorEntry.CONNECTION_HANDLER_MONITOR_OC); 431 432 final SearchResult searchResult = 433 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 434 filter); 435 436 final ArrayList<ConnectionHandlerMonitorEntry> monitorEntries = 437 new ArrayList<ConnectionHandlerMonitorEntry>( 438 searchResult.getEntryCount()); 439 for (final SearchResultEntry e : searchResult.getSearchEntries()) 440 { 441 monitorEntries.add(new ConnectionHandlerMonitorEntry(e)); 442 } 443 444 return Collections.unmodifiableList(monitorEntries); 445 } 446 447 448 449 /** 450 * Retrieves the disk space usage monitor entry from the Directory Server. 451 * 452 * @param connection The connection to use to communicate with the Directory 453 * Server. 454 * 455 * @return The disk space usage monitor entry from the Directory Server, or 456 * {@code null} if it is not available. 457 * 458 * @throws LDAPSearchException If a problem occurs while communicating with 459 * the Directory Server. 460 */ 461 public static DiskSpaceUsageMonitorEntry getDiskSpaceUsageMonitorEntry( 462 final LDAPConnection connection) 463 throws LDAPSearchException 464 { 465 return getDiskSpaceUsageMonitorEntry((LDAPInterface) connection); 466 } 467 468 469 470 /** 471 * Retrieves the disk space usage monitor entry from the Directory Server. 472 * 473 * @param connection The connection to use to communicate with the Directory 474 * Server. 475 * 476 * @return The disk space usage monitor entry from the Directory Server, or 477 * {@code null} if it is not available. 478 * 479 * @throws LDAPSearchException If a problem occurs while communicating with 480 * the Directory Server. 481 */ 482 public static DiskSpaceUsageMonitorEntry getDiskSpaceUsageMonitorEntry( 483 final LDAPInterface connection) 484 throws LDAPSearchException 485 { 486 final Filter filter = Filter.createEqualityFilter("objectClass", 487 DiskSpaceUsageMonitorEntry.DISK_SPACE_USAGE_MONITOR_OC); 488 489 final SearchResult searchResult = 490 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 491 filter); 492 493 final int numEntries = searchResult.getEntryCount(); 494 if (numEntries == 0) 495 { 496 debug(Level.FINE, DebugType.MONITOR, 497 "No entries returned in getDiskSpaceUsageMonitorEntry"); 498 499 return null; 500 } 501 else if (numEntries != 1) 502 { 503 debug(Level.FINE, DebugType.MONITOR, 504 "Multiple entries returned in getDiskSpaceUsageMonitorEntry"); 505 } 506 507 return new DiskSpaceUsageMonitorEntry( 508 searchResult.getSearchEntries().get(0)); 509 } 510 511 512 513 /** 514 * Retrieves the entry cache monitor entry from the Directory Server. 515 * 516 * @param connection The connection to use to communicate with the Directory 517 * Server. 518 * 519 * @return The entry cache monitor entry from the Directory Server, or 520 * {@code null} if it is not available. 521 * 522 * @throws LDAPSearchException If a problem occurs while communicating with 523 * the Directory Server. 524 */ 525 public static EntryCacheMonitorEntry getEntryCacheMonitorEntry( 526 final LDAPConnection connection) 527 throws LDAPSearchException 528 { 529 return getEntryCacheMonitorEntry((LDAPInterface) connection); 530 } 531 532 533 534 /** 535 * Retrieves the entry cache monitor entry from the Directory Server. 536 * 537 * @param connection The connection to use to communicate with the Directory 538 * Server. 539 * 540 * @return The entry cache monitor entry from the Directory Server, or 541 * {@code null} if it is not available. 542 * 543 * @throws LDAPSearchException If a problem occurs while communicating with 544 * the Directory Server. 545 */ 546 public static EntryCacheMonitorEntry getEntryCacheMonitorEntry( 547 final LDAPInterface connection) 548 throws LDAPSearchException 549 { 550 final Filter filter = Filter.createEqualityFilter("objectClass", 551 EntryCacheMonitorEntry.ENTRY_CACHE_MONITOR_OC); 552 553 final SearchResult searchResult = 554 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 555 filter); 556 557 final int numEntries = searchResult.getEntryCount(); 558 if (numEntries == 0) 559 { 560 debug(Level.FINE, DebugType.MONITOR, 561 "No entries returned in getEntryCacheMonitorEntry"); 562 563 return null; 564 } 565 else if (numEntries != 1) 566 { 567 debug(Level.FINE, DebugType.MONITOR, 568 "Multiple entries returned in getEntryCacheMonitorEntry"); 569 } 570 571 return new EntryCacheMonitorEntry(searchResult.getSearchEntries().get(0)); 572 } 573 574 575 576 /** 577 * Retrieves the FIFO entry cache monitor entries from the Directory Server. 578 * 579 * @param connection The connection to use to communicate with the Directory 580 * Server. 581 * 582 * @return The entry cache monitor entry from the Directory Server, or 583 * {@code null} if it is not available. 584 * 585 * @throws LDAPSearchException If a problem occurs while communicating with 586 * the Directory Server. 587 */ 588 public static List<FIFOEntryCacheMonitorEntry> 589 getFIFOEntryCacheMonitorEntries(final LDAPConnection connection) 590 throws LDAPSearchException 591 { 592 return getFIFOEntryCacheMonitorEntries((LDAPInterface) connection); 593 } 594 595 596 597 /** 598 * Retrieves the FIFO entry cache monitor entries from the Directory Server. 599 * 600 * @param connection The connection to use to communicate with the Directory 601 * Server. 602 * 603 * @return The entry cache monitor entry from the Directory Server, or 604 * {@code null} if it is not available. 605 * 606 * @throws LDAPSearchException If a problem occurs while communicating with 607 * the Directory Server. 608 */ 609 public static List<FIFOEntryCacheMonitorEntry> 610 getFIFOEntryCacheMonitorEntries(final LDAPInterface connection) 611 throws LDAPSearchException 612 { 613 final Filter filter = Filter.createEqualityFilter("objectClass", 614 FIFOEntryCacheMonitorEntry.FIFO_ENTRY_CACHE_MONITOR_OC); 615 616 final SearchResult searchResult = 617 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 618 filter); 619 620 final ArrayList<FIFOEntryCacheMonitorEntry> monitorEntries = 621 new ArrayList<FIFOEntryCacheMonitorEntry>( 622 searchResult.getEntryCount()); 623 for (final SearchResultEntry e : searchResult.getSearchEntries()) 624 { 625 monitorEntries.add(new FIFOEntryCacheMonitorEntry(e)); 626 } 627 628 return Collections.unmodifiableList(monitorEntries); 629 } 630 631 632 633 /** 634 * Retrieves a list of all gauge monitor entries available in the Directory 635 * Server. This may include monitor entries for gauges of different types 636 * (e.g., numeric gauges and indicator gauges). 637 * 638 * @param connection The connection to use to communicate with the Directory 639 * Server. 640 * 641 * @return A list of all gauge monitor entries available in the Directory 642 * Server. 643 * 644 * @throws LDAPSearchException If a problem occurs while communicating with 645 * the Directory Server. 646 */ 647 public static List<GaugeMonitorEntry> getGaugeMonitorEntries( 648 final LDAPInterface connection) 649 throws LDAPSearchException 650 { 651 final Filter filter = Filter.createEqualityFilter("objectClass", 652 GaugeMonitorEntry.GAUGE_MONITOR_OC); 653 654 final SearchResult searchResult = 655 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 656 filter); 657 658 final ArrayList<GaugeMonitorEntry> monitorEntries = 659 new ArrayList<GaugeMonitorEntry>(searchResult.getEntryCount()); 660 for (final SearchResultEntry e : searchResult.getSearchEntries()) 661 { 662 try 663 { 664 monitorEntries.add((GaugeMonitorEntry) MonitorEntry.decode(e)); 665 } 666 catch (final Exception ex) 667 { 668 debugException(ex); 669 } 670 } 671 672 return Collections.unmodifiableList(monitorEntries); 673 } 674 675 676 677 /** 678 * Retrieves the group cache monitor entry from the Directory Server. 679 * 680 * @param connection The connection to use to communicate with the Directory 681 * Server. 682 * 683 * @return The group cache monitor entry from the Directory Server, or 684 * {@code null} if it is not available. 685 * 686 * @throws LDAPSearchException If a problem occurs while communicating with 687 * the Directory Server. 688 */ 689 public static GroupCacheMonitorEntry getGroupCacheMonitorEntry( 690 final LDAPInterface connection) 691 throws LDAPSearchException 692 { 693 final Filter filter = Filter.createEqualityFilter("objectClass", 694 GroupCacheMonitorEntry.GROUP_CACHE_MONITOR_OC); 695 696 final SearchResult searchResult = 697 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 698 filter); 699 700 final int numEntries = searchResult.getEntryCount(); 701 if (numEntries == 0) 702 { 703 debug(Level.FINE, DebugType.MONITOR, 704 "No entries returned in getGroupCacheMonitorEntry"); 705 706 return null; 707 } 708 else if (numEntries != 1) 709 { 710 debug(Level.FINE, DebugType.MONITOR, 711 "Multiple entries returned in getGroupCacheMonitorEntry"); 712 } 713 714 return new GroupCacheMonitorEntry(searchResult.getSearchEntries().get(0)); 715 } 716 717 718 719 /** 720 * Retrieves the host system recent CPU and memory monitor entry from the 721 * Directory Server. 722 * 723 * @param connection The connection to use to communicate with the Directory 724 * Server. 725 * 726 * @return The host system recent CPU and memory monitor entry from the 727 * Directory Server, or {@code null} if it is not available. 728 * 729 * @throws LDAPSearchException If a problem occurs while communicating with 730 * the Directory Server. 731 */ 732 public static HostSystemRecentCPUAndMemoryMonitorEntry 733 getHostSystemRecentCPUAndMemoryMonitorEntry( 734 final LDAPInterface connection) 735 throws LDAPSearchException 736 { 737 final Filter filter = Filter.createEqualityFilter("objectClass", 738 HostSystemRecentCPUAndMemoryMonitorEntry. 739 HOST_SYSTEM_RECENT_CPU_AND_MEMORY_MONITOR_OC); 740 741 final SearchResult searchResult = 742 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 743 filter); 744 745 final int numEntries = searchResult.getEntryCount(); 746 if (numEntries == 0) 747 { 748 debug(Level.FINE, DebugType.MONITOR, 749 "No entries returned in " + 750 "getHostSystemRecentCPUAndMemoryMonitorEntry"); 751 752 return null; 753 } 754 else if (numEntries != 1) 755 { 756 debug(Level.FINE, DebugType.MONITOR, 757 "Multiple entries returned in " + 758 "getHostSystemRecentCPUAndMemoryMonitorEntry"); 759 } 760 761 return new HostSystemRecentCPUAndMemoryMonitorEntry( 762 searchResult.getSearchEntries().get(0)); 763 } 764 765 766 767 /** 768 * Retrieves a list of all index monitor entries available in the Directory 769 * Server. 770 * 771 * @param connection The connection to use to communicate with the Directory 772 * Server. 773 * 774 * @return A list of all index monitor entries available in the Directory 775 * Server. 776 * 777 * @throws LDAPSearchException If a problem occurs while communicating with 778 * the Directory Server. 779 */ 780 public static List<IndexMonitorEntry> getIndexMonitorEntries( 781 final LDAPConnection connection) 782 throws LDAPSearchException 783 { 784 return getIndexMonitorEntries((LDAPInterface) connection); 785 } 786 787 788 789 /** 790 * Retrieves a list of all index monitor entries available in the Directory 791 * Server. 792 * 793 * @param connection The connection to use to communicate with the Directory 794 * Server. 795 * 796 * @return A list of all index monitor entries available in the Directory 797 * Server. 798 * 799 * @throws LDAPSearchException If a problem occurs while communicating with 800 * the Directory Server. 801 */ 802 public static List<IndexMonitorEntry> getIndexMonitorEntries( 803 final LDAPInterface connection) 804 throws LDAPSearchException 805 { 806 final Filter filter = Filter.createEqualityFilter("objectClass", 807 IndexMonitorEntry.INDEX_MONITOR_OC); 808 809 final SearchResult searchResult = 810 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 811 filter); 812 813 final ArrayList<IndexMonitorEntry> monitorEntries = 814 new ArrayList<IndexMonitorEntry>(searchResult.getEntryCount()); 815 for (final SearchResultEntry e : searchResult.getSearchEntries()) 816 { 817 monitorEntries.add(new IndexMonitorEntry(e)); 818 } 819 820 return Collections.unmodifiableList(monitorEntries); 821 } 822 823 824 825 /** 826 * Retrieves a list of all indicator gauge monitor entries available in the 827 * Directory Server. 828 * 829 * @param connection The connection to use to communicate with the Directory 830 * Server. 831 * 832 * @return A list of all indicator gauge monitor entries available in the 833 * Directory Server. 834 * 835 * @throws LDAPSearchException If a problem occurs while communicating with 836 * the Directory Server. 837 */ 838 public static List<IndicatorGaugeMonitorEntry> 839 getIndicatorGaugeMonitorEntries(final LDAPInterface connection) 840 throws LDAPSearchException 841 { 842 final Filter filter = Filter.createEqualityFilter("objectClass", 843 GaugeMonitorEntry.GAUGE_MONITOR_OC); 844 845 final SearchResult searchResult = 846 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 847 filter); 848 849 final ArrayList<IndicatorGaugeMonitorEntry> monitorEntries = 850 new ArrayList<IndicatorGaugeMonitorEntry>( 851 searchResult.getEntryCount()); 852 for (final SearchResultEntry e : searchResult.getSearchEntries()) 853 { 854 monitorEntries.add(new IndicatorGaugeMonitorEntry(e)); 855 } 856 857 return Collections.unmodifiableList(monitorEntries); 858 } 859 860 861 862 /** 863 * Retrieves a list of all JE environment monitor entries available in the 864 * Directory Server. 865 * 866 * @param connection The connection to use to communicate with the Directory 867 * Server. 868 * 869 * @return A list of all JE environment monitor entries available in the 870 * Directory Server. 871 * 872 * @throws LDAPSearchException If a problem occurs while communicating with 873 * the Directory Server. 874 */ 875 public static List<JEEnvironmentMonitorEntry> 876 getJEEnvironmentMonitorEntries( 877 final LDAPConnection connection) 878 throws LDAPSearchException 879 { 880 return getJEEnvironmentMonitorEntries((LDAPInterface) connection); 881 } 882 883 884 885 /** 886 * Retrieves a list of all JE environment monitor entries available in the 887 * Directory Server. 888 * 889 * @param connection The connection to use to communicate with the Directory 890 * Server. 891 * 892 * @return A list of all JE environment monitor entries available in the 893 * Directory Server. 894 * 895 * @throws LDAPSearchException If a problem occurs while communicating with 896 * the Directory Server. 897 */ 898 public static List<JEEnvironmentMonitorEntry> 899 getJEEnvironmentMonitorEntries( 900 final LDAPInterface connection) 901 throws LDAPSearchException 902 { 903 final Filter filter = Filter.createEqualityFilter("objectClass", 904 JEEnvironmentMonitorEntry.JE_ENVIRONMENT_MONITOR_OC); 905 906 final SearchResult searchResult = 907 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 908 filter); 909 910 final ArrayList<JEEnvironmentMonitorEntry> monitorEntries = 911 new ArrayList<JEEnvironmentMonitorEntry>(searchResult.getEntryCount()); 912 for (final SearchResultEntry e : searchResult.getSearchEntries()) 913 { 914 monitorEntries.add(new JEEnvironmentMonitorEntry(e)); 915 } 916 917 return Collections.unmodifiableList(monitorEntries); 918 } 919 920 921 922 /** 923 * Retrieves a list of all LDAP external server monitor entries available in 924 * the Directory Server. 925 * 926 * @param connection The connection to use to communicate with the Directory 927 * Server. 928 * 929 * @return A list of all LDAP external server monitor entries available in 930 * the Directory Server. 931 * 932 * @throws LDAPSearchException If a problem occurs while communicating with 933 * the Directory Server. 934 */ 935 public static List<LDAPExternalServerMonitorEntry> 936 getLDAPExternalServerMonitorEntries( 937 final LDAPConnection connection) 938 throws LDAPSearchException 939 { 940 return getLDAPExternalServerMonitorEntries((LDAPInterface) connection); 941 } 942 943 944 945 /** 946 * Retrieves a list of all LDAP external server monitor entries available in 947 * the Directory Server. 948 * 949 * @param connection The connection to use to communicate with the Directory 950 * Server. 951 * 952 * @return A list of all LDAP external server monitor entries available in 953 * the Directory Server. 954 * 955 * @throws LDAPSearchException If a problem occurs while communicating with 956 * the Directory Server. 957 */ 958 public static List<LDAPExternalServerMonitorEntry> 959 getLDAPExternalServerMonitorEntries( 960 final LDAPInterface connection) 961 throws LDAPSearchException 962 { 963 final Filter filter = Filter.createEqualityFilter("objectClass", 964 LDAPExternalServerMonitorEntry.LDAP_EXTERNAL_SERVER_MONITOR_OC); 965 966 final SearchResult searchResult = 967 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 968 filter); 969 970 final ArrayList<LDAPExternalServerMonitorEntry> monitorEntries = 971 new ArrayList<LDAPExternalServerMonitorEntry>( 972 searchResult.getEntryCount()); 973 for (final SearchResultEntry e : searchResult.getSearchEntries()) 974 { 975 monitorEntries.add(new LDAPExternalServerMonitorEntry(e)); 976 } 977 978 return Collections.unmodifiableList(monitorEntries); 979 } 980 981 982 983 /** 984 * Retrieves a list of all LDAP statistics monitor entries available in the 985 * Directory Server. 986 * 987 * @param connection The connection to use to communicate with the Directory 988 * Server. 989 * 990 * @return A list of all LDAP statistics monitor entries available in the 991 * Directory Server. 992 * 993 * @throws LDAPSearchException If a problem occurs while communicating with 994 * the Directory Server. 995 */ 996 public static List<LDAPStatisticsMonitorEntry> 997 getLDAPStatisticsMonitorEntries( 998 final LDAPConnection connection) 999 throws LDAPSearchException 1000 { 1001 return getLDAPStatisticsMonitorEntries((LDAPInterface) connection); 1002 } 1003 1004 1005 1006 /** 1007 * Retrieves a list of all LDAP statistics monitor entries available in the 1008 * Directory Server. 1009 * 1010 * @param connection The connection to use to communicate with the Directory 1011 * Server. 1012 * 1013 * @return A list of all LDAP statistics monitor entries available in the 1014 * Directory Server. 1015 * 1016 * @throws LDAPSearchException If a problem occurs while communicating with 1017 * the Directory Server. 1018 */ 1019 public static List<LDAPStatisticsMonitorEntry> 1020 getLDAPStatisticsMonitorEntries( 1021 final LDAPInterface connection) 1022 throws LDAPSearchException 1023 { 1024 final Filter filter = Filter.createEqualityFilter("objectClass", 1025 LDAPStatisticsMonitorEntry.LDAP_STATISTICS_MONITOR_OC); 1026 1027 final SearchResult searchResult = 1028 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1029 filter); 1030 1031 final ArrayList<LDAPStatisticsMonitorEntry> monitorEntries = 1032 new ArrayList<LDAPStatisticsMonitorEntry>( 1033 searchResult.getEntryCount()); 1034 for (final SearchResultEntry e : searchResult.getSearchEntries()) 1035 { 1036 monitorEntries.add(new LDAPStatisticsMonitorEntry(e)); 1037 } 1038 1039 return Collections.unmodifiableList(monitorEntries); 1040 } 1041 1042 1043 1044 /** 1045 * Retrieves a list of all load-balancing algorithm monitor entries available 1046 * in the Directory Proxy Server. 1047 * 1048 * @param connection The connection to use to communicate with the Directory 1049 * Proxy Server. 1050 * 1051 * @return A list of all load-balancing algorithm monitor entries available 1052 * in the Directory Proxy Server. 1053 * 1054 * @throws LDAPSearchException If a problem occurs while communicating with 1055 * the Directory Proxy Server. 1056 */ 1057 public static List<LoadBalancingAlgorithmMonitorEntry> 1058 getLoadBalancingAlgorithmMonitorEntries( 1059 final LDAPConnection connection) 1060 throws LDAPSearchException 1061 { 1062 return getLoadBalancingAlgorithmMonitorEntries((LDAPInterface) connection); 1063 } 1064 1065 1066 1067 /** 1068 * Retrieves a list of all load-balancing algorithm monitor entries available 1069 * in the Directory Proxy Server. 1070 * 1071 * @param connection The connection to use to communicate with the Directory 1072 * Proxy Server. 1073 * 1074 * @return A list of all load-balancing algorithm monitor entries available 1075 * in the Directory Proxy Server. 1076 * 1077 * @throws LDAPSearchException If a problem occurs while communicating with 1078 * the Directory Proxy Server. 1079 */ 1080 public static List<LoadBalancingAlgorithmMonitorEntry> 1081 getLoadBalancingAlgorithmMonitorEntries( 1082 final LDAPInterface connection) 1083 throws LDAPSearchException 1084 { 1085 final Filter filter = Filter.createEqualityFilter("objectClass", 1086 LoadBalancingAlgorithmMonitorEntry. 1087 LOAD_BALANCING_ALGORITHM_MONITOR_OC); 1088 1089 final SearchResult searchResult = 1090 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1091 filter); 1092 1093 final ArrayList<LoadBalancingAlgorithmMonitorEntry> monitorEntries = 1094 new ArrayList<LoadBalancingAlgorithmMonitorEntry>( 1095 searchResult.getEntryCount()); 1096 for (final SearchResultEntry e : searchResult.getSearchEntries()) 1097 { 1098 monitorEntries.add(new LoadBalancingAlgorithmMonitorEntry(e)); 1099 } 1100 1101 return Collections.unmodifiableList(monitorEntries); 1102 } 1103 1104 1105 1106 /** 1107 * Retrieves the memory usage monitor entry from the Directory Server. 1108 * 1109 * @param connection The connection to use to communicate with the Directory 1110 * Server. 1111 * 1112 * @return The memory usage monitor entry from the Directory Server, or 1113 * {@code null} if it is not available. 1114 * 1115 * @throws LDAPSearchException If a problem occurs while communicating with 1116 * the Directory Server. 1117 */ 1118 public static MemoryUsageMonitorEntry getMemoryUsageMonitorEntry( 1119 final LDAPConnection connection) 1120 throws LDAPSearchException 1121 { 1122 return getMemoryUsageMonitorEntry((LDAPInterface) connection); 1123 } 1124 1125 1126 1127 /** 1128 * Retrieves the memory usage monitor entry from the Directory Server. 1129 * 1130 * @param connection The connection to use to communicate with the Directory 1131 * Server. 1132 * 1133 * @return The memory usage monitor entry from the Directory Server, or 1134 * {@code null} if it is not available. 1135 * 1136 * @throws LDAPSearchException If a problem occurs while communicating with 1137 * the Directory Server. 1138 */ 1139 public static MemoryUsageMonitorEntry getMemoryUsageMonitorEntry( 1140 final LDAPInterface connection) 1141 throws LDAPSearchException 1142 { 1143 final Filter filter = Filter.createEqualityFilter("objectClass", 1144 MemoryUsageMonitorEntry.MEMORY_USAGE_MONITOR_OC); 1145 1146 final SearchResult searchResult = 1147 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1148 filter); 1149 1150 final int numEntries = searchResult.getEntryCount(); 1151 if (numEntries == 0) 1152 { 1153 debug(Level.FINE, DebugType.MONITOR, 1154 "No entries returned in getMemoryUsageMonitorEntry"); 1155 1156 return null; 1157 } 1158 else if (numEntries != 1) 1159 { 1160 debug(Level.FINE, DebugType.MONITOR, 1161 "Multiple entries returned in getMemoryUsageMonitorEntry"); 1162 } 1163 1164 return new MemoryUsageMonitorEntry(searchResult.getSearchEntries().get(0)); 1165 } 1166 1167 1168 1169 /** 1170 * Retrieves a list of all numeric gauge monitor entries available in the 1171 * Directory Server. 1172 * 1173 * @param connection The connection to use to communicate with the Directory 1174 * Server. 1175 * 1176 * @return A list of all numeric gauge monitor entries available in the 1177 * Directory Server. 1178 * 1179 * @throws LDAPSearchException If a problem occurs while communicating with 1180 * the Directory Server. 1181 */ 1182 public static List<NumericGaugeMonitorEntry> 1183 getNumericGaugeMonitorEntries(final LDAPInterface connection) 1184 throws LDAPSearchException 1185 { 1186 final Filter filter = Filter.createEqualityFilter("objectClass", 1187 GaugeMonitorEntry.GAUGE_MONITOR_OC); 1188 1189 final SearchResult searchResult = 1190 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1191 filter); 1192 1193 final ArrayList<NumericGaugeMonitorEntry> monitorEntries = 1194 new ArrayList<NumericGaugeMonitorEntry>( 1195 searchResult.getEntryCount()); 1196 for (final SearchResultEntry e : searchResult.getSearchEntries()) 1197 { 1198 monitorEntries.add(new NumericGaugeMonitorEntry(e)); 1199 } 1200 1201 return Collections.unmodifiableList(monitorEntries); 1202 } 1203 1204 1205 1206 /** 1207 * Retrieves the per application processing time histogram monitor entries 1208 * from the Directory Server. 1209 * 1210 * @param connection The connection to use to communicate with the Directory 1211 * Server. 1212 * 1213 * @return The per application processing time histogram monitor entries from 1214 * the Directory Server. If none are available, an empty list is 1215 * returned. 1216 * 1217 * @throws LDAPSearchException If a problem occurs while communicating with 1218 * the Directory Server. 1219 */ 1220 public static List<PerApplicationProcessingTimeHistogramMonitorEntry> 1221 getPerApplicationProcessingTimeHistogramMonitorEntries( 1222 final LDAPConnection connection) 1223 throws LDAPSearchException 1224 { 1225 return getPerApplicationProcessingTimeHistogramMonitorEntries( 1226 (LDAPInterface) connection); 1227 } 1228 1229 1230 1231 /** 1232 * Retrieves the per application processing time histogram monitor entries 1233 * from the Directory Server. 1234 * 1235 * @param connection The connection to use to communicate with the Directory 1236 * Server. 1237 * 1238 * @return The per application processing time histogram monitor entries from 1239 * the Directory Server. If none are available, an empty list is 1240 * returned. 1241 * 1242 * @throws LDAPSearchException If a problem occurs while communicating with 1243 * the Directory Server. 1244 */ 1245 public static List<PerApplicationProcessingTimeHistogramMonitorEntry> 1246 getPerApplicationProcessingTimeHistogramMonitorEntries( 1247 final LDAPInterface connection) 1248 throws LDAPSearchException 1249 { 1250 final Filter filter = Filter.createEqualityFilter("objectClass", 1251 PerApplicationProcessingTimeHistogramMonitorEntry. 1252 PER_APPLICATION_PROCESSING_TIME_HISTOGRAM_MONITOR_OC); 1253 1254 final SearchResult searchResult = 1255 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1256 filter); 1257 1258 final int numEntries = searchResult.getEntryCount(); 1259 if (numEntries == 0) 1260 { 1261 debug(Level.FINE, DebugType.MONITOR, 1262 "No entries returned in " + 1263 "getPerApplicationProcessingTimeHistogramMonitorEntries"); 1264 1265 return Collections.emptyList(); 1266 } 1267 1268 List<PerApplicationProcessingTimeHistogramMonitorEntry> monitorEntries = 1269 new ArrayList<PerApplicationProcessingTimeHistogramMonitorEntry>(); 1270 1271 for (Entry entry: searchResult.getSearchEntries()) 1272 { 1273 monitorEntries.add( 1274 new PerApplicationProcessingTimeHistogramMonitorEntry(entry)); 1275 } 1276 1277 1278 return monitorEntries; 1279 } 1280 1281 1282 1283 /** 1284 * Retrieves the processing time histogram monitor entry from the Directory 1285 * Server. 1286 * 1287 * @param connection The connection to use to communicate with the Directory 1288 * Server. 1289 * 1290 * @return The processing time histogram monitor entry from the Directory 1291 * Server, or {@code null} if it is not available. 1292 * 1293 * @throws LDAPSearchException If a problem occurs while communicating with 1294 * the Directory Server. 1295 */ 1296 public static ProcessingTimeHistogramMonitorEntry 1297 getProcessingTimeHistogramMonitorEntry( 1298 final LDAPConnection connection) 1299 throws LDAPSearchException 1300 { 1301 return getProcessingTimeHistogramMonitorEntry((LDAPInterface) connection); 1302 } 1303 1304 1305 1306 /** 1307 * Retrieves the processing time histogram monitor entry from the Directory 1308 * Server. 1309 * 1310 * @param connection The connection to use to communicate with the Directory 1311 * Server. 1312 * 1313 * @return The processing time histogram monitor entry from the Directory 1314 * Server, or {@code null} if it is not available. 1315 * 1316 * @throws LDAPSearchException If a problem occurs while communicating with 1317 * the Directory Server. 1318 */ 1319 public static ProcessingTimeHistogramMonitorEntry 1320 getProcessingTimeHistogramMonitorEntry( 1321 final LDAPInterface connection) 1322 throws LDAPSearchException 1323 { 1324 final Filter filter = Filter.createEqualityFilter("objectClass", 1325 ProcessingTimeHistogramMonitorEntry. 1326 PROCESSING_TIME_HISTOGRAM_MONITOR_OC); 1327 1328 final SearchResult searchResult = 1329 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1330 filter); 1331 1332 final int numEntries = searchResult.getEntryCount(); 1333 if (numEntries == 0) 1334 { 1335 debug(Level.FINE, DebugType.MONITOR, 1336 "No entries returned in getProcessingTimeHistogramMonitorEntry"); 1337 1338 return null; 1339 } 1340 else if (numEntries != 1) 1341 { 1342 debug(Level.FINE, DebugType.MONITOR, 1343 "Multiple entries returned in " + 1344 "getProcessingTimeHistogramMonitorEntry"); 1345 } 1346 1347 return new ProcessingTimeHistogramMonitorEntry( 1348 searchResult.getSearchEntries().get(0)); 1349 } 1350 1351 1352 1353 /** 1354 * Retrieves a list of all replica monitor entries available in the Directory 1355 * Server. 1356 * 1357 * @param connection The connection to use to communicate with the Directory 1358 * Server. 1359 * 1360 * @return A list of all replica monitor entries available in the Directory 1361 * Server. 1362 * 1363 * @throws LDAPSearchException If a problem occurs while communicating with 1364 * the Directory Server. 1365 */ 1366 public static List<ReplicaMonitorEntry> getReplicaMonitorEntries( 1367 final LDAPConnection connection) 1368 throws LDAPSearchException 1369 { 1370 return getReplicaMonitorEntries((LDAPInterface) connection); 1371 } 1372 1373 1374 1375 /** 1376 * Retrieves a list of all replica monitor entries available in the Directory 1377 * Server. 1378 * 1379 * @param connection The connection to use to communicate with the Directory 1380 * Server. 1381 * 1382 * @return A list of all replica monitor entries available in the Directory 1383 * Server. 1384 * 1385 * @throws LDAPSearchException If a problem occurs while communicating with 1386 * the Directory Server. 1387 */ 1388 public static List<ReplicaMonitorEntry> getReplicaMonitorEntries( 1389 final LDAPInterface connection) 1390 throws LDAPSearchException 1391 { 1392 final Filter filter = Filter.createEqualityFilter("objectClass", 1393 ReplicaMonitorEntry.REPLICA_MONITOR_OC); 1394 1395 final SearchResult searchResult = 1396 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1397 filter); 1398 1399 final ArrayList<ReplicaMonitorEntry> monitorEntries = 1400 new ArrayList<ReplicaMonitorEntry>( 1401 searchResult.getEntryCount()); 1402 for (final SearchResultEntry e : searchResult.getSearchEntries()) 1403 { 1404 monitorEntries.add(new ReplicaMonitorEntry(e)); 1405 } 1406 1407 return Collections.unmodifiableList(monitorEntries); 1408 } 1409 1410 1411 1412 /** 1413 * Retrieves the replication server monitor entry from the Directory Server. 1414 * 1415 * @param connection The connection to use to communicate with the Directory 1416 * Server. 1417 * 1418 * @return The replication server monitor entry from the Directory Server, or 1419 * {@code null} if it is not available. 1420 * 1421 * @throws LDAPSearchException If a problem occurs while communicating with 1422 * the Directory Server. 1423 */ 1424 public static ReplicationServerMonitorEntry getReplicationServerMonitorEntry( 1425 final LDAPConnection connection) 1426 throws LDAPSearchException 1427 { 1428 return getReplicationServerMonitorEntry((LDAPInterface) connection); 1429 } 1430 1431 1432 1433 /** 1434 * Retrieves the replication server monitor entry from the Directory Server. 1435 * 1436 * @param connection The connection to use to communicate with the Directory 1437 * Server. 1438 * 1439 * @return The replication server monitor entry from the Directory Server, or 1440 * {@code null} if it is not available. 1441 * 1442 * @throws LDAPSearchException If a problem occurs while communicating with 1443 * the Directory Server. 1444 */ 1445 public static ReplicationServerMonitorEntry getReplicationServerMonitorEntry( 1446 final LDAPInterface connection) 1447 throws LDAPSearchException 1448 { 1449 final Filter filter = Filter.createEqualityFilter("objectClass", 1450 ReplicationServerMonitorEntry.REPLICATION_SERVER_MONITOR_OC); 1451 1452 final SearchResult searchResult = 1453 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1454 filter); 1455 1456 final int numEntries = searchResult.getEntryCount(); 1457 if (numEntries == 0) 1458 { 1459 debug(Level.FINE, DebugType.MONITOR, 1460 "No entries returned in getReplicationServerMonitorEntry"); 1461 1462 return null; 1463 } 1464 else if (numEntries != 1) 1465 { 1466 debug(Level.FINE, DebugType.MONITOR, 1467 "Multiple entries returned in " + 1468 "getReplicationServerMonitorEntry"); 1469 } 1470 1471 return new ReplicationServerMonitorEntry( 1472 searchResult.getSearchEntries().get(0)); 1473 } 1474 1475 1476 1477 /** 1478 * Retrieves a list of all replication summary monitor entries available in 1479 * the Directory Server. 1480 * 1481 * @param connection The connection to use to communicate with the Directory 1482 * Server. 1483 * 1484 * @return A list of all replication summary monitor entries available in the 1485 * Directory Server. 1486 * 1487 * @throws LDAPSearchException If a problem occurs while communicating with 1488 * the Directory Server. 1489 */ 1490 public static List<ReplicationSummaryMonitorEntry> 1491 getReplicationSummaryMonitorEntries( 1492 final LDAPConnection connection) 1493 throws LDAPSearchException 1494 { 1495 return getReplicationSummaryMonitorEntries((LDAPInterface) connection); 1496 } 1497 1498 1499 1500 /** 1501 * Retrieves a list of all replication summary monitor entries available in 1502 * the Directory Server. 1503 * 1504 * @param connection The connection to use to communicate with the Directory 1505 * Server. 1506 * 1507 * @return A list of all replication summary monitor entries available in the 1508 * Directory Server. 1509 * 1510 * @throws LDAPSearchException If a problem occurs while communicating with 1511 * the Directory Server. 1512 */ 1513 public static List<ReplicationSummaryMonitorEntry> 1514 getReplicationSummaryMonitorEntries( 1515 final LDAPInterface connection) 1516 throws LDAPSearchException 1517 { 1518 final Filter filter = Filter.createEqualityFilter("objectClass", 1519 ReplicationSummaryMonitorEntry.REPLICATION_SUMMARY_MONITOR_OC); 1520 1521 final SearchResult searchResult = 1522 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1523 filter); 1524 1525 final ArrayList<ReplicationSummaryMonitorEntry> monitorEntries = 1526 new ArrayList<ReplicationSummaryMonitorEntry>( 1527 searchResult.getEntryCount()); 1528 for (final SearchResultEntry e : searchResult.getSearchEntries()) 1529 { 1530 monitorEntries.add(new ReplicationSummaryMonitorEntry(e)); 1531 } 1532 1533 return Collections.unmodifiableList(monitorEntries); 1534 } 1535 1536 1537 1538 /** 1539 * Retrieves the result code monitor entry from the Directory Server. 1540 * 1541 * @param connection The connection to use to communicate with the Directory 1542 * Server. 1543 * 1544 * @return The result code monitor entry from the Directory Server, or 1545 * {@code null} if it is not available. 1546 * 1547 * @throws LDAPSearchException If a problem occurs while communicating with 1548 * the Directory Server. 1549 */ 1550 public static ResultCodeMonitorEntry getResultCodeMonitorEntry( 1551 final LDAPInterface connection) 1552 throws LDAPSearchException 1553 { 1554 final Filter filter = Filter.createEqualityFilter("objectClass", 1555 ResultCodeMonitorEntry.RESULT_CODE_MONITOR_OC); 1556 1557 final SearchResult searchResult = connection.search( 1558 MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, filter); 1559 1560 final int numEntries = searchResult.getEntryCount(); 1561 if (numEntries == 0) 1562 { 1563 debug(Level.FINE, DebugType.MONITOR, 1564 "No entries returned in getResultCodeMonitorEntry"); 1565 1566 return null; 1567 } 1568 else if (numEntries != 1) 1569 { 1570 debug(Level.FINE, DebugType.MONITOR, 1571 "Multiple entries returned in getResultCodeMonitorEntry"); 1572 } 1573 1574 return new ResultCodeMonitorEntry(searchResult.getSearchEntries().get(0)); 1575 } 1576 1577 1578 1579 /** 1580 * Retrieves the system info monitor entry from the Directory Server. 1581 * 1582 * @param connection The connection to use to communicate with the Directory 1583 * Server. 1584 * 1585 * @return The system info monitor entry from the Directory Server, or 1586 * {@code null} if it is not available. 1587 * 1588 * @throws LDAPSearchException If a problem occurs while communicating with 1589 * the Directory Server. 1590 */ 1591 public static SystemInfoMonitorEntry getSystemInfoMonitorEntry( 1592 final LDAPConnection connection) 1593 throws LDAPSearchException 1594 { 1595 return getSystemInfoMonitorEntry((LDAPInterface) connection); 1596 } 1597 1598 1599 1600 /** 1601 * Retrieves the system info monitor entry from the Directory Server. 1602 * 1603 * @param connection The connection to use to communicate with the Directory 1604 * Server. 1605 * 1606 * @return The system info monitor entry from the Directory Server, or 1607 * {@code null} if it is not available. 1608 * 1609 * @throws LDAPSearchException If a problem occurs while communicating with 1610 * the Directory Server. 1611 */ 1612 public static SystemInfoMonitorEntry getSystemInfoMonitorEntry( 1613 final LDAPInterface connection) 1614 throws LDAPSearchException 1615 { 1616 final Filter filter = Filter.createEqualityFilter("objectClass", 1617 SystemInfoMonitorEntry.SYSTEM_INFO_MONITOR_OC); 1618 1619 final SearchResult searchResult = 1620 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1621 filter); 1622 1623 final int numEntries = searchResult.getEntryCount(); 1624 if (numEntries == 0) 1625 { 1626 debug(Level.FINE, DebugType.MONITOR, 1627 "No entries returned in getSystemInfoMonitorEntry"); 1628 1629 return null; 1630 } 1631 else if (numEntries != 1) 1632 { 1633 debug(Level.FINE, DebugType.MONITOR, 1634 "Multiple entries returned in getSystemInfoMonitorEntry"); 1635 } 1636 1637 return new SystemInfoMonitorEntry(searchResult.getSearchEntries().get(0)); 1638 } 1639 1640 1641 1642 /** 1643 * Retrieves the stack trace monitor entry from the Directory Server. 1644 * 1645 * @param connection The connection to use to communicate with the Directory 1646 * Server. 1647 * 1648 * @return The stack trace monitor entry from the Directory Server, or 1649 * {@code null} if it is not available. 1650 * 1651 * @throws LDAPSearchException If a problem occurs while communicating with 1652 * the Directory Server. 1653 */ 1654 public static StackTraceMonitorEntry getStackTraceMonitorEntry( 1655 final LDAPConnection connection) 1656 throws LDAPSearchException 1657 { 1658 return getStackTraceMonitorEntry((LDAPInterface) connection); 1659 } 1660 1661 1662 1663 /** 1664 * Retrieves the stack trace monitor entry from the Directory Server. 1665 * 1666 * @param connection The connection to use to communicate with the Directory 1667 * Server. 1668 * 1669 * @return The stack trace monitor entry from the Directory Server, or 1670 * {@code null} if it is not available. 1671 * 1672 * @throws LDAPSearchException If a problem occurs while communicating with 1673 * the Directory Server. 1674 */ 1675 public static StackTraceMonitorEntry getStackTraceMonitorEntry( 1676 final LDAPInterface connection) 1677 throws LDAPSearchException 1678 { 1679 final Filter filter = Filter.createEqualityFilter("objectClass", 1680 StackTraceMonitorEntry.STACK_TRACE_MONITOR_OC); 1681 1682 final SearchResult searchResult = 1683 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1684 filter); 1685 1686 final int numEntries = searchResult.getEntryCount(); 1687 if (numEntries == 0) 1688 { 1689 debug(Level.FINE, DebugType.MONITOR, 1690 "No entries returned in getStackTraceMonitorEntry"); 1691 1692 return null; 1693 } 1694 else if (numEntries != 1) 1695 { 1696 debug(Level.FINE, DebugType.MONITOR, 1697 "Multiple entries returned in getStackTraceMonitorEntry"); 1698 } 1699 1700 return new StackTraceMonitorEntry(searchResult.getSearchEntries().get(0)); 1701 } 1702 1703 1704 1705 /** 1706 * Retrieves the traditional work queue monitor entry from the Directory 1707 * Server. 1708 * 1709 * @param connection The connection to use to communicate with the Directory 1710 * Server. 1711 * 1712 * @return The traditional work queue monitor entry from the Directory 1713 * Server, or {@code null} if it is not available. 1714 * 1715 * @throws LDAPSearchException If a problem occurs while communicating with 1716 * the Directory Server. 1717 */ 1718 public static TraditionalWorkQueueMonitorEntry 1719 getTraditionalWorkQueueMonitorEntry(final LDAPConnection connection) 1720 throws LDAPSearchException 1721 { 1722 return getTraditionalWorkQueueMonitorEntry((LDAPInterface) connection); 1723 } 1724 1725 1726 1727 /** 1728 * Retrieves the traditional work queue monitor entry from the Directory 1729 * Server. 1730 * 1731 * @param connection The connection to use to communicate with the Directory 1732 * Server. 1733 * 1734 * @return The traditional work queue monitor entry from the Directory 1735 * Server, or {@code null} if it is not available. 1736 * 1737 * @throws LDAPSearchException If a problem occurs while communicating with 1738 * the Directory Server. 1739 */ 1740 public static TraditionalWorkQueueMonitorEntry 1741 getTraditionalWorkQueueMonitorEntry(final LDAPInterface connection) 1742 throws LDAPSearchException 1743 { 1744 final Filter filter = Filter.createEqualityFilter("objectClass", 1745 TraditionalWorkQueueMonitorEntry.TRADITIONAL_WORK_QUEUE_MONITOR_OC); 1746 1747 final SearchResult searchResult = 1748 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1749 filter); 1750 1751 final int numEntries = searchResult.getEntryCount(); 1752 if (numEntries == 0) 1753 { 1754 debug(Level.FINE, DebugType.MONITOR, 1755 "No entries returned in getTraditionalWorkQueueMonitorEntry"); 1756 1757 return null; 1758 } 1759 else if (numEntries != 1) 1760 { 1761 debug(Level.FINE, DebugType.MONITOR, 1762 "Multiple entries returned in getTraditionalWorkQueueMonitorEntry"); 1763 } 1764 1765 return new TraditionalWorkQueueMonitorEntry( 1766 searchResult.getSearchEntries().get(0)); 1767 } 1768 1769 1770 1771 /** 1772 * Retrieves the UnboundID work queue monitor entry from the Directory Server. 1773 * 1774 * @param connection The connection to use to communicate with the Directory 1775 * Server. 1776 * 1777 * @return The UnboundID work queue monitor entry from the Directory Server, 1778 * or {@code null} if it is not available. 1779 * 1780 * @throws LDAPSearchException If a problem occurs while communicating with 1781 * the Directory Server. 1782 */ 1783 public static UnboundIDWorkQueueMonitorEntry 1784 getUnboundIDWorkQueueMonitorEntry(final LDAPConnection connection) 1785 throws LDAPSearchException 1786 { 1787 return getUnboundIDWorkQueueMonitorEntry((LDAPInterface) connection); 1788 } 1789 1790 1791 1792 /** 1793 * Retrieves the UnboundID work queue monitor entry from the Directory Server. 1794 * 1795 * @param connection The connection to use to communicate with the Directory 1796 * Server. 1797 * 1798 * @return The UnboundID work queue monitor entry from the Directory Server, 1799 * or {@code null} if it is not available. 1800 * 1801 * @throws LDAPSearchException If a problem occurs while communicating with 1802 * the Directory Server. 1803 */ 1804 public static UnboundIDWorkQueueMonitorEntry 1805 getUnboundIDWorkQueueMonitorEntry(final LDAPInterface connection) 1806 throws LDAPSearchException 1807 { 1808 final Filter filter = Filter.createEqualityFilter("objectClass", 1809 UnboundIDWorkQueueMonitorEntry.UNBOUNDID_WORK_QUEUE_MONITOR_OC); 1810 1811 final SearchResult searchResult = 1812 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1813 filter); 1814 1815 final int numEntries = searchResult.getEntryCount(); 1816 if (numEntries == 0) 1817 { 1818 debug(Level.FINE, DebugType.MONITOR, 1819 "No entries returned in getUnboundIDWorkQueueMonitorEntry"); 1820 1821 return null; 1822 } 1823 else if (numEntries != 1) 1824 { 1825 debug(Level.FINE, DebugType.MONITOR, 1826 "Multiple entries returned in getUnboundIDWorkQueueMonitorEntry"); 1827 } 1828 1829 return new UnboundIDWorkQueueMonitorEntry( 1830 searchResult.getSearchEntries().get(0)); 1831 } 1832 1833 1834 1835 /** 1836 * Retrieves the version monitor entry from the Directory Server. 1837 * 1838 * @param connection The connection to use to communicate with the Directory 1839 * Server. 1840 * 1841 * @return The version monitor entry from the Directory Server, or 1842 * {@code null} if it is not available. 1843 * 1844 * @throws LDAPSearchException If a problem occurs while communicating with 1845 * the Directory Server. 1846 */ 1847 public static VersionMonitorEntry getVersionMonitorEntry( 1848 final LDAPConnection connection) 1849 throws LDAPSearchException 1850 { 1851 return getVersionMonitorEntry((LDAPInterface) connection); 1852 } 1853 1854 1855 1856 /** 1857 * Retrieves the version monitor entry from the Directory Server. 1858 * 1859 * @param connection The connection to use to communicate with the Directory 1860 * Server. 1861 * 1862 * @return The version monitor entry from the Directory Server, or 1863 * {@code null} if it is not available. 1864 * 1865 * @throws LDAPSearchException If a problem occurs while communicating with 1866 * the Directory Server. 1867 */ 1868 public static VersionMonitorEntry getVersionMonitorEntry( 1869 final LDAPInterface connection) 1870 throws LDAPSearchException 1871 { 1872 final Filter filter = Filter.createEqualityFilter("objectClass", 1873 VersionMonitorEntry.VERSION_MONITOR_OC); 1874 1875 final SearchResult searchResult = 1876 connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, 1877 filter); 1878 1879 final int numEntries = searchResult.getEntryCount(); 1880 if (numEntries == 0) 1881 { 1882 debug(Level.FINE, DebugType.MONITOR, 1883 "No entries returned in getVersionMonitorEntry"); 1884 1885 return null; 1886 } 1887 else if (numEntries != 1) 1888 { 1889 debug(Level.FINE, DebugType.MONITOR, 1890 "Multiple entries returned in getVersionMonitorEntry"); 1891 } 1892 1893 return new VersionMonitorEntry(searchResult.getSearchEntries().get(0)); 1894 } 1895 }