|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mentata.l3d.L3DObject
A template for a class of entries in a directory database. This abstract class can be extended in context packages to correspond with one or more object classes from the target directory's schema, a specific location in the directory tree, filters, and other identifying characteristics. Each instance defines a set of L3DAttributes, often yet not always corresponding to those permitted in the directory schema. An instance may also define basic traits such as a friendly label, default sort behavior, a search limit, or use of incremental identifiers. An L3DObject initially represents a template container for an entry with no attribute values. There are no methods to manipulate this structure from without, but attribute values can be defined either manually or by populating the template with an identified directory entry. The attributes themselves are then available as L3DAttributes, providing access to type-specific functionality. An L3DObject instance can be bound with a directory connection for use in internal operations throughout its life. Given an authoritative connection, a populated L3DObject can be used to create, delete, or modify a corresponding entry in the database. Supporting methods also enable searching for entries, instantiating other objects in the same context, labelling attributes either explicitly or through external properties files, setting a locale, getting localized date/time stamps, and managing lists of attributes for various purposes.
| Field Summary | |
static boolean |
MULTIVALUE
A multivalue attribute. |
static int |
ONE
A scope that is limited to a single level of the directory hierarchy. |
static boolean |
OPTIONAL
An optional attribute. |
static boolean |
REQUIRED
A required attribute. |
static boolean |
SINGLEVALUE
A single value attribute. |
static int |
SUBTREE
A scope that includes an entire subtree of the directory hierarchy. |
| Constructor Summary | |
L3DObject(L3DContext context)
Constructs an empty object with an attribute structure fitting all object classes. |
|
| Method Summary | |
protected void |
addAttribute(String name,
L3DAttribute attribute)
Adds a new attribute to the object definition. |
protected void |
addAttribute(String name,
L3DAttribute attribute,
boolean multivalue)
Adds a new attribute to the object definition. |
protected void |
addAttribute(String name,
L3DAttribute attribute,
boolean multivalue,
boolean required)
Adds a new attribute to the object definition. |
protected void |
addAttributeList(String name,
String[] attributes)
Adds a new attribute list to the object. |
protected void |
addObjectclasses(String[] objectclasses)
Adds directory objectclass values to this object. |
protected void |
addPrerequisite(String[] attributes,
String[] prerequisites)
Adds a prerequisite relationship for multiple attributes to the object. |
protected void |
addPrerequisite(String attribute,
String[] prerequisites)
Adds a new attribute prerequisite relationship to the object. |
protected void |
applyLabels()
Reads object and attribute labels from a default properties bundle. |
protected void |
applyLabels(String tag)
Reads object and attribute labels from a named properties bundle. |
int |
compare(Object one,
Object two)
Sorts given LDAPEntry instances by preconfigured attributes and orderings. |
void |
create()
Create the associated entry in the directory via the bound connection. |
void |
create(LDAPConnection conn)
Create the associated entry in the directory. |
void |
delete()
Delete the associated entry from the directory via the bound connection. |
void |
delete(LDAPConnection conn)
Delete the associated entry from the directory. |
void |
empty()
Clears values from all attributes. |
void |
extend(LDAPConnection conn,
String classname)
Extends the associated entry with new objectclasses. |
void |
extend(String classname)
Extends the associated entry with new objectclasses via a bound counnection. |
L3DAttribute |
getAttribute(String name)
Returns the named attribute. |
String[] |
getAttributeList()
Returns the names of all attributes of the object. |
String[] |
getAttributeList(String name)
Returns the attribute names in the named list. |
protected LDAPConnection |
getBind()
Returns the connection associated with an object. |
String |
getClassName()
Returns the name of the object's Java class. |
protected L3DContext |
getContext()
Returns the containing context for this object. |
String |
getContextName()
Returns the name of the object's context. |
static String |
getDatestamp()
Returns a stamp representing the current date in the default locale. |
String |
getDN()
Returns the distinguished name for the associated entry. |
String |
getDN(String identifier)
Determines the distinguished name for an identified entry. |
String |
getIdentifier()
Returns the unique identifier value for the associated entry. |
String |
getIdentifierAttribute()
Returns the name of the unique identifier attribute for entries of the object. |
LDAPEntry |
getIncrementEntry()
Returns a counter entry for an auto-incrementing object. |
LDAPEntry |
getIncrementEntry(LDAPConnection conn)
Returns a counter entry for an auto-incrementing object. |
String |
getLabel()
Returns the label for the object type. |
String |
getLabel(String attribute)
Returns the label for an attribute. |
int |
getLimit()
Returns the maximum number of entries to return in a search. |
Locale |
getLocale()
Returns the locale for the object. |
String |
getName()
Returns the common name value for the associated entry. |
String |
getNameAttribute()
Returns the name of the common name attribute for entries of the object. |
L3DObject |
getObject(String classname)
Returns an empty instance of a given object from the same context. |
String[] |
getObjectclasses()
Returns the directory objectclass values that this object uniquely defines. |
L3DPath |
getPath()
Returns a path bean describing the object. |
L3DPath |
getPath(String attribute)
Returns a path bean describing the object with attribute. |
String[] |
getPrerequisites(String attribute)
Returns the prerequisite attributes for the named attribute. |
static String |
getTimestamp()
Returns a UTC timestamp for the current date and time. |
boolean |
hasMatch()
Indicates if an existing entry of the object type has the same identifier. |
boolean |
hasMatch(String filter)
Indicates if an existing entry of the object type matches the submitted filter. |
boolean |
isBound()
Identifies if the object is associated with a connection. |
boolean |
isIncremental()
Identifies if the object uses auto-incrementing identifiers. |
String[] |
mergeAttributeLists(String[] lists)
Returns a consolidation of attribute names from specified lists. |
String[] |
mergeAttributeLists(String[][] lists)
Returns a consolidation of attribute names from given lists. |
void |
minimizeScope()
Sets the object's scope to one. |
static boolean |
onList(String element,
String[] list)
Determines if a given element appears on a given list. |
void |
populate(LDAPEntry entry)
Sets values of all attributes to reflect those of a given directory entry. |
void |
populate(String dn)
Sets values of all attributes to reflect those of a given distinguished name. |
void |
populate(String dn,
String[] attributes)
Sets values of given attributes to reflect those of a given distinguished name. |
void |
prependBase(String rdn)
Prepends a relative dn to the beginning of the object's base. |
LDAPEntry[] |
search(String filter)
Returns complete entries matching a submitted filter. |
LDAPEntry[] |
search(String filter,
String[] attributes)
Returns entries matching a submitted filter. |
LDAPEntry[] |
search(String filter,
String[] attributes,
int limit)
Returns entries matching a submitted filter. |
LDAPEntry[] |
search(String filter,
String[] attributes,
int limit,
boolean sorted)
Returns entries matching a submitted filter. |
LDAPEntry[] |
search(String filter,
String[] attributes,
int limit,
boolean sorted,
LDAPConnection conn)
Returns entries matching a submitted filter. |
void |
setBind(LDAPConnection conn)
Associates the object with a directory connection. |
protected void |
setFilter(String filter)
Sets the default filter for the object. |
protected void |
setIncremental(String rdn,
String attribute,
String prefix)
Configure auto-incrementing for identifiers. |
protected void |
setLabel(String label)
Assigns a label to the type of object. |
protected void |
setLabel(String label,
String attribute)
Assigns a label to an attribute of the object. |
void |
setLimit(int limit)
Sets a maximum for the number of entries to return in a search. |
void |
setLocale(Locale locale)
Sets the locale for the object. |
void |
setSorting(String[] attributes,
boolean[] ascending)
Configures the sorting behavior for entries of the object. |
void |
update(LDAPConnection conn,
String attribute)
Updates the directory database with the current value for the given attribute. |
void |
update(String attribute)
Updates the directory database with the current value for the given attribute via a bound connection. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
equals |
| Field Detail |
public static final int ONE
public static final int SUBTREE
public static final boolean REQUIRED
public static final boolean OPTIONAL
public static final boolean MULTIVALUE
public static final boolean SINGLEVALUE
| Constructor Detail |
public L3DObject(L3DContext context)
throws L3DException
context - a containing L3D context| Method Detail |
protected L3DContext getContext()
public final L3DObject getObject(String classname)
throws L3DException
L3DException - if the containing context or requested object are undefinedpublic final String getContextName()
public final String getClassName()
protected final void setLabel(String label)
label - a clear description of object type
protected final void setLabel(String label,
String attribute)
label - a clear descriptionattribute - an attribute to describepublic final String getLabel()
public final String getLabel(String attribute)
attribute - an attribute
protected final void applyLabels()
throws L3DException
L3DException - if the default properties bundle is undefined
protected final void applyLabels(String tag)
throws L3DException
tag - the name of a properties bundle
L3DException - if the named properties bundle is undefinedpublic final void prependBase(String rdn)
rdn - a relative distinguished namepublic final void minimizeScope()
protected final void setFilter(String filter)
filter - a parenthetically enclosed directory filterpublic final void setLocale(Locale locale)
locale - a localepublic final Locale getLocale()
public static final String getTimestamp()
public static final String getDatestamp()
protected final void addObjectclasses(String[] objectclasses)
throws L3DException
objectclasses - names of directory objectclasses
L3DExceptionpublic final String[] getObjectclasses()
protected final void addAttributeList(String name,
String[] attributes)
name - a name for the attribute listattributes - a list of attributes to includepublic final String[] getAttributeList()
public final String[] getAttributeList(String name)
throws L3DException
name - an attribute list name
L3DException - if the named list is undefined
public static boolean onList(String element,
String[] list)
element - a string to findlist - a list of values to search
protected final void addPrerequisite(String attribute,
String[] prerequisites)
attribute - an attribute nameprerequisites - a list of attributes required in use of the named attribute
protected final void addPrerequisite(String[] attributes,
String[] prerequisites)
attributes - an list of attribute namesprerequisites - a list of attributes required in use of the named attributespublic final String[] getPrerequisites(String attribute)
attribute - an attribute name
public String[] mergeAttributeLists(String[] lists)
throws L3DException
lists - a list of attribute list names
L3DException - if a named attribute list is undefinedpublic String[] mergeAttributeLists(String[][] lists)
lists - a list of lists of attribute names
public final String getIdentifierAttribute()
throws L3DException
L3DException - if the identify attribute list is undefined
public final String getNameAttribute()
throws L3DException
L3DException - if the identify attribute list is undefined
public final void setSorting(String[] attributes,
boolean[] ascending)
attributes - a list of attribute names to sort byascending - a list of indicators for sort order per attribute
public int compare(Object one,
Object two)
compare in interface Comparatorone - first entry for comparisontwo - second entry for comparison
protected final void addAttribute(String name,
L3DAttribute attribute)
name - a name for the new attributeattribute - a new L3D attribute
protected final void addAttribute(String name,
L3DAttribute attribute,
boolean multivalue)
name - a name for the new attributeattribute - a new L3D attributemultivalue - an indicator for the attribute's cardinality
protected final void addAttribute(String name,
L3DAttribute attribute,
boolean multivalue,
boolean required)
name - a name for the new attributeattribute - a new L3D attributemultivalue - an indicator for the attribute's cardinalityrequired - an indicator for the attribute's necessity
public final L3DAttribute getAttribute(String name)
throws L3DException
name - an attribute name
L3DException - if the named attribute is undefinedpublic final void setBind(LDAPConnection conn)
conn - an LDAP connection to use in operationspublic final boolean isBound()
protected final LDAPConnection getBind()
null if there isn't onepublic final void setLimit(int limit)
limit - a maximum number of entries in search resultspublic final int getLimit()
public LDAPEntry[] search(String filter)
throws L3DException
filter - a parenthetically enclosed directory filter
L3DException - if the search fails or the sorting criteria are mismatched
public LDAPEntry[] search(String filter,
String[] attributes)
throws L3DException
filter - a parenthetically enclosed directory filterattributes - a list of attributes to include in results
L3DException - if the search fails or the sorting criteria are mismatched
public LDAPEntry[] search(String filter,
String[] attributes,
int limit)
throws L3DException
filter - a parenthetically enclosed directory filterattributes - a list of attributes to include in resultslimit - a maximum number of entries in results
L3DException - if the search fails or the sorting criteria are mismatched
public LDAPEntry[] search(String filter,
String[] attributes,
int limit,
boolean sorted)
throws L3DException
filter - a parenthetically enclosed directory filterattributes - a list of attributes to include in resultslimit - a maximum number of entries in resultssorted - an indicator of sorting necessity
L3DException - if the search fails or the sorting criteria are mismatched
public LDAPEntry[] search(String filter,
String[] attributes,
int limit,
boolean sorted,
LDAPConnection conn)
throws L3DException
filter - a parenthetically enclosed directory filterattributes - a list of attributes to include in resultslimit - a maximum number of entries in resultssorted - an indicator of sorting necessityconn - an LDAP connection to use in the search
L3DException - if the search fails or the sorting criteria are mismatched
public boolean hasMatch()
throws L3DException
L3DException - if the search fails
public boolean hasMatch(String filter)
throws L3DException
filter - a parenthetically enclosed directory filter
L3DException - if the search fails
public final void populate(LDAPEntry entry)
throws L3DException
entry - an LDAP entry to reflect
L3DException
public void populate(String dn)
throws L3DException
dn - a distinguished name
L3DException - if no entry exists with the given dn or the search fails
public void populate(String dn,
String[] attributes)
throws L3DException
dn - a distinguished nameattributes - a list of attributes to assign values to
L3DException - if no entry exists with the given dn or the search fails
public void empty()
throws L3DException
L3DException - if an attribute is not properly defined
public final String getIdentifier()
throws L3DException
L3DException - if the identify attribute list is undefined
public final String getName()
throws L3DException
L3DException - if the identify attribute list is undefined
public final String getDN()
throws L3DException
L3DException
public final String getDN(String identifier)
throws L3DException
identifier - an entry unique identifier
L3DException - if no identifier attribute is defined or a unique entry doesn't exist
public L3DPath getPath()
throws L3DException
L3DException - if no identifier attribute is defined
public L3DPath getPath(String attribute)
throws L3DException
attribute - an attribute name
L3DException - if no identifier attribute is defined
protected final void setIncremental(String rdn,
String attribute,
String prefix)
rdn - a distinguished name relative to the object base for the id counter entryattribute - an attribute of the entry which contains the countprefix - a prefix for all identifierspublic final boolean isIncremental()
public final LDAPEntry getIncrementEntry()
throws L3DException
L3DException
public final LDAPEntry getIncrementEntry(LDAPConnection conn)
throws L3DException
conn - a connection to the directory server
L3DException
public final void create()
throws L3DException
L3DException - if the object has no bound connection or the entry can't be created
public final void create(LDAPConnection conn)
throws L3DException
conn - the authenticated connection to use in creating the entry
L3DException - if the entry can't be created
public final void delete()
throws L3DException
L3DException - if the object has no bound connection or the entry can't be removed
public final void delete(LDAPConnection conn)
throws L3DException
conn - the authenticated connection to use in deleting the entry
L3DException - if the entry has subordinates or can't be removed
public final void extend(String classname)
throws L3DException
classname - the name of the target object
L3DException - if the object has no bound connection or the entry can't be extended
public final void extend(LDAPConnection conn,
String classname)
throws L3DException
conn - the authenticated connection to use in extending the entryclassname - the name of the target object
L3DException - if the entry shouldn't or can't be extended
public final void update(String attribute)
throws L3DException
attribute - the name of the attribute to modify
L3DException - if the object has no bound connection or the attribute is improperly
defined or can't be modified
public final void update(LDAPConnection conn,
String attribute)
throws L3DException
conn - an authenticated directory connection to use for updatingattribute - the name of the attribute to modify
L3DException - if the attribute is improperly defined or can't be modified
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||