class SchemaStorage
extends java.lang.Object
ObjectClass
) which represent the schema (structure) of the directory.Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ATTR_LEAF
XML attribute for the class "leaf" flag.
|
private static java.lang.String |
ATTR_MAND
XML attribute for the attribute "mandatory" flag.
|
private static java.lang.String |
ATTR_MULT
XML attribute for the attribute "multiple" flag.
|
private static java.lang.String |
ATTR_NAME
XML attribute for the attribute "name" field.
|
private static java.lang.String |
ATTR_RO
XML attribute for the attribute "read-only" flag.
|
private static java.lang.String |
ATTR_TYPE
XML attribute for the attribute "type" field.
|
private static java.lang.String |
ELEM_CLASS
XML tag for the class element.
|
private static java.lang.String |
ELEM_CLASS_ATTR
XML tag for the class attribute element.
|
private java.lang.String[] |
keys
Cached list of the keys in our map.
|
private java.util.Map<java.lang.String,ObjectClass> |
list
Directory object definitions (loaded once at startup and not changed).
|
private static SchemaStorage |
schema
Singleton instance.
|
Modifier | Constructor and Description |
---|---|
private |
SchemaStorage(java.net.URL[] urls,
java.lang.String[] required)
Construct an instance.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkRequiredClasses(java.lang.String[] required)
Check resulting schema for the presence of required classes.
|
(package private) java.lang.String[] |
getClassNames()
Get list of class names.
|
(package private) ObjectClass |
getObjectClass(java.lang.String name)
Get definition for the specified Object Class.
|
(package private) static SchemaStorage |
getSchema()
Get the singleton instance.
|
private void |
initKeys()
Initialize the cached list of keys in our map.
|
(package private) static SchemaStorage |
initSchema(java.net.URL[] urls,
java.lang.String[] required)
Initialize the singleton instance.
|
private void |
load(java.net.URL[] urls)
Read the schema definitions and create the list of object classes.
|
private void |
loadWorker(java.net.URL url)
Read the given schema definition and add to the list of object classes.
|
private static boolean |
str2bool(java.lang.String str)
Convert string into boolean value.
|
private int |
str2type(java.lang.String type)
Convert type name into type code using
AttributeType.fromString(java.lang.String) . |
private static final java.lang.String ATTR_MULT
private static final java.lang.String ATTR_NAME
private static final java.lang.String ATTR_MAND
private static final java.lang.String ATTR_RO
private static final java.lang.String ATTR_TYPE
private static final java.lang.String ATTR_LEAF
private static final java.lang.String ELEM_CLASS
private static final java.lang.String ELEM_CLASS_ATTR
private static SchemaStorage schema
private java.util.Map<java.lang.String,ObjectClass> list
private java.lang.String[] keys
private SchemaStorage(java.net.URL[] urls, java.lang.String[] required) throws java.lang.Exception
urls
- List of XML resources from which the schema will be read. The
order of the array defines the order of loading.required
- List of object classes that must exist in the loaded schema.java.lang.Exception
static SchemaStorage getSchema()
static SchemaStorage initSchema(java.net.URL[] urls, java.lang.String[] required) throws java.lang.Exception
urls
- List of XML resources from which the schema will be read. The
order of the array defines the order of loading.required
- List of object classes that must exist in the loaded schema.java.lang.Exception
- If an error occurred during schema initialization.java.lang.String[] getClassNames()
ObjectClass getObjectClass(java.lang.String name)
name
- Name of the Object Class to locate.ObjectClass
or null
if no such class defined.private void load(java.net.URL[] urls) throws java.lang.Exception
urls
- List of XML resources from which the schema will be read. The
order of the array defines the order of loading.java.lang.Exception
private void loadWorker(java.net.URL url) throws java.lang.Exception
url
- XML resource from which the schema will be read.java.lang.Exception
private void checkRequiredClasses(java.lang.String[] required) throws ConfigurationException
required
- List of object classes that must exist in the loaded schema.ConfigurationException
- In case if not all required classes are present in the schema.private void initKeys()
private int str2type(java.lang.String type) throws javax.naming.directory.InvalidAttributesException
AttributeType.fromString(java.lang.String)
.type
- Type name.javax.naming.directory.InvalidAttributesException
- If no such type name exists.private static boolean str2bool(java.lang.String str)
true
.str
- Source string.