sonyxperiadev / gerrit-events

MIT License
47 stars 62 forks source link

Proposition of architecture. #10

Open slawekjaranowski opened 10 years ago

slawekjaranowski commented 10 years ago

I congratulate that you separate gerrit-events from jenkins plugins. I know that this library mainly support gerrit events, but if you separate it, maybe you are interested to add some new feature.

My proposition is - create a few modules in gerrit-events project.

Dependency in project should be:

Requirements:

Advantages:

I can write:

GerritQuery query = new GerritSshQuery(new SSHConnectio(...))

in this case my project depends only on gerrit-ssh and some ssh implementation

I can also write:

GerritQuery query = new GerritRestQuery(new RestConnectio(...))

and in this case my project depends on gerrit-rest and some http connection library

Disadvantages:

rsandell commented 10 years ago

I like it! The disadvantages you mention could probably be mitigated a little bit by having a "least common denominator" command interface but at the same time "treat" each individual command method (ssh/rest) as a first class interface. As I've understood the intentions of the Gerrit project; the SSH interface is going away at some point or at least will stop development, and new operations will only be implemented in the rest api.

But another concern is what @rinrinne mentions in #5 that Gerrit plugins can add their own events and commands, so the architecture needs to somehow be prepared for that.

If you want to take a stab at implementing the proposed architecture, then go for it! :) But try to not mess too much with the existing dto classes because that would make backwards compatibility in the Gerrit Trigger quite hard/complex to maintain.

I've personally had some pains with how maven behaves with multi module projects in the past; one of the many reasons for breaking out this module. But it could be that my level of maven knowledge hasn't been good enough.