@@ -11,65 +11,39 @@ component {
11
11
this .author = " Ortus Solutions" ;
12
12
this .webURL = " http://www.ortussolutions.com" ;
13
13
this .description = " A JavaLoader Module for ColdBox" ;
14
- this .version = " 1.0.0. @build.version@" ;
14
+ this .version = " 1.0.0+ @build.version@" ;
15
15
// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
16
16
this .viewParentLookup = true ;
17
17
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
18
18
this .layoutParentLookup = true ;
19
19
// Module Entry Point
20
- this .entryPoint = " javaloader" ;
21
-
20
+ this .entryPoint = " cbjavaloader" ;
21
+ // CF Mapping
22
+ this .cfmapping = " cbjavaloader" ;
23
+
22
24
function configure (){
23
-
24
- // Java Loader Settings
25
- settings = {
26
- // The array paths to load
27
- loadPaths = getJars ( getDirectoryFromPath ( getCurrentTemplatePath () ) & " lib" ),
28
- // Load ColdFusion classes with loader
29
- loadColdFusionClassPath = false ,
30
- // Attach a custom class loader as a parent
31
- parentClassLoader = " " ,
32
- // Directories that contain Java source code that are to be dynamically compiled
33
- sourceDirectories = [],
34
- // the directory to build the .jar file for dynamic compilation in, defaults to ./tmp
35
- compileDirectory = getDirectoryFromPath ( getCurrentTemplatePath () ) & " model/javaloader/tmp" ,
36
- // Whether or not the source is trusted, i.e. it is going to change? Defaults to false, so changes will be recompiled and loaded
37
- trustedSource = false
38
- };
39
-
40
- // Custom Declared Points
41
- interceptorSettings = {
42
- customInterceptionPoints = " "
43
- };
44
-
45
- // Custom Declared Interceptors
46
- interceptors = [
47
- ];
48
-
49
25
// Register Custom DSL, don't map it because it is too late, mapping DSLs are only good by the parent app
50
26
controller .getWireBox ().registerDSL ( namespace = " javaloader" , path = " #moduleMapping #.models.JavaLoaderDSL" );
51
-
52
- // Bind Loader Proxy Class
53
- binder .map ( " loader@javaloader" )
54
- .to ( " #moduleMapping #.models.Loader" );
55
-
56
- // Bind Core JavaLoader
57
- binder .map ( " jl@javaloader" )
58
- .to ( " #moduleMapping #.models.javaloader.JavaLoader" )
59
- .initArg ( name = " loadPaths" , value = settings .loadPaths )
60
- .initArg ( name = " loadColdFusionClassPath" , value = settings .loadColdFusionClassPath )
61
- .initArg ( name = " parentClassLoader" , value = settings .parentClassLoader )
62
- .initArg ( name = " sourceDirectories" , value = settings .sourceDirectories )
63
- .initArg ( name = " compileDirectory" , value = settings .compileDirectory )
64
- .initArg ( name = " trustedSource" , value = settings .trustedSource );
65
27
}
66
28
67
29
/**
68
30
* Fired when the module is registered and activated.
69
31
*/
70
32
function onLoad (){
33
+ var settings = controller .getConfigSettings ();
34
+ // parse parent settings
35
+ parseParentSettings ();
36
+ // Bind Core JavaLoader
37
+ binder .map ( " jl@cbjavaloader" )
38
+ .to ( " #moduleMapping #.models.javaloader.JavaLoader" )
39
+ .initArg ( name = " loadPaths" , value = settings .javaloader .loadPaths )
40
+ .initArg ( name = " loadColdFusionClassPath" , value = settings .javaloader .loadColdFusionClassPath )
41
+ .initArg ( name = " parentClassLoader" , value = settings .javaloader .parentClassLoader )
42
+ .initArg ( name = " sourceDirectories" , value = settings .javaloader .sourceDirectories )
43
+ .initArg ( name = " compileDirectory" , value = settings .javaloader .compileDirectory )
44
+ .initArg ( name = " trustedSource" , value = settings .javaloader .trustedSource );
71
45
// Load JavaLoader and class loading
72
- wirebox .getInstance ( " loader@javaloader " ).setup ();
46
+ wirebox .getInstance ( " loader@cbjavaloader " ).setup ();
73
47
}
74
48
75
49
/**
@@ -90,4 +64,32 @@ component {
90
64
return directoryList ( arguments .dirPath , true , " array" , arguments .filter , " name desc" );
91
65
}
92
66
67
+ /**
68
+ * parse parent settings
69
+ */
70
+ private function parseParentSettings (){
71
+ var oConfig = controller .getSetting ( " ColdBoxConfig" );
72
+ var configStruct = controller .getConfigSettings ();
73
+ var javaLoaderDSL = oConfig .getPropertyMixin ( " javaloader" , " variables" , structnew () );
74
+
75
+ // defaults
76
+ configStruct .javaloader = {
77
+ // The array paths to load
78
+ loadPaths = getJars ( getDirectoryFromPath ( getCurrentTemplatePath () ) & " lib" ),
79
+ // Load ColdFusion classes with loader
80
+ loadColdFusionClassPath = false ,
81
+ // Attach a custom class loader as a parent
82
+ parentClassLoader = " " ,
83
+ // Directories that contain Java source code that are to be dynamically compiled
84
+ sourceDirectories = [],
85
+ // the directory to build the .jar file for dynamic compilation in, defaults to ./tmp
86
+ compileDirectory = getDirectoryFromPath ( getCurrentTemplatePath () ) & " model/javaloader/tmp" ,
87
+ // Whether or not the source is trusted, i.e. it is going to change? Defaults to false, so changes will be recompiled and loaded
88
+ trustedSource = false
89
+ };
90
+
91
+ // incorporate settings
92
+ structAppend ( configStruct .javaloader , javaLoaderDSL , true );
93
+ }
94
+
93
95
}
0 commit comments