The LightWire Config File

The structure of this file may change, but right now it seems to be working well for a 0.01 release :-> Any input always appreciated.

Below is a typical LightWire config file:

<!--- LIGHTWIRE CONFIGURATION FILE config/LightWireConfig.cfm --->
<!--- I set all of the configuration properties for the LightWire Object Factory --->
<!--- I get included into the LightWire init method --->
<cfscript>
   // LIGHTWIRE PARAMETERS    // LazyLoad - Should LightWire use lazy loading or just load all singletons on startup?    // Default = 0 (don't lazy load)    // SYNTAX: variables.LightWire.LazyLoad = [1/0];
   variables.LightWire.LazyLoad = 1;
   // Base Class Path - The base path including mapping to your components directory    // SYNTAX: variables.LightWire.BaseClassPath = "myproject.com";    variables.LightWire.BaseClassPath = "#application.CFMapping#.com";
   
   // LIGHTWIRE CLASS PATHS (Required: needed for every Singleton and Transient class)    // SYNTAX: variables.Class.[Singleton/Transient].[ClassName].Path = "path"    // EXAMPLE: variables.Class.Singleton.PageService.Path = "custom.model.Page";    // EXAMPLE: variables.Class.Transient.UserObject.Path = "custom.model.User";    variables.Class.Singleton.CFTemplate.Path = "lib.generate";
   variables.Class.Singleton.Generator.Path = "lib.generate";
   variables.Class.Singleton.PageService.Path = "custom.model.Page";
   variables.Class.Singleton.PageDAO.Path = "custom.model.Page";
   variables.Class.Singleton.UserService.Path = "custom.model.User";
   variables.Class.Singleton.UserDAO.Path = "custom.model.User";
   
   variables.Class.Transient.PageObject.Path = "custom.model.Page";

   // LIGHTWIRE DEPENDENCIES (only needed if the object has one or more dependencies)    // SYNTAX: variables.Dependencies.[ClassName] = "[comma delimited list of class names it depends on]";    // EXAMPLE: variables.Dependencies.PageService = "PageDAO,UserService";    variables.Dependencies.PageService = "PageDAO,UserService";
   variables.Dependencies.UserService = "UserDAO";
   variables.Dependencies.PageObject = "PageDAO,UserService";
   
   // CLASS SPECIFIC CONFIGURATION PROPERTIES (If you'd like to be able to set them here as opposed to in the class init files)    // All of these properties will be injected into the appropriate objects on instantiation   
   // Page Service    variables.PageService.ObjectName = "Page";
   variables.PageService.ObjectTitle = "Page";

   // Page DAO    variables.PageDAO.TableName = "tbl_Page";
   variables.PageDAO.ViewName = "tbl_Page";

   // Page Object    variables.PageObject.ObjectName = "Page";
   variables.PageObject.ObjectTitle = "Page";

   // User Service    variables.UserService.ObjectName = "User";
   variables.UserService.ObjectTitle = "User";

   // User DAO    variables.UserDAO.TableName = "tbl_User";
   variables.UserDAO.ViewName = "tbl_User";
   
</cfscript>
<!--- END LIGHTWIRE CONFIGURATION FILE config/LightWireConfig.cfm --->

The configuration properties are as follows:

  • Lazy Load - optional - By default LightWire will just load all singletons on being called. If you would like lazy loading, just set variables.LightWire.LazyLoad = 1.
  • Base Class Path - required - Often you want to reuse a config file, but you have to change the base mapping when moving from one project to another. I figured it would be nice to provide an optional “base class path” so if your class path starts with a project specific mapping you would only have to change one line in the config files when creating a new project. Also helps if you have a really long component path. Syntax: variables.LightWire.BaseClassPath = "[YourBaseClasssPath]";
  • Class Paths - required (one per class) - You need to provide the path to each class file that you want to be able to instantiate. This will be concatenated with the base class path before it and the class name after it, so if you have a myproj.com.custom.controller.MyController.cfc with myproj.com as the base path, the class path would just be “custom.controller”. Syntax: variables.Class.[Singleton/Transient].[ClassName].Path = "path"
  • Dependencies - optional (one per class that has dependencies) - This is where you can simply provide a comma delimited list of dependencies for any given class. Note that either singletons or transients can have dependencies, but obviously they can only be dependent on singletons. If you have transients dependent on other transients that would have to be mixed in after creation using application specific logic. Syntax: variables.Dependencies.[ClassName] = "[comma delimited list of class names it depends on]";
  • Class Specific Configuration Properties - optional (one per property to inject into a given class) - This is where you can set any properties you’d like to have injected into a given class. Note that you should NOT include objects to inject in this structure. They should just be listed in the dependencies section above. Syntax: variables.[ClassName].[PropertyName] = [PropertyValue];

Please feel free to play with the code at RIA Forge and let me know if you have any questions. This is my first OSS project, so be gentle :->

Comments
Rolex's Gravatar they are high quality timepieces which is attractive,<A href="://www.newstylerolex.com/" title="Cheap Brand Name

Watches">Rolex</A> -
<A href="://www.newstylerolex.com/" title="Replica Rolex">Replica Rolex</A> -
<A href="://www.newstylerolex.com/" title="Brand Name Watches">Replica Watches</A> -
<A href="://www.sunglassvip.net" title="Welcome to our Replica Watches website">Replica rolex</A> -
<A href="://www.sunglassvip.net" title="high quality timepieces">Rolex</A> -
<A href="://www.2g-3g.com" title="high quality timepieces">Rolex</A>
<A href="://www.watches-life.com" title="cheap price">Rolex</A>
<A href="://www.watches-life.com" title="cheap price">Replica Rolex</A>
<A href="://www.rolex-hot.com" title="cheaper price">Rolex</A>
<A href="://www.rolex-hot.com" title="cheaper price">Replica Rolex</A>
<A href="://www.vertuexclusiveshop.com" title="cheaper vertu">Vertu</A>
<A href="://www.vertuexclusiveshop.com" title="cheaper Replica vertu">Vertu Replica</A>
,good time!
# Posted By Rolex | 7/28/09 2:29 AM
Guojuicycoutureout's Gravatar ://www.outletfactory-coach.net coach factory outlet
://www.outletcoach20l2.net coach outlet online
://www.coachoutlet20l2.com coach outlet
://www.coachs2011.com coach outlet online
://www.juicycoutureoutlet2012.net juicy couture outlet online
://www.outletcoach20l2.net Coach outlet store online
://www.coachoutlet20l2.com Coach outlet online
://www.coachs2011.com coach outlet store online
# Posted By Guojuicycoutureout | 11/27/11 10:21 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.5.006. | Protected by Akismet | Blog with WordPress