@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.
|
Constructor and Description |
---|
Schema(Entry schemaEntry)
Creates a new schema object by decoding the information in the provided
entry.
|
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(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.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.
|
java.lang.String |
toString()
Retrieves a string representation of the associated schema entry.
|
public static final java.lang.String ATTR_ATTRIBUTE_SYNTAX
public static final java.lang.String ATTR_ATTRIBUTE_TYPE
public static final java.lang.String ATTR_DIT_CONTENT_RULE
public static final java.lang.String ATTR_DIT_STRUCTURE_RULE
public static final java.lang.String ATTR_MATCHING_RULE
public static final java.lang.String ATTR_MATCHING_RULE_USE
public static final java.lang.String ATTR_NAME_FORM
public static final java.lang.String ATTR_OBJECT_CLASS
public static final java.lang.String ATTR_SUBSCHEMA_SUBENTRY
public static Schema getSchema(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.public static Schema getSchema(LDAPConnection connection, 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.public static Schema getSchema(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.public static Schema getSchema(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.public static Schema getSchema(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.public static Schema getSchema(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.public static Schema getDefaultStandardSchema() throws LDAPException
LDAPException
- If a problem occurs while attempting to obtain or
parse the default standard schema definitions.public static Schema mergeSchemas(Schema... schemas)
schemas
- The schemas to be merged. It must not be null
or
empty.public ReadOnlyEntry getSchemaEntry()
public static java.lang.String getSubschemaSubentryDN(LDAPConnection connection, 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.public java.util.Set<AttributeSyntaxDefinition> getAttributeSyntaxes()
public AttributeSyntaxDefinition getAttributeSyntax(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.public java.util.Set<AttributeTypeDefinition> getAttributeTypes()
public java.util.Set<AttributeTypeDefinition> getOperationalAttributeTypes()
public java.util.Set<AttributeTypeDefinition> getUserAttributeTypes()
public AttributeTypeDefinition getAttributeType(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.public java.util.List<AttributeTypeDefinition> getSubordinateAttributeTypes(AttributeTypeDefinition d)
d
- The attribute type definition for which to retrieve all
subordinate attribute types. It must not be null
.public java.util.Set<DITContentRuleDefinition> getDITContentRules()
public DITContentRuleDefinition getDITContentRule(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.public java.util.Set<DITStructureRuleDefinition> getDITStructureRules()
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.public DITStructureRuleDefinition getDITStructureRuleByName(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.public DITStructureRuleDefinition getDITStructureRuleByNameForm(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.public java.util.Set<MatchingRuleDefinition> getMatchingRules()
public MatchingRuleDefinition getMatchingRule(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.public java.util.Set<MatchingRuleUseDefinition> getMatchingRuleUses()
public MatchingRuleUseDefinition getMatchingRuleUse(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.public java.util.Set<NameFormDefinition> getNameForms()
public NameFormDefinition getNameFormByName(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.public NameFormDefinition getNameFormByObjectClass(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.public java.util.Set<ObjectClassDefinition> getObjectClasses()
public java.util.Set<ObjectClassDefinition> getAbstractObjectClasses()
public java.util.Set<ObjectClassDefinition> getAuxiliaryObjectClasses()
public java.util.Set<ObjectClassDefinition> getStructuralObjectClasses()
public ObjectClassDefinition getObjectClass(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(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.public java.lang.String toString()
toString
in class java.lang.Object