KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > slamd > example > WeightedSiteMinderJobClass


1 /*
2  * Sun Public License
3  *
4  * The contents of this file are subject to the Sun Public License Version
5  * 1.0 (the "License"). You may not use this file except in compliance with
6  * the License. A copy of the License is available at http://www.sun.com/
7  *
8  * The Original Code is the SLAMD Distributed Load Generation Engine.
9  * The Initial Developer of the Original Code is Neil A. Wilson.
10  * Portions created by Neil A. Wilson are Copyright (C) 2004.
11  * Some preexisting portions Copyright (C) 2002-2004 Sun Microsystems, Inc.
12  * All Rights Reserved.
13  *
14  * Contributor(s): Neil A. Wilson
15  */

16 package com.sun.slamd.example;
17
18
19
20 import java.io.*;
21 import java.security.*;
22 import java.util.*;
23 import netscape.ldap.*;
24 import netscape.ldap.factory.*;
25 import com.sun.slamd.job.*;
26 import com.sun.slamd.parameter.*;
27 import com.sun.slamd.stat.*;
28
29
30
31 /**
32  * This class defines a SLAMD job that simulates the load that SiteMinder can
33  * place on an LDAP directory server using a weighted access pattern. The load
34  * that it uses is based on the following (rather inefficient) sequence of
35  * events:
36  *
37  * <OL>
38  * <LI>Perform a subtree search from the directory suffix to find the user's
39  * entry based on a login ID.</LI>
40  * <LI>Perform a base-level search on the user's entry to retrieve the
41  * objectClass attribute.</LI>
42  * <LI>Perform a bind as the user. This is done on a different connection
43  * than all of the other steps.</LI>
44  * <LI>Perform a base-level search on the user's entry to retrieve a given
45  * user-specified attribute (attr1).</LI>
46  * <LI>Perform a base-level search on the user's entry to retrieve a second
47  * user-specified attribute (attr2).</LI>
48  * <LI>Perform a base-level search on the user's entry to retrieve the first
49  * attribute (attr1).</LI>
50  * <LI>Perform a modification on the user's entry.</LI>
51  * <LI>Perform a base-level search on the user's entry to retrieve the first
52  * attribute again.</LI>
53  * <LI>Perform a base-level search on the user's entry to retrieve the first
54  * attribute again.</LI>
55  * <LI>Perform a base-level search on the user's entry to retrieve a third
56  * attribute (attr3).</LI>
57  * </OL>
58  *
59  *
60  * @author Neil A. Wilson
61  */

62 public class WeightedSiteMinderJobClass
63        extends JobClass
64 {
65   /**
66    * The set of characters that will be used to generate random values for the
67    * modifications.
68    */

69   public static final char[] ALPHABET =
70        "abcdefghijklmnopqrstuvwxyz".toCharArray();
71
72
73
74   /**
75    * The default value for the first attribute to retrieve during the
76    * authentication process.
77    */

78   public static final String JavaDoc DEFAULT_ATTR1 = "givenName";
79
80
81
82   /**
83    * The default value for the second attribute to retrieve during the
84    * authentication process.
85    */

86   public static final String JavaDoc DEFAULT_ATTR2 = "sn";
87
88
89
90   /**
91    * The default value for the third attribute to retrieve during the
92    * authentication process.
93    */

94   public static final String JavaDoc DEFAULT_ATTR3= "cn";
95
96
97
98   /**
99    * The default attribute used as the login ID.
100    */

101   public static final String JavaDoc DEFAULT_LOG_ID_ATTR = "uid";
102
103
104
105   /**
106    * The system property used to specify the location of the JSSE key store.
107    */

108   public static final String JavaDoc SSL_KEY_STORE_PROPERTY =
109        "javax.net.ssl.keyStore";
110
111
112
113   /**
114    * The system property used to specify the password for the JSSE key store.
115    */

116   public static final String JavaDoc SSL_KEY_PASSWORD_PROPERTY =
117        "javax.net.ssl.keyStorePassword";
118
119
120
121   /**
122    * The system property used to specify the location of the JSSE trust store.
123    */

124   public static final String JavaDoc SSL_TRUST_STORE_PROPERTY =
125        "javax.net.ssl.trustStore";
126
127
128
129   /**
130    * The system property used to specify the password for the JSSE trust store.
131    */

132   public static final String JavaDoc SSL_TRUST_PASSWORD_PROPERTY =
133        "javax.net.ssl.trustStorePassword";
134
135
136
137   /**
138    * The name of the stat tracker that will be used to count the number of
139    * overall authentication attempts.
140    */

141   public static final String JavaDoc STAT_TRACKER_OVERALL_AUTHENTICATION_ATTEMPTS =
142        "Overall Authentication Attempts";
143
144
145
146   /**
147    * The name of the stat tracker that will be used to count the number of
148    * authentication attempts based on the first user criteria.
149    */

150   public static final String JavaDoc STAT_TRACKER_AUTHENTICATION_1_ATTEMPTS =
151        "Authentication 1 Attempts";
152
153
154
155   /**
156    * The name of the stat tracker that will be used to count the number of
157    * authentication attempts based on the second user criteria.
158    */

159   public static final String JavaDoc STAT_TRACKER_AUTHENTICATION_2_ATTEMPTS =
160        "Authentication 2 Attempts";
161
162
163
164   /**
165    * The name of the stat tracker that will be used to keep track of the overall
166    * time required to perform each authentication.
167    */

168   public static final String JavaDoc STAT_TRACKER_OVERALL_AUTHENTICATION_TIME =
169        "Overall Authentication Time (ms)";
170
171
172
173   /**
174    * The name of the stat tracker that will be used to keep track of the time
175    * required to perform each authentication based on the first user criteria.
176    */

177   public static final String JavaDoc STAT_TRACKER_AUTHENTICATION_1_TIME =
178        "Authentication 1 Time (ms)";
179
180
181
182   /**
183    * The name of the stat tracker that will be used to keep track of the time
184    * required to perform each authentication based on the second user criteria.
185    */

186   public static final String JavaDoc STAT_TRACKER_AUTHENTICATION_2_TIME =
187        "Authentication 2 Time (ms)";
188
189
190
191   /**
192    * The name of the stat tracker that will be used to count the number of
193    * overall failed authentications.
194    */

195   public static final String JavaDoc STAT_TRACKER_OVERALL_FAILED_AUTHENTICATIONS =
196        "Overall Failed Authentications";
197
198
199
200   /**
201    * The name of the stat tracker that will be used to count the number of
202    * failed authentications based on the first user criteria.
203    */

204   public static final String JavaDoc STAT_TRACKER_FAILED_AUTHENTICATIONS_1 =
205        "Failed Authentications 1";
206
207
208
209   /**
210    * The name of the stat tracker that will be used to count the number of
211    * failed authentications based on the second user criteria.
212    */

213   public static final String JavaDoc STAT_TRACKER_FAILED_AUTHENTICATIONS_2 =
214        "Failed Authentications 2";
215
216
217
218   /**
219    * The name of the stat tracker that will be used to categorize the reasons
220    * for the failed auths.
221    */

222   public static final String JavaDoc STAT_TRACKER_FAIL_REASON = "Failure Reason";
223
224
225
226   /**
227    * The name of the stat tracker that will be used to count the overall number
228    * of successful authentications.
229    */

230   public static final String JavaDoc STAT_TRACKER_OVERALL_SUCCESSFUL_AUTHENTICATIONS =
231        "Overall Successful Authentications";
232
233
234
235   /**
236    * The name of the stat tracker that will be used to count the number of
237    * successful authentications based on the first user criteria.
238    */

239   public static final String JavaDoc STAT_TRACKER_SUCCESSFUL_AUTHENTICATIONS_1 =
240        "Successful Authentications 1";
241
242
243
244   /**
245    * The name of the stat tracker that will be used to count the number of
246    * successful authentications based on the second user criteria.
247    */

248   public static final String JavaDoc STAT_TRACKER_SUCCESSFUL_AUTHENTICATIONS_2 =
249        "Successful Authentications 2";
250
251
252
253   /**
254    * The default set of attributes to include in the modification.
255    */

256   public static final String JavaDoc[] DEFAULT_ATTRS_TO_MODIFY = new String JavaDoc[]
257   {
258     "description"
259   };
260
261
262
263   // Indicates whether to blindly trust any SSL certificate.
264
static boolean blindTrust;
265
266   // Indicates whether bind failures because of invalid credentials will be
267
// ignored (so you don't actually have to know user passwords).
268
static boolean ignoreInvalidCredentials;
269
270   // Indicates whether the bind should be attempted or skipped.
271
static boolean skipBind;
272
273   // Indicates whether the first login ID should be interpreted as a range.
274
static boolean useLoginIDRange1;
275
276   // Indicates whether the second login ID should be interpreted as a range.
277
static boolean useLoginIDRange2;
278
279   // Indicates whether the first login ID value should increment sequentially.
280
static boolean useSequential1;
281
282   // Indicates whether the second login ID value should increment sequentially.
283
static boolean useSequential2;
284
285   // Indicates whether all threads will used a shared set of connections or if
286
// each thread will have its own connection.
287
static boolean useSharedConnections;
288
289   // Indicates whether to use SSL when communicating with the directory.
290
static boolean useSSL;
291
292   // The time to keep working after stopping statistics collection.
293
static int coolDownTime;
294
295   // The port number of the directory server.
296
static int directoryPort;
297
298   // The percentage of the time that the first login ID should be used.
299
static int loginID1Percent;
300
301   // The maximum value to use in the first range of login IDs.
302
static int loginIDMax1;
303
304   // The maximum value to use in the second range of login IDs.
305
static int loginIDMax2;
306
307   // The minimum value to use in the first range of login IDs.
308
static int loginIDMin1;
309
310   // The minimum value to use in the second range of login IDs.
311
static int loginIDMin2;
312
313   // The span to use for the first range of login IDs.
314
static int loginIDSpan1;
315
316   // The span to use for the second range of login IDs.
317
static int loginIDSpan2;
318
319   // The next sequential value that should be used in the first login ID value.
320
static int sequentialCounter1;
321
322   // The next sequential value that should be used in the second login ID value.
323
static int sequentialCounter2;
324
325   // The maximum length of time that any single LDAP operation will be allowed
326
// to take before it is cancelled.
327
static int timeLimit;
328
329   // The time to start working before beginning statistics collection.
330
static int warmUpTime;
331
332   // The delay in milliseconds between authentication attempts.
333
static long delay;
334
335   // The LDAP connection that will be used for shared authentication operations.
336
static LDAPConnection sharedAuthConnection;
337
338   // The LDAP connection that will be used for shared bind operations.
339
static LDAPConnection sharedBindConnection;
340
341   // The random number generator that will seed the thread-specific random
342
// number generators.
343
static Random parentRandom;
344
345   // The DN to use to bind to the directory when performing the search and
346
// modify operations.
347
static String JavaDoc bindDN;
348
349   // The password for the bind DN.
350
static String JavaDoc bindPW;
351
352   // The address of the directory server.
353
static String JavaDoc directoryHost;
354
355   // The search filter to use when searching on the first attribute.
356
static String JavaDoc filter1;
357
358   // The search filter to use when searching on the second attribute.
359
static String JavaDoc filter2;
360
361   // The search filter to use when searching on the third attribute.
362
static String JavaDoc filter3;
363
364   // The name of the attribute that will be used to initially find the user's
365
// entry (the login ID attribute).
366
static String JavaDoc loginIDAttr;
367
368   // The text to include after the numeric part of the first login ID.
369
static String JavaDoc loginIDFinal1;
370
371   // The text to include after the numeric part of the second login ID.
372
static String JavaDoc loginIDFinal2;
373
374   // The text to include before the numeric part of the first login ID.
375
static String JavaDoc loginIDInitial1;
376
377   // The text to include before the numeric part of the second login ID.
378
static String JavaDoc loginIDInitial2;
379
380   // The password to use when authenticating.
381
static String JavaDoc loginPassword;
382
383   // The name of the first attribute to retrieve.
384
static String JavaDoc searchAttr1;
385
386   // The name of the second attribute to retrieve.
387
static String JavaDoc searchAttr2;
388
389   // The name of the third attribute to retrieve.
390
static String JavaDoc searchAttr3;
391
392   // The DN to use as the search base when trying to find user entries in the
393
// directory.
394
static String JavaDoc searchBase;
395
396   // The location of the JSSE key store for use with SSL.
397
static String JavaDoc sslKeyStore;
398
399   // The password used to access the JSSE key store.
400
static String JavaDoc sslKeyPassword;
401
402   // The location of the JSSE trust store for use with SSL.
403
static String JavaDoc sslTrustStore;
404
405   // The password used to access the JSSE trust store.
406
static String JavaDoc sslTrustPassword;
407
408   // The names of the attributes to alter in the modification.
409
static String JavaDoc[] modAttrs;
410
411   // The set of attributes to return when retrieving the first attribute.
412
static String JavaDoc[] returnAttrs1;
413
414   // The set of attributes to return when retrieving the second attribute.
415
static String JavaDoc[] returnAttrs2;
416
417   // The set of attributes to return when retrieving the third attribute.
418
static String JavaDoc[] returnAttrs3;
419
420   // The set of attributes to return when retrieving the set of objectclasses.
421
static String JavaDoc[] returnAttrsOC;
422
423
424
425   // The parameter that indicates whether the client should trust any SSL cert.
426
BooleanParameter blindTrustParameter =
427     new BooleanParameter("blind_trust", "Blindly Trust Any Certificate",
428                          "Indicates whether the client should blindly trust " +
429                          "any certificate presented by the server, or " +
430                          "whether the key and trust stores should be used.",
431                          true);
432
433   // The parameter used to indicate whether invalid credential results are
434
// ignored.
435
BooleanParameter ignoreInvCredParameter =
436        new BooleanParameter("ignore_49", "Ignore Invalid Credentials Errors",
437                             "Indicates whether bind failures because of " +
438                             "invalid credentials (err=49). This makes it " +
439                             "possible to use this job without actually " +
440                             "know user passwords.", false);
441
442   // The parameter used to indicate whether connections are shared.
443
BooleanParameter shareConnsParameter =
444        new BooleanParameter("share_conns", "Share Connections between Threads",
445                             "Indicates whether the connections to the " +
446                             "directory server will be shared between threads " +
447                             "or if each client thread will have its own " +
448                             "connections.", true);
449
450   // The parameter used to indicate whether to skip the bind operation.
451
BooleanParameter skipBindParameter =
452        new BooleanParameter("skip_bind", "Skip Bind Operation",
453                             "Indicates whether the bind attempt should be " +
454                             "skipped as part of the authentication process.",
455                             false);
456
457   // The parameter that indicates whether the connection should use SSL or not
458
BooleanParameter useSSLParameter =
459        new BooleanParameter("usessl", "Use SSL",
460                             "Indicates whether to use SSL to encrypt the " +
461                             "communication with the directory server", false);
462
463   // The parmeter that specifies the cool-down time in seconds.
464
IntegerParameter coolDownParameter =
465        new IntegerParameter("cool_down", "Cool Down Time",
466                             "The time in seconds that the job should " +
467                             "continue searching after ending statistics " +
468                             "collection.", true, 0, true, 0, false, 0);
469
470   // The parameter that indicates the delay that should be used between each
471
// authentication attempt.
472
IntegerParameter delayParameter =
473        new IntegerParameter("delay", "Time Between Authentications (ms)",
474                             "Specifies the length of time in milliseconds " +
475                             "each thread should wait between authentication " +
476                             "attempts. Note that this delay will be " +
477                             "between the starts of consecutive attempts and " +
478                             "not between the end of one attempt and the " +
479                             "beginning of the next. If an authentication " +
480                             "takes longer than this length of time, then " +
481                             "there will be no delay.", true, 0, true, 0, false,
482                             0);
483
484   // The parameter used to indicate the port number for the directory server.
485
IntegerParameter portParameter =
486        new IntegerParameter("ldap_port", "Directory Server Port",
487                             "The port number for the directory server.", true,
488                             389, true, 1, true, 65535);
489
490   // The parameter used to indicate the maximum length of time that any single
491
// LDAP operation will be allowed to take.
492
IntegerParameter timeLimitParameter =
493        new IntegerParameter("time_limit", "Operation Time Limit",
494                             "The maximum length of time in seconds that any " +
495                             "single LDAP operation will be allowed to take " +
496                             "before it is cancelled.", true, 0, true, 0, false,
497                             0);
498
499   // The parmeter that specifies the cool-down time in seconds.
500
IntegerParameter warmUpParameter =
501        new IntegerParameter("warm_up", "Warm Up Time",
502                             "The time in seconds that the job should " +
503                             "search before beginning statistics collection.",
504                             true, 0, true, 0, false, 0);
505
506   // The parameter that specifies the percentage of the time that the first user
507
// criteria will be used in the modification.
508
IntegerParameter weightParameter =
509        new IntegerParameter("weight", "Login ID 1 Percentage",
510                             "The percentage of the time that a login ID " +
511                             "should be selected according to the value " +
512                             "provided for the Login ID Value 1 parameter.",
513                             true, 50, true, 0, true, 100);
514
515   // The parameter used to indicate the attributes to modify.
516
MultiLineTextParameter modAttrsParameter =
517        new MultiLineTextParameter("mod_attrs", "Attributes to Modify",
518                                   "The set of attributes to modify.",
519                                   DEFAULT_ATTRS_TO_MODIFY, false);
520
521   // The parameter used to indicate the password for the bind DN.
522
PasswordParameter bindPWParameter =
523        new PasswordParameter("bindpw", "Directory Bind Password",
524                              "The password to use when binding to the " +
525                              "directory server to perform search and modify " +
526                              "operations.", false, "");
527
528   // The parameter that specifies the password for the SSL key store
529
PasswordParameter keyPWParameter =
530     new PasswordParameter("sslkeypw", "SSL Key Store Password",
531                           "The password for the JSSE key store", false, "");
532
533   // The parameter used to indicate the password to use when authenticating to
534
// the directory.
535
PasswordParameter loginPasswordParameter =
536        new PasswordParameter("login_id_pw", "Login Password",
537                              "The password to use when authenticating to the " +
538                              "directory for user authentications.", false, "");
539
540   // The parameter that specifies the password for the SSL key store
541
PasswordParameter trustPWParameter =
542     new PasswordParameter("ssltrustpw", "SSL Trust Store Password",
543                           "The password for the JSSE trust store", false, "");
544
545   // The placeholder parameter used as a spacer in the admin interface.
546
PlaceholderParameter placeholder = new PlaceholderParameter();
547
548   // The parameter used to indicate the first attribute to retrieve.
549
StringParameter attr1Parameter =
550        new StringParameter("attr1", "First Attribute to Retrieve",
551                            "The first attribute to retrieve from the user's " +
552                            "entry as part of the authentication process.",
553                            true, DEFAULT_ATTR1);
554
555   // The parameter used to indicate the first attribute to retrieve.
556
StringParameter attr2Parameter =
557        new StringParameter("attr2", "Second Attribute to Retrieve",
558                            "The second attribute to retrieve from the user's " +
559                            "entry as part of the authentication process.",
560                            true, DEFAULT_ATTR2);
561
562   // The parameter used to indicate the first attribute to retrieve.
563
StringParameter attr3Parameter =
564        new StringParameter("attr3", "Third Attribute to Retrieve",
565                            "The third attribute to retrieve from the user's " +
566                            "entry as part of the authentication process.",
567                            true, DEFAULT_ATTR3);
568
569   // The parameter used to indicate the bind DN.
570
StringParameter bindDNParameter =
571        new StringParameter("binddn", "Directory Bind DN",
572                            "The DN to use when binding to the directory " +
573                            "server to perform search and modify operations.",
574                            false, "");
575
576   // The parameter used to indicate the address of the directory server.
577
StringParameter hostParameter =
578        new StringParameter("ldap_host", "Directory Server Address",
579                            "The address for the directory server.", true, "");
580
581   // The parameter that specifies the location of the SSL key store
582
StringParameter keyStoreParameter =
583     new StringParameter("sslkeystore", "SSL Key Store",
584                         "The path to the JSSE key store to use for an " +
585                         "SSL-based connection", false, "");
586
587   // The parameter used to indicate the attribute to use for the login ID.
588
StringParameter loginIDParameter =
589        new StringParameter("login_id_attr", "Login ID Attribute",
590                            "The attribute to use as the login ID to find the " +
591                            "user's entry.", true, DEFAULT_LOG_ID_ATTR);
592
593   // The parameter used to indicate the first login ID value or value pattern.
594
StringParameter loginIDValue1Parameter =
595        new StringParameter("login_id_value_1", "Login ID Value 1",
596                            "The text to use as the value of the login ID " +
597                            "attribute in search filters created using the " +
598                            "first set of user criteria. The value may " +
599                            "contain a range of numbers in square brackets.",
600                            true, "");
601
602   // The parameter used to indicate the second login ID value or value pattern.
603
StringParameter loginIDValue2Parameter =
604        new StringParameter("login_id_value_2", "Login ID Value 2",
605                            "The text to use as the value of the login ID " +
606                            "attribute in search filters created using the " +
607                            "second set of user criteria. The value may " +
608                            "contain a range of numbers in square brackets.",
609                            true, "");
610
611   // The parameter used to indicate the search base for the directory.
612
StringParameter searchBaseParameter =
613     new StringParameter("search_base", "User Search Base",
614                         "The DN in the directory server under which user " +
615                         "entries may be found.", true, "");
616
617   // The parameter that specifies the location of the SSL trust store
618
StringParameter trustStoreParameter =
619     new StringParameter("ssltruststore", "SSL Trust Store",
620                         "The path to the JSSE trust store to use for an " +
621                         "SSL-based connection", false, "");
622
623   // The stat tracker that will categorize the reasons for auth failures.
624
CategoricalTracker failureReasonTracker;
625
626   // The stat trackers that will count the numbers of authentication attempts.
627
IncrementalTracker overallAttemptCounter;
628   IncrementalTracker attemptCounter1;
629   IncrementalTracker attemptCounter2;
630
631   // The stat trackers that will count the numbers of failed authentications.
632
IncrementalTracker overallFailureCounter;
633   IncrementalTracker failureCounter1;
634   IncrementalTracker failureCounter2;
635
636   // The stat trackers that will count the numbers of successful
637
// authentications.
638
IncrementalTracker overallSuccessCounter;
639   IncrementalTracker successCounter1;
640   IncrementalTracker successCounter2;
641
642   // The LDAP connection that will be used for authentication operations by this
643
// thread.
644
LDAPConnection authConnection;
645
646   // The LDAP connection that will be used for bind operations by this thread.
647
LDAPConnection bindConnection;
648
649   // The set of constraints that will be used for non-search/bind operations.
650
LDAPConstraints authConstraints;
651
652   // The set of constraints that will be used for bind operations.
653
LDAPConstraints bindConstraints;
654
655   // The set of constraints that will be used for search operations.
656
LDAPSearchConstraints authSearchConstraints;
657
658   // The random number generator for this thread.
659
Random random;
660
661   // The stat trackers that will time each authentication.
662
TimeTracker overallAuthTimer;
663   TimeTracker authTimer1;
664   TimeTracker authTimer2;
665
666
667
668   /**
669    * Creates a new instance of this job thread. This constructor does not need
670    * to do anything other than invoke the constructor for the superclass.
671    */

672   public WeightedSiteMinderJobClass()
673   {
674     super();
675   }
676
677
678
679   /**
680    * Returns the user-friendly name that is to be used for this job class in the
681    * administrative interface.
682    *
683    * @return The user-friendly name for this job class.
684    */

685   public String JavaDoc getJobName()
686   {
687     return "LDAP Weighted SiteMinder Load Simulator";
688   }
689
690
691
692   /**
693    * Returns a description of this job that can be seen in the administrative
694    * interface.
695    *
696    * @return A description of this job class.
697    */

698   public String JavaDoc getJobDescription()
699   {
700     return "This job simulates the load that SiteMinder can place on the " +
701            "directory server when it is performing authentications. It uses " +
702            "a weighted access pattern to more accurately simulate real-world " +
703            "behavior.";
704   }
705
706
707
708   /**
709    * Retrieves the name of the category in which this job class exists. This is
710    * used to help arrange the job classes in the administrative interface.
711    *
712    * @return The name of the category in which this job class exists.
713    */

714   public String JavaDoc getJobCategoryName()
715   {
716     return "LDAP";
717   }
718
719
720
721   /**
722    * Returns the set of parameters whose value may be specified by the end user.
723    *
724    * @return The set of configurable parameters for this job class.
725    */

726   public ParameterList getParameterStubs()
727   {
728     Parameter[] parameterArray = new Parameter[]
729     {
730       placeholder,
731       hostParameter,
732       portParameter,
733       bindDNParameter,
734       bindPWParameter,
735       placeholder,
736       searchBaseParameter,
737       loginIDValue1Parameter,
738       loginIDValue2Parameter,
739       weightParameter,
740       loginPasswordParameter,
741       loginIDParameter,
742       placeholder,
743       attr1Parameter,
744       attr2Parameter,
745       attr3Parameter,
746       modAttrsParameter,
747       placeholder,
748       warmUpParameter,
749       coolDownParameter,
750       timeLimitParameter,
751       delayParameter,
752       placeholder,
753       useSSLParameter,
754       blindTrustParameter,
755       keyStoreParameter,
756       keyPWParameter,
757       trustStoreParameter,
758       trustPWParameter,
759       placeholder,
760       skipBindParameter,
761       ignoreInvCredParameter,
762       shareConnsParameter
763     };
764
765     return new ParameterList(parameterArray);
766   }
767
768
769
770   /**
771    * Retrieves the set of stat trackers that will be maintained by this job
772    * class. The stat trackers returned by this method do not have to actually
773    * contain any statistics -- the display name and stat tracker class should
774    * be the only information that callers of this method should rely upon. Note
775    * that this list can be different from the list of statistics actually
776    * collected by the job in some cases (e.g., if the job may not return all the
777    * stat trackers it advertises in all cases, or if the job may return stat
778    * trackers that it did not advertise), but it is a possibility that only the
779    * stat trackers returned by this method will be accessible for some features
780    * in the SLAMD server.
781    *
782    * @param clientID The client ID that should be used for the
783    * returned stat trackers.
784    * @param threadID The thread ID that should be used for the
785    * returned stat trackers.
786    * @param collectionInterval The collection interval that should be used for
787    * the returned stat trackers.
788    *
789    * @return The set of stat trackers that will be maintained by this job
790    * class.
791    */

792   public StatTracker[] getStatTrackerStubs(String JavaDoc clientID, String JavaDoc threadID,
793                                            int collectionInterval)
794   {
795     return new StatTracker[]
796     {
797       new IncrementalTracker(clientID, threadID,
798                              STAT_TRACKER_OVERALL_AUTHENTICATION_ATTEMPTS,
799                              collectionInterval),
800       new IncrementalTracker(clientID, threadID,
801                              STAT_TRACKER_AUTHENTICATION_1_ATTEMPTS,
802                              collectionInterval),
803       new IncrementalTracker(clientID, threadID,
804                              STAT_TRACKER_AUTHENTICATION_2_ATTEMPTS,
805                              collectionInterval),
806       new IncrementalTracker(clientID, threadID,
807                              STAT_TRACKER_OVERALL_SUCCESSFUL_AUTHENTICATIONS,
808                              collectionInterval),
809       new IncrementalTracker(clientID, threadID,
810                              STAT_TRACKER_SUCCESSFUL_AUTHENTICATIONS_1,
811                              collectionInterval),
812       new IncrementalTracker(clientID, threadID,
813                              STAT_TRACKER_SUCCESSFUL_AUTHENTICATIONS_2,
814                              collectionInterval),
815       new IncrementalTracker(clientID, threadID,
816                              STAT_TRACKER_OVERALL_FAILED_AUTHENTICATIONS,
817                              collectionInterval),
818       new IncrementalTracker(clientID, threadID,
819                              STAT_TRACKER_FAILED_AUTHENTICATIONS_1,
820                              collectionInterval),
821       new IncrementalTracker(clientID, threadID,
822                              STAT_TRACKER_FAILED_AUTHENTICATIONS_2,
823                              collectionInterval),
824       new TimeTracker(clientID, threadID,
825                       STAT_TRACKER_OVERALL_AUTHENTICATION_TIME,
826                       collectionInterval),
827       new TimeTracker(clientID, threadID, STAT_TRACKER_AUTHENTICATION_1_TIME,
828                       collectionInterval),
829       new TimeTracker(clientID, threadID, STAT_TRACKER_AUTHENTICATION_2_TIME,
830                       collectionInterval),
831       new CategoricalTracker(clientID, threadID, STAT_TRACKER_FAIL_REASON,
832                              collectionInterval)
833     };
834   }
835
836
837
838   /**
839    * Retrieves the set of stat trackers that are maintained by this job class.
840    *
841    * @return The set of stat trackers for this job class.
842    */

843   public StatTracker[] getStatTrackers()
844   {
845     return new StatTracker[]
846     {
847       overallAttemptCounter,
848       attemptCounter1,
849       attemptCounter2,
850       overallSuccessCounter,
851       successCounter1,
852       successCounter2,
853       overallFailureCounter,
854       failureCounter1,
855       failureCounter2,
856       overallAuthTimer,
857       authTimer1,
858       authTimer2,
859       failureReasonTracker
860     };
861   }
862
863
864
865   /**
866    * Indicates whether this job class implements logic that makes it possible to
867    * test the validity of job parameters before scheduling the job for execution
868    * (e.g., to see if the server is reachable using the information provided).
869    *
870    * @return <CODE>true</CODE> if this job provides a means of testing the job
871    * parameters, or <CODE>false</CODE> if not.
872    */

873   public boolean providesParameterTest()
874   {
875     return true;
876   }
877
878
879
880   /**
881    * Provides a means of testing the provided job parameters to determine
882    * whether they are valid (e.g., to see if the server is reachable) before
883    * scheduling the job for execution. This method will be executed by the
884    * SLAMD server system itself and not by any of the clients.
885    *
886    * @param parameters The job parameters to be tested.
887    * @param outputMessages The lines of output that were generated as part of
888    * the testing process. Each line of output should
889    * be added to this list as a separate string, and
890    * empty strings (but not <CODE>null</CODE> values)
891    * are allowed to provide separation between
892    * different messages. No formatting should be
893    * provided for these messages, however, since they
894    * may be displayed in either an HTML or plain text
895    * interface.
896    *
897    * @return <CODE>true</CODE> if the test completed successfully, or
898    * <CODE>false</CODE> if not. Note that even if the test did not
899    * complete successfully, the user will be presented with a warning
900    * but will still be allowed to schedule the job using the provided
901    * parameters. This is necessary because the parameters may still be
902    * valid even if the server couldn't validate them at the time the
903    * job was scheduled (e.g., if the server wasn't running or could not
904    * be reached by the SLAMD server even though it could be by the
905    * clients).
906    */

907   public boolean testJobParameters(ParameterList parameters,
908                                    ArrayList outputMessages)
909   {
910     // Get all the parameters that we might need to perform the test.
911
StringParameter hostParam =
912          parameters.getStringParameter(hostParameter.getName());
913     if ((hostParam == null) || (! hostParam.hasValue()))
914     {
915       outputMessages.add("ERROR: No directory server address was provided.");
916       return false;
917     }
918     String JavaDoc host = hostParam.getStringValue();
919
920
921     IntegerParameter portParam =
922          parameters.getIntegerParameter(portParameter.getName());
923     if ((portParam == null) || (! hostParam.hasValue()))
924     {
925       outputMessages.add("ERROR: No directory server port was provided.");
926       return false;
927     }
928     int port = portParam.getIntValue();
929
930
931     boolean useSSL = false;
932     BooleanParameter useSSLParam =
933          parameters.getBooleanParameter(useSSLParameter.getName());
934     if (useSSLParam != null)
935     {
936       useSSL = useSSLParam.getBooleanValue();
937     }
938