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 Gunnar i have some questions on this topic.
For me is still not clear how to wire particular context and context object.
Lets back to your given example about RepositoryProvider and DAO (model managers).
How to wire concrete DAO implementation and concrete RepositoryProvider for concrete RuntimeContext.

For example in need to support to similar (in purpose) system with different domain model over the same unified API, so the client UI will stay the same.




2012/12/28 Florian Pirchner <florian.pirchner@xxxxxxxxx>
Hi Gunnar,

thanks a lot for the info. Good an idea how it works.

Best Florian



Am 28.12.12 16:42, schrieb Gunnar Wagenknecht:

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





--
Mit besten Grüßen
Florian Pirchner
Fohlenweg 22
2301 Probstdorf
Tel: +43 650 7772338
florian.pirchner@xxxxxxxxx


_______________________________________________
gyrex-dev mailing list
gyrex-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gyrex-dev


Back to the top