[MonetDB-users] Java Library in use
Hi all, Last week I've finished refactoring the JDBC code base, such that most of its non-JDBC specific functionality is available through a separate library. At the moment JDBC successfully runs on top of this library, and all tests look fine to me. The library can be found as the monetdb-1.0-mcl.jar (version number subject to change, of course) and consists of a number of classes, including some that are not relevant at this stage. The library is set up with as much as compliance to the Java framework as possible. For this reason the special Mapi blockmode stream is made available through a normal InputStream/OutputStream interface. On top of these streams, normal Readers/Writers can be created. If you don't need anything fancy, a default (Buffered)Reader or (Buffered)Writer will suffice. Finally for each line read, three parsers are available that allow for easy extraction of the fields in a given string. nl.cwi.monetdb.mcl.net.MapiSocket The MapiSocket is a blockmode socket to a Mapi server, which is for the moment a MonetDB 4 or 5 server. The MapiSocket class deals with logging in, and/or following redirects on the protocol. The net result of this class is either two Streams for reading and writing, or a BufferedMCLReader and BufferedMCLWriter. nl.cwi.monetdb.mcl.io.BufferedMCLReader nl.cwi.monetdb.mcl.io.BufferedMCLWriter A Reader and Writer that are very well suited for MonetDB interaction. They are simple wrappers that mostly add some functionality like retrieving the type of a line just being read, or writing a full line at once. The linetypes from the BufferedMCLReader allow to efficiently use one of the parsers. nl.cwi.monetdb.mcl.parser.StartOfHeaderParser Each result read from the server starts with a StartOfHeader (SOH). This SOH consists of a number of fields depending on its type. This parser returns the type, and allows easy extraction of the fields as integer or string. nl.cwi.monetdb.mcl.parser.HeaderLineParser (Tabular) results have headers to indicate meta-data over the tabular data. These headers can be easily accessed through the HeaderLineParser. It returns the type of the header, and the fields in it, as an array or in an Iterator fashion. nl.cwi.monetdb.mcl.parser.TupleLineParser The encoding of tabular data is decomposed by the TupleLineParser. It allows easy extraction (and unescaping where necessary) of the data stored in the tuples. With this framework it should be easy to e.g. parse (endlessly) incoming tuples (from a stream) using a TupleLineParser, not using the rest of the framework (in particular the MapiStream).
participants (1)
-
Fabian Groffen