public final class SchemaUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SchemaUtils.PasswordType
Represents a password type, including a "not a password" value.
|
static class |
SchemaUtils.SchemaFileFilter
A file filter implementation that accepts only LDIF files.
|
Modifier and Type | Method and Description |
---|---|
static String |
addSchemaFileToElementDefinitionIfAbsent(String definition,
String schemaFile)
Adds the provided schema file to the provided schema element definition.
|
static boolean |
canBeRelaxed(boolean relaxRules,
AttributeType at)
Indicates if the provided attribute No-User-Modification constraint can be relaxed.
|
static SchemaUtils.PasswordType |
checkPasswordType(AttributeType attrType)
Checks if the provided attribute type contains a password.
|
static ByteString |
createBooleanValue(boolean b)
Retrieves an attribute value containing a representation of the provided boolean value.
|
static String |
getElementDefinitionWithFileName(SchemaElement element)
Retrieves the definition string used to create the provided schema element and including the X-SCHEMA-FILE
extension.
|
static String |
getElementPropertyAsSingleValue(SchemaElement element,
String property)
Returns the single value of the provided extra property for the provided schema element.
|
static String |
getElementSchemaFile(SchemaElement element)
Returns the schema file of the provided schema element.
|
static File[] |
getSchemaFiles(File schemaDirectory)
Returns the list of schema files contained in the provided schema directory.
|
static boolean |
is02ConfigLdif(String schemaFile)
Indicates if the provided schema file corresponds to the configuration schema.
|
static String |
parseAttributeTypeOID(String definition)
Returns the OID from the provided attribute type definition, assuming the definition is valid.
|
static String |
parseDITContentRuleOID(String definition)
Returns the OID from the provided DIT content rule definition, assuming the definition is valid.
|
static String |
parseMatchingRuleUseOID(String definition)
Returns the OID from the provided matching rule use definition, assuming the definition is valid.
|
static String |
parseNameFormOID(String definition)
Returns the OID from the provided name form definition, assuming the definition is valid.
|
static String |
parseObjectClassOID(String definition)
Returns the OID from the provided object class definition, assuming the definition is valid.
|
static int |
parseRuleID(String definition)
Returns the ruleID from the provided DIT structure rule definition, assuming the definition is valid.
|
static String |
parseSchemaFileFromElementDefinition(String definition)
Parses the schema file (value of X-SCHEMA-FILE extension) from the provided schema element definition.
|
static String |
parseSyntaxOID(String definition)
Returns the OID from the provided syntax definition, assuming the definition is valid.
|
public static SchemaUtils.PasswordType checkPasswordType(AttributeType attrType)
attrType
- The attribute type to check.public static ByteString createBooleanValue(boolean b)
b
- The boolean value for which to retrieve the attribute value.public static String getElementDefinitionWithFileName(SchemaElement element)
element
- The schema element.public static String getElementPropertyAsSingleValue(SchemaElement element, String property)
element
- The schema element.property
- The name of property to retrieve.public static String getElementSchemaFile(SchemaElement element)
element
- The schema element.public static File[] getSchemaFiles(File schemaDirectory) throws InitializationException
schemaDirectory
- The directory containing schema filesInitializationException
- If the files can't be retrievedpublic static String addSchemaFileToElementDefinitionIfAbsent(String definition, String schemaFile)
definition
- The schema element definitionschemaFile
- The name of the schema file to include in the definitionpublic static String parseSchemaFileFromElementDefinition(String definition) throws LdapException
It expects a single value for the X-SCHEMA-FILE extension, e.g.: "X-SCHEMA-FILE '99-user.ldif'", as there is no sensible meaning for multiple values.
definition
- The definition of a schema elementnull
if the X-SCHEMA-FILE extension is not present in the
definitionLdapException
- If an error occurs while parsing the schema element definitionpublic static String parseAttributeTypeOID(String definition) throws LdapException
This method does not perform any check.
definition
- The definition of an attribute type, assumed to be validnull
LdapException
- If a problem occurs while parsing the definitionpublic static String parseObjectClassOID(String definition) throws LdapException
This method does not perform any check.
definition
- The definition of a object class, assumed to be validnull
LdapException
- If a problem occurs while parsing the definitionpublic static String parseNameFormOID(String definition) throws LdapException
This method does not perform any check.
definition
- The definition of a name form, assumed to be validnull
LdapException
- If a problem occurs while parsing the definitionpublic static String parseDITContentRuleOID(String definition) throws LdapException
This method does not perform any check.
definition
- The definition of a DIT content rule, assumed to be validnull
LdapException
- If a problem occurs while parsing the definitionpublic static int parseRuleID(String definition) throws LdapException
This method does not perform any check.
definition
- The definition of a DIT structure rule, assumed to be validnull
LdapException
- If a problem occurs while parsing the definitionpublic static String parseMatchingRuleUseOID(String definition) throws LdapException
This method does not perform any check.
definition
- The definition of a matching rule use, assumed to be validnull
LdapException
- If a problem occurs while parsing the definitionpublic static String parseSyntaxOID(String definition) throws LdapException
This method does not perform any check.
definition
- The definition of a syntax, assumed to be validnull
LdapException
- If a problem occurs while parsing the definitionpublic static boolean is02ConfigLdif(String schemaFile)
The file containing the definitions of the schema elements used for configuration must not be imported nor propagated to other servers because these definitions may vary between versions of OpenDJ.
schemaFile
- The name of a file defining schema elementstrue
if the file defines configuration elements, false
otherwisepublic static boolean canBeRelaxed(boolean relaxRules, AttributeType at)
relaxRules
- Indicates if the Relax Rules Control was usedat
- The attribute type to checktrue
if the "No-User-Modification" constraint can be relaxed for this attribute,
false
otherwiseCopyright 2010-2022 ForgeRock AS.