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 2008/05/22 22:00:40 UTC
svn commit: r659229 [2/2] - in /directory/apacheds/branches/bigbang:
core-entry/src/main/java/org/apache/directory/server/core/entry/
core/src/main/java/org/apache/directory/server/core/authn/
core/src/main/java/org/apache/directory/server/core/authz/ ...
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=659229&r1=659228&r2=659229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Thu May 22 13:00:38 2008
@@ -22,12 +22,12 @@
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.cursor.Cursor;
import org.apache.directory.server.core.cursor.SingletonCursor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
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.filtering.EntryFilteringCursor;
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;
@@ -63,7 +63,6 @@
import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeIdentifierException;
import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
-import org.apache.directory.shared.ldap.exception.LdapNamingException;
import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.PresenceNode;
@@ -79,14 +78,13 @@
import org.apache.directory.shared.ldap.schema.UsageEnum;
import org.apache.directory.shared.ldap.util.DateUtils;
import org.apache.directory.shared.ldap.util.NamespaceTools;
-import org.apache.directory.shared.ldap.util.SingletonEnumeration;
import org.apache.directory.shared.ldap.util.StringTools;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.naming.ConfigurationException;
import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
import javax.naming.directory.SearchControls;
import javax.naming.ldap.LdapContext;
import java.io.IOException;
@@ -231,9 +229,9 @@
*
* @return the root entry for the DSA
*/
- public ServerEntry getContextEntry()
+ public ClonedServerEntry getContextEntry()
{
- return rootDSE;
+ return new ClonedServerEntry( rootDSE );
}
@@ -783,9 +781,9 @@
}
- public ServerEntry getRootDSE( GetRootDSEOperationContext getRootDSEContext )
+ public ClonedServerEntry getRootDSE( GetRootDSEOperationContext getRootDSEContext )
{
- return rootDSE;
+ return new ClonedServerEntry( rootDSE );
}
@@ -867,14 +865,14 @@
/**
* @see Partition#list(ListOperationContext)
*/
- public Cursor<ServerEntry> list( ListOperationContext opContext ) throws Exception
+ public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
{
Partition backend = getPartition( opContext.getDn() );
return backend.list( opContext );
}
- public Cursor<ServerEntry> search( SearchOperationContext opContext )
+ public EntryFilteringCursor search( SearchOperationContext opContext )
throws Exception
{
LdapDN base = opContext.getDn();
@@ -903,7 +901,7 @@
if ( ( ids == null ) || ( ids.length == 0 ) )
{
ServerEntry rootDSE = (ServerEntry)getRootDSE( null ).clone();
- return new SingletonCursor<ServerEntry>( rootDSE );
+ return new EntryFilteringCursor( new SingletonCursor<ServerEntry>( rootDSE ), opContext );
}
// -----------------------------------------------------------
@@ -949,14 +947,14 @@
if ( containsOneDotOne )
{
ServerEntry serverEntry = new DefaultServerEntry( registries, base );
- return new SingletonCursor<ServerEntry>( serverEntry );
+ return new EntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), opContext );
}
// return everything
if ( containsAsterisk && containsPlus )
{
ServerEntry rootDSE = (ServerEntry)getRootDSE( null ).clone();
- return new SingletonCursor<ServerEntry>( rootDSE );
+ return new EntryFilteringCursor( new SingletonCursor<ServerEntry>( rootDSE ), opContext );
}
ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() );
@@ -981,7 +979,7 @@
}
}
- return new SingletonCursor<ServerEntry>( serverEntry );
+ return new EntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), opContext );
}
throw new LdapNameNotFoundException();
@@ -992,13 +990,13 @@
}
- public ServerEntry lookup( LookupOperationContext opContext ) throws Exception
+ public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
{
LdapDN dn = opContext.getDn();
if ( dn.size() == 0 )
{
- ServerEntry retval = new DefaultServerEntry( registries, opContext.getDn() );
+ ClonedServerEntry retval = new ClonedServerEntry( rootDSE );
Set<AttributeType> attributeTypes = rootDSE.getAttributeTypes();
if ( opContext.getAttrsId() != null )
@@ -1007,26 +1005,17 @@
{
String oid = attributeType.getOid();
- if ( opContext.getAttrsId().contains( oid ) )
+ if ( ! opContext.getAttrsId().contains( oid ) )
{
- EntryAttribute attr = rootDSE.get( oid );
- retval.put( (ServerAttribute)attr.clone() );
+ retval.removeAttributes( attributeType );
}
-
}
+ return retval;
}
else
{
- for ( AttributeType attributeType:attributeTypes )
- {
- String id = attributeType.getName();
-
- EntryAttribute attr = rootDSE.get( id );
- retval.put( (ServerAttribute)attr.clone() );
- }
+ return new ClonedServerEntry( rootDSE );
}
-
- return retval;
}
Partition backend = getPartition( dn );
@@ -1167,7 +1156,7 @@
}
- public ServerEntry lookup( Long id ) throws Exception
+ public ClonedServerEntry lookup( Long id ) throws Exception
{
// TODO not implemented until we can use id to figure out the partition using
// the partition ID component of the 64 bit Long identifier
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?rev=659229&r1=659228&r2=659229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Thu May 22 13:00:38 2008
@@ -21,9 +21,10 @@
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.entry.ServerSearchResult;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
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;
@@ -91,7 +92,7 @@
*
* @return the entry for the suffix of this Partition.
*/
- ServerEntry getContextEntry();
+ ClonedServerEntry getContextEntry();
/**
@@ -239,7 +240,7 @@
* @return a NamingEnumeration containing objects of type {@link ServerSearchResult}
* @throws Exception if there are any problems
*/
- Cursor<ServerEntry> list( ListOperationContext opContext ) throws Exception;
+ EntryFilteringCursor list( ListOperationContext opContext ) throws Exception;
/**
@@ -253,11 +254,8 @@
* @param opContext The context containing the information used by the operation
* @throws Exception if there are any problems
* @return a NamingEnumeration containing objects of type
- * <a href="http://java.sun.com/j2se/1.4.2/docs/api/
- * javax/naming/directory/SearchResult.html">SearchResult</a>.
*/
- Cursor<ServerEntry> search( SearchOperationContext opContext )
- throws Exception;
+ EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception;
/**
@@ -272,10 +270,10 @@
* @return an Attributes object representing the entry
* @throws Exception if there are any problems
*/
- ServerEntry lookup( LookupOperationContext lookupContext ) throws Exception;
+ ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception;
- ServerEntry lookup( Long id ) throws Exception;
+ ClonedServerEntry lookup( Long id ) throws Exception;
/**
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java?rev=659229&r1=659228&r2=659229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java Thu May 22 13:00:38 2008
@@ -29,7 +29,7 @@
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.entry.ClonedServerEntry;
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;
@@ -166,7 +166,7 @@
*
* @return the attributes of the RootDSE
*/
- public abstract ServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception;
+ public abstract ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception;
/**