Transcript Document
ColdSpring
Powered Fusebox
In Action
Adam Wayne Lehman
ColdFusion Specialist
Adobe Systems, Inc.
[email protected]
2006 Adobe Systems Incorporated. All Rights Reserved.
About Me
ColdFusion Specialist at Adobe
Solutions Engineer
Technical Evangelist
Member of the ColdFusion Product Team
10+ years of ColdFusion experience
Previous Lives
US Department of State
Johns Hopkins University
2006 Adobe Systems Incorporated. All Rights Reserved.
Agenda
Introduction to ColdSpring
Fusebox / ColdSpring MVC
ColdSpring Lexicons
Demo
Q&A
2006 Adobe Systems Incorporated. All Rights Reserved.
What is ColdSpring?
ColdSpring is a Model Framework
Community driven, open source ColdFusion component container
inspired by J2EE Spring Framework
Dave Ross
Chris Scott
Uses the J2EE Spring syntax and DTD for its xml config file
ColdFusion’s first Aspect Oriented Programming framework
Service layer framework for CFCs
Manages the lifecycle and dependencies of your CFCs
You don’t have to alter your existing CFCs to get them to work with ColdSpring
Enforces best practices in domain design
The most popular ColdFusion framework today!
2006 Adobe Systems Incorporated. All Rights Reserved.
Fusebox MVC
Event
(fuseaction)
• Processes and responded to events
• Can update the model directly
• Circuit.xml
Controller
• Domain model
• Abstracts the database
• acts, qrys & CFCs
• Renders model into UI
• HTML
View
2006 Adobe Systems Incorporated. All Rights Reserved.
• dsp_myForm.cfm
Model
Fusebox _VC
Use Fusebox to manage the
controller and the view
View
Controller
Procedural style better suited for
HTML development
Easier for designers and content
managers
Controller
Configured ‘declaratively’ through
xml
Highly extensible (lexicons)
Tons of existing solutions to
common problems (plugins)
View
2006 Adobe Systems Incorporated. All Rights Reserved.
ColdSpring M_ _
Use ColdSpring to manage the
model and define the domain
OO design solves complex problems
Full Component Lifecycle
Manages Dependencies
Configured ‘declaratively’ through xml
Very lightweight
Model is framework agnostic
2006 Adobe Systems Incorporated. All Rights Reserved.
Model
Singletons & Factories
Singletons
Objects that persist across requests
Minimal object creation = fast application
Factories
Responsible for maintaining Singletons
Handles configuration
Manages the object lifecycle
Creates the object
Persist the object
Directs requests to the object
2006 Adobe Systems Incorporated. All Rights Reserved.
Inversion of Control / Dependency Injection
Objects not responsible for managing dependencies
ColdSpring’s factory bakes the dependencies in during object creation
(dependency injection)
Setter Injection
Construction Injection
2006 Adobe Systems Incorporated. All Rights Reserved.
All CFCs are not the same
Value Object (DTO or Domain
Object)
DAO
fetch, save, remove, create, update
Gateway
Services
Façade for a group of model components
Should only talk to their components or
other services
Value Object
2006 Adobe Systems Incorporated. All Rights Reserved.
Service
Gateway
DAO
ColdSpring and Fusebox in Action
PDF and FlashPaper 2 reports with <CFReport /> and the ColdFusion Report
Builder tool
Integrated printable documents with <CFDocument />
Demonstrate a ColdFusion MX 7 SMS mobile application
LitePost Demo
ColdSpring Lexicons
Working with ColdSpring
2006 Adobe Systems Incorporated. All Rights Reserved.
Initializing ColdSpring
Create a fuseaction to initialize ColdSpring
<circuit access="internal" xmlns:cs="coldspring/">
<cs:initialize coldspringfactory="servicefactory“>
<cs:bean beanDefinitionFile="#expandPath(‘coldspring-services.xml')#" />
</cs:initialize>
</circuit>
Add fuseaction call to fusebox.xml.cfm
<globalfuseactions>
<appinit>
<do action="home.initColdSpring" />
</appinit>
</globalfuseactions>
2006 Adobe Systems Incorporated. All Rights Reserved.
Using ColdSpring
Getting a ColdSpring object in circuit.xml
<fuseaction name=“displayAllEntries”
<cs:get bean=“entryService” returnvariable=“REQUEST.entryService” />
<invoke object=“REQUEST.entryService” method=“getEntries”
returnvariable=“REQUEST.entries” />
or
<set name=“REQUEST.entries” value=“#REQUEST.entryService()#” />
</fuseaction>
2006 Adobe Systems Incorporated. All Rights Reserved.
Resources
Official FuseBox Website
http://www.fusebox.org
http://forums.fusebox.org
Official ColdSpring Website
http://www.coldspringframework.org
Sean Corfield (primary contributor to FuseBox 5)
http://www.corfield.org
2006 Adobe Systems Incorporated. All Rights Reserved.
2006 Adobe Systems Incorporated. All Rights Reserved.