PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/vendor/memcached/com/util/javaloader/readme.txt

http://cfwheels.googlecode.com/
Plain Text | 69 lines | 50 code | 19 blank | 0 comment | 0 complexity | c56124fa89b04387f9fb0558bb8209b2 MD5 | raw file
 1JavaLoader v0.4
 2Author: Mark Mandel
 3Date: 6th April 2007
 4
 5Installation
 6----------------
 7To install the javaloader, either put the javaloader in the 
 8root of your web application, or make a mapping called
 9'javaloader' to the javaloader folder.
10
11
12Utilisation
13----------------
14To access the JavaLoader CFC, you call createObject on it like so:
15
16createObject("component", "javaloader.JavaLoader").init(loadPaths, 
17														[loadColdFusionClassPath,] 
18														[parentClassLoader]);
19
20There are four arguments that possible to configure how and what the JavaLoader loads.
21
22* param: loadPaths
23An array of directories of classes, or paths to .jar files to load.
24
25An example would be:
26loadPaths = ArrayNew(1);
27loadPaths[1] = expandPath("icu4j.jar");
28loadPaths[2] = expandPath("log4j.jar");
29
30* param: loadColdFusionClassPath (default: false)
31Loads the ColdFusion libraries with the loaded libraries.
32This used to be on by default, however now you must implicitly set it to be true if 
33you wish to access any of the libraries that ColdFusion loads at application startup.
34
35* parentClassLoader (null)
36(Expert use only) The parent java.lang.ClassLoader to set when creating the URLClassLoader.
37Note - when setting loadColdFusionClassPath to 'true', this value is overwritten with the
38ColdFusion classloader.
39
40
41To create an instance of a Java Class, you then only need to call:
42
43javaloader.create(className).init(arg1, arg2...);
44
45* param className
46The name of the Java Class to create.
47
48This works exactly the same as createObject("java", className), such that simply calling create(className)
49gives you access to the static properties of the class, but to get an instance through calling the
50Constructor you are required to call create(className).init();
51
52Example:
53javaloader.create("org.apache.log4j.Logger").init("my log");
54
55Memory Issues
56----------------
57Due to a bug in ColdFusion that can cause URLClassLoaders not to be garbage collected,
58it is advised that instances of JavaLoader are stored in the Server scope, so that they
59never time out.
60
61
62Integration
63----------------
64Previously JavaLoader was a simple CFC that was very portable, and while JavaLoader
65now has dependencies, it can still be integrated into existing applications quite easily.
66
67The only dependency that much be maintained is that the /lib/ folder and its contents
68must sit in the same directory as JavaLoader.cfc  Other than that, JavaLoader can be
69integrated into existing applications and frameworks quite easily.