contentbox.modules.contentbox-deps.modules.cbantisamy.modules.cbjavaloader.models.javaloader

Class JavaLoader

lucee.Component
    extended by contentbox.modules.contentbox-deps.modules.cbantisamy.modules.cbjavaloader.models.javaloader.JavaLoader

Loads External Java Classes, while providing access to ColdFusion classes

Class Attributes:
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
    Constructor Summary
    init([array loadPaths='[runtime expression]'], [boolean loadColdFusionClassPath='false'], [any parentClassLoader=''], [array sourceDirectories], [string compileDirectory='[runtime expression]'], [boolean trustedSource='false'])
          Constructor.
    Method Summary
    private string calculateJarName(array directoryArray)
         returns the jar file name for a directory array.
    private contentbox.modules.contentbox-deps.modules.cbantisamy.modules.cbjavaloader.models.javaloader.datetime calculateSourceLastModified()
         returns what the source last modified was.
    private void compileSource()
         compile dynamic source.
    any create(string className)
         Retrieves a reference to the java class.
    private any createJavaProxy(any class)
         create a javaproxy, dependent on CF server settings.
    private any createJavaProxyCFC(any class)
         create a javaproxy, dependent on CF server settings.
    private any createWithSourceCheck(string className)
         does the create call, but first makes a source check.
    private any directoryCopy(string source, string destination, any nameconflict='overwrite')
    private void ensureNetworkClassLoaderOnServerScope()
         makes sure there is a URL class loader on the server scope that can load me up some networkClassLoader goodness.
    private array getClassLoadPaths()
    private string getCompileDirectory()
    private JavaCompiler getJavaCompiler()
    private any getParentClassLoader()
    private any getServerURLClassLoader()
         returns the server URL class loader.
    private array getSourceDirectories()
    private contentbox.modules.contentbox-deps.modules.cbantisamy.modules.cbjavaloader.models.javaloader.datetime getSourceLastModified()
    any getURLClassLoader()
         Returns the com.
    string getVersion()
         Retrieves the version of the loader you are using.
    private boolean hasJavaCompiler()
         whether this object has a javaCompiler.
    private boolean hasSourceLastModified()
         whether this object has a sourceLastModified.
    private string initUseJavaProxyCFC()
         initialise whether or not to use the JavaProxy CFC instead of the coldfusion java object.
    private boolean isTrustedSource()
    private void loadClasses()
         loads up the classes in the system.
    private array queryJars()
         pulls a query of all the jars in the /resources/lib folder.
    private void setClassLoadPaths(array classLoadPaths)
    private void setCompileDirectory(string compileDirectory)
    private void setJavaCompiler(JavaCompiler javaCompiler)
    private void setParentClassLoader(any parentClassLoader)
    private void setSourceDirectories(array sourceDirectories)
    private void setSourceLastModified(date sourceLastModified)
    private void setTrustedSource(boolean isTrustedSource)
    private void setURLClassLoader(any ClassLoader)
    private any throwException(string type, string message, [string detail=''])
         Throws an Exception.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init([array loadPaths='[runtime expression]'], [boolean loadColdFusionClassPath='false'], [any parentClassLoader=''], [array sourceDirectories], [string compileDirectory='[runtime expression]'], [boolean trustedSource='false'])

    Constructor

    Parameters:
    loadPaths - An array of directories of classes, or paths to .jar files to load
    loadColdFusionClassPath - Loads the ColdFusion libraries
    parentClassLoader - (Expert use only) The parent java.lang.ClassLoader to set when creating the URLClassLoader
    sourceDirectories - Directories that contain Java source code that are to be dynamically compiled
    compileDirectory - the directory to build the .jar file for dynamic compilation in, defaults to ./tmp
    trustedSource - Whether or not the source is trusted, i.e. it is going to change? Defaults to false, so changes will be recompiled and loaded

    Method Detail

    calculateJarName

    private string calculateJarName(array directoryArray)

    returns the jar file name for a directory array

    Parameters:
    directoryArray - array of directories to compile

    calculateSourceLastModified

    private contentbox.modules.contentbox-deps.modules.cbantisamy.modules.cbjavaloader.models.javaloader.datetime calculateSourceLastModified()

    returns what the source last modified was


    compileSource

    private void compileSource()

    compile dynamic source


    create

    public any create(string className)

    Retrieves a reference to the java class. To create a instance, you must run init() on this object

    Parameters:
    className - The name of the class to create

    createJavaProxy

    private any createJavaProxy(any class)

    create a javaproxy, dependent on CF server settings

    Parameters:
    class - the java class to create the proxy with

    createJavaProxyCFC

    private any createJavaProxyCFC(any class)

    create a javaproxy, dependent on CF server settings

    Parameters:
    class - the java class to create the proxy with

    createWithSourceCheck

    private any createWithSourceCheck(string className)

    does the create call, but first makes a source check

    Parameters:
    className - The name of the class to create

    directoryCopy

    private any directoryCopy(string source, string destination, any nameconflict='overwrite')

    Parameters:
    source
    destination
    nameconflict

    ensureNetworkClassLoaderOnServerScope

    private void ensureNetworkClassLoaderOnServerScope()

    makes sure there is a URL class loader on the server scope that can load me up some networkClassLoader goodness


    getClassLoadPaths

    private array getClassLoadPaths()


    getCompileDirectory

    private string getCompileDirectory()


    getJavaCompiler

    private JavaCompiler getJavaCompiler()


    getParentClassLoader

    private any getParentClassLoader()


    getServerURLClassLoader

    private any getServerURLClassLoader()

    returns the server URL class loader


    getSourceDirectories

    private array getSourceDirectories()


    getSourceLastModified

    private contentbox.modules.contentbox-deps.modules.cbantisamy.modules.cbjavaloader.models.javaloader.datetime getSourceLastModified()


    getURLClassLoader

    public any getURLClassLoader()

    Returns the com.compoundtheory.classloader.NetworkClassLoader in case you need access to it


    getVersion

    public string getVersion()

    Retrieves the version of the loader you are using


    hasJavaCompiler

    private boolean hasJavaCompiler()

    whether this object has a javaCompiler


    hasSourceLastModified

    private boolean hasSourceLastModified()

    whether this object has a sourceLastModified


    initUseJavaProxyCFC

    private string initUseJavaProxyCFC()

    initialise whether or not to use the JavaProxy CFC instead of the coldfusion java object


    isTrustedSource

    private boolean isTrustedSource()


    loadClasses

    private void loadClasses()

    loads up the classes in the system


    queryJars

    private array queryJars()

    pulls a query of all the jars in the /resources/lib folder


    setClassLoadPaths

    private void setClassLoadPaths(array classLoadPaths)

    Parameters:
    classLoadPaths

    setCompileDirectory

    private void setCompileDirectory(string compileDirectory)

    Parameters:
    compileDirectory

    setJavaCompiler

    private void setJavaCompiler(JavaCompiler javaCompiler)

    Parameters:
    javaCompiler

    setParentClassLoader

    private void setParentClassLoader(any parentClassLoader)

    Parameters:
    parentClassLoader

    setSourceDirectories

    private void setSourceDirectories(array sourceDirectories)

    Parameters:
    sourceDirectories

    setSourceLastModified

    private void setSourceLastModified(date sourceLastModified)

    Parameters:
    sourceLastModified

    setTrustedSource

    private void setTrustedSource(boolean isTrustedSource)

    Parameters:
    isTrustedSource

    setURLClassLoader

    private void setURLClassLoader(any ClassLoader)

    Parameters:
    ClassLoader

    throwException

    private any throwException(string type, string message, [string detail=''])

    Throws an Exception

    Parameters:
    type - The type of exception
    message - The message to accompany the exception
    detail - The detail message for the exception