com.ingensi.data:storeit-core

Light package used to store entities to various storage

License

License

Categories

Categories

Data
GroupId

GroupId

com.ingensi.data
ArtifactId

ArtifactId

storeit-core
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

Light package used to store entities to various storage

Download storeit-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.ingensi.data/storeit-core/ -->
<dependency>
    <groupId>com.ingensi.data</groupId>
    <artifactId>storeit-core</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.ingensi.data/storeit-core/
implementation 'com.ingensi.data:storeit-core:1.0.2'
// https://jarcasting.com/artifacts/com.ingensi.data/storeit-core/
implementation ("com.ingensi.data:storeit-core:1.0.2")
'com.ingensi.data:storeit-core:jar:1.0.2'
<dependency org="com.ingensi.data" name="storeit-core" rev="1.0.2">
  <artifact name="storeit-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.ingensi.data', module='storeit-core', version='1.0.2')
)
libraryDependencies += "com.ingensi.data" % "storeit-core" % "1.0.2"
[com.ingensi.data/storeit-core "1.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

StoreIt

Light Java library used to store entities to various storage.

How to use!

StoreIt provides an abstraction layer to store, get, list, update and delete all kind of entities.

To allow an entity to be stored into a StoreIt storage, it has to implement StoredEntity interface, to provides a getId() method.

Build with maven

Form the root package, install StoredIt locally:

mvn install

Add dependency in your project

Add dependency in your pom.xml according to the storage your want to use:

<dependency>
    <groupId>com.ingensi.data</groupId>
    <artifactId>storeit-elasticsearch</artifactId>
    <version>${storeit.version}</version>
</dependency>

Store your first entities

To store an entity with StoreIt, you need a StoredEntity class. Here is an example with a User class:

public class User implements StoredEntity {
    private final String username;
    private final String firstname;
    private final String lastname;
    
    public User(String username, String firstname, String lastname) {
        this.username = username;
        this.firstname = firstname;
        this.lastname = lastname;
    }
    
    public String getUsername() {
        return username;
    }
    
    public String getFirstname() {
        return firstname;
    }
    
    public String getLastname() {
        return lastname;
    }
    
    @Override
    public String getId() {
        return username;
    }
}

Then you are able to create, get, list, update or delete User into various storage by instantiating a Storage<User>:

Storage<User> storage = new xxxStorage<>(
    // DEPENDS ON THE STORAGE IMPLEMENTATION
);

// store new user
storage.store(new User("fbar", "foo", "bar"));
// list all users
Collection<User> users = storage.list();
// update user
storage.store(new User("fbar", "Jason", "Wilson"));
// get specific user
User bob = storage.get("bob");
// delete a user
storage.delete("fbar");

Structure and implementations

Each implemented module contains its own specific documentation.

Implement your own Storage

Look at existing implementations to learn how to implement your own Storage. Don't forget to contribute :)

com.ingensi.data

Ingensi

Ingensi Labs, Cyrès group

Versions

Version
1.0.2