Difference between revisions of "Document Store Framework"

From Gcube Wiki
Jump to: navigation, search
(Base Model)
Line 34: Line 34:
 
While the records are buffered for each new records requested to be accounted the library try to aggregate the new record with the one has already buffered. The aggregation made in this phase is lossless. In other words, the ''Record'' aggregated are only the ones having for all properties the same values except the ones the aggregation has been made (e.g. operationCount).
 
While the records are buffered for each new records requested to be accounted the library try to aggregate the new record with the one has already buffered. The aggregation made in this phase is lossless. In other words, the ''Record'' aggregated are only the ones having for all properties the same values except the ones the aggregation has been made (e.g. operationCount).
  
=== Storing Record ===
+
== Storing Record ==
  
 
The library discover dynamically the '''Document Store Lib Persistence'''. This library is responsible to connect to DS-NoSQL DB and to really store the Record. The configuration parameters are also discovered dynamically.
 
The library discover dynamically the '''Document Store Lib Persistence'''. This library is responsible to connect to DS-NoSQL DB and to really store the Record. The configuration parameters are also discovered dynamically.
Line 61: Line 61:
 
''<groupId>'''''org.gcube.data-publishing'''''</groupId>''
 
''<groupId>'''''org.gcube.data-publishing'''''</groupId>''
  
''<artifactId>'''''document-store-lib'''''</artifactId>''
+
''<artifactId>'''''document-store-lib-couchdb'''''</artifactId>''
  
 +
* couchbase
  
 +
''<groupId>'''''org.gcube.data-publishing'''''</groupId>''
  
The developer MUST not depend from this library. This library is already available on container because has been included in gCore and smartgears bundles.
+
''<artifactId>'''''document-store-lib-couchbase'''''</artifactId>''
Also, when a component does not run on a container , the component MUST not include this library as dependency. It will be responsibility of the person in charge of deploying the component to provide also that library.
+
  
This library must be available on every node of the infrastructure. To respect as much possible the smartgears ZERO-DEPENDENCY paradigm a simple couchdb-connector (simple HTTP client library) has been developed.
+
* mongodb
  
== Deployment ==
+
''<groupId>'''''org.gcube.data-publishing'''''</groupId>''
  
'''Docuemtn Lib''' and the '''Accounting Persistence Lib''' are already available on gCore and smartgears bundles (gHN and wHN).
+
''<artifactId>'''''document-store-lib-mongodb'''''</artifactId>''
  
  
 +
The developer MUST not depend from this libraries.
 +
 +
== Deployment ==
 +
 +
'''Document Store Lib''' and the '''Document Store Lib CouchDB''' are already available on gCore and smartgears bundles (gHN and wHN).
  
  
 
== Document Store Lib in the Accounting Architecture ==
 
== Document Store Lib in the Accounting Architecture ==
  
The following image evidences the use of docuemtn-store-lib in [[Accounting | Accounting Architecture]]:
+
The following image evidences the use of '''Document Store Lib''' in [[Accounting | Accounting Architecture]]:
  
 
[[File:Accounting-architecture-document-store-lib.png]]
 
[[File:Accounting-architecture-document-store-lib.png]]

Revision as of 16:34, 29 January 2016

Document Store Lib Provides facilities to store document in a Document Store NoSQL DB. It provides Aggregation, Bufferization and Fallback capabilities.

Library

The library has been tough to provide a common way to store Records in Document Store NoSQL DB. In particular is responsible for:

  • Aggregating
  • Buffering
  • Storing

Base Model

To set the various properties of a records two different methods are available by setting

  • Each Single Property through a generic Key-Value method
    • key : String
    • value : ? extends Serializable
  • Multiple Properties at once passing a Map<String,? extends Serializable>.

The build blocks of this library are the interfaces:

  • Record
  • AggregatedRecord

The first interface (Record) must be implemented to create a class compliant with the library model, so that the library can provide it own facilities. The second interface must be implemented if the model needs the aggregation facilities.

The library provides also a basic implementation AbstractRecord that the developer can use as building block fro its own model. By extending this abstract class the library also provide properties:

  • Validations
  • Harmonizations

Buffering & Aggregating Record

The library provide buffering capabilities. While the records are buffered for each new records requested to be accounted the library try to aggregate the new record with the one has already buffered. The aggregation made in this phase is lossless. In other words, the Record aggregated are only the ones having for all properties the same values except the ones the aggregation has been made (e.g. operationCount).

Storing Record

The library discover dynamically the Document Store Lib Persistence. This library is responsible to connect to DS-NoSQL DB and to really store the Record. The configuration parameters are also discovered dynamically.

If no library is discovered or if the storing fails (e.g. for network issue) the Records are persisted using a Fallback Persistence (on filesystem). Please note that Fallback Persistence is also used when a failure occurs (e.g. a network failure).

A recurrent task periodically (actually 10 min) check if there are Records stored from Fallback Persistence (A Document Store Lib Persistence must be discovered in advance to activate the recurrent task because otherwise the task has no reason to exist).

Development

The library is identified by the following maven coordinates:

<groupId>org.gcube.data-publishing</groupId>

<artifactId>document-store-lib</artifactId>

Please set the scope of the library to PROVIDED, if your component runs on a container gHN or vHN.

Document Store Lib Persistence

The current implementations of persistence for this library are:

  • couchdb

<groupId>org.gcube.data-publishing</groupId>

<artifactId>document-store-lib-couchdb</artifactId>

  • couchbase

<groupId>org.gcube.data-publishing</groupId>

<artifactId>document-store-lib-couchbase</artifactId>

  • mongodb

<groupId>org.gcube.data-publishing</groupId>

<artifactId>document-store-lib-mongodb</artifactId>


The developer MUST not depend from this libraries.

Deployment

Document Store Lib and the Document Store Lib CouchDB are already available on gCore and smartgears bundles (gHN and wHN).


Document Store Lib in the Accounting Architecture

The following image evidences the use of Document Store Lib in Accounting Architecture:

Accounting-architecture-document-store-lib.png