By Rupert
coldspring
Bean creation exception in ColdSpring
Mar 6th
I spent almost 45 minutes searching for the problem in Bean Creation in ColdSpring.
Bean creation exception in poimgr.model.service.FieldService
Invalid CFML construct found on line 23 at column 87.:ColdFusion was looking at the following text:
)
The CFML compiler was processing:
- a cfreturn tag beginning on line 23, column 18.
- a cfreturn tag beginning on line 23, column 18.
This basically means that there si a problem in FieldService at line 23!!!
1 <cfcomponent name="FieldService" displayname="FieldService" output="false"> 2 <!--- Constructor ---> 3 <cffunction name="init" access="Public" returntype="FieldService" output="false" hint="I am a new FieldService"> 4 <cfreturn> 5 </cfreturn> 6 7 </cffunction><cffunction name="setFieldBlockGateway" returntype="void" access="public" output="false"> 8 <cfargument name="fieldBlockGateway" type="poimgr.model.db.FieldBlockGateway" required="true"> 9 <cfset variables.fieldblockgateway="arguments.fieldBlockGateway"> 10 </cfset> 11 12 <cffunction name="getFieldBlockGateway" access="public" returntype="poimgr.model.db.FieldBlockGateway" output="false"> 13 <cfreturn> 14 </cfreturn> 15 16 17 </cffunction><cffunction name="getFieldBlocks" access="public" returntype="any" output="false"> 18 <cfreturn> 19 </cfreturn> 20 21 </cffunction><cffunction name="sortFieldBlocks" access="public" returntype="any" output="false"> 22 <cfargument name="columnName" type="string" required="true"> 23 <cfreturn> 24 </cfreturn> 25 26 27 28 </cfargument> </cffunction></cfargument></cffunction></cfcomponent>
Notice the “))” here…
Descriptive Error mechanisms need to be enhanced or Im just plain ol stupid.
AppTemplate Released Beta
Feb 7th
This is my beta release of apptemplate which runs ColdFusion, ColdSpring and Reactor.
To configure:
1. rename all instances of apptemplate to your “myapplication” found in the ff files;
Application.cfm:2:<cfapplication name="apptemplate" sessionmanagement="true"> build.xml:2: <property name="source" value="E:\wwwroot\apptemplate"> build.xml:3: </property><property name="target" value="E:\wwwroot\apptemplate"> build.xml:12: token="apptemplate" build.xml:13: value="apptemplate" config/ModelGlue.xml:4: <controller name="SecurityController" type="apptemplate.controller.SecurityController"> config/ModelGlue.xml:10: </controller><controller name="UserController" type="apptemplate.controller.UserController"> config/ColdSpring.xml:12: <property name="viewMappings"><value>/apptemplate/views</value></property> config/ColdSpring.xml:13: <property name="generatedViewMapping"><value>/apptemplate/views/generated</value></property> config/ColdSpring.xml:27: <constructor -arg name="pathToConfigXml"><value>/apptemplate/config/Reactor.xml</value></constructor> config/ColdSpring.xml:28: <property name="project"><value>apptemplate</value></property> config/ColdSpring.xml:29: <property name="dsn"><value>apptemplate</value></property> config/ColdSpring.xml:31: <property name="mapping"><value>/apptemplate/model/data</value></property> config/ColdSpring.xml:48: <bean id="dataAccess" class="apptemplate.model.db.DataAccess" singleton="true"> config/ColdSpring.xml:53: <value>apptemplate</value> config/ColdSpring.xml:57: </bean><bean id="utility" class="apptemplate.model.ValidationUtility" singleton="true"></bean> config/ColdSpring.xml:62: <bean id="userGateway" class="apptemplate.model.db.UserGateway" singleton="true" autowire="byName"></bean> config/ColdSpring.xml:64: <bean id="userDAO" class="apptemplate.model.db.UserDAO" singleton="true" autowire="byName"></bean> config/ColdSpring.xml:66: <bean id="securityService" class="apptemplate.model.service.SecurityService" singleton="true"></bean> config/ColdSpring.xml:68: <bean id="userService" class="apptemplate.model.service.UserService" singleton="true"> controller/UserController.cfc:3: <cffunction name="init" returntype="apptemplate.controller.UserController" access="public" output="false"> controller/UserController.cfc:11: <cfargument name="userService" type="apptemplate.model.service.UserService" required="true"> controller/UserController.cfc:15: <cffunction name="getUserService" returntype="apptemplate.model.service.UserService" access="public" output="false"> controller/SecurityController.cfc:3: </cffunction><cffunction name="init" returntype="apptemplate.controller.SecurityController" access="public" output="false"> controller/SecurityController.cfc:11: <cfargument name="securityService" type="apptemplate.model.service.SecurityService" required="true"> controller/SecurityController.cfc:15: <cffunction name="getSecurityService" returntype="apptemplate.model.service.SecurityService" access="public" output="false"> controller/SecurityController.cfc:20: <cfargument name="userService" type="apptemplate.model.service.UserService" required="true"> controller/SecurityController.cfc:24: <cffunction name="getUserService" returntype="apptemplate.model.service.UserService" access="public" output="false"> model/service/SecurityService.cfc:3: </cffunction><cffunction name="init" returntype="apptemplate.model.service.SecurityService" access="public" output="false"> model/service/UserService.cfc:8: <cfargument name="userGateway" type="apptemplate.model.db.UserGateway" required="true"> model/service/UserService.cfc:12: <cffunction name="getUserGateway" access="public" returntype="apptemplate.model.db.UserGateway" output="false"> model/service/UserService.cfc:17: <cfargument name="userDAO" type="apptemplate.model.db.UserDAO" required="true"> model/service/UserService.cfc:21: <cffunction name="getUserDAO" access="public" returntype="apptemplate.model.db.UserDAO" output="false"> model/db/UserDAO.cfc:1:<cfcomponent name="UserDAO" displayname="UserDAO" extends="apptemplate.model.db.DataAccess" output="false"> model/db/UserGateway.cfc:1:</cfcomponent><cfcomponent name="UserGateway" displayname="UserGateway" extends="apptemplate.model.db.DataAccess" output="false"> </cfcomponent></cffunction></cfargument></cffunction></cfargument></cffunction></cfargument></cffunction></cfargument></cffunction></cfargument></cffunction></bean></controller></property></cfapplication>
2. Create the database w/c runs on MySQL 5 and is found on
apptemplate/
db/
3. If you want to reload all classes, append “init” on the URL string.
ColdSpring bean creation magic…
Feb 1st
Adam describes some fun and exciting changes in ModelGlue Unity. I can now ditch cflocation by using argument.event.forward(“location.cfm”).
Its just now that im loving ColdSpring, I think its much better to instantiate beans and set/create other objects using setters/getters through the property instead of constructor-arg. Here’s an example:
<cfcomponent displayname="UserService" output="false" hint="I am a UserService."> <cffunction name="init" access="Public" returntype="UserService" output="false" hint="I am a new UserService"> <cfreturn> </cfreturn> </cffunction><cffunction name="setUserGateway" returntype="void" access="public" output="false" hint="Dependency: UserService"> <cfargument name="userGateway" type="cfcodetrack.model.UserGateway" required="true"> <cfset variables.usergateway="arguments.userGateway"> </cfset> <cffunction name="getUserGateway" access="public" returntype="cfcodetrack.model.UserGateway" output="false"> <cfreturn> </cfreturn> </cffunction><cffunction name="authenticate" access="public" returntype="string" output="false"> <cfargument name="username" type="string" required="true"> </cfargument><cfargument name="password" type="string" required="true"> <cfdump var="#password#"> <cfabort> </cfabort> <cffunction name="getUsers" access="public" returntype="any" output="false"> <cfreturn> </cfreturn> </cffunction> </cfdump></cfargument></cffunction></cfargument></cffunction></cfcomponent>
In your ColdSpring.xml your beans should only look like this:
<bean id="dsn" class="cfcodetrack.model.dsn"> <constructor -arg name="dsn"> <value>cfcodetrack</value> </constructor> </bean> <bean id="reactorFactory" class="reactor.reactorFactory"> <constructor -arg name="configuration"> <ref bean="reactorConfiguration"> </ref> </constructor> <!-- Security Service --> </bean><bean id="securityService" class="cfcodetrack.model.SecurityService" singleton="true"></bean> <bean id="userGateway" class="cfcodetrack.model.UserGateway" singleton="true"> <property name="reactorFactory"> <ref bean="reactorFactory"> </ref> </property><property name="dsn"> <ref bean="dsn"> </ref> </property> </bean><bean id="userService" class="cfcodetrack.model.UserService" singleton="true"> <property name="userGateway"> <ref bean="userGateway"> </ref> </property> </bean>
UML Explained
Feb 1st
As Im making some progress in ColdSpring/Reactor, I need some modelling to be able to visualise things much better and to help the team understand. Here is a very good post regarding Use Case Diagrams and Activity Diagrams that Doug wrote.
Some UML Tools:
ArgoUML
- hard to copy and paste objects
Poseidon for UML5.0.1 – without JRE
- cannot save
cfcxmi convert XML models to CFC
Visio 2003 UML Class Export Tool
1. Open your class diagram at a page with a class you wish to export.
2. Control+click each class you wish to export
3. Open the Visual Basic Editor (Alt+F11)
4. Double click on "ThisDocument" if no script is currently loaded
5. Paste the script below here into the empty page
6. Edit the "LogFileLocation" string to tell it where you wish to save your file. (Note: this must exist before the script runs)
7. Hit F5 to run the script
8. Enter a name for the file in the popup box
9. Hit OK
Sub ExportShapes() Const LogFileLocation As String = "C:\visioExportFiles\" Dim selObj As Visio.Selection 'Shapes selection collection Dim shpObj As Visio.Shape 'A shape instance Dim i As Integer Dim myClassDef As String Dim LogFileName As String Dim FileNum As Integer myClassDef = "<classes>" Set selObj = Visio.ActiveWindow.Selection For i = 1 To selObj.Count Set shpObj = selObj(i) myClassDef = myClassDef & "<class>" myClassDef = myClassDef & " <properties> <property>" & Replace(shpObj.Shapes.Item(6).Text, Chr(10), "</property> <property>") & "</property></properties>" myClassDef = myClassDef & "<methods><method>" & Replace(shpObj.Shapes.Item(5).Text, Chr(10), "</method><method>") & "</method></methods>" myClassDef = myClassDef & "</class>" Next i myClassDef = myClassDef & "</classes>" 'Begin export LogFileName = InputBox("What is the file name you wish to use (exclude the .xml extension)?", "Export Classes") MsgBox (myClassDef) If Len(LogFileName) Then FileNum = FreeFile ' next file number Open LogFileLocation & LogFileName & ".xml" For Output As #FileNum ' creates the file if it doesn't exist Print #FileNum, myClassDef ' write information at the end of the text file Close #FileNum ' close the file Else MsgBox ("Bad file name") End If End Sub
ModelGlue Unity, ColdSpring, Reactor Install Guide
Jan 29th
ModelGlue Unity
1. If you are using ColdFusion6.1 then you need to download the updater from Macromedia. You could also download them from our servers…
ColdFusion updater 1 downloads:

cfmx_61update_linux.bin
Note: You would have metadata problems later on if you have 6.1 and no updater 1. However, if your on CFMX7 then no worries. Read my earlier post.
2. Downlaod modelglue unity from www.model-glue.com or http://www.model-glue.com/modelglue_2.0.161.zip
3. Unzip modelglue in your webroot.
4. Test your installation. I highly recommend you go through the ModelGlue2.0 Unity docs found in here, especially the “quickstart” section since it would get you up-to-speed with learning MVC concepts.

If you want to skip the learning curve then you can extract the translator.zip in your webroot and should see the ModelGlue 2.0 Unity up and running page.
5. Your old modelglue1.1 apps are reverse compatible like poiadmin or poidemo, so it should work. You could also test by using the modelglueapplicationtemplate found under the modelglue directory found here:

Load the modelglueapplicationtemplate in eclipse and change the parameters in build.xml, then execute it by ant. You should now have a new application.

6. If you have any problems, then here are some ModelGlue References:
Joe Rinehart Blog
docs.model-glue.com
Builder: Better coding with the Model-Glue:Unity ColdFusion application framework
ColdSpring
5. Download coldspring from:
stable release-Coldspring 1.0 Final Release
bleeding-edge (cvs)
6. Unzip Coldspring in your webroot.
7. You should have the ff directory structure for coldspring in your webroot.

If you decide to put the coldspring directory in a different directory, then you could create a coldfusion mapping in your coldfusion administrator.
8. ColdSpring Resources:
Dave Ross and Chris Scott.
As far as I want this post to be verbose as much as possible for the Chinese team, you could also checkout nodans blog regarding ModelGlue Unity and ColdSpring Tutorials.
Reactor
9. Create a mapping for reactor so that ModelGlue1.1 and 2.0 can coexist. Just make sure CF sees “E:\wwwroot\ModelGlue\Reactor\reactor” as “/Reactor”.
10. Here are some resources in reactor:
Doug Hughes Blog
Trac Site
Reactor Documentation
Reactor Mailing List
Reactor Mailing List Archives
11. I highly recommend going through the reactor livedocs be sure to read the quickstart as it gives you a general idea of how to use reactor in developing your applications.

Comments