com.sun.slamd.scripting.ldap
Class LDAPConnectionVariable

java.lang.Object
  extended bycom.sun.slamd.scripting.engine.Variable
      extended bycom.sun.slamd.scripting.ldap.LDAPConnectionVariable
All Implemented Interfaces:
Argument

public class LDAPConnectionVariable
extends Variable

This class defines a variable that maintains a connection to an LDAP directory server and allows for interaction with that server. An LDAP connection has the following methods:


Field Summary
static java.lang.String ADD_METHOD_NAME
          The name of the method that performs an LDAP add operation.
static int ADD_METHOD_NUMBER
          The method number for the "add" method.
static java.lang.String BIND_METHOD_NAME
          The name of the method that performs an LDAP bind operation.
static int BIND_METHOD_NUMBER
          The method number for the "bind" method.
static java.lang.String COMPARE_FALSE_METHOD_NAME
          The name of the method that retrieves the result code associated with a compare result of "false".
static int COMPARE_FALSE_METHOD_NUMBER
          The method number for the "compareFalse" method.
static java.lang.String COMPARE_METHOD_NAME
          The name of the method that performs an LDAP compare operation.
static int COMPARE_METHOD_NUMBER
          The method number for the "compare" method.
static java.lang.String COMPARE_TRUE_METHOD_NAME
          The name of the method that retrieves the result code associated with a compare result of "true".
static int COMPARE_TRUE_METHOD_NUMBER
          The method number for the "compareTrue" method.
static int CONNECT_1_METHOD_NUMBER
          The method number for the first "connect" method.
static int CONNECT_2_METHOD_NUMBER
          The method number for the second "connect" method.
static int CONNECT_3_METHOD_NUMBER
          The method number for the third "connect" method.
static int CONNECT_4_METHOD_NUMBER
          The method number for the fourth "connect" method.
static int CONNECT_5_METHOD_NUMBER
          The method number for the fifth "connect" method.
static java.lang.String CONNECT_METHOD_NAME
          The name of the method that etablishes a connection to an LDAP directory server.
static java.lang.String DELETE_METHOD_NAME
          The name of the method that performs an LDAP delete operation.
static int DELETE_METHOD_NUMBER
          The method number for the "delete" method.
static java.lang.String DISCONNECT_METHOD_NAME
          The name of the method that performs an LDAP disconnect operation.
static int DISCONNECT_METHOD_NUMBER
          The method number for the "disconnect" method.
static java.lang.String ENABLE_ATTEMPT_COUNTERS_METHOD_NAME
          The name of the method that enables the stat trackers that count LDAP operation attempts.
static int ENABLE_ATTEMPT_COUNTERS_METHOD_NUMBER
          The method number for the "enableAttemptedOperationCounters" method.
static java.lang.String ENABLE_FAILED_COUNTERS_METHOD_NAME
          The name of the method that enables the stat trackers that count failed LDAP operations.
static int ENABLE_FAILED_COUNTERS_METHOD_NUMBER
          The method number for the "enableFailedOperationCounters" method.
static java.lang.String ENABLE_OPERATION_TIMERS_METHOD_NAME
          The name of the method that enables the stat trackers that time LDAP operations.
static int ENABLE_OPERATION_TIMERS_METHOD_NUMBER
          The method number for the "enableOperationTimers" method.
static java.lang.String ENABLE_SUCCESS_COUNTERS_METHOD_NAME
          The name of the method that enables the stat trackers that count successful LDAP operations.
static int ENABLE_SUCCESS_COUNTERS_METHOD_NUMBER
          The method number for the "enableSuccessfulOperationCounters" method.
static Method[] LDAP_CONNECTION_VARIABLE_METHODS
          The set of methods associated with LDAP connection variables.
static java.lang.String LDAP_CONNECTION_VARIABLE_TYPE
          The name that will be used for the data type of LDAP connection variables.
static int MODIFY_1_METHOD_NUMBER
          The method number for the first "modify" method.
static int MODIFY_2_METHOD_NUMBER
          The method number for the second "modify" method.
static java.lang.String MODIFY_METHOD_NAME
          The name of the method that performs an LDAP modify operation.
static java.lang.String MODIFY_RDN_METHOD_NAME
          The name of the method that performs an LDAP modify RDN operation.
static int MODIFY_RDN_METHOD_NUMBER
          The method number for the "modifyRDN" method.
static java.lang.String NEXT_ENTRY_METHOD_NAME
          The name of the method that retrieves the next entry in the set of search results.
static int NEXT_ENTRY_METHOD_NUMBER
          The method number for the "nextEntry" method.
static java.lang.String SCOPE_BASE_METHOD_NAME
          The name of the method that retrieves the search scope to use for base-level searches.
static int SCOPE_BASE_METHOD_NUMBER
          The method number for the "scopeBase" method.
static java.lang.String SCOPE_ONE_METHOD_NAME
          The name of the method that retrieves the search scope to use for onelevel searches.
static int SCOPE_ONE_METHOD_NUMBER
          The method number for the "scopeOne" method.
static java.lang.String SCOPE_SUB_METHOD_NAME
          The name of the method that retrieves the search scope to use for subtree searches.
static int SCOPE_SUB_METHOD_NUMBER
          The method number for the "scopeSub" method.
static int SEARCH_1_METHOD_NUMBER
          The method number for the first "search" method.
static int SEARCH_2_METHOD_NUMBER
          The method number for the second "search" method.
static int SEARCH_3_METHOD_NUMBER
          The method number for the third "search" method.
static java.lang.String SEARCH_METHOD_NAME
          The name of the method that performs an LDAP search operation.
static java.lang.String SUCCESS_METHOD_NAME
          The name of the method that retrieves the result code associated with a successful LDAP operation.
static int SUCCESS_METHOD_NUMBER
          The method number for the "success" method.
 
Constructor Summary
LDAPConnectionVariable()
          Creates a new variable with no name, to be used only when creating a variable with Class.newInstance(), and only when setName() is called after that to set the name.
 
Method Summary
 void assign(Argument argument)
          Assigns the value of the provided argument to this variable.
 void enableAttemptCounters(java.lang.String clientID, java.lang.String threadID, int collectionInterval)
          Enables the stat trackers that track the number of times the various LDAP operations were attempted.
 void enableFailedCounters(java.lang.String clientID, java.lang.String threadID, int collectionInterval)
          Enables the stat trackers that track the number of times the various LDAP operations were unable to complete successfully.
 void enableOperationTimers(java.lang.String clientID, java.lang.String threadID, int collectionInterval)
          Enables the stat trackers that track the length of time required to perform the various LDAP operations.
 void enableSuccessCounters(java.lang.String clientID, java.lang.String threadID, int collectionInterval)
          Enables the stat trackers that track the number of times the various LDAP operations were completed successfully.
 Variable executeMethod(int lineNumber, int methodNumber, Argument[] arguments)
          Executes the specified method, using the provided variables as arguments to the method, and makes the return value available to the caller.
 int getMethodNumber(java.lang.String methodName, java.lang.String[] argumentTypes)
          Retrieves the method number for the method that has the specified name and argument types, or -1 if there is no such method.
 Method[] getMethods()
          Retrieves a list of all methods defined for this variable.
 java.lang.String getReturnTypeForMethod(java.lang.String methodName, java.lang.String[] argumentTypes)
          Retrieves the return type for the method with the specified name and argument types.
 StatTracker[] getStatTrackers()
          Retrieves the stat trackers that have been maintained for this LDAP connection variable.
 java.lang.String getValueAsString()
          Retrieves a string representation of the value of this argument.
 java.lang.String getVariableTypeName()
          Retrieves the name of the variable type for this variable.
 boolean hasMethod(java.lang.String methodName)
          Indicates whether this variable type has a method with the specified name.
 void startStatTrackers(JobClass jobThread)
          Starts the stat trackers associated with this variable.
 void stopStatTrackers()
          Stops the stat trackers associated with this variable.
 
Methods inherited from class com.sun.slamd.scripting.engine.Variable
getArgumentAsString, getArgumentType, getArgumentValue, getName, isValidIdentifier, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LDAP_CONNECTION_VARIABLE_TYPE

public static final java.lang.String LDAP_CONNECTION_VARIABLE_TYPE
The name that will be used for the data type of LDAP connection variables.

See Also:
Constant Field Values

ADD_METHOD_NAME

public static final java.lang.String ADD_METHOD_NAME
The name of the method that performs an LDAP add operation.

See Also:
Constant Field Values

ADD_METHOD_NUMBER

public static final int ADD_METHOD_NUMBER
The method number for the "add" method.

See Also:
Constant Field Values

BIND_METHOD_NAME

public static final java.lang.String BIND_METHOD_NAME
The name of the method that performs an LDAP bind operation.

See Also:
Constant Field Values

BIND_METHOD_NUMBER

public static final int BIND_METHOD_NUMBER
The method number for the "bind" method.

See Also:
Constant Field Values

COMPARE_METHOD_NAME

public static final java.lang.String COMPARE_METHOD_NAME
The name of the method that performs an LDAP compare operation.

See Also:
Constant Field Values

COMPARE_METHOD_NUMBER

public static final int COMPARE_METHOD_NUMBER
The method number for the "compare" method.

See Also:
Constant Field Values

COMPARE_FALSE_METHOD_NAME

public static final java.lang.String COMPARE_FALSE_METHOD_NAME
The name of the method that retrieves the result code associated with a compare result of "false".

See Also:
Constant Field Values

COMPARE_FALSE_METHOD_NUMBER

public static final int COMPARE_FALSE_METHOD_NUMBER
The method number for the "compareFalse" method.

See Also:
Constant Field Values

COMPARE_TRUE_METHOD_NAME

public static final java.lang.String COMPARE_TRUE_METHOD_NAME
The name of the method that retrieves the result code associated with a compare result of "true".

See Also:
Constant Field Values

COMPARE_TRUE_METHOD_NUMBER

public static final int COMPARE_TRUE_METHOD_NUMBER
The method number for the "compareTrue" method.

See Also:
Constant Field Values

CONNECT_METHOD_NAME

public static final java.lang.String CONNECT_METHOD_NAME
The name of the method that etablishes a connection to an LDAP directory server.

See Also:
Constant Field Values

CONNECT_1_METHOD_NUMBER

public static final int CONNECT_1_METHOD_NUMBER
The method number for the first "connect" method.

See Also:
Constant Field Values

CONNECT_2_METHOD_NUMBER

public static final int CONNECT_2_METHOD_NUMBER
The method number for the second "connect" method.

See Also:
Constant Field Values

CONNECT_3_METHOD_NUMBER

public static final int CONNECT_3_METHOD_NUMBER
The method number for the third "connect" method.

See Also:
Constant Field Values

CONNECT_4_METHOD_NUMBER

public static final int CONNECT_4_METHOD_NUMBER
The method number for the fourth "connect" method.

See Also:
Constant Field Values

CONNECT_5_METHOD_NUMBER

public static final int CONNECT_5_METHOD_NUMBER
The method number for the fifth "connect" method.

See Also:
Constant Field Values

DELETE_METHOD_NAME

public static final java.lang.String DELETE_METHOD_NAME
The name of the method that performs an LDAP delete operation.

See Also:
Constant Field Values

DELETE_METHOD_NUMBER

public static final int DELETE_METHOD_NUMBER
The method number for the "delete" method.

See Also:
Constant Field Values

DISCONNECT_METHOD_NAME

public static final java.lang.String DISCONNECT_METHOD_NAME
The name of the method that performs an LDAP disconnect operation.

See Also:
Constant Field Values

DISCONNECT_METHOD_NUMBER

public static final int DISCONNECT_METHOD_NUMBER
The method number for the "disconnect" method.

See Also:
Constant Field Values

ENABLE_ATTEMPT_COUNTERS_METHOD_NAME

public static final java.lang.String ENABLE_ATTEMPT_COUNTERS_METHOD_NAME
The name of the method that enables the stat trackers that count LDAP operation attempts.

See Also:
Constant Field Values

ENABLE_ATTEMPT_COUNTERS_METHOD_NUMBER

public static final int ENABLE_ATTEMPT_COUNTERS_METHOD_NUMBER
The method number for the "enableAttemptedOperationCounters" method.

See Also:
Constant Field Values

ENABLE_FAILED_COUNTERS_METHOD_NAME

public static final java.lang.String ENABLE_FAILED_COUNTERS_METHOD_NAME
The name of the method that enables the stat trackers that count failed LDAP operations.

See Also:
Constant Field Values

ENABLE_FAILED_COUNTERS_METHOD_NUMBER

public static final int ENABLE_FAILED_COUNTERS_METHOD_NUMBER
The method number for the "enableFailedOperationCounters" method.

See Also:
Constant Field Values

ENABLE_OPERATION_TIMERS_METHOD_NAME

public static final java.lang.String ENABLE_OPERATION_TIMERS_METHOD_NAME
The name of the method that enables the stat trackers that time LDAP operations.

See Also:
Constant Field Values

ENABLE_OPERATION_TIMERS_METHOD_NUMBER

public static final int ENABLE_OPERATION_TIMERS_METHOD_NUMBER
The method number for the "enableOperationTimers" method.

See Also:
Constant Field Values

ENABLE_SUCCESS_COUNTERS_METHOD_NAME

public static final java.lang.String ENABLE_SUCCESS_COUNTERS_METHOD_NAME
The name of the method that enables the stat trackers that count successful LDAP operations.

See Also:
Constant Field Values

ENABLE_SUCCESS_COUNTERS_METHOD_NUMBER

public static final int ENABLE_SUCCESS_COUNTERS_METHOD_NUMBER
The method number for the "enableSuccessfulOperationCounters" method.

See Also:
Constant Field Values

MODIFY_METHOD_NAME

public static final java.lang.String MODIFY_METHOD_NAME
The name of the method that performs an LDAP modify operation.

See Also:
Constant Field Values

MODIFY_1_METHOD_NUMBER

public static final int MODIFY_1_METHOD_NUMBER
The method number for the first "modify" method.

See Also:
Constant Field Values

MODIFY_2_METHOD_NUMBER

public static final int MODIFY_2_METHOD_NUMBER
The method number for the second "modify" method.

See Also:
Constant Field Values

MODIFY_RDN_METHOD_NAME

public static final java.lang.String MODIFY_RDN_METHOD_NAME
The name of the method that performs an LDAP modify RDN operation.

See Also:
Constant Field Values

MODIFY_RDN_METHOD_NUMBER

public static final int MODIFY_RDN_METHOD_NUMBER
The method number for the "modifyRDN" method.

See Also:
Constant Field Values

NEXT_ENTRY_METHOD_NAME

public static final java.lang.String NEXT_ENTRY_METHOD_NAME
The name of the method that retrieves the next entry in the set of search results.

See Also:
Constant Field Values

NEXT_ENTRY_METHOD_NUMBER

public static final int NEXT_ENTRY_METHOD_NUMBER
The method number for the "nextEntry" method.

See Also:
Constant Field Values

SCOPE_BASE_METHOD_NAME

public static final java.lang.String SCOPE_BASE_METHOD_NAME
The name of the method that retrieves the search scope to use for base-level searches.

See Also:
Constant Field Values

SCOPE_BASE_METHOD_NUMBER

public static final int SCOPE_BASE_METHOD_NUMBER
The method number for the "scopeBase" method.

See Also:
Constant Field Values

SCOPE_ONE_METHOD_NAME

public static final java.lang.String SCOPE_ONE_METHOD_NAME
The name of the method that retrieves the search scope to use for onelevel searches.

See Also:
Constant Field Values

SCOPE_ONE_METHOD_NUMBER

public static final int SCOPE_ONE_METHOD_NUMBER
The method number for the "scopeOne" method.

See Also:
Constant Field Values

SCOPE_SUB_METHOD_NAME

public static final java.lang.String SCOPE_SUB_METHOD_NAME
The name of the method that retrieves the search scope to use for subtree searches.

See Also:
Constant Field Values

SCOPE_SUB_METHOD_NUMBER

public static final int SCOPE_SUB_METHOD_NUMBER
The method number for the "scopeSub" method.

See Also:
Constant Field Values

SEARCH_METHOD_NAME

public static final java.lang.String SEARCH_METHOD_NAME
The name of the method that performs an LDAP search operation.

See Also:
Constant Field Values

SEARCH_1_METHOD_NUMBER

public static final int SEARCH_1_METHOD_NUMBER
The method number for the first "search" method.

See Also:
Constant Field Values

SEARCH_2_METHOD_NUMBER

public static final int SEARCH_2_METHOD_NUMBER
The method number for the second "search" method.

See Also:
Constant Field Values

SEARCH_3_METHOD_NUMBER

public static final int SEARCH_3_METHOD_NUMBER
The method number for the third "search" method.

See Also:
Constant Field Values

SUCCESS_METHOD_NAME

public static final java.lang.String SUCCESS_METHOD_NAME
The name of the method that retrieves the result code associated with a successful LDAP operation.

See Also:
Constant Field Values

SUCCESS_METHOD_NUMBER

public static final int SUCCESS_METHOD_NUMBER
The method number for the "success" method.

See Also:
Constant Field Values

LDAP_CONNECTION_VARIABLE_METHODS

public static final Method[] LDAP_CONNECTION_VARIABLE_METHODS
The set of methods associated with LDAP connection variables.

Constructor Detail

LDAPConnectionVariable

public LDAPConnectionVariable()
                       throws ScriptException
Creates a new variable with no name, to be used only when creating a variable with Class.newInstance(), and only when setName() is called after that to set the name.

Throws:
ScriptException - If a problem occurs while initializing the new variable.
Method Detail

getVariableTypeName

public java.lang.String getVariableTypeName()
Retrieves the name of the variable type for this variable.

Specified by:
getVariableTypeName in class Variable
Returns:
The name of the variable type for this variable.

enableAttemptCounters

public void enableAttemptCounters(java.lang.String clientID,
                                  java.lang.String threadID,
                                  int collectionInterval)
Enables the stat trackers that track the number of times the various LDAP operations were attempted.

Parameters:
clientID - The client ID to use for the stat trackers.
threadID - The thread ID to use for the stat trackers.
collectionInterval - The collection interval to use for the stat trackers.

enableSuccessCounters

public void enableSuccessCounters(java.lang.String clientID,
                                  java.lang.String threadID,
                                  int collectionInterval)
Enables the stat trackers that track the number of times the various LDAP operations were completed successfully.

Parameters:
clientID - The client ID to use for the stat trackers.
threadID - The thread ID to use for the stat trackers.
collectionInterval - The collection interval to use for the stat trackers.

enableFailedCounters

public void enableFailedCounters(java.lang.String clientID,
                                 java.lang.String threadID,
                                 int collectionInterval)
Enables the stat trackers that track the number of times the various LDAP operations were unable to complete successfully.

Parameters:
clientID - The client ID to use for the stat trackers.
threadID - The thread ID to use for the stat trackers.
collectionInterval - The collection interval to use for the stat trackers.

enableOperationTimers

public void enableOperationTimers(java.lang.String clientID,
                                  java.lang.String threadID,
                                  int collectionInterval)
Enables the stat trackers that track the length of time required to perform the various LDAP operations.

Parameters:
clientID - The client ID to use for the stat trackers.
threadID - The thread ID to use for the stat trackers.
collectionInterval - The collection interval to use for the stat trackers.

getStatTrackers

public StatTracker[] getStatTrackers()
Retrieves the stat trackers that have been maintained for this LDAP connection variable.

Overrides:
getStatTrackers in class Variable
Returns:
The stat trackers that have been maintained for this LDAP connection variable.

startStatTrackers

public void startStatTrackers(JobClass jobThread)
Starts the stat trackers associated with this variable.

Overrides:
startStatTrackers in class Variable
Parameters:
jobThread - The job thread with which the stat trackers are associated.

stopStatTrackers

public void stopStatTrackers()
Stops the stat trackers associated with this variable.

Overrides:
stopStatTrackers in class Variable

getMethods

public Method[] getMethods()
Retrieves a list of all methods defined for this variable.

Specified by:
getMethods in class Variable
Returns:
A list of all methods defined for this variable.

hasMethod

public boolean hasMethod(java.lang.String methodName)
Indicates whether this variable type has a method with the specified name.

Specified by:
hasMethod in class Variable
Parameters:
methodName - The name of the method.
Returns:
true if this variable has a method with the specified name, or false if it does not.

getMethodNumber

public int getMethodNumber(java.lang.String methodName,
                           java.lang.String[] argumentTypes)
Retrieves the method number for the method that has the specified name and argument types, or -1 if there is no such method.

Specified by:
getMethodNumber in class Variable
Parameters:
methodName - The name of the method.
argumentTypes - The list of argument types for the method.
Returns:
The method number for the method that has the specified name and argument types.

getReturnTypeForMethod

public java.lang.String getReturnTypeForMethod(java.lang.String methodName,
                                               java.lang.String[] argumentTypes)
Retrieves the return type for the method with the specified name and argument types.

Specified by:
getReturnTypeForMethod in class Variable
Parameters:
methodName - The name of the method.
argumentTypes - The set of argument types for the method.
Returns:
The return type for the method, or null if there is no such method defined.

executeMethod

public Variable executeMethod(int lineNumber,
                              int methodNumber,
                              Argument[] arguments)
                       throws ScriptException
Executes the specified method, using the provided variables as arguments to the method, and makes the return value available to the caller.

Specified by:
executeMethod in class Variable
Parameters:
lineNumber - The line number of the script in which the method call occurs.
methodNumber - The method number of the method to execute.
arguments - The set of arguments to use for the method.
Returns:
The value returned from the method, or null if it does not return a value.
Throws:
ScriptException - If the specified method does not exist, or if a problem occurs while attempting to execute it.

assign

public void assign(Argument argument)
            throws ScriptException
Assigns the value of the provided argument to this variable. The value of the provided argument must be of the same type as this variable.

Specified by:
assign in class Variable
Parameters:
argument - The argument whose value should be assigned to this variable.
Throws:
ScriptException - If a problem occurs while performing the assignment.

getValueAsString

public java.lang.String getValueAsString()
Retrieves a string representation of the value of this argument.

Returns:
A string representation of the value of this argument.