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);
}
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));
}
}
}
}
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();
}
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));
}
}
}
}
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;
}
Aggregations