com.sun.slamd.scripting.ldap
Class LDAPEntryVariable

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

public class LDAPEntryVariable
extends Variable

This class defines a variable intended to store an LDAP entry. LDAP entries have the following methods:


Field Summary
static int ADD_ATTRIBUTE_1_METHOD_NUMBER
          The method number for the first "addAttribute" method.
static int ADD_ATTRIBUTE_2_METHOD_NUMBER
          The method number for the second "addAttribute" method.
static int ADD_ATTRIBUTE_3_METHOD_NUMBER
          The method number for the third "addAttribute" method.
static java.lang.String ADD_ATTRIBUTE_METHOD_NAME
          The name of the method that will be used to add a new attribute to this entry.
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 java.lang.String ASSIGN_METHOD_NAME
          The name of the method that will be used to initialize this entry.
static java.lang.String GET_ATTRIBUTE_AT_METHOD_NAME
          The name of the method that will be used to retrieve the attribute in the specified position from this entry
static int GET_ATTRIBUTE_AT_METHOD_NUMBER
          The method number for the "getAttributeat" method.
static java.lang.String GET_ATTRIBUTE_COUNT_METHOD_NAME
          The name of the method that will be used to retrieve the number of attributes stored in this entry
static int GET_ATTRIBUTE_COUNT_METHOD_NUMBER
          The method number for the "getAttributeCount" method.
static java.lang.String GET_ATTRIBUTE_METHOD_NAME
          The name of the method that will be used to retrieve the attribute with the specified name from this entry
static int GET_ATTRIBUTE_METHOD_NUMBER
          The method number for the "getAttribute" method.
static java.lang.String GET_ATTRIBUTE_NAMES_METHOD_NAME
          The name of the method that will be used to retrieve the names of the attributes stored in this entry
static int GET_ATTRIBUTE_NAMES_METHOD_NUMBER
          The method number for the "getAttributeNames" method.
static java.lang.String GET_DN_METHOD_NAME
          The name of the method that will be used to retrieve the DN for this entry.
static int GET_DN_METHOD_NUMBER
          The method number for the "getDN" method.
static java.lang.String GET_NORMALIZED_DN_METHOD_NAME
          The name of the method that will be used to retrieve the lowercase normalized DN for this entry.
static int GET_NORMALIZED_DN_METHOD_NUMBER
          The method number for the "getNormalizedDN" method.
static java.lang.String GET_PARENT_DN_METHOD_NAME
          The name of the method that will be used to retrieve the DN of this entry's parent.
static int GET_PARENT_DN_METHOD_NUMBER
          The method number for the "getParentDN" method.
static java.lang.String GET_VALUE_METHOD_NAME
          The name of the method that will be used to retrieve the value for the specified 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 retrieve the set of values for the specified attribute.
static int GET_VALUES_METHOD_NUMBER
          The method number for the "getValues" method.
static java.lang.String HAS_ATTRIBUTE_METHOD_NAME
          The name of the method that will be used to determine if this entry contains the specified attribute.
static int HAS_ATTRIBUTE_METHOD_NUMBER
          The method number for the "hasAttribute" method.
static java.lang.String IS_NULL_METHOD_NAME
          The name of the method that will be used in order to determine if this entry has not been initialized.
static int IS_NULL_METHOD_NUMBER
          The method number for the "isNull" method.
static Method[] LDAP_ENTRY_VARIABLE_METHODS
          The set of methods associated with LDAP entry variables.
static java.lang.String LDAP_ENTRY_VARIABLE_TYPE
          The name that will be used for the data type of LDAP entry variables.
static java.lang.String NOT_NULL_METHOD_NAME
          The name of the method that will be used in order to determine if this entry is not uninitialized.
static int NOT_NULL_METHOD_NUMBER
          The method number for the "notNull" method.
static java.lang.String REMOVE_ALL_ATTRIBUTES_METHOD_NAME
          The name of the method that will be used to remove all attributes from this entry
static int REMOVE_ALL_ATTRIBUTES_METHOD_NUMBER
          The method number for the "removeAllAttributes" method.
static java.lang.String REMOVE_ATTRIBUTE_METHOD_NAME
          The name of the method that will be used to remove a specified attribute from this entry
static int REMOVE_ATTRIBUTE_METHOD_NUMBER
          The method number for the "removeAttribute" method.
static java.lang.String REPLACE_ATTRIBUTE_METHOD_NAME
          The name of the method that will be used to replace an attribute in this entry
static int REPLACE_ATTRIBUTE_METHOD_NUMBER
          The method number for the "replaceAttribute" method.
 
Constructor Summary
LDAPEntryVariable()
          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.
LDAPEntryVariable(netscape.ldap.LDAPEntry entry)
          Creates a new LDAP entry variable base on the provided LDAPEntry object.
 
Method Summary
 void addAttribute(LDAPAttributeVariable attribute)
          Adds the specified attribute to this entry.
 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.
 LDAPAttributeVariable getAttribute(java.lang.String attributeName)
          Retrieves the requested attribute from this entry.
 LDAPAttributeVariable[] getAttributes()
          Retrieves the set of attributes stored in this entry.
 java.lang.String getAttributeValue(java.lang.String attributeName)
          Retrieves the value of the requested attribute from this entry.
 java.lang.String[] getAttributeValues(java.lang.String attributeName)
          Retrieves the values of the requested attribute from this entry.
 java.lang.String getDN()
          Retrieves the DN for this entry.
 netscape.ldap.LDAPAttribute[] getLDAPAttributes()
          Retrieves the set of attributes stored in this entry as LDAPAttribute objects.
 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 setAttributes(netscape.ldap.LDAPAttribute[] attributes)
          Specifies the set of attributes to use for this entry.
 void setAttributes(LDAPAttributeVariable[] attributes)
          Specifies the set of attributes to use for this entry.
 void setDN(java.lang.String entryDN)
          Specifies the DN for this entry.
 netscape.ldap.LDAPEntry toLDAPEntry()
          Converts this LDAP entry variable to an LDAPEntry 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_ENTRY_VARIABLE_TYPE

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

See Also:
Constant Field Values

ADD_ATTRIBUTE_METHOD_NAME

public static final java.lang.String ADD_ATTRIBUTE_METHOD_NAME
The name of the method that will be used to add a new attribute to this entry.

See Also:
Constant Field Values

ADD_ATTRIBUTE_1_METHOD_NUMBER

public static final int ADD_ATTRIBUTE_1_METHOD_NUMBER
The method number for the first "addAttribute" method.

See Also:
Constant Field Values

ADD_ATTRIBUTE_2_METHOD_NUMBER

public static final int ADD_ATTRIBUTE_2_METHOD_NUMBER
The method number for the second "addAttribute" method.

See Also:
Constant Field Values

ADD_ATTRIBUTE_3_METHOD_NUMBER

public static final int ADD_ATTRIBUTE_3_METHOD_NUMBER
The method number for the third "addAttribute" 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 entry.

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

GET_ATTRIBUTE_METHOD_NAME

public static final java.lang.String GET_ATTRIBUTE_METHOD_NAME
The name of the method that will be used to retrieve the attribute with the specified name from this entry

See Also:
Constant Field Values

GET_ATTRIBUTE_METHOD_NUMBER

public static final int GET_ATTRIBUTE_METHOD_NUMBER
The method number for the "getAttribute" method.

See Also:
Constant Field Values

GET_ATTRIBUTE_AT_METHOD_NAME

public static final java.lang.String GET_ATTRIBUTE_AT_METHOD_NAME
The name of the method that will be used to retrieve the attribute in the specified position from this entry

See Also:
Constant Field Values

GET_ATTRIBUTE_AT_METHOD_NUMBER

public static final int GET_ATTRIBUTE_AT_METHOD_NUMBER
The method number for the "getAttributeat" method.

See Also:
Constant Field Values

GET_ATTRIBUTE_COUNT_METHOD_NAME

public static final java.lang.String GET_ATTRIBUTE_COUNT_METHOD_NAME
The name of the method that will be used to retrieve the number of attributes stored in this entry

See Also:
Constant Field Values

GET_ATTRIBUTE_COUNT_METHOD_NUMBER

public static final int GET_ATTRIBUTE_COUNT_METHOD_NUMBER
The method number for the "getAttributeCount" method.

See Also:
Constant Field Values

GET_ATTRIBUTE_NAMES_METHOD_NAME

public static final java.lang.String GET_ATTRIBUTE_NAMES_METHOD_NAME
The name of the method that will be used to retrieve the names of the attributes stored in this entry

See Also:
Constant Field Values

GET_ATTRIBUTE_NAMES_METHOD_NUMBER

public static final int GET_ATTRIBUTE_NAMES_METHOD_NUMBER
The method number for the "getAttributeNames" method.

See Also:
Constant Field Values

GET_DN_METHOD_NAME

public static final java.lang.String GET_DN_METHOD_NAME
The name of the method that will be used to retrieve the DN for this entry.

See Also:
Constant Field Values

GET_DN_METHOD_NUMBER

public static final int GET_DN_METHOD_NUMBER
The method number for the "getDN" method.

See Also:
Constant Field Values

GET_NORMALIZED_DN_METHOD_NAME

public static final java.lang.String GET_NORMALIZED_DN_METHOD_NAME
The name of the method that will be used to retrieve the lowercase normalized DN for this entry.

See Also:
Constant Field Values

GET_NORMALIZED_DN_METHOD_NUMBER

public static final int GET_NORMALIZED_DN_METHOD_NUMBER
The method number for the "getNormalizedDN" method.

See Also:
Constant Field Values

GET_PARENT_DN_METHOD_NAME

public static final java.lang.String GET_PARENT_DN_METHOD_NAME
The name of the method that will be used to retrieve the DN of this entry's parent.

See Also:
Constant Field Values

GET_PARENT_DN_METHOD_NUMBER

public static final int GET_PARENT_DN_METHOD_NUMBER
The method number for the "getParentDN" 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 retrieve the value for the specified 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 retrieve the set of values for the specified 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_ATTRIBUTE_METHOD_NAME

public static final java.lang.String HAS_ATTRIBUTE_METHOD_NAME
The name of the method that will be used to determine if this entry contains the specified attribute.

See Also:
Constant Field Values

HAS_ATTRIBUTE_METHOD_NUMBER

public static final int HAS_ATTRIBUTE_METHOD_NUMBER
The method number for the "hasAttribute" 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 in order to determine if this entry 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 in order to determine if this entry is not uninitialized.

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_ATTRIBUTES_METHOD_NAME

public static final java.lang.String REMOVE_ALL_ATTRIBUTES_METHOD_NAME
The name of the method that will be used to remove all attributes from this entry

See Also:
Constant Field Values

REMOVE_ALL_ATTRIBUTES_METHOD_NUMBER

public static final int REMOVE_ALL_ATTRIBUTES_METHOD_NUMBER
The method number for the "removeAllAttributes" method.

See Also:
Constant Field Values

REMOVE_ATTRIBUTE_METHOD_NAME

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

See Also:
Constant Field Values

REMOVE_ATTRIBUTE_METHOD_NUMBER

public static final int REMOVE_ATTRIBUTE_METHOD_NUMBER
The method number for the "removeAttribute" method.

See Also:
Constant Field Values

REPLACE_ATTRIBUTE_METHOD_NAME

public static final java.lang.String REPLACE_ATTRIBUTE_METHOD_NAME
The name of the method that will be used to replace an attribute in this entry

See Also:
Constant Field Values

REPLACE_ATTRIBUTE_METHOD_NUMBER

public static final int REPLACE_ATTRIBUTE_METHOD_NUMBER
The method number for the "replaceAttribute" method.

See Also:
Constant Field Values

LDAP_ENTRY_VARIABLE_METHODS

public static final Method[] LDAP_ENTRY_VARIABLE_METHODS
The set of methods associated with LDAP entry variables.

Constructor Detail

LDAPEntryVariable

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


LDAPEntryVariable

public LDAPEntryVariable(netscape.ldap.LDAPEntry entry)
Creates a new LDAP entry variable base on the provided LDAPEntry object.

Parameters:
entry - The LDAPEntry object that should be used to create this LDAP entry variable.
Method Detail

toLDAPEntry

public netscape.ldap.LDAPEntry toLDAPEntry()
Converts this LDAP entry variable to an LDAPEntry object.

Returns:
The LDAPEntry object converted from this variable.

getDN

public java.lang.String getDN()
Retrieves the DN for this entry.

Returns:
The DN for this entry.

setDN

public void setDN(java.lang.String entryDN)
Specifies the DN for this entry.

Parameters:
entryDN - The DN for this entry.

getAttributes

public LDAPAttributeVariable[] getAttributes()
Retrieves the set of attributes stored in this entry.

Returns:
The set of attributes stored in this entry.

getAttribute

public LDAPAttributeVariable getAttribute(java.lang.String attributeName)
Retrieves the requested attribute from this entry.

Parameters:
attributeName - The name of the attribute to be retrieved.
Returns:
The requested attribute, or null if the attribute is not defined.

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String attributeName)
Retrieves the value of the requested attribute from this entry.

Parameters:
attributeName - The name of the attribute to be retrieved.
Returns:
The value of the requested attribute, or null if the attribute is not defined or does not have any values.

getAttributeValues

public java.lang.String[] getAttributeValues(java.lang.String attributeName)
Retrieves the values of the requested attribute from this entry.

Parameters:
attributeName - The name of the attribute to be retrieved.
Returns:
The values of the requested attribute, or null if the attribute is not defined.

getLDAPAttributes

public netscape.ldap.LDAPAttribute[] getLDAPAttributes()
Retrieves the set of attributes stored in this entry as LDAPAttribute objects.

Returns:
The set of attributes stored in this entry as LDAPAttribute objects.

setAttributes

public void setAttributes(LDAPAttributeVariable[] attributes)
Specifies the set of attributes to use for this entry.

Parameters:
attributes - The set of attributes to use for this entry.

setAttributes

public void setAttributes(netscape.ldap.LDAPAttribute[] attributes)
Specifies the set of attributes to use for this entry.

Parameters:
attributes - The set of attributes to use for this entry.

addAttribute

public void addAttribute(LDAPAttributeVariable attribute)
Adds the specified attribute to this entry. If the specified attribute is not already in the set, then it is simply added. If the specified attribute is in the set, then the values are merged.

Parameters:
attribute - The attribute to be added to this entry.

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.