Hi Jim, I see Luis already replied but I’d like to toss in some advice too. Firstly, I’m excited you’re giving ColdBox a try. I don’t think you’ll want to go back once you see how trivial it makes things like environment tier control. We understand that apps need more than just MVC conventions and you have better things to do than reinvent the wheel. There’s a difference between a framework that “gets out of your way” and one that runs and hides when you need help
So generally speaking, the FW/1 conventions are pretty much a copy of the ColdBox conventions which is good because it means you don’t have much to learn there. In fact, a simple, minimalistic “hello world” app is surprisingly similar to the same in FW/1. The main difference is now you have an entire development platform of tools at your disposal to build upon the blindly simple MVC conventions.
For starters, I’d like to point out that many of the docs on wiki.coldbox.org are what I call “comprehensive” docs that attempt to cover all espects of our libraries. These are great to dig into when you’re ready to go deeper, but might be a bit too much if you’re starting out. (I’m a little weird, I guess. I read them top to bottom to familiarize myself and then check back regularly jumping down to the part I want to reference)
I would recommend you start with our PDF ref cards These are a high-level introduction into our libraries and leaves plenty uncovered for you to discover later:
http://wiki.coldbox.org/wiki/Dashboard.cfm#PDF_Ref_Cards
If you webinars, we have dozens of recorded sessions here. Check out the ColdBox developers week 2012/2013 recordings.
http://www.coldbox.org/media
There’s also a collection of “Tips of the Week” on the ColdBox blog:
http://blog.coldbox.org/__search?q=Tip%20of%20the%20Week
This list is also excellent to get an immediate sounding board for questions and advice.
So, to address your specific questions a bit more directly…
> The main issue I’ve run into is how to handle things like DSN with some sort of environment check.
Luis mentioned this, but environment control has been part of ColdBox since the early days. Its something everyone needs! Start with this tip to get you started:
http://blog.coldbox.org/blog/tip-of-the-week-using-environment-control-in-coldbox
> The person here before I was setup ColdSpring
I’m sorry. ColdSpring is like beating yourself to death with XML :-/
Here’s our WireBox ref card:
https://github.com/ColdBox/cbox-refcards/raw/master/WireBox/WireBox-Refcard.pdf
And here is a couple simple runnable examples you can play with in your browser:
http://runnable.com/Usp0hdiR7RMpAAAR/use-wirebox-to-create-objects-in-coldbox-for-coldfusion-cfml-mvc-and-railo
http://runnable.com/UssCLbsLBpIvAAAj/use-wirebox-to-autowire-objects-in-coldbox-for-coldfusion-cfml-mvc-and-railo
You’ll find WireBox has very simple conventions. The simplest of which is just to drop a CFC in your /model directory and then call getModel( ‘myCFC’ ) in a handler or view. That simple! You can use WireBox with zero configuration if you use the model’s convention folder. Now, explicit mappings are possible like Luis showed, but it uses a nice DSL, not XML. You can give WireBox additional folders to look in with the “scanLocations” setting in WireBox.cfc but CFCs in nested folders must be refernced with their “path.to.cfc”. That’s why my favorite WireBox feature is the mapDirectory() command in the WireBox config. Just call mapDirectory( ‘/placeIKeepMyModels’ ) and it will recursivley scan that entire folder and map everything based on the name of the CFC at startup.
Now, as far as specifying your dependencies, it looks like you’re using constructor args. These actually work out of the box if you just add inject=“name” to your init()'s args. WireBox will see the constructor args, go find those dependencies, and pass them in all automatically. If you prefer convention over config, this is great!
component {
/**
-
@myService.inject myService
*/
function init( myService ) {}
}
Note, it’s up to you to take arguments.myService in your init and set it somewhere. I actually use an even simpler method called mixin injection. All you do is place a cfproperty at the top of the component with an inject attribute and your dependency will automatically be made available to you in the variables scope (by default).
component {
property name=‘myService’ inject=‘myService’;
}
It really doesn’t get any easier then that. You can also inject all sorts of things from ColdBox settings, loggers, caches, Java object, constants, you name it. And all of this makes the config optional. Another note, ColdSpring is very limited and only provides singleton persistence. WireBox, by default, will create everything as transients (recreated each time they are asked for). You can use our mapping DSL to do this, but again, I prefer the handy “singleton” annotation:
component singleton {}
Boom! Now this CFC will only be created once and the entire application will share a single instance.
That should get you started on your way. Just ask if you have any questions.
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com