Question

I have been tasked with figuring out a way to implement a NoSQL/KeyValue-esque abstraction layer (either as a Java interface, or a REST interface) that uses Oracle RDBMS under the hood as the data store. Reasons for doing this include having to deal with a legacy infrastructure that refuses to go away anytime soon as well as providing developers the ability to quickly prototype apps with basic CRUD functionality.

Constraint: Existing Oracle RDBMS instance needs to be the data store.

I am considering building my own Java interface to accomplish this but am afraid that I might be re-inventing the wheel. Are there any Java libraries out there that I should look at?

Here is a straw man design of what the interface could look like for the consumers of the API:

public interface KeyValueStore {
    /**
     * this would create a new Oracle table in a predefined schema
     * @param dbName
     * @return
     */
    DB create(String dbName);

    /**
     * Store a simple Map<> for the given entity with the given identity (maybe primary key)
     * Perhaps encode properties as a JSON string and store it as a BLOB in a column?
     * 
     * @param db
     * @param entity
     * @param identity
     * @param properties
     */
    void save(DB db, String entity, String identity, Map<String, String> properties);

    /**
     * Retrieve an entity with the specified identity
     * 
     * @param db
     * @param entity
     * @param identity
     * @return
     */
    Map<String, String> get(DB db, String entity, String identity);

    public interface DB {
        String getName();
        // add more methods here
    }
}
Was it helpful?

Solution

I have authored and open-sourced a Java implementation that provides a NoSQL abstraction over RDBMS to store entities as schema-less bags of properties (e.g., JSON objects or Java Maps). Entities have a GUID and can have multiple versions. The rest of the entity is opaque as far as the datastore is concerned. From a service consumer's perspective, the "schema" of the datastore can be changed simply by storing new properties.

https://github.com/akamai/Entity-Persistence-Service

See http://backchannel.org/blog/friendfeed-schemaless-mysql for technical inspiration.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top