Difference between revisions of "App Bean Config"

From ADF Docs
Jump to: navigation, search
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
The App Bean Config is the ADF application configuration file for the LightWire object factory. This file establishes the bean configuration with application-specific components and ADF library components.
+
Each [[ADF Application]] must contain an App Bean Config (appBeanConfig.cfm) in the root of the Applications folder (e.g. /ADF/apps/myApp/appBeanConfig.cfm).
  
The App Bean Config must have the file name '''AppBeanConfig.cfm''' and be located at the root of the ADF application directory.
+
The App Bean Config is the ADF Application's configuration file for the LightWire object factory. This file establishes the bean (components) that you want to use within your application.  The App Bean Config will contain application-specific components in addition to ADF library components.
  
 
== Architecture ==
 
== Architecture ==
Line 36: Line 36:
 
</source>
 
</source>
  
== App Component (App.cfc) ==
+
== Example ==
All ADF applications must contain the App component (App.cfc).
+
Lets say you are building a new Twitter application your application may contain the following code:
 
+
* /ADF
This file is a simple component used as the base object for the ADF application where all dependencies will be injected. This component extends the [[ADF_Core_App_Base|AppBase]] in the ADF [[Core]].
+
** /apps - contains all installed [[ADF Application]](s)
 +
*** /twitty - your applications directory
 +
**** /components - contains all of the components for your application
 +
***** App.cfc - core CFC for your application
 +
***** twittyService.cfc - service based CFC component
 +
***** twittyDAO.cfc - data access object
 +
**** appBeanConfig.cfc - configuration of your applications components

Revision as of 01:12, 30 March 2010

Overview

Each ADF Application must contain an App Bean Config (appBeanConfig.cfm) in the root of the Applications folder (e.g. /ADF/apps/myApp/appBeanConfig.cfm).

The App Bean Config is the ADF Application's configuration file for the LightWire object factory. This file establishes the bean (components) that you want to use within your application. The App Bean Config will contain application-specific components in addition to ADF library components.

Architecture

The App Bean Config is separated into three sections:

Initialization

  • Set up variables to be used in this configuration file.
  • Load the ADF application App component. This establishes the bean for the application by creating the singleton object where the dependencies will be injected.
// App specific variables
appBeanName = "STARTER_APP";
// Get the com path for the current custom application
appComPath = getComPathForCustomAppDir(GetCurrentTemplatePath());
// Load the APP Base
addSingleton("#appComPath#App", appBeanName);

Inject Components

  • Inject the ADF application components in the applications bean object. Create singletons, transients, and dependencies for the specific components.
 
// Load the STARTER APP service component
addSingleton("#appComPath#myComponent", "myComponent");
addConstructorDependency(myComponent, "myComponent");
addTransient("#appComPath#myOtherComponent", "myOtherComponent");

Inject ADF Library

  • Inject the ADF library components into the applications bean object.
// Dependecies from ADF Lib
addConstructorDependency(appBeanName, "cedata_1_0", "cedata");
addConstructorDependency(appBeanName, "scripts_1_0", "scripts");

Example

Lets say you are building a new Twitter application your application may contain the following code:

  • /ADF
    • /apps - contains all installed ADF Application(s)
      • /twitty - your applications directory
        • /components - contains all of the components for your application
          • App.cfc - core CFC for your application
          • twittyService.cfc - service based CFC component
          • twittyDAO.cfc - data access object
        • appBeanConfig.cfc - configuration of your applications components