public final class SchemaFactory extends Object
Schema
from an active directory schema search result. Active Directory does not adhere to
RFC 4512 to represent it's schema. Each schema element is represented with a separate LDAP entry. The factory parses
and sets the object classes and attribute types for the schema. The other properties on the schema object are not
available.Modifier | Constructor and Description |
---|---|
private |
SchemaFactory()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected static AttributeType |
createAttributeType(LdapEntry entry)
Creates an attribute type from the supplied ldap entry.
|
protected static ObjectClass |
createObjectClass(LdapEntry entry)
Creates an object class from the supplied ldap entry.
|
static Schema |
createSchema(ConnectionFactory factory,
String entryDn)
Creates a new schema.
|
static Schema |
createSchema(InputStream is)
Creates a new schema.
|
static Schema |
createSchema(SearchResult schemaResult)
Creates a new schema.
|
private static String |
getAttributeValue(LdapEntry entry,
String... names)
Returns a single value for the first attribute name found in the supplied entry.
|
private static String[] |
getAttributeValues(LdapEntry entry,
String... names)
Returns the values for the first attribute name found in the supplied entry.
|
protected static SearchResult |
getSearchResult(ConnectionFactory factory,
String dn,
String filter,
String[] retAttrs)
Searches for the supplied dn and returns its ldap entry.
|
public static Schema createSchema(InputStream is) throws IOException
is
- containing the schema ldifIOException
- if an error occurs reading the input streampublic static Schema createSchema(ConnectionFactory factory, String entryDn) throws LdapException
factory
- to obtain an LDAP connection fromentryDn
- the schema entriesLdapException
- if the search failspublic static Schema createSchema(SearchResult schemaResult)
schemaResult
- containing the schema entriesprotected static SearchResult getSearchResult(ConnectionFactory factory, String dn, String filter, String[] retAttrs) throws LdapException
factory
- to obtain an LDAP connection fromdn
- to search forfilter
- to search withretAttrs
- attributes to returnLdapException
- if the search failsprotected static AttributeType createAttributeType(LdapEntry entry)
entry
- containing an attribute schemaprotected static ObjectClass createObjectClass(LdapEntry entry)
entry
- containing a class schemaprivate static String getAttributeValue(LdapEntry entry, String... names)
entry
- containing the attributesnames
- to search for in the entryCopyright © 2003-2019 Virginia Tech. All Rights Reserved.