Data Manager Library

Data Management utility library which can be used to manage data different type of data contents in applications. Library provides build-in abstraction for creating different type of Data Manager instances based on different data storage solutions and interfaces. E.g upon databases like Postgresql and MongoDB or cloud based storage solutions.

There are two build-in Data Managers available within this library. In-memory and file data manager. They can be activated for the data service through file. with property. Use either value in-memory or file. In.memory data manager is provided just for testing purposes thus it cannot actually persist the data contents. File Data Manager uses local File IO as persistent storage. In-memory data manager is used by default if no configurations are provided.

Data Managers are controlled with Data Service instances which acts as a gateway to Data Manager for creating new and getting existing Data objects.

Data objects provided by the Data Managers never contains the actual data content itself but the reference ID into separately saved content. Data Manager saves data content into persistent storage depending on manager implementation used by the application or in temporary cache or both. Data content from objects can be read as byte arrays, input streams, text content (string) or as object if Data type supports object handling.

It is not possible to overwrite or append new data content into existing non-empty data objects referenced content. In order to update data content a new data object need to be created with the updated content.

Data Manager supports following data types

  • Byte
    • Generic data type which handles all contents as bytes. Supports any kind of data to be written.
  • Text
    • Same as Byte content, but only indicates that content is in text formatted data and not e.g. binary file.
  • HTML
    • Same as text content, but only indicates that content is in HTML formatted data.
  • Object
    • Generic data type for objects. Any type Serializable object can be written into this data type.
    • All object data types (Object, XML, XMLNS, JSON and YAML) provides getting saved object content directly without the need for parsing it from byte content.
  • XML
    • Object data which supports saving DOM objects.
    • Object data which supports saving DOM objects with namespaces.
  • JSON
    • Supports saving JSON objects
    • Uses Jackson data bind library
    • Using JSON data and Jackson is optional feature, which requires adding Jackson dependency on implementing project
  • YAML
    • Supports saving YAML objects
    • Uses Jackson data format library
    • Using YAML data and Jackson is optional feature, which requires adding Jackson dependency on implementing project
  • Composite
    • Special byte data type which enables content overwriting and appending
    • This data type makes exception in the rule for overwriting and appending on existing content
    • Saves other data objects as parts inside the composite data content. Enables replacing existing data parts and adding new parts into part list

Save location (cache/storage) is controlled by persistence type enumeration when creating or updating data. Data Manager can use persistent storage to save data content or just temporary cache or both in which case data content is stored into persistent storage for later use but is read from cache. When persisting it is also possible to compress and/or encrypt the persisted data content.

Data manager provides following persistence types when saving content:


In addition CACHED persistence type is available with all the other persistence types e.g. CACHED_PERSISTENT in which case data content is saved into underlying storage solution and kept in cache. One should always keep data in cache if possible for improved reads into data content.

Data content encryption is controlled through security service properties. By default data manager encrypts the data persistent content. It is also possible to instruct data manager to use unique secret keys for
content encryption in which case the content is encrypted with unique secret key which is then encrypted with given secret.

Alternatively a custom security service implementation can be created and use it with the data manager.

Security service properties: = xxx = 16 = AES = SHA-1 = AES/CFB8/NoPadding = 128
# If using PBKDF2 algorithms for the key generation, add salt and iteration count into configuration. = xxx = 16
# If using unique secret keys = unique
# If using custom security service = class.path.MySecurityService

Furthermore data manager support simple cycling of encrypted data by defining the recessive secrets as inactive new secrets as active into

Old secrets: = xxx = 16 = AES = SHA-1 = AES/CFB8/NoPadding

New secrets: = xxx = 16 = AES = SHA-1 = AES/CFB8/NoPadding

In order to re-encrypt the data with new secrets:

DataService service = new DefaultDataService();
// Re-encrypt data contents persisted before the given moment.

Data manager caches data objects and their content by using separate cache service. This service is also controlled by cache service properties. Alternatively a custom cache service implementation can be created and use it with the data manager.

Cache service properties: = 10000 = 30
# If using custom cache service = class.path.MyCacheService


DataService service = new DefaultDataService();
// Create new data objects with the service
Data data = service.createByteData("Test data content", Charset.forName("UTF-8"), DataPersistenceEnum.CACHED);

Project sources and documentation are available from GitLab.

Maven dependency


In case your project is Spring Boot based there is a starter library available for the data manager which auto configures the data service and enables its usage from other Spring beans. It is also easy to create your own data manager bean components which is then automatically bind to data service.


public class MyDataManager extends AbstractDataManager implements DataManager{
public class SomeService {

    private DataService dataService;

    public void doSomethingWithDataService() {
        Data data = dataService.createByteData(byte[] array,


Data Manager Spring Boot Starter Maven dependency