I am new to ColdBox and am attempting to put together my first app
using the 3.0.0.RC1, Oracle 11i and the CF9 base orm. I started with
the base app configuration and added two models with service. Put
mappings in ModelMappings.cfm. When I try to invoke the handler it
tells me that my services object is undefined in the list function of
the handler so the injector doesn't appear to be working.
Can anybody tell me what I am doing wrong? How do I trouble shoot
this? Any help would be appreciated.
============= config/ModelMappings.cfm ===================
<cfscript>
/* Add all the model mappings you want */
/* addModelMapping(alias="",path="") */
addModelMapping(alias="TransferRequestService",path="model.TransferRequest.TransferRequestService");
addModelMapping(alias="JobPostingService",path="model.JobPosting.JobPostingService");
addModelMapping(alias="DateUtil",path="model.utilities.DateUtil");
</cfscript>
============= config/coldbox.xml.cfm ===================
<?xml version="1.0" encoding="UTF-8"?>
<!--
For all possible configuration options please refer to the
documentation:
http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbConfigGuide
-->
<Config xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="
http://www.coldbox.org/schema/
config_3.0.0.xsd">
<Settings>
<!-- Application Setup-->
<Setting name="AppName" value="HR06TRJP"/>
<!-- If you are using a coldbox app to power flex/remote apps, you
NEED to set the AppMapping also. In Summary,
the AppMapping is either a CF mapping or the path from the webroot
to this application root. If this setting
is not set, then coldbox will try to auto-calculate it for you.
Please read the docs.
<Setting name="AppMapping" value="/MyApp"/> -->
<Setting name="EventName" value="" />
<!-- Development Settings -->
<Setting name="DebugMode" value="true"/>
<Setting name="DebugPassword" value=""/>
<Setting name="ReinitPassword" value=""/>
<Setting name="HandlersIndexAutoReload" value="true"/>
<Setting name="ConfigAutoReload" value="false"/>
<!-- Implicit Events -->
<Setting name="DefaultEvent" value="General.index"/>
<Setting name="RequestStartHandler" value="Main.onRequestStart"/>
<Setting name="RequestEndHandler" value=""/>
<Setting name="ApplicationStartHandler" value="Main.onAppInit"/>
<Setting name="SessionStartHandler" value=""/>
<Setting name="SessionEndHandler" value=""/>
<Setting name="MissingTemplateHandler" value=""/>
<!-- Extension Points -->
<Setting name="UDFLibraryFile" value="includes/helpers/
ApplicationHelper.cfm" />
<Setting name="PluginsExternalLocation" value="" />
<Setting name="ViewsExternalLocation" value=""/>
<Setting name="LayoutsExternalLocation" value="" />
<Setting name="HandlersExternalLocation" value="" />
<Setting name="RequestContextDecorator" value=""/>
<!-- Error/Exception Handling -->
<Setting name="ExceptionHandler" value=""/>
<Setting name="onInvalidEvent" value=""/>
<Setting name="CustomErrorTemplate" value="" />
<!-- Application Aspects -->
<Setting name="HandlerCaching" value="false"/>
<Setting name="EventCaching" value="false"/>
<Setting name="ProxyReturnCollection" value="false"/>
<Setting name="FlashURLPersistScope" value="session"/>
</Settings>
<!-- Complex Settings follow JSON Syntax.
www.json.org.
*IMPORTANT: use single quotes in this xml file for JSON notation,
ColdBox will translate it to double quotes.
-->
<YourSettings>
<!-- @YOURSETTINGS@ -->
</YourSettings>
<!--Model Integration -->
<Models>
<DefinitionFile>config/ModelMappings.cfm</DefinitionFile>
<!--
<SetterInjection>true</SetterInjection>
<ObjectCaching>true</ObjectCaching>
<ExternalLocation></ExternalLocation>
<DICompleteUDF>onDIComplete</DICompleteUDF>
<StopRecursion></StopRecursion>
<ParentFactory type="coldspring or lightwire">definition file</
ParentFactory>
-->
</Models>
<!--
ColdBox Logging via LogBox
Levels: -1=OFF,0=FATAL,1=ERROR,2=WARN,3=INFO,4=DEBUG
-->
<LogBox>
<Appender name="coldboxTracer"
class="coldbox.system.logging.appenders.ColdboxTracerAppender" />
<!-- Log to ColdBox File -->
<Appender name="fileLog"
class="coldbox.system.logging.appenders.AsyncRollingFileAppender">
<Property name="filePath">logs</Property>
<Property name="fileName">${AppName}</Property>
</Appender>
<!-- Root Logger Definition -->
<Root levelMin="FATAL" levelMax="DEBUG" appenders="*" />
</LogBox>
<Layouts>
<!--Declare the default layout, MANDATORY-->
<DefaultLayout>Layout.Main.cfm</DefaultLayout>
<!--
Declare other layouts, with view/folder assignments if needed, else
do not write them
<Layout file="Layout.Popup.cfm" name="popup">
<View>vwTest</View>
<View>vwMyView</View>
<Folder>tags</Folder>
</Layout>
-->
</Layouts>
<Interceptors>
<!-- USE ENVIRONMENT CONTROL -->
<Interceptor class="coldbox.system.interceptors.EnvironmentControl">
<Property name='configFile'>config/environments.xml.cfm</Property>
<Property name='fireOnInit'>true</Property>
</Interceptor>
<!-- USE AUTOWIRING -->
<Interceptor class="coldbox.system.interceptors.Autowire" >
<Property name="entityInjection">true</Property>
<Property name="debugMode">true</Property>
<Property name="enableSetterInjection">true</Property>
</Interceptor>
<!-- USE SES -->
<Interceptor class="coldbox.system.interceptors.SES">
<Property name="configFile">config/Routes.cfm</Property>
</Interceptor>
<!-- @SIDEBAR@ -->
<Interceptor class="coldbox.system.interceptors.coldboxSideBar">
<Property name="yOffset">50</Property>
<Property name="isScroll">false</Property>
<Property name="slideSpeed">15</Property>
<Property name="waitTimeBeforeOpen">0</Property>
<Property name="waitTimeBeforeClose">250</Property>
<Property name="links">
[
{"desc":"ColdBox API","href":"http:\/\/
www.coldbox.org\/api
\/"}
,{"desc":"ColdBox SideBar Help","href":"http:\/\/
ortus.svnrepository.com\/coldbox\/trac.cgi\/wiki\/cbSideBar"}
,{"desc":"ColdBox Credits","href":"http:\/\/
ortus.svnrepository.com\/coldbox\/trac.cgi\/wiki\/cbCredits"}
]
</Property>
<Property name="width"></Property>
<Property name="visibleWidth"></Property>
<Property name="imagePath"></Property>
<Property name="imageVAlign"></Property>
<Property name="cssPath"></Property>
</Interceptor>
</Interceptors>
<i18N>
<!--Default Resource Bundle without locale and properties extension--
>
<!--<DefaultResourceBundle>includes/main</DefaultResourceBundle>-->
<!--Java Standard Locale-->
<!--<DefaultLocale>en_US</DefaultLocale>-->
<!--session or client-->
<!--<LocaleStorage>session</LocaleStorage>-->
<!--<UknownTranslation>nothing</UknownTranslation>-->
</i18N>
<!-- Datasource Settings
<Datasources>
<Datasource alias="MyDSNAlias" name="real_dsn_name"
dbtype="mysql" username="" password="" />
</Datasources>
-->
<!--IOC Integration
<IOC>
<Framework type="coldspring or lightwire" reload="true or false"
objectCaching="true or false">definition file</Framework>
<ParentFactory type="coldspring or lightwire>definition file</
ParentFactory>
</IOC>
-->
<!-- Cache Settings
<Cache>
<ObjectDefaultTimeout>60</ObjectDefaultTimeout>
<ObjectDefaultLastAccessTimeout>30</ObjectDefaultLastAccessTimeout>
<UseLastAccessTimeouts>true</UseLastAccessTimeouts>
<ReapFrequency>1</ReapFrequency>
<MaxObjects>100</MaxObjects>
<FreeMemoryPercentageThreshold>0</FreeMemoryPercentageThreshold>
<EvictionPolicy>LRU</EvictionPolicy>
</Cache>
-->
<!-- Debugger Settings
<DebuggerSettings>
<EnableDumpVar>true</EnableDumpVar>
<PersistentRequestProfiler>true</PersistentRequestProfiler>
<maxPersistentRequestProfilers>10</maxPersistentRequestProfilers>
<maxRCPanelQueryRows>50</maxRCPanelQueryRows>
<TracerPanel show="true" expanded="true" />
<InfoPanel show="true" expanded="true" />
<CachePanel show="true" expanded="false" />
<RCPanel show="true" expanded="false" />
</DebuggerSettings>
-->
<!-- Mail Server Settings
<MailServerSettings>
<MailServer></MailServer>
<MailPort></MailPort>
<MailUsername></MailUsername>
<MailPassword></MailPassword>
</MailServerSettings>
-->
<!-- Bug reporting aspect
<BugTracerReports enabled="false">
<MailFrom>
mye...@gmail.com</MailFrom>
<CustomEmailBugReport>a custom bug report template</
CustomEmailBugReport>
<BugEmail>
mye...@gmail.com</BugEmail>
</BugTracerReports>
-->
<!-- Web Services
<WebServices>
<WebService name="TESTWS1" URL="
http://www.test.com/test1.cfc?wsdl" /
>
</WebServices>
-->
</Config>
============= handler/JobPosting.cfm ===================
<cfcomponent output="false" hint="Manage Job Postings"
extends="coldbox.system.EventHandler" >
<!--- Inject Dependencies --->
<cfproperty name="JobPostingService" inject="Model" scope="instance">
<!------------------------------------------- PUBLIC EVENTS
------------------------------------------>
<cffunction name="index" output="false" hint="index">
<cfargument name="event">
<cfset list(arguments.event)>
</cffunction>
<cffunction name="list" output="false" hint="list">
<cfargument name="event">
<cfset var rc = event.getCollection()>
<cfset rc.qContacts = JobPostingService.list()>
<cfset event.setView("JobPosting/list")>
</cffunction>
<cffunction name="add" output="false" hint="add">
<cfargument name="event">
<cfset var rc = event.getCollection()>
<cfset event.setView("JobPosting/add")>
</cffunction>
<cffunction name="create" output="false" hint="create">
<cfargument name="event">
<cfset var rc = event.getCollection()>
<cfset event.paramValue("name","")>
<cfset event.paramValue("email","")>
<!--- Verify posting info --->
<cfif NOT len(
rc.name) OR NOT len(rc.email)>
<cfset getPlugin("MessageBox").warn("Please enter a value for email
and/or name")>
<cfset setNextEvent("JobPosting.add")>
</cfif>
<!--- Create posting --->
<cfset JobPostingService.create(
rc.name,rc.email)>
<cfset getPlugin("MessageBox").info("Job Posting Created!")>
<cfset setNextEvent("JobPosting.list")>
</cffunction>
<cffunction name="delete" output="false" hint="delete">
<cfargument name="event">
<cfset var rc = event.getCollection()>
<cfset event.paramValue("id","")>
<!--- Remove posting --->
<cfset JobPostingService.remove(
rc.id )>
<cfset getPlugin("MessageBox").info("Job Posting Removed!")>
<cfset setNextEvent("JobPosting.list")>
</cffunction>
<!------------------------------------------- PRIVATE EVENTS
------------------------------------------>
</cfcomponent>
============= handler/TransferRequest.cfm ===================
<cfcomponent output="false" hint="Manage Transfer Requests"
extends="coldbox.system.EventHandler" >
<!--- Inject Dependencies --->
<cfproperty name="TransferRequestService" inject="Model"
scope="instance">
<!------------------------------------------- PUBLIC EVENTS
------------------------------------------>
<cffunction name="index" output="false" hint="index">
<cfargument name="event">
<cfset list(arguments.event)>
</cffunction>
<cffunction name="list" output="false" hint="list">
<cfargument name="event">
<cfset var rc = event.getCollection()>
<cfset rc.qRequests = TransferRequestService.list()>
<cfset event.setView("TransferRequest/list")>
</cffunction>
<cffunction name="add" output="false" hint="add">
<cfargument name="event">
<cfset var rc = event.getCollection()>
<cfset event.setView("TransferRequest/add")>
</cffunction>
<cffunction name="createTransferRequest" output="false"
hint="createTransferRequest">
<cfargument name="event">
<cfset var rc = event.getCollection()>
<cfset event.paramValue("clockNbr","")>
<cfset event.paramValue("userName","")>
<!--- Verify user info --->
<cfif NOT len(rc.clockNbr) OR NOT len(rc.userName)>
<cfset getPlugin("MessageBox").warn("Please enter a value for
clockNbr and/or userName")>
<cfset setNextEvent("TransferRequest.add")>
</cfif>
<!--- Create Contact --->
<cfset TransferRequestService.create(rc.clockNbr,rc.userName)>
<cfset getPlugin("MessageBox").info("Transfer Request Created!")>
<cfset setNextEvent("TransferRequest.list")>
</cffunction>
<cffunction name="delete" output="false" hint="delete">
<cfargument name="event">
<cfset var rc = event.getCollection()>
<cfset event.paramValue("id","")>
<!--- Remove Contact --->
<cfset TransferRequestService.remove(
rc.id )>
<cfset getPlugin("MessageBox").info("Transfer Request Removed!")>
<cfset setNextEvent("TransferRequest.list")>
</cffunction>
<!------------------------------------------- PRIVATE EVENTS
------------------------------------------>
</cfcomponent>
============= model/TransferRequest/TransferRequest.cfm
===================
/**
* DAO to handle TransferRequest operations.
* @author Michael Blakeslee
*/
component persistent="true" table="TBXX49_Transfer_Request" {
// Properties
property name="id" column="nc_id" type="numeric" ormtype="int"
fieldtype="id" generator="sequence"
params={sequence='gc_TRJP_TBXX49_Transfer_Request'};
property name="clockNbr" column="tc_clocknbr" type="string"
length="8" ormtype="string";
property name="userName" column="tc_userName" type="string"
length="120" ormtype="string";
// Relationships
// DEPENDENCIES via WireBOX
property name="DateUtil" inject="model" persistent="false";
}
============= model/TransferRequest/TransferRequestService.cfm
===================
/**
* Service to handle TransferRequest operations.
* @author Michael Blakeslee
*/
component extends="coldbox.system.orm.hibernate.VirtualEntityService"
singleton {
/**
* Constructor
*/
public TransferRequestService function init(){
// init it
super.init(entityName="TransferRequest");
return this;
}
}
============= model/JobPosting/JobPosting.cfm ===================
/**
* DAO to handle TransferRequest operations.
* @author Michael Blakeslee
*/
component persistent="true" table="TBXX50_Job_Posting" {
// Properties
property name="id" column="nc_id" type="numeric" ormtype="int"
fieldtype="id" generator="sequence"
params={sequence='gc_TRJP_TBXX50_Job_Posting'};
property name="name" column="tc_name" type="string" length="120"
ormtype="string";
property name="email" column="tc_email" type="string" length="120"
ormtype="string";
// Relationships
// DEPENDENCIES via WireBOX
property name="DateUtil" inject="model" persistent="false";
}
============= model/JobPosting/JobPostingService.cfm
===================
/**
* Service to handle Job Posting operations.
* @author Michael Blakeslee
*/
component extends="coldbox.system.orm.hibernate.VirtualEntityService"
singleton {
/**
* Constructor
*/
public JobPostingService function init(){
// init it
super.init(entityName="JobPosting");
return this;
}
}