use of org.apache.directory.api.ldap.model.schema.SchemaObject in project directory-ldap-api by apache.
the class Registries method delete.
/**
* Remove the given SchemaObject from the registries
*
* @param errors The list of collected errors
* @param schemaObject The SchemaObject to delete
* @return The list of errors
* @throws LdapException If the deletion failed
*/
public List<Throwable> delete(List<Throwable> errors, SchemaObject schemaObject) throws LdapException {
// Relax the registries
boolean wasRelaxed = isRelaxed;
setRelaxed();
// Remove the SchemaObject from the registries
SchemaObject removed = unregister(errors, schemaObject);
// Remove the SchemaObject from its schema
dissociateFromSchema(errors, removed);
// Unlink the SchemaObject references
removeReference(errors, removed);
if (errors.isEmpty()) {
// Check the registries now
List<Throwable> checkErrors = checkRefInteg();
errors.addAll(checkErrors);
}
// Restore the previous registries state
if (!wasRelaxed) {
setStrict();
}
// return the errors
return errors;
}
use of org.apache.directory.api.ldap.model.schema.SchemaObject in project directory-ldap-api by apache.
the class DefaultNormalizerRegistry method unregisterSchemaElements.
/**
* {@inheritDoc}
*/
@Override
public void unregisterSchemaElements(String schemaName) throws LdapException {
if (schemaName == null) {
return;
}
// with the give schemaName
for (Normalizer normalizer : this) {
if (schemaName.equalsIgnoreCase(normalizer.getSchemaName())) {
String oid = normalizer.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 DefaultObjectClassRegistry method clear.
/**
* {@inheritDoc}
*/
@Override
public void clear() {
// Clear the contained SchemaObjects
for (SchemaObject objectClass : oidRegistry) {
objectClass.clear();
}
// First clear the shared elements
super.clear();
// and clear the descendant
for (Map.Entry<String, Set<ObjectClass>> entry : oidToDescendants.entrySet()) {
Set<ObjectClass> descendants = entry.getValue();
if (descendants != null) {
descendants.clear();
}
}
oidToDescendants.clear();
}
use of org.apache.directory.api.ldap.model.schema.SchemaObject in project directory-ldap-api by apache.
the class DefaultDitStructureRuleRegistry method unregisterSchemaElements.
/**
* {@inheritDoc}
*/
@Override
public void unregisterSchemaElements(String schemaName) {
if (schemaName == null) {
return;
}
// with the give schemaName
for (DitStructureRule ditStructureRule : this) {
if (schemaName.equalsIgnoreCase(ditStructureRule.getSchemaName())) {
int ruleId = ditStructureRule.getRuleId();
SchemaObject removed = byRuleId.remove(ruleId);
if (DEBUG) {
LOG.debug("Removed {} with ruleId {} from the registry", removed, ruleId);
}
}
}
}
use of org.apache.directory.api.ldap.model.schema.SchemaObject in project directory-ldap-api by apache.
the class SchemaParserTestUtils method testQuirksMode.
/**
* Tests quirks mode.
*/
public static void testQuirksMode(AbstractSchemaParser parser, String required) throws ParseException {
try {
String value = null;
SchemaObject asd = null;
parser.setQuirksMode(true);
// alphanum OID
value = "( abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 " + required + " )";
asd = parser.parse(value);
assertEquals("abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789", asd.getOid());
// start with hypen
value = "( -oid " + required + " )";
asd = parser.parse(value);
assertEquals("-oid", asd.getOid());
// start with number
value = "( 1oid " + required + " )";
asd = parser.parse(value);
assertEquals("1oid", asd.getOid());
// start with dot
value = "( .oid " + required + " )";
asd = parser.parse(value);
assertEquals(".oid", asd.getOid());
} finally {
parser.setQuirksMode(false);
}
}
Aggregations