You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/05/21 23:33:00 UTC
svn commit: r658884 - in /directory/apacheds/branches/bigbang/core/src:
main/java/org/apache/directory/server/core/partition/impl/btree/gui/
test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
Author: akarasulu
Date: Wed May 21 14:33:00 2008
New Revision: 658884
URL: http://svn.apache.org/viewvc?rev=658884&view=rev
Log:
fixing breakage by replacing NamingException and NamingEnumeration
Removed:
directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeIteratorTest.java
Modified:
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/EntryNode.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java
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=658884&r1=658883&r2=658884&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 May 21 14:33:00 2008
@@ -27,14 +27,14 @@
import java.util.List;
import java.util.Map;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
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.xdbm.ForwardIndexEntry;
+import org.apache.directory.server.xdbm.IndexCursor;
import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.server.xdbm.search.SearchEngine;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -81,11 +81,11 @@
try
{
List<ForwardIndexEntry> recordForwards = new ArrayList<ForwardIndexEntry>();
- NamingEnumeration<IndexEntry> childList = db.list( id );
+ IndexCursor<Long,ServerEntry> childList = db.list( id );
- while ( childList.hasMore() )
+ while ( childList.next() )
{
- IndexEntry old = childList.next();
+ IndexEntry old = childList.get();
ForwardIndexEntry newRec = new ForwardIndexEntry();
newRec.copy( old );
recordForwards.add( newRec );
@@ -101,12 +101,13 @@
if ( engine != null && exprNode != null )
{
- if ( db.getChildCount( (Long)rec.getId() ) == 0 )
+ if ( db.getChildCount( rec.getId() ) == 0 )
{
- if ( engine.evaluate( exprNode, (Long)rec.getId() ) )
+ Evaluator evaluator = engine.evaluator( exprNode );
+ if ( evaluator.evaluate( rec.getId() ) )
{
- ServerEntry newEntry = db.lookup( (Long)rec.getEntryId() );
- EntryNode child = new EntryNode( (Long)rec.getEntryId(), this, db, newEntry, map, exprNode, engine );
+ ServerEntry newEntry = db.lookup( rec.getId() );
+ EntryNode child = new EntryNode( rec.getId(), this, db, newEntry, map, exprNode, engine );
children.add( child );
}
else
@@ -116,15 +117,15 @@
}
else
{
- ServerEntry newEntry = db.lookup( (Long)rec.getEntryId() );
- EntryNode child = new EntryNode( (Long)rec.getEntryId(), this, db, newEntry, map, exprNode, engine );
+ ServerEntry newEntry = db.lookup( rec.getId() );
+ EntryNode child = new EntryNode( rec.getId(), this, db, newEntry, map, exprNode, engine );
children.add( child );
}
}
else
{
- ServerEntry newEntry = db.lookup( (Long)rec.getEntryId() );
- EntryNode child = new EntryNode( (Long)rec.getEntryId(), this, db, newEntry, map );
+ ServerEntry newEntry = db.lookup( (Long)rec.getId() );
+ EntryNode child = new EntryNode( (Long)rec.getId(), this, db, newEntry, map );
children.add( child );
}
}
@@ -180,7 +181,7 @@
}
- public String getEntryDn() throws NamingException
+ public String getEntryDn() throws Exception
{
return partition.getEntryDn( id );
}
@@ -196,7 +197,7 @@
buf.append( "(" ).append( id ).append( ") " );
buf.append( dn.getRdn() );
}
- catch ( NamingException e )
+ catch ( Exception e )
{
buf.append( "ERROR: " + e.getMessage() );
}
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=658884&r1=658883&r2=658884&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 May 21 14:33:00 2008
@@ -34,7 +34,6 @@
import java.util.Map;
import java.util.Stack;
-import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.SearchControls;
import javax.swing.JFileChooser;
@@ -65,6 +64,7 @@
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.server.xdbm.IndexCursor;
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.schema.registries.Registries;
@@ -127,7 +127,7 @@
* @param db the partition to view
* @throws NamingException if there are problems accessing the partition
*/
- public PartitionFrame( BTreePartition db, Registries registries ) throws NamingException
+ public PartitionFrame( BTreePartition db, Registries registries ) throws Exception
{
partition = db;
this.registries = registries;
@@ -144,7 +144,7 @@
*
* @throws NamingException on partition access errors
*/
- private void initialize() throws NamingException
+ private void initialize() throws Exception
{
mainPnl.setBorder( null );
mainPnl.setLayout( new java.awt.BorderLayout() );
@@ -218,7 +218,14 @@
{
public void actionPerformed( ActionEvent e )
{
- exitForm();
+ try
+ {
+ exitForm();
+ }
+ catch ( Exception e1 )
+ {
+ e1.printStackTrace();
+ }
}
} );
@@ -257,7 +264,14 @@
{
public void windowClosing( java.awt.event.WindowEvent evt )
{
- exitForm();
+ try
+ {
+ exitForm();
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
}
} );
@@ -317,7 +331,7 @@
{
doFilterDialog( an_event.getActionCommand() );
}
- catch ( NamingException e )
+ catch ( Exception e )
{
e.printStackTrace();
}
@@ -402,7 +416,7 @@
* nothing has been selected yet.
* @throws NamingException on partition access errors
*/
- public String getSelectedDn() throws NamingException
+ public String getSelectedDn() throws Exception
{
TreePath path = tree.getSelectionModel().getSelectionPath();
@@ -488,7 +502,7 @@
/**
* Exit the Application
*/
- private void exitForm()
+ private void exitForm() throws Exception
{
setEnabled( false );
setVisible( false );
@@ -551,7 +565,7 @@
}
- public void doFilterDialog( final String mode ) throws NamingException
+ public void doFilterDialog( final String mode ) throws Exception
{
final FilterDialog dialog = new FilterDialog( mode, this, true );
@@ -652,17 +666,17 @@
limitMax = Integer.parseInt( limit );
}
- NamingEnumeration cursor = partition
- .getSearchEngine().search( new LdapDN( base ), AliasDerefMode.DEREF_ALWAYS, root, ctls );
+ IndexCursor<Long,ServerEntry> cursor = partition
+ .getSearchEngine().cursor( new LdapDN( base ), AliasDerefMode.DEREF_ALWAYS, root, ctls );
String[] cols = new String[2];
cols[0] = "id";
cols[1] = "dn";
DefaultTableModel tableModel = new DefaultTableModel( cols, 0 );
Object[] row = new Object[2];
int count = 0;
- while ( cursor.hasMore() && count < limitMax )
+ while ( cursor.next() && count < limitMax )
{
- IndexEntry rec = ( IndexEntry ) cursor.next();
+ IndexEntry rec = ( IndexEntry ) cursor.get();
row[0] = rec.getId();
row[1] = partition.getEntryDn( ( Long ) row[0] );
tableModel.addRow( row );
@@ -869,7 +883,7 @@
}
- private void load() throws NamingException
+ private void load() throws Exception
{
// boolean doFiltered = false;
nodes = new HashMap<Long, EntryNode>();
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=658884&r1=658883&r2=658884&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 May 21 14:33:00 2008
@@ -56,7 +56,7 @@
// added return value so expressions in debugger does not freak with void
- public int execute() throws NamingException
+ public int execute() throws Exception
{
Thread t = new Thread( new Runnable() {
public void run()
@@ -66,7 +66,7 @@
{
frame = new PartitionFrame( PartitionViewer.this.partition, registries );
}
- catch ( NamingException e )
+ catch ( Exception e )
{
e.printStackTrace();
return;