Interactions among domain types

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Interactions among domain types

grampajohn
Administrator
I'm reading through the note on db table ownership at https://github.com/powertac/powertac-server/wiki/Role-concept, and I'm confused. It says that if object a (TaxAuthority in this case) wants to do a financial transaction, it has to create a message representing the change that will somehow get routed to object b (AccountingService in this case), at which point object b will do the update. I'm a little unclear why the TaxAuthority does not simply call a method on the AccountingService rather than creating a message. I am also unclear how the message gets routed. Is there some piece of code or config I should be looking at to see this?

Part of my problem is that I cannot find any examples in existing code where this behavior is happening. Another confusion factor is that in powertac-common/grails-app/domain, we have two sets of types that have very similar names but slight different definitions. One set is in org.powertac.common, and the other is in org.powertac.common.command. The ones in org.powertac.common seem to be remarkably free of explanatory comments. On the other hand, when I look at the AccountingService code, I see dependencies only on the ones in org.powertac.common.command.

I also see that the code in AccountingService dealing with Tariffs is quite out-of-date. I might be able to fix it, but I'm reluctant to tackle it until I understand what's current and what's out of date.

What I think I'm seeing is an incomplete transition from the earlier OSGI architecture to the new Grails architecture. Unfortunately, I can find no documentation on how the different plugins are supposed to interact in the new architecture, and so far I have not found any code that makes sense to me outside of powertac-common.

I think we need someone to write a clear explanation of how all this is supposed to work in the new setup. I could try it, but I would like to understand what Carsten and the group at KIT were thinking of first. In the meantime, I'm quickly coming to the conclusion that we are not nearly as far along in development as I had hoped.

John
Reply | Threaded
Open this post in threaded view
|

Re: Interactions among domain types

ddauer

I'm reading through the note on db table ownership at https://github.com/powertac/powertac-server/wiki/Role-concept, and I'm confused. It says that if object a (TaxAuthority in this case) wants to do a financial transaction, it has to create a message representing the change that will somehow get routed to object b (AccountingService in this case), at which point object b will do the update. I'm a little unclear why the TaxAuthority does not simply call a method on the AccountingService rather than creating a message.

This was done to reduce dependencies between plugins. The idea was that a plugin should not depend on any other plugin than powertac-common.
 
I am also unclear how the message gets routed. Is there some piece of code or config I should be looking at to see this?

This is where Spring Integration kicks in. Existing Spring configurations are in the pipesAndFilters branch at https://github.com/powertac/powertac-server/tree/pipesAndFilters/grails-app/conf/spring. We define from and to which plugin/class a message gets routed within these files. Please note that they are not yet complete (missing tests and a couple of missing additional channel configurations) and have not been updated to represent the Tariff structure update. This is my priority #1 and I will fix that completely as soon as my finals are over.
 
- David
Reply | Threaded
Open this post in threaded view
|

Re: Interactions among domain types

grampajohn
Administrator
On 02/01/2011 11:22 AM, ddauer [via Power TAC Developers] wrote:
>
>     I'm reading through the note on db table ownership at
>     https://github.com/powertac/powertac-server/wiki/Role-concept, and
>     I'm confused. ...
>
>
> This was done to reduce dependencies between plugins. The idea was that
> a plugin should not depend on any other plugin than powertac-common.

OK, that makes sense. But there's still a lot of
responsibility-assignment I don't understand. There's quite a bit of
code inside powertac-common dealing with tariffs and tariff
subscriptions. What I'm not clear about is how that code is supposed to
get called. I'm also concerned about how we create the simulation trace
when these methods are called. For example, to subscribe to a Tariff,
one must call tariff.subscribe(), which returns a new or existing
TariffSubscription instance. If it's an existing instance, how do we
create the record of the change to the subscription? Also, when a
Customer subscribes to a Tariff, there's a financial transaction that
represents the signup fee/bonus, and when a Customer withdraws, there's
potentially an early-withdrawal penalty. The code to compute this should
be in TariffSubscription, but who calls it? Accounting Service? How does
it know that it needs to call it?

>
>     I am also unclear how the message gets routed. Is there some piece
>     of code or config I should be looking at to see this?
>
>
> This is where Spring Integration kicks in. Existing Spring
> configurations are in the pipesAndFilters branch at
> https://github.com/powertac/powertac-server/tree/pipesAndFilters/grails-app/conf/spring.
> We define from and to which plugin/class a message gets routed within
> these files. Please note that they are not yet complete (missing tests
> and a couple of missing additional channel configurations) and have not
> been updated to represent the Tariff structure update. This is my
> priority #1 and I will fix that completely as soon as my finals are over.
> - David

Yes, I had already found that, but either I don't understand it or it's
very out-of-date. But I guess there's another branch I had not spotted,
called pipesAndFilters. Even here you are still using the types in
org.powertac.common.command rather than the ones in org.powertac.common.
Is there a specific reason for this, or is it just depending on an older
version of powertac-common?

I need to understand this stuff well enough to do development, and to
help my students with their development work. At this point I'm still a
little lost.

Thanks for your help.

John