qflib - Packages
Overview
qflib is composed of various packages addressing different needs
of application development. The following diagram illustrates the
inter-package dependencies:
The de.qfs.lib.log package forms the basis for all
of qflib, while the de.qfs.lib.util package is
used by all other packages except de.qfs.lib.log . On top of these, de.qfs.lib.config and de.qfs.lib.gui
are mutually dependent. The de.qfs.lib.option
package is based on both of them, while de.qfs.lib.command only needs de.qfs.lib.gui .
The de.qfs.lib.transaction package which was
added with version 0.97.0 relies only on the de.qfs.lib.log and
de.qfs.lib.util packages. Also in 0.97.0 all classes dependent on RMI
were separated from the de.qfs.lib.log into the de.qfs.lib.logrmi package.
Another addition was made with version 0.98.1: the de.qfs.lib.tree package, a collection of classes and
interfaces for tree traversal and manipulation.
Packages de.qfs.lib.log and de.qfs.lib.logrmi
Logging is a commonly underestimated resource in program
development. The more complex a program is, the harder it is to
locate the source of a problem. Using a debugger helps, but it
requires knowledge of the problem area to some extent. Through
application of a good logging concept and the use of supporting
tools it is often possible to locate trouble spots so well that a
debugger is no longer necessary.
Traditional logging a la println , even if it is
removable through a DEBUG flag, soon causes trouble
due to the following shortcomings:
-
No uniform concept for the structure of messages. Without
knowing the source and some measure of importance of a message,
coherence is lost. With problems caused by multithreading it
gets even worse.
-
No fine grained control over message generation. Often Logging
can only be turned on or off as a whole at compile time. When it
is turned on, some critical mass is soon reached where
performance suffers and the sheer mass of output becomes
unmanageable. As a consequence, logging statements which might
have been of use again are removed or commented out.
-
Missing tool support. For someone who has to wade through a
flood of log messages in a simple text editor the chances of
finding anything of value are minimal.
The de.qfs.lib.log and de.qfs.lib.logrmi packages address these problems by:
-
Separating messages into five levels of importance ranging
from error through warning and
message to method call and debugging.
Each of these has a sublevel for details.
-
Providing information about the time, active thread and calling
class and method for each message.
-
Controlling generation and dispatch of log messages through
multiple filter systems. This reduces performance penalties and
increases manageability.
-
Close cooperation with the log server qflog which makes use of
these features to provide visualization, sorting and filtering
of log messages. It also offers fine grained control over the
generation of messages at runtime.
Since the de.qfs.lib.log package is independent of all other qflib
packages, it can be separated into its own jar
archive if necessary. It also doesn't make any use of the
collection classes, so there is no need to provide the
collections.jar archive for JDK 1.1 applets that
use only the de.qfs.lib.log package.
Package de.qfs.lib.util
The de.qfs.lib.util package is also located close to the bottom of the
qflib package hierarchy. It is a collection of little utilities
that don't fit in anywhere else, among them:
-
ArgsParser
-
A parser for arguments passed to a program via the command line.
-
DynamicClassLoader
-
A
ClassLoader that dynamically reloads modified
classes at runtime.
-
MapResourceBundle
-
An extension of the
ResourceBundle mechanism.
-
MultiMap
-
An implementation of the collection classes'
Map
interface that stores multiple values per key.
-
Visitor
-
An implementation of the visitor pattern, also known as
multi methods.
Package de.qfs.lib.config
The management of the configuration of a program is a recurring
task. Configuration includes user preferences for program
parameters as well as persistence for GUI component state like
window geometry or table sort order.
The de.qfs.lib.config package simplifies the configuration management
and provides persistence by storing the state in a user readable
and editable text file. It also features a mechanism that takes
care of geometry management.
Package de.qfs.lib.gui
This package is composed of various classes pertaining to
graphical user interfaces. It includes workarounds for some of
the weaknesses and shortcomings of Swing.
Its most prominent feature is an extension of the Swing
JTable that offers filtering and sorting through a
very easy to use interface. There is a little demo called
SortedTable.java in the demo
directory.
Package de.qfs.lib.option
This package combines the concepts of de.qfs.lib.config and de.qfs.lib.gui
primarily to simplify the creation of dialogs to edit user
preferences, but it is also applicable to any kind of dialog based
editing.
The values are represented through Options and edited via
OptionEdits. All
information about how components are grouped together, laid out
and labeled is provided through property files.
Instead of a collection of small examples on the examples page, there is a demo called
Options.java in the demo
directory.
Package de.qfs.lib.command
The Command pattern
has been a benefit to various projects. It is similar to an event
mechanism, but at a higher level of abstraction than the AWT event
loop.
Senders and receivers of commands can be kept completely unaware
of each other. They both act through a CommandDistributor.
This enables communication across library
boundaries. Exception handling is also simplified
through having a common point of entry for user-triggered actions.
Package de.qfs.lib.transaction
The de.qfs.lib.transaction package was added to qflib with version
0.97.0. It is useful in handling the effects of transactions at
the client side. Simple steps can be collected in a transaction
and committed together when everything is OK. In case of an error a
rollback will take back everything that happened so far.
Package de.qfs.lib.tree
The de.qfs.lib.tree package first appeared in version 0.98.1. It is a
collection of utilities for tree traversal and manipulation, based
on the TreeAdapter
interface, which is similar to Swing's TreeModel .
The current state of this package is experimental. Multithreading
isn't really supported yet and some of the interfaces are likely
to change, though not too much, since we are already relying
heavily on this package for our development of qftestJUI.
|