one to many relationship : to implement (and how) or not to implement a Repository ?

Julien Durens
Added over 3 years ago


I am trying to implement a slightly modified version of XEP-0142 in a tigase component.

It is an extension that enables a user to communicate with a representative of an organization, department, or workgroup.

this XEP implies a one to many relationship beetween Workgroups and queues, workgroups and users and I want to be able to configure all of them.

So I am wondering what is my best option to implement configuration mechanism from a database:

  • Implement a repository like for vhosts or other stuff. This has the advantage of allowing ad-hoc commands (that's what says the docs).

But is it possible to have a one to many relationship beetween two implementations of tigase.db.comp.RepositoryItemAbstract ? How ?

Documentation seems very poor about repositories, so any help would be appreciated...

  • Wouldn't it be easier to implement my own db connector ? But how could I implement ad-hoc commands ?

Any hint about how to implement such a thing or information about repositories in tigase would be welcome.

Thank you.


Replies (4)

Added by Wojciech Kapcia TigaseTeam over 3 years ago

First of all - I"m not really sure that you need to utilize repository (from skimming over the specification). If you require it and use of ad-hocs then you implement your own repository and then expose it to ad-hocs through @initBindings()@ method.

Added by Julien Durens over 3 years ago

Hi, thank you for your answer,

Actually, I'm a bit lost about Tigase database implementation.

But what I've seen and read makes me think that more or less everything is or belongs to a user. Am I right or do I misunderstand everything ?

If I am right, I would need to create a "mycomponent" user (for managing global component config, for example), and add datas via the user repository API.

Then every workgroup and every queue would be a user or subnodes of my main "mycomponent" user with datas set in other subnodes to store my component state.

Is that true or do I need to RTFM more carefuly :-) ?

Added by Wojciech Kapcia TigaseTeam about 3 years ago

Above is true if you decide to utilise UserRepository - then your component would be visible in tig_users table and all data stored as described in Tigase DB Schema Explained (this is used by MUC component for example).

Added by Julien Durens about 3 years ago

Okay, the fact is that I had never seen such a design in a relational DB, and it evoked me Object stores like mongodb and friends.

So I just wanted to be sure that I was understanding it quite well.

now, I'm more confident about what I understood. Thank you.