Extras:ReactorORM
<< Back to Dashboard | << Extras Viewer
Reactor ORM Support
Introduction
ColdBox includes some extra support classes when working with Reactor ORM. These classes are :
- ReactorLoader.cfc : An interceptor that can load Reactor and some of its classes into the ColdBox Cache. A super duper easy way to work with Reactor in your applications.
These utilities can be found in the /coldbox/system/orm/reactor folder.
Credits
Reactor Loader Interceptor
The reactor extras have been expanded and a new interceptor has been born called: ReactorLoader. This nice interceptor will configure your application to use Reactor and cache it in the ColdBox cache. Easily configure your app for Reactor ORM
Interceptor Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| dsnAlias | string | true | N/A | The datasource alias name to use, as defined in your datasources section of your config. Make sure you define the dbtype also |
| pathToConfigXML | string | true | N/A | The path of the Reactor config file |
| project | string | true | N/A | The name of the Reactor project |
| mapping | string | true | N/A | The relative path or mapping to the directory where reactor will write generated files |
| mode | string | true | N/A | The reactor mode: always,development,production |
| ReactorCacheKey | string | false | Reactor | The key used to store Reactor as a singleton in the coldbox cache. (case sensitive) |
| ReactorConfigClassPath | string | false | reactor.config.config | The class path override of the reactor configuration object |
| ReactorFactoryClassPath | string | false | reactor.reactorFactory | The class path override of the reactor factory object |
So just remember to add the datasource element with a valid dbType as Reactor needs it; Options are:
- mssql - Microsoft SQL Server 2000 and 2005.
- mysql - MySQL 5
- mysql4 - MySQL 4
- postgresql - PostgreSQL 8
- db2 - IBM DB2
- oracle - Oracle 9i and 10g
- oraclerdb - Oracle RDB (this is not officially supported)
Programmatic Sample:
datasources = {
blogDSN = { name="simpleblog" dbtype="mssql"}
};
interceptors = [
{ class="coldbox.system.orm.reactor.ReactorLoader",
properties = {
dsnAlias = "blogDSN",
pathToConfigXML = "config/reactor.xml.cfm",
project = "MyBlog",
mapping = "/#appMapping#/model/reactor",
mode = "development"
}
}
};
XML Sample:
<Datasources> <Datasource alias="blogDSN" name="simpleblog" dbtype="mssql" /> </Datasources> <Interceptors> <-- <Reactor Loader --> <Interceptor class="coldbox.system.orm.reactor.ReactorLoader"> <Property name="dsnAlias">blogDSN</Property> <Property name="pathToConfigXML">config/reactor.xml.cfm</Property> <Property name="project">MyBlog</Property> <Property name="mapping">${AppMapping}/model/reactor</Property> <Property name="mode">development</Property> </Interceptor> </Interceptors>
This declaration will create the following objects in the ColdBox cache:
| Cache Key | Object |
|---|---|
| Reactor | The reactor factory object |
So do you still think there is more? Well, there is no more, that's it, a few lines of code and you are cooking with Reactor.

SideBar
User Login 




Comments (