Class LDAPSchemaElement
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
LDAPAttributeSchema,LDAPDITContentRuleSchema,LDAPDITStructureRuleSchema,LDAPNameFormSchema,LDAPObjectClassSchema,LDAPSyntaxSchema,LDAPSyntaxSchemaElement
LDAPObjectClassSchema,
LDAPAttributeSchema, and LDAPMatchingRuleSchema
subclasses.
RFC 2252, Lightweight Directory Access Protocol (v3): Attribute Syntax Definitions covers the types of information that need to be specified in the definition of an object class, attribute type, or matching rule. All of these schema elements can specify the following information:
- a name identifying the element
- an OID identifying the element
- a description of the element
- a qualifier "OBSOLETE"
In addition, there are optional standard qualifiers for attribute
types (see LDAPAttributeSchema), and implementation-specific
qualifiers may be added. Non-standard qualifiers must have names
starting with X-, e.g. "X-OWNER 'John Jacobson'". Optional and
non-standard qualifiers can be accessed with getQualifier and
setQualifier, and enumerated with
getQualifierNames.
The LDAPSchemaElement class implements methods that
you can use with different types of schema elements (object class
definitions, attribute type definitions, and matching rule definitions).
You can do the following:
- get the name of a schema element
- get the OID of a schema element
- get the description of a schema element
- add an element to the schema
- remove an element from the schema
- Version:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]protected Stringstatic final intprotected static final Stringstatic final intprotected static final Stringstatic final intprotected static final Stringprotected Stringstatic final intprotected static final Stringstatic final intprotected static final Stringprotected Stringstatic final Stringprotected Stringprotected String(package private) static final longstatic final Stringstatic final Stringstatic final intprotected static final Stringstatic final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a blank element.protectedLDAPSchemaElement(String name, String oid, String description) Constructs a definition explicitly.protectedLDAPSchemaElement(String name, String oid, String description, String[] aliases) Constructs a definition explicitly. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(LDAPConnection ld) Adds the current object class, attribute type, or matching rule definition to the schema at the root DSE.voidadd(LDAPConnection ld, String dn) Adds the current object class, attribute type, or matching rule definition to the schema.String[]Gets the aliases of the attribute, if any(package private) StringGets any aliases for this elementprotected StringGets any qualifiers marked as custom (starting with "X-")Gets the description of the object class, attribute type, or matching rule.getID()Gets the object ID (OID) of the object class, attribute type, or matching rule in dotted-string format (for example, "1.2.3.4").getName()Gets the name of the object class, attribute type, or matching rule.getOID()Deprecated.protected StringgetOptionalValues(String[] names) Gets qualifiers which may or may not be presentString[]getQualifier(String name) Gets the value of a qualifier which is not predefined.Gets an enumeration of all qualifiers which are not predefined.(package private) StringgetQualifierString(String[] ignore) Creates a string for use in toString with any qualifiers of the element.getValue()Formats a String in the format defined in X.501 (see RFC 2252, Lightweight Directory Access Protocol (v3): Attribute Syntax Definitions for a description of this format).(package private) StringgetValue(boolean quotingBug) (package private) StringGets a qualifier's value or values, if present, and format the String according to RFC 2252.(package private) StringGets a qualifier's value or values, if present, and formats the String according to RFC 2252(package private) StringPrepares the initial common part of a schema element value in RFC 2252 format for submitting to a serverbooleanReports if the element is marked as obsolete.voidmodify(LDAPConnection ld, LDAPSchemaElement newValue) Replaces a single value of the object class, attribute type, or matching rule definition in the schema at the root DSE.voidmodify(LDAPConnection ld, LDAPSchemaElement newValue, String dn) Replaces a single value of the object class, attribute type, or matching rule definition in the schema.protected voidparseValue(String raw) Parses a raw schema value into OID, name, description, and a Hashtable of other qualifiers and values.voidremove(LDAPConnection ld) Removes the current object class, attribute type, or matching rule definition from the schema at the root DSE.voidremove(LDAPConnection ld, String dn) Removes the current object class, attribute type, or matching rule definition from the schema.voidsetQualifier(String name, String value) Keeps track of qualifiers which are not predefined.voidsetQualifier(String name, String[] values) Keeps track of qualifiers which are not predefined.protected voidupdate(LDAPConnection ld, int op, String name, String dn) Adds, removes or modifies the definition from a Directory.protected voidupdate(LDAPConnection ld, int op, LDAPAttribute[] attrs, String dn) Adds, removes or modifies the definition from a Directory.protected voidupdate(LDAPConnection ld, int op, LDAPAttribute attr, String dn) Adds, removes or modifies the definition from a Directory.
-
Field Details
-
serialVersionUID
static final long serialVersionUID- See Also:
-
unknown
public static final int unknown- See Also:
-
cis
public static final int cis- See Also:
-
binary
public static final int binary- See Also:
-
telephone
public static final int telephone- See Also:
-
ces
public static final int ces- See Also:
-
dn
public static final int dn- See Also:
-
integer
public static final int integer- See Also:
-
cisString
- See Also:
-
binaryString
- See Also:
-
telephoneString
- See Also:
-
cesString
- See Also:
-
intString
- See Also:
-
dnString
- See Also:
-
OBSOLETE
- See Also:
-
SUPERIOR
- See Also:
-
SYNTAX
- See Also:
-
oid
-
name
-
description
-
attrName
-
rawValue
-
aliases
-
properties
-
novalsTable
-
-
Constructor Details
-
LDAPSchemaElement
protected LDAPSchemaElement()Constructs a blank element. -
LDAPSchemaElement
Constructs a definition explicitly.- Parameters:
name- name of elementoid- dotted-string object identifierdescription- description of element
-
LDAPSchemaElement
Constructs a definition explicitly.- Parameters:
name- name of elementoid- dotted-string object identifierdescription- description of elementaliases- names which are to be considered aliases for this element;nullif there are no aliases
-
-
Method Details
-
getName
Gets the name of the object class, attribute type, or matching rule.- Returns:
- the name of the object class, attribute type, or matching rule.
-
getID
Gets the object ID (OID) of the object class, attribute type, or matching rule in dotted-string format (for example, "1.2.3.4").- Returns:
- the OID of the object class, attribute type, or matching rule.
-
getOID
Deprecated.UseLDAPSchemaElement.getID()Gets the object ID (OID) of the object class, attribute type, or matching rule in dotted-string format (for example, "1.2.3.4").- Returns:
- the OID of the object class, attribute type, or matching rule.
-
getDescription
Gets the description of the object class, attribute type, or matching rule.- Returns:
- the description of the object class, attribute type, or matching rule.
-
update
protected void update(LDAPConnection ld, int op, LDAPAttribute attr, String dn) throws LDAPException Adds, removes or modifies the definition from a Directory.- Parameters:
ld- an open connection to a Directory Server. Typically the connection must have been authenticated to add a definition.op- type of modification to makeattr- attribute in the schema entry to modify- Throws:
LDAPException- if the definition can't be added/removed
-
update
protected void update(LDAPConnection ld, int op, LDAPAttribute[] attrs, String dn) throws LDAPException Adds, removes or modifies the definition from a Directory.- Parameters:
ld- an open connection to a Directory Server. Typically the connection must have been authenticated to add a definition.op- type of modification to makeattrs- attributes in the schema entry to modify- Throws:
LDAPException- if the definition can't be added/removed.
-
update
Adds, removes or modifies the definition from a Directory.- Parameters:
ld- an open connection to a Directory Server. Typically the connection must have been authenticated to add a definition.op- type of modification to makename- name of attribute in the schema entry to modify- Throws:
LDAPException- if the definition can't be added/removed
-
add
Adds the current object class, attribute type, or matching rule definition to the schema. Typically, most servers will require you to authenticate before allowing you to edit the schema.- Parameters:
ld- theLDAPConnectionobject representing a connection to an LDAP serverdn- the entry at which to add the schema definition- Throws:
LDAPException- if the specified definition cannot be added to the schema
-
add
Adds the current object class, attribute type, or matching rule definition to the schema at the root DSE. Typically, most servers will require you to authenticate before allowing you to edit the schema.- Parameters:
ld- theLDAPConnectionobject representing a connection to an LDAP server- Throws:
LDAPException- if the specified definition cannot be added to the schema.
-
modify
Replaces a single value of the object class, attribute type, or matching rule definition in the schema. Typically, most servers will require you to authenticate before allowing you to edit the schema.- Parameters:
ld- theLDAPConnectionobject representing a connection to an LDAP servernewValue- the new valuedn- the entry at which to modify the schema definition- Throws:
LDAPException- if the specified definition cannot be modified.
-
modify
Replaces a single value of the object class, attribute type, or matching rule definition in the schema at the root DSE. Typically, most servers will require you to authenticate before allowing you to edit the schema.- Parameters:
ld- theLDAPConnectionobject representing a connection to an LDAP servernewValue- the new value- Throws:
LDAPException- if the specified definition cannot be modified.
-
remove
Removes the current object class, attribute type, or matching rule definition from the schema. Typically, most servers will require you to authenticate before allowing you to edit the schema.- Parameters:
ld- theLDAPConnectionobject representing a connection to an LDAP serverdn- the entry at which to remove the schema definition- Throws:
LDAPException- if the specified definition cannot be removed from the schema.
-
remove
Removes the current object class, attribute type, or matching rule definition from the schema at the root DSE. Typically, most servers will require you to authenticate before allowing you to edit the schema.- Parameters:
ld- theLDAPConnectionobject representing a connection to an LDAP server- Throws:
LDAPException- if the specified definition cannot be removed from the schema
-
isObsolete
public boolean isObsolete()Reports if the element is marked as obsolete.- Returns:
trueif the element is defined as obsolete.
-
parseValue
Parses a raw schema value into OID, name, description, and a Hashtable of other qualifiers and values.- Parameters:
raw- a raw schema definition
-
getValue
Formats a String in the format defined in X.501 (see RFC 2252, Lightweight Directory Access Protocol (v3): Attribute Syntax Definitions for a description of this format). This is the format that LDAP servers and clients use to exchange schema information. For example, when you search an LDAP server for its schema, the server returns an entry with the attributes "objectclasses" and "attributetypes". The values of the "attributetypes" attribute are attribute type descriptions in this format.- Returns:
- a formatted String for defining a schema element.
-
getValue
-
getValuePrefix
String getValuePrefix()Prepares the initial common part of a schema element value in RFC 2252 format for submitting to a server- Returns:
- the OID, name, description, and possibly OBSOLETE fields of a schema element definition.
-
getOptionalValues
Gets qualifiers which may or may not be present- Parameters:
names- list of qualifiers to look up- Returns:
- String in RFC 2252 format containing any values found, not terminated with ' '.
-
getCustomValues
Gets any qualifiers marked as custom (starting with "X-")- Returns:
- string in RFC 2252 format, without a terminating ' '.
-
getValue
Gets a qualifier's value or values, if present, and formats the String according to RFC 2252- Parameters:
key- the qualifier to getdoQuote-trueif values should be enveloped with single quotesdoDollar-trueif a list of values should use " $ " as separator; that is true for object class attribute lists- Returns:
- String in RFC 2252 format, without a terminating ' '.
-
getValue
Gets a qualifier's value or values, if present, and format the String according to RFC 2252.- Parameters:
key- the qualifier to getdoQuote-trueif values should be enveloped with single quotes- Returns:
- String in RFC 2252 format, without a terminating ' '.
-
setQualifier
Keeps track of qualifiers which are not predefined.- Parameters:
name- name of qualifiervalue- value of qualifier. "" for no value,nullto remove the qualifier
-
setQualifier
Keeps track of qualifiers which are not predefined.- Parameters:
name- name of qualifiervalues- array of values
-
getQualifier
Gets the value of a qualifier which is not predefined.- Parameters:
name- name of qualifier- Returns:
- value or values of qualifier;
nullif not present, a zero-length array if present but with no value.
-
getQualifierNames
Gets an enumeration of all qualifiers which are not predefined.- Returns:
- enumeration of qualifiers.
-
getAliases
Gets the aliases of the attribute, if any- Returns:
- the aliases of the attribute, or
nullif it does not have any aliases
-
getQualifierString
Creates a string for use in toString with any qualifiers of the element.- Parameters:
ignore- any qualifiers to NOT include- Returns:
- a String with any known qualifiers.
-
getAliasString
String getAliasString()Gets any aliases for this element- Returns:
- a string with any aliases, for use in toString()
-
LDAPSchemaElement.getID()