The ItemEditor Database Browser
Previous Next
Uses of the ItemEditor
The ItemEditor class is a very simple GUI for browsing
and modifying any ItemSpace, including any InfinityDB
database. It is very low-level, since it merely
displays a vertically sorted list of Items. It can be
used for:
- Learning about ItemSpaces, Items and their various component types
- checking the storage structures and data an application creates
- creating application test input
- configuring applications
It is very convenient to be able to 'see inside' an application,
and debugging is very much simplified. It is easy to separate
storage problems from retrieval problems, for example.
Standalone Invocation
To run an ItemEditor standalone:
%JDK_DIR%\bin\java -classpath %CP%;infinitydb.jar com.infinitydb.itemeditor.ItemEditor %1
The above is taken from installdir/examples/ItemEditor.bat.
When the ItemEditor is run on an empty database it can be rather
difficult to get going. It is easier to start off using it with an
already populated ItemSpace. To do this easily, first run
installdir/examples/DemoSnippets.bat in order to get
a db file with some contents to see. This will create
DemoSnippets.infdb.
Be sure not to open any db file from within multiple
separate JVMs at the same time. Allowing multiple JVM's to open the same
InfinityDB can easily corrupt the db. InfinityDB 1.0.40 and later
can optionally use the java.nio file locking system to prevent this
when run on Java 1.4 or later. The locking is not
automatic, but must be requested by new
InfinityDB.open() and InfinityDB.create()
parameters, which is strongly suggested. See the javadoc.
Invocation Inside a JVM
To run ItemEditor on any ItemSpace visible within a running
program, just use the constructor, with the ItemSpace as a parameter.
If the ItemSpace provided is an InfinityDB, then the commit(),
rollBack() and other methods are available, so the ItemEditor
adds these commands to its File menu.
To see how to invoke ItemEditor from inside a running
application, modify
installdir/src/com/infinitydb/examples/DemoSnippets.java
and uncomment:
//db.commit();
//new ItemSpace(db)
This will bring up an internal ItemEditor on the database created by
DemoSnippets, which has a few typical Items.
The GUI
The main window shows a the set of Items near to the
Item currently displayed in the text field at the bottom.
As the text field is modified, it is continually parsed
into an Item using the
component printable representations. The horizontal
bar in the main window is thin and separates two
existing Items where the current Item would go if
it is not in the ItemSpace. If the current Item is in
the ItemSpace, it is highlighted in the main window. The arrow keys move
up and down, and the mouse can select a visible Item.
There is no scroll bar, because it would be difficult
to place the slider, since an ItemSpace might have
billions of Items, and the current relative position
would require counting a large fraction of them, which
would be too slow.
If an ItemSpace being viewed by an ItemEditor is
modified by the running application that constructed it,
scrolling the display with the arrow keys will refresh the
view. All modifications performed by the ItemEditor will
be immediately visible to the running application.
Previous Next
Copyright © 1997-2006
Boiler Bay.