Entries Tagged as model-glue
August 10, 2007 ·
I have been developing a number of Model Glue applications over the last year and a half. Its a great framework and it has actually saved my neck on a project with incredible tight deadlines. I thought I would share some of the tips I have learned along the way by doing a series of posts with tips over the next couple of weeks.
In the first part of the series I shall be looking at:
Separate out your Model-Glue file
In any moderately sized project, you will start to gather a large number of controllers and event handlers, not to mention the messages you are passing back to the controllers. This will lead you to have a very large ModelGlue.xml file which becomes unwieldy and difficult to find things without the help of outline tools such as the CF Frameworks Explorer in Eclipse.
For this reason, I like splitting my my ModelGlue.xml file out into a number of files, this can be done easily thanks to the top level include tag (which is a child of the modelglue tag).
To use this, you simply have to create another ModelGlue file, and you simply point to it by doing the following:
<modelglue>
< include template="config/ModelGlue_Pages.xml">
< include template="config/ModelGlue_Security.xml">
< include template="config/ModelGlue_Products.xml">
<controllers>
...
</controllers>
<event-handlers>
...
</event-handlers>
</modelglue>
The included files are simply other ModelGlue.xml files, with their own controllers an event handlers dealing with that so you have split out your application into relevant files. This also means that different developers can work on different parts of the application, simply by removing the include in your own version.
By the way, you can do a very similar think with ColdSpring (but more on that later)
Tags:
model-glue
July 23, 2007 ·
Do you need someone to present at your CFUG? Well, I have been doing a lot of presentations lately, which can be seen over in my
Presentations page, which means I have a lot of content I can present on. If you have a specific topic (including
CFEclipse of course!) Why not
email me with your proposal and I shall see what I can do.
I am based in London, England so unless there is a nice budget to fly me out, I can also do remote presentations using Adobe Connect. I am available in the evenings mostly so let me know if you ever need an extra presenter at your CFUG or company.
Tags:
ajax · cfeclipse · coldfusion · coldspring · frameworks · model-glue · presentations · ukcfug
May 23, 2007 ·
Yep, I am looking for a talented ColdFusion developer to come and work for/with me at
Design UK's offices in the centre of
London.
If you want more information about the role, head over to the
Design UK Careers section of the website and apply via there.
You don't have to use CFEclipse, just be damn good... are you that good? Apply now!
(the obvious bits...)
- You need a valid EU working permit
- This is an on-site role, sorry
- No agencies, how many times??? NO AGENCIES!
- Experience in frameworks is a must
UPDATE: this role has now been filled! Woohoo!
Tags:
coldfusion · coldspring · frameworks · jobs · model-glue · personal · reactor
January 08, 2007 ·
Continuing from my
previous post, you might also want to add some application variables that you can access in your views easily.
To start with, ModelGlue comes with a generic bean that you can use to setup some values without having to create your own beans. You set this in the Coldspring.xml file and in this example, I am going to add some site wide information, such as a copyright value that will go in the footer.
<bean id="copyrightConfig" class="ModelGlue.Bean.CommonBeans.SimpleConfig">
<property name="config">
<map>
<entry key="year">
<value>2007</value>
</entry>
<entry key="company">
<value>Mark Drew Inc. PLC. SA. PTY. Ltd.</value>
</entry>
<entry key="link">
<value>http://www.markdrew.co.uk</value>
</entry>
</map>
</property>
</bean>
What we have done here is set up an object called
copyrightConfig with some values in it. The <map> item is actually setting up a structure.
Now that we have a bean with our application wide configuration settings, we would like to put them available to all the views via the ViewState object. To do this, in the default controller we add code to the
onRequestStart function to load our bean and put it in the ViewState:
<cfset stConfig = getModelGlue().getBean("copyrightConfig").getConfig() />
<cfloop collection="#stConfig#" item="conf">
<cfset arguments.event.setValue("copyright_" & conf, stConfig[conf])>
</cfloop>
The first line gets the copyrightConfig bean's config structure (remember those values we added to the <map>?), then we loop through the keys in the structure (adding "copyright_" to the start, just so we know what they are) adding them to the event object. Later on in the view, we have available in the viewState the values as follows:
<div id="footer">
Copyright &copyright; #ViewState.getValue("copyright_year")# <a href="#ViewState.getValue("copyright_link")# ">#ViewState.getValue("copyright_company")# </a>
</div>
If you don't like adding the "copyright_" to each of the values you could add the configuration structure to the the copyright key:
<cfset arguments.event.setValue("copyright", getModelGlue().getBean("copyrightConfig").getConfig())>
And then access the items as follows:
<cfset stCopyright = ViewState.getValue("copyright")>
<div id="footer">
Copyright &copyright; #stCopyright.year# <a href="#stCopyright.link# ">#stCopyright.company# </a>
</div>
the only thing is that by accessing the values like this, you are taking away the in-built help that the ViewState.getValue() function gives you that if the value doesn't exist, it doesn't barf.
Tags:
coldfusion · model-glue
January 08, 2007 ·
When using Joe Rinehart's Model-Glue framework, I noticed a few people that come from using fusebox based apps were a bit confused at how you would set either application wide variables, or fuse-action (i.e. event) specific variables (such as xfa's). In the definition of MG itself there isn't something blatantly obvious, so how would you set, for example, the section variable that each of the event-handlers belongs to (for the title for example)?
In the controller, I created a function called
setValue, this function loops through any arguments you pass to them creating event values for them:
<cffunction name="setValue" access="public" returnType="void" output="false">
<cfargument name="event" type="any">
<cfset stArguments = arguments.event.getAllArguments()>
<cfloop collection="#stArguments#" item="arg">
<cfset arguments.event.setValue(arg, stArguments[arg])>
</cfloop>
</cffunction>
I can then set an event constant in the event-handler, by broadcasting the following message:
<broadcasts>
<message name="setValue">
<argument name="xfa.section" value="testimonials" />
</message>
</broadcasts>
This means that in my view code I can get the section variable as follows:
<h1>#ViewState.getValue("xfa.section")#</h1>
In my next post, I shall set some application wide variables, and show you how to access them in a similar manner.
EDIT:
Andy Jarett has just pointed out something (which should have been as plain as the nose in my face) that instead of having to do the above, you can simply do the following for each include:
<views>
&lt;include name="body" template="dsp_body.cfm"&gt;
<value name="xfa.section" value="testimonials" />
</include>
</views>
Which is obviously the easier way of doing it (if you bother to read the documentation, which I didn't).
Tags:
coldfusion · model-glue
August 10, 2006 ·
I have been thinking on how to implement "generic" framework support in CFEclipse. I apologise if this post seems a bit rambling but its to get some opinions from people out there and to formalise my thinking a little before I go off and develop something.
So, What do I mean by generic framework support? Well, making plugins for each framework is kind of hard. Yes, they all have their own way of doing things but way back when I was doing the Fusebox Plugin, I realised the problems, and also saw how much overlap of code there is. To overcome making plugins for each framework, I am thinking that we need to abstract a little what each framework does (with relation to coding and implementing it), the actions and the UI that each would need. Since each of the frameworks is likely to change in time, and maybe new ones come up, we need a way in CFEclipse to be able to modify (like the dictionary files) and add new framework definitions.
I am breaking down the issues for implementing framework support and hopefully shake out a way of developing it as follows:
Configuration
Most frameworks (I am looking at Model-Glue, Fusebox and Mach II) are configured using an XML file, which has a number of nodes that say the flow of actions in your application, the files to include and the settings of your application. Fusebox also has a number of iterators and logic nodes in the XML. I know there are other frameworks out there, which are configured differently, but these are the main ones I am looking at the moment since I have some knowledge of them and they can be generalised. (I should also include Reactor and Coldspring in this)
We need a way to say that, for example, "ModelGlue.xml" is a config file and we should open it and treat it differently or that Fusebox.cfm is also a framework file that we want to edit differently.
When I was implementing the Fusebox plugin, I run into the problem that I had to create an object (a class) for each node type, now this isnt a problem if the lexicon of a framework is small, but for Fusebox the lexicon is rather large and in fact (correct me if I am wrong) I think you can add your own nodes. This would make it a nightmare of classes that are specific to a framework. Ok, so lets create a generic node that can have a name, a parent and a number of children. Then we name that node, and assign an image to it.
Another part of a framework seems to be the base files required when you are creating an application. These files need to be dropped into your application, such as config files, index.cfm etc. I am not talking about the Core Framework Files that you would create a ColdFusion Mapping to, but the ones you will be working, such as the sample application templates for each framework.
To address this and also kill another bird with the same sharpened stone, I have an idea of extending the "New File From Template" to creating a "New Project From Template" which would you, as a user would set up by setting a project that you keep all your project templates in and in each folder you can put a set of files that make up a baseline application,e,g a folder called "Normal CF Project" with Application.cfm and index.cfm or a folder called "CFC Project" with Application.cfc and index.cfm or a folder with the Model Glue application template. This would mean that when you are creating a project you can select from which of these folders you would copy the files into your new project.
This is fine so far but lacks another part, all the replacements you have to do (for example the name of the application). I though this might be solved by using the snippet syntax in those files e.g
<cfapplication name="${{applicationname}">
So a brute force attack would be to parse ALL of the files under that folder looking for snippet texts. Mike Nimer actually suggested something, which would be to copy the files using ANT. This is a very intelligent choice as I can use a generic ANT build file (I am talking in the background, Eclipse running it as part of its project creation script) that I can pass a list of replacements. At the root of each project we would have a xml file that CFEclipse can read, for you to put all the values to replace, then in each of the files you would have variables that are replaced.
Views (or UI)
What views would you need for your framework?
I am thinking currently that we only need two views, one being the Framework File Editor, basically an XML editor that (in the background) knows what DTD to use for that particular framework file and what insight to provide, and a outline view of all the nodes in that file.
Well, XML buddy already has a outline view of your xml. If we are re-creating an XML editor for the config files and we have outline view, maybe we could configure it to be filtered (show events for MG, fuse-actions for Fusebox etc) by a particular node. Each node type would then need to have its own action (when you double click etc) and ways to add new nodes (where applicable).
Actions
Now we can edit our framework files, we need to add actions, I would say that to start out with we have some simple "open" actions assigned to some nodes, so some examples:
* For ModelGlue.xml - On node "include", use template, to open file by path
* For ModelGlue.xml - On node "include", use template, to open file by path, using "ColdSpring/beans/bean:id=modelGlueConfiguration/property:name=viewMappings" value as the root
*For ModelGlue.xml - On node "modelglue/controllers/controller:type" open file by package
*For ModelGlue.xml - On node "modelglue/event-handlers/event-handler/broadcast/message:name" open file referenced in "modelglue/controllers/controller/message-listener".parent.type where message:name = message-listener:message
These are just examples to get my head round how the actions would need to be worked out. But basically the actions here are open by path or open by package.
Other actions would run in the background and they are custom validation, not just XML validation but for example
* validate that all "modelglue/event-handlers/event-handler/broadcast/message:name" have a corresponding "modelglue/controllers/controller/message-listener:message"
* validate that for "modelglue/controllers/controller/message-listener:function" there is a corresponding cffunction in the "open file by package" for "modelglue/controllers/controller/message-listener"_parent.type
As you can see we are starting to get a syntax here of the type of language that we need to define for each framework.
So to add framework support this would be done by creating a file for each framework file that we shall handle, it would define where to look for a DTD, define actions per named node, define validations and define nodes that will be displayed in the outline
I don't have much experience in this area so I appreciate any comments on my logic so far.
Tags:
cfeclipse · coldfusion · fusebox · model-glue
August 04, 2006 ·
Rob Rohan put a post a couple of days ago that I forgot to mention. He has been "porting"
blogCFC to
ModelGlue:Unity which is an awesome thing as you could then add a blog to your main MG site as an Action Pack!
The more interesting part is that he has been
integrating the Atom Protocol into blogCFC so you can use external clients to manage your posts. Clever guy that Rob!
You can read more about this over at his
blog
Tags:
coldfusion · model-glue
August 04, 2006 ·
Continuing from yesterday's post, here are some of my comments with regards to some of the features that have been requested if a magic wand could be waved and all your feaures be implement.
So moving right ahead....
Fixes to colour highlighting (especially on dark backgrounds)
Refactoring Support
Hyperlinking to CFC's and CFC functions
This is the "Golden Grail" isnt it? Being able to know what type of object you are writing even before CF itself knows it (since its not a strongly typed language)
Awareness of external CFC's (without definition in code)
This is a tough one. CFEclipse would have to have access to the code. We don't parse CFML to that level, there are ways round it and if people post the code that they are trying to figure out there ARE ways that we can handle this (like creating a linked directory to the external CFC's)
Double click selects a whole tag
I presume this is a bug, its a user's preference and something they are used to. I know there is code there that was written to select *something* so its a matter of changing this behavior if people are interested (on the whole not the individual)
Expression Builder
Even for the 6 years or so that I was doing ColdFusion in CFStudio I never figured this thing out as useful. I personally still don't. Good syntax highlighting and awareness of how functions and CFC's work get round this. There will be improvements to the dictionary view and some new views to help you with functions and tags. Someone show me how my life is better with some sort of Expression Builder and I might think about it. Again, I am not porting CFStudio/HomeSite. I wont.
Customisable toolbars
I have added HomeSite-like toolbars, and after talking to Dean Harmon over at CFunited these might change and become a view on themselves. Eventually I am going to make it easier for you to add your own toolbars, without having to edit the toolbar.xml directly. This is a feature I kind of like and it will be more integrated into snippets as they are a very powerful feature.
Comparison of remote files
Yep. This is going to happen, I mentioned I need to integrate FTP/sFTP/RDS into what is called a Team based plugin, so that you can do compare/replate synchronise etc. There is a lot to work out as I mentioned but I think, now with Eclipse 3.2, it will be coming. When? That depends on prioritisation of features.
"How to move to CFEclipse from HomeSite video"
OK, sure. Anyone switched over recently? Robert Blackburn has been writing a series of articles on CFEclipse over at Fusion Authority and I have been doing a number of presentations on this. Rob Rohan did a number of videos before, and now I have a copy of contribute to play with. I promise I shall do some videos but its just finding the time. If anyone asks how they can contribute, this would be a good way! There will be a new CFEclipse.org site coming soon and it will have all these resources in a central location. Time, as you all know, is all I need.
Customisable hotkeys for snippets
NO. Hmm, thats a bit harsh, but let me put it another way... no. Eclipse has a different way of doing keyboard shortcuts and I have a "cunning plan thats more cunning than a fox with a degree in Cunning from Cunning-ham University". This will be that you will hit the snippet hotkey (Ctrl/Apple + J) and you will see all the snippets you have assigned trigger text... you can then type it and press return... I think this will be more expandable than the way CFStudio/HomeSite does it.
Integrated Help
Which help? Coldfusion 5/6/7 or 8, Blue Dragon 6/7? Railo? I understand you and I want help, but this clashes a bit with a very useful feature of being able to have multiple dictionaries. Also Help is very "heavy" i.e. it takes up a lot of space. So, I would ask the providers of the various CFML runtimes to provide help plugins, discuss with me and we shall find a way of calling the right help for your version of ColdFusion you have defined for your project. Deal?
Split Screen
You can do this, you create a new editor (right click on the editor's tab and move it where you want it. It would be a new version of the editor that will ask you to update when you save, but it does the trick. This is an "edge" case in my opinion (hey... I can have one you know?) and you wont need it all the time.
Customisable Code Colouring
You can customise this, go to Window-Preferences-CFEclipse and check out the sub tabs, there is code colouring for CF, HTML and SQL tags (this is from memory so just go and check it out)
Stability improvements
Any bugs, please put them on the bug tracker over at http://cfeclipse.tigris.org, just register and add a bug. I will get round to it and if you think you can help make it more stable, please, just hit me up, I can show you where the code is and the way to work it out.
Frameworks Intelligence
I already wrote a plugin for Fusebox a while back, I am not using Fusebox anymore so I don't have a pressing need nor ideas on how it could help me doing it. I am definitely going to be working on a ModelGlue one and have some great ideas for it, once I get a way of implementing them (hint: Round Trip modeling anyone?).
Better file explorer (by name, by date, by type)
Yep, good idea. I don't use this view much apart from using it to edit something remotely. But I can definitely see what people mean. Another feature to implement.
I shall be working through the next items tomorrow, I got the initial list of requirements from Damon Cooper's blog when there were about 60 commnents, there must be about 100 or so now, so I shall have to have another read!
Tags:
cfeclipse · coldfusion · model-glue
July 26, 2006 ·
I am not sure if people out there are reading Peter Bell's
Application Generation blog, but if you are not, and you are doing ColdFusion OO programming this is a MUST. He is working through how to build frameworks, in other words generic code that is required for a number of applications. This isnt a "how do I connect to a database" type of thing, instead he has been going through how to create
page controllers,
iterating objects and
Generic getters and setters (e.g. ModelGlue's getValue()) amongs other things. This is a great blog and one to keep your eye on.
Tags:
blogging · coldfusion · model-glue
July 18, 2006 ·
I just thought I would post this as some people asked me about OO frameworks and their performance speed. I have been developing a little model glue content management system for a certain CF IDE site who shall remain nameless and during the course of development I was thinking to my self "boy, this is slow, I know I am in development mode, but hell its not a hot rod". So I started having doubts about the performace and was getting worried. I thought I would remove the ModelGlue debugging and that made some difference, I turned off ColdFusion debugging and that made a bigger difference. I changed the reactor config from
<property name="mode"><value>development</value></property>
to
<property name="mode"><value>production</value></property>
And it was still not exactly screaming along. Then I realised I had forgotten (hey, its REALLY hot and humid here in London today, brain is fried) the
<property name="reload"><value>true</value></property>
property in the model glue config! I know, I know... easy mistake to do, but when I turned it to "false", guess what? Bovine excrement zooming off a shovel.
Just remember this when you are going into production kids, or if you are starting to do some comparisons with other frameworks... otherwise it just aint fair calling frameworks slow.
Tags:
coldfusion · model-glue