Git Product home page Git Product logo

shielddb's Introduction

ShieldDB

Build

ShieldDB is a simple embedded database with JSON file backend with optional in-memory read cache.

Features

  • Easy to use : use ShieldDB like you use a standard Java List
  • Easy to extends
  • No mandatory external dependencies
  • No reflection API usage (except for some json mapper implementation like Gson)

Contributing to ShielDB

If you want to contribute to ShieldDB or if you want better know how ShieldDB is working, you can check the DEVELOPER.md.

How to use it?

Add the core dependency

...
<dependencies>
	...
	<dependency>
		<groupId>nf.fr.k49</groupId>
		<artifactId>shielddb-core</artifactId>
		<version>0.1.1</version>
	</dependency>
	...
</dependencies>
...

Add as dependency a mapper

...
<dependencies>
	...
	<dependency>
		<groupId>nf.fr.k49</groupId>
		<artifactId>shielddb-gson-backend</artifactId>
		<version>0.1.1</version>
	</dependency>
	...
</dependencies>
...

Note: At this time, there is only a Gson mapper implementation. But you can make yours and maybe make a Pull Request :-)

Initialize a ShieldDB instance

Create a bean class:

public class User {
	private String firstname;
	private String lastname;
	private int age;
	private LocalDate birthDate;
	...
}
final List<User> userDb = ShieldDB.<User>builder()
		.mapper(new ShieldDBGson<User>())
		.storage(new FileStorage("User.json"))
		.build();

Note: If you want to store a type that has no custom equals implementation, you may have some issues.

(Optional) Add some shield to customize the way ShieldDB will read/write

final List<User> userDb = ShieldDB.<User>builder()
		.shield(new AtomicShield())// ensure only one thread use userDb
		.shield(new ReadOnlyShield())// throw an UnsupportedOperationException on write access
		//.shield(new SilentReadOnlyShield())// do nothing on write access (no exception)
		.shield(new InMemoryArrayListReadCacheShield())// add an in memory read cache
		.mapper(new ShieldDBGson<User>())
		.storage(new FileStorage("User.json"))
		.build();

See more usage example here: https://github.com/kuroidoruido/ShieldDB/tree/master/shielddb-demo-app/

Release process

  • ensure snapshot deploys: mvn clean deploy
  • set all packages to a release version: mvn versions:set -DnewVersion=1.0.0
  • commit changes
  • deploy release: mvn clean deploy
  • await new release is visible on maven central: https://repo1.maven.org/maven2/nf/fr/k49/
  • set all packages to the next snapshot version: mvn versions:set -DnewVersion=1.0.1-SNAPSHOT
  • commit changes

shielddb's People

Contributors

kuroidoruido avatar dearrudam avatar bhegmanns avatar elebeaup avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.