001/*
002 * Copyright 2008-2018 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2018 Ping Identity Corporation
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 */
021package com.unboundid.ldap.sdk.unboundidds.monitors;
022
023
024
025import java.util.Collections;
026import java.util.LinkedHashMap;
027import java.util.Map;
028
029import com.unboundid.ldap.sdk.Entry;
030import com.unboundid.util.NotMutable;
031import com.unboundid.util.ThreadSafety;
032import com.unboundid.util.ThreadSafetyLevel;
033
034import static com.unboundid.ldap.sdk.unboundidds.monitors.MonitorMessages.*;
035
036
037
038/**
039 * This class defines a monitor entry that provides information about the types
040 * of LDAP operations processed through an LDAP connection handler.
041 * <BR>
042 * <BLOCKQUOTE>
043 *   <B>NOTE:</B>  This class, and other classes within the
044 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
045 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
046 *   server products.  These classes provide support for proprietary
047 *   functionality or for external specifications that are not considered stable
048 *   or mature enough to be guaranteed to work in an interoperable way with
049 *   other types of LDAP servers.
050 * </BLOCKQUOTE>
051 * <BR>
052 * Information available through this monitor entry includes:
053 * <UL>
054 *   <LI>The total number of requests for each type of operation received by the
055 *       connection handler.</LI>
056 *   <LI>The total number of responses of each type of operation returned by the
057 *       connection handler.</LI>
058 *   <LI>The total number of search result entries returned by the connection
059 *       handler.</LI>
060 *   <LI>The total number of search result references returned by the connection
061 *       handler.</LI>
062 *   <LI>The total number of LDAP messages read from clients.</LI>
063 *   <LI>The total number of LDAP messages written to clients.</LI>
064 *   <LI>The total number of request bytes read from clients.</LI>
065 *   <LI>The total number of response bytes written to clients.</LI>
066 *   <LI>The number of connections accepted by the connection handler.</LI>
067 *   <LI>The number of connections closed by the connection handler.</LI>
068 *   <LI>The number of operations initiated by the connection handler.</LI>
069 *   <LI>The number of operations completed by the connection handler.</LI>
070 *   <LI>The number of operations abandoned by the connection handler.</LI>
071 * </UL>
072 * The LDAP statistics monitor entries provided by the server can be retrieved
073 * using the {@link MonitorManager#getLDAPStatisticsMonitorEntries} method.
074 * These entries provide specific methods for accessing information about the
075 * LDAP connection handler (e.g., the
076 * {@link LDAPStatisticsMonitorEntry#getAbandonRequests} method can be used to
077 * retrieve the number of abandon requests received).  Alternately, this
078 * information may be accessed using the generic API.  See the
079 * {@link MonitorManager} class documentation for an example that demonstrates
080 * the use of the generic API for accessing monitor data.
081 */
082@NotMutable()
083@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
084public final class LDAPStatisticsMonitorEntry
085       extends MonitorEntry
086{
087  /**
088   * The structural object class used in LDAP statistics monitor entries.
089   */
090  static final String LDAP_STATISTICS_MONITOR_OC =
091       "ds-ldap-statistics-monitor-entry";
092
093
094
095  /**
096   * The name of the attribute that contains the number of abandon requests.
097   */
098  private static final String ATTR_ABANDON_REQUESTS = "abandonRequests";
099
100
101
102  /**
103   * The name of the attribute that contains the number of add requests.
104   */
105  private static final String ATTR_ADD_REQUESTS = "addRequests";
106
107
108
109  /**
110   * The name of the attribute that contains the number of add responses.
111   */
112  private static final String ATTR_ADD_RESPONSES = "addResponses";
113
114
115
116  /**
117   * The name of the attribute that contains the number of bind requests.
118   */
119  private static final String ATTR_BIND_REQUESTS = "bindRequests";
120
121
122
123  /**
124   * The name of the attribute that contains the number of bind responses.
125   */
126  private static final String ATTR_BIND_RESPONSES = "bindResponses";
127
128
129
130  /**
131   * The name of the attribute that contains the number of bytes read.
132   */
133  private static final String ATTR_BYTES_READ = "bytesRead";
134
135
136
137  /**
138   * The name of the attribute that contains the number of bytes written.
139   */
140  private static final String ATTR_BYTES_WRITTEN = "bytesWritten";
141
142
143
144  /**
145   * The name of the attribute that contains the number of compare requests.
146   */
147  private static final String ATTR_COMPARE_REQUESTS = "compareRequests";
148
149
150
151  /**
152   * The name of the attribute that contains the number of compare responses.
153   */
154  private static final String ATTR_COMPARE_RESPONSES = "compareResponses";
155
156
157
158  /**
159   * The name of the attribute that contains the number of connections
160   * closed.
161   */
162  private static final String ATTR_CONNECTIONS_CLOSED = "connectionsClosed";
163
164
165
166  /**
167   * The name of the attribute that contains the number of connections
168   * established.
169   */
170  private static final String ATTR_CONNECTIONS_ESTABLISHED =
171       "connectionsEstablished";
172
173
174
175  /**
176   * The name of the attribute that contains the number of delete requests.
177   */
178  private static final String ATTR_DELETE_REQUESTS = "deleteRequests";
179
180
181
182  /**
183   * The name of the attribute that contains the number of delete responses.
184   */
185  private static final String ATTR_DELETE_RESPONSES = "deleteResponses";
186
187
188
189  /**
190   * The name of the attribute that contains the number of extended requests.
191   */
192  private static final String ATTR_EXTENDED_REQUESTS = "extendedRequests";
193
194
195
196  /**
197   * The name of the attribute that contains the number of extended responses.
198   */
199  private static final String ATTR_EXTENDED_RESPONSES = "extendedResponses";
200
201
202
203  /**
204   * The name of the attribute that contains the number of LDAP messages read.
205   */
206  private static final String ATTR_LDAP_MESSAGES_READ = "ldapMessagesRead";
207
208
209
210  /**
211   * The name of the attribute that contains the number of LDAP messages
212   * written.
213   */
214  private static final String ATTR_LDAP_MESSAGES_WRITTEN =
215       "ldapMessagesWritten";
216
217
218
219  /**
220   * The name of the attribute that contains the number of modify requests.
221   */
222  private static final String ATTR_MODIFY_REQUESTS = "modifyRequests";
223
224
225
226  /**
227   * The name of the attribute that contains the number of modify responses.
228   */
229  private static final String ATTR_MODIFY_RESPONSES = "modifyResponses";
230
231
232
233  /**
234   * The name of the attribute that contains the number of modify DN requests.
235   */
236  private static final String ATTR_MODIFY_DN_REQUESTS = "modifyDNRequests";
237
238
239
240  /**
241   * The name of the attribute that contains the number of modify DN responses.
242   */
243  private static final String ATTR_MODIFY_DN_RESPONSES = "modifyDNResponses";
244
245
246
247  /**
248   * The name of the attribute that contains the number of operations abandoned.
249   */
250  private static final String ATTR_OPS_ABANDONED = "operationsAbandoned";
251
252
253
254  /**
255   * The name of the attribute that contains the number of operations completed.
256   */
257  private static final String ATTR_OPS_COMPLETED = "operationsCompleted";
258
259
260
261  /**
262   * The name of the attribute that contains the number of operations initiated.
263   */
264  private static final String ATTR_OPS_INITIATED = "operationsInitiated";
265
266
267
268  /**
269   * The name of the attribute that contains the number of search requests.
270   */
271  private static final String ATTR_SEARCH_REQUESTS = "searchRequests";
272
273
274
275  /**
276   * The name of the attribute that contains the number of search result done
277   * responses.
278   */
279  private static final String ATTR_SEARCH_RESULT_DONE_RESPONSES =
280       "searchResultsDone";
281
282
283
284  /**
285   * The name of the attribute that contains the number of search result entry
286   * responses.
287   */
288  private static final String ATTR_SEARCH_RESULT_ENTRY_RESPONSES =
289       "searchResultEntries";
290
291
292
293  /**
294   * The name of the attribute that contains the number of search result
295   * reference responses.
296   */
297  private static final String ATTR_SEARCH_RESULT_REFERENCE_RESPONSES =
298       "searchResultReferences";
299
300
301
302  /**
303   * The name of the attribute that contains the number of unbind requests.
304   */
305  private static final String ATTR_UNBIND_REQUESTS = "unbindRequests";
306
307
308
309  /**
310   * The serial version UID for this serializable class.
311   */
312  private static final long serialVersionUID = 4869341619766489249L;
313
314
315
316  // The number of abandon requests.
317  private final Long abandonRequests;
318
319  // The number of add requests.
320  private final Long addRequests;
321
322  // The number of add responses.
323  private final Long addResponses;
324
325  // The number of bind requests.
326  private final Long bindRequests;
327
328  // The number of bind responses.
329  private final Long bindResponses;
330
331  // The number of bytes read.
332  private final Long bytesRead;
333
334  // The number of bytes written.
335  private final Long bytesWritten;
336
337  // The number of compare requests.
338  private final Long compareRequests;
339
340  // The number of compare responses.
341  private final Long compareResponses;
342
343  // The number of connections that have been closed.
344  private final Long connectionsClosed;
345
346  // The number of connections that have been established.
347  private final Long connectionsEstablished;
348
349  // The number of delete requests.
350  private final Long deleteRequests;
351
352  // The number of delete responses.
353  private final Long deleteResponses;
354
355  // The number of extended requests.
356  private final Long extendedRequests;
357
358  // The number of extended responses.
359  private final Long extendedResponses;
360
361  // The number of LDAP messages read.
362  private final Long ldapMessagesRead;
363
364  // The number of LDAP messages written.
365  private final Long ldapMessagesWritten;
366
367  // The number of modify requests.
368  private final Long modifyRequests;
369
370  // The number of modify responses.
371  private final Long modifyResponses;
372
373  // The number of modify DN requests.
374  private final Long modifyDNRequests;
375
376  // The number of modify DN responses.
377  private final Long modifyDNResponses;
378
379  // The number of operations abandoned.
380  private final Long opsAbandoned;
381
382  // The number of operations completed.
383  private final Long opsCompleted;
384
385  // The number of operations initiated.
386  private final Long opsInitiated;
387
388  // The number of search requests.
389  private final Long searchRequests;
390
391  // The number of search result done responses.
392  private final Long searchDoneResponses;
393
394  // The number of search result entry responses.
395  private final Long searchEntryResponses;
396
397  // The number of search result reference responses.
398  private final Long searchReferenceResponses;
399
400  // The number of unbind requests.
401  private final Long unbindRequests;
402
403
404
405  /**
406   * Creates a new LDAP statistics monitor entry from the provided entry.
407   *
408   * @param  entry  The entry to be parsed as an LDAP statistics monitor entry.
409   *                It must not be {@code null}.
410   */
411  public LDAPStatisticsMonitorEntry(final Entry entry)
412  {
413    super(entry);
414
415    abandonRequests          = getLong(ATTR_ABANDON_REQUESTS);
416    addRequests              = getLong(ATTR_ADD_REQUESTS);
417    addResponses             = getLong(ATTR_ADD_RESPONSES);
418    bindRequests             = getLong(ATTR_BIND_REQUESTS);
419    bindResponses            = getLong(ATTR_BIND_RESPONSES);
420    bytesRead                = getLong(ATTR_BYTES_READ);
421    bytesWritten             = getLong(ATTR_BYTES_WRITTEN);
422    compareRequests          = getLong(ATTR_COMPARE_REQUESTS);
423    compareResponses         = getLong(ATTR_COMPARE_RESPONSES);
424    connectionsClosed        = getLong(ATTR_CONNECTIONS_CLOSED);
425    connectionsEstablished   = getLong(ATTR_CONNECTIONS_ESTABLISHED);
426    deleteRequests           = getLong(ATTR_DELETE_REQUESTS);
427    deleteResponses          = getLong(ATTR_DELETE_RESPONSES);
428    extendedRequests         = getLong(ATTR_EXTENDED_REQUESTS);
429    extendedResponses        = getLong(ATTR_EXTENDED_RESPONSES);
430    ldapMessagesRead         = getLong(ATTR_LDAP_MESSAGES_READ);
431    ldapMessagesWritten      = getLong(ATTR_LDAP_MESSAGES_WRITTEN);
432    modifyRequests           = getLong(ATTR_MODIFY_REQUESTS);
433    modifyResponses          = getLong(ATTR_MODIFY_RESPONSES);
434    modifyDNRequests         = getLong(ATTR_MODIFY_DN_REQUESTS);
435    modifyDNResponses        = getLong(ATTR_MODIFY_DN_RESPONSES);
436    opsAbandoned             = getLong(ATTR_OPS_ABANDONED);
437    opsCompleted             = getLong(ATTR_OPS_COMPLETED);
438    opsInitiated             = getLong(ATTR_OPS_INITIATED);
439    searchRequests           = getLong(ATTR_SEARCH_REQUESTS);
440    searchDoneResponses      = getLong(ATTR_SEARCH_RESULT_DONE_RESPONSES);
441    searchEntryResponses     = getLong(ATTR_SEARCH_RESULT_ENTRY_RESPONSES);
442    searchReferenceResponses = getLong(ATTR_SEARCH_RESULT_REFERENCE_RESPONSES);
443    unbindRequests           = getLong(ATTR_UNBIND_REQUESTS);
444  }
445
446
447
448  /**
449   * Retrieves the number of connections established since the associated
450   * connection handler was started.
451   *
452   * @return  The number of connections established since the associated
453   *          connection handler was started, or {@code null} if it was not
454   *          included in the monitor entry.
455   */
456  public Long getConnectionsEstablished()
457  {
458    return connectionsEstablished;
459  }
460
461
462
463  /**
464   * Retrieves the number of connections closed since the associated connection
465   * handler was started.
466   *
467   * @return  The number of connections closed since the associated connection
468   *          handler was started, or {@code null} if it was not included in the
469   *          monitor entry.
470   */
471  public Long getConnectionsClosed()
472  {
473    return connectionsClosed;
474  }
475
476
477
478  /**
479   * Retrieves the number of operations initiated since the associated
480   * connection handler was started.
481   *
482   * @return  The number of operations initiated since the associated
483   *          connection handler was started, or {@code null} if it was not
484   *          included in the monitor entry.
485   */
486  public Long getOperationsInitiated()
487  {
488    return opsInitiated;
489  }
490
491
492
493  /**
494   * Retrieves the number of operations completed since the associated
495   * connection handler was started.
496   *
497   * @return  The number of operations completed since the associated
498   *          connection handler was started, or {@code null} if it was not
499   *          included in the monitor entry.
500   */
501  public Long getOperationsCompleted()
502  {
503    return opsCompleted;
504  }
505
506
507
508  /**
509   * Retrieves the number of operations abandoned since the associated
510   * connection handler was started.
511   *
512   * @return  The number of operations abandoned since the associated
513   *          connection handler was started, or {@code null} if it was not
514   *          included in the monitor entry.
515   */
516  public Long getOperationsAbandoned()
517  {
518    return opsAbandoned;
519  }
520
521
522
523  /**
524   * Retrieves the number of bytes read from clients since the associated
525   * connection handler was started.
526   *
527   * @return  The number of bytes read from clients since the associated
528   *          connection handler was started, or {@code null} if it was not
529   *          included in the monitor entry.
530   */
531  public Long getBytesRead()
532  {
533    return bytesRead;
534  }
535
536
537
538  /**
539   * Retrieves the number of bytes written to clients since the associated
540   * connection handler was started.
541   *
542   * @return  The number of bytes written to clients since the associated
543   *          connection handler was started, or {@code null} if it was not
544   *          included in the monitor entry.
545   */
546  public Long getBytesWritten()
547  {
548    return bytesWritten;
549  }
550
551
552
553  /**
554   * Retrieves the number of LDAP messages read from clients since the
555   * associated connection handler was started.
556   *
557   * @return  The number of LDAP messages read from clients since the associated
558   *          connection handler was started, or {@code null} if it was not
559   *          included in the monitor entry.
560   */
561  public Long getLDAPMessagesRead()
562  {
563    return ldapMessagesRead;
564  }
565
566
567
568  /**
569   * Retrieves the number of LDAP messages written to clients since the
570   * associated connection handler was started.
571   *
572   * @return  The number of LDAP messages written to clients since the
573   *          associated connection handler was started, or {@code null} if it
574   *          was not included in the monitor entry.
575   */
576  public Long getLDAPMessagesWritten()
577  {
578    return ldapMessagesWritten;
579  }
580
581
582
583  /**
584   * Retrieves the number of abandon requests from clients since the associated
585   * connection handler was started.
586   *
587   * @return  The number of abandon requests from clients since the associated
588   *          connection handler was started, or {@code null} if it was not
589   *          included in the monitor entry.
590   */
591  public Long getAbandonRequests()
592  {
593    return abandonRequests;
594  }
595
596
597
598  /**
599   * Retrieves the number of add requests from clients since the associated
600   * connection handler was started.
601   *
602   * @return  The number of add requests from clients since the associated
603   *          connection handler was started, or {@code null} if it was not
604   *          included in the monitor entry.
605   */
606  public Long getAddRequests()
607  {
608    return addRequests;
609  }
610
611
612
613  /**
614   * Retrieves the number of add responses to clients since the associated
615   * connection handler was started.
616   *
617   * @return  The number of add responses to clients since the associated
618   *          connection handler was started, or {@code null} if it was not
619   *          included in the monitor entry.
620   */
621  public Long getAddResponses()
622  {
623    return addResponses;
624  }
625
626
627
628  /**
629   * Retrieves the number of bind requests from clients since the associated
630   * connection handler was started.
631   *
632   * @return  The number of bind requests from clients since the associated
633   *          connection handler was started, or {@code null} if it was not
634   *          included in the monitor entry.
635   */
636  public Long getBindRequests()
637  {
638    return bindRequests;
639  }
640
641
642
643  /**
644   * Retrieves the number of bind responses to clients since the associated
645   * connection handler was started.
646   *
647   * @return  The number of bind responses to clients since the associated
648   *          connection handler was started, or {@code null} if it was not
649   *          included in the monitor entry.
650   */
651  public Long getBindResponses()
652  {
653    return bindResponses;
654  }
655
656
657
658  /**
659   * Retrieves the number of compare requests from clients since the associated
660   * connection handler was started.
661   *
662   * @return  The number of compare requests from clients since the associated
663   *          connection handler was started, or {@code null} if it was not
664   *          included in the monitor entry.
665   */
666  public Long getCompareRequests()
667  {
668    return compareRequests;
669  }
670
671
672
673  /**
674   * Retrieves the number of compare responses to clients since the associated
675   * connection handler was started.
676   *
677   * @return  The number of compare responses to clients since the associated
678   *          connection handler was started, or {@code null} if it was not
679   *          included in the monitor entry.
680   */
681  public Long getCompareResponses()
682  {
683    return compareResponses;
684  }
685
686
687
688  /**
689   * Retrieves the number of delete requests from clients since the associated
690   * connection handler was started.
691   *
692   * @return  The number of delete requests from clients since the associated
693   *          connection handler was started, or {@code null} if it was not
694   *          included in the monitor entry.
695   */
696  public Long getDeleteRequests()
697  {
698    return deleteRequests;
699  }
700
701
702
703  /**
704   * Retrieves the number of delete responses to clients since the associated
705   * connection handler was started.
706   *
707   * @return  The number of delete responses to clients since the associated
708   *          connection handler was started, or {@code null} if it was not
709   *          included in the monitor entry.
710   */
711  public Long getDeleteResponses()
712  {
713    return deleteResponses;
714  }
715
716
717
718  /**
719   * Retrieves the number of extended requests from clients since the associated
720   * connection handler was started.
721   *
722   * @return  The number of extended requests from clients since the associated
723   *          connection handler was started, or {@code null} if it was not
724   *          included in the monitor entry.
725   */
726  public Long getExtendedRequests()
727  {
728    return extendedRequests;
729  }
730
731
732
733  /**
734   * Retrieves the number of extended responses to clients since the associated
735   * connection handler was started.
736   *
737   * @return  The number of extended responses to clients since the associated
738   *          connection handler was started, or {@code null} if it was not
739   *          included in the monitor entry.
740   */
741  public Long getExtendedResponses()
742  {
743    return extendedResponses;
744  }
745
746
747
748  /**
749   * Retrieves the number of modify requests from clients since the associated
750   * connection handler was started.
751   *
752   * @return  The number of modify requests from clients since the associated
753   *          connection handler was started, or {@code null} if it was not
754   *          included in the monitor entry.
755   */
756  public Long getModifyRequests()
757  {
758    return modifyRequests;
759  }
760
761
762
763  /**
764   * Retrieves the number of modify responses to clients since the associated
765   * connection handler was started.
766   *
767   * @return  The number of modify responses to clients since the associated
768   *          connection handler was started, or {@code null} if it was not
769   *          included in the monitor entry.
770   */
771  public Long getModifyResponses()
772  {
773    return modifyResponses;
774  }
775
776
777
778  /**
779   * Retrieves the number of modify DN requests from clients since the
780   * associated connection handler was started.
781   *
782   * @return  The number of modify DN requests from clients since the associated
783   *          connection handler was started, or {@code null} if it was not
784   *          included in the monitor entry.
785   */
786  public Long getModifyDNRequests()
787  {
788    return modifyDNRequests;
789  }
790
791
792
793  /**
794   * Retrieves the number of modify DN responses to clients since the associated
795   * connection handler was started.
796   *
797   * @return  The number of modify DN responses to clients since the associated
798   *          connection handler was started, or {@code null} if it was not
799   *          included in the monitor entry.
800   */
801  public Long getModifyDNResponses()
802  {
803    return modifyDNResponses;
804  }
805
806
807
808  /**
809   * Retrieves the number of search requests from clients since the associated
810   * connection handler was started.
811   *
812   * @return  The number of search requests from clients since the associated
813   *          connection handler was started, or {@code null} if it was not
814   *          included in the monitor entry.
815   */
816  public Long getSearchRequests()
817  {
818    return searchRequests;
819  }
820
821
822
823  /**
824   * Retrieves the number of search result entries sent to clients since the
825   * associated connection handler was started.
826   *
827   * @return  The number of search result entries sent to clients since the
828   *          associated connection handler was started, or {@code null} if it
829   *          was not included in the monitor entry.
830   */
831  public Long getSearchResultEntries()
832  {
833    return searchEntryResponses;
834  }
835
836
837
838  /**
839   * Retrieves the number of search result references sent to clients since the
840   * associated connection handler was started.
841   *
842   * @return  The number of search result references sent to clients since the
843   *          associated connection handler was started, or {@code null} if it
844   *          was not included in the monitor entry.
845   */
846  public Long getSearchResultReferences()
847  {
848    return searchReferenceResponses;
849  }
850
851
852
853  /**
854   * Retrieves the number of search result done responses to clients since the
855   * associated connection handler was started.
856   *
857   * @return  The number of search result done responses to clients since the
858   *          associated connection handler was started, or {@code null} if it
859   *          was not included in the monitor entry.
860   */
861  public Long getSearchDoneResponses()
862  {
863    return searchDoneResponses;
864  }
865
866
867
868  /**
869   * Retrieves the number of unbind requests from clients since the associated
870   * connection handler was started.
871   *
872   * @return  The number of unbind requests from clients since the associated
873   *          connection handler was started, or {@code null} if it was not
874   *          included in the monitor entry.
875   */
876  public Long getUnbindRequests()
877  {
878    return unbindRequests;
879  }
880
881
882
883  /**
884   * {@inheritDoc}
885   */
886  @Override()
887  public String getMonitorDisplayName()
888  {
889    return INFO_LDAP_STATS_MONITOR_DISPNAME.get();
890  }
891
892
893
894  /**
895   * {@inheritDoc}
896   */
897  @Override()
898  public String getMonitorDescription()
899  {
900    return INFO_LDAP_STATS_MONITOR_DESC.get();
901  }
902
903
904
905  /**
906   * {@inheritDoc}
907   */
908  @Override()
909  public Map<String,MonitorAttribute> getMonitorAttributes()
910  {
911    final LinkedHashMap<String,MonitorAttribute> attrs =
912         new LinkedHashMap<String,MonitorAttribute>();
913
914    if (connectionsEstablished != null)
915    {
916      addMonitorAttribute(attrs,
917           ATTR_CONNECTIONS_ESTABLISHED,
918           INFO_LDAP_STATS_DISPNAME_CONNECTIONS_ESTABLISHED.get(),
919           INFO_LDAP_STATS_DESC_CONNECTIONS_ESTABLISHED.get(),
920           connectionsEstablished);
921    }
922
923    if (connectionsClosed != null)
924    {
925      addMonitorAttribute(attrs,
926           ATTR_CONNECTIONS_CLOSED,
927           INFO_LDAP_STATS_DISPNAME_CONNECTIONS_CLOSED.get(),
928           INFO_LDAP_STATS_DESC_CONNECTIONS_CLOSED.get(),
929           connectionsClosed);
930    }
931
932    if (bytesRead != null)
933    {
934      addMonitorAttribute(attrs,
935           ATTR_BYTES_READ,
936           INFO_LDAP_STATS_DISPNAME_BYTES_READ.get(),
937           INFO_LDAP_STATS_DESC_BYTES_READ.get(),
938           bytesRead);
939    }
940
941    if (bytesWritten != null)
942    {
943      addMonitorAttribute(attrs,
944           ATTR_BYTES_WRITTEN,
945           INFO_LDAP_STATS_DISPNAME_BYTES_WRITTEN.get(),
946           INFO_LDAP_STATS_DESC_BYTES_WRITTEN.get(),
947           bytesWritten);
948    }
949
950    if (ldapMessagesRead != null)
951    {
952      addMonitorAttribute(attrs,
953           ATTR_LDAP_MESSAGES_READ,
954           INFO_LDAP_STATS_DISPNAME_LDAP_MESSAGES_READ.get(),
955           INFO_LDAP_STATS_DESC_LDAP_MESSAGES_READ.get(),
956           ldapMessagesRead);
957    }
958
959    if (ldapMessagesWritten != null)
960    {
961      addMonitorAttribute(attrs,
962           ATTR_LDAP_MESSAGES_WRITTEN,
963           INFO_LDAP_STATS_DISPNAME_LDAP_MESSAGES_WRITTEN.get(),
964           INFO_LDAP_STATS_DESC_LDAP_MESSAGES_WRITTEN.get(),
965           ldapMessagesWritten);
966    }
967
968    if (opsInitiated != null)
969    {
970      addMonitorAttribute(attrs,
971           ATTR_OPS_INITIATED,
972           INFO_LDAP_STATS_DISPNAME_OPS_INITIATED.get(),
973           INFO_LDAP_STATS_DESC_OPS_INITIATED.get(),
974           opsInitiated);
975    }
976
977    if (opsCompleted != null)
978    {
979      addMonitorAttribute(attrs,
980           ATTR_OPS_COMPLETED,
981           INFO_LDAP_STATS_DISPNAME_OPS_COMPLETED.get(),
982           INFO_LDAP_STATS_DESC_OPS_COMPLETED.get(),
983           opsCompleted);
984    }
985
986    if (opsAbandoned != null)
987    {
988      addMonitorAttribute(attrs,
989           ATTR_OPS_ABANDONED,
990           INFO_LDAP_STATS_DISPNAME_OPS_ABANDONED.get(),
991           INFO_LDAP_STATS_DESC_OPS_ABANDONED.get(),
992           opsAbandoned);
993    }
994
995    if (abandonRequests != null)
996    {
997      addMonitorAttribute(attrs,
998           ATTR_ABANDON_REQUESTS,
999           INFO_LDAP_STATS_DISPNAME_ABANDON_REQUESTS.get(),
1000           INFO_LDAP_STATS_DESC_ABANDON_REQUESTS.get(),
1001           abandonRequests);
1002    }
1003
1004    if (addRequests != null)
1005    {
1006      addMonitorAttribute(attrs,
1007           ATTR_ADD_REQUESTS,
1008           INFO_LDAP_STATS_DISPNAME_ADD_REQUESTS.get(),
1009           INFO_LDAP_STATS_DESC_ADD_REQUESTS.get(),
1010           addRequests);
1011    }
1012
1013    if (addResponses != null)
1014    {
1015      addMonitorAttribute(attrs,
1016           ATTR_ADD_RESPONSES,
1017           INFO_LDAP_STATS_DISPNAME_ADD_RESPONSES.get(),
1018           INFO_LDAP_STATS_DESC_ADD_RESPONSES.get(),
1019           addResponses);
1020    }
1021
1022    if (bindRequests != null)
1023    {
1024      addMonitorAttribute(attrs,
1025           ATTR_BIND_REQUESTS,
1026           INFO_LDAP_STATS_DISPNAME_BIND_REQUESTS.get(),
1027           INFO_LDAP_STATS_DESC_BIND_REQUESTS.get(),
1028           bindRequests);
1029    }
1030
1031    if (bindResponses != null)
1032    {
1033      addMonitorAttribute(attrs,
1034           ATTR_BIND_RESPONSES,
1035           INFO_LDAP_STATS_DISPNAME_BIND_RESPONSES.get(),
1036           INFO_LDAP_STATS_DESC_BIND_RESPONSES.get(),
1037           bindResponses);
1038    }
1039
1040    if (compareRequests != null)
1041    {
1042      addMonitorAttribute(attrs,
1043           ATTR_COMPARE_REQUESTS,
1044           INFO_LDAP_STATS_DISPNAME_COMPARE_REQUESTS.get(),
1045           INFO_LDAP_STATS_DESC_COMPARE_REQUESTS.get(),
1046           compareRequests);
1047    }
1048
1049    if (compareResponses != null)
1050    {
1051      addMonitorAttribute(attrs,
1052           ATTR_COMPARE_RESPONSES,
1053           INFO_LDAP_STATS_DISPNAME_COMPARE_RESPONSES.get(),
1054           INFO_LDAP_STATS_DESC_COMPARE_RESPONSES.get(),
1055           compareResponses);
1056    }
1057
1058    if (deleteRequests != null)
1059    {
1060      addMonitorAttribute(attrs,
1061           ATTR_DELETE_REQUESTS,
1062           INFO_LDAP_STATS_DISPNAME_DELETE_REQUESTS.get(),
1063           INFO_LDAP_STATS_DESC_DELETE_REQUESTS.get(),
1064           deleteRequests);
1065    }
1066
1067    if (deleteResponses != null)
1068    {
1069      addMonitorAttribute(attrs,
1070           ATTR_DELETE_RESPONSES,
1071           INFO_LDAP_STATS_DISPNAME_DELETE_RESPONSES.get(),
1072           INFO_LDAP_STATS_DESC_DELETE_RESPONSES.get(),
1073           deleteResponses);
1074    }
1075
1076    if (extendedRequests != null)
1077    {
1078      addMonitorAttribute(attrs,
1079           ATTR_EXTENDED_REQUESTS,
1080           INFO_LDAP_STATS_DISPNAME_EXTENDED_REQUESTS.get(),
1081           INFO_LDAP_STATS_DESC_EXTENDED_REQUESTS.get(),
1082           extendedRequests);
1083    }
1084
1085    if (extendedResponses != null)
1086    {
1087      addMonitorAttribute(attrs,
1088           ATTR_EXTENDED_RESPONSES,
1089           INFO_LDAP_STATS_DISPNAME_EXTENDED_RESPONSES.get(),
1090           INFO_LDAP_STATS_DESC_EXTENDED_RESPONSES.get(),
1091           extendedResponses);
1092    }
1093
1094    if (modifyRequests != null)
1095    {
1096      addMonitorAttribute(attrs,
1097           ATTR_MODIFY_REQUESTS,
1098           INFO_LDAP_STATS_DISPNAME_MODIFY_REQUESTS.get(),
1099           INFO_LDAP_STATS_DESC_MODIFY_REQUESTS.get(),
1100           modifyRequests);
1101    }
1102
1103    if (modifyResponses != null)
1104    {
1105      addMonitorAttribute(attrs,
1106           ATTR_MODIFY_RESPONSES,
1107           INFO_LDAP_STATS_DISPNAME_MODIFY_RESPONSES.get(),
1108           INFO_LDAP_STATS_DESC_MODIFY_RESPONSES.get(),
1109           modifyResponses);
1110    }
1111
1112    if (modifyDNRequests != null)
1113    {
1114      addMonitorAttribute(attrs,
1115           ATTR_MODIFY_DN_REQUESTS,
1116           INFO_LDAP_STATS_DISPNAME_MODIFY_DN_REQUESTS.get(),
1117           INFO_LDAP_STATS_DESC_MODIFY_DN_REQUESTS.get(),
1118           modifyDNRequests);
1119    }
1120
1121    if (modifyDNResponses != null)
1122    {
1123      addMonitorAttribute(attrs,
1124           ATTR_MODIFY_DN_RESPONSES,
1125           INFO_LDAP_STATS_DISPNAME_MODIFY_DN_RESPONSES.get(),
1126           INFO_LDAP_STATS_DESC_MODIFY_DN_RESPONSES.get(),
1127           modifyDNResponses);
1128    }
1129
1130    if (searchRequests != null)
1131    {
1132      addMonitorAttribute(attrs,
1133           ATTR_SEARCH_REQUESTS,
1134           INFO_LDAP_STATS_DISPNAME_SEARCH_REQUESTS.get(),
1135           INFO_LDAP_STATS_DESC_SEARCH_REQUESTS.get(),
1136           searchRequests);
1137    }
1138
1139    if (searchEntryResponses != null)
1140    {
1141      addMonitorAttribute(attrs,
1142           ATTR_SEARCH_RESULT_ENTRY_RESPONSES,
1143           INFO_LDAP_STATS_DISPNAME_SEARCH_ENTRY_RESPONSES.get(),
1144           INFO_LDAP_STATS_DESC_SEARCH_ENTRY_RESPONSES.get(),
1145           searchEntryResponses);
1146    }
1147
1148    if (searchReferenceResponses != null)
1149    {
1150      addMonitorAttribute(attrs,
1151           ATTR_SEARCH_RESULT_REFERENCE_RESPONSES,
1152           INFO_LDAP_STATS_DISPNAME_SEARCH_REFERENCE_RESPONSES.get(),
1153           INFO_LDAP_STATS_DESC_SEARCH_REFERENCE_RESPONSES.get(),
1154           searchReferenceResponses);
1155    }
1156
1157    if (searchDoneResponses != null)
1158    {
1159      addMonitorAttribute(attrs,
1160           ATTR_SEARCH_RESULT_DONE_RESPONSES,
1161           INFO_LDAP_STATS_DISPNAME_SEARCH_DONE_RESPONSES.get(),
1162           INFO_LDAP_STATS_DESC_SEARCH_DONE_RESPONSES.get(),
1163           searchDoneResponses);
1164    }
1165
1166    if (unbindRequests != null)
1167    {
1168      addMonitorAttribute(attrs,
1169           ATTR_UNBIND_REQUESTS,
1170           INFO_LDAP_STATS_DISPNAME_UNBIND_REQUESTS.get(),
1171           INFO_LDAP_STATS_DESC_UNBIND_REQUESTS.get(),
1172           unbindRequests);
1173    }
1174
1175    return Collections.unmodifiableMap(attrs);
1176  }
1177}