Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 66908 invoked from network); 20 Jan 2008 17:01:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Jan 2008 17:01:20 -0000 Received: (qmail 70548 invoked by uid 500); 20 Jan 2008 17:01:10 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 70452 invoked by uid 500); 20 Jan 2008 17:01:10 -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 70429 invoked by uid 99); 20 Jan 2008 17:01:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Jan 2008 09:01:10 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Jan 2008 17:00:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9E3611A9858; Sun, 20 Jan 2008 09:00:27 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r613608 [7/15] - in /directory/sandbox/akarasulu/bigbang/apacheds: ./ bootstrap-plugin/ bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ core-entry/ core-entry/src/main/java/org/apache/directory/server/core/... Date: Sun, 20 Jan 2008 16:59:36 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080120170027.9E3611A9858@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java Sun Jan 20 08:59:10 2008 @@ -19,6 +19,7 @@ */ package org.apache.directory.server.core.interceptor.context; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.name.LdapDN; /** @@ -28,14 +29,14 @@ * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class ListSuffixOperationContext extends AbstractOperationContext +public class ListSuffixOperationContext extends AbstractOperationContext { /** * Creates a new instance of ListSuffixOperationContext. */ - public ListSuffixOperationContext() + public ListSuffixOperationContext( Registries registries ) { - super(); + super( registries ); } /** @@ -43,9 +44,9 @@ * * @param dn The DN to get the suffix from */ - public ListSuffixOperationContext( LdapDN dn ) + public ListSuffixOperationContext( Registries registries, LdapDN dn ) { - super( dn ); + super( registries, dn ); } /** Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java Sun Jan 20 08:59:10 2008 @@ -23,6 +23,7 @@ import java.util.Arrays; import java.util.List; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.util.StringTools; @@ -33,7 +34,7 @@ * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class LookupOperationContext extends AbstractOperationContext +public class LookupOperationContext extends AbstractOperationContext { /** The list of attributes id to return */ private List attrsId; @@ -46,9 +47,9 @@ * Creates a new instance of LookupOperationContext. * */ - public LookupOperationContext() + public LookupOperationContext( Registries registries ) { - super(); + super( registries ); } /** @@ -56,9 +57,9 @@ * Creates a new instance of LookupOperationContext. * */ - public LookupOperationContext( LdapDN dn ) + public LookupOperationContext( Registries registries, LdapDN dn ) { - super( dn ); + super( registries, dn ); } /** @@ -66,9 +67,9 @@ * Creates a new instance of LookupOperationContext. * */ - public LookupOperationContext( String attrsId[] ) + public LookupOperationContext( Registries registries, String attrsId[] ) { - super(); + super( registries ); this.attrsId = new ArrayList(); attrsOid = new ArrayList(); setAttrsId( attrsId ); @@ -79,9 +80,9 @@ * Creates a new instance of LookupOperationContext. * */ - public LookupOperationContext( LdapDN dn, String attrsId[] ) + public LookupOperationContext( Registries registries, LdapDN dn, String attrsId[] ) { - super( dn ); + super( registries, dn ); this.attrsId = new ArrayList(); attrsOid = new ArrayList(); setAttrsId( attrsId ); Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Sun Jan 20 08:59:10 2008 @@ -28,6 +28,7 @@ import javax.naming.directory.Attributes; import javax.naming.directory.ModificationItem; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.message.ModificationItemImpl; import org.apache.directory.shared.ldap.name.LdapDN; @@ -51,9 +52,9 @@ * Creates a new instance of ModifyOperationContext. * */ - public ModifyOperationContext() + public ModifyOperationContext( Registries registries ) { - super(); + super( registries ); } @@ -63,9 +64,9 @@ * @param dn the dn of the entry to be modified * @param modItems the modifications to be performed on the entry */ - public ModifyOperationContext( LdapDN dn, List modItems ) + public ModifyOperationContext( Registries registries, LdapDN dn, List modItems ) { - super( dn ); + super( registries, dn ); this.modItems = modItems; } @@ -77,9 +78,9 @@ * @param modItems the modifications to be performed on the entry * @param collateralOperation true if op is collateral, false otherwise */ - public ModifyOperationContext( LdapDN dn, List modItems, boolean collateralOperation ) + public ModifyOperationContext( Registries registries, LdapDN dn, List modItems, boolean collateralOperation ) { - super( dn, collateralOperation ); + super( registries, dn, collateralOperation ); this.modItems = modItems; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java Sun Jan 20 08:59:10 2008 @@ -20,6 +20,7 @@ package org.apache.directory.server.core.interceptor.context; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.name.Rdn; @@ -40,9 +41,9 @@ /** * Creates a new instance of MoveAndRenameOperationContext. */ - public MoveAndRenameOperationContext() + public MoveAndRenameOperationContext( Registries registries ) { - super(); + super( registries ); } @@ -54,9 +55,9 @@ * @param newRdn the new rdn to use for the target once renamed * @param delOldRdn true if the old rdn value is deleted, false otherwise */ - public MoveAndRenameOperationContext( LdapDN oldDn, LdapDN parent, Rdn newRdn, boolean delOldRdn ) + public MoveAndRenameOperationContext( Registries registries, LdapDN oldDn, LdapDN parent, Rdn newRdn, boolean delOldRdn ) { - super( oldDn, newRdn, delOldRdn ); + super( registries, oldDn, newRdn, delOldRdn ); this.parent = parent; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java Sun Jan 20 08:59:10 2008 @@ -19,6 +19,7 @@ */ package org.apache.directory.server.core.interceptor.context; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.name.LdapDN; /** @@ -38,9 +39,9 @@ * Creates a new instance of MoveOperationContext. * */ - public MoveOperationContext() + public MoveOperationContext( Registries registries ) { - super(); + super( registries ); } /** @@ -48,9 +49,9 @@ * Creates a new instance of MoveOperationContext. * */ - public MoveOperationContext( LdapDN oldDn, LdapDN parent ) + public MoveOperationContext( Registries registries, LdapDN oldDn, LdapDN parent ) { - super( oldDn ); + super( registries, oldDn ); this.parent = parent; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java Sun Jan 20 08:59:10 2008 @@ -22,6 +22,7 @@ import javax.naming.ldap.Control; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.name.LdapDN; @@ -57,6 +58,11 @@ */ LdapDN getDn(); + + /** + * @return The global registries + */ + Registries getRegistries(); /** * Set the context DN Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java Sun Jan 20 08:59:10 2008 @@ -19,6 +19,7 @@ */ package org.apache.directory.server.core.interceptor.context; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.name.LdapDN; /** @@ -28,13 +29,14 @@ * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class RemoveContextPartitionOperationContext extends AbstractOperationContext +public class RemoveContextPartitionOperationContext extends AbstractOperationContext { /** * Creates a new instance of RemoveContextPartitionOperationContext. */ - public RemoveContextPartitionOperationContext() + public RemoveContextPartitionOperationContext( Registries registries ) { + super( registries ); } /** @@ -42,9 +44,9 @@ * * @param entryDn The Entry DN from which the partition should be removed */ - public RemoveContextPartitionOperationContext( LdapDN dn ) + public RemoveContextPartitionOperationContext( Registries registries, LdapDN dn ) { - super( dn ); + super( registries, dn ); } /** Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java Sun Jan 20 08:59:10 2008 @@ -20,6 +20,7 @@ package org.apache.directory.server.core.interceptor.context; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.name.Rdn; @@ -45,9 +46,9 @@ /** * Creates a new instance of RenameOperationContext. */ - public RenameOperationContext() + public RenameOperationContext( Registries registries ) { - super(); + super( registries ); } @@ -58,9 +59,9 @@ * @param newRdn the new RDN to use for the target * @param delOldDn true if we delete the old RDN value */ - public RenameOperationContext( LdapDN oldDn, Rdn newRdn, boolean delOldDn ) + public RenameOperationContext( Registries registries, LdapDN oldDn, Rdn newRdn, boolean delOldDn ) { - super( oldDn ); + super( registries, oldDn ); this.newRdn = newRdn; this.delOldDn = delOldDn; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ReplaceOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ReplaceOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ReplaceOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ReplaceOperationContext.java Sun Jan 20 08:59:10 2008 @@ -19,6 +19,7 @@ */ package org.apache.directory.server.core.interceptor.context; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.name.LdapDN; /** @@ -38,9 +39,9 @@ * Creates a new instance of ReplaceOperationContext. * */ - public ReplaceOperationContext() + public ReplaceOperationContext( Registries registries ) { - super(); + super( registries ); } /** @@ -48,9 +49,9 @@ * Creates a new instance of ReplaceOperationContext. * */ - public ReplaceOperationContext( LdapDN oldDn, LdapDN parent ) + public ReplaceOperationContext( Registries registries, LdapDN oldDn, LdapDN parent ) { - super( oldDn ); + super( registries, oldDn ); this.parent = parent; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java Sun Jan 20 08:59:10 2008 @@ -20,6 +20,7 @@ package org.apache.directory.server.core.interceptor.context; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.filter.ExprNode; import org.apache.directory.shared.ldap.message.AliasDerefMode; import org.apache.directory.shared.ldap.name.LdapDN; @@ -42,15 +43,16 @@ /** The controls */ private SearchControls searchControls; + /** The mode of alias handling */ private AliasDerefMode aliasDerefMode; /** * Creates a new instance of SearchOperationContext. */ - public SearchOperationContext() + public SearchOperationContext( Registries registries ) { - super(); + super( registries ); } @@ -61,34 +63,50 @@ * @param filter the filter AST to use for the search * @param searchControls the search controls */ - public SearchOperationContext( LdapDN dn, AliasDerefMode aliasDerefMode, ExprNode filter, + public SearchOperationContext( Registries registries, LdapDN dn, AliasDerefMode aliasDerefMode, ExprNode filter, SearchControls searchControls ) { - super( dn ); + super( registries, dn ); this.filter = filter; this.aliasDerefMode = aliasDerefMode; this.searchControls = searchControls; } + /** + * @return The filter + */ public ExprNode getFilter() { return filter; } + /** + * Set the filter into the context. + * + * @param filter The filter to set + */ public void setFilter( ExprNode filter ) { this.filter = filter; } + /** + * @return The search controls + */ public SearchControls getSearchControls() { return searchControls; } + /** + * Set the search controls + * + * @param searchControls The search controls + */ public void setSearchControls( SearchControls searchControls ) { this.searchControls = searchControls; @@ -105,12 +123,19 @@ } + /** + * @return The alias handling mode + */ public AliasDerefMode getAliasDerefMode() { return aliasDerefMode; } + /** + * Set the alias handling mode + * @param aliasDerefMode The alias handling mode + */ public void setAliasDerefMode( AliasDerefMode aliasDerefMode ) { this.aliasDerefMode = aliasDerefMode; Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java Sun Jan 20 08:59:10 2008 @@ -19,6 +19,7 @@ */ package org.apache.directory.server.core.interceptor.context; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.name.LdapDN; /** @@ -28,14 +29,14 @@ * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class UnbindOperationContext extends AbstractOperationContext +public class UnbindOperationContext extends AbstractOperationContext { /** * Creates a new instance of UnbindOperationContext. */ - public UnbindOperationContext() + public UnbindOperationContext( Registries registries ) { - super(); + super( registries ); } /** @@ -43,9 +44,9 @@ * * @param unbindDn The principal DN to unbind */ - public UnbindOperationContext( LdapDN unbindDn ) + public UnbindOperationContext( Registries registries, LdapDN unbindDn ) { - super( unbindDn ); + super( registries, unbindDn ); } /** Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Sun Jan 20 08:59:10 2008 @@ -23,6 +23,8 @@ import org.apache.directory.server.core.DirectoryService; import org.apache.directory.server.core.authn.AuthenticationInterceptor; import org.apache.directory.server.core.authn.LdapPrincipal; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerEntryUtils; import org.apache.directory.server.core.interceptor.context.AddOperationContext; import org.apache.directory.server.core.interceptor.context.BindOperationContext; import org.apache.directory.server.core.interceptor.context.DeleteOperationContext; @@ -37,6 +39,7 @@ import org.apache.directory.server.core.interceptor.context.SearchOperationContext; import org.apache.directory.server.core.partition.PartitionNexus; import org.apache.directory.server.core.partition.PartitionNexusProxy; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.JndiPropertyConstants; import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.exception.LdapNoPermissionException; @@ -98,6 +101,9 @@ /** The directory service which owns this context **/ private final DirectoryService service; + /** The global registries **/ + protected final Registries registries; + /** The interceptor proxy to the backend nexus */ private final PartitionNexus nexusProxy; @@ -157,7 +163,9 @@ doBindOperation( props.getBindDn(), props.getCredentials(), props.getAuthenticationMechanisms(), props.getSaslAuthId() ); - if ( ! nexusProxy.hasEntry( new EntryOperationContext( dn ) ) ) + registries = service.getRegistries(); + + if ( ! nexusProxy.hasEntry( new EntryOperationContext( registries, dn ) ) ) { throw new NameNotFoundException( dn + " does not exist" ); } @@ -184,6 +192,7 @@ this.env.put( DirectoryService.JNDI_KEY, service ); this.nexusProxy = new PartitionNexusProxy( this, service ); this.principal = principal; + registries = service.getRegistries(); } @@ -203,10 +212,14 @@ * @param attributes * @param target */ - protected void doAddOperation( LdapDN target, Attributes attributes ) throws NamingException + protected void doAddOperation( LdapDN target, ServerEntry entry ) throws NamingException { // setup the op context and populate with request controls - AddOperationContext opCtx = new AddOperationContext( target, attributes ); + AddOperationContext opCtx = new AddOperationContext( + service.getRegistries(), + target, + entry ); + opCtx.addRequestControls( requestControls ); // execute add operation @@ -225,7 +238,7 @@ protected void doDeleteOperation( LdapDN target ) throws NamingException { // setup the op context and populate with request controls - DeleteOperationContext opCtx = new DeleteOperationContext( target ); + DeleteOperationContext opCtx = new DeleteOperationContext( registries, target ); opCtx.addRequestControls( requestControls ); // execute delete operation @@ -250,7 +263,7 @@ throws NamingException { // setup the op context and populate with request controls - SearchOperationContext opCtx = new SearchOperationContext( dn, aliasDerefMode, filter, searchControls ); + SearchOperationContext opCtx = new SearchOperationContext( registries, dn, aliasDerefMode, filter, searchControls ); opCtx.addRequestControls( requestControls ); // execute search operation @@ -270,7 +283,7 @@ protected NamingEnumeration doListOperation( LdapDN target ) throws NamingException { // setup the op context and populate with request controls - ListOperationContext opCtx = new ListOperationContext( target ); + ListOperationContext opCtx = new ListOperationContext( registries, target ); opCtx.addRequestControls( requestControls ); // execute list operation @@ -284,9 +297,9 @@ } - protected Attributes doGetRootDSEOperation( LdapDN target ) throws NamingException + protected ServerEntry doGetRootDSEOperation( LdapDN target ) throws NamingException { - GetRootDSEOperationContext opCtx = new GetRootDSEOperationContext( target ); + GetRootDSEOperationContext opCtx = new GetRootDSEOperationContext( registries, target ); opCtx.addRequestControls( requestControls ); // do not reset request controls since this is not an external @@ -304,7 +317,7 @@ LookupOperationContext opCtx; // execute lookup/getRootDSE operation - opCtx = new LookupOperationContext( target ); + opCtx = new LookupOperationContext( registries, target ); opCtx.addRequestControls( requestControls ); Attributes attributes = nexusProxy.lookup( opCtx ); @@ -324,7 +337,7 @@ LookupOperationContext opCtx; // execute lookup/getRootDSE operation - opCtx = new LookupOperationContext( target, attrIds ); + opCtx = new LookupOperationContext( registries, target, attrIds ); opCtx.addRequestControls( requestControls ); Attributes attributes = nexusProxy.lookup( opCtx ); @@ -343,7 +356,7 @@ throws NamingException { // setup the op context and populate with request controls - BindOperationContext opCtx = new BindOperationContext(); + BindOperationContext opCtx = new BindOperationContext( registries ); opCtx.setDn( bindDn ); opCtx.setCredentials( credentials ); opCtx.setMechanisms( mechanisms ); @@ -367,7 +380,7 @@ { // setup the op context and populate with request controls MoveAndRenameOperationContext opCtx = - new MoveAndRenameOperationContext( oldDn, parent, new Rdn( newRdn ), delOldDn ); + new MoveAndRenameOperationContext( registries, oldDn, parent, new Rdn( newRdn ), delOldDn ); opCtx.addRequestControls( requestControls ); // execute moveAndRename operation @@ -385,7 +398,7 @@ protected void doModifyOperation( LdapDN dn, List modItems ) throws NamingException { // setup the op context and populate with request controls - ModifyOperationContext opCtx = new ModifyOperationContext( dn, modItems ); + ModifyOperationContext opCtx = new ModifyOperationContext( registries, dn, modItems ); opCtx.addRequestControls( requestControls ); // execute modify operation @@ -403,7 +416,7 @@ protected void doMove( LdapDN oldDn, LdapDN target ) throws NamingException { // setup the op context and populate with request controls - MoveOperationContext opCtx = new MoveOperationContext( oldDn, target ); + MoveOperationContext opCtx = new MoveOperationContext( registries, oldDn, target ); opCtx.addRequestControls( requestControls ); // execute move operation @@ -421,7 +434,7 @@ protected void doRename( LdapDN oldDn, String newRdn, boolean delOldRdn ) throws NamingException { // setup the op context and populate with request controls - RenameOperationContext opCtx = new RenameOperationContext( oldDn, new Rdn( newRdn ), delOldRdn ); + RenameOperationContext opCtx = new RenameOperationContext( registries, oldDn, new Rdn( newRdn ), delOldRdn ); opCtx.addRequestControls( requestControls ); // execute rename operation @@ -616,7 +629,7 @@ * we need to copy over the controls as well to propagate the complete * environment besides whats in the hashtable for env. */ - doAddOperation( target, attributes ); + doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) ); return new ServerLdapContext( service, principal, target ); } @@ -688,7 +701,7 @@ if ( outAttrs != null ) { LdapDN target = buildTarget( name ); - doAddOperation( target, outAttrs ); + doAddOperation( target, ServerEntryUtils.toServerEntry( outAttrs, target, registries ) ); return; } @@ -697,7 +710,7 @@ Attributes attributes = (Attributes)obj; LdapDN target = buildTarget( name ); - doAddOperation( target, attributes ); + doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) ); } // Check for Referenceable else if ( obj instanceof Referenceable ) @@ -731,7 +744,7 @@ // Serialize object into entry attributes and add it. JavaLdapSupport.serialize( attributes, obj ); - doAddOperation( target, attributes ); + doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) ); } else if ( obj instanceof DirContext ) { @@ -749,7 +762,7 @@ LdapDN target = buildTarget( name ); injectRdnAttributeValues( target, attributes ); - doAddOperation( target, attributes ); + doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) ); } else { @@ -847,7 +860,7 @@ { LdapDN target = buildTarget( name ); - if ( nexusProxy.hasEntry( new EntryOperationContext( target ) ) ) + if ( nexusProxy.hasEntry( new EntryOperationContext( registries, target ) ) ) { doDeleteOperation( target ); } @@ -902,7 +915,7 @@ if ( name.size() == 0 ) { - attributes = doGetRootDSEOperation( target ); + attributes = ServerEntryUtils.toAttributesImpl( doGetRootDSEOperation( target ) ); } else { Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Sun Jan 20 08:59:10 2008 @@ -22,6 +22,7 @@ import org.apache.directory.server.core.DirectoryService; import org.apache.directory.server.core.authn.LdapPrincipal; +import org.apache.directory.server.core.entry.ServerEntryUtils; import org.apache.directory.server.core.interceptor.context.EntryOperationContext; import org.apache.directory.server.core.partition.PartitionNexusProxy; import org.apache.directory.shared.ldap.constants.SchemaConstants; @@ -273,7 +274,7 @@ { Attributes clone = ( Attributes ) attrs.clone(); LdapDN target = buildTarget( name ); - doAddOperation( target, clone ); + doAddOperation( target, ServerEntryUtils.toServerEntry( clone, target, registries ) ); return; } @@ -293,7 +294,8 @@ attributes.put( ( Attribute ) list.next() ); } } - doAddOperation( target, attributes ); + + doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) ); return; } @@ -326,7 +328,7 @@ // Serialize object into entry attributes and add it. JavaLdapSupport.serialize( attributes, obj ); - doAddOperation( target, attributes ); + doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) ); } else if ( obj instanceof DirContext ) { @@ -343,7 +345,7 @@ } LdapDN target = buildTarget( name ); - doAddOperation( target, attributes ); + doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) ); } else { @@ -370,7 +372,7 @@ { LdapDN target = buildTarget( name ); - if ( getNexusProxy().hasEntry( new EntryOperationContext( target ) ) ) + if ( getNexusProxy().hasEntry( new EntryOperationContext( registries, target ) ) ) { doDeleteOperation( target ); } @@ -444,7 +446,7 @@ } // Add the new context to the server which as a side effect adds - doAddOperation( target, attributes ); + doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) ); // Initialize the new context return new ServerLdapContext( getService(), getPrincipal(), target ); Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Sun Jan 20 08:59:10 2008 @@ -168,7 +168,7 @@ public boolean compare( LdapDN name, String oid, Object value ) throws NamingException { // make sure we add the request controls to operation - CompareOperationContext opCtx = new CompareOperationContext( name, oid, value ); + CompareOperationContext opCtx = new CompareOperationContext( registries, name, oid, value ); opCtx.addRequestControls( requestControls ); // execute operation @@ -204,7 +204,7 @@ principalDn = new LdapDN( bindDn ); } - UnbindOperationContext opCtx = new UnbindOperationContext( principalDn ); + UnbindOperationContext opCtx = new UnbindOperationContext( registries, principalDn ); opCtx.addRequestControls( requestControls ); super.getNexusProxy().unbind( opCtx ); responseControls = opCtx.getResponseControls(); Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java Sun Jan 20 08:59:10 2008 @@ -106,12 +106,12 @@ children.set( childNumber++, orNode ); // iterate through descendants adding them to the orNode - Iterator descendants = attrRegistry.descendants( leaf.getAttribute() ); + Iterator descendants = attrRegistry.descendants( leaf.getAttribute() ); while ( descendants.hasNext() ) { LeafNode newLeaf = null; - AttributeType descendant = ( AttributeType ) descendants.next(); + AttributeType descendant = descendants.next(); if ( leaf instanceof PresenceNode ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java Sun Jan 20 08:59:10 2008 @@ -21,7 +21,6 @@ import org.apache.directory.server.schema.registries.OidRegistry; -import org.apache.directory.shared.asn1.primitives.OID; import org.apache.directory.shared.ldap.filter.AndNode; import org.apache.directory.shared.ldap.filter.BranchNode; import org.apache.directory.shared.ldap.filter.ExprNode; @@ -88,36 +87,18 @@ { Object normalized; - if ( OID.isOID( attribute ) ) - { - if ( value instanceof String ) - { - normalized = ncn.normalizeByOid( attribute, ( String ) value ); - } - else if ( value instanceof byte [] ) - { - normalized = ncn.normalizeByOid( attribute, ( byte[] ) value ); - } - else - { - normalized = ncn.normalizeByOid( attribute, value.toString() ); - } - } - else - { - if ( value instanceof String ) - { - normalized = ncn.normalizeByName( attribute, ( String ) value ); - } - else if ( value instanceof byte [] ) - { - normalized = ncn.normalizeByName( attribute, ( byte[] ) value ); - } - else - { - normalized = ncn.normalizeByName( attribute, value.toString() ); - } - } + if ( value instanceof String ) + { + normalized = ncn.normalizeByName( attribute, ( String ) value ); + } + else if ( value instanceof byte [] ) + { + normalized = ncn.normalizeByName( attribute, ( byte[] ) value ); + } + else + { + normalized = ncn.normalizeByOid( attribute, value.toString() ); + } return normalized; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Sun Jan 20 08:59:10 2008 @@ -27,6 +27,8 @@ import org.apache.directory.server.constants.ApacheSchemaConstants; import org.apache.directory.server.core.DirectoryService; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerValue; import org.apache.directory.server.core.enumeration.SearchResultFilter; import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration; import org.apache.directory.server.core.interceptor.BaseInterceptor; @@ -43,6 +45,7 @@ import org.apache.directory.server.core.invocation.Invocation; import org.apache.directory.server.core.invocation.InvocationStack; import org.apache.directory.server.schema.registries.AttributeTypeRegistry; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; @@ -101,11 +104,13 @@ }; - private AttributeTypeRegistry registry; + private AttributeTypeRegistry atRegistry; private DirectoryService service; private LdapDN subschemaSubentryDn; + + private Registries registries; /** @@ -119,12 +124,13 @@ public void init( DirectoryService directoryService ) throws NamingException { service = directoryService; - registry = directoryService.getRegistries().getAttributeTypeRegistry(); + registries = directoryService.getRegistries(); + atRegistry = registries.getAttributeTypeRegistry(); // stuff for dealing with subentries (garbage for now) - String subschemaSubentry = ( String ) service.getPartitionNexus() + ServerValue subschemaSubentry = service.getPartitionNexus() .getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get(); - subschemaSubentryDn = new LdapDN( subschemaSubentry ); + subschemaSubentryDn = new LdapDN( (String)subschemaSubentry.get() ); subschemaSubentryDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() ); } @@ -137,20 +143,16 @@ /** * Adds extra operational attributes to the entry before it is added. */ - public void add(NextInterceptor nextInterceptor, AddOperationContext opContext ) + public void add( NextInterceptor nextInterceptor, AddOperationContext opContext ) throws NamingException { String principal = getPrincipal().getName(); - Attributes entry = opContext.getEntry(); - - Attribute attribute = new AttributeImpl( SchemaConstants.CREATORS_NAME_AT ); - attribute.add( principal ); - entry.put( attribute ); - - attribute = new AttributeImpl( SchemaConstants.CREATE_TIMESTAMP_AT ); - attribute.add( DateUtils.getGeneralizedTime() ); - entry.put( attribute ); + + ServerEntry entry = opContext.getEntry(); + entry.put( SchemaConstants.CREATORS_NAME_AT, principal ); + entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); + nextInterceptor.add( opContext ); } @@ -187,7 +189,7 @@ // Make the modify() call happen // ------------------------------------------------------------------- - ModifyOperationContext newModify = new ModifyOperationContext( opContext.getDn(), modItemList ); + ModifyOperationContext newModify = new ModifyOperationContext( registries, opContext.getDn(), modItemList ); service.getPartitionNexus().modify( newModify ); } @@ -210,11 +212,11 @@ LdapDN newDn = ( LdapDN ) opContext.getDn().clone(); newDn.remove( opContext.getDn().size() - 1 ); newDn.add( opContext.getNewRdn() ); - newDn.normalize( registry.getNormalizerMapping() ); + newDn.normalize( atRegistry.getNormalizerMapping() ); List items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE ); - ModifyOperationContext newModify = new ModifyOperationContext( newDn, items ); + ModifyOperationContext newModify = new ModifyOperationContext( registries, newDn, items ); service.getPartitionNexus().modify( newModify ); } @@ -238,7 +240,7 @@ ModifyOperationContext newModify = - new ModifyOperationContext( opContext.getParent(), items ); + new ModifyOperationContext( registries, opContext.getParent(), items ); service.getPartitionNexus().modify( newModify ); } @@ -262,7 +264,7 @@ List items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE ); ModifyOperationContext newModify = - new ModifyOperationContext( + new ModifyOperationContext( registries, opContext.getParent(), items ); service.getPartitionNexus().modify( newModify ); @@ -338,9 +340,9 @@ AttributeType type = null; - if ( registry.hasAttributeType( attrId ) ) + if ( atRegistry.hasAttributeType( attrId ) ) { - type = registry.lookup( attrId ); + type = atRegistry.lookup( attrId ); } if ( type != null && type.getUsage() != UsageEnum.USER_APPLICATIONS ) @@ -399,7 +401,7 @@ { if ( service.isDenormalizeOpAttrsEnabled() ) { - AttributeType type = registry.lookup( SchemaConstants.CREATORS_NAME_AT ); + AttributeType type = atRegistry.lookup( SchemaConstants.CREATORS_NAME_AT ); Attribute attr = AttributeUtils.getAttribute( entry, type ); if ( attr != null ) @@ -410,7 +412,7 @@ attr.add( denormalizeTypes( creatorsName ).getUpName() ); } - type = registry.lookup( SchemaConstants.MODIFIERS_NAME_AT ); + type = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT ); attr = AttributeUtils.getAttribute( entry, type ); if ( attr != null ) @@ -421,7 +423,7 @@ attr.add( denormalizeTypes( modifiersName ).getUpName() ); } - type = registry.lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT ); + type = atRegistry.lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT ); attr = AttributeUtils.getAttribute( entry, type ); if ( attr != null ) @@ -457,7 +459,7 @@ } else if ( rdn.size() == 1 ) { - String name = registry.lookup( rdn.getNormType() ).getName(); + String name = atRegistry.lookup( rdn.getNormType() ).getName(); String value = (String)rdn.getAtav().getValue(); newDn.add( new Rdn( name, name, value, value ) ); continue; @@ -469,7 +471,7 @@ for ( Iterator atavs = rdn.iterator(); atavs.hasNext(); /**/ ) { AttributeTypeAndValue atav = atavs.next(); - String type = registry.lookup( rdn.getNormType() ).getName(); + String type = atRegistry.lookup( rdn.getNormType() ).getName(); buf.append( type ).append( '=' ).append( atav.getValue() ); if ( atavs.hasNext() ) Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Sun Jan 20 08:59:10 2008 @@ -152,7 +152,7 @@ { try { - return lookup( new LookupOperationContext( entryContext.getDn() ) ) != null; + return lookup( new LookupOperationContext( entryContext.getRegistries(), entryContext.getDn() ) ) != null; } catch ( NameNotFoundException e ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Sun Jan 20 08:59:10 2008 @@ -22,6 +22,11 @@ import org.apache.directory.server.constants.ServerDNConstants; import org.apache.directory.server.core.DirectoryService; +import org.apache.directory.server.core.entry.DefaultServerAttribute; +import org.apache.directory.server.core.entry.DefaultServerEntry; +import org.apache.directory.server.core.entry.ServerAttribute; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerEntryUtils; import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext; import org.apache.directory.server.core.interceptor.context.AddOperationContext; import org.apache.directory.server.core.interceptor.context.BindOperationContext; @@ -49,6 +54,7 @@ import org.apache.directory.server.core.partition.tree.Node; import org.apache.directory.server.schema.registries.AttributeTypeRegistry; import org.apache.directory.server.schema.registries.OidRegistry; +import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.MultiException; import org.apache.directory.shared.ldap.NotImplementedException; import org.apache.directory.shared.ldap.constants.SchemaConstants; @@ -58,7 +64,6 @@ import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException; import org.apache.directory.shared.ldap.filter.ExprNode; import org.apache.directory.shared.ldap.filter.PresenceNode; -import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.message.CascadeControl; import org.apache.directory.shared.ldap.message.EntryChangeControl; @@ -118,15 +123,6 @@ /** the vendorName string proudly set to: Apache Software Foundation*/ private static final String ASF = "Apache Software Foundation"; - /** the vendorName DSE operational attribute */ - private static final String VENDORNAME_ATTR = "vendorName"; - - /** the vendorVersion DSE operational attribute */ - private static final String VENDORVERSION_ATTR = "vendorVersion"; - - /** the namingContexts DSE operational attribute */ - private static final String NAMINGCTXS_ATTR = "namingContexts"; - /** the closed state of this partition */ private boolean initialized; @@ -142,9 +138,15 @@ private BranchNode partitionLookupTree = new BranchNode(); /** the read only rootDSE attributes */ - private final Attributes rootDSE; + private final ServerEntry rootDSE; - private AttributeTypeRegistry attrRegistry; + /** The global registries */ + private Registries registries; + + /** The attributeType registry */ + private AttributeTypeRegistry atRegistry; + + /** The OID registry */ private OidRegistry oidRegistry; private Object partitionLookupTreeLock = new Object(); @@ -158,54 +160,41 @@ * @see Vendor Information * @param rootDSE the root entry for the DSA */ - public DefaultPartitionNexus( Attributes rootDSE ) + public DefaultPartitionNexus( ServerEntry rootDSE ) throws NamingException { // setup that root DSE this.rootDSE = rootDSE; - Attribute attr = new AttributeImpl( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ); - attr.add( ServerDNConstants.CN_SCHEMA_DN ); - rootDSE.put( attr ); - - attr = new AttributeImpl( "supportedLDAPVersion" ); - rootDSE.put( attr ); - attr.add( "3" ); - - attr = new AttributeImpl( "supportedFeatures" ); - rootDSE.put( attr ); - attr.add( "1.3.6.1.4.1.4203.1.5.1" ); - - attr = new AttributeImpl( "supportedExtension" ); - rootDSE.put( attr ); - attr.add( NoticeOfDisconnect.EXTENSION_OID ); + + // Add the basic informations + rootDSE.put( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, ServerDNConstants.CN_SCHEMA_DN ); + rootDSE.put( SchemaConstants.SUPPORTED_LDAP_VERSION_AT, "3" ); + rootDSE.put( SchemaConstants.SUPPORTED_FEATURES_AT, SchemaConstants.FEATURE_ALL_OPERATIONAL_ATTRIBUTES ); + rootDSE.put( SchemaConstants.SUPPORTED_EXTENSION_AT, NoticeOfDisconnect.EXTENSION_OID ); // Add the supportedSASLMechanisms attribute to rootDSE - attr = new AttributeImpl( SupportedSASLMechanisms.ATTRIBUTE ); - rootDSE.put( attr ); - attr.add( SupportedSASLMechanisms.GSSAPI ); - attr.add( SupportedSASLMechanisms.DIGEST_MD5 ); - attr.add( SupportedSASLMechanisms.CRAM_MD5 ); - - attr = new AttributeImpl( "supportedControl" ); - rootDSE.put( attr ); - attr.add( PersistentSearchControl.CONTROL_OID ); - attr.add( EntryChangeControl.CONTROL_OID ); - attr.add( SubentriesControl.CONTROL_OID ); - attr.add( ManageDsaITControl.CONTROL_OID ); - attr.add( CascadeControl.CONTROL_OID ); - - attr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT ); - rootDSE.put( attr ); - attr.add( SchemaConstants.TOP_OC ); - attr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC ); - - attr = new AttributeImpl( NAMINGCTXS_ATTR ); - rootDSE.put( attr ); - - attr = new AttributeImpl( VENDORNAME_ATTR ); - attr.add( ASF ); - rootDSE.put( attr ); + rootDSE.put( SupportedSASLMechanisms.ATTRIBUTE, + SupportedSASLMechanisms.GSSAPI, + SupportedSASLMechanisms.DIGEST_MD5, + SupportedSASLMechanisms.CRAM_MD5 ); + + // Add the supported controls + rootDSE.put( SchemaConstants.SUPPORTED_CONTROL_AT, + PersistentSearchControl.CONTROL_OID, + EntryChangeControl.CONTROL_OID, + SubentriesControl.CONTROL_OID, + ManageDsaITControl.CONTROL_OID, + CascadeControl.CONTROL_OID ); + + // Add the objectClasses + rootDSE.put( SchemaConstants.OBJECT_CLASS_AT, + SchemaConstants.TOP_OC, + SchemaConstants.EXTENSIBLE_OBJECT_OC ); + + // Add the 'vendor' name and version infos + rootDSE.put( SchemaConstants.VENDOR_NAME_AT, ASF ); Properties props = new Properties(); + try { props.load( getClass().getResourceAsStream( "version.properties" ) ); @@ -215,9 +204,7 @@ LOG.error( "failed to LOG version properties" ); } - attr = new AttributeImpl( VENDORVERSION_ATTR ); - attr.add( props.getProperty( "apacheds.version", "UNKNOWN" ) ); - rootDSE.put( attr ); + rootDSE.put( SchemaConstants.VENDOR_VERSION_AT, props.getProperty( "apacheds.version", "UNKNOWN" ) ); } @@ -253,18 +240,29 @@ * * @return the root entry for the DSA */ - public Attributes getContextEntry() + public ServerEntry getContextEntry() { return rootDSE; } /** + * Returns root the rootDSE. + * + * @return the root entry for the DSA + */ + public Attributes getContextEntryAttr() + { + return null; + } + + + /** * Sets root entry for this BTreePartition. * * @throws UnsupportedOperationException everytime */ - public void setContextEntry( Attributes rootEntry ) + public void setContextEntry( ServerEntry rootEntry ) { throw new UnsupportedOperationException( "Setting the RootDSE is not allowed." ); } @@ -321,8 +319,9 @@ } this.directoryService = directoryService; - this.attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry(); - this.oidRegistry = directoryService.getRegistries().getOidRegistry(); + registries = directoryService.getRegistries(); + atRegistry = registries.getAttributeTypeRegistry(); + oidRegistry = registries.getOidRegistry(); initializeSystemPartition(); List initializedPartitions = new ArrayList(); @@ -334,8 +333,9 @@ { while ( partitions.hasNext() ) { - Partition p = partitions.next(); - AddContextPartitionOperationContext opCtx = new AddContextPartitionOperationContext( p ); + Partition partition = partitions.next(); + AddContextPartitionOperationContext opCtx = + new AddContextPartitionOperationContext( registries, partition ); addContextPartition( opCtx ); initializedPartitions.add( opCtx.getPartition() ); } @@ -372,22 +372,32 @@ { // initialize system partition first Partition override = directoryService.getSystemPartition(); + if ( override != null ) { - Attributes systemEntry = override.getContextEntry(); - Attribute objectClassAttr = systemEntry.get( SchemaConstants.OBJECT_CLASS_AT ); + ServerEntry systemEntry = override.getContextEntry(); + ServerAttribute objectClassAttr = systemEntry.get( SchemaConstants.OBJECT_CLASS_AT ); + if ( objectClassAttr == null ) { - objectClassAttr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT ); - systemEntry.put( objectClassAttr ); + systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, + SchemaConstants.TOP_OC, + SchemaConstants.ORGANIZATIONAL_UNIT_OC, + SchemaConstants.EXTENSIBLE_OBJECT_OC ); } - objectClassAttr.add( SchemaConstants.TOP_OC ); - objectClassAttr.add( SchemaConstants.ORGANIZATIONAL_UNIT_OC ); - objectClassAttr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC ); + else + { + objectClassAttr.add( + SchemaConstants.TOP_OC, + SchemaConstants.ORGANIZATIONAL_UNIT_OC, + SchemaConstants.EXTENSIBLE_OBJECT_OC ); + } + systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN ); systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ), NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) ); + override.setContextEntry( systemEntry ); // --------------------------------------------------------------- @@ -405,7 +415,7 @@ { Set indices = ( ( JdbmPartition ) override ).getIndexedAttributes(); Set indexOids = new HashSet(); - OidRegistry registry = directoryService.getRegistries().getOidRegistry(); + OidRegistry registry = registries.getOidRegistry(); for ( Index index : indices ) { @@ -440,16 +450,21 @@ ( ( JdbmPartition ) system ).setIndexedAttributes( indexedAttrs ); // Add context entry for system partition - Attributes systemEntry = new AttributesImpl(); - Attribute objectClassAttr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT ); - objectClassAttr.add( SchemaConstants.TOP_OC ); - objectClassAttr.add( SchemaConstants.ORGANIZATIONAL_UNIT_OC ); - objectClassAttr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC ); - systemEntry.put( objectClassAttr ); + ServerEntry systemEntry = new DefaultServerEntry( registries, new LdapDN( ServerDNConstants.SYSTEM_DN ) ); + + // Add the ObjectClasses + systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, + SchemaConstants.TOP_OC, + SchemaConstants.ORGANIZATIONAL_UNIT_OC, + SchemaConstants.EXTENSIBLE_OBJECT_OC + ); + + // Add some operational attributes systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN ); systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ), NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) ); + system.setContextEntry( systemEntry ); } @@ -465,8 +480,19 @@ { partitions.put( key, system ); partitionLookupTree.recursivelyAddPartition( partitionLookupTree, system.getSuffixDn(), 0, system ); - Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR ); - namingContexts.add( system.getUpSuffixDn().getUpName() ); + ServerAttribute namingContexts = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT ); + + if ( namingContexts == null ) + { + namingContexts = new DefaultServerAttribute( + registries.getAttributeTypeRegistry().lookup( SchemaConstants.NAMING_CONTEXTS_AT ), + system.getUpSuffixDn().getUpName() ); + rootDSE.put( namingContexts ); + } + else + { + namingContexts.add( system.getUpSuffixDn().getUpName() ); + } } return system; @@ -492,7 +518,7 @@ { try { - removeContextPartition( new RemoveContextPartitionOperationContext( new LdapDN( suffix ) ) ); + removeContextPartition( new RemoveContextPartitionOperationContext( registries, new LdapDN( suffix ) ) ); } catch ( NamingException e ) { @@ -548,7 +574,7 @@ public boolean compare( CompareOperationContext compareContext ) throws NamingException { Partition partition = getPartition( compareContext.getDn() ); - AttributeTypeRegistry registry = directoryService.getRegistries().getAttributeTypeRegistry(); + AttributeTypeRegistry registry = registries.getAttributeTypeRegistry(); // complain if we do not recognize the attribute being compared if ( !registry.hasAttributeType( compareContext.getOid() ) ) @@ -558,7 +584,7 @@ AttributeType attrType = registry.lookup( compareContext.getOid() ); - Attribute attr = partition.lookup( new LookupOperationContext( compareContext.getDn() ) ).get( attrType.getName() ); + Attribute attr = partition.lookup( new LookupOperationContext( registries, compareContext.getDn() ) ).get( attrType.getName() ); // complain if the attribute being compared does not exist in the entry if ( attr == null ) @@ -627,6 +653,15 @@ if ( ! partition.isInitialized() ) { + if ( partition.getContextEntry() != null ) + { + partition.setContextEntry( partition.getContextEntry() ); + } + else + { + partition.setContextEntry( ServerEntryUtils.toServerEntry( partition.getContextEntryAttr(), new LdapDN( partition.getSuffix() ) , registries ) ); + } + partition.init( directoryService ); } @@ -642,15 +677,25 @@ partitions.put( partitionSuffix.toString(), partition ); partitionLookupTree.recursivelyAddPartition( partitionLookupTree, partition.getSuffixDn(), 0, partition ); - Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR ); + ServerAttribute namingContexts = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT ); LdapDN partitionUpSuffix = partition.getUpSuffixDn(); + if ( partitionUpSuffix == null ) { throw new ConfigurationException( "The current partition does not have any user provided suffix: " + partition.getId() ); } - namingContexts.add( partitionUpSuffix.getUpName() ); + if ( namingContexts == null ) + { + namingContexts = new DefaultServerAttribute( + registries.getAttributeTypeRegistry().lookup( SchemaConstants.NAMING_CONTEXTS_AT ), partitionUpSuffix.getUpName() ); + rootDSE.put( namingContexts ); + } + else + { + namingContexts.add( partitionUpSuffix.getUpName() ); + } } } @@ -665,12 +710,16 @@ throw new NameNotFoundException( "No partition with suffix: " + key ); } - Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR ); - namingContexts.remove( partition.getUpSuffixDn().getUpName() ); + ServerAttribute namingContexts = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT ); + + if ( namingContexts != null ) + { + namingContexts.remove( partition.getUpSuffixDn().getUpName() ); + } // Create a new partition list. // This is easier to create a new structure from scratch than to reorganize - // the current structure. As this strcuture is not modified often + // the current structure. As this structure is not modified often // this is an acceptable solution. synchronized ( partitionLookupTree ) { @@ -712,7 +761,7 @@ while ( dn.size() > 0 ) { - if ( hasEntry( new EntryOperationContext( dn ) ) ) + if ( hasEntry( new EntryOperationContext( registries, dn ) ) ) { return dn; } @@ -754,7 +803,7 @@ } - public Attributes getRootDSE( GetRootDSEOperationContext getRootDSEContext ) + public ServerEntry getRootDSE( GetRootDSEOperationContext getRootDSEContext ) { return rootDSE; } @@ -775,8 +824,13 @@ */ private void unregister( Partition partition ) throws NamingException { - Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR ); - namingContexts.remove( partition.getSuffixDn().getUpName() ); + ServerAttribute namingContexts = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT ); + + if ( namingContexts != null ) + { + namingContexts.remove( partition.getSuffixDn().getUpName() ); + } + partitions.remove( partition.getSuffixDn().toString() ); } @@ -925,57 +979,29 @@ return new SingletonEnumeration( result ); } - Attributes attrs = new AttributesImpl(); - if ( containsAsterisk ) + ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() ); + + ServerEntry rootDSE = getRootDSE( new GetRootDSEOperationContext( registries ) ); + + for ( ServerAttribute attribute:rootDSE ) { - for ( NamingEnumeration ii = getRootDSE( null ).getAll(); ii.hasMore(); /**/ ) + AttributeType type = atRegistry.lookup( attribute.getUpId() ); + + if ( realIds.contains( type.getOid() ) ) { - // add all user attribute - Attribute attr = ii.next(); - AttributeType type = attrRegistry.lookup( attr.getID() ); - if ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) - { - attrs.put( attr ); - } - // add attributes specifically asked for - else if ( realIds.contains( type.getOid() ) ) - { - attrs.put( attr ); - } + serverEntry.put( attribute ); } - } - else if ( containsPlus ) - { - for ( NamingEnumeration ii = getRootDSE( null ).getAll(); ii.hasMore(); /**/ ) + else if ( containsAsterisk && ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) ) { - // add all operational attributes - Attribute attr = ii.next(); - AttributeType type = attrRegistry.lookup( attr.getID() ); - if ( type.getUsage() != UsageEnum.USER_APPLICATIONS ) - { - attrs.put( attr ); - } - // add user attributes specifically asked for - else if ( realIds.contains( type.getOid() ) ) - { - attrs.put( attr ); - } + serverEntry.put( attribute ); } - } - else - { - for ( NamingEnumeration ii = getRootDSE( null ).getAll(); ii.hasMore(); /**/ ) + else if ( containsPlus && ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) ) { - // add user attributes specifically asked for - Attribute attr = ii.next(); - AttributeType type = attrRegistry.lookup( attr.getID() ); - if ( realIds.contains( type.getOid() ) ) - { - attrs.put( attr ); - } + serverEntry.put( attribute ); } } + Attributes attrs = ServerEntryUtils.toAttributesImpl( serverEntry ); SearchResult result = new ServerSearchResult( "", null, attrs, false ); return new SingletonEnumeration( result ); } @@ -994,33 +1020,35 @@ if ( dn.size() == 0 ) { - Attributes retval = new AttributesImpl(); - NamingEnumeration list = rootDSE.getIDs(); + ServerEntry retval = new DefaultServerEntry( registries, opContext.getDn() ); + Set attributeTypes = rootDSE.getAttributeTypes(); if ( opContext.getAttrsId() != null ) { - while ( list.hasMore() ) + for ( AttributeType attributeType:attributeTypes ) { - String id = list.next(); + String id = attributeType.getName(); if ( opContext.getAttrsId().contains( id ) ) { - Attribute attr = rootDSE.get( id ); - retval.put( ( Attribute ) attr.clone() ); + ServerAttribute attr = rootDSE.get( id ); + retval.put( (ServerAttribute)attr.clone() ); } + } } else { - while ( list.hasMore() ) + for ( AttributeType attributeType:attributeTypes ) { - String id = list.next(); - Attribute attr = rootDSE.get( id ); - retval.put( ( Attribute ) attr.clone() ); + String id = attributeType.getName(); + + ServerAttribute attr = rootDSE.get( id ); + retval.put( (ServerAttribute)attr.clone() ); } } - return retval; + return ServerEntryUtils.toAttributesImpl( retval ); } Partition backend = getPartition( dn ); @@ -1130,13 +1158,13 @@ // ------------------------------------------------------------------------ - public void registerSupportedExtensions( Set extensionOids ) + public void registerSupportedExtensions( Set extensionOids ) throws NamingException { - Attribute supportedExtension = rootDSE.get( "supportedExtension" ); + ServerAttribute supportedExtension = rootDSE.get( SchemaConstants.SUPPORTED_EXTENSION_AT ); + if ( supportedExtension == null ) { - supportedExtension = new AttributeImpl( "supportedExtension" ); - rootDSE.put( supportedExtension ); + rootDSE.set( SchemaConstants.SUPPORTED_EXTENSION_AT ); } for ( String extensionOid : extensionOids ) Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Sun Jan 20 08:59:10 2008 @@ -21,6 +21,7 @@ import org.apache.directory.server.core.DirectoryService; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.core.interceptor.context.AddOperationContext; import org.apache.directory.server.core.interceptor.context.BindOperationContext; import org.apache.directory.server.core.interceptor.context.DeleteOperationContext; @@ -58,8 +59,10 @@ { /** The name of reserved system partition */ String SYSTEM_PARTITION_NAME = "system"; + /** default partition implementation class */ String DEFAULT_PARTITION_IMPLEMENTATION = "org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition"; + /** the default entry cache size to use for a partition */ int DEFAULT_CACHE_SIZE = 10000; @@ -90,17 +93,25 @@ * * @return the entry for the suffix of this Partition. */ - Attributes getContextEntry(); + ServerEntry getContextEntry(); /** + * Gets the root entry of the partition, the entry for the suffix. + * + * @return the entry for the suffix of this Partition. + */ + Attributes getContextEntryAttr(); + + + /** * Sets the root entry of the partition, the entry for the suffix. * * @param contextEntry the entry for the suffix of this Partition. */ - void setContextEntry( Attributes contextEntry ); - + void setContextEntry( ServerEntry contextEntry ); + /** * Gets the non-normalized suffix for this Partition as a string. * Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java Sun Jan 20 08:59:10 2008 @@ -27,10 +27,10 @@ import javax.naming.InvalidNameException; import javax.naming.NamingException; -import javax.naming.directory.Attributes; import javax.naming.ldap.LdapContext; import org.apache.directory.server.constants.ServerDNConstants; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext; import org.apache.directory.server.core.interceptor.context.CompareOperationContext; import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext; @@ -165,7 +165,7 @@ * * @return the attributes of the RootDSE */ - public abstract Attributes getRootDSE( GetRootDSEOperationContext opContext ) throws NamingException; + public abstract ServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws NamingException; /** @@ -244,5 +244,5 @@ * @param extensionOids a set of OID strings to add to the supportedExtension * attribute in the RootDSE */ - public abstract void registerSupportedExtensions( Set extensionOids ); + public abstract void registerSupportedExtensions( Set extensionOids ) throws NamingException; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java Sun Jan 20 08:59:10 2008 @@ -43,6 +43,8 @@ import org.apache.directory.server.core.authn.AuthenticationInterceptor; import org.apache.directory.server.core.authz.AciAuthorizationInterceptor; import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerEntryUtils; import org.apache.directory.server.core.enumeration.SearchResultFilter; import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration; import org.apache.directory.server.core.event.EventInterceptor; @@ -121,12 +123,12 @@ /** * A static object to store the rootDSE entry with all the attributes */ - private static Attributes ROOT_DSE_ALL; + private static ServerEntry ROOT_DSE_ALL; /** * A static object to store the rootDSE entry without operationnal attributes */ - private static Attributes ROOT_DSE_NO_OPERATIONNAL; + private static ServerEntry ROOT_DSE_NO_OPERATIONNAL; /** * A mutex to protect the rootDSE construction @@ -221,13 +223,19 @@ } - public Attributes getContextEntry() + public ServerEntry getContextEntry() { throw new UnsupportedOperationException( "Not supported by PartitionNexusProxy" ); } - public void setContextEntry( Attributes contextEntry ) + public Attributes getContextEntryAttr() + { + throw new UnsupportedOperationException( "Not supported by PartitionNexusProxy" ); + } + + + public void setContextEntry( ServerEntry contextEntry ) { throw new UnsupportedOperationException( "Not supported by PartitionNexusProxy" ); } @@ -577,22 +585,23 @@ { if ( ROOT_DSE_NO_OPERATIONNAL == null ) { - ROOT_DSE_NO_OPERATIONNAL = lookup( opContext, null ); + ROOT_DSE_NO_OPERATIONNAL = ServerEntryUtils.toServerEntry( lookup( opContext, null ), opContext.getDn(), opContext.getRegistries() ); } } - return ROOT_DSE_NO_OPERATIONNAL; - } else if ( ( attrs.size() == 1 ) && ( attrs.contains( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) ) ) + return ServerEntryUtils.toAttributesImpl( ROOT_DSE_NO_OPERATIONNAL ); + } + else if ( ( attrs.size() == 1 ) && ( attrs.contains( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) ) ) { synchronized ( ROOT_DSE_ALL_MUTEX ) { if ( ROOT_DSE_ALL == null ) { - ROOT_DSE_ALL = lookup( opContext, null ); + ROOT_DSE_ALL = ServerEntryUtils.toServerEntry( lookup( opContext, null ), opContext.getDn(), opContext.getRegistries() ); } } - return ROOT_DSE_ALL; + return ServerEntryUtils.toAttributesImpl( ROOT_DSE_ALL ); } } @@ -768,7 +777,7 @@ } - public Attributes getRootDSE( GetRootDSEOperationContext opContext ) throws NamingException + public ServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws NamingException { if ( opContext.getDn().size() == 0 ) { @@ -787,7 +796,7 @@ } - public Attributes getRootDSE( GetRootDSEOperationContext opContext, Collection bypass ) + public ServerEntry getRootDSE( GetRootDSEOperationContext opContext, Collection bypass ) throws NamingException { ensureStarted(); @@ -861,7 +870,7 @@ } - public void registerSupportedExtensions( Set extensionOids ) + public void registerSupportedExtensions( Set extensionOids ) throws NamingException { service.getPartitionNexus().registerSupportedExtensions( extensionOids ); } Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=613608&r1=613607&r2=613608&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Sun Jan 20 08:59:10 2008 @@ -20,6 +20,7 @@ package org.apache.directory.server.core.partition.impl.btree; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.core.enumeration.SearchResultEnumeration; import org.apache.directory.server.core.interceptor.context.AddOperationContext; import org.apache.directory.server.core.interceptor.context.DeleteOperationContext; @@ -89,7 +90,12 @@ protected int cacheSize = -1; protected LdapDN suffixDn; protected String suffix; - protected Attributes contextEntry = new AttributesImpl( true ); + + /** The rootDSE context */ + protected ServerEntry contextEntry; + + /** The rootDSE context */ + protected Attributes contextEntryAttr; // ------------------------------------------------------------------------ @@ -139,9 +145,34 @@ * * @return the root suffix entry for this BTreePartition */ - public Attributes getContextEntry() + public ServerEntry getContextEntry() { - return ( Attributes ) contextEntry.clone(); + if ( contextEntry != null ) + { + return ( ServerEntry ) contextEntry.clone(); + } + else + { + return null; + } + } + + + /** + * Returns root entry for this BTreePartition. + * + * @return the root suffix entry for this BTreePartition + */ + public Attributes getContextEntryAttr() + { + if ( contextEntryAttr != null ) + { + return ( Attributes ) contextEntryAttr.clone(); + } + else + { + return null; + } } @@ -150,12 +181,34 @@ * * @param rootEntry the root suffix entry of this BTreePartition */ - public void setContextEntry( Attributes rootEntry ) + public void setContextEntry( ServerEntry rootEntry ) { - this.contextEntry = ( Attributes ) rootEntry.clone(); + this.contextEntry = ( ServerEntry ) rootEntry.clone(); } + + /** + * Sets root entry for this BTreePartition. + * + * @param rootEntry the root suffix entry of this BTreePartition + */ + public void setContextEntry( String rootEntry ) + { + System.out.println( rootEntry ); + } + + + /** + * Sets root entry for this BTreePartition. + * + * @param rootEntry the root suffix entry of this BTreePartition + */ + public void setContextEntry( Attributes rootEntryAttr ) + { + this.contextEntryAttr = ( AttributesImpl ) rootEntryAttr.clone(); + } + /** * Gets the unique identifier for this partition. *