com.sun.slamd.example
Class SolarisLDAPAuthRateJobClass

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.sun.slamd.job.JobClass
          extended bycom.sun.slamd.example.SolarisLDAPAuthRateJobClass
All Implemented Interfaces:
java.lang.Runnable

public class SolarisLDAPAuthRateJobClass
extends JobClass

This class defines a SLAMD job that simulates the load that a Solaris 9 client places on the directory when authenticating telnet users through pam_ldap.


Field Summary
static int AUTH_METHOD_DIGEST_MD5
          The flag indicating that the authentication method should be "DIGEST-MD5".
static int AUTH_METHOD_SIMPLE
          The flag indicating that the authentication method should be "simple".
static java.lang.String[] AUTH_METHOD_STRINGS
          The human-readable strings corresponding to the authentication method constants.
static int AUTH_METHOD_TLS_DIGEST_MD5
          The flag indicating that the authentication method should be "DIGEST-MD5" over an SSL connection.
static int AUTH_METHOD_TLS_SIMPLE
          The flag indicating that the authentication method should be "simple" over an SSL connection.
static int CREDENTIAL_LEVEL_ANONYMOUS
          The flag indicating that the "anonymous" credential level should be used.
static int CREDENTIAL_LEVEL_PROXY
          The flag indicating that the "proxy" credential level should be used.
static java.lang.String[] CREDENTIAL_LEVEL_STRINGS
          The human-readable strings corresponding to the credential level constants.
static java.lang.String SSL_KEY_PASSWORD_PROPERTY
          The system property used to specify the password for the JSSE key store.
static java.lang.String SSL_KEY_STORE_PROPERTY
          The system property used to specify the location of the JSSE key store.
static java.lang.String SSL_TRUST_PASSWORD_PROPERTY
          The system property used to specify the password for the JSSE trust store.
static java.lang.String SSL_TRUST_STORE_PROPERTY
          The system property used to specify the location of the JSSE trust store.
static java.lang.String STAT_TRACKER_AUTHENTICATION_ATTEMPTS
          The name of the stat tracker that will be used to count the number of authentication attempts.
static java.lang.String STAT_TRACKER_AUTHENTICATION_TIME
          The name of the stat tracker that will be used to keep track of the time required to perform each authentication.
static java.lang.String STAT_TRACKER_FAILED_AUTHENTICATIONS
          The name of the stat tracker that will be used to count the number of failed authentications.
static java.lang.String STAT_TRACKER_SUCCESSFUL_AUTHENTICATIONS
          The name of the stat tracker that will be used to count the number of successful authentications.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SolarisLDAPAuthRateJobClass()
          Creates a new instance of this job thread.
 
Method Summary
 void bindAsUser(java.lang.String userDN, java.lang.String userPassword)
          Performs a bind as the user with the specified DN, using the configured authentication method.
 void getAutomountEntry(java.lang.String keyName)
          Simulates the query issued to the directory server when Solaris is looking for the automount records for a specified key.
 void getGroupsForUser(java.lang.String userID)
          Simulates the query issued to the directory server when Solaris is trying to determine the groups for the specified user.
 void getHostByAddress(java.lang.String ipAddress)
          Simulates the query issued to the directory server whenever the Solaris gethostbyaddr function is called.
 void getHostByName(java.lang.String hostname)
          Simulates the query issued to the directory server whenever the Solaris gethostbyname function is called.
 java.lang.String getIPAddress()
          Retrieves a randomly-chosen IP address to use as the client's source address.
 java.lang.String getJobCategoryName()
          Retrieves the name of the category in which this job class exists.
 java.lang.String getJobDescription()
          Returns a description of this job that can be seen in the administrative interface.
 java.lang.String getJobName()
          Returns the user-friendly name that is to be used for this job class in the administrative interface.
 void getNISKey(int uidNumber)
          Simulates the query issued to the directory server when Solaris is trying to get the NIS key information for the specified user.
 ParameterList getParameterStubs()
          Returns the set of parameters whose value may be specified by the end user.
 int getPosixAccount(java.lang.String userID)
          Simulates the query issued to the directory server whenever the Solaris getpwnam function is called.
 void getProjectByName(java.lang.String projectName)
          Simulates the query issued to the directory server when Solaris is trying to retrieve the project with the given name.
 java.lang.String getShadowAccount(java.lang.String userID)
          Simulates the query issued to the directory server whenever the Solaris getspnam function is called.
 StatTracker[] getStatTrackers()
          Retrieves the set of stat trackers that are maintained by this job class.
 StatTracker[] getStatTrackerStubs(java.lang.String clientID, java.lang.String threadID, int collectionInterval)
          Retrieves the set of stat trackers that will be maintained by this job class.
 void getUserAttr(java.lang.String userID)
          Simulates the query issued to the directory server when Solaris is trying to retrieve extended attributes for a user entry.
 boolean getUserEntry(java.lang.String userID)
          Retrieves the entry for the user with all attributes.
 java.lang.String getUserID()
          Retrieves a randomly-chosen user ID to use for the next authentication.
 void initializeClient(java.lang.String clientID, ParameterList parameters)
          Performs initialization for this job on each client immediately before each thread is created to actually run the job.
 void initializeThread(java.lang.String clientID, java.lang.String threadID, int collectionInterval, ParameterList parameters)
          Initializes this job class with the information that it will use when actually running the job.
 void runJob()
          Perform the work of this job thread by establishing the connection(s) to the directory server and issuing all the appropriate queries.
 void validateJobInfo(int numClients, int threadsPerClient, int threadStartupDelay, java.util.Date startTime, java.util.Date stopTime, int duration, int collectionInterval, ParameterList parameters)
          Provides a means of validating the information used to schedule the job, including the scheduling information and list of parameters.
 
Methods inherited from class com.sun.slamd.job.JobClass
destroy, enableRealTimeStats, finalizeClient, finalizeJob, finalizeThread, getActiveThreadCount, getClientID, getClientNumber, getClientSideJob, getClientSideParameterStubs, getCollectionInterval, getJobID, getScheduledDuration, getShouldStopTime, getStatReporter, getThreadID, getThreadNumber, indicateCompletedWithErrors, indicateStoppedDueToError, initializeJob, initializeJobThread, isDeprecated, isRunning, logMessage, overrideCollectionInterval, overrideNumClients, overrideThreadsPerClient, providesParameterTest, run, setClientNumber, setClientSideJob, setThreadNumber, shouldStop, stackTraceToString, startJob, stopAndWait, stopJob, stopRequested, testJobParameters, writeVerbose
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CREDENTIAL_LEVEL_ANONYMOUS

public static final int CREDENTIAL_LEVEL_ANONYMOUS
The flag indicating that the "anonymous" credential level should be used.

See Also:
Constant Field Values

CREDENTIAL_LEVEL_PROXY

public static final int CREDENTIAL_LEVEL_PROXY
The flag indicating that the "proxy" credential level should be used.

See Also:
Constant Field Values

CREDENTIAL_LEVEL_STRINGS

public static final java.lang.String[] CREDENTIAL_LEVEL_STRINGS
The human-readable strings corresponding to the credential level constants.


AUTH_METHOD_SIMPLE

public static final int AUTH_METHOD_SIMPLE
The flag indicating that the authentication method should be "simple".

See Also:
Constant Field Values

AUTH_METHOD_DIGEST_MD5

public static final int AUTH_METHOD_DIGEST_MD5
The flag indicating that the authentication method should be "DIGEST-MD5".

See Also:
Constant Field Values

AUTH_METHOD_TLS_SIMPLE

public static final int AUTH_METHOD_TLS_SIMPLE
The flag indicating that the authentication method should be "simple" over an SSL connection.

See Also:
Constant Field Values

AUTH_METHOD_TLS_DIGEST_MD5

public static final int AUTH_METHOD_TLS_DIGEST_MD5
The flag indicating that the authentication method should be "DIGEST-MD5" over an SSL connection.

See Also:
Constant Field Values

AUTH_METHOD_STRINGS

public static final java.lang.String[] AUTH_METHOD_STRINGS
The human-readable strings corresponding to the authentication method constants.


SSL_KEY_STORE_PROPERTY

public static final java.lang.String SSL_KEY_STORE_PROPERTY
The system property used to specify the location of the JSSE key store.

See Also:
Constant Field Values

SSL_KEY_PASSWORD_PROPERTY

public static final java.lang.String SSL_KEY_PASSWORD_PROPERTY
The system property used to specify the password for the JSSE key store.

See Also:
Constant Field Values

SSL_TRUST_STORE_PROPERTY

public static final java.lang.String SSL_TRUST_STORE_PROPERTY
The system property used to specify the location of the JSSE trust store.

See Also:
Constant Field Values

SSL_TRUST_PASSWORD_PROPERTY

public static final java.lang.String SSL_TRUST_PASSWORD_PROPERTY
The system property used to specify the password for the JSSE trust store.

See Also:
Constant Field Values

STAT_TRACKER_AUTHENTICATION_ATTEMPTS

public static final java.lang.String STAT_TRACKER_AUTHENTICATION_ATTEMPTS
The name of the stat tracker that will be used to count the number of authentication attempts.

See Also:
Constant Field Values

STAT_TRACKER_AUTHENTICATION_TIME

public static final java.lang.String STAT_TRACKER_AUTHENTICATION_TIME
The name of the stat tracker that will be used to keep track of the time required to perform each authentication.

See Also:
Constant Field Values

STAT_TRACKER_FAILED_AUTHENTICATIONS

public static final java.lang.String STAT_TRACKER_FAILED_AUTHENTICATIONS
The name of the stat tracker that will be used to count the number of failed authentications.

See Also:
Constant Field Values

STAT_TRACKER_SUCCESSFUL_AUTHENTICATIONS

public static final java.lang.String STAT_TRACKER_SUCCESSFUL_AUTHENTICATIONS
The name of the stat tracker that will be used to count the number of successful authentications.

See Also:
Constant Field Values
Constructor Detail

SolarisLDAPAuthRateJobClass

public SolarisLDAPAuthRateJobClass()
Creates a new instance of this job thread. This constructor does not need to do anything other than invoke the constructor for the superclass.

Method Detail

getJobName

public java.lang.String getJobName()
Returns the user-friendly name that is to be used for this job class in the administrative interface.

Specified by:
getJobName in class JobClass
Returns:
The user-friendly name for this job class.

getJobDescription

public java.lang.String getJobDescription()
Returns a description of this job that can be seen in the administrative interface.

Specified by:
getJobDescription in class JobClass
Returns:
A description of this job class.

getJobCategoryName

public java.lang.String getJobCategoryName()
Retrieves the name of the category in which this job class exists. This is used to help arrange the job classes in the administrative interface.

Overrides:
getJobCategoryName in class JobClass
Returns:
The name of the category in which this job class exists.

getParameterStubs

public ParameterList getParameterStubs()
Returns the set of parameters whose value may be specified by the end user.

Specified by:
getParameterStubs in class JobClass
Returns:
The set of configurable parameters for this job class.

getStatTrackerStubs

public StatTracker[] getStatTrackerStubs(java.lang.String clientID,
                                         java.lang.String threadID,
                                         int collectionInterval)
Retrieves the set of stat trackers that will be maintained by this job class. The stat trackers returned by this method do not have to actually contain any statistics -- the display name and stat tracker class should be the only information that callers of this method should rely upon. Note that this list can be different from the list of statistics actually collected by the job in some cases (e.g., if the job may not return all the stat trackers it advertises in all cases, or if the job may return stat trackers that it did not advertise), but it is a possibility that only the stat trackers returned by this method will be accessible for some features in the SLAMD server.

Specified by:
getStatTrackerStubs in class JobClass
Parameters:
clientID - The client ID that should be used for the returned stat trackers.
threadID - The thread ID that should be used for the returned stat trackers.
collectionInterval - The collection interval that should be used for the returned stat trackers.
Returns:
The set of stat trackers that will be maintained by this job class.

getStatTrackers

public StatTracker[] getStatTrackers()
Retrieves the set of stat trackers that are maintained by this job class.

Specified by:
getStatTrackers in class JobClass
Returns:
The set of stat trackers for this job class.

validateJobInfo

public void validateJobInfo(int numClients,
                            int threadsPerClient,
                            int threadStartupDelay,
                            java.util.Date startTime,
                            java.util.Date stopTime,
                            int duration,
                            int collectionInterval,
                            ParameterList parameters)
                     throws InvalidValueException
Provides a means of validating the information used to schedule the job, including the scheduling information and list of parameters.

Overrides:
validateJobInfo in class JobClass
Parameters:
numClients - The number of clients that should be used to run the job.
threadsPerClient - The number of threads that should be created on each client to run the job.
threadStartupDelay - The delay in milliseconds that should be used when starting the client threads.
startTime - The time that the job should start running.
stopTime - The time that the job should stop running.
duration - The maximum length of time in seconds that the job should be allowed to run.
collectionInterval - The collection interval that should be used when gathering statistics for the job.
parameters - The set of parameters provided to this job that can be used to customize its behavior.
Throws:
InvalidValueException - If the provided information is not appropriate for running this job.

initializeClient

public void initializeClient(java.lang.String clientID,
                             ParameterList parameters)
                      throws UnableToRunException
Performs initialization for this job on each client immediately before each thread is created to actually run the job.

Overrides:
initializeClient in class JobClass
Parameters:
clientID - The ID assigned to the client running this job.
parameters - The set of parameters provided to this job that can be used to customize its behavior.
Throws:
UnableToRunException - If the client initialization could not be completed successfully and the job is unable to run.

initializeThread

public void initializeThread(java.lang.String clientID,
                             java.lang.String threadID,
                             int collectionInterval,
                             ParameterList parameters)
                      throws UnableToRunException
Initializes this job class with the information that it will use when actually running the job. This will also initialize the stat trackers used by the job.

Specified by:
initializeThread in class JobClass
Parameters:
clientID - The thread ID for this thread.
threadID - The thread ID for this thread.
collectionInterval - The collection interval to use for gathering statistics while processing the job.
parameters - The st of parameters that contain the information used to customize the way this job is processed.
Throws:
UnableToRunException - If a problem occurs that prevents the thread from being able to run properly.

runJob

public void runJob()
Perform the work of this job thread by establishing the connection(s) to the directory server and issuing all the appropriate queries. The job will continue until the specified number of iterations have been performed, the stop time has been reached, the maximum duration has been reached, or the SLAMD server indicates that a stop has been requested.

Specified by:
runJob in class JobClass

getIPAddress

public java.lang.String getIPAddress()
Retrieves a randomly-chosen IP address to use as the client's source address.

Returns:
A randomly-chosen IP address to use as the client's source address.

getUserID

public java.lang.String getUserID()
Retrieves a randomly-chosen user ID to use for the next authentication.

Returns:
A randomly-chosen user ID to use for the next authentication.

getHostByAddress

public void getHostByAddress(java.lang.String ipAddress)
                      throws netscape.ldap.LDAPException
Simulates the query issued to the directory server whenever the Solaris gethostbyaddr function is called.

Parameters:
ipAddress - The dotted-quad (e.g., 1.2.3.4) IP address for which to retrieve the value.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query.

getHostByName

public void getHostByName(java.lang.String hostname)
                   throws netscape.ldap.LDAPException
Simulates the query issued to the directory server whenever the Solaris gethostbyname function is called.

Parameters:
hostname - The hostname for which to retrieve the address.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query.

getPosixAccount

public int getPosixAccount(java.lang.String userID)
                    throws netscape.ldap.LDAPException
Simulates the query issued to the directory server whenever the Solaris getpwnam function is called.

Parameters:
userID - The user ID for which to retrieve the entry.
Returns:
The uid number for the user whose account was returned, or -1 if no user could be found.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query, or if multiple entries matched the given query.

getShadowAccount

public java.lang.String getShadowAccount(java.lang.String userID)
                                  throws netscape.ldap.LDAPException
Simulates the query issued to the directory server whenever the Solaris getspnam function is called.

Parameters:
userID - The user ID for which to retrieve the entry.
Returns:
The DN of the entry matching the provided criteria, or null if no entry was found.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query, or if multiple entries matched the given query.

getUserEntry

public boolean getUserEntry(java.lang.String userID)
                     throws netscape.ldap.LDAPException
Retrieves the entry for the user with all attributes. I'm not sure which system call this corresponds to, but it does happen during the login process.

Parameters:
userID - The user ID for which to retrieve the entry.
Returns:
true if a match was found, or false if there were no matches.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query, or if multiple entries matched the given query.

bindAsUser

public void bindAsUser(java.lang.String userDN,
                       java.lang.String userPassword)
                throws netscape.ldap.LDAPException
Performs a bind as the user with the specified DN, using the configured authentication method.

Parameters:
userDN - The DN for the user.
userPassword - The password for the user.
Throws:
netscape.ldap.LDAPException - If a problem occurs while performing the bind.

getAutomountEntry

public void getAutomountEntry(java.lang.String keyName)
                       throws netscape.ldap.LDAPException
Simulates the query issued to the directory server when Solaris is looking for the automount records for a specified key.

Parameters:
keyName - The name of the key for which to retrieve the automount records.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query.

getUserAttr

public void getUserAttr(java.lang.String userID)
                 throws netscape.ldap.LDAPException
Simulates the query issued to the directory server when Solaris is trying to retrieve extended attributes for a user entry.

Parameters:
userID - The user ID for which to retrieve the information.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query.

getProjectByName

public void getProjectByName(java.lang.String projectName)
                      throws netscape.ldap.LDAPException
Simulates the query issued to the directory server when Solaris is trying to retrieve the project with the given name.

Parameters:
projectName - The name of the project to retrieve.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query.

getGroupsForUser

public void getGroupsForUser(java.lang.String userID)
                      throws netscape.ldap.LDAPException
Simulates the query issued to the directory server when Solaris is trying to determine the groups for the specified user.

Parameters:
userID - The user ID for which to retrieve the groups.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query.

getNISKey

public void getNISKey(int uidNumber)
               throws netscape.ldap.LDAPException
Simulates the query issued to the directory server when Solaris is trying to get the NIS key information for the specified user.

Parameters:
uidNumber - The UID number for the user.
Throws:
netscape.ldap.LDAPException - If a problem occurs while processing the query.