You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2005/06/22 12:38:01 UTC
svn commit: r191792 [3/3] - in
/directory/apacheds/branches/db_refactor/core: ./ src/main/aspects/
src/main/java/org/apache/ldap/server/authn/
src/main/java/org/apache/ldap/server/authz/
src/main/java/org/apache/ldap/server/exception/ src/main/java/org...
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java?rev=191792&r1=191791&r2=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java Wed Jun 22 03:37:56 2005
@@ -17,29 +17,23 @@
package org.apache.ldap.server.normalization;
+import java.util.Map;
+
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SearchControls;
+import org.apache.ldap.common.filter.ExprNode;
import org.apache.ldap.common.name.DnParser;
import org.apache.ldap.common.name.NameComponentNormalizer;
import org.apache.ldap.common.schema.AttributeType;
+import org.apache.ldap.server.configuration.InterceptorConfiguration;
import org.apache.ldap.server.interceptor.BaseInterceptor;
-import org.apache.ldap.server.interceptor.InterceptorContext;
import org.apache.ldap.server.interceptor.NextInterceptor;
-import org.apache.ldap.server.invocation.Add;
-import org.apache.ldap.server.invocation.Delete;
-import org.apache.ldap.server.invocation.GetMatchedDN;
-import org.apache.ldap.server.invocation.GetSuffix;
-import org.apache.ldap.server.invocation.HasEntry;
-import org.apache.ldap.server.invocation.IsSuffix;
-import org.apache.ldap.server.invocation.List;
-import org.apache.ldap.server.invocation.Lookup;
-import org.apache.ldap.server.invocation.LookupWithAttrIds;
-import org.apache.ldap.server.invocation.Modify;
-import org.apache.ldap.server.invocation.ModifyMany;
-import org.apache.ldap.server.invocation.ModifyRN;
-import org.apache.ldap.server.invocation.Move;
-import org.apache.ldap.server.invocation.MoveAndModifyRN;
-import org.apache.ldap.server.invocation.Search;
+import org.apache.ldap.server.jndi.ContextFactoryConfiguration;
import org.apache.ldap.server.schema.AttributeTypeRegistry;
@@ -56,10 +50,9 @@
private DnParser parser;
- public void init( InterceptorContext context ) throws NamingException
+ public void init( ContextFactoryConfiguration factoryCfg, InterceptorConfiguration cfg ) throws NamingException
{
- AttributeTypeRegistry attributeRegistry = context.getGlobalRegistries().getAttributeTypeRegistry();
-
+ AttributeTypeRegistry attributeRegistry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
parser = new DnParser( new PerComponentNormalizer( attributeRegistry ) );
}
@@ -74,150 +67,151 @@
// ------------------------------------------------------------------------
- protected void process( NextInterceptor nextInterceptor, Add call ) throws NamingException
+ public void add( NextInterceptor nextInterceptor, String upName, Name normName, Attributes attrs ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ normName = parser.parse( normName.toString() );
}
- super.process( nextInterceptor, call );
+ nextInterceptor.add( upName, normName, attrs );
}
- protected void process( NextInterceptor nextInterceptor, Delete call ) throws NamingException
+ public void delete( NextInterceptor nextInterceptor, Name name ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ nextInterceptor.delete( name );
}
- protected void process( NextInterceptor nextInterceptor, Modify call ) throws NamingException
+ public void modify( NextInterceptor nextInterceptor, Name name, int modOp, Attributes attrs ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ nextInterceptor.modify( name, modOp, attrs );
}
- protected void process( NextInterceptor nextInterceptor, ModifyMany call ) throws NamingException
+ public void modify( NextInterceptor nextInterceptor, Name name, ModificationItem[] items ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ nextInterceptor.modify( name, items );
}
- protected void process( NextInterceptor nextInterceptor, ModifyRN call ) throws NamingException
+ public void modifyRn( NextInterceptor nextInterceptor, Name name, String newRn, boolean deleteOldRn ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ nextInterceptor.modifyRn( name, newRn, deleteOldRn );
}
- protected void process( NextInterceptor nextInterceptor, Move call ) throws NamingException
+ public void move( NextInterceptor nextInterceptor, Name name, Name newParentName ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
-
- call.setNewParentName( parser.parse( call.getNewParentName().toString() ) );
+ name = parser.parse( name.toString() );
+ newParentName = parser.parse( newParentName.toString() );
}
- super.process( nextInterceptor, call );
+ nextInterceptor.move( name, newParentName );
}
- protected void process( NextInterceptor nextInterceptor, MoveAndModifyRN call ) throws NamingException
+ public void move( NextInterceptor nextInterceptor, Name name, Name newParentName, String newRn, boolean deleteOldRn ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
- call.setNewParentName( parser.parse( call.getNewParentName().toString() ) );
+ newParentName = parser.parse( newParentName.toString() );
}
- super.process( nextInterceptor, call );
+ nextInterceptor.move( name, newParentName, newRn, deleteOldRn );
}
- protected void process( NextInterceptor nextInterceptor, Search call ) throws NamingException
+ public NamingEnumeration search( NextInterceptor nextInterceptor,
+ Name base, Map env, ExprNode filter,
+ SearchControls searchCtls ) throws NamingException
{
synchronized( parser )
{
- call.setBaseName( parser.parse( call.getBaseName().toString() ) );
+ base = parser.parse( base.toString() );
}
- super.process( nextInterceptor, call );
+ return nextInterceptor.search( base, env, filter, searchCtls );
}
- protected void process( NextInterceptor nextInterceptor, HasEntry call ) throws NamingException
+ public boolean hasEntry( NextInterceptor nextInterceptor, Name name ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ return nextInterceptor.hasEntry( name );
}
- protected void process( NextInterceptor nextInterceptor, IsSuffix call ) throws NamingException
+ public boolean isSuffix( NextInterceptor nextInterceptor, Name name ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ return nextInterceptor.isSuffix( name );
}
- protected void process( NextInterceptor nextInterceptor, List call ) throws NamingException
+ public NamingEnumeration list( NextInterceptor nextInterceptor, Name base ) throws NamingException
{
synchronized( parser )
{
- call.setBaseName( parser.parse( call.getBaseName().toString() ) );
+ base = parser.parse( base.toString() );
}
- super.process( nextInterceptor, call );
+ return nextInterceptor.list( base );
}
- protected void process( NextInterceptor nextInterceptor, Lookup call ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, Name name ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ return nextInterceptor.lookup( name );
}
- protected void process( NextInterceptor nextInterceptor, LookupWithAttrIds call ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, Name name, String[] attrIds ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ return nextInterceptor.lookup( name, attrIds );
}
@@ -226,25 +220,25 @@
// ------------------------------------------------------------------------
- protected void process( NextInterceptor nextInterceptor, GetMatchedDN call ) throws NamingException
+ public Name getMatchedDn( NextInterceptor nextInterceptor, Name name, boolean normalized ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ return nextInterceptor.getMatchedDn( name, normalized );
}
- protected void process( NextInterceptor nextInterceptor, GetSuffix call ) throws NamingException
+ public Name getSuffix( NextInterceptor nextInterceptor, Name name, boolean normalized ) throws NamingException
{
synchronized( parser )
{
- call.setName( parser.parse( call.getName().toString() ) );
+ name = parser.parse( name.toString() );
}
- super.process( nextInterceptor, call );
+ return nextInterceptor.getSuffix( name, normalized );
}
@@ -253,7 +247,7 @@
* A normalizer that normalizes each name component specifically according to
* the attribute type of the name component.
*/
- class PerComponentNormalizer implements NameComponentNormalizer
+ private class PerComponentNormalizer implements NameComponentNormalizer
{
/** the attribute type registry we use to lookup component normalizers */
private final AttributeTypeRegistry registry;
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java?rev=191792&r1=191791&r2=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java Wed Jun 22 03:37:56 2005
@@ -18,6 +18,7 @@
import java.util.HashSet;
+import java.util.Map;
import javax.naming.Name;
import javax.naming.NamingEnumeration;
@@ -26,28 +27,22 @@
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
+import org.apache.ldap.common.filter.ExprNode;
import org.apache.ldap.common.schema.AttributeType;
import org.apache.ldap.common.schema.UsageEnum;
import org.apache.ldap.common.util.DateUtils;
+import org.apache.ldap.server.configuration.InterceptorConfiguration;
import org.apache.ldap.server.enumeration.ResultFilteringEnumeration;
import org.apache.ldap.server.enumeration.SearchResultFilter;
import org.apache.ldap.server.interceptor.BaseInterceptor;
-import org.apache.ldap.server.interceptor.InterceptorContext;
import org.apache.ldap.server.interceptor.NextInterceptor;
-import org.apache.ldap.server.invocation.Add;
-import org.apache.ldap.server.invocation.List;
-import org.apache.ldap.server.invocation.Lookup;
-import org.apache.ldap.server.invocation.LookupWithAttrIds;
-import org.apache.ldap.server.invocation.Modify;
-import org.apache.ldap.server.invocation.ModifyMany;
-import org.apache.ldap.server.invocation.ModifyRN;
-import org.apache.ldap.server.invocation.Move;
-import org.apache.ldap.server.invocation.MoveAndModifyRN;
-import org.apache.ldap.server.invocation.Search;
+import org.apache.ldap.server.invocation.InvocationStack;
+import org.apache.ldap.server.jndi.ContextFactoryConfiguration;
import org.apache.ldap.server.partition.ContextPartitionNexus;
import org.apache.ldap.server.schema.AttributeTypeRegistry;
@@ -96,10 +91,10 @@
}
- public void init( InterceptorContext ctx ) throws NamingException
+ public void init( ContextFactoryConfiguration factoryCfg, InterceptorConfiguration cfg ) throws NamingException
{
- nexus = ctx.getRootNexus();
- registry = ctx.getGlobalRegistries().getAttributeTypeRegistry();
+ nexus = factoryCfg.getPartitionNexus();
+ registry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
}
@@ -111,10 +106,9 @@
/**
* Adds extra operational attributes to the entry before it is added.
*/
- protected void process( NextInterceptor nextInterceptor, Add call ) throws NamingException
+ public void add( NextInterceptor nextInterceptor, String upName, Name normName, Attributes entry ) throws NamingException
{
- String principal = getPrincipal( call ).getName();
- Attributes entry = call.getAttributes();
+ String principal = getPrincipal().getName();
BasicAttribute attribute = new BasicAttribute( "creatorsName" );
attribute.add( principal );
@@ -124,157 +118,148 @@
attribute.add( DateUtils.getGeneralizedTime() );
entry.put( attribute );
- nextInterceptor.process( call );
+ nextInterceptor.add( upName, normName, entry );
}
- protected void process( NextInterceptor nextInterceptor, Modify call ) throws NamingException
+ public void modify( NextInterceptor nextInterceptor, Name name, int modOp, Attributes attrs) throws NamingException
{
- nextInterceptor.process( call );
+ nextInterceptor.modify( name, modOp, attrs );
// add operational attributes after call in case the operation fails
Attributes attributes = new BasicAttributes();
BasicAttribute attribute = new BasicAttribute( "modifiersName" );
- attribute.add( getPrincipal( call ).getName() );
+ attribute.add( getPrincipal().getName() );
attributes.put( attribute );
attribute = new BasicAttribute( "modifyTimestamp" );
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- nexus.modify( call.getName(), DirContext.REPLACE_ATTRIBUTE, attributes );
+ nexus.modify( name, DirContext.REPLACE_ATTRIBUTE, attributes );
}
- protected void process( NextInterceptor nextInterceptor, ModifyMany call ) throws NamingException
+ public void modify( NextInterceptor nextInterceptor, Name name, ModificationItem[] items ) throws NamingException
{
- nextInterceptor.process( call );
+ nextInterceptor.modify( name, items );
// add operational attributes after call in case the operation fails
Attributes attributes = new BasicAttributes();
BasicAttribute attribute = new BasicAttribute( "modifiersName" );
- attribute.add( getPrincipal( call ).getName() );
+ attribute.add( getPrincipal().getName() );
attributes.put( attribute );
attribute = new BasicAttribute( "modifyTimestamp" );
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- nexus.modify( call.getName(), DirContext.REPLACE_ATTRIBUTE, attributes );
+ nexus.modify( name, DirContext.REPLACE_ATTRIBUTE, attributes );
}
- protected void process( NextInterceptor nextInterceptor, ModifyRN call ) throws NamingException
+ public void modifyRn( NextInterceptor nextInterceptor, Name name, String newRn, boolean deleteOldRn ) throws NamingException
{
- nextInterceptor.process( call );
+ nextInterceptor.modifyRn( name, newRn, deleteOldRn );
// add operational attributes after call in case the operation fails
Attributes attributes = new BasicAttributes();
BasicAttribute attribute = new BasicAttribute( "modifiersName" );
- attribute.add( getPrincipal( call ).getName() );
+ attribute.add( getPrincipal().getName() );
attributes.put( attribute );
attribute = new BasicAttribute( "modifyTimestamp" );
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- Name newDn = call.getName().getSuffix( 1 ).add( call.getNewRelativeName() );
+ Name newDn = name.getSuffix( 1 ).add( newRn );
nexus.modify( newDn, DirContext.REPLACE_ATTRIBUTE, attributes );
}
- protected void process( NextInterceptor nextInterceptor, Move call ) throws NamingException
+ public void move( NextInterceptor nextInterceptor, Name name, Name newParentName ) throws NamingException
{
- nextInterceptor.process( call );
+ nextInterceptor.move( name, newParentName );
// add operational attributes after call in case the operation fails
Attributes attributes = new BasicAttributes();
BasicAttribute attribute = new BasicAttribute( "modifiersName" );
- attribute.add( getPrincipal( call ).getName() );
+ attribute.add( getPrincipal().getName() );
attributes.put( attribute );
attribute = new BasicAttribute( "modifyTimestamp" );
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- nexus.modify( call.getNewParentName(), DirContext.REPLACE_ATTRIBUTE, attributes );
+ nexus.modify( newParentName, DirContext.REPLACE_ATTRIBUTE, attributes );
}
- protected void process( NextInterceptor nextInterceptor, MoveAndModifyRN call ) throws NamingException
+ public void move( NextInterceptor nextInterceptor, Name name, Name newParentName, String newRn, boolean deleteOldRn ) throws NamingException
{
- nextInterceptor.process( call );
+ nextInterceptor.move( name, newParentName, newRn, deleteOldRn );
// add operational attributes after call in case the operation fails
Attributes attributes = new BasicAttributes();
BasicAttribute attribute = new BasicAttribute( "modifiersName" );
- attribute.add( getPrincipal( call ).getName() );
+ attribute.add( getPrincipal().getName() );
attributes.put( attribute );
attribute = new BasicAttribute( "modifyTimestamp" );
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- nexus.modify( call.getNewParentName(), DirContext.REPLACE_ATTRIBUTE, attributes );
+ nexus.modify( newParentName, DirContext.REPLACE_ATTRIBUTE, attributes );
}
- protected void process( NextInterceptor nextInterceptor, Lookup call ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, Name name ) throws NamingException
{
- nextInterceptor.process( call );
-
- Attributes attributes = ( Attributes ) call.getReturnValue();
- Attributes retval = ( Attributes ) attributes.clone();
- filter( retval );
- call.setReturnValue( retval );
+ Attributes result = nextInterceptor.lookup( name );
+ if ( result == null )
+ {
+ return null;
+ }
+ filter( result );
+ return result;
}
- protected void process( NextInterceptor nextInterceptor, LookupWithAttrIds call ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, Name name, String[] attrIds ) throws NamingException
{
- nextInterceptor.process( call );
-
- Attributes attributes = ( Attributes ) call.getReturnValue();
- if ( attributes == null )
+ Attributes result = nextInterceptor.lookup( name, attrIds );
+ if ( result == null )
{
- return;
+ return null;
}
- Attributes retval = ( Attributes ) attributes.clone();
- filter( call.getName(), retval, call.getAttributeIds() );
- call.setReturnValue( retval );
+ filter( name, result, attrIds );
+ return result;
}
- protected void process( NextInterceptor nextInterceptor, List call ) throws NamingException
+ public NamingEnumeration list( NextInterceptor nextInterceptor, Name base ) throws NamingException
{
- nextInterceptor.process( call );
-
- NamingEnumeration e;
- ResultFilteringEnumeration retval;
- LdapContext ctx = ( LdapContext ) call.getContextStack().peek();
- e = ( NamingEnumeration ) call.getReturnValue();
- retval = new ResultFilteringEnumeration( e, new SearchControls(), ctx, SEARCH_FILTER );
- call.setReturnValue( retval );
+ NamingEnumeration e = nextInterceptor.list( base );
+ LdapContext ctx =
+ ( LdapContext ) InvocationStack.getInstance().peek().getTarget();
+ return new ResultFilteringEnumeration( e, new SearchControls(), ctx, SEARCH_FILTER );
}
- protected void process( NextInterceptor nextInterceptor, Search call ) throws NamingException
+ public NamingEnumeration search( NextInterceptor nextInterceptor,
+ Name base, Map env, ExprNode filter,
+ SearchControls searchCtls ) throws NamingException
{
- nextInterceptor.process( call );
-
- SearchControls searchControls = call.getControls();
- if ( searchControls.getReturningAttributes() != null )
+ NamingEnumeration e = nextInterceptor.search( base, env, filter, searchCtls );
+ if ( searchCtls.getReturningAttributes() != null )
{
- return;
+ return e;
}
- NamingEnumeration e;
- ResultFilteringEnumeration retval;
- LdapContext ctx = ( LdapContext ) call.getContextStack().peek();
- e = ( NamingEnumeration ) call.getReturnValue();
- retval = new ResultFilteringEnumeration( e, searchControls, ctx, SEARCH_FILTER );
- call.setReturnValue( retval );
+ LdapContext ctx =
+ ( LdapContext ) InvocationStack.getInstance().peek().getTarget();
+ return new ResultFilteringEnumeration( e, searchCtls, ctx, SEARCH_FILTER );
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartitionNexus.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartitionNexus.java?rev=191792&r1=191791&r2=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartitionNexus.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartitionNexus.java Wed Jun 22 03:37:56 2005
@@ -141,7 +141,7 @@
*
* @return the attributes of the RootDSE
*/
- public abstract Attributes getRootDSE();
+ public abstract Attributes getRootDSE() throws NamingException;
public abstract ContextPartition getSystemPartition();
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java?rev=191792&r1=191791&r2=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java Wed Jun 22 03:37:56 2005
@@ -720,6 +720,6 @@
clonedDn.remove( clonedDn.size() - 1 );
}
- throw new NameNotFoundException();
+ throw new NameNotFoundException( dn.toString() );
}
}
Copied: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeSearchResult.java (from r191637, directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/PartitionStoreSearchResult.java)
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeSearchResult.java?p2=directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeSearchResult.java&p1=directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/PartitionStoreSearchResult.java&r1=191637&r2=191792&rev=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/PartitionStoreSearchResult.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeSearchResult.java Wed Jun 22 03:37:56 2005
@@ -31,7 +31,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class PartitionStoreSearchResult extends SearchResult
+public class BTreeSearchResult extends SearchResult
{
private static final long serialVersionUID = 3976739172700860977L;
@@ -52,7 +52,7 @@
* @param obj the object if any
* @param attrs the attributes of the entry
*/
- public PartitionStoreSearchResult( BigInteger id, String name, Object obj,
+ public BTreeSearchResult( BigInteger id, String name, Object obj,
Attributes attrs )
{
super( name, obj, attrs );
@@ -69,7 +69,7 @@
* @param attrs the attributes of the entry
* @param isRelative whether or not the name is relative to the base
*/
- public PartitionStoreSearchResult( BigInteger id, String name, Object obj,
+ public BTreeSearchResult( BigInteger id, String name, Object obj,
Attributes attrs, boolean isRelative )
{
super( name, obj, attrs, isRelative );
@@ -86,7 +86,7 @@
* @param obj the object if any
* @param attrs the attributes of the entry
*/
- public PartitionStoreSearchResult( BigInteger id, String name, String className,
+ public BTreeSearchResult( BigInteger id, String name, String className,
Object obj, Attributes attrs )
{
super( name, className, obj, attrs );
@@ -104,7 +104,7 @@
* @param attrs the attributes of the entry
* @param isRelative whether or not the name is relative to the base
*/
- public PartitionStoreSearchResult( BigInteger id, String name, String className,
+ public BTreeSearchResult( BigInteger id, String name, String className,
Object obj, Attributes attrs, boolean isRelative )
{
super( name, className, obj, attrs, isRelative );
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeSearchResultEnumeration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeSearchResultEnumeration.java?rev=191792&r1=191791&r2=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeSearchResultEnumeration.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeSearchResultEnumeration.java Wed Jun 22 03:37:56 2005
@@ -119,7 +119,7 @@
}
}
- return new PartitionStoreSearchResult( rec.getEntryId(), name, null, entry );
+ return new BTreeSearchResult( rec.getEntryId(), name, null, entry );
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/IndexRecord.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/IndexRecord.java?rev=191792&r1=191791&r2=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/IndexRecord.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/IndexRecord.java Wed Jun 22 03:37:56 2005
@@ -119,7 +119,12 @@
*/
public Attributes getAttributes()
{
- return entry;
+ if( entry == null )
+ {
+ return null;
+ }
+
+ return ( Attributes ) entry.clone();
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmTable.java?rev=191792&r1=191791&r2=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmTable.java Wed Jun 22 03:37:56 2005
@@ -296,7 +296,8 @@
}
}
- return getRaw( key );
+ Object value = getRaw( key );
+ return value;
}
@@ -1113,7 +1114,7 @@
ne.setRootCause( e );
throw ne;
}
-
+
return val;
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java?rev=191792&r1=191791&r2=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java Wed Jun 22 03:37:56 2005
@@ -20,8 +20,10 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import java.util.Set;
+import javax.naming.Name;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
@@ -46,15 +48,12 @@
import org.apache.ldap.common.schema.SchemaUtils;
import org.apache.ldap.common.schema.Syntax;
import org.apache.ldap.common.util.SingletonEnumeration;
+import org.apache.ldap.server.configuration.InterceptorConfiguration;
import org.apache.ldap.server.enumeration.ResultFilteringEnumeration;
import org.apache.ldap.server.enumeration.SearchResultFilter;
import org.apache.ldap.server.interceptor.BaseInterceptor;
-import org.apache.ldap.server.interceptor.InterceptorContext;
import org.apache.ldap.server.interceptor.NextInterceptor;
-import org.apache.ldap.server.invocation.List;
-import org.apache.ldap.server.invocation.Lookup;
-import org.apache.ldap.server.invocation.LookupWithAttrIds;
-import org.apache.ldap.server.invocation.Search;
+import org.apache.ldap.server.jndi.ContextFactoryConfiguration;
import org.apache.ldap.server.jndi.ServerLdapContext;
import org.apache.ldap.server.partition.ContextPartitionNexus;
@@ -101,10 +100,10 @@
}
- public void init( InterceptorContext ctx ) throws NamingException
+ public void init( ContextFactoryConfiguration factoryCfg, InterceptorConfiguration cfg ) throws NamingException
{
- this.nexus = ctx.getRootNexus();
- this.globalRegistries = ctx.getGlobalRegistries();
+ this.nexus = factoryCfg.getPartitionNexus();
+ this.globalRegistries = factoryCfg.getGlobalRegistries();
attributeRegistry = globalRegistries.getAttributeTypeRegistry();
binaryAttributeFilter = new BinaryAttributeFilter();
@@ -119,32 +118,25 @@
}
- protected void process( NextInterceptor nextInterceptor, List call ) throws NamingException
+ public NamingEnumeration list( NextInterceptor nextInterceptor, Name base ) throws NamingException
{
- nextInterceptor.process( call );
-
- NamingEnumeration e;
- ResultFilteringEnumeration retval;
- LdapContext ctx = ( LdapContext ) call.getContextStack().peek();
- e = ( NamingEnumeration ) call.getReturnValue();
- retval = new ResultFilteringEnumeration( e, new SearchControls(), ctx, binaryAttributeFilter );
- call.setReturnValue( retval );
+ NamingEnumeration e = nextInterceptor.list( base );
+ LdapContext ctx = getContext();
+ return new ResultFilteringEnumeration( e, new SearchControls(), ctx, binaryAttributeFilter );
}
- protected void process( NextInterceptor nextInterceptor, Search call ) throws NamingException
+ public NamingEnumeration search( NextInterceptor nextInterceptor,
+ Name base, Map env, ExprNode filter,
+ SearchControls searchCtls ) throws NamingException
{
// check to make sure the DN searched for is a subentry
- if ( !subentryDn.equals( call.getBaseName().toString() ) )
+ if ( !subentryDn.equals( base.toString() ) )
{
- nextInterceptor.process( call );
- return;
+ return nextInterceptor.search( base, env, filter, searchCtls );
}
- boolean bypass = false;
- SearchControls searchControls = call.getControls();
- ExprNode filter = call.getFilter();
- if ( searchControls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
+ if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
filter instanceof SimpleNode )
{
SimpleNode node = ( SimpleNode ) filter;
@@ -155,14 +147,12 @@
)
{
// call.setBypass( true );
- Attributes attrs = getSubschemaEntry( searchControls.getReturningAttributes() );
- SearchResult result = new SearchResult( call.getBaseName().toString(), null, attrs );
- SingletonEnumeration e = new SingletonEnumeration( result );
- call.setReturnValue( e );
- bypass = true;
+ Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes() );
+ SearchResult result = new SearchResult( base.toString(), null, attrs );
+ return new SingletonEnumeration( result );
}
}
- else if ( searchControls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
+ else if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
filter instanceof PresenceNode )
{
PresenceNode node = ( PresenceNode ) filter;
@@ -170,30 +160,21 @@
if ( node.getAttribute().equalsIgnoreCase( "objectClass" ) )
{
// call.setBypass( true );
- Attributes attrs = getSubschemaEntry( searchControls.getReturningAttributes() );
- SearchResult result = new SearchResult( call.getBaseName().toString(), null, attrs );
- SingletonEnumeration e = new SingletonEnumeration( result );
- call.setReturnValue( e );
- bypass = true;
+ Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes() );
+ SearchResult result = new SearchResult( base.toString(), null, attrs );
+ return new SingletonEnumeration( result );
}
}
- if ( !bypass )
- {
- nextInterceptor.process( call );
- }
+ NamingEnumeration e = nextInterceptor.search( base, env, filter, searchCtls );
- if ( searchControls.getReturningAttributes() != null )
+ if ( searchCtls.getReturningAttributes() != null )
{
- return;
+ return e;
}
- NamingEnumeration e;
- ResultFilteringEnumeration retval;
- LdapContext ctx = ( LdapContext ) call.getContextStack().peek();
- e = ( NamingEnumeration ) call.getReturnValue();
- retval = new ResultFilteringEnumeration( e, searchControls, ctx, binaryAttributeFilter );
- call.setReturnValue( retval );
+ LdapContext ctx = getContext();
+ return new ResultFilteringEnumeration( e, searchCtls, ctx, binaryAttributeFilter );
}
@@ -323,32 +304,27 @@
}
- protected void process( NextInterceptor nextInterceptor, Lookup call ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, Name name ) throws NamingException
{
- nextInterceptor.process( call );
+ Attributes result = nextInterceptor.lookup( name );
- ServerLdapContext ctx = ( ServerLdapContext ) call.getContextStack().peek();
- Attributes attributes = ( Attributes ) call.getReturnValue();
- Attributes retval = ( Attributes ) attributes.clone();
- doFilter( ctx, retval );
- call.setReturnValue( retval );
+ ServerLdapContext ctx = ( ServerLdapContext ) getContext();
+ doFilter( ctx, result );
+ return result;
}
- protected void process( NextInterceptor nextInterceptor, LookupWithAttrIds call ) throws NamingException
+ public Attributes lookup( NextInterceptor nextInterceptor, Name name, String[] attrIds ) throws NamingException
{
- nextInterceptor.process( call );
-
- ServerLdapContext ctx = ( ServerLdapContext ) call.getContextStack().peek();
- Attributes attributes = ( Attributes ) call.getReturnValue();
- if ( attributes == null )
+ Attributes result = nextInterceptor.lookup( name, attrIds );
+ if ( result == null )
{
- return;
+ return null;
}
- Attributes retval = ( Attributes ) attributes.clone();
- doFilter( ctx, retval );
- call.setReturnValue( retval );
+ ServerLdapContext ctx = ( ServerLdapContext ) getContext();
+ doFilter( ctx, result );
+ return result;
}
Modified: directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/operational/OperationalAttributeServiceTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/operational/OperationalAttributeServiceTest.java?rev=191792&r1=191791&r2=191792&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/operational/OperationalAttributeServiceTest.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/operational/OperationalAttributeServiceTest.java Wed Jun 22 03:37:56 2005
@@ -82,8 +82,6 @@
SearchResult result = ( SearchResult ) list.next();
list.close();
- System.out.println( result );
-
assertNotNull( result.getAttributes().get( "ou" ) );
assertNotNull( result.getAttributes().get( CREATORS_NAME ) );
assertNotNull( result.getAttributes().get( CREATE_TIMESTAMP ) );