Search in sources :

Example 11 with SchemaObject

use of org.apache.directory.api.ldap.model.schema.SchemaObject in project directory-ldap-api by apache.

the class DefaultSchemaObjectRegistry method getSchemaName.

/**
 * {@inheritDoc}
 */
@Override
public String getSchemaName(String oid) throws LdapException {
    if (!Oid.isOid(oid)) {
        String msg = I18n.err(I18n.ERR_13733_ARG_NOT_NUMERIC_OID);
        LOG.warn(msg);
        throw new LdapException(msg);
    }
    SchemaObject schemaObject = byName.get(oid);
    if (schemaObject != null) {
        return schemaObject.getSchemaName();
    }
    String msg = I18n.err(I18n.ERR_13734_OID_NOT_FOUND, oid);
    LOG.warn(msg);
    throw new LdapException(msg);
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) LoadableSchemaObject(org.apache.directory.api.ldap.model.schema.LoadableSchemaObject) LdapException(org.apache.directory.api.ldap.model.exception.LdapException)

Example 12 with SchemaObject

use of org.apache.directory.api.ldap.model.schema.SchemaObject in project directory-ldap-api by apache.

the class DefaultSchemaObjectRegistry method unregisterSchemaElements.

/**
 * {@inheritDoc}
 */
@Override
public void unregisterSchemaElements(String schemaName) throws LdapException {
    if (schemaName == null) {
        return;
    }
    // with the give schemaName
    for (T schemaObject : this) {
        if (schemaName.equalsIgnoreCase(schemaObject.getSchemaName())) {
            String oid = schemaObject.getOid();
            SchemaObject removed = unregister(oid);
            if (DEBUG) {
                LOG.debug(I18n.msg(I18n.MSG_13702_REMOVED_FROM_REGISTRY, removed, oid));
            }
        }
    }
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) LoadableSchemaObject(org.apache.directory.api.ldap.model.schema.LoadableSchemaObject)

Example 13 with SchemaObject

use of org.apache.directory.api.ldap.model.schema.SchemaObject in project directory-ldap-api by apache.

the class DefaultSchemaObjectRegistry method clear.

/**
 * {@inheritDoc}
 */
@Override
public void clear() {
    // Clear all the schemaObjects
    for (SchemaObject schemaObject : oidRegistry) {
        // Don't clear LoadableSchemaObject
        if (!(schemaObject instanceof LoadableSchemaObject)) {
            schemaObject.clear();
        }
    }
    // Remove the byName elements
    byName.clear();
    // Clear the OidRegistry
    oidRegistry.clear();
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) LoadableSchemaObject(org.apache.directory.api.ldap.model.schema.LoadableSchemaObject) LoadableSchemaObject(org.apache.directory.api.ldap.model.schema.LoadableSchemaObject)

Example 14 with SchemaObject

use of org.apache.directory.api.ldap.model.schema.SchemaObject in project directory-ldap-api by apache.

the class DefaultSyntaxCheckerRegistry method unregisterSchemaElements.

/**
 * {@inheritDoc}
 */
@Override
public void unregisterSchemaElements(String schemaName) throws LdapException {
    if (schemaName == null) {
        return;
    }
    // with the give schemaName
    for (SyntaxChecker syntaxChecker : this) {
        if (schemaName.equalsIgnoreCase(syntaxChecker.getSchemaName())) {
            String oid = syntaxChecker.getOid();
            SchemaObject removed = unregister(oid);
            if (DEBUG) {
                LOG.debug(I18n.msg(I18n.MSG_13702_REMOVED_FROM_REGISTRY, removed, oid));
            }
        }
    }
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) SyntaxChecker(org.apache.directory.api.ldap.model.schema.SyntaxChecker)

Example 15 with SchemaObject

use of org.apache.directory.api.ldap.model.schema.SchemaObject in project directory-ldap-api by apache.

the class OpenLdapSchemaParser method parse.

/**
 * Parses an OpenLDAP schemaObject element/object.
 *
 * @param schemaObject the String image of a complete schema object
 * @return the schema object
 * @throws ParseException If the schemaObject can't be parsed
 */
@Override
public SchemaObject parse(String schemaObject) throws ParseException {
    if ((schemaObject == null) || Strings.isEmpty(schemaObject.trim())) {
        throw new ParseException(I18n.err(I18n.ERR_13716_NULL_OR_EMPTY_STRING_SCHEMA_OBJECT), 0);
    }
    // reset and initialize the parser / lexer pair
    reset(schemaObject);
    invokeParser(schemaObject);
    if (!schemaDescriptions.isEmpty()) {
        for (Object obj : schemaDescriptions) {
            if (obj instanceof SchemaObject) {
                return (SchemaObject) obj;
            }
        }
    }
    return null;
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) ParseException(java.text.ParseException)

Aggregations

SchemaObject (org.apache.directory.api.ldap.model.schema.SchemaObject)37 SchemaObjectWrapper (org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)14 Schema (org.apache.directory.api.ldap.model.schema.registries.Schema)13 ArrayList (java.util.ArrayList)12 DefaultEntry (org.apache.directory.api.ldap.model.entry.DefaultEntry)12 Entry (org.apache.directory.api.ldap.model.entry.Entry)11 DefaultSchema (org.apache.directory.api.ldap.model.schema.registries.DefaultSchema)11 LoadableSchemaObject (org.apache.directory.api.ldap.model.schema.LoadableSchemaObject)10 AttributesFactory (org.apache.directory.api.ldap.model.schema.AttributesFactory)8 ParseException (java.text.ParseException)6 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)4 DitStructureRule (org.apache.directory.api.ldap.model.schema.DitStructureRule)4 LdapSyntax (org.apache.directory.api.ldap.model.schema.LdapSyntax)4 ObjectClass (org.apache.directory.api.ldap.model.schema.ObjectClass)4 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 Set (java.util.Set)3 AttributeType (org.apache.directory.api.ldap.model.schema.AttributeType)3 DitContentRule (org.apache.directory.api.ldap.model.schema.DitContentRule)3