A lightweight embedded no-sql object DB persisting objects to flat XML files. XFlat is a completely free alternative to db4o for an embedded object DB.
So you've got a Java application, and need to persist some data. Cool. Just write it to a file.
Well, my data's in a bunch of POJOs.
Ok that's easy, just serialize it to XML and drop it into a DOM, then write it to a file.
Alright, that sounds easy enough. But wait a second, I need random access to my saved POJOs.
Well thats a bit harder, but you could write a class to inspect the DOM and pull out the data you need.
But I also need to query my POJOs by arbitrary criteria.
Looks like you need a database. Take a look at db4o or Sql Lite
Well I'd prefer not to have to deal with Sql, and I may need to inspect or transform my data as XML.
Oh, well in that case XFlat is for you!
XFlat is a single lightweight JAR that persists XML DOM Elements to flat files. It presents as a CRUD interface to XML Elements that can be queried by ID or arbitrary XPath expressions. Because it is stored in flat files, XFlat is not relational and is schemaless. XFlat is currently effective for table sizes up to the dozens of KB. Future versions will contain engines that are effective up to the hundreds of MB, using memory-mapped files.
ScheduledThreadPoolExecutorin the constructor, for even finer control of the database's concurrent tasks.
Pure XML data files
POJO mapping to XML
Elementobjects using JAXB. The underlying implementation can be swapped if necessary. The JAXB context is only loaded if it is used, so you can avoid it completely by specifying custom converters, or using only the JDOM CRUD interface.
Queriable by XPath expressions
Elementthat is convertible to the value which is being matched, then the matching is performed using Hamcrest Matchers. Breaking the query into XPath expressions and values allows the engine to leverage indexes effectively, much more easily than if we used XQuery. Future versions may support XQuery.
Sharding by ID
Comparable. A sharded table is spread across as many files as is necessary, and each row is stored in the appropriate file based on its ID. A
RangeProviderdetermines which values go into which shards.
Multiple swappable Engines (to be implemented)
Indexing on XPath expressions (to be implemented)
Sharding by arbitrary XPath expressions (to be implemented)
<dependency> <groupId>org.xflatdb</groupId> <artifactId>xflat</artifactId> <version>0.9</version> <classifier>sources</classifier> </dependency>View on Maven Central
Click Here for examples