This is a reminder that we will be holding a CBOX-100 Training session at CF.Objective this year. This 1 day course is an intense 8 hours of ColdBox. You will get to understand the ColdBox Platform and get some amazing training materials to help you get started in your ColdBox Development. So if you have not registered for CF.Objective yet, then please follow this link to register and also register for the ColdBox class.
If you have already registered and want to sign up for the ColdBox training, then please contact Cathy at cathy@bestmeetings.com
When using ColdBox's SES routing mechanisms you will come to a point where you would like to create variables depending on when a specific route matches or not. You can do so very easily by using the argument called matchVariables, which is a simple string of name-value pairs you want to create in the request collection (This was added in version 2.6.3). However, a hidden feature that we just documented that has been enabled since version 2.6.0, is that you can also pass named arguments to the addCourse() method and have them created on the request collection when the route matches. This makes it much much easier to create simple or complex variables than a simple string of name-value pairs.
Example using matchVariables:
<cfset addRoute(pattern="space/:space",handler="page",action="show",matchVariables="spaceUsed=true,foundAt=#now()#")>
That route will create the spaceUsed,foundAt variables in the request collection when the route matches. However, let's see how easy it is to do it using by convention name-value pairs in the method.
<cfset addRoute(pattern="page/:page",handler="page",action="show",foundAt=now(),internalNamespace="_internal",hashMap=structnew())>
I just added the foundAt,internalNamespace, and HashMap variables just by adding them as virtual arguments. It gets even better if you are running Railo because you can use implicit Array/Structure notation to create very complex variables.
Again, this is now a documented feature in the wiki, so enjoy.
We are releasing a 1.0 version of our GroovyLoader plugin for ColdBox Applications today. This plugin can be found in the extra downloads section of the ColdBox Website as part of the projects pack. So what did we do, well, based on Barney Boisvert's inspiration on CFGroovy, we decided to create a plugin that would leverage ColdBox users with the Groovy Scripting Language. We took some different approaches to the integration and we still have many things planned for it. But as of now, these are the features that our GroovyLoader exhibits
Drop and Play functionality on ANY ColdBox application running on Railo 3.0 >, Adobe CF 8 >, or Open BD
Load a groovy environment (1.6.0) into any ColdBox application without modifying the running CF engine. It uses our integrated JavaLoader to load all necessary libraries without modifying the CF engine. It can also, load up ANY library you place in the GroovyLoader's lib directory automatically. So if you kids start fooling around with packaged groovy libraries or java libraries like Hibernate, Spring, Gorm, etc. You can do so, by just dropping the files in that pre-configured folder.
Setup of a directory that will hold groovy classes/scripts, that the GroovyLoader will try to load at runtime. Uses the configureClassPath() method of the plugin and usually called once.
Integration with the ColdBox cache to provide resolution of parsed groovy-to-java classes for all parsed groovy source, including custom groovy source compilations
Ability to clean the parsed class cache from the ColdBox cache
Ability to clean the groovy classloader cache of parsed bits
Ability to handle complex groovy/java relationships and hierarchies
Easily extend/decorate the plugin to meet your needs or enhance it
Execute groovy source code using a custom tag import
Groovy scripts and source code executions will be binded with the following variables. This means that the groovy scripts that are executed using runScript() and runSource() will have the following variables IMPLICITLY created at runtime. This creates a data bridge between ColdFusion and Groovy.
A custom passed structure called varCollection. This can have anything you like.
The coldbox request collection: coldbox_rc
The following coldfusion variables:
cf_pagecontext : The coldfusion pagecontext object
cf_application : The coldfusion application scope
cf_server : The coldfusion server scope
cf_session : The coldfusion session scope (if available)
So how does it work. Well, first of all, the download includes a very simple application that you can replicate and learn from. As our integration progresses we will be adding more functionality and some extra surprises our very own Sana Ullah has been working on for quite a while now.
Step1: Install the custom plugin in your application or as a core plugin, basically drop the GroovyLoader folder in your plugins directory of your app
Step 2: Init the plugin on application start, usually the application start handler:
<cffunction name="onAppInit" access="public" returntype="void" output="false"> <cfargument name="Event" type="any">
<!--- Init the Groovy Loader with my model/groovy folder ---> <cfset getMyPlugin("GroovyLoader.GroovyLoader").configureClassPath(getSetting("ApplicationPath") & "model/groovy")>
</cffunction>Step 3: That's it, you can now use it a la carte to create groovy classes, run scripts, or run on deman source code via the method or the imported tag. You can see some sample handler methods below:
<cfcomponent name="groovy" extends="coldbox.system.eventhandler" output="false" autowire="true">
I had the pleasure of getting to speak at the Orange County User Group last night and it was a great night. We had a full night of ColdBox and even some incredible Ping Pong tournament. Thanks guys for inviting me over. You can find the recordings for the presentations below. You will be surprised to see some of the new ColdBox projects, especially our new ColdBox Lookup Manager that has been silently released. Expect more on it soon.