You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/04/30 01:52:00 UTC
svn commit: r1332028 - in /directory/apacheds/branches/index-work:
core-api/src/main/java/org/apache/directory/server/core/api/changelog/
core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/
core-shared/src/main/java/org/apa...
Author: elecharny
Date: Sun Apr 29 23:51:59 2012
New Revision: 1332028
URL: http://svn.apache.org/viewvc?rev=1332028&view=rev
Log:
o Removed the useless Scope class from core-api (using the SearchScope enum instead)
o Get rid of some useless calls to searchContext.getSearchControls()
Removed:
directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/changelog/Scope.java
Modified:
directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogSearchEngine.java
directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java
directory/apacheds/branches/index-work/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
directory/apacheds/branches/index-work/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
directory/apacheds/branches/index-work/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
directory/apacheds/branches/index-work/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java
directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
directory/apacheds/branches/index-work/xdbm-tools/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
Modified: directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogSearchEngine.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogSearchEngine.java (original)
+++ directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogSearchEngine.java Sun Apr 29 23:51:59 2012
@@ -24,6 +24,7 @@ import org.apache.directory.server.core.
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.filter.ExprNode;
import org.apache.directory.shared.ldap.model.ldif.ChangeType;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.ObjectClass;
@@ -158,7 +159,7 @@ public interface ChangeLogSearchEngine
* @return the set of changes that occurred on an entry and/or it's descendants depending on the scope
* @throws Exception if there are failures accessing the store
*/
- Cursor<ChangeLogEvent> find( Dn base, Scope scope, RevisionOrder order ) throws Exception;
+ Cursor<ChangeLogEvent> find( Dn base, SearchScope scope, RevisionOrder order ) throws Exception;
/**
Modified: directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java (original)
+++ directory/apacheds/branches/index-work/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchingOperationContext.java Sun Apr 29 23:51:59 2012
@@ -40,6 +40,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
import org.apache.directory.shared.ldap.model.schema.SchemaUtils;
import org.apache.directory.shared.util.StringConstants;
+import org.apache.directory.shared.util.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: directory/apacheds/branches/index-work/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/index-work/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java Sun Apr 29 23:51:59 2012
@@ -83,6 +83,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.name.DnUtils;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
+import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
import org.apache.directory.shared.ldap.model.schema.Normalizer;
import org.apache.directory.shared.ldap.model.schema.UsageEnum;
import org.apache.directory.shared.ldap.util.tree.DnNode;
@@ -660,15 +661,13 @@ public class DefaultPartitionNexus exten
private EntryFilteringCursor searchRootDse( SearchOperationContext searchContext ) throws LdapException
{
- SearchControls searchControls = searchContext.getSearchControls();
-
- String[] ids = searchControls.getReturningAttributes();
+ Set<AttributeTypeOptions> ids = searchContext.getReturningAttributes();
// -----------------------------------------------------------
// If nothing is asked for then we just return the entry asis.
// We let other mechanisms filter out operational attributes.
// -----------------------------------------------------------
- if ( ( ids == null ) || ( ids.length == 0 ) )
+ if ( ( ids == null ) || ( ids.size() == 0 ) )
{
Entry rootDse = getRootDse( null );
return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( rootDse ), searchContext );
@@ -684,17 +683,15 @@ public class DefaultPartitionNexus exten
boolean allOperationalAttributes = searchContext.isAllOperationalAttributes();
boolean noAttribute = searchContext.isNoAttributes();
- for ( String id : ids )
+ for ( AttributeTypeOptions id : ids )
{
- String idTrimmed = id.trim();
-
try
{
- realIds.add( schemaManager.getAttributeTypeRegistry().getOidByName( idTrimmed ) );
+ realIds.add( id.getAttributeType().getOid() );
}
catch ( Exception e )
{
- realIds.add( idTrimmed );
+ realIds.add( id.getAttributeType().getName() );
}
}
@@ -744,7 +741,6 @@ public class DefaultPartitionNexus exten
public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
Dn base = searchContext.getDn();
- SearchControls searchCtls = searchContext.getSearchControls();
ExprNode filter = searchContext.getFilter();
// TODO since we're handling the *, and + in the EntryFilteringCursor
@@ -755,11 +751,11 @@ public class DefaultPartitionNexus exten
// We are searching from the rootDSE. We have to distinguish three cases :
// 1) The scope is OBJECT : we have to return the rootDSE entry, filtered
// 2) The scope is ONELEVEL : we have to return all the Naming Contexts
- boolean isObjectScope = searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE;
+ boolean isObjectScope = searchContext.getScope() == SearchScope.OBJECT;
- boolean isOnelevelScope = searchCtls.getSearchScope() == SearchControls.ONELEVEL_SCOPE;
+ boolean isOnelevelScope = searchContext.getScope() == SearchScope.ONELEVEL;
- boolean isSublevelScope = searchCtls.getSearchScope() == SearchControls.SUBTREE_SCOPE;
+ boolean isSublevelScope = searchContext.getScope() == SearchScope.SUBTREE;
// test for (objectClass=*)
boolean isSearchAll = false;
Modified: directory/apacheds/branches/index-work/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/branches/index-work/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Sun Apr 29 23:51:59 2012
@@ -79,6 +79,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.filter.ExprNode;
import org.apache.directory.shared.ldap.model.filter.OrNode;
import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.normalizers.ConcreteNameComponentNormalizer;
@@ -1255,9 +1256,9 @@ public class AciAuthorizationInterceptor
EntryFilteringCursor cursor = next( searchContext );
boolean isSubschemaSubentryLookup = subschemaSubentryDn.equals( searchContext.getDn().getNormName() );
- SearchControls searchCtls = searchContext.getSearchControls();
- boolean isRootDseLookup = searchContext.getDn().size() == 0
- && searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE;
+
+ boolean isRootDseLookup = ( searchContext.getDn().size() == 0 )
+ && ( searchContext.getScope() == SearchScope.OBJECT );
if ( isPrincipalAnAdministrator( principalDn )
|| !directoryService.isAccessControlEnabled() || isRootDseLookup
Modified: directory/apacheds/branches/index-work/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/branches/index-work/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Sun Apr 29 23:51:59 2012
@@ -82,6 +82,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.filter.SimpleNode;
import org.apache.directory.shared.ldap.model.filter.SubstringNode;
import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
import org.apache.directory.shared.ldap.model.message.controls.Cascade;
import org.apache.directory.shared.ldap.model.name.Ava;
import org.apache.directory.shared.ldap.model.name.Dn;
@@ -1494,7 +1495,7 @@ public class SchemaInterceptor extends B
// The user was searching into the subSchemaSubEntry
// This kind of search _must_ be limited to OBJECT scope (the subSchemaSubEntry
// does not have any sub level)
- if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE )
+ if ( searchContext.getScope() == SearchScope.OBJECT )
{
// The filter can be an equality or a presence, but nothing else
if ( filter instanceof SimpleNode )
Modified: directory/apacheds/branches/index-work/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java (original)
+++ directory/apacheds/branches/index-work/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java Sun Apr 29 23:51:59 2012
@@ -728,8 +728,6 @@ public class ConfigPartitionReader
// Prepare the search request
AttributeType adsdAt = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
EqualityNode<?> filter = new EqualityNode( adsdAt, new StringValue( name ) );
- SearchControls controls = new SearchControls();
- controls.setSearchScope( scope.ordinal() );
IndexCursor<Long, Entry, Long> cursor = null;
// Create a container for all the read beans
@@ -738,7 +736,7 @@ public class ConfigPartitionReader
try
{
// Do the search
- cursor = se.cursor( baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls );
+ cursor = se.cursor( baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, scope );
// First, check if we have some entries to process.
if ( !cursor.next() )
Modified: directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java (original)
+++ directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java Sun Apr 29 23:51:59 2012
@@ -23,25 +23,20 @@ package org.apache.directory.server.core
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.naming.directory.SearchControls;
-
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.GetRootDseOperationContext;
import org.apache.directory.server.core.api.interceptor.context.HasEntryOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
@@ -85,6 +80,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.filter.ExprNode;
import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
import org.apache.directory.shared.ldap.model.name.Ava;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.name.Rdn;
@@ -954,13 +950,13 @@ public abstract class AbstractBTreeParti
{
try
{
- SearchControls searchCtls = searchContext.getSearchControls();
+ SearchScope scope = searchContext.getScope();
IndexCursor<ID, Entry, ID> underlying;
Dn dn = searchContext.getDn();
AliasDerefMode derefMode = searchContext.getAliasDerefMode();
ExprNode filter = searchContext.getFilter();
- underlying = searchEngine.cursor( dn, derefMode, filter, searchCtls );
+ underlying = searchEngine.cursor( dn, derefMode, filter, scope );
return new BaseEntryFilteringCursor( new EntryCursorAdaptor<ID>( this, underlying ), searchContext );
}
Modified: directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java (original)
+++ directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java Sun Apr 29 23:51:59 2012
@@ -24,6 +24,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.filter.ExprNode;
import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.server.xdbm.IndexCursor;
@@ -79,12 +80,12 @@ public interface SearchEngine<E, ID>
* @param base the search base
* @param aliasDerefMode the alias dereferencing mode to use
* @param filter the search filter AST root
- * @param searchCtls the JNDI search controls
+ * @param scope the Scope
* @return enumeration over SearchResults
* @throws Exception if the search fails
*/
IndexCursor<ID, E, ID> cursor( Dn base, AliasDerefMode aliasDerefMode, ExprNode filter,
- SearchControls searchCtls ) throws Exception;
+ SearchScope scope ) throws Exception;
/**
Modified: directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/branches/index-work/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Sun Apr 29 23:51:59 2012
@@ -100,7 +100,7 @@ public class DefaultSearchEngine<ID exte
* @see SearchEngine#cursor(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.message.AliasDerefMode, ExprNode, SearchControls)
*/
public IndexCursor<ID, Entry, ID> cursor( Dn base, AliasDerefMode aliasDerefMode, ExprNode filter,
- SearchControls searchCtls ) throws Exception
+ SearchScope scope ) throws Exception
{
Dn effectiveBase;
ID baseId = db.getEntryId( base );
@@ -156,7 +156,7 @@ public class DefaultSearchEngine<ID exte
effectiveBaseId = db.getEntryId( effectiveBase );
}
- if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE )
+ if ( scope == SearchScope.OBJECT )
{
IndexEntry<ID, ID> indexEntry = new ForwardIndexEntry<ID, ID>();
indexEntry.setId( effectiveBaseId );
@@ -175,8 +175,7 @@ public class DefaultSearchEngine<ID exte
// Add the scope node using the effective base to the filter
BranchNode root = new AndNode();
- ExprNode node = new ScopeNode<ID>( aliasDerefMode, effectiveBase, effectiveBaseId, SearchScope.getSearchScope( searchCtls
- .getSearchScope() ) );
+ ExprNode node = new ScopeNode<ID>( aliasDerefMode, effectiveBase, effectiveBaseId, scope );
root.getChildren().add( node );
root.getChildren().add( filter );
Modified: directory/apacheds/branches/index-work/xdbm-tools/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/xdbm-tools/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java?rev=1332028&r1=1332027&r2=1332028&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/xdbm-tools/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java (original)
+++ directory/apacheds/branches/index-work/xdbm-tools/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java Sun Apr 29 23:51:59 2012
@@ -72,6 +72,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.ldif.LdifEntry;
import org.apache.directory.shared.ldap.model.ldif.LdifReader;
import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -629,19 +630,19 @@ public class PartitionFrame extends JFra
return false;
}
- SearchControls ctls = new SearchControls();
+ SearchScope searchScope = null;
if ( scope.equals( FilterDialog.BASE_SCOPE ) )
{
- ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+ searchScope = SearchScope.OBJECT;
}
else if ( scope.equals( FilterDialog.SINGLE_SCOPE ) )
{
- ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ searchScope = SearchScope.ONELEVEL;
}
else if ( scope.equals( FilterDialog.SUBTREE_SCOPE ) )
{
- ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+ searchScope = SearchScope.SUBTREE;
}
else
{
@@ -655,7 +656,7 @@ public class PartitionFrame extends JFra
}
IndexCursor<Long, Entry, Long> cursor = partition.getSearchEngine().cursor( new Dn( base ),
- AliasDerefMode.DEREF_ALWAYS, root, ctls );
+ AliasDerefMode.DEREF_ALWAYS, root, searchScope );
String[] cols = new String[2];
cols[0] = "id";
cols[1] = "dn";