I've come up with a .02 version of warpcore using a Java Stack as the event manager, but from simple testing it doesn't seem to be as fast as the previous version. I'm going to have to narrow this down to creation time or execution time though.

Click more to see the code.

<cfcomponent name="warpCore">

    <cffunction name="init" returntype="warpCore01" output="false">
        <cfargument name="trigger" type="string" required="false" default="request.func"/>
            variables.eventCore = CreateObject("java", "java.util.Stack");
            variables.driveCore = StructNew();
            variables.trigger = arguments.trigger;
            variables.cap = 10;
            return this;

    <cffunction name="addDrive">
        <cfargument name="controllerPath" type="string"/>
            var objController = CreateObject("component", arguments.controllerPath);
            var arrEvents = StructKeyArray(objController);
            var iEvents = ArrayLen(arrEvents);
            var i = 0;
            if (iEvents gt 0) {
                for(i = 1; i lte iEvents; i = i + 1) {
                    if (NOT StructKeyExists(variables.driveCore, arrEvents[i])) {
                        StructInsert(variables.driveCore, arrEvents[i], ArrayNew(1));
                    ArrayAppend(variables.driveCore[arrEvents[i]], objController[arrEvents[i]]);

    <cffunction name="execute" returntype="void">
        <cfset setEvent(getTriggerEvent())/>
        <cfset runEvent()/>
    <cffunction name="runEvent" returntype="void" access="private">
            var eCurrent = "";
            var iCount = variables.cap;
            var iEvents = 0;
            var x = 0;
            var fExecutor = "";
            do {
                eCurrent = getEvent();
                if (StructKeyExists(variables.driveCore, eCurrent)) {
                    iEvents = ArrayLen(variables.driveCore[eCurrent]);
                    for (x = 1; x lte iEvents; x = x + 1) {
                        fExecutor = variables.driveCore[eCurrent][x];
                iCount = iCount - 1;
            } while (NOT isEmpty() AND (iCount gte 0));
    <cffunction name="getEvent">
        <cfset var event = variables.eventCore.pop()>
        <cfreturn event/>
    <cffunction name="getTriggerEvent" returntype="any">
        <cfreturn evaluate(variables.trigger)/>
    <cffunction name="setEvent" returntype="void">
        <cfargument name="value" required="true"/>
        <cfset variables.eventCore.push(arguments.value)/>
    <cffunction name="isEmpty" access="private">
        <cfreturn variables.eventCore.empty()/>
    <cffunction name="clearEvents" returntype="void">
        <cfset variables.eventCore.empty()/>


Comments are not allowed for this entry.
Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me on LinkedIn.