1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.db.gui;
18
19
20 import org.apache.ldap.common.filter.ExprNode;
21 import org.apache.ldap.common.filter.FilterParser;
22 import org.apache.ldap.common.filter.FilterParserImpl;
23 import org.apache.ldap.common.ldif.LdifIterator;
24 import org.apache.ldap.common.ldif.LdifParser;
25 import org.apache.ldap.common.ldif.LdifParserImpl;
26 import org.apache.ldap.common.message.DerefAliasesEnum;
27 import org.apache.ldap.common.message.LockableAttributesImpl;
28 import org.apache.ldap.common.name.LdapName;
29 import org.apache.ldap.common.util.StringTools;
30 import org.apache.ldap.server.db.Database;
31 import org.apache.ldap.server.db.Index;
32 import org.apache.ldap.server.db.IndexRecord;
33 import org.apache.ldap.server.db.SearchEngine;
34
35 import javax.naming.NamingEnumeration;
36 import javax.naming.NamingException;
37 import javax.naming.directory.Attributes;
38 import javax.naming.directory.SearchControls;
39 import javax.swing.*;
40 import javax.swing.event.TreeSelectionEvent;
41 import javax.swing.event.TreeSelectionListener;
42 import javax.swing.table.DefaultTableModel;
43 import javax.swing.tree.DefaultTreeModel;
44 import javax.swing.tree.TreeModel;
45 import javax.swing.tree.TreeNode;
46 import javax.swing.tree.TreePath;
47 import java.awt.*;
48 import java.awt.event.ActionEvent;
49 import java.awt.event.ActionListener;
50 import java.io.File;
51 import java.io.FileNotFoundException;
52 import java.io.FileReader;
53 import java.io.IOException;
54 import java.math.BigInteger;
55 import java.util.HashMap;
56 import java.util.Hashtable;
57 import java.util.Iterator;
58 import java.util.Stack;
59
60
61 /***
62 * The frame for the database.
63 *
64 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
65 * @version $Rev: 159259 $
66 */
67 public class MainFrame extends JFrame
68 {
69 private static final long serialVersionUID = 4049353102291513657L;
70
71
72 private JLabel statusBar = new JLabel( "Ready" );
73 private JPanel mainPnl = new JPanel();
74 private JSplitPane splitPane = new JSplitPane();
75 private JTabbedPane tabbedPane = new JTabbedPane();
76 private JPanel entryPnl = new JPanel();
77 private JPanel idxPnl = new JPanel();
78 private JScrollPane treePane = new JScrollPane();
79 private JTree tree = new JTree();
80 private JScrollPane entryPane = new JScrollPane();
81 private JTable entryTbl = new JTable();
82 private JScrollPane idxPane = new JScrollPane();
83 private JTable idxTbl = new JTable();
84 private JMenu searchMenu = new JMenu();
85 private JMenuItem annotate = new JMenuItem();
86 private JMenuItem run = new JMenuItem();
87 private JMenuItem debug = new JMenuItem();
88 private JMenu indices = new JMenu();
89
90
91 private Database database = null;
92 private boolean doCleanUp = false;
93 private HashMap nodes = new HashMap();
94 private EntryNode root = null;
95 private SearchEngine eng = null;
96
97
98 /***
99 * Creates new form JFrame
100 */
101 public MainFrame( Database db, SearchEngine eng )
102 throws NamingException
103 {
104 database = db;
105 this.eng = eng;
106
107 initGUI();
108 buildIndicesMenu( database );
109 pack();
110 load();
111 }
112
113
114 /***
115 * This method is called from within the constructor to initialize the form
116 */
117 private void initGUI()
118 {
119 mainPnl.setBorder( null );
120 mainPnl.setLayout( new java.awt.BorderLayout() );
121 mainPnl.add( splitPane, java.awt.BorderLayout.CENTER );
122 splitPane.add( tabbedPane, javax.swing.JSplitPane.RIGHT );
123 splitPane.add( treePane, javax.swing.JSplitPane.LEFT );
124 tabbedPane.add( entryPnl, "Entry Attributes" );
125 tabbedPane.add( idxPnl, "Entry Indices" );
126
127 entryPnl.setLayout( new java.awt.BorderLayout() );
128 entryPnl.add( entryPane, java.awt.BorderLayout.CENTER );
129
130 idxPnl.setLayout( new java.awt.BorderLayout() );
131 idxPnl.add( idxPane, java.awt.BorderLayout.CENTER );
132
133 getContentPane().setLayout( new java.awt.BorderLayout() );
134 JPanel content = new JPanel();
135 content.setPreferredSize( new java.awt.Dimension( 798, 461 ) );
136 content.setLayout( new java.awt.BorderLayout() );
137 content.setBorder( javax.swing.BorderFactory.createEtchedBorder() );
138 content.add( mainPnl, java.awt.BorderLayout.NORTH );
139 getContentPane().add( content, BorderLayout.CENTER );
140
141 setTitle( "Backend DB Viewer" );
142
143 getContentPane().add( statusBar, BorderLayout.SOUTH );
144
145 JMenuBar menuBar = new JMenuBar();
146
147
148
149
150
151 JMenu backendMenu = new JMenu( "Backend" );
152 backendMenu.setText( "Backend" );
153 backendMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
154 backendMenu.setMnemonic( 'B' );
155
156
157 JMenuItem add = new JMenuItem( "Add" );
158 backendMenu.add( add );
159 add.setMnemonic( 'A' );
160 add.setBackground( new java.awt.Color( 205, 205, 205 ) );
161 add.addActionListener( new ActionListener()
162 {
163 public void actionPerformed( ActionEvent e )
164 {
165 doAddDialog();
166 }
167 } );
168
169
170 JMenuItem importItem = new JMenuItem( "Import" );
171 backendMenu.add( importItem );
172 importItem.setMnemonic( 'I' );
173 importItem.setBackground( new java.awt.Color( 205, 205, 205 ) );
174 importItem.addActionListener( new ActionListener()
175 {
176 public void actionPerformed( ActionEvent e )
177 {
178 doImport();
179 }
180 } );
181
182
183 JMenuItem exit = new JMenuItem( "Exit" );
184 backendMenu.add( exit );
185 exit.setMnemonic( 'E' );
186 exit.setBackground( new java.awt.Color( 205, 205, 205 ) );
187 exit.addActionListener( new ActionListener()
188 {
189 public void actionPerformed( ActionEvent e )
190 {
191 exitForm();
192 }
193 } );
194
195
196 JMenu helpMenu = new JMenu( "Help" );
197 helpMenu.setMnemonic( 'H' );
198 JMenuItem about = new JMenuItem( "About" );
199 about.setMnemonic( 'A' );
200 about.setBackground( new java.awt.Color( 205,205,205 ) );
201 about.addActionListener( new ActionListener()
202 {
203 public void actionPerformed( ActionEvent e )
204 {
205 AboutDialog aboutDialog =
206 new AboutDialog ( MainFrame.this, true );
207 MainFrame.this.centerOnScreen( aboutDialog );
208 aboutDialog.setVisible( true );
209 }
210 } );
211 helpMenu.setBackground( new java.awt.Color( 205,205,205 ) );
212 helpMenu.add( about );
213
214
215
216 menuBar.setBackground( new java.awt.Color( 196,197,203 ) );
217 menuBar.add( backendMenu );
218 menuBar.add( searchMenu );
219 menuBar.add( indices );
220 menuBar.add( helpMenu );
221
222 setJMenuBar( menuBar );
223 setBounds( new java.awt.Rectangle( 0, 0, 802, 515 ) );
224 setSize( new java.awt.Dimension( 802,515 ) );
225 setResizable( true );
226
227 addWindowListener( new java.awt.event.WindowAdapter()
228 {
229 public void windowClosing( java.awt.event.WindowEvent evt )
230 {
231 exitForm();
232 }
233 } );
234
235 treePane.getViewport().add( tree );
236 tree.setBounds( new java.awt.Rectangle( 6,184,82,80 ) );
237 tree.setShowsRootHandles( true );
238 tree.setToolTipText( "DB DIT" );
239 tree.setScrollsOnExpand( true );
240 tree.getSelectionModel().addTreeSelectionListener(
241 new TreeSelectionListener()
242 {
243 public void valueChanged( TreeSelectionEvent e )
244 {
245 TreePath path = e.getNewLeadSelectionPath();
246
247 if ( path == null )
248 {
249 return;
250 }
251
252 Object last = path.getLastPathComponent();
253 try
254 {
255 if ( last instanceof EntryNode )
256 {
257 displayEntry( ( ( EntryNode ) last ).getEntryId(),
258 ( ( EntryNode ) last).getLdapEntry() );
259 }
260 }
261 catch( Exception ex )
262 {
263 ex.printStackTrace();
264 }
265 }
266 } );
267
268 entryPane.getViewport().add( entryTbl );
269 entryTbl.setBounds( new java.awt.Rectangle( 321,103,32,32 ) );
270
271 idxPane.getViewport().add( idxTbl );
272 idxTbl.setBounds( new java.awt.Rectangle( 429,134,32,32 ) );
273
274 treePane.setSize( new java.awt.Dimension( 285, 435 ) );
275 treePane.setPreferredSize( new java.awt.Dimension( 285, 403 ) );
276 searchMenu.setText( "Search" );
277 searchMenu.setBackground( new java.awt.Color( 205,205,205 ) );
278 searchMenu.add( run );
279 searchMenu.add( debug );
280 searchMenu.add( annotate );
281
282 ActionListener searchHandler = new ActionListener()
283 {
284 public void actionPerformed( ActionEvent an_event )
285 {
286 System.out.println( "action command = "
287 + an_event.getActionCommand() );
288 doFilterDialog( an_event.getActionCommand() );
289 }
290 };
291
292 annotate.setText( FilterDialog.ANNOTATE_MODE );
293 annotate.setActionCommand( FilterDialog.ANNOTATE_MODE );
294 annotate.setBackground( new java.awt.Color( 205,205,205 ) );
295 annotate.addActionListener( searchHandler );
296
297 run.setText( FilterDialog.RUN_MODE );
298 run.setActionCommand( FilterDialog.RUN_MODE );
299 run.setBackground( new java.awt.Color( 205,205,205 ) );
300 run.addActionListener( searchHandler );
301
302 debug.setText( FilterDialog.DEBUG_MODE );
303 debug.setActionCommand( FilterDialog.DEBUG_MODE );
304 debug.setBackground( new java.awt.Color( 205,205,205 ) );
305 debug.addActionListener( searchHandler );
306
307 indices.setText( "Indices" );
308 indices.setBackground( new java.awt.Color( 205, 205, 205 ) );
309 }
310
311
312 private void centerOnScreen( Window window )
313 {
314 Dimension frameSize = window.getSize();
315 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
316
317 frameSize.height = ( ( frameSize.height > screenSize.height )
318 ? screenSize.height : frameSize.height );
319 frameSize.width = ( ( frameSize.width > screenSize.width )
320 ? screenSize.width : frameSize.width );
321 window.setLocation( ( screenSize.width - frameSize.width ) / 2,
322 ( screenSize.height - frameSize.height ) / 2 );
323 }
324
325
326 /***
327 * Displays a entry addition dialog.
328 */
329 public void doAddDialog()
330 {
331 try
332 {
333 TreePath path = tree.getSelectionModel().getSelectionPath();
334 String parentDn = database.getSuffix().toString();
335
336 if ( null != path )
337 {
338 Object last = path.getLastPathComponent();
339
340 if( last instanceof EntryNode )
341 {
342 parentDn = ( ( EntryNode ) last ).getEntryDn();
343 }
344 }
345
346 if ( null == parentDn )
347 {
348 JOptionPane.showMessageDialog( this,
349 "Must select a parent entry to add a child to!" );
350 return;
351 }
352
353 AddEntryDialog dialog = new AddEntryDialog( this, false );
354 dialog.setParentDn( parentDn );
355
356 centerOnScreen( dialog );
357 dialog.setEnabled( true );
358 dialog.setVisible( true );
359 }
360 catch ( Exception e )
361 {
362 e.printStackTrace();
363 }
364 }
365
366
367 /***
368 * Gets the DN of the DIT node selected in the tree view.
369 *
370 * @return the DN of the selected tree node or the root Dn of the tree if
371 * nothing has been selected yet.
372 */
373 public String getSelectedDn()
374 {
375 TreePath path = tree.getSelectionModel().getSelectionPath();
376
377 if ( null == path )
378 {
379 return database.getSuffix().toString();
380 }
381
382 Object last = path.getLastPathComponent();
383 String base = null;
384
385 if( last instanceof EntryNode )
386 {
387 try
388 {
389 base = ( ( EntryNode ) last ).getEntryDn();
390 }
391 catch ( NamingException e )
392 {
393 e.printStackTrace();
394 }
395 }
396 else
397 {
398 base = database.getSuffix().toString();
399 }
400
401 return base;
402 }
403
404
405 public void doImport()
406 {
407 FileReader in = null;
408 LdifIterator list = null;
409 LdifParser parser = new LdifParserImpl();
410 JFileChooser chooser = new JFileChooser();
411 int choice = chooser.showOpenDialog( this );
412 File selected = chooser.getSelectedFile();
413
414 if ( JFileChooser.APPROVE_OPTION != choice )
415 {
416 return;
417 }
418
419 try
420 {
421 in = new FileReader( selected );
422 list = new LdifIterator( in );
423
424 while ( list.hasNext() )
425 {
426 String dif = ( String ) list.next();
427 LockableAttributesImpl attrs = new LockableAttributesImpl();
428 parser.parse( attrs, dif );
429 String updn = ( String ) attrs.get( "dn" ).get();
430 LdapName ndn =
431 new LdapName( StringTools.deepTrimToLower( updn ) );
432 attrs.remove( "dn" );
433
434 if ( null == database.getEntryId( ndn.toString() ) )
435 {
436 database.add( updn, ndn, attrs );
437 load();
438 }
439 }
440 }
441 catch( NamingException e )
442 {
443
444 e.printStackTrace();
445 return;
446 }
447 catch( FileNotFoundException e )
448 {
449
450 e.printStackTrace();
451 return;
452 }
453 catch( IOException e )
454 {
455
456 e.printStackTrace();
457 return;
458 }
459 catch( Exception e )
460 {
461
462 e.printStackTrace();
463 return;
464 }
465 }
466
467
468 /***
469 * Exit the Application
470 */
471 private void exitForm()
472 {
473 setEnabled( false );
474 setVisible( false );
475 dispose();
476
477 if ( doCleanUp && database != null )
478 {
479 try
480 {
481 database.sync();
482 database.close();
483 }
484 catch ( NamingException e )
485 {
486 e.printStackTrace();
487 }
488
489 System.exit( 0 );
490 }
491 }
492
493
494 public void doRunDebugAnnotate( FilterDialog dialog, String mode )
495 {
496 try
497 {
498 if ( mode == FilterDialog.RUN_MODE )
499 {
500 doRun( dialog.getFilter(), dialog.getScope(),
501 dialog.getBase(), dialog.getLimit() );
502 }
503 else if ( mode == FilterDialog.DEBUG_MODE )
504 {
505 doDebug( dialog.getFilter(), dialog.getScope(),
506 dialog.getBase(), dialog.getLimit() );
507 }
508 else if ( mode == FilterDialog.ANNOTATE_MODE )
509 {
510 if ( doAnnotate( dialog.getFilter() ) )
511 {
512
513 }
514 else
515 {
516
517
518 return;
519 }
520 }
521 else
522 {
523 throw new RuntimeException( "Unrecognized mode." );
524 }
525 }
526 catch ( Exception e )
527 {
528
529 e.printStackTrace();
530 }
531 }
532
533
534 public void doFilterDialog( final String mode )
535 {
536 final FilterDialog dialog = new FilterDialog( mode, this, true );
537
538 if ( tree.getSelectionModel().getSelectionPath() != null )
539 {
540 dialog.setBase( getSelectedDn() );
541 }
542 else
543 {
544 dialog.setBase( database.getSuffix().toString() );
545 }
546
547 dialog.addActionListener( new ActionListener()
548 {
549 public void actionPerformed( ActionEvent an_event )
550 {
551 String cmd = an_event.getActionCommand();
552
553 if ( cmd.equals( FilterDialog.SEARCH_CMD ) )
554 {
555 doRunDebugAnnotate( dialog, mode );
556 }
557 else if ( cmd.equals(FilterDialog.CANCEL_CMD ) )
558 {
559
560 }
561 else
562 {
563 throw new RuntimeException(
564 "Unrecognized FilterDialog command: " + cmd );
565 }
566
567 dialog.setVisible( false );
568 dialog.dispose();
569 }
570 } );
571
572
573 dialog.setSize( 456, 256 );
574 centerOnScreen( dialog );
575 dialog.setEnabled( true );
576 dialog.setVisible( true );
577 }
578
579
580 public boolean doRun( String filter, String scope, String base,
581 String limit )
582 throws Exception
583 {
584 System.out.println( "Search attempt using filter '" + filter + "' "
585 + "with scope '" + scope + "' and a return limit of '" + limit
586 + "'" );
587 FilterParser parser = new FilterParserImpl();
588 ExprNode root = null;
589
590 try
591 {
592 root = parser.parse( filter );
593 }
594 catch ( Exception e )
595 {
596 e.printStackTrace();
597 JTextArea text = new JTextArea();
598 String msg = e.getMessage();
599
600 if ( msg.length() > 1024 )
601 {
602 msg = msg.substring( 0, 1024 ) + "\n. . . truncated . . .";
603 }
604
605 text.setText( msg );
606 text.setEnabled( false );
607 JOptionPane.showMessageDialog( null, text, "Syntax Error",
608 JOptionPane.ERROR_MESSAGE );
609 return false;
610 }
611
612 SearchControls ctls = new SearchControls();
613
614 if ( scope == FilterDialog.BASE_SCOPE )
615 {
616 ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
617 }
618 else if ( scope == FilterDialog.SINGLE_SCOPE )
619 {
620 ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
621 }
622 else if ( scope == FilterDialog.SUBTREE_SCOPE )
623 {
624 ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
625 } else {
626 throw new RuntimeException( "Unexpected scope parameter: " +
627 scope );
628 }
629
630 int limitMax = Integer.MAX_VALUE;
631 if ( ! limit.equals( FilterDialog.UNLIMITED ) )
632 {
633 limitMax = Integer.parseInt( limit );
634 }
635
636 Hashtable env = new Hashtable();
637
638 env.put( DerefAliasesEnum.JNDI_PROP,
639 DerefAliasesEnum.DEREFALWAYS_NAME );
640
641 NamingEnumeration cursor = eng.search( new LdapName( base ),
642 env, root, ctls );
643 String [] cols = new String [2];
644 cols[0] = "id";
645 cols[1] = "dn";
646 DefaultTableModel tableModel = new DefaultTableModel( cols, 0 );
647 Object [] row = new Object[2];
648 int count = 0;
649 while ( cursor.hasMore() && count < limitMax )
650 {
651 IndexRecord rec = ( IndexRecord ) cursor.next();
652 row[0] = rec.getEntryId();
653 row[1] = database.getEntryDn( ( BigInteger ) row[0] );
654 tableModel.addRow( row );
655 count++;
656 }
657
658 SearchResultDialog results = new SearchResultDialog( this, false );
659 StringBuffer buf = new StringBuffer();
660 buf.append( "base: " );
661 buf.append( base );
662 buf.append( "\n" );
663 buf.append( "scope: " );
664 buf.append( scope );
665 buf.append( "\n" );
666 buf.append( "limit: " );
667 buf.append( limit );
668 buf.append( "\n" );
669 buf.append( "total: " );
670 buf.append( count );
671 buf.append( "\n" );
672 buf.append( "filter:\n" );
673 buf.append( filter );
674 buf.append( "\n" );
675 results.setFilter( buf.toString() );
676
677 TreeNode astRoot = new ASTNode( null, root );
678 TreeModel treeModel = new DefaultTreeModel( astRoot, true );
679 results.setTreeModel( treeModel );
680 results.setTableModel( tableModel );
681 centerOnScreen( results );
682 results.setVisible( true );
683 return true;
684 }
685
686
687 public void doDebug( String filter, String scope, String base,
688 String limit )
689 {
690 System.out.println( "Search attempt using filter '" + filter + "' "
691 + "with scope '" + scope + "' and a return limit of '" + limit
692 + "'" );
693 }
694
695
696 public void selectTreeNode( BigInteger id )
697 {
698 Stack stack = new Stack();
699 Object [] comps = null;
700 TreeNode parent = ( EntryNode ) nodes.get( id );
701
702 while ( parent != null && ( parent != parent.getParent() ) )
703 {
704 stack.push( parent );
705 parent = parent.getParent();
706 }
707
708 if ( stack.size() == 0 )
709 {
710 comps = new Object[1];
711 comps[0] = root;
712 }
713 else
714 {
715 comps = new Object[stack.size()];
716 }
717
718 for ( int ii = 0; stack.size() > 0 && ii < comps.length; ii++ )
719 {
720 comps[ii] = stack.pop();
721 }
722
723 TreePath path = new TreePath( comps );
724 tree.scrollPathToVisible( path );
725 tree.getSelectionModel().setSelectionPath( path );
726 tree.validate();
727 }
728
729
730 public boolean doAnnotate( String filter )
731 throws Exception
732 {
733 FilterParser parser = new FilterParserImpl();
734 ExprNode root = null;
735
736 try
737 {
738 root = parser.parse( filter );
739 }
740 catch( Exception e )
741 {
742 JTextArea text = new JTextArea();
743 String msg = e.getMessage();
744
745 if ( msg.length() > 1024 )
746 {
747 msg = msg.substring( 0, 1024 ) + "\n. . . truncated . . .";
748 }
749
750 text.setText( msg );
751 text.setEnabled( false );
752 JOptionPane.showMessageDialog( null, text, "Syntax Error",
753 JOptionPane.ERROR_MESSAGE );
754 return false;
755 }
756
757 AnnotatedFilterTreeDialog treeDialog = new
758 AnnotatedFilterTreeDialog( MainFrame.this, false );
759 treeDialog.setFilter( filter );
760
761 eng.getOptimizer().annotate( root );
762 TreeNode astRoot = new ASTNode( null, root );
763 TreeModel model = new DefaultTreeModel( astRoot, true );
764 treeDialog.setModel( model );
765 treeDialog.setVisible( true );
766 return true;
767 }
768
769
770 /***
771 * Shows a dialog to display and scan indices.
772 *
773 * @param idxAttr the name of the index or its attribute
774 * @throws Exception if the indices cannot be accessed
775 */
776 public void showIndexDialog( String idxAttr )
777 throws Exception
778 {
779 Index index = null;
780 boolean isSystem = database.hasSystemIndexOn( idxAttr );
781
782 if ( isSystem )
783 {
784 index = database.getSystemIndex( idxAttr );
785 }
786 else
787 {
788 index = database.getUserIndex( idxAttr );
789 }
790
791 if ( index != null )
792 {
793 IndexDialog dialog = new IndexDialog( this, false, index );
794 centerOnScreen( dialog );
795 dialog.setEnabled( true );
796 dialog.setVisible( true );
797 }
798 }
799
800
801 public void buildIndicesMenu( Database database )
802 {
803 JMenuItem item = null;
804
805 ActionListener listener = new ActionListener()
806 {
807 public void actionPerformed( ActionEvent event )
808 {
809 try
810 {
811 showIndexDialog( event.getActionCommand() );
812 }
813 catch ( Exception e )
814 {
815 e.printStackTrace();
816 }
817 }
818 };
819
820 Iterator list = database.getSystemIndices();
821 while ( list.hasNext() )
822 {
823 String idx = ( String ) list.next();
824 item = new JMenuItem();
825 item.setBackground( new java.awt.Color( 205, 205, 205 ) );
826 indices.add( item );
827 item.setText( idx );
828 item.setActionCommand( idx );
829 item.addActionListener( listener );
830 }
831
832 indices.add( new JSeparator() );
833 list = database.getUserIndices();
834 while ( list.hasNext() )
835 {
836 String idx = ( String ) list.next();
837 item = new JMenuItem();
838 item.setBackground( new java.awt.Color( 205, 205, 205 ) );
839 indices.add( item );
840 item.setText( idx );
841 item.setActionCommand( idx );
842 item.addActionListener( listener );
843 }
844 }
845
846
847 void displayEntry( BigInteger id, Attributes entry )
848 throws Exception
849 {
850 String dn = database.getEntryUpdn( id );
851 AttributesTableModel model =
852 new AttributesTableModel( entry, id, dn, false );
853 entryTbl.setModel( model );
854
855 model = new AttributesTableModel(
856 database.getIndices( id ), id, dn, false );
857 idxTbl.setModel( model );
858
859 validate();
860 }
861
862
863 private void load() throws NamingException
864 {
865
866 nodes = new HashMap();
867
868 Attributes suffix = database.getSuffixEntry();
869 BigInteger id = database.getEntryId(
870 database.getSuffix().toString() );
871 root = new EntryNode( id, null, database, suffix, nodes );
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925 DefaultTreeModel model = new DefaultTreeModel( root );
926 tree.setModel( model );
927
928 if ( isVisible() )
929 {
930 tree.validate();
931 }
932 }
933 }