You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/10/13 00:44:54 UTC
svn commit: r824528 [3/3] - in /directory:
apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/
apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/
a...
Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java?rev=824528&r1=824527&r2=824528&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java Mon Oct 12 22:44:52 2009
@@ -30,6 +30,8 @@
import javax.naming.NamingException;
+import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.DITContentRule;
import org.apache.directory.shared.ldap.schema.DITStructureRule;
@@ -59,6 +61,12 @@
/** A logger for this class */
private static final Logger LOG = LoggerFactory.getLogger( Registries.class );
+ /** A flag indicating if this Registries is relaxed or not */
+ private boolean isRelaxed;
+
+ /** A flag indicating if this Registries should accept only enabled elements */
+ private boolean acceptDisabled;
+
/**
* A String name to Schema object map for those schemas loaded into this
* registry.
@@ -139,6 +147,12 @@
schemaObjectsBySchemaName = new ConcurrentHashMap<String, Set<SchemaWrapper>>();
usedBy = new ConcurrentHashMap<SchemaWrapper, Set<SchemaWrapper>>();
using = new ConcurrentHashMap<SchemaWrapper, Set<SchemaWrapper>>();
+
+ // Default to not permissive
+ isRelaxed = false;
+
+ // Default to not allow disabled element
+ acceptDisabled = false;
}
@@ -390,6 +404,18 @@
* Attempts to resolve the dependent schema objects of all entities that
* refer to other objects within the registries. Null references will be
* handed appropriately.
+ * The order in which the SchemaObjects must be :
+ * <li/>1) Normalizers, Comparators and SyntaxCheckers (as they depend on nothing)
+ * <li/>2) Syntaxes (depend on SyntaxCheckers)
+ * <li/>3) MatchingRules (depend on Syntaxes, Normalizers and Comparators
+ * <li/>4) AttributeTypes (depend on MatchingRules, Syntaxes and AttributeTypes : in this case, we first handle the superior)
+ * <li/>5) ObjectClasses (depend on AttributeTypes and ObjectClasses)
+ * <br/><br/>
+ * Later, when we will support them :
+ * <li/>6) MatchingRuleUses (depend on matchingRules and AttributeTypes)
+ * <li/>7) DitContentRules (depend on ObjectClasses and AttributeTypes)
+ * <li/>8) NameForms (depends on ObjectClasses and AttributeTypes)
+ * <li/>9) DitStructureRules (depends onNameForms and DitStructureRules) *
*
* @return a list of exceptions encountered while resolving entities
*/
@@ -397,30 +423,56 @@
{
ArrayList<Throwable> errors = new ArrayList<Throwable>();
- // Check the ObjectClasses
- for ( ObjectClass objectClass : objectClassRegistry )
+ // Step 1 :
+ // We start with Normalizers, Comparators and SyntaxCheckers
+ // as they depend on nothing
+ // Check the Normalizers
+ for ( Normalizer normalizer : normalizerRegistry )
{
- resolve( objectClass, errors );
+ resolve( normalizer, errors );
}
- // Check the AttributeTypes
- for ( AttributeType attributeType : attributeTypeRegistry )
+ // Check the Comparators
+ for ( LdapComparator<?> comparator : comparatorRegistry )
{
- resolve( attributeType, errors );
+ resolve( comparator, errors );
}
-
- // Check the MatchingRules
- for ( MatchingRule matchingRule : matchingRuleRegistry )
+
+ // Check the SyntaxCheckers
+ for ( SyntaxChecker syntaxChecker : syntaxCheckerRegistry )
{
- resolve( matchingRule, errors );
+ resolve( syntaxChecker, errors );
}
- // Check the LdapSyntax
+ // Step 2 :
+ // Check the LdapSyntaxes
for ( LdapSyntax ldapSyntax : ldapSyntaxRegistry )
{
resolve( ldapSyntax, errors );
}
+
+ // Step 3 :
+ // Check the matchingRules
+ for ( MatchingRule matchingRule : matchingRuleRegistry )
+ {
+ resolve( matchingRule, errors );
+ }
+
+ // Step 4 :
+ // Check the AttributeTypes
+ for ( AttributeType attributeType : attributeTypeRegistry )
+ {
+ resolve( attributeType, errors );
+ }
+
+ // Step 5 :
+ // Check the ObjectClasses
+ for ( ObjectClass objectClass : objectClassRegistry )
+ {
+ resolve( objectClass, errors );
+ }
+ // Step 6-9 aren't yet defined
return errors;
}
@@ -430,206 +482,330 @@
*
* @param syntax the LdapSyntax to resolve the SyntaxChecker of
* @param errors the list of errors to add exceptions to
- * @return true if it succeeds, false otherwise
*/
- private boolean resolve( LdapSyntax syntax, List<Throwable> errors )
+ private void resolve( LdapSyntax syntax, List<Throwable> errors )
{
- if ( syntax == null )
- {
- return true;
- }
-
+ // A LdapSyntax must point to a valid SyntaxChecker
+ // or to the OctetString SyntaxChecker
try
{
- syntax.getSyntaxChecker();
- return true;
+ syntax.applyRegistries( this );
}
- catch ( Exception e )
+ catch ( NamingException e )
{
errors.add( e );
- return false;
}
}
/**
- * Check if the Comparator and the syntax are existing for a matchingRule
+ * Attempts to resolve the Normalizer
+ *
+ * @param normalizer the Normalizer
+ * @param errors the list of errors to add exceptions to
*/
- private boolean resolve( MatchingRule mr, List<Throwable> errors )
+ private void resolve( Normalizer normalizer, List<Throwable> errors )
{
- boolean isSuccess = true;
-
- if ( mr == null )
- {
- return true;
- }
-
+ // This is currently doing nothing.
try
{
- if ( mr.getLdapComparator() == null )
- {
- String schema = matchingRuleRegistry.getSchemaName( mr.getOid() );
- errors.add( new NullPointerException( "matchingRule " + mr.getName() + " in schema " + schema
- + " with OID " + mr.getOid() + " has a null comparator" ) );
- isSuccess = false;
- }
+ normalizer.applyRegistries( this );
}
- catch ( Exception e )
+ catch ( NamingException e )
{
errors.add( e );
- isSuccess = false;
}
+ }
+
+ /**
+ * Attempts to resolve the LdapComparator
+ *
+ * @param comparator the LdapComparator
+ * @param errors the list of errors to add exceptions to
+ */
+ private void resolve( LdapComparator<?> comparator, List<Throwable> errors )
+ {
+ // This is currently doing nothing.
try
{
- isSuccess &= resolve( mr.getSyntax(), errors );
-
- if ( mr.getSyntax() == null )
- {
- String schema = matchingRuleRegistry.getSchemaName( mr.getOid() );
- errors.add( new NullPointerException( "matchingRule " + mr.getName() + " in schema " + schema
- + " with OID " + mr.getOid() + " has a null Syntax" ) );
- isSuccess = false;
- }
+ comparator.applyRegistries( this );
}
- catch ( Exception e )
+ catch ( NamingException e )
{
errors.add( e );
- isSuccess = false;
}
-
- return isSuccess;
}
/**
- * Check the inheritance, and the existence of MatchingRules and LdapSyntax
- * for an attribute
+ * Attempts to resolve the SyntaxChecker
+ *
+ * @param normalizer the SyntaxChecker
+ * @param errors the list of errors to add exceptions to
*/
- private boolean resolve( AttributeType at, List<Throwable> errors )
+ private void resolve( SyntaxChecker syntaxChecker, List<Throwable> errors )
{
- boolean isSuccess = true;
-
- boolean hasMatchingRule = false;
-
- if ( at == null )
+ // This is currently doing nothing.
+ try
{
- return true;
+ syntaxChecker.applyRegistries( this );
}
+ catch ( NamingException e )
+ {
+ errors.add( e );
+ }
+ }
+
+ /**
+ * Check if the Comparator, Normalizer and the syntax are
+ * existing for a matchingRule
+ */
+ private void resolve( MatchingRule matchingRule, List<Throwable> errors )
+ {
+ // A Matching rule must point to a valid Syntax
try
{
- isSuccess &= resolve( at.getSuperior(), errors );
+ matchingRule.applyRegistries( this );
}
- catch ( Exception e )
+ catch ( NamingException e )
{
errors.add( e );
- isSuccess = false;
}
+ }
- try
+
+ /**
+ * Check AttributeType referential integrity
+ */
+ private void resolveRecursive( AttributeType attributeType, Set<String> processed, List<Throwable> errors )
+ {
+ // Process the Superior, if any
+ String superiorOid = attributeType.getSuperiorOid();
+ AttributeType superior = null;
+
+ if ( superiorOid != null )
{
- isSuccess &= resolve( at.getEquality(), errors );
-
- if ( at.getEquality() != null )
+ // Check if the Superior is present in the registries
+ try
+ {
+ superior = attributeTypeRegistry.lookup( superiorOid );
+ }
+ catch ( NamingException ne )
+ {
+ // This AT's superior has not been loaded into the Registries.
+ if ( !processed.contains( superiorOid ) )
+ {
+ errors.add( ne );
+ }
+ }
+
+ // We now have to process the superior, if it hasn"'t been
+ // processed yet.
+ if ( ( superior != null ) && !processed.contains( superiorOid ) )
{
- hasMatchingRule |= true;
+ resolveRecursive( superior, processed, errors );
}
}
- catch ( Exception e )
+
+ // Process the Syntax. If it's null, the attributeType must have
+ // a Superior.
+ String syntaxOid = attributeType.getSyntaxOid();
+
+ if ( syntaxOid != null )
{
- errors.add( e );
- isSuccess = false;
+ // Check if the Syntax is present in the registries
+ try
+ {
+ ldapSyntaxRegistry.lookup( syntaxOid );
+ }
+ catch ( NamingException ne )
+ {
+ // This AT's syntax has not been loaded into the Registries.
+ errors.add( ne );
+ }
}
-
- try
+ else
{
- isSuccess &= resolve( at.getOrdering(), errors );
-
- if ( at.getOrdering() != null )
+ // No Syntax : get it from the AttributeType's superior
+ if ( superior == null )
{
- hasMatchingRule |= true;
+ // This is an error. if the AT does not have a Syntax,
+ // then it must have a superior, which syntax is get from.
+ Throwable error = new LdapSchemaViolationException(
+ "The AttributeType " + attributeType.getOid() + " does not have a superior" +
+ " nor a Syntax. This is invalid", ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+ errors.add( error );
}
}
- catch ( Exception e )
+
+ // Process the EQUALITY MatchingRule. It may be null, but if it's not
+ // it must have been processed before
+ String equalityOid = attributeType.getEqualityOid();
+
+ if ( equalityOid != null )
{
- errors.add( e );
- isSuccess = false;
+ // Check if the MatchingRule is present in the registries
+ try
+ {
+ matchingRuleRegistry.lookup( equalityOid );
+ }
+ catch ( NamingException ne )
+ {
+ // This AT's EQUALITY matchingRule has not been loaded into the Registries.
+ errors.add( ne );
+ }
}
-
- try
+
+ // Process the ORDERING MatchingRule. It may be null, but if it's not
+ // it must have been processed before
+ String orderingOid = attributeType.getOrderingOid();
+
+ if ( orderingOid != null )
{
- isSuccess &= resolve( at.getSubstring(), errors );
-
- if ( at.getSubstring() != null )
+ // Check if the MatchingRule is present in the registries
+ try
+ {
+ matchingRuleRegistry.lookup( orderingOid );
+ }
+ catch ( NamingException ne )
{
- hasMatchingRule |= true;
+ // This AT's ORDERING matchingRule has not been loaded into the Registries.
+ errors.add( ne );
}
}
- catch ( Exception e )
+
+ // Process the SUBSTR MatchingRule. It may be null, but if it's not
+ // it must have been processed before
+ String substringOid = attributeType.getSubstringOid();
+
+ if ( substringOid != null )
{
- errors.add( e );
- isSuccess = false;
+ // Check if the MatchingRule is present in the registries
+ try
+ {
+ matchingRuleRegistry.lookup( substringOid );
+ }
+ catch ( NamingException ne )
+ {
+ // This AT's SUBSTR matchingRule has not been loaded into the Registries.
+ errors.add( ne );
+ }
}
-
+
+ // All is done for this AttributeType, let's apply the registries
try
{
- isSuccess &= resolve( at.getSyntax(), errors );
-
- if ( at.getSyntax() == null )
- {
- String schema = attributeTypeRegistry.getSchemaName( at.getOid() );
-
- errors.add( new NullPointerException( "attributeType " + at.getName() + " in schema " + schema
- + " with OID " + at.getOid() + " has a null Syntax" ) );
-
- isSuccess = false;
- }
+ attributeType.applyRegistries( this );
}
- catch ( Exception e )
+ catch ( NamingException ne )
{
- errors.add( e );
- isSuccess = false;
+ // Do nothing. We may have a broken AT,
+ // but at this point, it doesn't matter.
}
+ }
- return isSuccess;
+
+ /**
+ * Check the inheritance, and the existence of MatchingRules and LdapSyntax
+ * for an attribute
+ */
+ private void resolve( AttributeType attributeType, List<Throwable> errors )
+ {
+ // This set is used to avoid having more than one error
+ // for an AttributeType. It's mandatory when processing
+ // a Superior, as it may be broken and referenced more than once.
+ Set<String> processed = new HashSet<String>();
+
+ // Call the recursive method, as we may have superiors to deal with
+ resolveRecursive( attributeType, processed, errors );
}
- private boolean resolve( ObjectClass oc, List<Throwable> errors )
+ private void resolve( ObjectClass objectClass, List<Throwable> errors )
{
- boolean isSuccess = true;
+ // This set is used to avoid having more than one error
+ // for an ObjectClass. It's mandatory when processing
+ // the Superiors, as they may be broken and referenced more than once.
+ Set<String> processed = new HashSet<String>();
- if ( oc == null )
+
+ // Call the recursive method, as we may have superiors to deal with
+ resolveRecursive( objectClass, processed, errors );
+ }
+
+ private void resolveRecursive( ObjectClass objectClass, Set<String> processed, List<Throwable> errors )
+ {
+ // Process the Superiors, if any
+
+ List<String> superiorOids = objectClass.getSuperiorOids();
+ ObjectClass superior = null;
+
+ for ( String superiorOid : superiorOids )
{
- return true;
+ // Check if the Superior is present in the registries
+ try
+ {
+ superior = objectClassRegistry.lookup( superiorOid );
+ }
+ catch ( NamingException ne )
+ {
+ // This OC's superior has not been loaded into the Registries.
+ if ( !processed.contains( superiorOid ) )
+ {
+ errors.add( ne );
+ }
+ }
+
+ // We now have to process the superior, if it hasn't been
+ // processed yet.
+ if ( ( superior != null ) && !processed.contains( superiorOid ) )
+ {
+ resolveRecursive( superior, processed, errors );
+ }
}
-
- List<ObjectClass> superiors = oc.getSuperiors();
-
- if ( ( superiors == null ) || ( superiors.size() == 0 ) )
+
+ // Process the MAY attributeTypes.
+ for ( String mayOid : objectClass.getMayAttributeTypeOids() )
{
- isSuccess = false;
+ // Check if the MAY AttributeType is present in the registries
+ try
+ {
+ attributeTypeRegistry.lookup( mayOid );
+ }
+ catch ( NamingException ne )
+ {
+ // This AT has not been loaded into the Registries.
+ errors.add( ne );
+ }
}
- else
+
+ // Process the MUST attributeTypes.
+ for ( String mustOid : objectClass.getMustAttributeTypeOids() )
{
- for ( ObjectClass superior : superiors )
+ // Check if the MUST AttributeType is present in the registries
+ try
+ {
+ attributeTypeRegistry.lookup( mustOid );
+ }
+ catch ( NamingException ne )
{
- isSuccess &= resolve( superior, errors );
+ // This AT has not been loaded into the Registries.
+ errors.add( ne );
}
}
-
- for ( AttributeType attributeType : oc.getMayAttributeTypes() )
+
+ // All is done for this ObjectClass, let's apply the registries
+ try
{
- isSuccess &= resolve( attributeType, errors );
+ objectClass.applyRegistries( this );
}
-
- for ( AttributeType attributeType : oc.getMustAttributeTypes() )
+ catch ( NamingException ne )
{
- isSuccess &= resolve( attributeType, errors );
+ // Do nothing. We may have a broken OC,
+ // but at this point, it doesn't matter.
}
-
- return isSuccess;
}
@@ -901,7 +1077,7 @@
/**
* Dump the UsedBy data structure as a String
*/
- private String dumpUsedBy()
+ public String dumpUsedBy()
{
StringBuilder sb = new StringBuilder();
@@ -937,7 +1113,7 @@
/**
* Dump the Using data structure as a String
*/
- private String dumpUsing()
+ public String dumpUsing()
{
StringBuilder sb = new StringBuilder();
@@ -1200,17 +1376,17 @@
if ( !usedBy.containsKey( refereeWrapper ) )
{
LOG.debug( "The {}:{} is not referenced by any " + message,
- reference.getObjectType(), reference.getOid() );
+ referee.getObjectType(), referee.getOid() );
return false;
}
- Set<SchemaWrapper> used = usedBy.get( referenceWrapper );
+ Set<SchemaWrapper> used = usedBy.get( refereeWrapper );
- if ( !used.contains( refereeWrapper ) )
+ if ( !used.contains( referenceWrapper ) )
{
LOG.debug( "The {}:{} is not referenced by any " + message,
- reference.getObjectType(), reference.getOid() );
+ referee.getObjectType(), referee.getOid() );
return false;
}
@@ -1248,7 +1424,7 @@
}
// Check the references : Syntax -> SyntaxChecker and SyntaxChecker -> Syntax
- if ( checkReferences( syntax, syntax.getSyntaxChecker(), "SyntaxChecker" ) )
+ if ( !checkReferences( syntax, syntax.getSyntaxChecker(), "SyntaxChecker" ) )
{
return false;
}
@@ -1309,19 +1485,19 @@
}
// Check the references : MR -> S and S -> MR
- if ( checkReferences( matchingRule, matchingRule.getSyntax(), "Syntax" ) )
+ if ( !checkReferences( matchingRule, matchingRule.getSyntax(), "Syntax" ) )
{
return false;
}
// Check the references : MR -> N
- if ( checkReferences( matchingRule, matchingRule.getNormalizer(), "Normalizer" ) )
+ if ( !checkReferences( matchingRule, matchingRule.getNormalizer(), "Normalizer" ) )
{
return false;
}
// Check the references : MR -> C and C -> MR
- if ( checkReferences( matchingRule, matchingRule.getLdapComparator(), "Comparator" ) )
+ if ( !checkReferences( matchingRule, matchingRule.getLdapComparator(), "Comparator" ) )
{
return false;
}
@@ -1346,7 +1522,7 @@
}
// Check the references : OC -> AT and AT -> OC (MAY)
- if ( checkReferences( objectClass, may, "AttributeType" ) )
+ if ( !checkReferences( objectClass, may, "AttributeType" ) )
{
return false;
}
@@ -1367,7 +1543,7 @@
}
// Check the references : OC -> AT and AT -> OC (MUST)
- if ( checkReferences( objectClass, must, "AttributeType" ) )
+ if ( !checkReferences( objectClass, must, "AttributeType" ) )
{
return false;
}
@@ -1388,7 +1564,7 @@
}
// Check the references : OC -> OC and OC -> OC (SUPERIORS)
- if ( checkReferences( objectClass, superior, "ObjectClass" ) )
+ if ( !checkReferences( objectClass, superior, "ObjectClass" ) )
{
return false;
}
@@ -1418,7 +1594,7 @@
}
// Check the references for AT -> S and S -> AT
- if ( checkReferences( attributeType, attributeType.getSyntax(), "AttributeType" ) )
+ if ( !checkReferences( attributeType, attributeType.getSyntax(), "AttributeType" ) )
{
return false;
}
@@ -1435,7 +1611,7 @@
}
// Check the references for AT -> MR and MR -> AT
- if ( checkReferences( attributeType, attributeType.getEquality(), "AttributeType" ) )
+ if ( !checkReferences( attributeType, attributeType.getEquality(), "AttributeType" ) )
{
return false;
}
@@ -1453,7 +1629,7 @@
}
// Check the references for AT -> MR and MR -> AT
- if ( checkReferences( attributeType, attributeType.getOrdering(), "AttributeType" ) )
+ if ( !checkReferences( attributeType, attributeType.getOrdering(), "AttributeType" ) )
{
return false;
}
@@ -1471,7 +1647,7 @@
}
// Check the references for AT -> MR and MR -> AT
- if ( checkReferences( attributeType, attributeType.getSubstring(), "AttributeType" ) )
+ if ( !checkReferences( attributeType, attributeType.getSubstring(), "AttributeType" ) )
{
return false;
}
@@ -1491,7 +1667,7 @@
}
// Check the references : AT -> AT and AT -> AT (SUPERIOR)
- if ( checkReferences( attributeType, superior, "AttributeType" ) )
+ if ( !checkReferences( attributeType, superior, "AttributeType" ) )
{
return false;
}
@@ -1500,4 +1676,51 @@
return true;
}
+
+
+ /**
+ * Tells if the Registries is permissive or if it must be checked
+ * against inconsistencies.
+ *
+ * @return True if SchemaObjects can be added even if they break the consistency
+ */
+ public boolean isRelaxed()
+ {
+ return isRelaxed;
+ }
+
+
+ /**
+ * Change the Registries behavior regarding consistency.
+ *
+ * @param isRelaxed If <code>false</code>, then the Registries won't allow modifications that
+ * leave the Registries to be inconsistent
+ */
+ public void setRelaxed( boolean isRelaxed )
+ {
+ this.isRelaxed = isRelaxed;
+ }
+
+
+ /**
+ * Tells if the Registries accept disabled elements.
+ *
+ * @return True if disbaled SchemaObjects can be added
+ */
+ public boolean acceptDisabled()
+ {
+ return acceptDisabled;
+ }
+
+
+ /**
+ * Change the Registries behavior regarding disabled SchemaObject element.
+ *
+ * @param acceptDisabled If <code>false</code>, then the Registries won't accept
+ * disabled SchemaObject or enabled SchemaObject from disabled schema
+ */
+ public void setAcceptDisabled( boolean acceptDisabled )
+ {
+ this.acceptDisabled = acceptDisabled;
+ }
}
Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoader.java?rev=824528&r1=824527&r2=824528&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoader.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoader.java Mon Oct 12 22:44:52 2009
@@ -21,6 +21,7 @@
import java.util.Collection;
+import java.util.List;
/**
@@ -55,9 +56,11 @@
*
* @param schemas the collection of schemas to load
* @param registries the registries to populate with these schemas
+ * @param check tells if the Registries must be checked after having been loaded
+ * @return the list of erros we met during the loading of schemas
* @throws Exception if any kind of problems are encountered during the load
*/
- void loadWithDependencies( Collection<Schema> schemas, Registries registries ) throws Exception;
+ List<Throwable> loadWithDependencies( Collection<Schema> schemas, Registries registries, boolean check ) throws Exception;
/**
@@ -65,18 +68,22 @@
*
* @param schema the schema to load
* @param registries the registries to populate with these schemas
+ * @param check tells if the Registries must be checked after having been loaded
+ * @return the list of erros we met during the loading of schemas
* @throws Exception if any kind of problems are encountered during the load
*/
- void loadWithDependencies( Schema schema, Registries registries ) throws Exception;
+ List<Throwable> loadWithDependencies( Schema schema, Registries registries, boolean check ) throws Exception;
/**
* Loads all available enabled schemas.
*
* @param registries the registry to load all enabled schemas into
+ * @param check tells if the Registries must be checked after having been loaded
+ * @return the list of erros we met during the loading of schemas
* @throws Exception if there are any failures
*/
- void loadAllEnabled( Registries registries ) throws Exception;
+ List<Throwable> loadAllEnabled( Registries registries, boolean check ) throws Exception;
/**
Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/OctetStringSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/OctetStringSyntaxChecker.java?rev=824528&r1=824527&r2=824528&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/OctetStringSyntaxChecker.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/OctetStringSyntaxChecker.java Mon Oct 12 22:44:52 2009
@@ -21,8 +21,6 @@
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.schema.SyntaxChecker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
@@ -39,9 +37,6 @@
*/
public class OctetStringSyntaxChecker extends SyntaxChecker
{
- /** A logger for this class */
- private static final Logger LOG = LoggerFactory.getLogger( OctetStringSyntaxChecker.class );
-
/** The serialVersionUID */
private static final long serialVersionUID = 1L;
@@ -55,6 +50,17 @@
/**
+ * Creates a new instance of OctetStringSyntaxChecker, with a specific OID
+ *
+ * @param oid The Syntax's OID
+ */
+ public OctetStringSyntaxChecker( String oid )
+ {
+ super( oid );
+ }
+
+
+ /**
* {@inheritDoc}
*/
public boolean isValidSyntax( Object value )
Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/util/ExceptionUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/util/ExceptionUtils.java?rev=824528&r1=824527&r2=824528&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/util/ExceptionUtils.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/util/ExceptionUtils.java Mon Oct 12 22:44:52 2009
@@ -964,4 +964,17 @@
}
return list;
}
+
+
+ public static String printErrors( List<Throwable> errors )
+ {
+ StringBuilder sb = new StringBuilder();
+
+ for ( Throwable error:errors )
+ {
+ sb.append( "Error : " ).append( error.getMessage() ).append( "\n" );
+ }
+
+ return sb.toString();
+ }
}