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 2011/09/28 15:39:05 UTC
svn commit: r1176880 - in /directory:
apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/
apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/
apacheds/trunk/core-api/src/test/java/org/apache/direc...
Author: elecharny
Date: Wed Sep 28 13:39:04 2011
New Revision: 1176880
URL: http://svn.apache.org/viewvc?rev=1176880&view=rev
Log:
o Get rid of the Entry.getAttributeTypes() method
o Replaced it with a getAttributes() method which returns the Attributes, not the AttributeTypes
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/EntrySerializer.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/ImmutableEntry.java
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java Wed Sep 28 13:39:04 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.core
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -158,9 +159,12 @@ public class ClonedServerEntry implement
}
- public Set<AttributeType> getAttributeTypes()
+ /**
+ * {@inheritDoc}
+ */
+ public Collection<Attribute> getAttributes()
{
- return clonedEntry.getAttributeTypes();
+ return clonedEntry.getAttributes();
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java Wed Sep 28 13:39:04 2011
@@ -98,8 +98,9 @@ public class ServerEntryUtils
Attributes attributes = new BasicAttributes( true );
- for ( AttributeType attributeType:entry.getAttributeTypes() )
+ for ( Attribute attribute:entry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
Attribute attr = entry.get( attributeType );
// Deal with a special case : an entry without any ObjectClass
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java Wed Sep 28 13:39:04 2011
@@ -33,6 +33,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.cursor.CursorIterator;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.exception.OperationAbandonedException;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
@@ -373,9 +374,10 @@ public class BaseEntryFilteringCursor im
if ( getOperationContext().isNoAttributes() )
{
- for ( AttributeType at : originalEntry.getAttributeTypes() )
+ for ( Attribute attribute : originalEntry.getAttributes() )
{
- entry.remove( entry.get( at ) );
+ AttributeType attributeType = attribute.getAttributeType();
+ entry.remove( entry.get( attributeType ) );
}
return;
@@ -384,28 +386,30 @@ public class BaseEntryFilteringCursor im
if ( getOperationContext().isAllUserAttributes() )
{
- for ( AttributeType at : originalEntry.getAttributeTypes() )
+ for ( Attribute attribute : originalEntry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
boolean isNotRequested = true;
for ( AttributeTypeOptions attrOptions:getOperationContext().getReturningAttributes() )
{
- if ( attrOptions.getAttributeType().equals( at ) || attrOptions.getAttributeType().isAncestorOf( at ) )
+ if ( attrOptions.getAttributeType().equals( attributeType ) ||
+ attrOptions.getAttributeType().isAncestorOf( attributeType ) )
{
isNotRequested = false;
break;
}
}
- boolean isNotUserAttribute = at.getUsage() != UsageEnum.USER_APPLICATIONS;
+ boolean isNotUserAttribute = attributeType.getUsage() != UsageEnum.USER_APPLICATIONS;
if ( isNotRequested && isNotUserAttribute )
{
- entry.removeAttributes( at );
+ entry.removeAttributes( attributeType );
}
else if( typesOnly )
{
- entry.get( at ).clear();
+ entry.get( attributeType ).clear();
}
}
@@ -414,28 +418,30 @@ public class BaseEntryFilteringCursor im
if ( getOperationContext().isAllOperationalAttributes() )
{
- for ( AttributeType at : originalEntry.getAttributeTypes() )
+ for ( Attribute attribute : originalEntry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
boolean isNotRequested = true;
for ( AttributeTypeOptions attrOptions:getOperationContext().getReturningAttributes() )
{
- if ( attrOptions.getAttributeType().equals( at ) || attrOptions.getAttributeType().isAncestorOf( at ) )
+ if ( attrOptions.getAttributeType().equals( attributeType ) ||
+ attrOptions.getAttributeType().isAncestorOf( attributeType ) )
{
isNotRequested = false;
break;
}
}
- boolean isUserAttribute = at.getUsage() == UsageEnum.USER_APPLICATIONS;
+ boolean isUserAttribute = attributeType.getUsage() == UsageEnum.USER_APPLICATIONS;
if ( isNotRequested && isUserAttribute )
{
- entry.removeAttributes( at );
+ entry.removeAttributes( attributeType );
}
else if( typesOnly )
{
- entry.get( at ).clear();
+ entry.get( attributeType ).clear();
}
}
@@ -444,13 +450,15 @@ public class BaseEntryFilteringCursor im
if ( getOperationContext().getReturningAttributes() != null )
{
- for ( AttributeType at : originalEntry.getAttributeTypes() )
+ for ( Attribute attribute : originalEntry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
boolean isNotRequested = true;
for ( AttributeTypeOptions attrOptions:getOperationContext().getReturningAttributes() )
{
- if ( attrOptions.getAttributeType().equals( at ) || attrOptions.getAttributeType().isAncestorOf( at ) )
+ if ( attrOptions.getAttributeType().equals( attributeType ) ||
+ attrOptions.getAttributeType().isAncestorOf( attributeType ) )
{
isNotRequested = false;
break;
@@ -459,11 +467,11 @@ public class BaseEntryFilteringCursor im
if ( isNotRequested )
{
- entry.removeAttributes( at );
+ entry.removeAttributes( attributeType );
}
else if( typesOnly )
{
- entry.get( at ).clear();
+ entry.get( attributeType ).clear();
}
}
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java Wed Sep 28 13:39:04 2011
@@ -30,6 +30,7 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.util.Arrays;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -1669,7 +1670,7 @@ public class SchemaAwareEntryTest
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
- assertEquals( 0, entry.getAttributeTypes().size() );
+ assertEquals( 0, entry.getAttributes().size() );
Attribute attrOC = new DefaultAttribute( atOC, "top", "person" );
Attribute attrCN = new DefaultAttribute( atCN, "test1", "test2" );
@@ -1678,14 +1679,22 @@ public class SchemaAwareEntryTest
entry.add( attrOC, attrCN, attrSN, attrPWD );
- Set<AttributeType> attributeTypes = entry.getAttributeTypes();
+ Collection<Attribute> attributes = entry.getAttributes();
- assertEquals( 4, attributeTypes.size() );
- assertTrue( attributeTypes.contains( atOC ) );
- assertTrue( attributeTypes.contains( atCN ) );
- assertTrue( attributeTypes.contains( atSN ) );
- assertTrue( attributeTypes.contains( atPwd ) );
- assertFalse( attributeTypes.contains( atC ) );
+ assertEquals( 4, attributes.size() );
+ Set<AttributeType> expected = new HashSet<AttributeType>();
+ expected.add( atOC );
+ expected.add( atCN );
+ expected.add( atSN );
+ expected.add( atPwd );
+ expected.add( atC );
+
+ for ( Attribute attribute : attributes )
+ {
+ AttributeType attributeType = attribute.getAttributeType();
+
+ assertTrue( expected.contains( attributeType ) );
+ }
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java Wed Sep 28 13:39:04 2011
@@ -61,7 +61,7 @@ public interface Authenticator
* Called by {@link AuthenticationInterceptor} to indicate that this
* authenticator is being placed into service.
*/
- public void init( DirectoryService directoryService ) throws LdapException;
+ void init( DirectoryService directoryService ) throws LdapException;
/**
@@ -84,8 +84,11 @@ public interface Authenticator
/**
* Performs authentication and returns the principal if succeeded.
+ *
+ * @param bindContext The Bind context
+ * @exception If the authentication failed
*/
- public LdapPrincipal authenticate( BindOperationContext bindContext ) throws Exception;
+ LdapPrincipal authenticate( BindOperationContext bindContext ) throws Exception;
/**
@@ -95,4 +98,13 @@ public interface Authenticator
* @throws PasswordPolicyException
*/
void checkPwdPolicy( Entry userEntry ) throws LdapException;
+
+
+ /**
+ * Performs an unbind on the given context
+ *
+ * @param unbindContext The Unbind context
+ * @exception If the unbind failed
+ */
+ //void unbind( UnbindOperationContext unbindContext ) throws Exception;
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Wed Sep 28 13:39:04 2011
@@ -1343,9 +1343,10 @@ public class AciAuthorizationInterceptor
*/
List<AttributeType> attributeToRemove = new ArrayList<AttributeType>();
- for ( AttributeType attributeType : clonedEntry.getAttributeTypes() )
+ for ( Attribute attribute : clonedEntry.getAttributes() )
{
// if attribute type scope access is not allowed then remove the attribute and continue
+ AttributeType attributeType = attribute.getAttributeType();
Attribute attr = clonedEntry.get( attributeType );
aciContext = new AciContext( schemaManager, opContext );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Wed Sep 28 13:39:04 2011
@@ -20,6 +20,7 @@ package org.apache.directory.server.core
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -117,10 +118,9 @@ public class ChangeLogInterceptor extend
forward.setChangeType( ChangeType.Add );
forward.setDn( addContext.getDn() );
- Set<AttributeType> list = addEntry.getAttributeTypes();
-
- for ( AttributeType attributeType:list )
+ for ( Attribute attribute:addEntry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
forward.addAttribute( addEntry.get( attributeType).clone() );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Wed Sep 28 13:39:04 2011
@@ -290,10 +290,10 @@ public class CollectiveAttributeIntercep
*/
private boolean containsAnyCollectiveAttributes( Entry entry ) throws LdapException
{
- Set<AttributeType> attributeTypes = entry.getAttributeTypes();
-
- for ( AttributeType attributeType : attributeTypes )
+ for ( Attribute attribute : entry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
+
if ( attributeType.isCollective() )
{
return true;
@@ -408,8 +408,9 @@ public class CollectiveAttributeIntercep
Entry subentry = opContext.lookup( subentryDn, ByPassConstants.LOOKUP_COLLECTIVE_BYPASS, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
- for ( AttributeType attributeType : subentry.getAttributeTypes() )
+ for ( Attribute attribute : subentry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
String attrId = attributeType.getName();
if ( !attributeType.isCollective() )
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java Wed Sep 28 13:39:04 2011
@@ -31,6 +31,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.entry.Modification;
import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -114,10 +115,9 @@ public class JournalInterceptor extends
ldif.setChangeType( ChangeType.Add );
ldif.setDn( addContext.getDn() );
- Set<AttributeType> list = addEntry.getAttributeTypes();
-
- for ( AttributeType attributeType:list )
+ for ( Attribute attribute:addEntry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
ldif.addAttribute( addEntry.get( attributeType).clone() );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Wed Sep 28 13:39:04 2011
@@ -444,8 +444,10 @@ public class OperationalAttributeInterce
Set<AttributeType> removedAttributes = new HashSet<AttributeType>();
// Build a list of attributeType to remove
- for ( AttributeType attributeType : attributes.getAttributeTypes() )
+ for ( Attribute attribute : attributes.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
+
if ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS )
{
removedAttributes.add( attributeType );
@@ -474,12 +476,12 @@ public class OperationalAttributeInterce
return;
}
- Set<AttributeType> attributeTypes = entry.getAttributeTypes();
-
if ( dn.size() == 0 )
{
- for ( AttributeType attributeType : attributeTypes )
+ for ( Attribute attribute : entry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
+
if ( !ids.contains( attributeType.getOid() ) )
{
entry.removeAttributes( attributeType );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Wed Sep 28 13:39:04 2011
@@ -566,12 +566,12 @@ public class DefaultPartitionNexus exten
if ( dn.size() == 0 )
{
Entry retval = new ClonedServerEntry( rootDSE );
- Set<AttributeType> attributeTypes = rootDSE.getAttributeTypes();
if ( ( lookupContext.getAttrsId() != null ) && !lookupContext.getAttrsId().isEmpty() )
{
- for ( AttributeType attributeType : attributeTypes )
+ for ( Attribute attribute : rootDSE.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
String oid = attributeType.getOid();
if ( !lookupContext.getAttrsId().contains( oid ) )
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Wed Sep 28 13:39:04 2011
@@ -1355,8 +1355,10 @@ public class SchemaInterceptor extends B
// First, make sure all attributes are valid schema defined attributes
// ---------------------------------------------------------------
- for ( AttributeType attributeType : entry.getAttributeTypes() )
+ for ( Attribute attribute : entry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
+
if ( !schemaManager.getAttributeTypeRegistry().contains( attributeType.getName() ) )
{
throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_275, attributeType.getName() ) );
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/EntrySerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/EntrySerializer.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/EntrySerializer.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/EntrySerializer.java Wed Sep 28 13:39:04 2011
@@ -124,23 +124,22 @@ public class EntrySerializer implements
}
// Then the attributes.
- out.writeInt( entry.getAttributeTypes().size() );
+ out.writeInt( entry.getAttributes().size() );
// Iterate through the keys. We store the Attribute
// here, to be able to restore it in the readExternal :
// we need access to the registries, which are not available
// in the ServerAttribute class.
- for ( AttributeType attributeType : entry.getAttributeTypes() )
+ for ( Attribute attribute : entry.getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
+
// Write the oid to be able to restore the AttributeType when deserializing
// the attribute
String oid = attributeType.getOid();
out.writeUTF( oid );
- // Get the attribute
- Attribute attribute = entry.get( attributeType );;
-
// Write the attribute
attribute.writeExternal( out );
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java Wed Sep 28 13:39:04 2011
@@ -913,8 +913,9 @@ public abstract class AbstractBTreeParti
}
else
{
- for ( AttributeType attributeType : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributeTypes() )
+ for ( Attribute attribute : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
String oid = attributeType.getOid();
if ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS )
@@ -931,8 +932,10 @@ public abstract class AbstractBTreeParti
{
if ( lookupContext.hasAllOperational() )
{
- for ( AttributeType attributeType : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributeTypes() )
+ for ( Attribute attribute : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
+
if ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS )
{
entry.removeAttributes( attributeType );
@@ -943,8 +946,10 @@ public abstract class AbstractBTreeParti
{
if ( lookupContext.getAttrsId().size() == 0 )
{
- for ( AttributeType attributeType : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributeTypes() )
+ for ( Attribute attribute : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
+
if ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS )
{
entry.removeAttributes( attributeType );
@@ -953,8 +958,9 @@ public abstract class AbstractBTreeParti
}
else
{
- for ( AttributeType attributeType : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributeTypes() )
+ for ( Attribute attribute : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributes() )
{
+ AttributeType attributeType = attribute.getAttributeType();
String oid = attributeType.getOid();
if ( !lookupContext.getAttrsId().contains( oid ) )
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java Wed Sep 28 13:39:04 2011
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -1346,19 +1347,9 @@ public final class DefaultEntry implemen
/**
* {@inheritDoc}
*/
- public Set<AttributeType> getAttributeTypes()
+ public Collection<Attribute> getAttributes()
{
- Set<AttributeType> attributeTypes = new HashSet<AttributeType>();
-
- for ( Attribute attribute : attributes.values() )
- {
- if ( attribute.getAttributeType() != null )
- {
- attributeTypes.add( attribute.getAttributeType() );
- }
- }
-
- return attributeTypes;
+ return Collections.unmodifiableMap( attributes ).values();
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java Wed Sep 28 13:39:04 2011
@@ -20,6 +20,7 @@ package org.apache.directory.shared.ldap
import java.io.Externalizable;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -112,11 +113,11 @@ public interface Entry extends Cloneable
/**
- * Gets all the attributes type
+ * Gets all the attributes
*
* @return The combined set of all the attributes.
*/
- Set<AttributeType> getAttributeTypes();
+ Collection<Attribute> getAttributes();
/**
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/ImmutableEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/ImmutableEntry.java?rev=1176880&r1=1176879&r2=1176880&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/ImmutableEntry.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/ImmutableEntry.java Wed Sep 28 13:39:04 2011
@@ -22,6 +22,7 @@ package org.apache.directory.shared.ldap
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -279,9 +280,9 @@ public class ImmutableEntry implements E
/**
* {@inheritDoc}
*/
- public Set<AttributeType> getAttributeTypes()
+ public Collection<Attribute> getAttributes()
{
- return entry.getAttributeTypes();
+ return entry.getAttributes();
}