Wiki

Build-Server: http://jenkins.root1.de/job/SOS%20-%20trunk/
Snapshot Download: http://nexus.root1.de/content/repositories/snapshots/de/root1/sos/
Maven dependency:

<dependency>
  <groupId>de.root1</groupId>
  <artifactId>sos</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <type>pom</type>
</dependency>

Repository-URL: http://nexus.root1.de/content/repositories/snapshots

Usage

// init storage: requires storage folder and storage name
Storage os = new Storage(new File("/home/foobar/mystoragefolder"), "myStorage");

// open storage
os.open();

// create an object to store
Pojo pojo = new Pojo();
pojo.setAge(10);
pojo.setBirthday(new Date());
pojo.setFirstname("Max");
pojo.setLastname("Mustermann");
pojo.setPostcode(1000);
pojo.setId(UUID.randomUUID()); // this fills the field "id" with an UUID --> mandatory for storable objects

// store object: 
// Storable objects need to have a field 
// of type "UUID" named "id" whic is not null.
// Otherwise object is not storable!
os.store(pojo);

// query for stored object
Query query = os.query(Pojo.class);

// search all Pojos where the "firstname" variable equals to "Max" 
query.setCondition("firstname", new Condition<String>(){

    public boolean condition(String variable) {
        if (variable.contains("Max"))
            return true;
        return false;
    }
});

// execute query
List execute = query.execute();

System.out.println("Result size: "+execute.size());

// print results ...
for (Object object : execute) {
    System.out.println("Found:  "+object);

    os.remove(((Pojo)object).getId()); // .. and remove object
}

// ask store for specific object
Object xyz = os.get(anyUUID);

// close storage 
os.close();