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