Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Model-Glue Rachel Lehman Perpetual Intermediate Designer-Developer Introduction to Model-Glue.

Similar presentations


Presentation on theme: "Introduction to Model-Glue Rachel Lehman Perpetual Intermediate Designer-Developer Introduction to Model-Glue."— Presentation transcript:

1 Introduction to Model-Glue Rachel Lehman raelehman@gmail.com http://rmaxim.blogspot.com Perpetual Intermediate Designer-Developer Introduction to Model-Glue | Rachel Lehman1

2 Model-Glue:ColdFusion An MVC Framework for ColdFusion Open Source Also does scaffolding Works well with other frameworks (and uses them) Simple enough for beginners Powerful enough for enterprise development Introduction to Model-Glue | Rachel Lehman2

3 Agenda What a Model-Glue application looks like What the framework does Installation & configuration Hello World example Master-Detail example A few handy tips Upcoming in Model-Glue 3 Q & A Introduction to Model-Glue | Rachel Lehman3

4 Basic Model-Glue Application Architecture  Model (CFC business objects & data access)  CFCs for business objects (Beans)  CFCs for data access (DAOs & Gateways)  CFCs for service abstraction (Service layer)  View (CFM display code)  CFM pages for view templates (dspIndex.cfm, dspTemplate.cfm, dspMyPage.cfm)  Common includes (headers, footers, UDF’s, etc)  Where the HTML goes  Controller (CFC business logic)  CFCs to connect your views to your model  Configuration (XML defining your application)  ColdSpring.xml defines ModelGlue application settings  ModelGlue.xml defines the pages (events) in your application  ORM Configuration: Reactor and Transfer (required for scaffolding)  Application.cfm (soon to be Application.cfc, defines app name)  Index.cfm (front controller, imports framework, all requests go through here) Introduction to Model-Glue | Rachel Lehman4

5 Model-Glue Event Flow Introduction to Model-Glue | Rachel Lehman5

6 Installation Download MG from http://www.model-glue.comhttp://www.model-glue.com Download ColdSpring from http://www.coldspringframework.org http://www.coldspringframework.org Download Reactor from http://www.alagad.com; or Transfer from http://www.transfer-orm.comhttp://www.alagad.comhttp://www.transfer-orm.com Unzip files and copy the framework files to your web root, or what ColdFusion sees as /modelglue, /coldspring, /reactor (with mappings if necessary) Copy the modelglueapplicationtemplate directory to where you wish to deploy your application Introduction to Model-Glue | Rachel Lehman6

7 Configuration Open the build.xml file – ANT build file Edit the project name, application name, and application directory Run the file as an ANT build (either through Eclipse, or the command line with ANT) Introduction to Model-Glue | Rachel Lehman7

8 No Ant? Don’t be intimidated, it’s super simple and comes with Eclipse (you have it if you’re using CFEclipse) You can also follow these steps for a manual install: – Create a new directory called "myappname" under your Web root. – Copy the contents of the /modelglueapplicationtemplate directory to the /myappname directory. – Open /myappname/config/ColdSpring.xml – Do a find and replace, changing "modelglueapplicationtemplate" to "myappname" – Open /myappname/config/ModelGlue.xml – Do a find and replace, changing "modelglueapplicationtemplate" to "myappname" – Open /myappname/Application.cfm – Do a find and replace, changing "modelglueapplicationtemplate" to "myappname" Introduction to Model-Glue | Rachel Lehman8

9 Here Goes Nothin! Browse to the home page of your application, and you should see… Introduction to Model-Glue | Rachel Lehman9

10 What You Should Know About Configuration (ColdSpring.xml) Reload (true for development, false for production) & reload password (defaults to true) Rescaffold (true for development when using scaffolding, false otherwise and for production) Debug (true for development, false for production) Preferences, Names for common terms (default event/page, event name, reload key, etc) Mappings to files (views, scaffolds, config, etc) Introduction to Model-Glue | Rachel Lehman10

11 DEMO: HELLO WORLD Adding and running a new event Introduction to Model-Glue | Rachel Lehman11

12 A Few Tips Force application reload with init=true Get the current page and event name (base URL) with viewState.getValue(‘myself’) Forward events within the Controller (like but within the framework) with event.forward() for redirection It’s event within the Controller, and viewState within the views* Centralize application settings with GenericConfig beans Create multiple view templates for different layouts or types of delivery (home, subpage, popup, rss, etc) Add an unnamed result to the xml and it will execute at the end of the request for easy site-wide templates Lock down your config files (store outside the web root and use a mapping, or apply directory security) and if possible, the framework itself. Introduction to Model-Glue | Rachel Lehman12

13 DEMO: MASTER/DETAIL APPLICATION (CF ART GALLERY) An application put into practice with Model-Glue Introduction to Model-Glue | Rachel Lehman13

14 From Here… You can organize and divide your application with multiple – Controllers – ModelGlue.xml config files – ColdSpring.xml config files ActionPacks are pluggable Model-Glue applications Check out Generic Database Messages and Scaffolds features for quick admin interfaces Introduction to Model-Glue | Rachel Lehman14

15 Now in Alpha Model-Glue: Gesture Feature Preview Event generation – type the name of an event that doesn’t exist, and your stub XML, controller methods, views and even a unit test case will be generated for you Custom-typed events allow you to bundle repetitive event functionality (templates) into the event, rather than defining it with each event handler in your xml Application.cfc support (CFMX6 has been EOL’d) All event values are now stored in the Event object, no need to use viewState Easy ways to manage search engine safe URLs Helpers – for an easier way to include UDFs Dead-simple caching (in event xml – cache=true) – extendable for you to implement on your own Estimated release is Mid 2008 Introduction to Model-Glue | Rachel Lehman15

16 Resources and Further Reading ModelGlue mailing list (Google Groups ID- model-glue) Documentation: http://docs.model-glue.com/http://docs.model-glue.com/ Joe Rinehart’s Blog: the author of Model-Glue http://www.firemoss.com/blog http://www.firemoss.com/blog Ray Camden’s Blog: intro series, answers to many FAQ’s: http://www.coldfusionjedi.com/index.cfm/ModelGlue http://www.coldfusionjedi.com/index.cfm/ModelGlue Other Blogs that cover Model-Glue: – Todd Sharp - http://cfsilence.com/blog/client/http://cfsilence.com/blog/client/ – Doug Boude - http://www.dougboude.com/blog/http://www.dougboude.com/blog/ – Dan Wilson - http://www.nodans.com/http://www.nodans.com/ Model-Glue Cookbook: http://modelgluecookbook.com/http://modelgluecookbook.com/ Demo applications written with Model-Glue: – Canvas wiki: http://canvas.riaforge.org/http://canvas.riaforge.org/ – Litepost blog: http://code.google.com/p/litepost/http://code.google.com/p/litepost/ – Sample apps with MG install Apache ANT for deployment - http://ant.apache.org/http://ant.apache.org/ I’ll post my code examples on my own blog at http://rmaxim.blogspot.comhttp://rmaxim.blogspot.com Introduction to Model-Glue | Rachel Lehman16

17 Q & A Thank you! Introduction to Model-Glue | Rachel Lehman17


Download ppt "Introduction to Model-Glue Rachel Lehman Perpetual Intermediate Designer-Developer Introduction to Model-Glue."

Similar presentations


Ads by Google