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/03/18 07:13:18 UTC
svn commit: r638228 [9/20] - in
/directory/sandbox/akarasulu/bigbang/apacheds: ./
apacheds-xbean-spring/src/site/ benchmarks/src/site/
bootstrap-extract/src/site/ bootstrap-partition/src/site/
bootstrap-plugin/src/main/java/org/apache/directory/server/...
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Mon Mar 17 23:12:41 2008
@@ -39,19 +39,17 @@
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.core.schema.SchemaService;
+import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.ldif.ChangeType;
-import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifEntry;
import org.apache.directory.shared.ldap.ldif.LdifUtils;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
/**
@@ -101,7 +99,7 @@
return;
}
- Entry forward = new Entry();
+ LdifEntry forward = new LdifEntry();
forward.setChangeType( ChangeType.Add );
forward.setDn( opContext.getDn().getUpName() );
@@ -114,7 +112,7 @@
forward.addAttribute( ServerEntryUtils.toAttributeImpl( addEntry.get( attributeType ) ) );
}
- Entry reverse = LdifUtils.reverseAdd( opContext.getDn() );
+ LdifEntry reverse = LdifUtils.reverseAdd( opContext.getDn() );
changeLog.log( getPrincipal(), forward, reverse );
}
@@ -127,11 +125,11 @@
{
// @todo make sure we're not putting in operational attributes that cannot be user modified
// must save the entry if change log is enabled
- Attributes attributes = null;
+ ServerEntry serverEntry = null;
if ( changeLog.isEnabled() && ! opContext.isCollateralOperation() )
{
- attributes = getAttributes( opContext );
+ serverEntry = getAttributes( opContext );
}
next.delete( opContext );
@@ -141,10 +139,10 @@
return;
}
- Entry forward = new Entry();
+ LdifEntry forward = new LdifEntry();
forward.setChangeType( ChangeType.Delete );
forward.setDn( opContext.getDn().getUpName() );
- Entry reverse = LdifUtils.reverseDel( opContext.getDn(), attributes );
+ LdifEntry reverse = LdifUtils.reverseDel( opContext.getDn(), ServerEntryUtils.toAttributesImpl( serverEntry ) );
changeLog.log( getPrincipal(), forward, reverse );
}
@@ -156,10 +154,10 @@
* @return the entry's attributes (may be immutable if the schema subentry)
* @throws NamingException on error accessing the entry's attributes
*/
- private Attributes getAttributes( OperationContext opContext ) throws NamingException
+ private ServerEntry getAttributes( OperationContext opContext ) throws NamingException
{
LdapDN dn = opContext.getDn();
- Attributes attributes;
+ ServerEntry serverEntry;
// @todo make sure we're not putting in operational attributes that cannot be user modified
Invocation invocation = InvocationStack.getInstance().peek();
@@ -171,22 +169,23 @@
}
else
{
- attributes = proxy.lookup( new LookupOperationContext( opContext.getRegistries(), dn ), PartitionNexusProxy.LOOKUP_BYPASS );
+ serverEntry = proxy.lookup( new LookupOperationContext( opContext.getRegistries(), dn ), PartitionNexusProxy.LOOKUP_BYPASS );
}
- return attributes;
+ return serverEntry;
}
public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
{
- Attributes attributes = null;
- boolean isDelete = AttributeUtils.getAttribute( opContext.getModItems(), entryDeleted ) != null;
+ ServerEntry serverEntry = null;
+ Modification modification = ServerEntryUtils.getModificationItem( opContext.getModItems(), entryDeleted );
+ boolean isDelete = ( modification != null );
if ( ! isDelete && ( changeLog.isEnabled() && ! opContext.isCollateralOperation() ) )
{
// @todo make sure we're not putting in operational attributes that cannot be user modified
- attributes = getAttributes( opContext );
+ serverEntry = getAttributes( opContext );
}
next.modify( opContext );
@@ -202,15 +201,20 @@
return;
}
- Entry forward = new Entry();
+ LdifEntry forward = new LdifEntry();
forward.setChangeType( ChangeType.Modify );
forward.setDn( opContext.getDn().getUpName() );
- for ( ModificationItemImpl modItem : opContext.getModItems() )
+
+ for ( Modification modItem : opContext.getModItems() )
{
- forward.addModificationItem( modItem );
+ forward.addModificationItem( ServerEntryUtils.toModificationItemImpl( modItem ) );
}
- Entry reverse = LdifUtils.reverseModify( opContext.getDn(), opContext.getModItems(), attributes );
+ LdifEntry reverse = LdifUtils.reverseModify(
+ opContext.getDn(),
+ ServerEntryUtils.toModificationItemImpl( opContext.getModItems() ),
+ ServerEntryUtils.toAttributesImpl( serverEntry ) );
+
changeLog.log( getPrincipal(), forward, reverse );
}
@@ -222,11 +226,12 @@
public void rename ( NextInterceptor next, RenameOperationContext renameContext ) throws NamingException
{
- Attributes attributes = null;
+ ServerEntry serverEntry = null;
+
if ( changeLog.isEnabled() && ! renameContext.isCollateralOperation() )
{
// @todo make sure we're not putting in operational attributes that cannot be user modified
- attributes = getAttributes( renameContext );
+ serverEntry = getAttributes( renameContext );
}
next.rename( renameContext );
@@ -236,13 +241,14 @@
return;
}
- Entry forward = new Entry();
+ LdifEntry forward = new LdifEntry();
forward.setChangeType( ChangeType.ModRdn );
forward.setDn( renameContext.getDn().getUpName() );
forward.setDeleteOldRdn( renameContext.getDelOldDn() );
- Entry reverse = LdifUtils.reverseModifyRdn( attributes, null, renameContext.getDn(),
+ LdifEntry reverse = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl( serverEntry ), null, renameContext.getDn(),
new Rdn( renameContext.getNewRdn() ) );
+
changeLog.log( getPrincipal(), forward, reverse );
}
@@ -250,13 +256,14 @@
public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opCtx )
throws NamingException
{
- Attributes attributes = null;
+ ServerEntry serverEntry = null;
+
if ( changeLog.isEnabled() && ! opCtx.isCollateralOperation() )
{
// @todo make sure we're not putting in operational attributes that cannot be user modified
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- attributes = proxy.lookup( new LookupOperationContext( opCtx.getRegistries(), opCtx.getDn() ),
+ serverEntry = proxy.lookup( new LookupOperationContext( opCtx.getRegistries(), opCtx.getDn() ),
PartitionNexusProxy.LOOKUP_BYPASS );
}
@@ -267,14 +274,14 @@
return;
}
- Entry forward = new Entry();
+ LdifEntry forward = new LdifEntry();
forward.setChangeType( ChangeType.ModDn );
forward.setDn( opCtx.getDn().getUpName() );
forward.setDeleteOldRdn( opCtx.getDelOldDn() );
forward.setNewRdn( opCtx.getNewRdn().getUpName() );
forward.setNewSuperior( opCtx.getParent().getUpName() );
- Entry reverse = LdifUtils.reverseModifyRdn( attributes, opCtx.getParent(), opCtx.getDn(),
+ LdifEntry reverse = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl( serverEntry ), opCtx.getParent(), opCtx.getDn(),
new Rdn( opCtx.getNewRdn() ) );
changeLog.log( getPrincipal(), forward, reverse );
}
@@ -289,12 +296,12 @@
return;
}
- Entry forward = new Entry();
+ LdifEntry forward = new LdifEntry();
forward.setChangeType( ChangeType.ModDn );
forward.setDn( opCtx.getDn().getUpName() );
forward.setNewSuperior( opCtx.getParent().getUpName() );
- Entry reverse = LdifUtils.reverseModifyDn( opCtx.getParent(), opCtx.getDn() );
+ LdifEntry reverse = LdifUtils.reverseModifyDn( opCtx.getParent(), opCtx.getDn() );
changeLog.log( getPrincipal(), forward, reverse );
}
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java Mon Mar 17 23:12:41 2008
@@ -23,7 +23,7 @@
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.cursor.Cursor;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifEntry;
import javax.naming.NamingException;
@@ -64,7 +64,7 @@
* @return the new revision reached after having applied the forward LDIF
* @throws NamingException if there are problems logging the change
*/
- long log( LdapPrincipal principal, Entry forward, Entry reverse ) throws NamingException;
+ long log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws NamingException;
/**
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java Mon Mar 17 23:12:41 2008
@@ -21,7 +21,7 @@
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifEntry;
import javax.naming.NamingException;
@@ -59,7 +59,7 @@
}
- public long log( LdapPrincipal principal, Entry forward, Entry reverse ) throws NamingException
+ public long log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws NamingException
{
if ( ! enabled )
{
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java Mon Mar 17 23:12:41 2008
@@ -40,7 +40,7 @@
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.cursor.Cursor;
import org.apache.directory.server.core.cursor.ListCursor;
-import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifEntry;
import org.apache.directory.shared.ldap.util.DateUtils;
import javax.naming.NamingException;
@@ -425,7 +425,7 @@
}
- public long log( LdapPrincipal principal, Entry forward, Entry reverse ) throws NamingException
+ public long log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws NamingException
{
currentRevision++;
ChangeLogEvent event = new ChangeLogEvent( currentRevision, DateUtils.getGeneralizedTime(),
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java Mon Mar 17 23:12:41 2008
@@ -19,6 +19,7 @@
package org.apache.directory.server.core.changelog;
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerAttribute;
import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -31,18 +32,17 @@
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerContext;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.ldif.ChangeType;
-import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifEntry;
import org.apache.directory.shared.ldap.ldif.LdifUtils;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.util.Base64;
import org.apache.directory.shared.ldap.util.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
@@ -263,7 +263,7 @@
buf.append( "\n#! deleteTimestamp: " );
buf.append( DateUtils.getGeneralizedTime() );
- Entry entry = new Entry();
+ LdifEntry entry = new LdifEntry();
entry.setDn( opContext.getDn().getUpName() );
entry.setChangeType( ChangeType.Delete );
buf.append( LdifUtils.convertToLdif( entry ) );
@@ -300,11 +300,11 @@
buf.append( opContext.getDn() );
buf.append( "\nchangetype: modify" );
- List<ModificationItemImpl> mods = opContext.getModItems();
+ List<Modification> mods = opContext.getModItems();
- for ( ModificationItemImpl mod :mods )
+ for ( Modification mod :mods )
{
- append( buf, mod.getAttribute(), getModOpStr( mod.getModificationOp() ) );
+ append( buf, (ServerAttribute)mod.getAttribute(), mod.getOperation().toString() + ": ");
}
buf.append( "\n" );
@@ -446,25 +446,23 @@
* @return the buffer argument to allow for call chaining.
* @throws NamingException if the attribute is not identified by the registry
*/
- private StringBuilder append( StringBuilder buf, Attribute attr ) throws NamingException
+ private StringBuilder append( StringBuilder buf, ServerAttribute attr ) throws NamingException
{
- String id = attr.getID();
- int sz = attr.size();
+ String id = attr.getId();
boolean isBinary = ! atRegistry.lookup( id ).getSyntax().isHumanReadable();
if ( isBinary )
{
- for ( int ii = 0; ii < sz; ii++ )
+ for ( Value<?> value:attr )
{
buf.append( "\n" );
buf.append( id );
buf.append( ":: " );
- Object value = attr.get( ii );
String encoded;
- if ( value instanceof String )
+ if ( value.get() instanceof String )
{
- encoded = ( String ) value;
+ encoded = ( String ) value.get();
try
{
@@ -477,19 +475,19 @@
}
else
{
- encoded = new String( Base64.encode( ( byte[] ) attr.get( ii ) ) );
+ encoded = new String( Base64.encode( ( byte[] ) value.get() ) );
}
buf.append( encoded );
}
}
else
{
- for ( int ii = 0; ii < sz; ii++ )
+ for ( Value<?> value:attr )
{
buf.append( "\n" );
buf.append( id );
buf.append( ": " );
- buf.append( attr.get( ii ) );
+ buf.append( value.get() );
}
}
@@ -512,46 +510,6 @@
/**
- * Gets a String representation of the JNDI attribute modificaion flag. Here are the mappings:
- * <table>
- * <tr><th>JNDI Constant</th><th>Returned String</th></tr>
- * <tr><td>DirContext.ADD_ATTRIBUTE</td><td>'add: '</td></tr>
- * <tr><td>DirContext.REMOVE_ATTRIBUTE</td><td>'delete: '</td></tr>
- * <tr><td>DirContext.REPLACE_ATTRIBUTE</td><td>'replace: '</td></tr>
- * </table>
- * <ul><li>
- * Note that the String in right hand column is quoted to show trailing space.
- * </li></ul>
- *
- * @param modOp the int value of the JNDI modification operation
- * @return the string representation of the JNDI Modification operation
- */
- private String getModOpStr( int modOp )
- {
- String opStr;
-
- switch( modOp )
- {
- case( DirContext.ADD_ATTRIBUTE ):
- opStr = "add: ";
- break;
-
- case( DirContext.REMOVE_ATTRIBUTE ):
- opStr = "delete: ";
- break;
-
- case( DirContext.REPLACE_ATTRIBUTE ):
- opStr = "replace: ";
- break;
-
- default:
- throw new IllegalArgumentException( "Undefined attribute modify operation: " + modOp );
- }
- return opStr;
- }
-
-
- /**
* Appends a modification delta instruction to an LDIF: i.e.
* <pre>
* add: telephoneNumber
@@ -566,11 +524,11 @@
* @return the buffer argument provided for chaining
* @throws NamingException if the modification attribute id is undefined
*/
- private StringBuilder append( StringBuilder buf, Attribute mod, String modOp ) throws NamingException
+ private StringBuilder append( StringBuilder buf, ServerAttribute mod, String modOp ) throws NamingException
{
buf.append( "\n" );
buf.append( modOp );
- buf.append( mod.getID() );
+ buf.append( mod.getId() );
append( buf, mod );
buf.append( "\n-" );
return buf;
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Mon Mar 17 23:12:41 2008
@@ -21,6 +21,10 @@
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
@@ -36,18 +40,13 @@
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.ServerSearchResult;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
import java.util.HashSet;
import java.util.Set;
@@ -82,19 +81,20 @@
*/
private final SearchResultFilter SEARCH_FILTER = new SearchResultFilter()
{
- public boolean accept( Invocation invocation, SearchResult result, SearchControls controls )
+ public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
throws NamingException
{
LdapDN name = ((ServerSearchResult)result).getDn();
- if ( !name.isNormalized() )
+ if ( name.isNormalized() == false )
{
name = LdapDN.normalize( name, atRegistry.getNormalizerMapping() );
}
- Attributes entry = result.getAttributes();
+ ServerEntry entry = result.getServerEntry();
String[] retAttrs = controls.getReturningAttributes();
addCollectiveAttributes( name, entry, retAttrs );
+ result.setServerEntry( entry );
return true;
}
};
@@ -120,15 +120,15 @@
* @param retAttrs array or attribute type to be specifically included in the result entry(s)
* @throws NamingException if there are problems accessing subentries
*/
- private void addCollectiveAttributes( LdapDN normName, Attributes entry, String[] retAttrs ) throws NamingException
+ private void addCollectiveAttributes( LdapDN normName, ServerEntry entry, String[] retAttrs ) throws NamingException
{
- Attribute caSubentries;
+ ServerAttribute caSubentries;
//noinspection StringEquality
if ( ( retAttrs == null ) || ( retAttrs.length != 1 ) || ( retAttrs[0] != SchemaConstants.ALL_USER_ATTRIBUTES ) )
{
- Attributes entryWithCAS = nexus.lookup( new LookupOperationContext( registries, normName, new String[] {
- SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT } ) );
+ ServerEntry entryWithCAS = nexus.lookup( new LookupOperationContext( registries, normName, new String[] {
+ SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT_OID } ) );
caSubentries = entryWithCAS.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
}
else
@@ -151,14 +151,13 @@
* OID values in the exclusions set instead of regular names that
* may have case variance.
*/
- Attribute collectiveExclusions = entry.get( SchemaConstants.COLLECTIVE_EXCLUSIONS_AT );
+ ServerAttribute collectiveExclusions = entry.get( SchemaConstants.COLLECTIVE_EXCLUSIONS_AT );
Set<String> exclusions = new HashSet<String>();
if ( collectiveExclusions != null )
{
- if ( AttributeUtils.containsValueCaseIgnore( collectiveExclusions, SchemaConstants.EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT_OID )
- || AttributeUtils.containsValue( collectiveExclusions, SchemaConstants.EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT,
- atRegistry.lookup( SchemaConstants.COLLECTIVE_EXCLUSIONS_AT_OID ) ) )
+ if ( collectiveExclusions.contains( SchemaConstants.EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT_OID )
+ || collectiveExclusions.contains( SchemaConstants.EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT ) )
{
/*
* This entry does not allow any collective attributes
@@ -169,9 +168,9 @@
exclusions = new HashSet<String>();
- for ( int ii = 0; ii < collectiveExclusions.size(); ii++ )
+ for ( Value<?> value:collectiveExclusions )
{
- AttributeType attrType = atRegistry.lookup( ( String ) collectiveExclusions.get( ii ) );
+ AttributeType attrType = atRegistry.lookup( ( String ) value.get() );
exclusions.add( attrType.getOid() );
}
}
@@ -193,7 +192,15 @@
for ( String retAttr:retAttrs )
{
- retIdsSet.add( retAttr.toLowerCase() );
+ if ( retAttr.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
+ retAttr.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
+ {
+ retIdsSet.add( retAttr );
+ }
+ else
+ {
+ retIdsSet.add( atRegistry.lookup( retAttr ).getOid() );
+ }
}
/*
@@ -201,19 +208,17 @@
* attributes of the subentry and copy collective attributes from the
* subentry into the entry.
*/
- for ( int ii = 0; ii < caSubentries.size(); ii++ )
+ for ( Value<?> value:caSubentries )
{
- String subentryDnStr = ( String ) caSubentries.get( ii );
+ String subentryDnStr = ( String ) value.get();
LdapDN subentryDn = new LdapDN( subentryDnStr );
- Attributes subentry = nexus.lookup( new LookupOperationContext( registries, subentryDn ) );
- NamingEnumeration<String> attrIds = subentry.getIDs();
+ ServerEntry subentry = nexus.lookup( new LookupOperationContext( registries, subentryDn ) );
- while ( attrIds.hasMore() )
+ for ( AttributeType attributeType:subentry.getAttributeTypes() )
{
- String attrId = attrIds.next();
- AttributeType attrType = atRegistry.lookup( attrId );
-
- if ( !attrType.isCollective() )
+ String attrId = attributeType.getName();
+
+ if ( !attributeType.isCollective() )
{
continue;
}
@@ -222,12 +227,12 @@
* Skip the addition of this collective attribute if it is excluded
* in the 'collectiveAttributes' attribute.
*/
- if ( exclusions.contains( attrType.getOid() ) )
+ if ( exclusions.contains( attributeType.getOid() ) )
{
continue;
}
- Set<AttributeType> allSuperTypes = getAllSuperTypes( attrType );
+ Set<AttributeType> allSuperTypes = getAllSuperTypes( attributeType );
for ( String retId : retIdsSet )
{
@@ -240,7 +245,7 @@
if ( allSuperTypes.contains( retType ) )
{
- retIdsSet.add( attrId );
+ retIdsSet.add( atRegistry.lookup( attrId ).getOid() );
break;
}
}
@@ -249,20 +254,21 @@
* If not all attributes or this collective attribute requested specifically
* then bypass the inclusion process.
*/
- if ( !( retIdsSet.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) || retIdsSet.contains( attrId ) ) )
+ if ( !( retIdsSet.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
+ retIdsSet.contains( atRegistry.lookup( attrId ).getOid() ) ) )
{
continue;
}
- Attribute subentryColAttr = subentry.get( attrId );
- Attribute entryColAttr = entry.get( attrId );
+ ServerAttribute subentryColAttr = subentry.get( attrId );
+ ServerAttribute entryColAttr = entry.get( attrId );
/*
* If entry does not have attribute for collective attribute then create it.
*/
if ( entryColAttr == null )
{
- entryColAttr = new AttributeImpl( attrId );
+ entryColAttr = new DefaultServerAttribute( attrId, atRegistry.lookup( attrId ) );
entry.put( entryColAttr );
}
@@ -270,9 +276,9 @@
* Add all the collective attribute values in the subentry
* to the currently processed collective attribute in the entry.
*/
- for ( int jj = 0; jj < subentryColAttr.size(); jj++ )
+ for ( Value<?> subentryColVal:subentryColAttr )
{
- entryColAttr.add( subentryColAttr.get( jj ) );
+ entryColAttr.add( (String)subentryColVal.get() );
}
}
}
@@ -301,9 +307,9 @@
// ------------------------------------------------------------------------
// Interceptor Method Overrides
// ------------------------------------------------------------------------
- public Attributes lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
+ public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
{
- Attributes result = nextInterceptor.lookup( opContext );
+ ServerEntry result = nextInterceptor.lookup( opContext );
if ( result == null )
{
@@ -323,18 +329,18 @@
}
- public NamingEnumeration<SearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
+ public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
{
- NamingEnumeration<SearchResult> result = nextInterceptor.list( opContext );
+ NamingEnumeration<ServerSearchResult> result = nextInterceptor.list( opContext );
Invocation invocation = InvocationStack.getInstance().peek();
return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, SEARCH_FILTER, "List collective Filter" );
}
- public NamingEnumeration<SearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
+ public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
{
- NamingEnumeration<SearchResult> result = nextInterceptor.search( opContext );
+ NamingEnumeration<ServerSearchResult> result = nextInterceptor.search( opContext );
Invocation invocation = InvocationStack.getInstance().peek();
return new SearchResultFilteringEnumeration(
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java Mon Mar 17 23:12:41 2008
@@ -20,30 +20,26 @@
package org.apache.directory.server.core.collective;
-import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
+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.LookupOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
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.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.SchemaUtils;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
/**
@@ -81,28 +77,17 @@
}
}
- public void checkModify( Registries registries, LdapDN normName, int modOp, Attributes mods ) throws NamingException
+ public void checkModify( Registries registries, LdapDN normName, List<Modification> mods ) throws NamingException
{
- ArrayList<ModificationItemImpl> modsAsArray = new ArrayList<ModificationItemImpl>( mods.size() );
- NamingEnumeration<? extends Attribute> allAttrs = mods.getAll();
+ ServerEntry originalEntry = nexus.lookup( new LookupOperationContext( registries, normName ) );
+ ServerEntry targetEntry = ServerEntryUtils.toServerEntry(
+ SchemaUtils.getTargetEntry( ServerEntryUtils.toModificationItemImpl( mods ), ServerEntryUtils.toAttributesImpl( originalEntry ) ),
+ normName,
+ registries);
- while ( allAttrs.hasMoreElements() )
- {
- Attribute attr = allAttrs.nextElement();
- modsAsArray.add( new ModificationItemImpl( modOp, attr ) );
- }
-
- checkModify( registries, normName, modsAsArray );
- }
-
-
- public void checkModify( Registries registries, LdapDN normName, List<ModificationItemImpl> mods ) throws NamingException
- {
- Attributes originalEntry = nexus.lookup( new LookupOperationContext( registries, normName ) );
- Attributes targetEntry = SchemaUtils.getTargetEntry( mods, originalEntry );
- Attribute targetObjectClasses = targetEntry.get( SchemaConstants.OBJECT_CLASS_AT );
+ ServerAttribute targetObjectClasses = targetEntry.get( SchemaConstants.OBJECT_CLASS_AT );
- if ( AttributeUtils.containsValueCaseIgnore( targetObjectClasses, SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) )
+ if ( targetObjectClasses.contains( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) )
{
return;
}
@@ -119,16 +104,16 @@
}
- private boolean addsAnyCollectiveAttributes( List<ModificationItemImpl> mods ) throws NamingException
+ private boolean addsAnyCollectiveAttributes( List<Modification> mods ) throws NamingException
{
- for ( ModificationItem mod:mods )
+ for ( Modification mod:mods )
{
- Attribute attr = mod.getAttribute();
- String attrID = attr.getID();
+ ServerAttribute attr = (ServerAttribute)mod.getAttribute();
+ String attrID = attr.getId();
AttributeType attrType = attrTypeRegistry.lookup( attrID );
- int modOp = mod.getModificationOp();
+ ModificationOperation modOp = mod.getOperation();
- if ( ( ( modOp == DirContext.ADD_ATTRIBUTE ) || ( modOp == DirContext.REPLACE_ATTRIBUTE ) ) &&
+ if ( ( ( modOp == ModificationOperation.ADD_ATTRIBUTE ) || ( modOp == ModificationOperation.REPLACE_ATTRIBUTE ) ) &&
attrType.isCollective() )
{
return true;
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/ReferralHandlingEnumeration.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/ReferralHandlingEnumeration.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/ReferralHandlingEnumeration.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/ReferralHandlingEnumeration.java Mon Mar 17 23:12:41 2008
@@ -27,10 +27,10 @@
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.referral.ReferralLut;
@@ -38,6 +38,7 @@
import org.apache.directory.shared.ldap.codec.util.LdapURL;
import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.exception.LdapReferralException;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
@@ -52,16 +53,16 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class ReferralHandlingEnumeration implements NamingEnumeration<SearchResult>
+public class ReferralHandlingEnumeration implements NamingEnumeration<ServerSearchResult>
{
private final Logger log = LoggerFactory.getLogger( ReferralHandlingEnumeration.class );
- private final List<SearchResult> referrals = new ArrayList<SearchResult>();
- private final NamingEnumeration<SearchResult> underlying;
+ private final List<ServerSearchResult> referrals = new ArrayList<ServerSearchResult>();
+ private final NamingEnumeration<ServerSearchResult> underlying;
private final ReferralLut lut;
private final PartitionNexus nexus;
private final boolean doThrow;
private final int scope;
- private SearchResult prefetched;
+ private ServerSearchResult prefetched;
private int refIndex = -1;
/**
@@ -73,7 +74,7 @@
private Registries registries;
public ReferralHandlingEnumeration(
- NamingEnumeration<SearchResult> underlying,
+ NamingEnumeration<ServerSearchResult> underlying,
ReferralLut lut,
Registries registries,
PartitionNexus nexus,
@@ -95,8 +96,8 @@
{
while ( underlying.hasMore() )
{
- SearchResult result = underlying.next();
- LdapDN dn = new LdapDN( result.getName() );
+ ServerSearchResult result = underlying.next();
+ LdapDN dn = new LdapDN( result.getDn() );
dn.normalize( normalizerMap );
if ( lut.isReferral( dn ) )
@@ -118,9 +119,9 @@
}
- public SearchResult next() throws NamingException
+ public ServerSearchResult next() throws NamingException
{
- SearchResult retval = prefetched;
+ ServerSearchResult retval = prefetched;
prefetch();
return retval;
}
@@ -164,7 +165,7 @@
}
- public SearchResult nextElement()
+ public ServerSearchResult nextElement()
{
try
{
@@ -182,26 +183,26 @@
public void doReferralExceptionOnSearchBase( Registries registries ) throws NamingException
{
// the refs attribute may be filtered out so we might need to lookup the entry
- Attribute refs = prefetched.getAttributes().get( SchemaConstants.REF_AT );
+ ServerAttribute refs = prefetched.getServerEntry().get( SchemaConstants.REF_AT );
if ( refs == null )
{
- LdapDN prefetchedDn = new LdapDN( prefetched.getName() );
+ LdapDN prefetchedDn = new LdapDN( prefetched.getDn() );
prefetchedDn.normalize( normalizerMap );
refs = nexus.lookup( new LookupOperationContext( registries, prefetchedDn ) ).get( SchemaConstants.REF_AT );
}
if ( refs == null )
{
- throw new IllegalStateException( prefetched.getName()
+ throw new IllegalStateException( prefetched.getDn()
+ " does not seem like a referral but we're trying to handle it as one." );
}
List<String> list = new ArrayList<String>( refs.size() );
- for ( int ii = 0; ii < refs.size(); ii++ )
+ for ( Value<?> value:refs )
{
- String val = ( String ) refs.get( ii );
+ String val = (String)value.get();
// need to add non-ldap URLs as-is
if ( !val.startsWith( "ldap" ) )
@@ -219,7 +220,7 @@
catch ( LdapURLEncodingException e )
{
log
- .error( "Bad URL (" + val + ") for ref in " + prefetched.getName()
+ .error( "Bad URL (" + val + ") for ref in " + prefetched.getDn()
+ ". Reference will be ignored." );
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultEnumeration.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultEnumeration.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultEnumeration.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultEnumeration.java Mon Mar 17 23:12:41 2008
@@ -21,7 +21,8 @@
import javax.naming.NamingEnumeration;
-import javax.naming.directory.SearchResult;
+
+import org.apache.directory.server.core.entry.ServerSearchResult;
/**
@@ -30,6 +31,6 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public interface SearchResultEnumeration extends NamingEnumeration<SearchResult>
+public interface SearchResultEnumeration extends NamingEnumeration<ServerSearchResult>
{
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilter.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilter.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilter.java Mon Mar 17 23:12:41 2008
@@ -20,11 +20,11 @@
package org.apache.directory.server.core.enumeration;
+import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.invocation.Invocation;
import javax.naming.NamingException;
import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
/**
@@ -48,5 +48,5 @@
* @return true if the result is to be returned, false if it is to be
* discarded from the result set
*/
- boolean accept( Invocation invocation, SearchResult result, SearchControls controls ) throws NamingException;
+ boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls ) throws NamingException;
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilteringEnumeration.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilteringEnumeration.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilteringEnumeration.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilteringEnumeration.java Mon Mar 17 23:12:41 2008
@@ -31,10 +31,11 @@
import javax.naming.Name;
import javax.naming.spi.DirectoryManager;
import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.shared.ldap.exception.OperationAbandonedException;
import org.apache.directory.shared.ldap.message.AbandonListener;
@@ -53,7 +54,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class SearchResultFilteringEnumeration implements NamingEnumeration<SearchResult>, AbandonListener
+public class SearchResultFilteringEnumeration implements NamingEnumeration<ServerSearchResult>, AbandonListener
{
/** the logger used by this class */
private static final Logger log = LoggerFactory.getLogger( SearchResultFilteringEnumeration.class );
@@ -62,10 +63,10 @@
private final List<SearchResultFilter> filters;
/** the underlying decorated enumeration */
- private final NamingEnumeration<SearchResult> decorated;
+ private final NamingEnumeration<ServerSearchResult> decorated;
/** the first accepted search result that is prefetched */
- private SearchResult prefetched;
+ private ServerSearchResult prefetched;
/** flag storing closed state of this naming enumeration */
private boolean isClosed = false;
@@ -98,7 +99,7 @@
* creating this enumeration
* @param invocation the invocation representing the seach that created this enumeration
*/
- public SearchResultFilteringEnumeration( NamingEnumeration<SearchResult> decorated, SearchControls searchControls,
+ public SearchResultFilteringEnumeration( NamingEnumeration<ServerSearchResult> decorated, SearchControls searchControls,
Invocation invocation, SearchResultFilter filter, String name ) throws NamingException
{
this.searchControls = searchControls;
@@ -128,7 +129,7 @@
* creating this enumeration
* @param invocation the invocation representing the seach that created this enumeration
*/
- public SearchResultFilteringEnumeration( NamingEnumeration<SearchResult> decorated, SearchControls searchControls,
+ public SearchResultFilteringEnumeration( NamingEnumeration<ServerSearchResult> decorated, SearchControls searchControls,
Invocation invocation, List<SearchResultFilter> filters, String name ) throws NamingException
{
this.searchControls = searchControls;
@@ -209,9 +210,9 @@
}
- public SearchResult next() throws NamingException
+ public ServerSearchResult next() throws NamingException
{
- SearchResult retVal = this.prefetched;
+ ServerSearchResult retVal = this.prefetched;
prefetch();
return retVal;
}
@@ -227,9 +228,9 @@
}
- public SearchResult nextElement()
+ public ServerSearchResult nextElement()
{
- SearchResult retVal = this.prefetched;
+ ServerSearchResult retVal = this.prefetched;
try
{
@@ -249,29 +250,29 @@
// ------------------------------------------------------------------------
- private void applyObjectFactories( SearchResult result ) throws NamingException
+ private void applyObjectFactories( ServerSearchResult result ) throws NamingException
{
// if already populated or no factories are available just return
- if ( result.getObject() != null || !applyObjectFactories )
+ if ( ( result.getObject() != null ) || !applyObjectFactories )
{
return;
}
DirContext ctx = ( DirContext ) invocation.getCaller();
Hashtable<?,?> env = ctx.getEnvironment();
- Attributes attrs = result.getAttributes();
- Name name = new LdapDN( result.getName() );
+ ServerEntry serverEntry = result.getServerEntry();
+ Name name = new LdapDN( result.getDn() );
try
{
- Object obj = DirectoryManager.getObjectInstance( null, name, ctx, env, attrs );
+ Object obj = DirectoryManager.getObjectInstance( null, name, ctx, env, ServerEntryUtils.toAttributesImpl( serverEntry ) );
result.setObject( obj );
}
catch ( Exception e )
{
StringBuffer buf = new StringBuffer();
buf.append( "ObjectFactories threw exception while attempting to generate an object for " );
- buf.append( result.getName() );
+ buf.append( result.getDn() );
buf.append( ". Call on SearchResult.getObject() will return null." );
log.warn( buf.toString(), e );
}
@@ -290,7 +291,8 @@
*/
private void prefetch() throws NamingException
{
- SearchResult tmp;
+ ServerSearchResult tmp;
+
if ( abandoned )
{
this.close();
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/Evaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/Evaluator.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/Evaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/Evaluator.java Mon Mar 17 23:12:41 2008
@@ -21,8 +21,8 @@
import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -45,5 +45,5 @@
* @return true if the filter selects the candidate false otherwise
* @throws javax.naming.NamingException if there is a database fault during evaluation
*/
- boolean evaluate( ExprNode node, String dn, Attributes entry ) throws NamingException;
+ boolean evaluate( ExprNode node, String dn, ServerEntry entry ) throws NamingException;
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java Mon Mar 17 23:12:41 2008
@@ -30,7 +30,7 @@
import java.util.Set;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -49,6 +49,7 @@
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.entry.Modification;
import org.apache.directory.shared.ldap.filter.AndNode;
import org.apache.directory.shared.ldap.filter.BranchNode;
import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -56,16 +57,13 @@
import org.apache.directory.shared.ldap.filter.NotNode;
import org.apache.directory.shared.ldap.filter.ScopeNode;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.naming.Binding;
-import javax.naming.Name;
import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls;
import javax.naming.event.EventContext;
import javax.naming.event.NamespaceChangeListener;
@@ -117,7 +115,7 @@
* @param namingListener the naming listener to register
* @throws NamingException if there are failures adding the naming listener
*/
- public void addNamingListener( EventContext ctx, Name name, ExprNode filter, SearchControls searchControls,
+ public void addNamingListener( EventContext ctx, LdapDN name, ExprNode filter, SearchControls searchControls,
NamingListener namingListener ) throws NamingException
{
LdapDN normalizedBaseDn = new LdapDN( name );
@@ -247,7 +245,7 @@
//super.add( next, opContext );
LdapDN name = opContext.getDn();
- Attributes entry = ServerEntryUtils.toAttributesImpl( opContext.getEntry() );
+ ServerEntry entry = opContext.getEntry();
Set<EventSourceRecord> selecting = getSelectingSources( name, entry );
@@ -277,7 +275,7 @@
public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
{
LdapDN name = opContext.getDn();
- Attributes entry = nexus.lookup( new LookupOperationContext( opContext.getRegistries(), name ) );
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( opContext.getRegistries(), name ) );
next.delete( opContext );
//super.delete( next, opContext );
@@ -307,9 +305,9 @@
}
- private void notifyOnModify( Registries registries, LdapDN name, List<ModificationItemImpl> mods, Attributes oriEntry ) throws NamingException
+ private void notifyOnModify( Registries registries, LdapDN name, List<Modification> mods, ServerEntry oriEntry ) throws NamingException
{
- Attributes entry = nexus.lookup( new LookupOperationContext( registries, name ) );
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
Set<EventSourceRecord> selecting = getSelectingSources( name, entry );
if ( selecting.isEmpty() )
@@ -340,7 +338,7 @@
{
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- Attributes oriEntry = proxy.lookup( new LookupOperationContext( opContext.getRegistries(), opContext.getDn() ), PartitionNexusProxy.LOOKUP_BYPASS );
+ ServerEntry oriEntry = proxy.lookup( new LookupOperationContext( opContext.getRegistries(), opContext.getDn() ), PartitionNexusProxy.LOOKUP_BYPASS );
next.modify( opContext );
@@ -350,7 +348,7 @@
private void notifyOnNameChange( Registries registries, LdapDN oldName, LdapDN newName ) throws NamingException
{
- Attributes entry = nexus.lookup( new LookupOperationContext( registries, newName ) );
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, newName ) );
Set<EventSourceRecord> selecting = getSelectingSources( oldName, entry );
if ( selecting.isEmpty() )
@@ -415,7 +413,7 @@
}
- Set<EventSourceRecord> getSelectingSources( LdapDN name, Attributes entry ) throws NamingException
+ Set<EventSourceRecord> getSelectingSources( LdapDN name, ServerEntry entry ) throws NamingException
{
if ( sources.isEmpty() )
{
@@ -461,14 +459,14 @@
class EventSourceRecord
{
- private Name base;
+ private LdapDN base;
private SearchControls controls;
private ExprNode filter;
private EventContext context;
private NamingListener listener;
- public EventSourceRecord(Name base, ExprNode filter, EventContext context, SearchControls controls,
+ public EventSourceRecord( LdapDN base, ExprNode filter, EventContext context, SearchControls controls,
NamingListener listener)
{
this.filter = filter;
@@ -497,7 +495,7 @@
}
- public Name getBase()
+ public LdapDN getBase()
{
return base;
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java Mon Mar 17 23:12:41 2008
@@ -21,8 +21,8 @@
import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.filter.AndNode;
@@ -94,7 +94,7 @@
/**
* @see Evaluator#evaluate(ExprNode, String, Attributes)
*/
- public boolean evaluate( ExprNode node, String dn, Attributes entry ) throws NamingException
+ public boolean evaluate( ExprNode node, String dn, ServerEntry entry ) throws NamingException
{
if ( node.isLeaf() )
{
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java Mon Mar 17 23:12:41 2008
@@ -22,14 +22,14 @@
import java.util.Comparator;
-import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.filter.ApproximateNode;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -43,7 +43,6 @@
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.MatchingRule;
import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
/**
@@ -105,7 +104,7 @@
/**
* @see Evaluator#evaluate(ExprNode, String, Attributes)
*/
- public boolean evaluate( ExprNode node, String dn, Attributes entry ) throws NamingException
+ public boolean evaluate( ExprNode node, String dn, ServerEntry entry ) throws NamingException
{
if ( node instanceof ScopeNode )
{
@@ -155,13 +154,13 @@
* @return the ava evaluation on the perspective candidate
* @throws javax.naming.NamingException if there is a database access failure
*/
- private boolean evalGreaterOrLesser( SimpleNode node, Attributes entry, boolean isGreaterOrLesser ) throws NamingException
+ private boolean evalGreaterOrLesser( SimpleNode node, ServerEntry entry, boolean isGreaterOrLesser ) throws NamingException
{
String attrId = node.getAttribute();
// get the attribute associated with the node
AttributeType type = attributeTypeRegistry.lookup( oidRegistry.getOid( attrId ) );
- Attribute attr = AttributeUtils.getAttribute( entry, type );
+ ServerAttribute attr = entry.get( type );
// If we do not have the attribute just return false
if ( null == attr )
@@ -176,7 +175,6 @@
Normalizer normalizer = getNormalizer( attrId );
Comparator comparator = getComparator( attrId );
Object filterValue = normalizer.normalize( node.getValue() );
- NamingEnumeration list = attr.getAll();
/*
* Cheaper to not check isGreater in one loop - better to separate
@@ -184,12 +182,12 @@
*/
if ( isGreaterOrLesser == COMPARE_GREATER )
{
- while ( list.hasMore() )
+ for ( Value<?> value:attr )
{
- Object value = normalizer.normalize( list.next() );
+ Object normValue = normalizer.normalize( value );
// Found a value that is greater than or equal to the ava value
- if ( 0 >= comparator.compare( value, filterValue ) )
+ if ( 0 >= comparator.compare( normValue, filterValue ) )
{
return true;
}
@@ -197,12 +195,12 @@
}
else
{
- while ( list.hasMore() )
+ for ( Value<?> value:attr )
{
- Object value = normalizer.normalize( list.next() );
+ Object normValue = normalizer.normalize( value );
// Found a value that is less than or equal to the ava value
- if ( 0 <= comparator.compare( value, filterValue ) )
+ if ( 0 <= comparator.compare( normValue, filterValue ) )
{
return true;
}
@@ -222,15 +220,14 @@
* @param entry the perspective candidate
* @return the ava evaluation on the perspective candidate
*/
- private boolean evalPresence( String attrId, Attributes entry ) throws NamingException
+ private boolean evalPresence( String attrId, ServerEntry entry ) throws NamingException
{
if ( entry == null )
{
return false;
}
- AttributeType type = attributeTypeRegistry.lookup( oidRegistry.getOid( attrId ) );
- return null != AttributeUtils.getAttribute( entry, type );
+ return null != entry.get( attrId );
}
@@ -243,14 +240,13 @@
* @return the ava evaluation on the perspective candidate
* @throws javax.naming.NamingException if there is a database access failure
*/
- private boolean evalEquality( EqualityNode node, Attributes entry ) throws NamingException
+ private boolean evalEquality( EqualityNode node, ServerEntry entry ) throws NamingException
{
Normalizer normalizer = getNormalizer( node.getAttribute() );
Comparator comparator = getComparator( node.getAttribute() );
// get the attribute associated with the node
- AttributeType type = attributeTypeRegistry.lookup( node.getAttribute() );
- Attribute attr = AttributeUtils.getAttribute( entry, type );
+ ServerAttribute attr = entry.get( node.getAttribute() );
// If we do not have the attribute just return false
if ( null == attr )
@@ -259,7 +255,14 @@
}
// check if AVA value exists in attribute
- if ( AttributeUtils.containsValue( attr, node.getValue(), type ) )
+ if ( node.getValue() instanceof String )
+ {
+ if ( attr.contains( (String)node.getValue() ) )
+ {
+ return true;
+ }
+ }
+ else if ( attr.contains( (byte[])node.getValue() ) )
{
return true;
}
@@ -268,23 +271,30 @@
Object filterValue = normalizer.normalize( node.getValue() );
// check if the normalized value is present
- if ( AttributeUtils.containsValue( attr, filterValue, type ) )
+ if ( filterValue instanceof String)
+ {
+ if ( attr.contains( (String)filterValue ) )
+ {
+ return true;
+ }
+ }
+ else if ( attr.contains( (byte[])filterValue ) )
{
return true;
}
+
+
/*
* We need to now iterate through all values because we could not get
* a lookup to work. For each value we normalize and use the comparator
* to determine if a match exists.
*/
- NamingEnumeration list = attr.getAll();
-
- while ( list.hasMore() )
+ for( Value<?> value:attr )
{
- Object value = normalizer.normalize( list.next() );
+ Object normValue = normalizer.normalize( value.get() );
- if ( 0 == comparator.compare( value, filterValue ) )
+ if ( 0 == comparator.compare( normValue, filterValue ) )
{
return true;
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/ScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/ScopeEvaluator.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/ScopeEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/ScopeEvaluator.java Mon Mar 17 23:12:41 2008
@@ -22,8 +22,8 @@
import javax.naming.NamingException;
import javax.naming.directory.SearchControls;
-import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.ScopeNode;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -45,7 +45,7 @@
/**
* @see Evaluator#evaluate(ExprNode, String, Attributes)
*/
- public boolean evaluate( ExprNode node, String dn, Attributes record ) throws NamingException
+ public boolean evaluate( ExprNode node, String dn, ServerEntry record ) throws NamingException
{
ScopeNode snode = ( ScopeNode ) node;
@@ -53,6 +53,7 @@
{
case ( SearchControls.OBJECT_SCOPE ):
return dn.equals( snode.getBaseDn() );
+
case ( SearchControls.ONELEVEL_SCOPE ):
if ( dn.endsWith( snode.getBaseDn() ) )
{
@@ -60,8 +61,10 @@
LdapDN scopeDn = new LdapDN( snode.getBaseDn() );
return ( scopeDn.size() + 1 ) == candidateDn.size();
}
+
case ( SearchControls.SUBTREE_SCOPE ):
return dn.endsWith( snode.getBaseDn() );
+
default:
throw new NamingException( "Unrecognized search scope!" );
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java Mon Mar 17 23:12:41 2008
@@ -23,13 +23,13 @@
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.SubstringNode;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -67,7 +67,7 @@
/**
* @see Evaluator#evaluate(ExprNode, String, Attributes)
*/
- public boolean evaluate( ExprNode node, String dn, Attributes entry ) throws NamingException
+ public boolean evaluate( ExprNode node, String dn, ServerEntry entry ) throws NamingException
{
Pattern regex = null;
SubstringNode snode = (SubstringNode)node;
@@ -84,7 +84,7 @@
// get the attribute
- Attribute attr = entry.get( snode.getAttribute() );
+ ServerAttribute attr = entry.get( snode.getAttribute() );
// if the attribute does not exist just return false
if ( null == attr )
@@ -110,17 +110,15 @@
* The test uses the comparator obtained from the appropriate
* substring matching rule.
*/
- NamingEnumeration list = attr.getAll();
- while ( list.hasMore() )
+ for ( Value<?> value: attr )
{
- String value = ( String ) normalizer.normalize( list.next() );
+ String normValue = ( String ) normalizer.normalize( value );
// Once match is found cleanup and return true
- if ( regex.matcher( value ).matches() )
+ if ( regex.matcher( normValue ).matches() )
{
- list.close();
return true;
}
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Mon Mar 17 23:12:41 2008
@@ -21,8 +21,9 @@
import org.apache.commons.collections.map.LRUMap;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
-import org.apache.directory.server.core.entry.ServerValue;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -43,25 +44,22 @@
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.exception.LdapAttributeInUseException;
import org.apache.directory.shared.ldap.exception.LdapContextNotEmptyException;
import org.apache.directory.shared.ldap.exception.LdapNameAlreadyBoundException;
import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
import org.apache.directory.shared.ldap.exception.LdapNamingException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.apache.directory.shared.ldap.util.EmptyEnumeration;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchResult;
import java.util.List;
import java.util.Map;
@@ -127,7 +125,7 @@
{
nexus = directoryService.getPartitionNexus();
normalizerMap = directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
- ServerValue<?> attr = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+ Value<?> attr = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
subschemSubentryDn = new LdapDN( ( String ) attr.get() );
subschemSubentryDn.normalize( normalizerMap );
registries = directoryService.getRegistries();
@@ -176,7 +174,7 @@
{
// We don't know if the parent is an alias or not, so we will launch a
// lookup, and update the cache if it's not an alias
- Attributes attrs;
+ ServerEntry attrs;
try
{
@@ -190,9 +188,9 @@
throw e2;
}
- Attribute objectClass = attrs.get( SchemaConstants.OBJECT_CLASS_AT );
+ ServerAttribute objectClass = attrs.get( SchemaConstants.OBJECT_CLASS_AT );
- if ( AttributeUtils.containsValueCaseIgnore( objectClass, SchemaConstants.ALIAS_OC ) )
+ if ( objectClass.contains( SchemaConstants.ALIAS_OC ) )
{
String msg = "Attempt to add entry to alias '" + name.getUpName() + "' not allowed.";
ResultCodeEnum rc = ResultCodeEnum.ALIAS_PROBLEM;
@@ -235,7 +233,7 @@
// check if entry to delete has children (only leaves can be deleted)
boolean hasChildren = false;
- NamingEnumeration<SearchResult> list = nextInterceptor.list( new ListOperationContext( registries, name ) );
+ NamingEnumeration<ServerSearchResult> list = nextInterceptor.list( new ListOperationContext( registries, name ) );
if ( list.hasMore() )
{
@@ -266,12 +264,12 @@
/**
* Checks to see the base being searched exists, otherwise throws the appropriate LdapException.
*/
- public NamingEnumeration<SearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
+ public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
{
if ( opContext.getDn().getNormName().equals( subschemSubentryDn.getNormName() ) )
{
// there is nothing under the schema subentry
- return new EmptyEnumeration<SearchResult>();
+ return new EmptyEnumeration<ServerSearchResult>();
}
// check if entry to search exists
@@ -285,11 +283,11 @@
/**
* Checks to see the base being searched exists, otherwise throws the appropriate LdapException.
*/
- public Attributes lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
+ public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
{
if ( opContext.getDn().getNormName().equals( subschemSubentryDn.getNormName() ) )
{
- return ServerEntryUtils.toAttributesImpl( nexus.getRootDSE( null ) );
+ return nexus.getRootDSE( null );
}
// check if entry to lookup exists
@@ -319,25 +317,24 @@
assertHasEntry( nextInterceptor, msg, opContext.getDn() );
- Attributes entry = nexus.lookup( new LookupOperationContext( registries, opContext.getDn() ) );
- List<ModificationItemImpl> items = opContext.getModItems();
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, opContext.getDn() ) );
+ List<Modification> items = opContext.getModItems();
- for ( ModificationItemImpl item : items )
+ for ( Modification item : items )
{
- if ( item.getModificationOp() == DirContext.ADD_ATTRIBUTE )
+ if ( item.getOperation() == ModificationOperation.ADD_ATTRIBUTE )
{
- Attribute modAttr = item.getAttribute();
- Attribute entryAttr = entry.get( modAttr.getID() );
+ ServerAttribute modAttr = (ServerAttribute)item.getAttribute();
+ ServerAttribute entryAttr = entry.get( modAttr.getId() );
if ( entryAttr != null )
{
- for ( int jj = 0; jj < modAttr.size(); jj++ )
+ for ( Value<?> value:modAttr )
{
- // TODO Fix DIRSERVER-832
- if ( entryAttr.contains( modAttr.get( jj ) ) )
+ if ( entryAttr.contains( value ) )
{
- throw new LdapAttributeInUseException( "Trying to add existing value '" + modAttr.get( jj )
- + "' to attribute " + modAttr.getID() );
+ throw new LdapAttributeInUseException( "Trying to add existing value '" + value
+ + "' to attribute " + modAttr.getId() );
}
}
}
@@ -520,13 +517,13 @@
/**
* Checks to see the entry being searched exists, otherwise throws the appropriate LdapException.
*/
- public NamingEnumeration<SearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
+ public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
{
LdapDN base = opContext.getDn();
try
{
- NamingEnumeration<SearchResult> result = nextInterceptor.search( opContext );
+ NamingEnumeration<ServerSearchResult> result = nextInterceptor.search( opContext );
if ( ! result.hasMoreElements() )
{
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java Mon Mar 17 23:12:41 2008
@@ -23,6 +23,7 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
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,8 +50,6 @@
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
import java.util.Iterator;
@@ -162,7 +161,7 @@
}
- public NamingEnumeration<SearchResult> list( NextInterceptor next, ListOperationContext opContext )
+ public NamingEnumeration<ServerSearchResult> list( NextInterceptor next, ListOperationContext opContext )
throws NamingException
{
return next.list( opContext );
@@ -176,7 +175,7 @@
}
- public Attributes lookup( NextInterceptor next, LookupOperationContext opContext ) throws NamingException
+ public ServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws NamingException
{
return next.lookup( opContext );
}
@@ -207,7 +206,7 @@
}
- public NamingEnumeration<SearchResult> search( NextInterceptor next, SearchOperationContext opContext ) throws NamingException
+ public NamingEnumeration<ServerSearchResult> search( NextInterceptor next, SearchOperationContext opContext ) throws NamingException
{
return next.search( opContext );
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java Mon Mar 17 23:12:41 2008
@@ -22,6 +22,7 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
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;
@@ -47,8 +48,6 @@
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
import java.util.Iterator;
@@ -200,19 +199,19 @@
/**
* Filters {@link Partition#list( ListOperationContext )} call.
*/
- NamingEnumeration<SearchResult> list( NextInterceptor next, ListOperationContext opContext ) throws NamingException;
+ NamingEnumeration<ServerSearchResult> list( NextInterceptor next, ListOperationContext opContext ) throws NamingException;
/**
* Filters {@link Partition#search( SearchOperationContext )} call.
*/
- NamingEnumeration<SearchResult> search( NextInterceptor next, SearchOperationContext opContext ) throws NamingException;
+ NamingEnumeration<ServerSearchResult> search( NextInterceptor next, SearchOperationContext opContext ) throws NamingException;
/**
* Filters {@link Partition#lookup( LookupOperationContext )} call.
*/
- Attributes lookup( NextInterceptor next, LookupOperationContext opContext ) throws NamingException;
+ ServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws NamingException;
/**