Hello all, I am new to the group and I am a recovering spaghetti coder. ;-)
I am looking at how to take advantage of the ColdSpring Framework within Mach-ii. But first, I am trying to get a better understand of ColdSpring. I wonder if it would help if I had a class diagram of the ColdSpring framework or of one of the Sample Application. >From what I can determine this far, the mach-ii framework loads the ColdspringPlugin.cfc when mach-ii is initialized. The ColdspringPlugin.cfc initializes the Coldspring framework with the following steps: 1. create bean factory with coldspring.beans.DefaultXmlBeanFactory 2. other stuff I not sure of… 3. set bean factory as a property in mach-ii property manager which can be referenced by listeners, filters, and other plugins. The only purpose of the ColdspringPlugin.cfc is to initialize the ColdSpring framework and the plugin is not use afterwards. Typically a mach-ii plugin is called during the processing of an event with methods like postEvent, postProcess, postView, prevent, preprocess, preview, etc. But these methods are not defined by the ColdspringPlugin.cfc and not used. When an application object is need (like categoryService in the example application) within a listener, filter, or plugin, a reference to the bean factory is obtained by using the getProperty() method of the mach-ii framework component (like listener, filter, plugin). Then the bean factory's getBean() method is called to obtain a reference to an application component. If an instance of the application component does not exist, then one is created. Otherwise, a reference to an existing instance is provided. Once an instance is created in the listener or other mach-ii framework component, the ColdSpring framework is no longer referenced and is out of the picture during the rest of the applications existence. How am I doing so far? Here are the benefits I am beginning to realize with the ColdSpring framework. 1. I can create on instance of an application component and use that instance through out the application. So far, this is the only benefit I can see. On Another note. I noticed that the Coldspring examples create a mach-ii Listener Object which contains a Service Object. The Service Object contains a DataAccessObject and GatewayObject. What is the benefit of creating the extra Service Object layer? Why would you not create the DataAccessObject and GatewayObject within the mach-ii Listener Object? I sincerely appreciate any comments. I am just a young grasshopper among great masters of the art. ;-) Troy
