com.sun.slamd.scripting.ldap
Class LDAPAttributeVariable

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

public class LDAPAttributeVariable
extends Variable

This class defines a variable intended to store LDAP attribute information. LDAP attributes have the following methods:


Field Summary
static java.lang.String ADD_VALUE_METHOD_NAME
          The name of the method that will be used to add a new value to this array.
static int ADD_VALUE_METHOD_NUMBER
          The method number for the "addValue" method.
static int ASSIGN_1_METHOD_NUMBER
          The method number for the first "assign" method.
static int ASSIGN_2_METHOD_NUMBER
          The method number for the second "assign" method.
static int ASSIGN_3_METHOD_NUMBER
          The method number for the third "assign" method.
static int ASSIGN_4_METHOD_NUMBER
          The method number for the fourth "assign" method.
static java.lang.String ASSIGN_METHOD_NAME
          The name of the method that will be used to initialize this LDAP attribute.
static java.lang.String GET_NAME_METHOD_NAME
          The name of the method that will be used to get the name of this LDAP attribute.
static int GET_NAME_METHOD_NUMBER
          The method number for the "getName" method.
static java.lang.String GET_VALUE_METHOD_NAME
          The name of the method that will be used to get the value of this LDAP attribute.
static int GET_VALUE_METHOD_NUMBER
          The method number for the "getValue" method.
static java.lang.String GET_VALUES_METHOD_NAME
          The name of the method that will be used to get the set of values for this LDAP attribute.
static int GET_VALUES_METHOD_NUMBER
          The method number for the "getValues" method.
static java.lang.String HAS_VALUE_METHOD_NAME
          The name of the method that will be used to determine whether this LDAP attribute has a specified value.
static int HAS_VALUE_METHOD_NUMBER
          The method number for the "hasValue" method.
static java.lang.String IS_NULL_METHOD_NAME
          The name of the method that will be used to determine whether this LDAP attribute has not been initialized.
static int IS_NULL_METHOD_NUMBER
          The method number for the "isNull" method.
static Method[] LDAP_ATTRIBUTE_VARIABLE_METHODS
          The set of methods associated with LDAP attribute variables.
static java.lang.String LDAP_ATTRIBUTE_VARIABLE_TYPE
          The name that will be used for the data type of LDAP attribute variables.
static java.lang.String NOT_NULL_METHOD_NAME
          The name of the method that will be used to determine whether this LDAP attribute has been initialized.
static int NOT_NULL_METHOD_NUMBER
          The method number for the "notNull" method.
static java.lang.String REMOVE_ALL_VALUES_METHOD_NAME
          The name of the method that will be used to remove all values from this LDAP attribute.
static int REMOVE_ALL_VALUES_METHOD_NUMBER
          The method number for the "removeAllValues" method.
static java.lang.String REMOVE_VALUE_METHOD_NAME
          The name of the method that will be used to remove a specified value from this LDAP attribute.
static int REMOVE_VALUE_METHOD_NUMBER
          The method number for the removeValue method.
static java.lang.String SET_NAME_METHOD_NAME
          The name of the method that will be used to specify the name of this LDAP attribute.
static int SET_NAME_METHOD_NUMBER
          The method number for the "setName" method.
static java.lang.String SET_VALUE_METHOD_NAME
          The name of the method that will be used to specify the value for this LDAP attribute.
static int SET_VALUE_METHOD_NUMBER
          The method number for the "setValue" method.
static java.lang.String SET_VALUES_METHOD_NAME
          The name of the method that will be used to specify the set of values for this LDAP attribute.
static int SET_VALUES_METHOD_NUMBER
          The method number for the "setValues" method.
 
Constructor Summary
LDAPAttributeVariable()
          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.
LDAPAttributeVariable(netscape.ldap.LDAPAttribute attribute)
          Creates a new LDAP attribute variable from the provided LDAPAttribute object.
LDAPAttributeVariable(java.lang.String name, java.lang.String value)
          Creates a new LDAP attribute variable with the specified name and value.
LDAPAttributeVariable(java.lang.String name, java.lang.String[] values)
          Creates a new LDAP attribute variable with the specified name and set of values.
 
Method Summary
 void addValue(java.lang.String value)
          Adds the provided value to this attribute as long as it does not already exist.
 void assign(Argument argument)
          Assigns the value of the provided argument to this variable.
 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.
 java.lang.String getAttributeName()
          Retrieves the name of this LDAP attribute.
 java.lang.String getAttributeValue()
          Retrieves the value for this LDAP attribute.
 java.lang.String[] getAttributeValues()
          Retrieves the set of values for this LDAP attribute.
 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.
 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 setAttributeName(java.lang.String attributeName)
          Specifies the name for this LDAP attribute.
 void setAttributeValues(java.lang.String[] values)
          Specifies the set of values for this LDAP attribute.
 netscape.ldap.LDAPAttribute toLDAPAttribute()
          Retrieves this attribute as an LDAPAttribute object.
 
Methods inherited from class com.sun.slamd.scripting.engine.Variable
getArgumentAsString, getArgumentType, getArgumentValue, getName, getStatTrackers, isValidIdentifier, setName, startStatTrackers, stopStatTrackers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LDAP_ATTRIBUTE_VARIABLE_TYPE

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

See Also:
Constant Field Values

ADD_VALUE_METHOD_NAME

public static final java.lang.String ADD_VALUE_METHOD_NAME
The name of the method that will be used to add a new value to this array.

See Also:
Constant Field Values

ADD_VALUE_METHOD_NUMBER

public static final int ADD_VALUE_METHOD_NUMBER
The method number for the "addValue" method.

See Also:
Constant Field Values

ASSIGN_METHOD_NAME

public static final java.lang.String ASSIGN_METHOD_NAME
The name of the method that will be used to initialize this LDAP attribute.

See Also:
Constant Field Values

ASSIGN_1_METHOD_NUMBER

public static final int ASSIGN_1_METHOD_NUMBER
The method number for the first "assign" method.

See Also:
Constant Field Values

ASSIGN_2_METHOD_NUMBER

public static final int ASSIGN_2_METHOD_NUMBER
The method number for the second "assign" method.

See Also:
Constant Field Values

ASSIGN_3_METHOD_NUMBER

public static final int ASSIGN_3_METHOD_NUMBER
The method number for the third "assign" method.

See Also:
Constant Field Values

ASSIGN_4_METHOD_NUMBER

public static final int ASSIGN_4_METHOD_NUMBER
The method number for the fourth "assign" method.

See Also:
Constant Field Values

GET_NAME_METHOD_NAME

public static final java.lang.String GET_NAME_METHOD_NAME
The name of the method that will be used to get the name of this LDAP attribute.

See Also:
Constant Field Values

GET_NAME_METHOD_NUMBER

public static final int GET_NAME_METHOD_NUMBER
The method number for the "getName" method.

See Also:
Constant Field Values

GET_VALUE_METHOD_NAME

public static final java.lang.String GET_VALUE_METHOD_NAME
The name of the method that will be used to get the value of this LDAP attribute.

See Also:
Constant Field Values

GET_VALUE_METHOD_NUMBER

public static final int GET_VALUE_METHOD_NUMBER
The method number for the "getValue" method.

See Also:
Constant Field Values

GET_VALUES_METHOD_NAME

public static final java.lang.String GET_VALUES_METHOD_NAME
The name of the method that will be used to get the set of values for this LDAP attribute.

See Also:
Constant Field Values

GET_VALUES_METHOD_NUMBER

public static final int GET_VALUES_METHOD_NUMBER
The method number for the "getValues" method.

See Also:
Constant Field Values

HAS_VALUE_METHOD_NAME

public static final java.lang.String HAS_VALUE_METHOD_NAME
The name of the method that will be used to determine whether this LDAP attribute has a specified value.

See Also:
Constant Field Values

HAS_VALUE_METHOD_NUMBER

public static final int HAS_VALUE_METHOD_NUMBER
The method number for the "hasValue" method.

See Also:
Constant Field Values

IS_NULL_METHOD_NAME

public static final java.lang.String IS_NULL_METHOD_NAME
The name of the method that will be used to determine whether this LDAP attribute has not been initialized.

See Also:
Constant Field Values

IS_NULL_METHOD_NUMBER

public static final int IS_NULL_METHOD_NUMBER
The method number for the "isNull" method.

See Also:
Constant Field Values

NOT_NULL_METHOD_NAME

public static final java.lang.String NOT_NULL_METHOD_NAME
The name of the method that will be used to determine whether this LDAP attribute has been initialized.

See Also:
Constant Field Values

NOT_NULL_METHOD_NUMBER

public static final int NOT_NULL_METHOD_NUMBER
The method number for the "notNull" method.

See Also:
Constant Field Values

REMOVE_ALL_VALUES_METHOD_NAME

public static final java.lang.String REMOVE_ALL_VALUES_METHOD_NAME
The name of the method that will be used to remove all values from this LDAP attribute.

See Also:
Constant Field Values

REMOVE_ALL_VALUES_METHOD_NUMBER

public static final int REMOVE_ALL_VALUES_METHOD_NUMBER
The method number for the "removeAllValues" method.

See Also:
Constant Field Values

REMOVE_VALUE_METHOD_NAME

public static final java.lang.String REMOVE_VALUE_METHOD_NAME
The name of the method that will be used to remove a specified value from this LDAP attribute.

See Also:
Constant Field Values

REMOVE_VALUE_METHOD_NUMBER

public static final int REMOVE_VALUE_METHOD_NUMBER
The method number for the removeValue method.

See Also:
Constant Field Values

SET_NAME_METHOD_NAME

public static final java.lang.String SET_NAME_METHOD_NAME
The name of the method that will be used to specify the name of this LDAP attribute.

See Also:
Constant Field Values

SET_NAME_METHOD_NUMBER

public static final int SET_NAME_METHOD_NUMBER
The method number for the "setName" method.

See Also:
Constant Field Values

SET_VALUE_METHOD_NAME

public static final java.lang.String SET_VALUE_METHOD_NAME
The name of the method that will be used to specify the value for this LDAP attribute.

See Also:
Constant Field Values

SET_VALUE_METHOD_NUMBER

public static final int SET_VALUE_METHOD_NUMBER
The method number for the "setValue" method.

See Also:
Constant Field Values

SET_VALUES_METHOD_NAME

public static final java.lang.String SET_VALUES_METHOD_NAME
The name of the method that will be used to specify the set of values for this LDAP attribute.

See Also:
Constant Field Values

SET_VALUES_METHOD_NUMBER

public static final int SET_VALUES_METHOD_NUMBER
The method number for the "setValues" method.

See Also:
Constant Field Values

LDAP_ATTRIBUTE_VARIABLE_METHODS

public static final Method[] LDAP_ATTRIBUTE_VARIABLE_METHODS
The set of methods associated with LDAP attribute variables.

Constructor Detail

LDAPAttributeVariable

public LDAPAttributeVariable()
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.


LDAPAttributeVariable

public LDAPAttributeVariable(java.lang.String name,
                             java.lang.String value)
Creates a new LDAP attribute variable with the specified name and value.

Parameters:
name - The name to use for this attribute.
value - The value to use for this attribute.

LDAPAttributeVariable

public LDAPAttributeVariable(java.lang.String name,
                             java.lang.String[] values)
Creates a new LDAP attribute variable with the specified name and set of values.

Parameters:
name - The name to use for this attribute.
values - The set of values to use for this attribute.

LDAPAttributeVariable

public LDAPAttributeVariable(netscape.ldap.LDAPAttribute attribute)
Creates a new LDAP attribute variable from the provided LDAPAttribute object.

Parameters:
attribute - The LDAPAttribute object to use to create this LDAP attribute variable.
Method Detail

getAttributeName

public java.lang.String getAttributeName()
Retrieves the name of this LDAP attribute.

Returns:
The name of this LDAP attribute.

setAttributeName

public void setAttributeName(java.lang.String attributeName)
Specifies the name for this LDAP attribute.

Parameters:
attributeName - The name for this LDAP attribute.

getAttributeValue

public java.lang.String getAttributeValue()
Retrieves the value for this LDAP attribute. If there are multiple values, then the first will be returned. If there are no values, then an empty string will be returned.

Returns:
The value for this LDAP attribute.

getAttributeValues

public java.lang.String[] getAttributeValues()
Retrieves the set of values for this LDAP attribute.

Returns:
The set of values for this LDAP attribute.

setAttributeValues

public void setAttributeValues(java.lang.String[] values)
Specifies the set of values for this LDAP attribute.

Parameters:
values - The set of values for this LDAP attribute.

addValue

public void addValue(java.lang.String value)
Adds the provided value to this attribute as long as it does not already exist.

Parameters:
value - The value to add to this attribute.

toLDAPAttribute

public netscape.ldap.LDAPAttribute toLDAPAttribute()
Retrieves this attribute as an LDAPAttribute object.

Returns:
This attribute in the form of an LDAPAttribute object.

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.

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.