@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class Schema extends java.lang.Object implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTR_ATTRIBUTE_SYNTAX
The name of the attribute used to hold the attribute syntax definitions.
|
static java.lang.String |
ATTR_ATTRIBUTE_TYPE
The name of the attribute used to hold the attribute type definitions.
|
static java.lang.String |
ATTR_DIT_CONTENT_RULE
The name of the attribute used to hold the DIT content rule definitions.
|
static java.lang.String |
ATTR_DIT_STRUCTURE_RULE
The name of the attribute used to hold the DIT structure rule definitions.
|
static java.lang.String |
ATTR_MATCHING_RULE
The name of the attribute used to hold the matching rule definitions.
|
static java.lang.String |
ATTR_MATCHING_RULE_USE
The name of the attribute used to hold the matching rule use definitions.
|
static java.lang.String |
ATTR_NAME_FORM
The name of the attribute used to hold the name form definitions.
|
static java.lang.String |
ATTR_OBJECT_CLASS
The name of the attribute used to hold the object class definitions.
|
static java.lang.String |
ATTR_SUBSCHEMA_SUBENTRY
The name of the attribute used to hold the DN of the subschema subentry
with the schema information that governs a specified entry.
|
static java.lang.String[] |
SCHEMA_REQUEST_ATTRS
The set of request attributes that will be used when retrieving the server
subschema subentry in order to retrieve all of the schema elements.
|
static Filter |
SUBSCHEMA_SUBENTRY_FILTER
The filter that should be used to retrieve the subsechema subentry.
|
Constructor and Description |
---|
Schema(Entry schemaEntry)
Creates a new schema object by decoding the information in the provided
entry.
|
Schema(Entry schemaEntry,
java.util.Map<java.lang.String,LDAPException> unparsableAttributeSyntaxes,
java.util.Map<java.lang.String,LDAPException> unparsableMatchingRules,
java.util.Map<java.lang.String,LDAPException> unparsableAttributeTypes,
java.util.Map<java.lang.String,LDAPException> unparsableObjectClasses,
java.util.Map<java.lang.String,LDAPException> unparsableDITContentRules,
java.util.Map<java.lang.String,LDAPException> unparsableDITStructureRules,
java.util.Map<java.lang.String,LDAPException> unparsableNameForms,
java.util.Map<java.lang.String,LDAPException> unparsableMatchingRuleUses)
Creates a new schema object by decoding the information in the provided
entry, optionally capturing any information about unparsable values in the
provided maps.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Indicates whether the provided object is equal to this schema object.
|
java.util.Set<ObjectClassDefinition> |
getAbstractObjectClasses()
Retrieves the set of abstract object class definitions contained in the
server schema.
|
AttributeSyntaxDefinition |
getAttributeSyntax(java.lang.String oid)
Retrieves the attribute syntax with the specified OID from the server
schema.
|
java.util.Set<AttributeSyntaxDefinition> |
getAttributeSyntaxes()
Retrieves the set of attribute syntax definitions contained in the server
schema.
|
AttributeTypeDefinition |
getAttributeType(java.lang.String name)
Retrieves the attribute type with the specified name or OID from the server
schema.
|
java.util.Set<AttributeTypeDefinition> |
getAttributeTypes()
Retrieves the set of attribute type definitions contained in the server
schema.
|
java.util.Set<ObjectClassDefinition> |
getAuxiliaryObjectClasses()
Retrieves the set of auxiliary object class definitions contained in the
server schema.
|
static Schema |
getDefaultStandardSchema()
Retrieves a schema object that contains definitions for a number of
standard attribute types and object classes from LDAP-related RFCs and
Internet Drafts.
|
DITContentRuleDefinition |
getDITContentRule(java.lang.String name)
Retrieves the DIT content rule with the specified name or OID from the
server schema.
|
java.util.Set<DITContentRuleDefinition> |
getDITContentRules()
Retrieves the set of DIT content rule definitions contained in the server
schema.
|
DITStructureRuleDefinition |
getDITStructureRuleByID(int ruleID)
Retrieves the DIT content rule with the specified rule ID from the server
schema.
|
DITStructureRuleDefinition |
getDITStructureRuleByName(java.lang.String ruleName)
Retrieves the DIT content rule with the specified name from the server
schema.
|
DITStructureRuleDefinition |
getDITStructureRuleByNameForm(java.lang.String nameForm)
Retrieves the DIT content rule associated with the specified name form from
the server schema.
|
java.util.Set<DITStructureRuleDefinition> |
getDITStructureRules()
Retrieves the set of DIT structure rule definitions contained in the server
schema.
|
MatchingRuleDefinition |
getMatchingRule(java.lang.String name)
Retrieves the matching rule with the specified name or OID from the server
schema.
|
java.util.Set<MatchingRuleDefinition> |
getMatchingRules()
Retrieves the set of matching rule definitions contained in the server
schema.
|
MatchingRuleUseDefinition |
getMatchingRuleUse(java.lang.String name)
Retrieves the matching rule use with the specified name or OID from the
server schema.
|
java.util.Set<MatchingRuleUseDefinition> |
getMatchingRuleUses()
Retrieves the set of matching rule use definitions contained in the server
schema.
|
NameFormDefinition |
getNameFormByName(java.lang.String name)
Retrieves the name form with the specified name or OID from the server
schema.
|
NameFormDefinition |
getNameFormByObjectClass(java.lang.String objectClass)
Retrieves the name form associated with the specified structural object
class from the server schema.
|
java.util.Set<NameFormDefinition> |
getNameForms()
Retrieves the set of name form definitions contained in the server schema.
|
ObjectClassDefinition |
getObjectClass(java.lang.String name)
Retrieves the object class with the specified name or OID from the server
schema.
|
java.util.Set<ObjectClassDefinition> |
getObjectClasses()
Retrieves the set of object class definitions contained in the server
schema.
|
java.util.Set<AttributeTypeDefinition> |
getOperationalAttributeTypes()
Retrieves the set of operational attribute type definitions (i.e., those
definitions with a usage of directoryOperation, distributedOperation, or
dSAOperation) contained in the server schema.
|
static Schema |
getSchema(java.io.File... schemaFiles)
Reads schema information from one or more files containing the schema
represented in LDIF form, with the definitions represented in the form
described in section 4.1 of RFC 4512.
|
static Schema |
getSchema(java.io.InputStream inputStream)
Reads schema information from the provided input stream.
|
static Schema |
getSchema(LDAPConnection connection)
Retrieves the directory server schema over the provided connection.
|
static Schema |
getSchema(LDAPConnection connection,
java.lang.String entryDN)
Retrieves the directory server schema that governs the specified entry.
|
static Schema |
getSchema(LDAPConnection connection,
java.lang.String entryDN,
boolean throwOnUnparsableElement)
Retrieves the directory server schema that governs the specified entry.
|
static Schema |
getSchema(java.util.List<java.io.File> schemaFiles)
Reads schema information from one or more files containing the schema
represented in LDIF form, with the definitions represented in the form
described in section 4.1 of RFC 4512.
|
static Schema |
getSchema(java.util.List<java.io.File> schemaFiles,
boolean throwOnUnparsableElement)
Reads schema information from one or more files containing the schema
represented in LDIF form, with the definitions represented in the form
described in section 4.1 of RFC 4512.
|
static Schema |
getSchema(java.lang.String... schemaFiles)
Reads schema information from one or more files containing the schema
represented in LDIF form, with the definitions represented in the form
described in section 4.1 of RFC 4512.
|
ReadOnlyEntry |
getSchemaEntry()
Retrieves the entry used to create this schema object.
|
java.util.Set<ObjectClassDefinition> |
getStructuralObjectClasses()
Retrieves the set of structural object class definitions contained in the
server schema.
|
java.util.List<AttributeTypeDefinition> |
getSubordinateAttributeTypes(AttributeTypeDefinition d)
Retrieves a list of all subordinate attribute type definitions for the
provided attribute type definition.
|
static java.lang.String |
getSubschemaSubentryDN(LDAPConnection connection,
java.lang.String entryDN)
Retrieves the value of the subschemaSubentry attribute from the specified
entry using the provided connection.
|
java.util.Set<AttributeTypeDefinition> |
getUserAttributeTypes()
Retrieves the set of user attribute type definitions (i.e., those
definitions with a usage of userApplications) contained in the server
schema.
|
int |
hashCode()
Retrieves a hash code for this schema object.
|
static Schema |
mergeSchemas(Schema... schemas)
Retrieves a schema containing all of the elements of each of the provided
schemas.
|
static Schema |
parseSchemaEntry(Entry schemaEntry)
Parses all schema elements contained in the provided entry.
|
java.lang.String |
toString()
Retrieves a string representation of the associated schema entry.
|
@NotNull public static final Filter SUBSCHEMA_SUBENTRY_FILTER
@NotNull public static final java.lang.String ATTR_ATTRIBUTE_SYNTAX
@NotNull public static final java.lang.String ATTR_ATTRIBUTE_TYPE
@NotNull public static final java.lang.String ATTR_DIT_CONTENT_RULE
@NotNull public static final java.lang.String ATTR_DIT_STRUCTURE_RULE
@NotNull public static final java.lang.String ATTR_MATCHING_RULE
@NotNull public static final java.lang.String ATTR_MATCHING_RULE_USE
@NotNull public static final java.lang.String ATTR_NAME_FORM
@NotNull public static final java.lang.String ATTR_OBJECT_CLASS
@NotNull public static final java.lang.String ATTR_SUBSCHEMA_SUBENTRY
@NotNull public static final java.lang.String[] SCHEMA_REQUEST_ATTRS
public Schema(@NotNull Entry schemaEntry)
schemaEntry
- The schema entry to decode. It must not be
null
.public Schema(@NotNull Entry schemaEntry, @Nullable java.util.Map<java.lang.String,LDAPException> unparsableAttributeSyntaxes, @Nullable java.util.Map<java.lang.String,LDAPException> unparsableMatchingRules, @Nullable java.util.Map<java.lang.String,LDAPException> unparsableAttributeTypes, @Nullable java.util.Map<java.lang.String,LDAPException> unparsableObjectClasses, @Nullable java.util.Map<java.lang.String,LDAPException> unparsableDITContentRules, @Nullable java.util.Map<java.lang.String,LDAPException> unparsableDITStructureRules, @Nullable java.util.Map<java.lang.String,LDAPException> unparsableNameForms, @Nullable java.util.Map<java.lang.String,LDAPException> unparsableMatchingRuleUses)
schemaEntry
- The schema entry to decode. It must
not be null
.unparsableAttributeSyntaxes
- A map that will be updated with
information about any attribute syntax
definitions that cannot be parsed. It
may be null
if unparsable
attribute syntax definitions should be
silently ignored.unparsableMatchingRules
- A map that will be updated with
information about any matching rule
definitions that cannot be parsed. It
may be null
if unparsable
matching rule definitions should be
silently ignored.unparsableAttributeTypes
- A map that will be updated with
information about any attribute type
definitions that cannot be parsed. It
may be null
if unparsable
attribute type definitions should be
silently ignored.unparsableObjectClasses
- A map that will be updated with
information about any object class
definitions that cannot be parsed. It
may be null
if unparsable
object class definitions should be
silently ignored.unparsableDITContentRules
- A map that will be updated with
information about any DIT content rule
definitions that cannot be parsed. It
may be null
if unparsable
DIT content rule definitions should be
silently ignored.unparsableDITStructureRules
- A map that will be updated with
information about any DIT structure
rule definitions that cannot be
parsed. It may be null
if
unparsable attribute DIT structure
rule definitions should be silently
ignored.unparsableNameForms
- A map that will be updated with
information about any name form
definitions that cannot be parsed. It
may be null
if unparsable
name form definitions should be
silently ignored.unparsableMatchingRuleUses
- A map that will be updated with
information about any matching rule
use definitions that cannot be parsed.
It may be null
if unparsable
matching rule use definitions should
be silently ignored.@NotNull public static Schema parseSchemaEntry(@NotNull Entry schemaEntry) throws LDAPException
Schema(Entry)
constructor in that this method
will throw an exception if it encounters any unparsable schema elements,
while the constructor will silently ignore them. Alternatively, the
constructor that takes a bunch of maps can be used to obtain information
about any unparsable schema elements while still providing access to the
parsed schema.schemaEntry
- The schema entry to parse. It must not be
null
.LDAPException
- If the provided entry contains any schema element
definitions that cannot be parsed.@Nullable public static Schema getSchema(@NotNull LDAPConnection connection) throws LDAPException
connection
- The connection to use in order to retrieve the server
schema. It must not be null
.LDAPException
- If a problem occurs while obtaining the server
schema.@Nullable public static Schema getSchema(@NotNull LDAPConnection connection, @Nullable java.lang.String entryDN) throws LDAPException
connection
- The connection to use in order to retrieve the server
schema. It must not be null
.entryDN
- The DN of the entry for which to retrieve the governing
schema. It may be null
or an empty string in
order to retrieve the schema that governs the server's
root DSE.null
if
it is not available for some reason (e.g., the client does not
have permission to read the server schema).LDAPException
- If a problem occurs while obtaining the server
schema.@Nullable public static Schema getSchema(@NotNull LDAPConnection connection, @Nullable java.lang.String entryDN, boolean throwOnUnparsableElement) throws LDAPException
connection
- The connection to use in order to
retrieve the server schema. It must not
be null
.entryDN
- The DN of the entry for which to retrieve
the governing schema. It may be
null
or an empty string in order
to retrieve the schema that governs the
server's root DSE.throwOnUnparsableElement
- Indicates whether to throw an exception
if the schema entry that is retrieved has
one or more unparsable schema elements.null
if
it is not available for some reason (e.g., the client does not
have permission to read the server schema).LDAPException
- If a problem occurs while obtaining the server
schema, or if the schema contains one or more
unparsable elements and
throwOnUnparsableElement
is true
.@Nullable public static Schema getSchema(@NotNull java.lang.String... schemaFiles) throws java.io.IOException, LDIFException
schemaFiles
- The paths to the LDIF files containing the schema
information to be read. At least one file must be
specified. If multiple files are specified, then they
will be processed in the order in which they have been
listed.null
if none of the files contains any LDIF data to be read.java.io.IOException
- If a problem occurs while attempting to read from
any of the specified files.LDIFException
- If a problem occurs while attempting to parse the
contents of any of the schema files.@Nullable public static Schema getSchema(@NotNull java.io.File... schemaFiles) throws java.io.IOException, LDIFException
schemaFiles
- The paths to the LDIF files containing the schema
information to be read. At least one file must be
specified. If multiple files are specified, then they
will be processed in the order in which they have been
listed.null
if none of the files contains any LDIF data to be read.java.io.IOException
- If a problem occurs while attempting to read from
any of the specified files.LDIFException
- If a problem occurs while attempting to parse the
contents of any of the schema files.@Nullable public static Schema getSchema(@NotNull java.util.List<java.io.File> schemaFiles) throws java.io.IOException, LDIFException
schemaFiles
- The paths to the LDIF files containing the schema
information to be read. At least one file must be
specified. If multiple files are specified, then they
will be processed in the order in which they have been
listed.null
if none of the files contains any LDIF data to be read.java.io.IOException
- If a problem occurs while attempting to read from
any of the specified files.LDIFException
- If a problem occurs while attempting to parse the
contents of any of the schema files.@Nullable public static Schema getSchema(@NotNull java.util.List<java.io.File> schemaFiles, boolean throwOnUnparsableElement) throws java.io.IOException, LDIFException
schemaFiles
- The paths to the LDIF files containing
the schema information to be read. At
least one file must be specified. If
multiple files are specified, then they
will be processed in the order in which
they have been listed.throwOnUnparsableElement
- Indicates whether to throw an exception
if the schema entry that is retrieved has
one or more unparsable schema elements.null
if none of the files contains any LDIF data to be read.java.io.IOException
- If a problem occurs while attempting to read from
any of the specified files.LDIFException
- If a problem occurs while attempting to parse the
contents of any of the schema files. If
throwOnUnparsableElement
is true
,
then this may also be thrown if any of the schema
files contains any unparsable schema elements.@Nullable public static Schema getSchema(@NotNull java.io.InputStream inputStream) throws java.io.IOException, LDIFException
inputStream
- The input stream from which the schema entry will be
read. It must not be null
, and it will be
closed when this method returns.null
if
the end of the input stream is reached without reading any data.java.io.IOException
- If a problem is encountered while attempting to read
from the provided input stream.LDIFException
- If a problem occurs while attempting to parse the
data read as LDIF.@NotNull public static Schema getDefaultStandardSchema() throws LDAPException
LDAPException
- If a problem occurs while attempting to obtain or
parse the default standard schema definitions.@Nullable public static Schema mergeSchemas(@NotNull Schema... schemas)
schemas
- The schemas to be merged. It must not be null
or
empty.@NotNull public ReadOnlyEntry getSchemaEntry()
@Nullable public static java.lang.String getSubschemaSubentryDN(@NotNull LDAPConnection connection, @Nullable java.lang.String entryDN) throws LDAPException
connection
- The connection to use in order to perform the search.
It must not be null
.entryDN
- The DN of the entry from which to retrieve the
subschemaSubentry attribute. It may be null
or
an empty string in order to retrieve the value from the
server's root DSE.null
if it is not available for some reason
(e.g., the client does not have permission to read the target
entry or the subschemaSubentry attribute).LDAPException
- If a problem occurs while attempting to retrieve
the specified entry.@NotNull public java.util.Set<AttributeSyntaxDefinition> getAttributeSyntaxes()
@Nullable public AttributeSyntaxDefinition getAttributeSyntax(@NotNull java.lang.String oid)
oid
- The OID of the attribute syntax to retrieve. It must not be
null
. It may optionally include a minimum upper bound
(as may appear when the syntax OID is included in an attribute
type definition), but if it does then that portion will be
ignored when retrieving the attribute syntax.null
if there is no
such syntax defined in the server schema.@NotNull public java.util.Set<AttributeTypeDefinition> getAttributeTypes()
@NotNull public java.util.Set<AttributeTypeDefinition> getOperationalAttributeTypes()
@NotNull public java.util.Set<AttributeTypeDefinition> getUserAttributeTypes()
@Nullable public AttributeTypeDefinition getAttributeType(@NotNull java.lang.String name)
name
- The name or OID of the attribute type to retrieve. It must
not be null
.null
if there is no
such attribute type defined in the server schema.@NotNull public java.util.List<AttributeTypeDefinition> getSubordinateAttributeTypes(@NotNull AttributeTypeDefinition d)
d
- The attribute type definition for which to retrieve all
subordinate attribute types. It must not be null
.@NotNull public java.util.Set<DITContentRuleDefinition> getDITContentRules()
@Nullable public DITContentRuleDefinition getDITContentRule(@NotNull java.lang.String name)
name
- The name or OID of the DIT content rule to retrieve. It must
not be null
.null
if there is no
such rule defined in the server schema.@NotNull public java.util.Set<DITStructureRuleDefinition> getDITStructureRules()
@Nullable public DITStructureRuleDefinition getDITStructureRuleByID(int ruleID)
ruleID
- The rule ID for the DIT structure rule to retrieve.null
if there is no
such rule defined in the server schema.@Nullable public DITStructureRuleDefinition getDITStructureRuleByName(@NotNull java.lang.String ruleName)
ruleName
- The name of the DIT structure rule to retrieve. It must
not be null
.null
if there is no
such rule defined in the server schema.@Nullable public DITStructureRuleDefinition getDITStructureRuleByNameForm(@NotNull java.lang.String nameForm)
nameForm
- The name or OID of the name form for which to retrieve
the associated DIT structure rule.null
if there is no
such rule defined in the server schema.@NotNull public java.util.Set<MatchingRuleDefinition> getMatchingRules()
@Nullable public MatchingRuleDefinition getMatchingRule(@NotNull java.lang.String name)
name
- The name or OID of the matching rule to retrieve. It must
not be null
.null
if there is no
such rule defined in the server schema.@NotNull public java.util.Set<MatchingRuleUseDefinition> getMatchingRuleUses()
@Nullable public MatchingRuleUseDefinition getMatchingRuleUse(@NotNull java.lang.String name)
name
- The name or OID of the matching rule use to retrieve. It
must not be null
.null
if there is no
such matching rule use defined in the server schema.@NotNull public java.util.Set<NameFormDefinition> getNameForms()
@Nullable public NameFormDefinition getNameFormByName(@NotNull java.lang.String name)
name
- The name or OID of the name form to retrieve. It must not be
null
.null
if there is no
such rule defined in the server schema.@NotNull public NameFormDefinition getNameFormByObjectClass(@NotNull java.lang.String objectClass)
objectClass
- The name or OID of the structural object class for
which to retrieve the associated name form. It must
not be null
.null
if there is no
such rule defined in the server schema.@NotNull public java.util.Set<ObjectClassDefinition> getObjectClasses()
@NotNull public java.util.Set<ObjectClassDefinition> getAbstractObjectClasses()
@NotNull public java.util.Set<ObjectClassDefinition> getAuxiliaryObjectClasses()
@NotNull public java.util.Set<ObjectClassDefinition> getStructuralObjectClasses()
@Nullable public ObjectClassDefinition getObjectClass(@NotNull java.lang.String name)
name
- The name or OID of the object class to retrieve. It must
not be null
.null
if there is no such
class defined in the server schema.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@Nullable java.lang.Object o)
equals
in class java.lang.Object
o
- The object for which to make the determination.true
if the provided object is equal to this schema
object, or false
if not.