Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [gyrex-dev] org.eclipse.gyrex.persistence

Hi,

I'll respond in detail when I'm back in the office but some short notes below.

Am 28.12.2012 13:11, schrieb Florian Pirchner:
Yes, it would be really great to get deeper knowledge about the concepts
of repositories. I looked at the code but i am not sure how to use
Repository, RepositoryProvider, IRepositoryContentTypeProvider and so on.

It was introduced for multi-tenancy reasons and to have some higher level abstraction then DataSource/JNDI.

The idea is that a model manager ("DAO") requires a repository ("data store") to work with. There can be many different repository types (eg. JDBC, EclipseLink, Carbonado, MongoDB, volatile in-memory). Repository types can be extensible (eg. EclipseLink is also a JPA repository).

Here is an example repository type implementation:
https://github.com/AGETO/gyrex-carbonado-persistence

DAOs are developed for a specific repository type, eg. a product model Carbonado DAO will require a Carbonado repository. A product model Carbonado DAO also defines the content type to store in a repository.


Code may look like this:
---
IRuntimeContext context =...

IProductManager productMgr = context.get(IProductManager.class);
IProduct product = productMgr.create(..)
populate(product)
productMgr.save(product)

---


The IRuntimeContext knows which IProductManager implementation to use (Carbonado based, JDBC based, etc.)
The IProductManager implementation requires a specific content type.
The IRuntimeContext also knows which repository to use for storing which content type.
It wires it all together.


Advance topics:
The content type also has a version. We use it for automatically updating database schema, etc.

-Gunnar



--
Gunnar Wagenknecht
gunnar@xxxxxxxxxxxxxxx
http://wagenknecht.org/


Back to the top