Difference between revisions of "Site Configuration (ADF.cfc)"

From ADF Docs
Jump to: navigation, search
(ADF Applications)
Line 56: Line 56:
  
 
=== ADF Applications ===
 
=== ADF Applications ===
To have an ADF application accessible at the site, the ADF application must be loaded into the sites application scope.   
+
To make an ADF application accessible at the site level, the ADF application must be loaded into the site's application scope.   
  
 
This setup is in the ADF Component at the site.  Call the loadApp function through the ADF cfc.  Pass the argument for the ADF application bean name  (this name is defined when creating a new ADF application, [[Create_New_App|Create New ADF App]]).  
 
This setup is in the ADF Component at the site.  Call the loadApp function through the ADF cfc.  Pass the argument for the ADF application bean name  (this name is defined when creating a new ADF application, [[Create_New_App|Create New ADF App]]).  

Revision as of 00:01, 20 December 2009

Overview

Site Configuration provides the capability for the ADF library components to be used within a site. A few updates are needed to enable this functionality.

The ADF library components are loaded into application space for the site. The ADF.cfc is a configuration file that enables a site by site specification for the ADF library components.

Starter Files

Starter Files are located in the '/ADF/core/site-sample' directory. This contains a starter 'custom-application.cfm' and 'ADF.cfc', which contain the basic initialization code for the ADF configuration into a site.

Setup

  1. Locate the '/ADF/core/site-sample' directory.
  2. Copy the ADF.cfc file into the site's '/_cs_apps/' directory.
  3. Open the custom-application.cfm file and copy the code block into your sites custom-application.cfm file.

Custom-Application.cfm

When custom-application.cfm is called, a check is run to setup the ADF in the server and site application space.

 <CFLOCK timeout="30" type="exclusive" name="ADF-RESET">
   <cfscript>
   // Validation for the user is logged in
   if ( request.user.id GT 0 ) { userValidated = true; } else { userValidated = false; }
   // Check if the ADF exists in Server space OR manual reset AND the user is logged in.
   if ( (NOT StructKeyExists(server, "ADF")) OR ((StructKeyExists(url,"resetServerADF")) AND (userValidated)) )
     CreateObject("component","ADF.core.Core").init();
   // Initialize the ADF for the site AND the user is logged in.
   if ( (NOT StructKeyExists(application, "ADF")) OR ((StructKeyExists(url,"resetSiteADF")) AND (userValidated)) )
     CreateObject("component","#request.site.name#._cs_apps.ADF").init();
   // Check if a variable has been defined to dump
   if ( StructKeyExists(url,"ADFDumpVar") AND (userValidated) ) {
     // Verify if the ADF dump var exists
     if ( isDefined(url.ADFDumpVar) )
       CreateObject("component","ADF.lib.utils.Utils_1_0").dodump(evaluate(url.ADFDumpVar), #url.ADFDumpVar#, false);
     else
       WriteOutput("ADFDumpVar Failed : Variable '#url.ADFDumpVar#' does not exist.");
   }
   </cfscript>
 </CFLOCK>

ADF Component (ADF.cfc)

This ADF component file is used to build an ADF object factory into application space for the site. The ADF component contains three distinct operations:

  1. Load the ADF into the site.
  2. Load ADF applications into the site ADF.
  3. Load the ADF library components into the site ADF.

Site Components

This initialized call builds the application.ADF object factory. This function will load any site components in the '_cs_apps/components' directory into 'application.ADF' space. The structure reference name will be the file name of the component.

 /*
  *
  *	Load the Site Environment Configs/Elements and 
  *		Components ('/_cs_apps/components') into the site.
  *
  */
 loadSite();

ADF Applications

To make an ADF application accessible at the site level, the ADF application must be loaded into the site's application scope.

This setup is in the ADF Component at the site. Call the loadApp function through the ADF cfc. Pass the argument for the ADF application bean name (this name is defined when creating a new ADF application, Create New ADF App).

 /*
  *	Load the ADF Application into application space
  *  
  *  SAMPLES: 
  *		loadApp("CustomAppBeanName");
  */
 loadApp("ptProfile");

ADF Library Components

This command will load the latest versions of the ADF library components into the site. This enables the ADF library components accesible through the application.ADF scope throughout the site.

 /*
  *
  *	Define the ADF components to load into the sites application space.
  *
  */
 loadLibrary();

Verify

To verify the site has been configured correctly, you need to reset the ADF on the site to load the ADF into application space.

To do this, reset the site and/or server through the Reset ADF.