-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathModuleConfig.cfc
119 lines (109 loc) · 3.13 KB
/
ModuleConfig.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/**
* Copyright 2013 Ortus Solutions, Corp
* www.ortussolutions.com
* ---
* Welcome to the world of file abstractions
*/
component {
// Module Properties
this.title = "CB FileSystem";
this.author = "Ortus Solutions, Corp";
this.webURL = "https://github.com/ortus-solutions/cbfs";
this.description = "A powerful file system abstraction module for ColdBox applications";
this.version = "@build.version@[email protected]@";
// CF Mapping
this.cfmapping = "cbfs";
this.modelNamespace = "cbfs";
// Module Dependencies That Must Be Loaded First, use internal names or aliases
this.dependencies = [ "cbstreams", "s3sdk" ];
// Helpers
this.applicationHelper = [ "helpers/Mixins.cfm" ];
/**
* Configure this module
*/
function configure(){
variables.DEFAULTS = {
// The default disk with a reserved name of 'default'
"defaultDisk" : "default",
// Register the disks on the system
"disks" : {
// Your default application storage : non-web accessible
"default" : {
provider : "Local",
properties : {
path : getSystemSetting( "CBFS_DEFAULT_DISK_PATH", "#controller.getAppRootPath()#.cbfs" )
}
},
// A public web-accessible storage located at /includes/public
"public" : {
provider : "Local",
properties : {
path : getSystemSetting(
"CBFS_PUBLIC_DISK_PATH",
"#controller.getAppRootPath()#includes/public"
),
diskUrl : function(){
return variables.controller
.getRequestService()
.getContext()
.getHtmlBaseUrl() & "includes/public"
}
}
},
// A disk that points to the CFML Engine's temp directory
"temp" : {
provider : "Local",
properties : { path : getSystemSetting( "CBFS_TEMP_DISK_PATH", getTempDirectory() ) }
}
}
};
// Setup the defaults
settings = structCopy( variables.DEFAULTS );
// Disk Events
interceptorSettings = {
customInterceptionPoints : [
"cbfsOnDiskStart",
"cbfsOnDiskShutdown",
"cbfsOnFileCreate",
"cbfsOnFileMove",
"cbfsOnFileCopy",
"cbfsOnFileDelete",
"cbfsOnFileInfoRequest",
"cbfsOnFileMove",
"cbfsOnDirectoryMove",
"cbfsOnDirectoryCreate",
"cbfsOnDirectoryCopy",
"cbfsOnDirectoryDelete"
]
};
// Register custom DSL
wirebox.registerDSL( "cbfs", "#moduleMapping#.dsl.cbfsDSL" );
}
/**
* Fired when the module is registered and activated.
*/
function onLoad(){
// Incorporate default disks
settings.disks.append( variables.DEFAULTS.disks );
// Register all app disks
wirebox.getInstance( "DiskService@cbfs" ).registerAppDisks();
}
/**
* Listen when modules are activated to load module disks
*/
function afterAspectsLoad( event, interceptData, rc, prc, buffer ){
// Register all module disks
wirebox.getInstance( "DiskService@cbfs" ).registerModuleDisks();
}
/**
* Listen when ColdBox Shutds down
*/
function onColdBoxShutdown( event, interceptData, rc, prc, buffer ){
wirebox.getInstance( "DiskService@cbfs" ).shutdown();
}
/**
* Fired when the module is unregistered and unloaded
*/
function onUnload(){
}
}