directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r652410 [9/14] - in /directory: apacheds/branches/bigbang/ apacheds/branches/bigbang/apacheds-jdbm/ apacheds/branches/bigbang/apacheds-jdbm/src/ apacheds/branches/bigbang/apacheds-jdbm/src/etc/ apacheds/branches/bigbang/apacheds-jdbm/src/ex...
Date Thu, 01 May 2008 00:06:46 GMT
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java Wed Apr 30 17:06:41 2008
@@ -23,13 +23,13 @@
 import java.util.Comparator;
 import java.util.Iterator;
 
-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.ServerEntry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+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;
@@ -45,7 +45,6 @@
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 
 
 /**
@@ -118,15 +117,15 @@
      * @return
      * @throws NamingException
      */
-    private boolean matchValue( SimpleNode node, Attribute attr, AttributeType type, Normalizer normalizer,
+    private boolean matchValue( SimpleNode node, EntryAttribute attr, AttributeType type, Normalizer normalizer,
         Comparator comparator ) throws NamingException
     {
         // get the normalized AVA filter value
-        Object filterValue = node.getValue();
+        Value<?> filterValue = node.getValue();
 
         // Check if the attribute normalized value match 
         // Fast check. If it succeeds, we are done.
-        if ( AttributeUtils.containsValue( attr, filterValue, type ) )
+        if ( attr.contains( filterValue ) )
         {
             // We are lucky.
             return true;
@@ -137,14 +136,12 @@
          * a lookup to work.  For each value we normalize and use the comparator
          * to determine if a match exists.
          */
-        NamingEnumeration values = attr.getAll();
-
-        while ( values.hasMore() )
+        for ( Value<?> value:attr )
         {
-            Object normValue = normalizer.normalize( values.next() );
+            Object normValue = normalizer.normalize( value.get() );
 
             // TODO Fix DIRSERVER-832
-            if ( 0 == comparator.compare( normValue, filterValue ) )
+            if ( 0 == comparator.compare( normValue, filterValue.get() ) )
             {
                 // The value has been found. get out.
                 return true;
@@ -159,18 +156,18 @@
     /**
      * Get the entry from the backend, if it's not already into the record
      */
-    private Attributes getEntry( IndexRecord rec ) throws NamingException
+    private ServerEntry getEntry( IndexRecord rec ) throws NamingException
     {
         // get the attributes associated with the entry 
-        Attributes entry = rec.getAttributes();
+    	ServerEntry entry = rec.getEntry();
 
         // resuscitate entry if need be
         // TODO Is this really needed ? 
         // How possibly can't we have the entry at this point ?
         if ( null == entry )
         {
-            rec.setAttributes( db.lookup( ( Long ) rec.getEntryId() ) );
-            entry = rec.getAttributes();
+            rec.setEntry( db.lookup( ( Long ) rec.getEntryId() ) );
+            entry = rec.getEntry();
         }
 
         return entry;
@@ -261,13 +258,13 @@
         }
 
         // resuscitate entry if need be
-        if ( null == record.getAttributes() )
+        if ( null == record.getEntry() )
         {
-            record.setAttributes( db.lookup( id ) );
+            record.setEntry( db.lookup( id ) );
         }
 
         // get the attribute associated with the node
-        Attribute attr = AttributeUtils.getAttribute( record.getAttributes(), 
+        EntryAttribute attr = record.getEntry().get( 
         		registries.getAttributeTypeRegistry().lookup( node.getAttribute() ) );
 
         // If we do not have the attribute just return false
@@ -283,7 +280,6 @@
         Normalizer normalizer = getNormalizer( attrId, ORDERING_MATCH );
         Comparator comparator = getComparator( attrId, ORDERING_MATCH );
         Object filterValue = node.getValue();
-        NamingEnumeration list = attr.getAll();
 
         /*
          * Cheaper to not check isGreater in one loop - better to separate
@@ -291,12 +287,12 @@
          */
         if ( isGreaterOrLesser == SimpleNode.EVAL_GREATER )
         {
-            while ( list.hasMore() )
+            for ( Value<?> value:attr )
             {
-                Object value = normalizer.normalize( list.next() );
+                Object normValue = normalizer.normalize( value.get() );
 
                 // Found a value that is greater than or equal to the ava value
-                if ( 0 >= comparator.compare( filterValue, value ) )
+                if ( 0 >= comparator.compare( (String)((Value<?>)filterValue).get(), normValue ) )
                 {
                     return true;
                 }
@@ -304,12 +300,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( filterValue, value ) )
+                if ( 0 <= comparator.compare( filterValue, normValue ) )
                 {
                     return true;
                 }
@@ -350,7 +346,7 @@
         }
 
         // get the attributes associated with the entry 
-        Attributes entry = getEntry( rec );
+        ServerEntry entry = getEntry( rec );
 
         // Of course, if the entry does not contains any attributes
         // (very unlikely !!!), get out of here
@@ -365,7 +361,7 @@
         		registries.getOidRegistry().getOid( attrId ) );
 
         // here, we may have some descendants if the attribute is not found
-        if ( AttributeUtils.getAttribute( entry, type ) != null )
+        if ( entry.get( type ) != null )
         {
             // The current entry contains this attribute. We can exit
             return true;
@@ -384,7 +380,7 @@
                 {
                     AttributeType descendant = descendants.next();
 
-                    if ( AttributeUtils.getAttribute( entry, descendant ) != null )
+                    if ( entry.get( descendant ) != null )
                     {
                         // We have found one descendant : exit
                         return true;
@@ -411,7 +407,7 @@
     private boolean evalEquality( SimpleNode node, IndexRecord rec ) throws NamingException
     {
         String filterAttr = node.getAttribute();
-        Object filterValue = node.getValue();
+        Value<?> filterValue = node.getValue();
 
         // First, check if the attributeType is indexed
         if ( db.hasUserIndexOn( filterAttr ) )
@@ -444,7 +440,7 @@
          * contained.
          */
         // get the attributes associated with the entry 
-        Attributes entry = getEntry( rec );
+        ServerEntry entry = getEntry( rec );
 
         // Of course, if the entry does not contains any attributes
         // (very unlikely !!!), get out of here
@@ -456,13 +452,13 @@
 
         // get the attribute associated with the node 
         AttributeType type = registries.getAttributeTypeRegistry().lookup( filterAttr );
-        Attribute attr = AttributeUtils.getAttribute( entry, type );
+        EntryAttribute attr = entry.get( type );
 
         if ( attr != null )
         {
             // We have found the attribute into the entry.
             // Check if the normalized value is present
-            if ( AttributeUtils.containsValue( attr, filterValue, type ) )
+            if ( attr.contains( filterValue ) )
             {
                 // We are lucky.
                 return true;
@@ -492,7 +488,7 @@
             {
                 AttributeType descendant = descendants.next();
 
-                attr = AttributeUtils.getAttribute( entry, descendant );
+                attr = entry.get( descendant );
 
                 if ( null == attr )
                 {
@@ -501,7 +497,7 @@
                 else
                 {
                     // check if the normalized value is present
-                    if ( AttributeUtils.containsValue( attr, filterValue, descendant ) )
+                    if ( attr.contains( filterValue ) )
                     {
                         return true;
                     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEvaluator.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEvaluator.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEvaluator.java Wed Apr 30 17:06:41 2008
@@ -26,16 +26,16 @@
 
 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.ServerEntry;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+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;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 
 
 /**
@@ -133,14 +133,14 @@
         // Index not defined beyond this point
         // --------------------------------------------------------------------
 
-        Attributes entry = record.getAttributes();
+        ServerEntry entry = record.getEntry();
         
         // resuscitate the entry if it has not been and set entry in IndexRecord
         if ( null == entry )
         {
-            Attributes attrs = db.lookup( (Long)record.getEntryId() );
-            record.setAttributes( attrs );
-            entry = record.getAttributes();
+        	ServerEntry attrs = db.lookup( (Long)record.getEntryId() );
+            record.setEntry( attrs );
+            entry = record.getEntry();
         }
 
         // Of course, if the entry does not contains any attributes
@@ -152,7 +152,7 @@
         }
 
         // get the attribute
-        Attribute attr = AttributeUtils.getAttribute( entry, type );
+        EntryAttribute attr = entry.get( type );
 
         // if the attribute does not exist just return false
         if ( attr != null)
@@ -175,16 +175,13 @@
              * The test uses the comparator obtained from the appropriate 
              * substring matching rule.
              */
-            NamingEnumeration values = attr.getAll();
-            
-            while ( values.hasMore() )
+            for( Value<?> value:attr )
             {
-                String value = ( String ) normalizer.normalize( values.next() );
+                String normValue = ( String ) normalizer.normalize( value.get() );
     
                 // Once match is found cleanup and return true
-                if ( regex.matcher( value ).matches() )
+                if ( regex.matcher( normValue ).matches() )
                 {
-                    values.close();
                     return true;
                 }
             }
@@ -203,7 +200,7 @@
             {
                 AttributeType descendant = descendants.next();
 
-                attr = AttributeUtils.getAttribute( entry, descendant );
+                attr = entry.get( descendant );
 
                 if ( null == attr )
                 {
@@ -229,16 +226,13 @@
                      * The test uses the comparator obtained from the appropriate 
                      * substring matching rule.
                      */
-                    NamingEnumeration values = attr.getAll();
-                    
-                    while ( values.hasMore() )
+                    for ( Value<?> value:attr )
                     {
-                        String value = ( String ) normalizer.normalize( values.next() );
+                        String normValue = ( String ) normalizer.normalize( value.get() );
             
                         // Once match is found cleanup and return true
-                        if ( regex.matcher( value ).matches() )
+                        if ( regex.matcher( normValue ).matches() )
                         {
-                            values.close();
                             return true;
                         }
                     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java Wed Apr 30 17:06:41 2008
@@ -26,7 +26,6 @@
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 
-import javax.naming.directory.Attributes;
 import javax.swing.DefaultCellEditor;
 import javax.swing.JButton;
 import javax.swing.JComboBox;
@@ -40,8 +39,10 @@
 import javax.swing.JTable;
 import javax.swing.JTextField;
 
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,7 +73,7 @@
     private JButton m_cancelBut = new JButton();
     private JPopupMenu m_popup;
 
-    private Attributes m_childEntry = new AttributesImpl();
+    private ServerEntry childEntry = null;
 
 
     /**
@@ -81,10 +82,11 @@
      * @param parent the parent frame
      * @param modal whether or not to go modal on the dialog
      */
-    public AddEntryDialog(Frame parent, boolean modal)
+    public AddEntryDialog(Frame parent, boolean modal, Registries registries )
     {
         super( parent, modal );
-        m_childEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC );
+        childEntry = new DefaultServerEntry( registries );
+        childEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC );
         initGUI();
     }
 
@@ -168,7 +170,7 @@
             javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font(
                 "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) );
 
-        m_attrTbl.setModel( new AttributesTableModel( m_childEntry, null, null, true ) );
+        m_attrTbl.setModel( new AttributesTableModel( childEntry, null, null, true ) );
 
         //
         // Build the table's popup menu
@@ -279,9 +281,9 @@
     }
 
 
-    public Attributes getChildEntry()
+    public ServerEntry getChildEntry()
     {
-        return m_childEntry;
+        return childEntry;
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AttributesTableModel.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AttributesTableModel.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AttributesTableModel.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AttributesTableModel.java Wed Apr 30 17:06:41 2008
@@ -22,12 +22,12 @@
 
 import java.util.ArrayList;
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.swing.table.AbstractTableModel;
 
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Value;
+
 
 /**
  * A general purpose table model for entry attributes.
@@ -49,7 +49,7 @@
     private final transient ArrayList<Object> valList;
 
     /** the attributes for the entry */
-    private final Attributes entry;
+    private final ServerEntry entry;
     /** the unique id of the entry  */
     private final Long id;
     /** the distinguished name of the entry */
@@ -66,42 +66,32 @@
      * @param dn the distinguished name of the entry
      * @param isMutable whether or not the model can be changed
      */
-    public AttributesTableModel(Attributes entry, Long id, String dn, boolean isMutable)
+    public AttributesTableModel( ServerEntry entry, Long id, String dn, boolean isMutable)
     {
         this.dn = dn;
         this.id = id;
         this.entry = entry;
         this.isMutable = isMutable;
 
-        NamingEnumeration<String> list = entry.getIDs();
         int rowCount = 0;
 
-        while ( list.hasMoreElements() )
+        for ( EntryAttribute attribute:entry )
         {
-            String attrId = list.nextElement();
+            String attrId = attribute.getId();
             rowCount = rowCount + entry.get( attrId ).size();
         }
 
         keyList = new ArrayList<Object>( rowCount );
         valList = new ArrayList<Object>( rowCount );
 
-        list = this.entry.getIDs();
-        while ( list.hasMoreElements() )
+        for ( EntryAttribute attribute:entry )
         {
-            String l_key = ( String ) list.nextElement();
-            Attribute l_attr = this.entry.get( l_key );
+            String key = attribute.getId();
 
-            for ( int ii = 0; ii < l_attr.size(); ii++ )
+            for ( Value<?> value:attribute )
             {
-                try
-                {
-                    keyList.add( l_attr.getID() );
-                    valList.add( l_attr.get( ii ) );
-                }
-                catch ( NamingException e )
-                {
-                    e.printStackTrace();
-                }
+                keyList.add( attribute.getId() );
+                valList.add( value.get() );
             }
         }
     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/EntryNode.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/EntryNode.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/EntryNode.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/EntryNode.java Wed Apr 30 17:06:41 2008
@@ -29,9 +29,9 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 import javax.swing.tree.TreeNode;
 
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
 import org.apache.directory.server.core.partition.impl.btree.IndexRecord;
 import org.apache.directory.server.core.partition.impl.btree.SearchEngine;
@@ -49,18 +49,18 @@
 {
     private final BTreePartition partition;
     private final EntryNode parent;
-    private final Attributes entry;
+    private final ServerEntry entry;
     private final ArrayList<TreeNode> children;
     private final Long id;
 
 
-    public EntryNode(Long id, EntryNode parent, BTreePartition partition, Attributes entry, Map<Long, EntryNode> map)
+    public EntryNode(Long id, EntryNode parent, BTreePartition partition, ServerEntry entry, Map<Long, EntryNode> map)
     {
         this( id, parent, partition, entry, map, null, null );
     }
 
 
-    public EntryNode( Long id, EntryNode parent, BTreePartition db, Attributes entry, Map<Long, EntryNode> map,
+    public EntryNode( Long id, EntryNode parent, BTreePartition db, ServerEntry entry, Map<Long, EntryNode> map,
         ExprNode exprNode, SearchEngine engine )
     {
         this.partition = db;
@@ -104,7 +104,7 @@
                     {
                         if ( engine.evaluate( exprNode, (Long)rec.getEntryId() ) )
                         {
-                            Attributes newEntry = db.lookup( (Long)rec.getEntryId() );
+                            ServerEntry newEntry = db.lookup( (Long)rec.getEntryId() );
                             EntryNode child = new EntryNode( (Long)rec.getEntryId(), this, db, newEntry, map, exprNode,
                                 engine );
                             children.add( child );
@@ -116,14 +116,14 @@
                     }
                     else
                     {
-                        Attributes newEntry = db.lookup( (Long)rec.getEntryId() );
+                        ServerEntry newEntry = db.lookup( (Long)rec.getEntryId() );
                         EntryNode child = new EntryNode( (Long)rec.getEntryId(), this, db, newEntry, map, exprNode, engine );
                         children.add( child );
                     }
                 }
                 else
                 {
-                    Attributes newEntry = db.lookup( (Long)rec.getEntryId() );
+                    ServerEntry newEntry = db.lookup( (Long)rec.getEntryId() );
                     EntryNode child = new EntryNode( (Long)rec.getEntryId(), this, db, newEntry, map );
                     children.add( child );
                 }
@@ -210,7 +210,7 @@
     }
 
 
-    public Attributes getLdapEntry()
+    public ServerEntry getLdapEntry()
     {
         return entry;
     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java Wed Apr 30 17:06:41 2008
@@ -36,7 +36,6 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
 import javax.swing.JFileChooser;
 import javax.swing.JFrame;
@@ -67,6 +66,7 @@
 import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.IndexRecord;
+import org.apache.directory.server.schema.registries.Registries;
 
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
@@ -117,6 +117,9 @@
     private Map<Long, EntryNode> nodes;
     private EntryNode root;
 
+    
+    /** A handle on the global registries */
+    private Registries registries;
 
     /**
      * Creates new form JFrame
@@ -124,9 +127,10 @@
      * @param db the partition to view
      * @throws NamingException if there are problems accessing the partition
      */
-    public PartitionFrame( BTreePartition db ) throws NamingException
+    public PartitionFrame( BTreePartition db, Registries registries ) throws NamingException
     {
         partition = db;
+        this.registries = registries;
 
         initialize();
         buildIndicesMenu( partition );
@@ -377,7 +381,7 @@
                 return;
             }
 
-            AddEntryDialog dialog = new AddEntryDialog( this, false );
+            AddEntryDialog dialog = new AddEntryDialog( this, false, registries );
             dialog.setParentDn( parentDn );
 
             centerOnScreen( dialog );
@@ -451,14 +455,14 @@
             {
                 LdifEntry entry = ( LdifEntry ) list.next();
                 String updn = entry.getDn();
-                Attributes attrs = entry.getAttributes();
                 
                 LdapDN ndn = new LdapDN( StringTools.deepTrimToLower( updn ) );
 
+                ServerEntry attrs = ServerEntryUtils.toServerEntry( entry.getAttributes(), ndn, null );
+
                 if ( null == partition.getEntryId( ndn.toString() ) )
                 {
-                    ServerEntry serverEntry = ServerEntryUtils.toServerEntry( attrs, ndn, null );
-                    partition.add( new AddOperationContext( null, ndn, serverEntry ) );
+                    partition.add( new AddOperationContext( null, attrs ) );
                     load();
                 }
             }
@@ -852,7 +856,7 @@
     }
 
 
-    void displayEntry( Long id, Attributes entry ) throws Exception
+    void displayEntry( Long id, ServerEntry entry ) throws Exception
     {
         String dn = partition.getEntryUpdn( id );
         AttributesTableModel model = new AttributesTableModel( entry, id, dn, false );
@@ -870,7 +874,7 @@
         // boolean doFiltered = false;
         nodes = new HashMap<Long, EntryNode>();
 
-        Attributes suffix = partition.getSuffixEntry();
+        ServerEntry suffix = partition.getSuffixEntry();
         Long id = partition.getEntryId( partition.getSuffixDn().toString() );
         root = new EntryNode( id, null, partition, suffix, nodes );
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java Wed Apr 30 17:06:41 2008
@@ -24,6 +24,7 @@
 import java.awt.Toolkit;
 
 import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
+import org.apache.directory.server.schema.registries.Registries;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,11 +43,15 @@
 
     /** A handle on the atomic partition */
     private BTreePartition partition;
+    
+    /** A handle on the global registries */
+    private Registries registries;
 
 
-    public PartitionViewer( BTreePartition db )
+    public PartitionViewer( BTreePartition db, Registries registries )
     {
         this.partition = db;
+        this.registries = registries;
     }
 
 
@@ -59,7 +64,7 @@
                 PartitionFrame frame = null;
                 try
                 {
-                    frame = new PartitionFrame( PartitionViewer.this.partition );
+                    frame = new PartitionFrame( PartitionViewer.this.partition, registries );
                 }
                 catch ( NamingException e )
                 {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Wed Apr 30 17:06:41 2008
@@ -21,7 +21,7 @@
 
 
 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.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
@@ -46,7 +46,6 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 
 import java.io.File;
 import java.util.HashSet;
@@ -241,7 +240,7 @@
             store.setEnableOptimizer( isOptimizerEnabled() );
         }
 
-        store.init( registries.getOidRegistry(), registries.getAttributeTypeRegistry() );
+        store.init( registries );
     }
 
 
@@ -468,11 +467,11 @@
     
     public final void add( AddOperationContext addContext ) throws NamingException
     {
-        store.add( addContext.getDn(), ServerEntryUtils.toAttributesImpl( addContext.getEntry() ) );
+        store.add( addContext.getDn(), addContext.getEntry() );
     }
 
 
-    public final Attributes lookup( Long id ) throws NamingException
+    public final ServerEntry lookup( Long id ) throws NamingException
     {
         return store.lookup( id );
     }
@@ -507,7 +506,7 @@
     }
 
 
-    public final Attributes getSuffixEntry() throws NamingException
+    public final ServerEntry getSuffixEntry() throws NamingException
     {
         return store.getSuffixEntry();
     }
@@ -525,7 +524,7 @@
     }
 
 
-    public final Attributes getIndices( Long id ) throws NamingException
+    public final ServerEntry getIndices( Long id ) throws NamingException
     {
         return store.getIndices( id );
     }
@@ -544,8 +543,10 @@
 
     public final void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws NamingException
     {
-        store.move( moveAndRenameContext.getDn(), moveAndRenameContext.getParent(), 
-        		moveAndRenameContext.getNewRdn(), moveAndRenameContext.getDelOldDn() );
+        store.move( moveAndRenameContext.getDn(), 
+            moveAndRenameContext.getParent(), 
+            moveAndRenameContext.getNewRdn(), 
+            moveAndRenameContext.getDelOldDn() );
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Wed Apr 30 17:06:41 2008
@@ -73,6 +73,7 @@
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.exception.LdapReferralException;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
@@ -112,17 +113,16 @@
 
     private ReferralLut lut = new ReferralLut();
     private PartitionNexus nexus;
-    
+
     /** The attributeType registry */
     private AttributeTypeRegistry atRegistry;
-    
+
     /** Thre global registries */
     private Registries registries;
-    
+
     /** The OID registry */
     private OidRegistry oidRegistry;
 
-    
     static
     {
         /*
@@ -135,11 +135,11 @@
         c.add( ReferralInterceptor.class.getName() );
         c.add( AciAuthorizationInterceptor.class.getName() );
         c.add( DefaultAuthorizationInterceptor.class.getName() );
-//        c.add( ExceptionInterceptor.class.getName() );
+        //        c.add( ExceptionInterceptor.class.getName() );
         c.add( OperationalAttributeInterceptor.class.getName() );
         c.add( SchemaInterceptor.class.getName() );
         c.add( SubentryInterceptor.class.getName() );
-//        c.add( CollectiveAttributeInterceptor.class.getName() );
+        //        c.add( CollectiveAttributeInterceptor.class.getName() );
         c.add( EventInterceptor.class.getName() );
         c.add( TriggerInterceptor.class.getName() );
         SEARCH_BYPASS = Collections.unmodifiableCollection( c );
@@ -149,21 +149,21 @@
     static boolean isReferral( ServerEntry entry ) throws NamingException
     {
         EntryAttribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
-        
+
         if ( oc == null )
         {
             LOG.warn( "could not find objectClass attribute in entry: " + entry );
             return false;
         }
-        
+
         if ( oc.contains( SchemaConstants.REFERRAL_OC ) )
         {
             //We have a referral ObjectClass, let's check that the ref is
             // valid, accordingly to the RFC
-            
+
             // Get the 'ref' attributeType
             EntryAttribute refAttr = entry.get( SchemaConstants.REF_AT );
-            
+
             if ( refAttr == null )
             {
                 // very unlikely, as we have already checked the entry in SchemaInterceptor
@@ -171,24 +171,24 @@
                 LOG.error( message );
                 throw new NamingException( message );
             }
-            
-            for ( Value<?> value:refAttr )
+
+            for ( Value<?> value : refAttr )
             {
-                ServerStringValue ref = (ServerStringValue)value; 
-                
+                ServerStringValue ref = ( ServerStringValue ) value;
+
                 String refVal = ref.get();
-                
+
                 try
                 {
                     LdapURL ldapUrl = new LdapURL( refVal );
-                    
+
                     // We have a LDAP URL, we have to check that :
                     // - we don't have scope specifier
                     // - we don't have filters
                     // - we don't have attribute description list
                     // - we don't have extensions
                     // - the DN is not empty
-                    
+
                     if ( ldapUrl.getScope() != SearchControls.OBJECT_SCOPE )
                     {
                         // This is the default value if we don't have any scope
@@ -198,37 +198,37 @@
                         LOG.error( message );
                         throw new NamingException( message );
                     }
-                    
+
                     if ( !StringTools.isEmpty( ldapUrl.getFilter() ) )
                     {
                         String message = "An LDAPURL should not contains filters";
                         LOG.error( message );
                         throw new NamingException( message );
                     }
-                    
+
                     if ( ( ldapUrl.getAttributes() != null ) && ( ldapUrl.getAttributes().size() != 0 ) )
                     {
                         String message = "An LDAPURL should not contains any description attribute list";
                         LOG.error( message );
                         throw new NamingException( message );
                     }
-                    
+
                     if ( ( ldapUrl.getExtensions() != null ) && ( ldapUrl.getExtensions().size() != 0 ) )
                     {
                         String message = "An LDAPURL should not contains any extension";
                         LOG.error( message );
                         throw new NamingException( message );
                     }
-                    
+
                     if ( ( ldapUrl.getCriticalExtensions() != null ) && ( ldapUrl.getCriticalExtensions().size() != 0 ) )
                     {
                         String message = "An LDAPURL should not contains any critical extension";
                         LOG.error( message );
                         throw new NamingException( message );
                     }
-                    
+
                     LdapDN dn = ldapUrl.getDn();
-                    
+
                     if ( ( dn == null ) || dn.isEmpty() )
                     {
                         String message = "An LDAPURL should contains a non-empty DN";
@@ -242,10 +242,10 @@
                     // we will just ignore this LdapURL.
                 }
             }
-            
+
             return true;
         }
-        
+
         return false;
     }
 
@@ -258,12 +258,12 @@
         oidRegistry = registries.getOidRegistry();
 
         Iterator<String> suffixes = nexus.listSuffixes( null );
-        
+
         while ( suffixes.hasNext() )
         {
             LdapDN suffix = new LdapDN( suffixes.next() );
-            addReferrals( nexus.search( new SearchOperationContext(
-                    registries, suffix, AliasDerefMode.DEREF_ALWAYS, getReferralFilter(), getControls() ) ), suffix );
+            addReferrals( nexus.search( new SearchOperationContext( registries, suffix, AliasDerefMode.DEREF_ALWAYS,
+                getReferralFilter(), getControls() ) ), suffix );
         }
     }
 
@@ -272,10 +272,10 @@
     {
         // handle referral here
         List<String> list = new ArrayList<String>( refs.size() );
-        
-        for ( Value<?> value:refs )
+
+        for ( Value<?> value : refs )
         {
-            String val = (String)value.get();
+            String val = ( String ) value.get();
 
             // need to add non-ldap URLs as-is
             if ( !val.startsWith( "ldap" ) )
@@ -297,14 +297,14 @@
 
             LdapDN urlDn = new LdapDN( ldapUrl.getDn().toNormName() );
             urlDn.normalize( atRegistry.getNormalizerMapping() );
-            
+
             if ( urlDn.equals( farthest ) )
             {
                 // according to the protocol there is no need for the dn since it is the same as this request
-            	StringBuilder buf = new StringBuilder();
+                StringBuilder buf = new StringBuilder();
                 buf.append( ldapUrl.getScheme() );
                 buf.append( ldapUrl.getHost() );
-            
+
                 if ( ldapUrl.getPort() > 0 )
                 {
                     buf.append( ":" );
@@ -322,24 +322,24 @@
              */
             int diff = targetUpdn.size() - farthest.size();
             LdapDN extra = new LdapDN();
-            
+
             for ( int jj = 0; jj < diff; jj++ )
             {
                 extra.add( targetUpdn.get( farthest.size() + jj ) );
             }
 
             urlDn.addAll( extra );
-            
+
             StringBuilder buf = new StringBuilder();
             buf.append( ldapUrl.getScheme() );
             buf.append( ldapUrl.getHost() );
-            
+
             if ( ldapUrl.getPort() > 0 )
             {
                 buf.append( ":" );
                 buf.append( ldapUrl.getPort() );
             }
-            
+
             buf.append( "/" );
             buf.append( LdapURL.urlEncode( urlDn.getUpName(), false ) );
             list.add( buf.toString() );
@@ -349,7 +349,7 @@
     }
 
 
-    public void add(NextInterceptor next, AddOperationContext opContext ) throws NamingException
+    public void add( NextInterceptor next, AddOperationContext opContext ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -361,7 +361,7 @@
         if ( ( refval == null ) || refval.equals( IGNORE ) )
         {
             next.add( opContext );
-            
+
             if ( isReferral( entry ) )
             {
                 lut.referralAdded( name );
@@ -370,11 +370,11 @@
         else if ( refval.equals( THROW ) )
         {
             LdapDN farthest = lut.getFarthestReferralAncestor( name );
-        
+
             if ( farthest == null )
             {
                 next.add( opContext );
-                
+
                 if ( isReferral( entry ) )
                 {
                     lut.referralAdded( name );
@@ -382,10 +382,9 @@
                 return;
             }
 
-            ServerEntry referral = invocation.getProxy().lookup( 
-                    new LookupOperationContext( registries, farthest ), 
-                    PartitionNexusProxy.LOOKUP_BYPASS );
-            
+            ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, farthest ),
+                PartitionNexusProxy.LOOKUP_BYPASS );
+
             AttributeType refsType = atRegistry.lookup( oidRegistry.getOid( SchemaConstants.REF_AT ) );
             EntryAttribute refs = referral.get( refsType );
             doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
@@ -404,8 +403,8 @@
 
     public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws NamingException
     {
-    	LdapDN name = opContext.getDn();
-    	
+        LdapDN name = opContext.getDn();
+
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
@@ -419,16 +418,15 @@
         if ( refval.equals( THROW ) )
         {
             LdapDN farthest = lut.getFarthestReferralAncestor( name );
-            
+
             if ( farthest == null )
             {
                 return next.compare( opContext );
             }
 
-            ServerEntry referral = invocation.getProxy().lookup( 
-                    new LookupOperationContext( registries, farthest ), 
-                    PartitionNexusProxy.LOOKUP_BYPASS );
-            
+            ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, farthest ),
+                PartitionNexusProxy.LOOKUP_BYPASS );
+
             EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
             doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
 
@@ -449,7 +447,7 @@
 
     public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
     {
-    	LdapDN name = opContext.getDn();
+        LdapDN name = opContext.getDn();
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
@@ -458,38 +456,37 @@
         if ( refval == null || refval.equals( IGNORE ) )
         {
             next.delete( opContext );
-            
+
             if ( lut.isReferral( name ) )
             {
                 lut.referralDeleted( name );
             }
-            
+
             return;
         }
 
         if ( refval.equals( THROW ) )
         {
             LdapDN farthest = lut.getFarthestReferralAncestor( name );
-            
+
             if ( farthest == null )
             {
                 next.delete( opContext );
-                
+
                 if ( lut.isReferral( name ) )
                 {
                     lut.referralDeleted( name );
                 }
-                
+
                 return;
             }
 
-            ServerEntry referral = invocation.getProxy().lookup( 
-                    new LookupOperationContext( registries, farthest ), 
-                    PartitionNexusProxy.LOOKUP_BYPASS );
-            
+            ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, farthest ),
+                PartitionNexusProxy.LOOKUP_BYPASS );
+
             EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
             doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
-            
+
         }
         else if ( refval.equals( FOLLOW ) )
         {
@@ -521,7 +518,7 @@
     public void move( NextInterceptor next, MoveOperationContext opContext ) throws NamingException
     {
         LdapDN oldName = opContext.getDn();
-        
+
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
@@ -532,12 +529,12 @@
         if ( refval == null || refval.equals( IGNORE ) )
         {
             next.move( opContext );
-            
+
             if ( lut.isReferral( oldName ) )
             {
                 lut.referralChanged( oldName, newName );
             }
-            
+
             return;
         }
 
@@ -545,24 +542,23 @@
         {
             LdapDN farthestSrc = lut.getFarthestReferralAncestor( oldName );
             LdapDN farthestDst = lut.getFarthestReferralAncestor( newName ); // note will not return newName so safe
-            
+
             if ( farthestSrc == null && farthestDst == null && !lut.isReferral( newName ) )
             {
                 next.move( opContext );
-                
+
                 if ( lut.isReferral( oldName ) )
                 {
                     lut.referralChanged( oldName, newName );
                 }
-                
+
                 return;
             }
             else if ( farthestSrc != null )
             {
-                ServerEntry referral = invocation.getProxy().lookup( 
-                        new LookupOperationContext( registries, farthestSrc ), 
-                        PartitionNexusProxy.LOOKUP_BYPASS );
-                
+                ServerEntry referral = invocation.getProxy().lookup(
+                    new LookupOperationContext( registries, farthestSrc ), PartitionNexusProxy.LOOKUP_BYPASS );
+
                 EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
                 doReferralException( farthestSrc, new LdapDN( oldName.getUpName() ), refs );
             }
@@ -593,11 +589,10 @@
     }
 
 
-    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
-        throws NamingException
+    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext ) throws NamingException
     {
         LdapDN oldName = opContext.getDn();
-        
+
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
@@ -608,7 +603,7 @@
         if ( refval == null || refval.equals( IGNORE ) )
         {
             next.moveAndRename( opContext );
-            
+
             if ( lut.isReferral( oldName ) )
             {
                 lut.referralChanged( oldName, newName );
@@ -620,11 +615,11 @@
         {
             LdapDN farthestSrc = lut.getFarthestReferralAncestor( oldName );
             LdapDN farthestDst = lut.getFarthestReferralAncestor( newName ); // safe to use - does not return newName
-            
+
             if ( farthestSrc == null && farthestDst == null && !lut.isReferral( newName ) )
             {
                 next.moveAndRename( opContext );
-                
+
                 if ( lut.isReferral( oldName ) )
                 {
                     lut.referralChanged( oldName, newName );
@@ -633,13 +628,12 @@
             }
             else if ( farthestSrc != null )
             {
-                ServerEntry referral = invocation.getProxy().lookup( 
-                        new LookupOperationContext( registries, farthestSrc ), 
-                        PartitionNexusProxy.LOOKUP_BYPASS );
-                
+                ServerEntry referral = invocation.getProxy().lookup(
+                    new LookupOperationContext( registries, farthestSrc ), PartitionNexusProxy.LOOKUP_BYPASS );
+
                 EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
                 doReferralException( farthestSrc, new LdapDN( oldName.getUpName() ), refs );
-                
+
             }
             else if ( farthestDst != null )
             {
@@ -668,11 +662,10 @@
     }
 
 
-    public void rename( NextInterceptor next, RenameOperationContext opContext )
-        throws NamingException
+    public void rename( NextInterceptor next, RenameOperationContext opContext ) throws NamingException
     {
         LdapDN oldName = opContext.getDn();
-        
+
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
@@ -685,12 +678,12 @@
         if ( refval == null || refval.equals( IGNORE ) )
         {
             next.rename( opContext );
-            
+
             if ( lut.isReferral( oldName ) )
             {
                 lut.referralChanged( oldName, newName );
             }
-            
+
             return;
         }
 
@@ -698,28 +691,27 @@
         {
             LdapDN farthestSrc = lut.getFarthestReferralAncestor( oldName );
             LdapDN farthestDst = lut.getFarthestReferralAncestor( newName );
-            
+
             if ( farthestSrc == null && farthestDst == null && !lut.isReferral( newName ) )
             {
                 next.rename( opContext );
-                
+
                 if ( lut.isReferral( oldName ) )
                 {
                     lut.referralChanged( oldName, newName );
                 }
-                
+
                 return;
             }
-            
+
             if ( farthestSrc != null )
             {
-                ServerEntry referral = invocation.getProxy().lookup( 
-                        new LookupOperationContext( registries, farthestSrc ), 
-                        PartitionNexusProxy.LOOKUP_BYPASS );
-                
+                ServerEntry referral = invocation.getProxy().lookup(
+                    new LookupOperationContext( registries, farthestSrc ), PartitionNexusProxy.LOOKUP_BYPASS );
+
                 EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
                 doReferralException( farthestSrc, new LdapDN( oldName.getUpName() ), refs );
-                
+
             }
             else if ( farthestDst != null )
             {
@@ -760,7 +752,8 @@
         {
             if ( mod.getAttribute().getId().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
             {
-                boolean modsOcHasReferral = ((ServerAttribute)mod.getAttribute()).contains( SchemaConstants.REFERRAL_OC );
+                boolean modsOcHasReferral = ( ( ServerAttribute ) mod.getAttribute() )
+                    .contains( SchemaConstants.REFERRAL_OC );
 
                 switch ( mod.getOperation() )
                 {
@@ -768,35 +761,35 @@
                      * if ADD op where refferal is added to objectClass of a
                      * non-referral entry then we add a new referral to lut
                      */
-                    case ADD_ATTRIBUTE :
+                    case ADD_ATTRIBUTE:
                         if ( modsOcHasReferral && !isTargetReferral )
                         {
                             lut.referralAdded( name );
                         }
-                    
+
                         break;
 
-                        /*
-                        * if REMOVE op where refferal is removed from objectClass of a
-                        * referral entry then we remove the referral from lut
-                        */
-                    case REMOVE_ATTRIBUTE :
+                    /*
+                    * if REMOVE op where refferal is removed from objectClass of a
+                    * referral entry then we remove the referral from lut
+                    */
+                    case REMOVE_ATTRIBUTE:
                         if ( modsOcHasReferral && isTargetReferral )
                         {
                             lut.referralDeleted( name );
                         }
-                    
+
                         break;
 
-                        /*
-                        * if REPLACE op on referral has new set of OC values which does
-                        * not contain a referral value then we remove the referral from
-                        * the lut
-                        *
-                        * if REPLACE op on non-referral has new set of OC values with
-                        * referral value then we add the new referral to the lut
-                        */
-                    case REPLACE_ATTRIBUTE :
+                    /*
+                    * if REPLACE op on referral has new set of OC values which does
+                    * not contain a referral value then we remove the referral from
+                    * the lut
+                    *
+                    * if REPLACE op on non-referral has new set of OC values with
+                    * referral value then we add the new referral to the lut
+                    */
+                    case REPLACE_ATTRIBUTE:
                         if ( isTargetReferral && !modsOcHasReferral )
                         {
                             lut.referralDeleted( name );
@@ -805,7 +798,7 @@
                         {
                             lut.referralAdded( name );
                         }
-                    
+
                         break;
 
                     default:
@@ -837,7 +830,7 @@
         if ( refval.equals( THROW ) )
         {
             LdapDN farthest = lut.getFarthestReferralAncestor( name );
-            
+
             if ( farthest == null )
             {
                 next.modify( opContext );
@@ -845,10 +838,9 @@
                 return;
             }
 
-            ServerEntry referral = invocation.getProxy().lookup( 
-                    new LookupOperationContext( registries, farthest ), 
-                    PartitionNexusProxy.LOOKUP_BYPASS );
-            
+            ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, farthest ),
+                PartitionNexusProxy.LOOKUP_BYPASS );
+
             EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
             doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
         }
@@ -866,7 +858,7 @@
 
     static ExprNode getReferralFilter()
     {
-        return new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.REFERRAL_OC );
+        return new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, new ClientStringValue( SchemaConstants.REFERRAL_OC ) );
     }
 
 
@@ -879,7 +871,8 @@
     }
 
 
-    public void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext ) throws NamingException
+    public void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext )
+        throws NamingException
     {
         next.addContextPartition( opContext );
 
@@ -887,20 +880,22 @@
         Partition partition = opContext.getPartition();
         LdapDN suffix = partition.getSuffixDn();
         Invocation invocation = InvocationStack.getInstance().peek();
-        NamingEnumeration<ServerSearchResult> list = invocation.getProxy().search( new SearchOperationContext( registries, suffix,
-                AliasDerefMode.DEREF_ALWAYS, getReferralFilter(), getControls() ), SEARCH_BYPASS );
+        NamingEnumeration<ServerSearchResult> list = invocation.getProxy().search(
+            new SearchOperationContext( registries, suffix, AliasDerefMode.DEREF_ALWAYS, getReferralFilter(),
+                getControls() ), SEARCH_BYPASS );
         addReferrals( list, suffix );
     }
 
 
-    public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws NamingException
+    public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext )
+        throws NamingException
     {
         // remove referrals immediately before removing the partition
         Invocation invocation = InvocationStack.getInstance().peek();
-        NamingEnumeration<ServerSearchResult> list = invocation.getProxy().search( 
+        NamingEnumeration<ServerSearchResult> list = invocation.getProxy().search(
             new SearchOperationContext( registries, opContext.getDn(), AliasDerefMode.DEREF_ALWAYS,
-                    getReferralFilter(), getControls() ), SEARCH_BYPASS );
-        
+                getReferralFilter(), getControls() ), SEARCH_BYPASS );
+
         deleteReferrals( list, opContext.getDn() );
         next.removeContextPartition( opContext );
     }
@@ -909,12 +904,12 @@
     private void addReferrals( NamingEnumeration<ServerSearchResult> referrals, LdapDN base ) throws NamingException
     {
         while ( referrals.hasMore() )
-        {   
-        	ServerSearchResult r = referrals.next();
+        {
+            ServerSearchResult r = referrals.next();
             LdapDN referral;
             LdapDN result = new LdapDN( r.getDn() );
             result.normalize( atRegistry.getNormalizerMapping() );
-            
+
             if ( r.isRelative() )
             {
                 referral = ( LdapDN ) base.clone();
@@ -931,7 +926,7 @@
     {
         while ( referrals.hasMore() )
         {
-        	ServerSearchResult r = referrals.next();
+            ServerSearchResult r = referrals.next();
             LdapDN referral;
             LdapDN result = new LdapDN( r.getDn() );
             result.normalize( atRegistry.getNormalizerMapping() );
@@ -941,7 +936,7 @@
                 referral = ( LdapDN ) base.clone();
                 referral.addAll( result );
             }
-            
+
             // Now, remove the referral from the cache
             lut.referralDeleted( result );
         }
@@ -960,10 +955,9 @@
         {
             return next.search( opContext );
         }
-        
+
         LdapDN base = opContext.getDn();
         SearchControls controls = opContext.getSearchControls();
-        
 
         /**
          * THROW_FINDING_BASE is a special setting which allows for finding base to 
@@ -974,43 +968,47 @@
         {
             if ( lut.isReferral( base ) )
             {
-                ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, base ), PartitionNexusProxy.LOOKUP_BYPASS );
+                ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, base ),
+                    PartitionNexusProxy.LOOKUP_BYPASS );
                 EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
                 doReferralExceptionOnSearchBase( base, refs, controls.getSearchScope() );
             }
 
             LdapDN farthest = lut.getFarthestReferralAncestor( base );
-            
+
             if ( farthest == null )
             {
                 return next.search( opContext );
             }
 
-            ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
+            ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, farthest ),
+                PartitionNexusProxy.LOOKUP_BYPASS );
             EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
             doReferralExceptionOnSearchBase( farthest, new LdapDN( base.getUpName() ), refs, controls.getSearchScope() );
             throw new IllegalStateException( "Should never get here: shutting up compiler" );
         }
-        
+
         if ( refval.equals( THROW ) )
         {
             if ( lut.isReferral( base ) )
             {
-                ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, base ), PartitionNexusProxy.LOOKUP_BYPASS );
+                ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, base ),
+                    PartitionNexusProxy.LOOKUP_BYPASS );
                 EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
                 doReferralExceptionOnSearchBase( base, refs, controls.getSearchScope() );
             }
 
             LdapDN farthest = lut.getFarthestReferralAncestor( base );
-            
+
             if ( farthest == null )
             {
-                SearchResultFilteringEnumeration srfe = 
-                    ( SearchResultFilteringEnumeration ) next.search( opContext );
-                return new ReferralHandlingEnumeration( srfe, lut, opContext.getRegistries(), nexus, controls.getSearchScope(), true );
+                SearchResultFilteringEnumeration srfe = ( SearchResultFilteringEnumeration ) next.search( opContext );
+                return new ReferralHandlingEnumeration( srfe, lut, opContext.getRegistries(), nexus, controls
+                    .getSearchScope(), true );
             }
 
-            ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
+            ServerEntry referral = invocation.getProxy().lookup( new LookupOperationContext( registries, farthest ),
+                PartitionNexusProxy.LOOKUP_BYPASS );
             EntryAttribute refs = referral.get( SchemaConstants.REF_AT );
             doReferralExceptionOnSearchBase( farthest, new LdapDN( base.getUpName() ), refs, controls.getSearchScope() );
             throw new IllegalStateException( "Should never get here: shutting up compiler" );
@@ -1040,8 +1038,8 @@
     {
         // handle referral here
         List<String> list = new ArrayList<String>( refs.size() );
-        
-        for ( Value<?> value:refs )
+
+        for ( Value<?> value : refs )
         {
             String val = ( String ) value.get();
 
@@ -1066,31 +1064,31 @@
             StringBuilder buf = new StringBuilder();
             buf.append( ldapUrl.getScheme() );
             buf.append( ldapUrl.getHost() );
-            
+
             if ( ldapUrl.getPort() > 0 )
             {
                 buf.append( ":" );
                 buf.append( ldapUrl.getPort() );
             }
-            
+
             buf.append( "/" );
             buf.append( LdapURL.urlEncode( ldapUrl.getDn().getUpName(), false ) );
             buf.append( "??" );
 
             switch ( scope )
             {
-                case ( SearchControls.SUBTREE_SCOPE  ):
+                case ( SearchControls.SUBTREE_SCOPE   ):
                     buf.append( "sub" );
                     break;
-                    
-                case ( SearchControls.ONELEVEL_SCOPE  ):
+
+                case ( SearchControls.ONELEVEL_SCOPE   ):
                     buf.append( "one" );
                     break;
-                    
-                case ( SearchControls.OBJECT_SCOPE  ):
+
+                case ( SearchControls.OBJECT_SCOPE   ):
                     buf.append( "base" );
                     break;
-                    
+
                 default:
                     throw new IllegalStateException( "Unknown recognized search scope: " + scope );
             }
@@ -1107,8 +1105,8 @@
     {
         // handle referral here
         List<String> list = new ArrayList<String>( refs.size() );
-        
-        for ( Value<?> value:refs )
+
+        for ( Value<?> value : refs )
         {
             String val = ( String ) value.get();
 
@@ -1121,7 +1119,7 @@
 
             // parse the ref value and normalize the DN according to schema 
             LdapURL ldapUrl = new LdapURL();
-            
+
             try
             {
                 ldapUrl.parse( val.toCharArray() );
@@ -1135,52 +1133,53 @@
             urlDn.normalize( atRegistry.getNormalizerMapping() );
             int diff = targetUpdn.size() - farthest.size();
             LdapDN extra = new LdapDN();
-            
+
             for ( int jj = 0; jj < diff; jj++ )
             {
                 extra.add( targetUpdn.get( farthest.size() + jj ) );
             }
 
             urlDn.addAll( extra );
-            
+
             StringBuilder buf = new StringBuilder();
             buf.append( ldapUrl.getScheme() );
             buf.append( ldapUrl.getHost() );
-            
+
             if ( ldapUrl.getPort() > 0 )
             {
                 buf.append( ":" );
                 buf.append( ldapUrl.getPort() );
             }
-            
+
             buf.append( "/" );
             buf.append( LdapURL.urlEncode( urlDn.getUpName(), false ) );
             buf.append( "??" );
 
             switch ( scope )
             {
-                case ( SearchControls.SUBTREE_SCOPE  ):
+                case ( SearchControls.SUBTREE_SCOPE   ):
                     buf.append( "sub" );
                     break;
-                    
-                case ( SearchControls.ONELEVEL_SCOPE  ):
+
+                case ( SearchControls.ONELEVEL_SCOPE   ):
                     buf.append( "one" );
                     break;
-                    
-                case ( SearchControls.OBJECT_SCOPE  ):
+
+                case ( SearchControls.OBJECT_SCOPE   ):
                     buf.append( "base" );
                     break;
-                    
+
                 default:
                     throw new IllegalStateException( "Unknown recognized search scope: " + scope );
             }
-            
+
             list.add( buf.toString() );
         }
 
         throw new LdapReferralException( list );
     }
 
+
     /**
      * Check if the given name is a referral or not.
      * 
@@ -1201,6 +1200,7 @@
         return lut.isReferral( dn );
     }
 
+
     /**
      * Check if the given name is a referral or not.
      * 
@@ -1210,6 +1210,7 @@
      */
     public boolean isReferral( LdapDN name ) throws NamingException
     {
-  		return lut.isReferral( name.isNormalized() ? name :  LdapDN.normalize( name, atRegistry.getNormalizerMapping() ) );
+        return lut
+            .isReferral( name.isNormalized() ? name : LdapDN.normalize( name, atRegistry.getNormalizerMapping() ) );
     }
 }



Mime
View raw message