JavaMatch does not stand on its own. Data structures are typically not only kept in memory, but also stored in a file system or database. This page describes how JavaMatch works in combination with such storage mechanisms.
JDO, the standard for transparent object persistence, enables you to match in databases. JDO has a query language, JDOQL. This language can be used to improve JavaMatch's performance in two different ways:
Prevayler does not use a database. It keeps the entire data structure in memory. Therefore, matching the data that is persisted in Prevayler is exactly the same as matching data that is not persisted.
Prevayler has an example bank application, that is used to handle accounts. This can be found in directory src\org\prevayler\demos\demo2\gui in the Prevayler source distribution. The program maintains a list of accounts, each with a balance, where you can desposit, withdraw and transfer money.
With JavaMatch, this program can be extended to show a list of "most interesting accounts": The accounts that have the highest balance, or that are the most active (had the most deposits, withdrawals and transfers). The business logic doesn't need any changes, it's just another view on the same data.
To run this demo, put the file MatchFrame.java in directory src/org/prevayler/demos/demo2/gui. Then edit file src/org/prevayler/demos/demo2/gui/BankFrame.java: Where the frames are created (near line 27 in the current version), add the line
new MatchFrame(prevayler, desktop);
This adds another frame to the user interface, one that shows the results of the matching.
Before compiling the demo, add javamatch.jar to the lib directory, and add this to the classpath when compiling / running the application.
Copyright © 2004, Walter van Iterson