You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2010/05/19 14:10:36 UTC
svn commit: r946144 -
/directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java
Author: felixk
Date: Wed May 19 12:10:36 2010
New Revision: 946144
URL: http://svn.apache.org/viewvc?rev=946144&view=rev
Log:
Formatting
Modified:
directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java
Modified: directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java?rev=946144&r1=946143&r2=946144&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java (original)
+++ directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java Wed May 19 12:10:36 2010
@@ -36,7 +36,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
import org.apache.directory.shared.ldap.exception.LdapProtocolErrorException;
import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
-//import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -113,7 +112,7 @@ public class DefaultSchemaManager implem
/** the normalized name for the schema modification attributes */
private DN schemaModificationAttributesDN;
-
+
/** A Map containing all the schema being dependent from a schema */
private Map<String, Set<String>> schemaDependences = new HashMap<String, Set<String>>();
@@ -197,14 +196,15 @@ public class DefaultSchemaManager implem
for ( String schemaName : schemas )
{
Schema schema = schemaLoader.getSchema( schemaName );
-
+
if ( schema != null )
{
schemaArray[n++] = schema;
}
else
{
- throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_11001, schemaName ) );
+ throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err(
+ I18n.ERR_11001, schemaName ) );
}
}
@@ -216,7 +216,7 @@ public class DefaultSchemaManager implem
{
// Create a content container for this schema
registries.addSchema( schema.getSchemaName() );
-
+
// And inject any existig SchemaObject into the registries
addComparators( schema, registries );
addNormalizers( schema, registries );
@@ -257,7 +257,7 @@ public class DefaultSchemaManager implem
}
}
-
+
//-----------------------------------------------------------------------
// API methods
//-----------------------------------------------------------------------
@@ -512,7 +512,7 @@ public class DefaultSchemaManager implem
{
return true;
}
-
+
boolean loaded = false;
// Reset the errors if not null
@@ -528,7 +528,7 @@ public class DefaultSchemaManager implem
// Load the schemas
for ( Schema schema : schemas )
{
- if ( !load( clonedRegistries, schema ) && ( ! errors.isEmpty() ) )
+ if ( !load( clonedRegistries, schema ) && ( !errors.isEmpty() ) )
{
return false;
}
@@ -551,26 +551,26 @@ public class DefaultSchemaManager implem
for ( Schema schema : schemas )
{
load( registries, schema );
-
+
// Update the schema dependences if needed
-
+
if ( schema.getDependencies() != null )
{
for ( String dep : schema.getDependencies() )
{
Set<String> deps = schemaDependences.get( dep );
-
+
if ( deps == null )
{
deps = new HashSet<String>();
deps.add( schema.getSchemaName() );
}
-
+
// Replace the dependences
schemaDependences.put( dep, deps );
}
}
-
+
// add the schema to the schemaLoader
schemaLoader.addSchema( schema );
}
@@ -599,7 +599,7 @@ public class DefaultSchemaManager implem
{
return true;
}
-
+
Schema[] schemas = toArray( schemaNames );
return load( schemas );
@@ -642,7 +642,7 @@ public class DefaultSchemaManager implem
else
{
LOG.info( "Loading {} enabled schema: \n{}", schema.getSchemaName(), schema );
-
+
// Check that the dependencies, if any, are correct
if ( schema.getDependencies() != null )
{
@@ -673,7 +673,8 @@ public class DefaultSchemaManager implem
* - isRelaxed
* - disabledAccepted
*/
- @SuppressWarnings("PMD.UnusedPrivateMethod") // False positive
+ @SuppressWarnings("PMD.UnusedPrivateMethod")
+ // False positive
private boolean unload( Registries registries, Schema schema ) throws Exception
{
if ( schema == null )
@@ -733,10 +734,10 @@ public class DefaultSchemaManager implem
*/
private void addDitContentRules( Schema schema, Registries registries ) throws Exception
{
- if ( !schemaLoader.loadDitContentRules( schema ).isEmpty() )
- {
+ if ( !schemaLoader.loadDitContentRules( schema ).isEmpty() )
+ {
throw new NotImplementedException( I18n.err( I18n.ERR_11003 ) );
- }
+ }
// for ( Entry entry : schemaLoader.loadDitContentRules( schema ) )
// {
// throw new NotImplementedException( I18n.err( I18n.ERR_11003 ) );
@@ -749,10 +750,10 @@ public class DefaultSchemaManager implem
*/
private void addDitStructureRules( Schema schema, Registries registries ) throws Exception
{
- if ( !schemaLoader.loadDitStructureRules( schema ).isEmpty() )
- {
+ if ( !schemaLoader.loadDitStructureRules( schema ).isEmpty() )
+ {
throw new NotImplementedException( I18n.err( I18n.ERR_11004 ) );
- }
+ }
// for ( Entry entry : schemaLoader.loadDitStructureRules( schema ) )
// {
// throw new NotImplementedException( I18n.err( I18n.ERR_11004 ) );
@@ -779,10 +780,10 @@ public class DefaultSchemaManager implem
*/
private void addMatchingRuleUses( Schema schema, Registries registries ) throws Exception
{
- if ( !schemaLoader.loadMatchingRuleUses( schema ).isEmpty() )
- {
+ if ( !schemaLoader.loadMatchingRuleUses( schema ).isEmpty() )
+ {
throw new NotImplementedException( I18n.err( I18n.ERR_11005 ) );
- }
+ }
// for ( Entry entry : schemaLoader.loadMatchingRuleUses( schema ) )
// {
// throw new NotImplementedException( I18n.err( I18n.ERR_11005 ) );
@@ -795,10 +796,10 @@ public class DefaultSchemaManager implem
*/
private void addNameForms( Schema schema, Registries registries ) throws Exception
{
- if ( !schemaLoader.loadNameForms( schema ).isEmpty() )
- {
+ if ( !schemaLoader.loadNameForms( schema ).isEmpty() )
+ {
throw new NotImplementedException( I18n.err( I18n.ERR_11006 ) );
- }
+ }
// for ( Entry entry : schemaLoader.loadNameForms( schema ) )
// {
// throw new NotImplementedException( I18n.err( I18n.ERR_11006 ) );
@@ -951,7 +952,7 @@ public class DefaultSchemaManager implem
{
load( registries, schema );
}
-
+
return true;
}
else
@@ -960,7 +961,7 @@ public class DefaultSchemaManager implem
{
schema.disable();
}
-
+
return false;
}
}
@@ -1172,7 +1173,7 @@ public class DefaultSchemaManager implem
{
errors.clear();
}
-
+
// Work on a cloned and relaxed registries
Registries clonedRegistries = cloneRegistries();
clonedRegistries.setRelaxed();
@@ -1200,18 +1201,18 @@ public class DefaultSchemaManager implem
for ( Schema schema : schemas )
{
unload( registries, schema );
-
+
// Update the schema dependences
for ( String dep : schema.getDependencies() )
{
Set<String> deps = schemaDependences.get( dep );
-
+
if ( deps != null )
{
deps.remove( schema.getSchemaName() );
}
}
-
+
schemaLoader.removeSchema( schema );
}
@@ -1537,8 +1538,8 @@ public class DefaultSchemaManager implem
return false;
}
-
-
+
+
/**
* Get the inner SchemaObject if it's not a C/N/SC
*/
@@ -1596,8 +1597,8 @@ public class DefaultSchemaManager implem
else
{
// We have an invalid SchemaObject, no need to go any further
- Throwable error = new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
- I18n.err( I18n.ERR_11007, schemaObject.getOid() ) );
+ Throwable error = new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err(
+ I18n.ERR_11007, schemaObject.getOid() ) );
errors.add( error );
}
}
@@ -1638,8 +1639,7 @@ public class DefaultSchemaManager implem
// The new schemaObject's OID must not already exist
if ( checkOidExist( copy ) )
{
- Throwable error = new LdapProtocolErrorException(
- I18n.err( I18n.ERR_11008, schemaObject.getOid() ) );
+ Throwable error = new LdapProtocolErrorException( I18n.err( I18n.ERR_11008, schemaObject.getOid() ) );
errors.add( error );
return false;
@@ -1651,8 +1651,8 @@ public class DefaultSchemaManager implem
if ( schemaName == null )
{
// The schema associated with the SchemzaObject does not exist. This is not valid.
- Throwable error = new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_11009, schemaObject.getOid(),
- copy.getSchemaName() ) );
+ Throwable error = new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err(
+ I18n.ERR_11009, schemaObject.getOid(), copy.getSchemaName() ) );
errors.add( error );
return false;
@@ -1741,8 +1741,7 @@ public class DefaultSchemaManager implem
// The new schemaObject's OID must exist
if ( !checkOidExist( schemaObject ) )
{
- Throwable error = new LdapProtocolErrorException(
- I18n.err( I18n.ERR_11011, schemaObject.getOid() ) );
+ Throwable error = new LdapProtocolErrorException( I18n.err( I18n.ERR_11011, schemaObject.getOid() ) );
errors.add( error );
return false;
}
@@ -1987,7 +1986,7 @@ public class DefaultSchemaManager implem
return !isRelaxed;
}
-
+
/**
* {@inheritDoc}
*/