[wirebox] best approach to create multi-level services

I am new to WireBox and I have to tackle a rather large problem first thing. I am needing some guidance on how to approach this.

I need to create multiple service layers based on our multiple divisions, each have their own databases.

For example:
com.divisionA.model
com.divisionB.model
com.divisionC.model

Each service layer will only handle its own business logic, they will not have any knowledge of each other. They will each be unit tested independent of one another as well.

I then need to create a top-level service layer that can talk to all of the divisional layers. It will access the appropriate divisional model based on configuration of the client data being accessed. This top-level service is what the applications will reference.

I understand how to configure the divisional service layers in Wirebox. But what I do not understand is how the top-level service will access them. Also, even though the applications will only reference the top-level service I imagine that I still need to configure the divisional services in the Application.cfc as well and I’m at a loss on how I would do this.

Any help would be appreciated? Or am I going about this the wrong way? Any better suggestions?

Thanks

> But what I do not understand is how the top-level service will access them.

I’m not sure if I understand your question. Every instance is mapped in WireBox with an ID. You haven’t shared the specifics on how you’ve chosen to map your models, but assuming that the mapping ID for com.divisionA.model is something like “divisionAModel” then you’d just access it like this:

var divisionAModel = wirebox.getInstance( “divisionAModel” );

> I imagine that I still need to configure the divisional services in the Application.cfc

Wait, what? What are you configuring in Application.cfc? If you’re outside of ColdBox, the only code you should need is:

onApplicationStart() {
new wirebox.system.ioc.Injector( “path.to.config” );
}

Everything else should be in your config file (call the binder).

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks Brad,

Sorry if I was not clear - it made sense to me lol. And like I said, first time using WireBox.

You may not have understood what I was saying but I am understanding what you are saying. I think I was trying to make this more complex than what it needed to be. Your explanation helped!

Thanks