You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/02/14 03:00:37 UTC
svn commit: r507354 - in /directory/apacheds/branches/1.0:
core/src/main/java/org/apache/directory/server/core/operational/
core/src/main/java/org/apache/directory/server/core/partition/impl/btree/
protocol-ldap/src/main/java/org/apache/directory/serve...
Author: akarasulu
Date: Tue Feb 13 18:00:37 2007
New Revision: 507354
URL: http://svn.apache.org/viewvc?view=rev&rev=507354
Log:
ref attribute handling changes ...
o removed the code in the search handler which injected the ref attribute into
the returningAttributes list for the search operation
o added code to the returningAttributes handling code to always return the
ref attribute of an entry regardless of the ref attribute's presence in
the list of attributes to return
o checking in OperationalAttributeService to make sure we do not remove the
ref attribute from entries.
NOTE: this has one drawback, other non-btree based implementations must also
implement this functionality to make sure referral handling succeeds
if this code was in an interceptor then we wouldn't have this problem
however having an interceptor much with the returningAttributes causes
problems
Modified:
directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeSearchResultEnumeration.java
directory/apacheds/branches/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java
Modified: directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?view=diff&rev=507354&r1=507353&r2=507354
==============================================================================
--- directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java (original)
+++ directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java Tue Feb 13 18:00:37 2007
@@ -108,6 +108,8 @@
private boolean isDenormalizeOpAttrsEnabled;
+ private AttributeType refAttrOid = null;
+
/**
* Creates the operational attribute management service interceptor.
@@ -122,6 +124,7 @@
nexus = factoryCfg.getPartitionNexus();
registry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
isDenormalizeOpAttrsEnabled = factoryCfg.getStartupConfiguration().isDenormalizeOpAttrsEnabled();
+ refAttrOid =registry.lookup( "ref" );
}
@@ -326,7 +329,11 @@
if ( type != null && type.getUsage() != UsageEnum.USERAPPLICATIONS )
{
- attributes.remove( attrId );
+ // just make sure we do not remove the ref attribute
+ if ( ! type.getOid().equals( refAttrOid.getOid() ) )
+ {
+ attributes.remove( attrId );
+ }
}
}
return true;
Modified: directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeSearchResultEnumeration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeSearchResultEnumeration.java?view=diff&rev=507354&r1=507353&r2=507354
==============================================================================
--- directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeSearchResultEnumeration.java (original)
+++ directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeSearchResultEnumeration.java Tue Feb 13 18:00:37 2007
@@ -233,6 +233,15 @@
}
}
}
+
+ // add the ref attribute if it exists in the entry if it was already
+ // added to the entry because of '+' above then it will just be overwritten
+ AttributeType refAT = registry.lookup( "ref" );
+ Attribute refAttr = AttributeUtils.getAttribute( rec.getAttributes(), refAT );
+ if ( refAttr != null )
+ {
+ entry.put( ( Attribute ) refAttr.clone() );
+ }
BTreeSearchResult result = new BTreeSearchResult( rec.getEntryId(), name, null, entry );
result.setRelative( false );
Modified: directory/apacheds/branches/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java?view=diff&rev=507354&r1=507353&r2=507354
==============================================================================
--- directory/apacheds/branches/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java (original)
+++ directory/apacheds/branches/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java Tue Feb 13 18:00:37 2007
@@ -20,9 +20,7 @@
package org.apache.directory.server.ldap.support;
-import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Iterator;
import javax.naming.Context;
@@ -154,21 +152,13 @@
SearchRequest req = ( SearchRequest ) request;
NamingEnumeration list = null;
String[] ids = null;
- Collection retAttrs = new HashSet();
- retAttrs.addAll( req.getAttributes() );
// add the search request to the registry of outstanding requests for this session
SessionRegistry.getSingleton().addOutstandingRequest( session, req );
- // check the attributes to see if a referral's ref attribute is included
- if ( retAttrs.size() > 0 && !retAttrs.contains( "ref" ) )
+ if ( req.getAttributes() != null && req.getAttributes().size() > 0 )
{
- retAttrs.add( "ref" );
- ids = ( String[] ) retAttrs.toArray( ArrayUtils.EMPTY_STRING_ARRAY );
- }
- else if ( retAttrs.size() > 0 )
- {
- ids = ( String[] ) retAttrs.toArray( ArrayUtils.EMPTY_STRING_ARRAY );
+ ids = ( String[] ) req.getAttributes().toArray( ArrayUtils.EMPTY_STRING_ARRAY );
}
try