From commits-return-23578-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Sat Nov 07 07:58:49 2009 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 34454 invoked from network); 7 Nov 2009 07:58:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Nov 2009 07:58:49 -0000 Received: (qmail 44296 invoked by uid 500); 7 Nov 2009 07:58:49 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 44219 invoked by uid 500); 7 Nov 2009 07:58:49 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 44137 invoked by uid 99); 7 Nov 2009 07:58:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Nov 2009 07:58:49 +0000 X-ASF-Spam-Status: No, hits=-1999.6 required=10.0 tests=ALL_TRUSTED,SUBJECT_FUZZY_TION X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Nov 2009 07:58:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6F65123889F7; Sat, 7 Nov 2009 07:57:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r833647 [8/17] - in /directory: apacheds/branches/apacheds-schema/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/par... Date: Sat, 07 Nov 2009 07:57:42 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091107075754.6F65123889F7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Sat Nov 7 07:57:34 2009 @@ -20,8 +20,6 @@ package org.apache.directory.server.core.normalization; -import java.util.Map; - import org.apache.directory.server.core.DirectoryService; import org.apache.directory.server.core.entry.ClonedServerEntry; import org.apache.directory.server.core.entry.ServerEntry; @@ -54,9 +52,8 @@ import org.apache.directory.shared.ldap.name.NameComponentNormalizer; import org.apache.directory.shared.ldap.name.Rdn; import org.apache.directory.shared.ldap.schema.AttributeType; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.schema.normalizers.ConcreteNameComponentNormalizer; -import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer; -import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -84,11 +81,8 @@ /** a filter node value normalizer and undefined node remover */ private FilterNormalizingVisitor normVisitor; - /** The association between attributeTypes and their normalizers */ - private Map attrNormalizers; - /** The attributeType registry */ - private AttributeTypeRegistry attributeRegistry; + private SchemaManager schemaManager; /** * Initialize the registries, normalizers. @@ -97,10 +91,9 @@ { LOG.debug( "Initialiazing the NormalizationInterceptor" ); - attributeRegistry = directoryService.getRegistries().getAttributeTypeRegistry(); - NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry ); - normVisitor = new FilterNormalizingVisitor( ncn, directoryService.getRegistries() ); - attrNormalizers = attributeRegistry.getNormalizerMapping(); + schemaManager = directoryService.getSchemaManager(); + NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager ); + normVisitor = new FilterNormalizingVisitor( ncn, schemaManager ); } /** @@ -118,8 +111,8 @@ */ public void add( NextInterceptor nextInterceptor, AddOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); - opContext.getEntry().getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); + opContext.getEntry().getDn().normalize( schemaManager.getNormalizerMapping() ); addRdnAttributesToEntry( opContext.getDn(), opContext.getEntry() ); nextInterceptor.add( opContext ); } @@ -130,7 +123,7 @@ */ public void delete( NextInterceptor nextInterceptor, DeleteOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); nextInterceptor.delete( opContext ); } @@ -140,7 +133,7 @@ */ public void modify( NextInterceptor nextInterceptor, ModifyOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); nextInterceptor.modify( opContext ); } @@ -151,9 +144,9 @@ public void rename( NextInterceptor nextInterceptor, RenameOperationContext opContext ) throws Exception { // Normalize the new RDN and the DN - opContext.getNewRdn().normalize( attrNormalizers ); - opContext.getDn().normalize( attrNormalizers ); - opContext.getNewDn().normalize( attrNormalizers ); + opContext.getNewRdn().normalize( schemaManager.getNormalizerMapping() ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); + opContext.getNewDn().normalize( schemaManager.getNormalizerMapping() ); // Push to the next interceptor nextInterceptor.rename( opContext ); @@ -165,8 +158,8 @@ */ public void move( NextInterceptor nextInterceptor, MoveOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); - opContext.getParent().normalize( attrNormalizers); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); + opContext.getParent().normalize( schemaManager.getNormalizerMapping()); nextInterceptor.move( opContext ); } @@ -179,11 +172,11 @@ { LdapDN rdn = new LdapDN(); rdn.add( opContext.getNewRdn() ); - rdn.normalize( attrNormalizers ); + rdn.normalize( schemaManager.getNormalizerMapping() ); opContext.setNewRdn( rdn.getRdn() ); - opContext.getDn().normalize( attrNormalizers ); - opContext.getParent().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); + opContext.getParent().normalize( schemaManager.getNormalizerMapping() ); nextInterceptor.moveAndRename( opContext ); } @@ -193,7 +186,7 @@ */ public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); ExprNode filter = opContext.getFilter(); @@ -220,7 +213,7 @@ */ public boolean hasEntry( NextInterceptor nextInterceptor, EntryOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); return nextInterceptor.hasEntry( opContext ); } @@ -230,7 +223,7 @@ */ public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); return nextInterceptor.list( opContext ); } @@ -250,7 +243,7 @@ for ( String id:attrIds ) { - String oid = attributeRegistry.lookup( id ).getOid(); + String oid = schemaManager.lookupAttributeTypeRegistry( id ).getOid(); normalizedAttrIds[pos++] = oid; } @@ -263,7 +256,7 @@ */ public ClonedServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); if ( opContext.getAttrsId() != null ) { @@ -283,7 +276,7 @@ */ public LdapDN getMatchedName ( NextInterceptor nextInterceptor, GetMatchedNameOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); return nextInterceptor.getMatchedName( opContext ); } @@ -293,7 +286,7 @@ */ public LdapDN getSuffix ( NextInterceptor nextInterceptor, GetSuffixOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); return nextInterceptor.getSuffix( opContext ); } @@ -303,9 +296,9 @@ */ public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); - AttributeType at = opContext.getSession().getDirectoryService().getRegistries().getAttributeTypeRegistry().lookup( opContext.getOid() ); + AttributeType at = opContext.getSession().getDirectoryService().getSchemaManager().lookupAttributeTypeRegistry( opContext.getOid() ); if ( at.getSyntax().isHumanReadable() && ( opContext.getValue().isBinary() ) ) { @@ -322,7 +315,7 @@ */ public void bind( NextInterceptor next, BindOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); next.bind( opContext ); } @@ -332,7 +325,7 @@ */ public void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); next.addContextPartition( opContext ); } @@ -342,7 +335,7 @@ */ public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws Exception { - opContext.getDn().normalize( attrNormalizers ); + opContext.getDn().normalize( schemaManager.getNormalizerMapping() ); next.removeContextPartition( opContext ); } @@ -385,7 +378,7 @@ // 2) The attribute exists else { - AttributeType at = attributeRegistry.lookup( upId ); + AttributeType at = schemaManager.lookupAttributeTypeRegistry( upId ); // 2.1 if the attribute is single valued, replace the value if ( at.isSingleValued() ) Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Sat Nov 7 07:57:34 2009 @@ -59,10 +59,9 @@ import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.name.Rdn; import org.apache.directory.shared.ldap.schema.AttributeType; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.schema.SchemaUtils; import org.apache.directory.shared.ldap.schema.UsageEnum; -import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry; -import org.apache.directory.shared.ldap.schema.registries.Registries; import org.apache.directory.shared.ldap.util.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -112,14 +111,12 @@ }; - private AttributeTypeRegistry atRegistry; - private DirectoryService service; private LdapDN subschemaSubentryDn; - /** The registries */ - private Registries registries; + /** The schemaManager */ + private SchemaManager schemaManager; private static AttributeType CREATE_TIMESTAMP_ATTRIBUTE_TYPE; private static AttributeType MODIFIERS_NAME_ATTRIBUTE_TYPE; @@ -137,18 +134,17 @@ public void init( DirectoryService directoryService ) throws Exception { service = directoryService; - registries = directoryService.getRegistries(); - atRegistry = registries.getAttributeTypeRegistry(); + schemaManager = directoryService.getSchemaManager(); // stuff for dealing with subentries (garbage for now) Value subschemaSubentry = service.getPartitionNexus() .getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get(); subschemaSubentryDn = new LdapDN( subschemaSubentry.getString() ); - subschemaSubentryDn.normalize( atRegistry.getNormalizerMapping() ); + subschemaSubentryDn.normalize( schemaManager.getNormalizerMapping() ); - CREATE_TIMESTAMP_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.CREATE_TIMESTAMP_AT ); - MODIFIERS_NAME_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT ); - MODIFY_TIMESTAMP_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT ); + CREATE_TIMESTAMP_ATTRIBUTE_TYPE = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.CREATE_TIMESTAMP_AT ); + MODIFIERS_NAME_ATTRIBUTE_TYPE = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.MODIFIERS_NAME_AT ); + MODIFY_TIMESTAMP_ATTRIBUTE_TYPE = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.MODIFY_TIMESTAMP_AT ); } @@ -309,7 +305,7 @@ LdapDN newDn = opContext.getNewDn(); // add operational attributes after call in case the operation fails - ServerEntry serverEntry = new DefaultServerEntry( registries, newDn ); + ServerEntry serverEntry = new DefaultServerEntry( schemaManager, newDn ); serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() ); serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); @@ -327,7 +323,7 @@ nextInterceptor.move( opContext ); // add operational attributes after call in case the operation fails - ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() ); + ServerEntry serverEntry = new DefaultServerEntry( schemaManager, opContext.getDn() ); serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() ); serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); @@ -347,7 +343,7 @@ nextInterceptor.moveAndRename( opContext ); // add operational attributes after call in case the operation fails - ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() ); + ServerEntry serverEntry = new DefaultServerEntry( schemaManager, opContext.getDn() ); serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() ); serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); @@ -534,7 +530,7 @@ } else if ( rdn.size() == 1 ) { - String name = atRegistry.lookup( rdn.getNormType() ).getName(); + String name = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName(); String value = rdn.getAtav().getNormValue().getString(); newDn.add( new Rdn( name, name, value, value ) ); continue; @@ -546,7 +542,7 @@ for ( Iterator atavs = rdn.iterator(); atavs.hasNext(); /**/ ) { AttributeTypeAndValue atav = atavs.next(); - String type = atRegistry.lookup( rdn.getNormType() ).getName(); + String type = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName(); buf.append( type ).append( '=' ).append( atav.getNormValue() ); if ( atavs.hasNext() ) Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Sat Nov 7 07:57:34 2009 @@ -92,10 +92,9 @@ import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.shared.ldap.schema.Normalizer; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.schema.SchemaUtils; import org.apache.directory.shared.ldap.schema.UsageEnum; -import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry; -import org.apache.directory.shared.ldap.schema.registries.Registries; import org.apache.directory.shared.ldap.util.DateUtils; import org.apache.directory.shared.ldap.util.NamespaceTools; import org.apache.directory.shared.ldap.util.StringTools; @@ -130,11 +129,8 @@ /** The DirectoryService instance */ private DirectoryService directoryService; - /** The global registries */ - private Registries registries; - - /** The attributeType registry */ - private AttributeTypeRegistry atRegistry; + /** The global schemaManager */ + private SchemaManager schemaManager; /** the partitions keyed by normalized suffix strings */ private Map partitions = new HashMap(); @@ -221,12 +217,11 @@ } //this.directoryService = directoryService; - registries = directoryService.getRegistries(); - atRegistry = registries.getAttributeTypeRegistry(); + schemaManager = directoryService.getSchemaManager(); // Initialize and normalize the localy used DNs LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN ); - adminDn.normalize( atRegistry.getNormalizerMapping() ); + adminDn.normalize( schemaManager.getNormalizerMapping() ); initializeSystemPartition( directoryService ); @@ -238,7 +233,7 @@ { for ( Partition partition : directoryService.getPartitions() ) { - partition.setRegistries( registries ); + partition.setSchemaManager( schemaManager ); CoreSession adminSession = new DefaultCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService ); @@ -307,8 +302,8 @@ // Add root context entry for system partition LdapDN systemSuffixDn = new LdapDN( ServerDNConstants.SYSTEM_DN ); - systemSuffixDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() ); - ServerEntry systemEntry = new DefaultServerEntry( registries, systemSuffixDn ); + systemSuffixDn.normalize( schemaManager.getNormalizerMapping() ); + ServerEntry systemEntry = new DefaultServerEntry( schemaManager, systemSuffixDn ); // Add the ObjectClasses systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, @@ -325,7 +320,7 @@ systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ), NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) ); LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED ); - adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() ); + adminDn.normalize( schemaManager.getNormalizerMapping() ); CoreSession adminSession = new DefaultCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService ); AddOperationContext addOperationContext = new AddOperationContext( adminSession, systemEntry ); @@ -351,7 +346,7 @@ if ( namingContexts == null ) { namingContexts = new DefaultServerAttribute( - registries.getAttributeTypeRegistry().lookup( SchemaConstants.NAMING_CONTEXTS_AT ), + schemaManager.lookupAttributeTypeRegistry( SchemaConstants.NAMING_CONTEXTS_AT ), system.getSuffixDn().getUpName() ); rootDSE.put( namingContexts ); } @@ -382,7 +377,7 @@ try { LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED ); - adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() ); + adminDn.normalize( schemaManager.getNormalizerMapping() ); CoreSession adminSession = new DefaultCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService ); removeContextPartition( new RemoveContextPartitionOperationContext( @@ -415,22 +410,22 @@ throw new UnsupportedOperationException( "The id cannot be set for the partition nexus." ); } - - /* (non-Javadoc) - * @see org.apache.directory.server.core.partition.PartitionNexus#getRegistries() + + /** + * {@inheritDoc} */ - public Registries getRegistries() + public SchemaManager getSchemaManager() { - return this.registries; + return schemaManager; } - - /* (non-Javadoc) - * @see org.apache.directory.server.core.partition.PartitionNexus#setRegistries(org.apache.directory.shared.ldap.schema.registries.Registries) + + /** + * {@inheritDoc} */ - public void setRegistries( Registries registries ) + public void setSchemaManager( SchemaManager schemaManager ) { - this.registries = registries; + this.schemaManager = schemaManager; } @@ -532,15 +527,15 @@ public boolean compare( CompareOperationContext compareContext ) throws Exception { Partition partition = getPartition( compareContext.getDn() ); - AttributeTypeRegistry registry = registries.getAttributeTypeRegistry(); + //AttributeTypeRegistry registry = schemaManager.getAttributeTypeRegistry(); // complain if we do not recognize the attribute being compared - if ( !registry.contains( compareContext.getOid() ) ) + if ( !schemaManager.getAttributeTypeRegistry().contains( compareContext.getOid() ) ) { throw new LdapInvalidAttributeIdentifierException( compareContext.getOid() + " not found within the attributeType registry" ); } - AttributeType attrType = registry.lookup( compareContext.getOid() ); + AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( compareContext.getOid() ); EntryAttribute attr = partition.lookup( compareContext.newLookupContext( compareContext.getDn() ) ).get( attrType.getName() ); @@ -790,7 +785,7 @@ { try { - realIds.add( atRegistry.getOidByName( idTrimmed ) ); + realIds.add( schemaManager.getAttributeTypeRegistry().getOidByName( idTrimmed ) ); } catch ( Exception e ) { @@ -802,7 +797,7 @@ // return nothing if ( containsOneDotOne ) { - ServerEntry serverEntry = new DefaultServerEntry( registries, base ); + ServerEntry serverEntry = new DefaultServerEntry( schemaManager, base ); return new BaseEntryFilteringCursor( new SingletonCursor( serverEntry ), opContext ); } @@ -813,13 +808,13 @@ return new BaseEntryFilteringCursor( new SingletonCursor( rootDSE ), opContext ); } - ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() ); + ServerEntry serverEntry = new DefaultServerEntry( schemaManager, opContext.getDn() ); ServerEntry rootDSE = getRootDSE( new GetRootDSEOperationContext( opContext.getSession() ) ); for ( EntryAttribute attribute:rootDSE ) { - AttributeType type = atRegistry.lookup( attribute.getUpId() ); + AttributeType type = schemaManager.lookupAttributeTypeRegistry( attribute.getUpId() ); if ( realIds.contains( type.getOid() ) ) { @@ -842,7 +837,7 @@ throw new LdapNameNotFoundException(); } - base.normalize( atRegistry.getNormalizerMapping() ); + base.normalize( schemaManager.getNormalizerMapping() ); Partition backend = getPartition( base ); return backend.search( opContext ); } @@ -904,7 +899,7 @@ if ( namingContexts == null ) { namingContexts = new DefaultServerAttribute( - registries.getAttributeTypeRegistry().lookup( SchemaConstants.NAMING_CONTEXTS_AT ), partitionSuffix.getUpName() ); + schemaManager.lookupAttributeTypeRegistry( SchemaConstants.NAMING_CONTEXTS_AT ), partitionSuffix.getUpName() ); rootDSE.put( namingContexts ); } else Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Sat Nov 7 07:57:34 2009 @@ -54,7 +54,7 @@ import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.schema.AttributeType; -import org.apache.directory.shared.ldap.schema.registries.Registries; +import org.apache.directory.shared.ldap.schema.SchemaManager; /** @@ -87,7 +87,7 @@ protected SearchEngine searchEngine; protected Optimizer optimizer; - protected Registries registries; + protected SchemaManager schemaManager; protected String id; protected int cacheSize = -1; @@ -121,18 +121,18 @@ /** * {@inheritDoc} */ - public void setRegistries( Registries registries ) + public void setSchemaManager( SchemaManager schemaManager ) { - this.registries = registries; + this.schemaManager = schemaManager; } /** * {@inheritDoc} */ - public Registries getRegistries() + public SchemaManager getSchemaManager() { - return registries; + return schemaManager; } @@ -351,7 +351,7 @@ public void inspect() throws Exception { - PartitionViewer viewer = new PartitionViewer( this, registries ); + PartitionViewer viewer = new PartitionViewer( this, schemaManager ); viewer.execute(); } Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java Sat Nov 7 07:57:34 2009 @@ -42,7 +42,7 @@ import org.apache.directory.server.core.entry.DefaultServerEntry; import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.shared.ldap.constants.SchemaConstants; -import org.apache.directory.shared.ldap.schema.registries.Registries; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -82,10 +82,10 @@ * @param parent the parent frame * @param modal whether or not to go modal on the dialog */ - public AddEntryDialog(Frame parent, boolean modal, Registries registries ) + public AddEntryDialog(Frame parent, boolean modal, SchemaManager schemaManager ) { super( parent, modal ); - childEntry = new DefaultServerEntry( registries ); + childEntry = new DefaultServerEntry( schemaManager ); childEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC ); initGUI(); } Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java Sat Nov 7 07:57:34 2009 @@ -66,16 +66,14 @@ import org.apache.directory.server.xdbm.Index; import org.apache.directory.server.xdbm.IndexCursor; import org.apache.directory.server.xdbm.IndexEntry; - import org.apache.directory.shared.ldap.filter.ExprNode; import org.apache.directory.shared.ldap.filter.FilterParser; import org.apache.directory.shared.ldap.ldif.LdifEntry; import org.apache.directory.shared.ldap.ldif.LdifReader; import org.apache.directory.shared.ldap.message.AliasDerefMode; import org.apache.directory.shared.ldap.name.LdapDN; -import org.apache.directory.shared.ldap.schema.registries.Registries; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.util.StringTools; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -118,8 +116,8 @@ private EntryNode root; - /** A handle on the global registries */ - private Registries registries; + /** A handle on the global schemaManager */ + private SchemaManager schemaManager; /** * Creates new form JFrame @@ -127,10 +125,10 @@ * @param db the partition to view * @throws NamingException if there are problems accessing the partition */ - public PartitionFrame( BTreePartition db, Registries registries ) throws Exception + public PartitionFrame( BTreePartition db, SchemaManager schemaManager ) throws Exception { partition = db; - this.registries = registries; + this.schemaManager = schemaManager; initialize(); buildIndicesMenu( partition ); @@ -394,7 +392,7 @@ return; } - AddEntryDialog dialog = new AddEntryDialog( this, false, registries ); + AddEntryDialog dialog = new AddEntryDialog( this, false, schemaManager ); dialog.setParentDn( parentDn ); centerOnScreen( dialog ); @@ -469,7 +467,7 @@ LdapDN ndn = new LdapDN( StringTools.deepTrimToLower( updn ) ); - ServerEntry attrs = new DefaultServerEntry( registries, entry.getEntry() ); + ServerEntry attrs = new DefaultServerEntry( schemaManager, entry.getEntry() ); if ( null == partition.getEntryId( ndn.toString() ) ) { Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java Sat Nov 7 07:57:34 2009 @@ -24,7 +24,7 @@ import java.awt.Toolkit; import org.apache.directory.server.core.partition.impl.btree.BTreePartition; -import org.apache.directory.shared.ldap.schema.registries.Registries; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,14 +42,14 @@ /** A handle on the atomic partition */ private BTreePartition partition; - /** A handle on the global registries */ - private Registries registries; + /** A handle on the global schemaManager */ + private SchemaManager schemaManager; - public PartitionViewer( BTreePartition db, Registries registries ) + public PartitionViewer( BTreePartition db, SchemaManager schemaManager ) { this.partition = db; - this.registries = registries; + this.schemaManager = schemaManager; } @@ -62,7 +62,7 @@ PartitionFrame frame = null; try { - frame = new PartitionFrame( PartitionViewer.this.partition, registries ); + frame = new PartitionFrame( PartitionViewer.this.partition, schemaManager ); } catch ( Exception e ) { Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java Sat Nov 7 07:57:34 2009 @@ -20,6 +20,17 @@ package org.apache.directory.server.core.prefs; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.HashMap; +import java.util.List; +import java.util.prefs.AbstractPreferences; +import java.util.prefs.BackingStoreException; +import java.util.prefs.Preferences; + +import javax.naming.InvalidNameException; +import javax.naming.NamingException; + import org.apache.directory.server.constants.ApacheSchemaConstants; import org.apache.directory.server.core.DirectoryService; import org.apache.directory.server.core.entry.ClonedServerEntry; @@ -37,17 +48,6 @@ import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.shared.ldap.util.PreferencesDictionary; -import javax.naming.InvalidNameException; -import javax.naming.NamingException; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.HashMap; -import java.util.List; -import java.util.prefs.AbstractPreferences; -import java.util.prefs.BackingStoreException; -import java.util.prefs.Preferences; - /** * A server side system {@link Preferences} implementation. This implementation @@ -116,7 +116,7 @@ try { dn = new LdapDN( "prefNodeName=" + name + "," + parentDn.getUpName() ); - dn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() ); + dn.normalize( directoryService.getSchemaManager().getNormalizerMapping() ); if ( ! directoryService.getAdminSession().exists( dn ) ) { @@ -272,7 +272,7 @@ AttributeType at; try { - at = directoryService.getRegistries().getAttributeTypeRegistry().lookup( key ); + at = directoryService.getSchemaManager().lookupAttributeTypeRegistry( key ); ServerAttribute attr = new DefaultServerAttribute( at ); Modification mi = new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attr ); addDelta( mi ); @@ -346,7 +346,7 @@ AttributeType at; try { - at = directoryService.getRegistries().getAttributeTypeRegistry().lookup( key ); + at = directoryService.getSchemaManager().lookupAttributeTypeRegistry( key ); ServerAttribute attr = new DefaultServerAttribute( at, value ); Modification mi = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attr ); addDelta( mi ); Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Sat Nov 7 07:57:34 2009 @@ -45,8 +45,7 @@ import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.name.LdapDN; -import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry; -import org.apache.directory.shared.ldap.schema.registries.Registries; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.util.LdapURL; import org.apache.directory.shared.ldap.util.StringTools; import org.slf4j.Logger; @@ -69,11 +68,8 @@ private PartitionNexus nexus; - /** The attributeType registry */ - private AttributeTypeRegistry atRegistry; - - /** The global registries */ - private Registries registries; + /** The global schemaManager */ + private SchemaManager schemaManager; /** The referralManager */ private ReferralManager referralManager; @@ -205,8 +201,7 @@ public void init( DirectoryService directoryService ) throws Exception { nexus = directoryService.getPartitionNexus(); - registries = directoryService.getRegistries(); - atRegistry = registries.getAttributeTypeRegistry(); + schemaManager = directoryService.getSchemaManager(); // Initialize the referralManager referralManager = new ReferralManagerImpl( directoryService ); @@ -214,7 +209,7 @@ Value subschemaSubentry = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get(); LdapDN subschemaSubentryDn = new LdapDN( subschemaSubentry.getString() ); - subschemaSubentryDn.normalize( atRegistry.getNormalizerMapping() ); + subschemaSubentryDn.normalize( schemaManager.getNormalizerMapping() ); subschemaSubentryDnNorm = subschemaSubentryDn.getNormName(); } Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaService.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaService.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaService.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaService.java Sat Nov 7 07:57:34 2009 @@ -45,9 +45,9 @@ import org.apache.directory.shared.ldap.schema.NameForm; import org.apache.directory.shared.ldap.schema.Normalizer; import org.apache.directory.shared.ldap.schema.ObjectClass; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.schema.SchemaUtils; import org.apache.directory.shared.ldap.schema.SyntaxChecker; -import org.apache.directory.shared.ldap.schema.registries.Registries; /** @@ -97,9 +97,9 @@ } - public final Registries getRegistries() + public final SchemaManager getSchemaManager() { - return schemaPartition.getRegistries(); + return schemaPartition.getSchemaManager(); } @@ -127,9 +127,9 @@ private ServerAttribute generateComparators() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.COMPARATORS_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.COMPARATORS_AT ) ); - Iterator> list = getRegistries().getComparatorRegistry().iterator(); + Iterator> list = getSchemaManager().getComparatorRegistry().iterator(); while ( list.hasNext() ) { @@ -143,9 +143,9 @@ private ServerAttribute generateNormalizers() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.NORMALIZERS_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.NORMALIZERS_AT ) ); - Iterator list = getRegistries().getNormalizerRegistry().iterator(); + Iterator list = getSchemaManager().getNormalizerRegistry().iterator(); while ( list.hasNext() ) { @@ -159,9 +159,9 @@ private ServerAttribute generateSyntaxCheckers() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.SYNTAX_CHECKERS_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.SYNTAX_CHECKERS_AT ) ); - Iterator list = getRegistries().getSyntaxCheckerRegistry().iterator(); + Iterator list = getSchemaManager().getSyntaxCheckerRegistry().iterator(); while ( list.hasNext() ) { @@ -175,9 +175,9 @@ private ServerAttribute generateObjectClasses() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.OBJECT_CLASSES_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASSES_AT ) ); - Iterator list = getRegistries().getObjectClassRegistry().iterator(); + Iterator list = getSchemaManager().getObjectClassRegistry().iterator(); while ( list.hasNext() ) { @@ -192,9 +192,9 @@ private ServerAttribute generateAttributeTypes() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.ATTRIBUTE_TYPES_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.ATTRIBUTE_TYPES_AT ) ); - Iterator list = getRegistries().getAttributeTypeRegistry().iterator(); + Iterator list = getSchemaManager().getAttributeTypeRegistry().iterator(); while ( list.hasNext() ) { @@ -209,9 +209,9 @@ private ServerAttribute generateMatchingRules() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.MATCHING_RULES_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.MATCHING_RULES_AT ) ); - Iterator list = getRegistries().getMatchingRuleRegistry().iterator(); + Iterator list = getSchemaManager().getMatchingRuleRegistry().iterator(); while ( list.hasNext() ) { @@ -226,9 +226,9 @@ private ServerAttribute generateMatchingRuleUses() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.MATCHING_RULE_USE_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.MATCHING_RULE_USE_AT ) ); - Iterator list = getRegistries().getMatchingRuleUseRegistry().iterator(); + Iterator list = getSchemaManager().getMatchingRuleUseRegistry().iterator(); while ( list.hasNext() ) { @@ -243,9 +243,9 @@ private ServerAttribute generateSyntaxes() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.LDAP_SYNTAXES_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.LDAP_SYNTAXES_AT ) ); - Iterator list = getRegistries().getLdapSyntaxRegistry().iterator(); + Iterator list = getSchemaManager().getLdapSyntaxRegistry().iterator(); while ( list.hasNext() ) { @@ -260,9 +260,9 @@ private ServerAttribute generateDitContextRules() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.DIT_CONTENT_RULES_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.DIT_CONTENT_RULES_AT ) ); - Iterator list = getRegistries().getDitContentRuleRegistry().iterator(); + Iterator list = getSchemaManager().getDITContentRuleRegistry().iterator(); while ( list.hasNext() ) { @@ -277,9 +277,9 @@ private ServerAttribute generateDitStructureRules() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.DIT_STRUCTURE_RULES_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.DIT_STRUCTURE_RULES_AT ) ); - Iterator list = getRegistries().getDitStructureRuleRegistry().iterator(); + Iterator list = getSchemaManager().getDITStructureRuleRegistry().iterator(); while ( list.hasNext() ) { @@ -294,9 +294,9 @@ private ServerAttribute generateNameForms() throws NamingException { ServerAttribute attr = new DefaultServerAttribute( - getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.NAME_FORMS_AT ) ); + getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.NAME_FORMS_AT ) ); - Iterator list = getRegistries().getNameFormRegistry().iterator(); + Iterator list = getSchemaManager().getNameFormRegistry().iterator(); while ( list.hasNext() ) { @@ -313,7 +313,7 @@ */ private void generateSchemaSubentry( ServerEntry mods ) throws NamingException { - ServerEntry attrs = new DefaultServerEntry( getRegistries(), mods.getDn() ); + ServerEntry attrs = new DefaultServerEntry( getSchemaManager(), mods.getDn() ); // add the objectClass attribute : 'top', 'subschema', 'subentry' and 'apacheSubschema' attrs.put( SchemaConstants.OBJECT_CLASS_AT, @@ -408,7 +408,7 @@ { schemaModificationAttributesDN = new LdapDN( ServerDNConstants.SCHEMA_MODIFICATIONS_DN ); schemaModificationAttributesDN.normalize( - getRegistries().getAttributeTypeRegistry().getNormalizerMapping() ); + getSchemaManager().getNormalizerMapping() ); } catch ( NamingException e ) { @@ -443,7 +443,7 @@ } Set setOids = new HashSet(); - ServerEntry attrs = new DefaultServerEntry( getRegistries(), LdapDN.EMPTY_LDAPDN ); + ServerEntry attrs = new DefaultServerEntry( getSchemaManager(), LdapDN.EMPTY_LDAPDN ); boolean returnAllOperationalAttributes = false; synchronized( lock ) @@ -506,7 +506,7 @@ } else { - setOids.add( getRegistries().getAttributeTypeRegistry().getOidByName( id ) ); + setOids.add( getSchemaManager().getAttributeTypeRegistry().getOidByName( id ) ); } } Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java Sat Nov 7 07:57:34 2009 @@ -20,6 +20,13 @@ package org.apache.directory.server.core.schema; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.naming.NamingException; + import org.apache.directory.server.core.entry.ServerAttribute; import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.shared.ldap.constants.SchemaConstants; @@ -32,20 +39,12 @@ import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.shared.ldap.schema.ObjectClass; import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum; -import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.schema.registries.ObjectClassRegistry; import org.apache.directory.shared.ldap.util.NamespaceTools; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.naming.NamingException; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.HashSet; - /** * Performs schema checks on behalf of the SchemaInterceptor. @@ -73,7 +72,7 @@ * @throws NamingException if modify operations leave the entry inconsistent * without a STRUCTURAL objectClass */ - public static void preventStructuralClassRemovalOnModifyReplace( ObjectClassRegistry registry, LdapDN name, ModificationOperation mod, + public static void preventStructuralClassRemovalOnModifyReplace( SchemaManager schemaManager, LdapDN name, ModificationOperation mod, ServerAttribute attribute ) throws NamingException { if ( mod != ModificationOperation.REPLACE_ATTRIBUTE ) @@ -103,7 +102,7 @@ // check that there is at least one structural objectClass in the replacement set for ( Value value:attribute ) { - ObjectClass ocType = registry.lookup( value.getString() ); + ObjectClass ocType = schemaManager.getObjectClassRegistry().lookup( value.getString() ); if ( ocType.getType() == ObjectClassTypeEnum.STRUCTURAL ) { @@ -198,7 +197,7 @@ * @throws NamingException if modify operations leave the entry inconsistent * without a STRUCTURAL objectClass */ - public static void preventStructuralClassRemovalOnModifyRemove( ObjectClassRegistry registry, LdapDN name, ModificationOperation mod, + public static void preventStructuralClassRemovalOnModifyRemove( SchemaManager schemaManager, LdapDN name, ModificationOperation mod, EntryAttribute attribute, EntryAttribute entryObjectClasses ) throws NamingException { if ( mod != ModificationOperation.REMOVE_ATTRIBUTE ) @@ -258,7 +257,7 @@ // check resultant set of objectClass values for a structural objectClass for ( Value objectClass:cloned ) { - ObjectClass oc = registry.lookup( objectClass.getString() ); + ObjectClass oc = schemaManager.getObjectClassRegistry().lookup( objectClass.getString() ); if ( oc.getType() == ObjectClassTypeEnum.STRUCTURAL ) { @@ -382,7 +381,7 @@ * @throws NamingException if the modify operation is removing an Rdn attribute */ public static void preventRdnChangeOnModifyReplace( LdapDN name, ModificationOperation mod, - ServerAttribute attribute, AttributeTypeRegistry atRegistry ) + ServerAttribute attribute, SchemaManager schemaManager ) throws NamingException { if ( mod != ModificationOperation.REPLACE_ATTRIBUTE ) @@ -391,7 +390,7 @@ } Set rdnAttributes = getRdnAttributes( name ); - String id = atRegistry.getOidByName( attribute.getUpId() ); + String id = schemaManager.getAttributeTypeRegistry().getOidByName( attribute.getUpId() ); if ( !rdnAttributes.contains( id ) ) { @@ -416,7 +415,8 @@ // from here on the modify operation replaces specific values // of the Rdn attribute so we must check to make sure all the old // rdn attribute values are present in the replacement set - String rdnValue = getRdnValue( id, name, atRegistry ); + String rdnValue = getRdnValue( id, name, schemaManager ); + for ( int ii = 0; ii < attribute.size(); ii++ ) { // if the old rdn value is not in the rdn attribute then @@ -458,7 +458,7 @@ */ public static void preventRdnChangeOnModifyReplace( LdapDN name, ModificationOperation mod, ServerEntry entry, - AttributeTypeRegistry atRegistry ) + SchemaManager schemaManager ) throws NamingException { if ( mod != ModificationOperation.REPLACE_ATTRIBUTE ) @@ -495,7 +495,7 @@ // from here on the modify operation replaces specific values // of the Rdn attribute so we must check to make sure all the old // rdn attribute values are present in the replacement set - String rdnValue = getRdnValue( id, name, atRegistry ); + String rdnValue = getRdnValue( id, name, schemaManager ); // if the old rdn value is not in the rdn attribute then // we must complain with a schema violation @@ -536,7 +536,7 @@ * @throws NamingException if the modify operation is removing an Rdn attribute */ public static void preventRdnChangeOnModifyRemove( LdapDN name, ModificationOperation mod, ServerAttribute attribute, - AttributeTypeRegistry atRegistry ) throws NamingException + SchemaManager schemaManager ) throws NamingException { if ( mod != ModificationOperation.REMOVE_ATTRIBUTE ) { @@ -546,7 +546,7 @@ Set rdnAttributes = getRdnAttributes( name ); String id = attribute.getId(); - if ( !rdnAttributes.contains( atRegistry.getOidByName( id ) ) ) + if ( !rdnAttributes.contains( schemaManager.getAttributeTypeRegistry().getOidByName( id ) ) ) { return; } @@ -570,7 +570,7 @@ // from here on the modify operation only deletes specific values // of the Rdn attribute so we must check if one of those values // are used by the Rdn attribute value pair for the name of the entry - String rdnValue = getRdnValue( id, name, atRegistry ); + String rdnValue = getRdnValue( id, name, schemaManager ); for ( Value value:attribute ) { @@ -611,7 +611,7 @@ * @throws NamingException if the modify operation is removing an Rdn attribute */ public static void preventRdnChangeOnModifyRemove( LdapDN name, ModificationOperation mod, - ServerEntry entry, AttributeTypeRegistry atRegistry ) + ServerEntry entry, SchemaManager schemaManager ) throws NamingException { if ( mod != ModificationOperation.REMOVE_ATTRIBUTE ) @@ -645,7 +645,7 @@ // from here on the modify operation only deletes specific values // of the Rdn attribute so we must check if one of those values // are used by the Rdn attribute value pair for the name of the entry - String rdnValue = getRdnValue( id, name, atRegistry ); + String rdnValue = getRdnValue( id, name, schemaManager ); EntryAttribute rdnAttr = entry.get( id ); for ( Value value:rdnAttr ) @@ -678,10 +678,10 @@ * attribute is not an rdn attribute * @throws NamingException if the name is malformed in any way */ - private static String getRdnValue( String id, LdapDN name, AttributeTypeRegistry atRegistry ) throws NamingException + private static String getRdnValue( String id, LdapDN name, SchemaManager schemaManager ) throws NamingException { // Transform the rdnAttrId to it's OID counterPart - String idOid = atRegistry.getOidByName( id ); + String idOid = schemaManager.getAttributeTypeRegistry().getOidByName( id ); if ( idOid == null ) { @@ -696,7 +696,7 @@ String rdnAttrId = NamespaceTools.getRdnAttribute( comps[ii] ); // Transform the rdnAttrId to it's OID counterPart - String rdnAttrOid = atRegistry.getOidByName( rdnAttrId ); + String rdnAttrOid = schemaManager.getAttributeTypeRegistry().getOidByName( rdnAttrId ); if ( rdnAttrOid == null ) { Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Sat Nov 7 07:57:34 2009 @@ -94,12 +94,10 @@ import org.apache.directory.shared.ldap.schema.AttributeTypeOptions; import org.apache.directory.shared.ldap.schema.ObjectClass; import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.schema.SyntaxChecker; import org.apache.directory.shared.ldap.schema.UsageEnum; -import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry; -import org.apache.directory.shared.ldap.schema.registries.ObjectClassRegistry; import org.apache.directory.shared.ldap.schema.registries.OidRegistry; -import org.apache.directory.shared.ldap.schema.registries.Registries; import org.apache.directory.shared.ldap.schema.registries.Schema; import org.apache.directory.shared.ldap.schema.registries.SchemaLoader; import org.apache.directory.shared.ldap.schema.syntaxCheckers.OctetStringSyntaxChecker; @@ -145,17 +143,11 @@ private List filters = new ArrayList(); - /** - * the global schema object registries - */ - private Registries registries; + /** the global schema object SchemaManager */ + private SchemaManager schemaManager; /** A global reference to the ObjectClass attributeType */ private AttributeType OBJECT_CLASS; - /** - * the global attributeType registry - */ - private AttributeTypeRegistry atRegistry; /** A normalized form for the SubschemaSubentry DN */ private String subschemaSubentryDnNorm; @@ -169,7 +161,7 @@ private LdapDN schemaModificationAttributesDN; /** The schema manager */ - private SchemaSubentryManager schemaManager; + private SchemaSubentryManager schemaSubEntryManager; private SchemaService schemaService; @@ -205,36 +197,35 @@ } nexus = directoryService.getPartitionNexus(); - registries = directoryService.getRegistries(); - atRegistry = registries.getAttributeTypeRegistry(); - OBJECT_CLASS = atRegistry.lookup( SchemaConstants.OBJECT_CLASS_AT ); + schemaManager = directoryService.getSchemaManager(); + OBJECT_CLASS = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASS_AT ); binaryAttributeFilter = new BinaryAttributeFilter(); topFilter = new TopFilter(); filters.add( binaryAttributeFilter ); filters.add( topFilter ); schemaBaseDN = new LdapDN( SchemaConstants.OU_SCHEMA ); - schemaBaseDN.normalize( atRegistry.getNormalizerMapping() ); + schemaBaseDN.normalize( schemaManager.getNormalizerMapping() ); schemaService = directoryService.getSchemaService(); // stuff for dealing with subentries (garbage for now) Value subschemaSubentry = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get(); subschemaSubentryDn = new LdapDN( subschemaSubentry.getString() ); - subschemaSubentryDn.normalize( atRegistry.getNormalizerMapping() ); + subschemaSubentryDn.normalize( schemaManager.getNormalizerMapping() ); subschemaSubentryDnNorm = subschemaSubentryDn.getNormName(); schemaModificationAttributesDN = new LdapDN( ServerDNConstants.SCHEMA_MODIFICATIONS_DN ); - schemaModificationAttributesDN.normalize( atRegistry.getNormalizerMapping() ); + schemaModificationAttributesDN.normalize( schemaManager.getNormalizerMapping() ); computeSuperiors(); // Initialize the schema manager SchemaLoader loader = schemaService.getSchemaPartition().getSchemaManager().getLoader(); SchemaPartitionDao dao = (SchemaPartitionDao)loader.getDao(); - schemaManager = new SchemaSubentryManager( registries, loader, dao ); + schemaSubEntryManager = new SchemaSubentryManager( schemaManager, loader, dao ); - MODIFIERS_NAME_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT ); - MODIFY_TIMESTAMP_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT ); + MODIFIERS_NAME_ATTRIBUTE_TYPE = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.MODIFIERS_NAME_AT ); + MODIFY_TIMESTAMP_ATTRIBUTE_TYPE = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.MODIFY_TIMESTAMP_AT ); if ( IS_DEBUG ) { @@ -396,7 +387,7 @@ */ private void computeSuperiors() throws Exception { - Iterator objectClasses = registries.getObjectClassRegistry().iterator(); + Iterator objectClasses = schemaManager.getObjectClassRegistry().iterator(); superiors = new ConcurrentHashMap>(); allMust = new ConcurrentHashMap>(); allMay = new ConcurrentHashMap>(); @@ -472,12 +463,12 @@ try { // Check that the attribute is declared - if ( registries.getAttributeTypeRegistry().contains( attribute ) ) + if ( schemaManager.getAttributeTypeRegistry().contains( attribute ) ) { - String oid = atRegistry.getOidByName( attribute ); + String oid = schemaManager.getAttributeTypeRegistry().getOidByName( attribute ); // The attribute must be an AttributeType - if ( atRegistry.contains( oid ) ) + if ( schemaManager.getAttributeTypeRegistry().contains( oid ) ) { if ( !filteredAttrs.containsKey( oid ) ) { @@ -532,7 +523,7 @@ private Value convert( String id, Object value ) throws Exception { - AttributeType at = atRegistry.lookup( id ); + AttributeType at = schemaManager.lookupAttributeTypeRegistry( id ); if ( at.getSyntax().isHumanReadable() ) { @@ -603,7 +594,7 @@ { SubstringNode node = ( ( SubstringNode ) filter ); - if ( !atRegistry.lookup( node.getAttribute() ).getSyntax().isHumanReadable() ) + if ( !schemaManager.lookupAttributeTypeRegistry( node.getAttribute() ).getSyntax().isHumanReadable() ) { String message = "A Substring filter should be used only on Human Readable attributes"; LOG.error( message ); @@ -643,7 +634,7 @@ { ExtensibleNode node = ( ( ExtensibleNode ) filter ); - if ( !atRegistry.lookup( node.getAttribute() ).getSyntax().isHumanReadable() ) + if ( !schemaManager.lookupAttributeTypeRegistry( node.getAttribute() ).getSyntax().isHumanReadable() ) { String message = "A Extensible filter should be used only on Human Readable attributes"; LOG.error( message ); @@ -740,16 +731,16 @@ String objectClassOid = null; - if ( registries.getObjectClassRegistry().contains( objectClass ) ) + if ( schemaManager.getObjectClassRegistry().contains( objectClass ) ) { - objectClassOid = registries.getObjectClassRegistry().lookup( objectClass ).getOid(); + objectClassOid = schemaManager.getObjectClassRegistry().lookup( objectClass ).getOid(); } else { return new BaseEntryFilteringCursor( new EmptyCursor(), opContext ); } - String nodeOid = atRegistry.getOidByName( node.getAttribute() ); + String nodeOid = schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ); // see if node attribute is objectClass if ( nodeOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) @@ -841,19 +832,18 @@ */ private boolean isRequired( String attrId, EntryAttribute objectClasses ) throws Exception { - OidRegistry oidRegistry = registries.getOidRegistry(); - ObjectClassRegistry registry = registries.getObjectClassRegistry(); + OidRegistry oidRegistry = schemaManager.getOidRegistry(); if ( !oidRegistry.hasOid( attrId ) ) { return false; } - String attrOid = registries.getAttributeTypeRegistry().getOidByName( attrId ); + String attrOid = schemaManager.getAttributeTypeRegistry().getOidByName( attrId ); for ( Value objectClass : objectClasses ) { - ObjectClass ocSpec = registry.lookup( objectClass.getString() ); + ObjectClass ocSpec = schemaManager.getObjectClassRegistry().lookup( objectClass.getString() ); for ( AttributeType must : ocSpec.getMustAttributeTypes() ) { @@ -961,7 +951,6 @@ private boolean getObjectClasses( EntryAttribute objectClasses, List result ) throws Exception { Set ocSeen = new HashSet(); - ObjectClassRegistry registry = registries.getObjectClassRegistry(); // We must select all the ObjectClasses, except 'top', // but including all the inherited ObjectClasses @@ -981,7 +970,7 @@ hasExtensibleObject = true; } - ObjectClass oc = registry.lookup( objectClassName ); + ObjectClass oc = schemaManager.getObjectClassRegistry().lookup( objectClassName ); // Add all unseen objectClasses to the list, except 'top' if ( !ocSeen.contains( oc.getOid() ) ) @@ -1006,7 +995,7 @@ for ( Value value : objectClasses ) { String ocName = value.getString(); - ObjectClass oc = registries.getObjectClassRegistry().lookup( ocName ); + ObjectClass oc = schemaManager.getObjectClassRegistry().lookup( ocName ); List types = oc.getMustAttributeTypes(); @@ -1029,13 +1018,13 @@ Set allowed = new HashSet( must ); // Add the 'ObjectClass' attribute ID - allowed.add( registries.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) ); + allowed.add( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) ); // Loop on all objectclasses for ( Value objectClass : objectClasses ) { String ocName = objectClass.getString(); - ObjectClass oc = registries.getObjectClassRegistry().lookup( ocName ); + ObjectClass oc = schemaManager.getObjectClassRegistry().lookup( ocName ); List types = oc.getMayAttributeTypes(); @@ -1082,7 +1071,7 @@ { String ocLowerName = ocName.toLowerCase(); - ObjectClass objectClass = registries.getObjectClassRegistry().lookup( ocLowerName ); + ObjectClass objectClass = schemaManager.getObjectClassRegistry().lookup( ocLowerName ); if ( !objectClasses.contains( ocLowerName ) ) { @@ -1139,13 +1128,13 @@ // are still present in the entry. for ( AttributeTypeAndValue atav : oldRDN ) { - AttributeType type = atRegistry.lookup( atav.getUpType() ); + AttributeType type = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() ); tmpEntry.remove( type, atav.getUpValue() ); } for ( AttributeTypeAndValue atav : newRdn ) { - AttributeType type = atRegistry.lookup( atav.getUpType() ); + AttributeType type = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() ); if ( !tmpEntry.contains( type, atav.getNormValue() ) ) { @@ -1161,7 +1150,7 @@ // Check that no operational attributes are removed for ( AttributeTypeAndValue atav : oldRDN ) { - AttributeType attributeType = atRegistry.lookup( atav.getUpType() ); + AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() ); if ( !attributeType.isUserModifiable() ) { @@ -1416,7 +1405,7 @@ opContext.setModItems( cleanMods ); // Now that the entry has been modified, update the SSSE - schemaManager.modifySchemaSubentry( opContext, opContext.hasRequestControl( CascadeControl.CONTROL_OID ) ); + schemaSubEntryManager.modifySchemaSubentry( opContext, opContext.hasRequestControl( CascadeControl.CONTROL_OID ) ); return; } @@ -1563,7 +1552,7 @@ for ( AttributeType attributeType : entry.getAttributeTypes() ) { - if ( !atRegistry.contains( attributeType.getName() ) ) + if ( !schemaManager.getAttributeTypeRegistry().contains( attributeType.getName() ) ) { throw new LdapInvalidAttributeIdentifierException( attributeType.getName() + " not found in attribute registry!" ); @@ -1619,8 +1608,6 @@ private void checkOcSuperior( ServerEntry entry ) throws Exception { - ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry(); - // handle the m-supObjectClass meta attribute EntryAttribute supOC = entry.get( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT ); @@ -1642,7 +1629,7 @@ { String supName = sup.getString(); - ObjectClass superior = ocRegistry.lookup( supName ); + ObjectClass superior = schemaManager.getObjectClassRegistry().lookup( supName ); switch ( ocType ) { @@ -1702,7 +1689,7 @@ { next.add( addContext ); - if ( registries.isSchemaLoaded( schemaName ) ) + if ( schemaManager.isSchemaLoaded( schemaName ) ) { // Update the OC superiors for each added ObjectClass computeSuperiors(); @@ -1716,12 +1703,12 @@ next.add( addContext ); // Update the structures now that the schema element has been added - Schema schema = registries.getLoadedSchema( schemaName ); + Schema schema = schemaManager.getLoadedSchema( schemaName ); if ( ( schema != null ) && schema.isEnabled() ) { String ocName = entry.get( MetaSchemaConstants.M_NAME_AT ).getString(); - ObjectClass addedOC = registries.getObjectClassRegistry().lookup( ocName ); + ObjectClass addedOC = schemaManager.getObjectClassRegistry().lookup( ocName ); computeSuperior( addedOC ); } } Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java Sat Nov 7 07:57:34 2009 @@ -45,11 +45,10 @@ import org.apache.directory.shared.ldap.schema.MatchingRuleUse; import org.apache.directory.shared.ldap.schema.NameForm; import org.apache.directory.shared.ldap.schema.ObjectClass; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription; import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription; import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription; -import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry; -import org.apache.directory.shared.ldap.schema.registries.Registries; import org.apache.directory.shared.ldap.schema.registries.SchemaLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,8 +79,8 @@ private static final Set VALID_OU_VALUES = new HashSet(); - /** The registries */ - private final Registries registries; + /** The schemaManager */ + private final SchemaManager schemaManager; private final SchemaSubentryModifier subentryModifier; @@ -112,46 +111,44 @@ } - public SchemaSubentryManager( Registries registries, SchemaLoader loader, SchemaPartitionDao dao ) + public SchemaSubentryManager( SchemaManager schemaManager, SchemaLoader loader, SchemaPartitionDao dao ) throws Exception { - this.registries = registries; - this.subentryModifier = new SchemaSubentryModifier( registries, dao ); - this.parsers = new DescriptionParsers( registries, dao ); + this.schemaManager = schemaManager; + this.subentryModifier = new SchemaSubentryModifier( schemaManager, dao ); + this.parsers = new DescriptionParsers( schemaManager, dao ); - AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry(); - - String comparatorsOid = atRegistry.getOidByName( SchemaConstants.COMPARATORS_AT ); + String comparatorsOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.COMPARATORS_AT ); opAttr2handlerIndex.put( comparatorsOid, COMPARATOR_INDEX ); - String normalizersOid = atRegistry.getOidByName( SchemaConstants.NORMALIZERS_AT ); + String normalizersOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.NORMALIZERS_AT ); opAttr2handlerIndex.put( normalizersOid, NORMALIZER_INDEX ); - String syntaxCheckersOid = atRegistry.getOidByName( SchemaConstants.SYNTAX_CHECKERS_AT ); + String syntaxCheckersOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.SYNTAX_CHECKERS_AT ); opAttr2handlerIndex.put( syntaxCheckersOid, SYNTAX_CHECKER_INDEX ); - String ldapSyntaxesOid = atRegistry.getOidByName( SchemaConstants.LDAP_SYNTAXES_AT ); + String ldapSyntaxesOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.LDAP_SYNTAXES_AT ); opAttr2handlerIndex.put( ldapSyntaxesOid, SYNTAX_INDEX ); - String matchingRulesOid = atRegistry.getOidByName( SchemaConstants.MATCHING_RULES_AT ); + String matchingRulesOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.MATCHING_RULES_AT ); opAttr2handlerIndex.put( matchingRulesOid, MATCHING_RULE_INDEX ); - String attributeTypesOid = atRegistry.getOidByName( SchemaConstants.ATTRIBUTE_TYPES_AT ); + String attributeTypesOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.ATTRIBUTE_TYPES_AT ); opAttr2handlerIndex.put( attributeTypesOid, ATTRIBUTE_TYPE_INDEX ); - String objectClassesOid = atRegistry.getOidByName( SchemaConstants.OBJECT_CLASSES_AT ); + String objectClassesOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASSES_AT ); opAttr2handlerIndex.put( objectClassesOid, OBJECT_CLASS_INDEX ); - String matchingRuleUseOid = atRegistry.getOidByName( SchemaConstants.MATCHING_RULE_USE_AT ); + String matchingRuleUseOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.MATCHING_RULE_USE_AT ); opAttr2handlerIndex.put( matchingRuleUseOid, MATCHING_RULE_USE_INDEX ); - String ditStructureRulesOid = atRegistry.getOidByName( SchemaConstants.DIT_STRUCTURE_RULES_AT ); + String ditStructureRulesOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.DIT_STRUCTURE_RULES_AT ); opAttr2handlerIndex.put( ditStructureRulesOid, DIT_STRUCTURE_RULE_INDEX ); - String ditContentRulesOid = atRegistry.getOidByName( SchemaConstants.DIT_CONTENT_RULES_AT ); + String ditContentRulesOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.DIT_CONTENT_RULES_AT ); opAttr2handlerIndex.put( ditContentRulesOid, DIT_CONTENT_RULE_INDEX ); - String nameFormsOid = atRegistry.getOidByName( SchemaConstants.NAME_FORMS_AT ); + String nameFormsOid = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.NAME_FORMS_AT ); opAttr2handlerIndex.put( nameFormsOid, NAME_FORM_INDEX ); } @@ -163,7 +160,7 @@ { for ( Modification mod : opContext.getModItems() ) { - String opAttrOid = registries.getAttributeTypeRegistry().getOidByName( mod.getAttribute().getId() ); + String opAttrOid = schemaManager.getAttributeTypeRegistry().getOidByName( mod.getAttribute().getId() ); ServerAttribute serverAttribute = (ServerAttribute)mod.getAttribute(); Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Sat Nov 7 07:57:34 2009 @@ -47,11 +47,11 @@ import org.apache.directory.shared.ldap.schema.MatchingRuleUse; import org.apache.directory.shared.ldap.schema.NameForm; import org.apache.directory.shared.ldap.schema.ObjectClass; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.schema.SchemaObject; import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription; import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription; import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription; -import org.apache.directory.shared.ldap.schema.registries.Registries; import org.apache.directory.shared.ldap.schema.registries.Schema; import org.apache.directory.shared.ldap.util.Base64; @@ -81,20 +81,20 @@ private AttributesFactory factory = new AttributesFactory(); private final SchemaPartitionDao dao; - /** The server registries */ - private Registries registries; + /** The server schemaManager */ + private SchemaManager schemaManager; /** * * Creates a new instance of SchemaSubentryModifier. * - * @param registries The server registries + * @param schemaManager The server schemaManager * @param dao */ - public SchemaSubentryModifier( Registries registries, SchemaPartitionDao dao ) + public SchemaSubentryModifier( SchemaManager schemaManager, SchemaPartitionDao dao ) { - this.registries = registries; + this.schemaManager = schemaManager; this.dao = dao; } @@ -190,7 +190,7 @@ { Schema schema = dao.getSchema( obj.getSchemaName() ); LdapDN dn = getDn( obj ); - ServerEntry entry = factory.getAttributes( obj, schema, registries ); + ServerEntry entry = factory.getAttributes( obj, schema, schemaManager ); entry.setDn( dn ); opContext.add( entry, BYPASS ); @@ -244,7 +244,7 @@ private Entry getEntry( LdapDN dn, LdapComparatorDescription comparatorDescription ) { - Entry entry = new DefaultServerEntry( registries, dn ); + Entry entry = new DefaultServerEntry( schemaManager, dn ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, @@ -271,7 +271,7 @@ private Entry getEntry( LdapDN dn, NormalizerDescription normalizerDescription ) { - Entry entry = new DefaultServerEntry( registries, dn ); + Entry entry = new DefaultServerEntry( schemaManager, dn ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, @@ -309,7 +309,7 @@ private Entry getEntry( LdapDN dn, SyntaxCheckerDescription syntaxCheckerDescription ) { - Entry entry = new DefaultServerEntry( registries, dn ); + Entry entry = new DefaultServerEntry( schemaManager, dn ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java?rev=833647&r1=833646&r2=833647&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java (original) +++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java Sat Nov 7 07:57:34 2009 @@ -31,17 +31,16 @@ import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.core.filtering.EntryFilteringCursor; import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext; +import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.entry.client.ClientStringValue; -import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.filter.AndNode; import org.apache.directory.shared.ldap.filter.BranchNode; import org.apache.directory.shared.ldap.filter.EqualityNode; import org.apache.directory.shared.ldap.filter.SearchScope; import org.apache.directory.shared.ldap.message.AliasDerefMode; import org.apache.directory.shared.ldap.name.LdapDN; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,7 +73,7 @@ super( LdapClassLoader.class.getClassLoader() ); this.directoryService = directoryService; defaultSearchDn = new LdapDN( defaultSearchContextsConfig ); - defaultSearchDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() ); + defaultSearchDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() ); } @@ -161,7 +160,7 @@ for ( Value val : attr ) { LdapDN dn = new LdapDN( val.getString() ); - dn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() ); + dn.normalize( directoryService.getSchemaManager().getNormalizerMapping() ); searchContexts.add( dn ); } @@ -190,7 +189,7 @@ for ( String suffix:suffixes ) { LdapDN dn = new LdapDN( suffix ); - dn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() ); + dn.normalize( directoryService.getSchemaManager().getNormalizerMapping() ); namingContexts.add( dn ); }