forked from Ortus-Solutions/ContentBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Application.cfc
executable file
·97 lines (82 loc) · 3.36 KB
/
Application.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
********************************************************************************
Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
www.coldboxframework.com | www.luismajano.com | www.ortussolutions.com
********************************************************************************
Author : Luis Majano
Description :
This is the Application.cfc for usage withing the ColdBox Framework with some
extra funkyness for ContentBox
*/
component{
// Application properties, modify as you see fit
this.name = "ContentBox-Shell-" & hash(getCurrentTemplatePath());
this.sessionManagement = true;
this.sessionTimeout = createTimeSpan(0,0,30,0);
this.setClientCookies = true;
// Mapping Imports
import coldbox.system.*;
// ColdBox Application Specific, Modify if you need to
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() );
COLDBOX_APP_MAPPING = "";
COLDBOX_CONFIG_FILE = "";
COLDBOX_APP_KEY = "";
// FILL OUT: THE DATASOURCE FOR CONTENTBOX MANDATORY
this.datasource = "contentbox";
// THE LOCATION OF THE 'CONTENTBOX' MODULE MANDATORY
this.mappings["/contentbox"] = COLDBOX_APP_ROOT_PATH & "modules/contentbox";
// THE LOCATION OF COLDBOX
this.mappings["/coldbox"] = expandPath("/coldbox");
// ORM SETTINGS
this.ormEnabled = true;
this.ormSettings = {
// FILL OUT: ADD MORE LOCATIONS AS YOU SEE FIT
cfclocation=["model","modules"],
// FILL OUT: THE DIALECT OF YOUR DATABASE OR LET HIBERNATE FIGURE IT OUT, UP TO YOU
//dialect = "MySQLwithInnoDB",
// FILL OUT: FOR FIRST TIME INSTALLATION LEAVE AS IS, THEN CHANGE TO 'none' OR LEAVE AS IS FOR CONTINUOUS REPO UPDATES
dbcreate = "update",
secondarycacheenabled = true,
// FILL OUT: IF YOU WANT ANOTHER SECONDARY CACHE, PLEASE UPDATE HERE
cacheprovider = "ehCache",
logSQL = true,
flushAtRequestEnd = false,
autoManageSession = false,
eventHandling = true,
eventHandler = "modules.contentbox.model.system.EventHandler"
};
// application start
public boolean function onApplicationStart(){
application.cbBootstrap = new Coldbox(COLDBOX_CONFIG_FILE,COLDBOX_APP_ROOT_PATH,COLDBOX_APP_KEY);
application.cbBootstrap.loadColdbox();
return true;
}
// request start
public boolean function onRequestStart(String targetPage){
// ORM Reload: REMOVE IN PRODUCTION IF NEEDED
if( structKeyExists(url,"ormReload") ){ ormReload(); }
// Bootstrap Reinit
if( not structKeyExists(application,"cbBootstrap") or application.cbBootStrap.isfwReinit() ){
lock name="coldbox.bootstrap_#this.name#" type="exclusive" timeout="5" throwonTimeout=true{
structDelete(application,"cbBootStrap");
application.cbBootstrap = new ColdBox(COLDBOX_CONFIG_FILE,COLDBOX_APP_ROOT_PATH,COLDBOX_APP_KEY,COLDBOX_APP_MAPPING);
}
}
// ColdBox Reload Checks
application.cbBootStrap.reloadChecks();
//Process a ColdBox request only
if( findNoCase('index.cfm',listLast(arguments.targetPage,"/")) ){
application.cbBootStrap.processColdBoxRequest();
}
return true;
}
public void function onSessionStart(){
application.cbBootStrap.onSessionStart();
}
public void function onSessionEnd(struct sessionScope, struct appScope){
arguments.appScope.cbBootStrap.onSessionEnd(argumentCollection=arguments);
}
public boolean function onMissingTemplate(template){
return application.cbBootstrap.onMissingTemplate(argumentCollection=arguments);
}
}