WarpCore

The name's probably already taken, but what the hell. WarpCore is the name I've given to a very simple implementation of an implicit invocation controller scheme in ColdFusion. The concept is simple: some variable is set that contains an event, the WarpCore handles the registration of new drives (controllers), and the WarpCore controls activating functions in those drives.

Declaring the WarpCore


ing<" cfscript>r
e    quurilr.eedv=e"
fnat l=s e""w edlecfoamuel"t;=

"
    ,W"a rpC/o>r

e     = <Crcfsete avtaerO brjeetcutr(n"Vcaolmupeon e=n t""", "/c
>

fc    .
w<arcfsetp Cvoarre "p)o.siintiito(n
    =     t0r ig/g
>
e

r    : <"
urcfli.fe vNeOnTt "L
i    s);t
    F
i    nWdaNropCCaosree(."
aodndDer,iavlel("",c oanrtgruomlelnetrs1."s)c;o
p    e)W>
    a    r<pcCfotreh.raodwd Derrirvoer(c"
ocdonet=r"oLlilsetrR2e"m)o;
v    eW"a rmpeCsosraeg.ea=d"dIDnrvivael(i"dc oanrtgruomlelnetr 3S"C)O;
P    
E.    W aVralpiCdo rvea.leuxeescu tae(r)e;
ONE< a/ncdf sAcLrLi.p"t >

Example Drive


cti<onc fncaommep=o"nLeinstt Rneammoev=e""c oonuttrpoultl=e"rf1a"l>
s    
e"
     r<etcufrfnutnycptei=o"ns tnraimneg="">w
e    lc<omcef"
a>
r
g    u    mWeenltc onmaem ef=ro"mst rCionngt1"r otlylpeer= "s1tring" required="true" />

<    br< /c>f
a    r    gu<mecfsetn ts neatmEev=e"nts(t'rlienag2v"e 't)yp>e
=    "st<rin/gc"f fruenqcutiireodn=">
t    
ru    e"
< /cf>
f    un<ctcifaorgnum ennatm neam=e=""bsyec">
o    p    Geo"
o dt-ybpyee= "fsrtormi nCgo"n trroelqlueirr ed1="false" default<=br" al/l>"
    />
<
    /<cfcffuanrcgtuimeonnt>
n
am<e="/dceflciommiptoenrenst">

The WarpCore

fo<r(cif f=un c1t;i oin lntaem ei=E"vLeisnttRse;m oiv e=N oiC a+se 1") o{u
t    p    ut    =    "    fialfs e("N OTr eStturrnutcytpKe=e"ysEtxriinsgt"s>

(    v<arcifaabrlgeusm.ecnotr en,a mea="srtrrinEg1v" etynpet="sst[riing]") r)eq ui{re
d=    "t    ru    e    "     /    >

S    t<rcufacrgtumIennt sneamre=t"s(trvinag2r"i atbylpees=."csotrrei,n agr"rE vreenqtusi[ri]e, dA=r"rtaryNueew"( 1))/;>

                <        c}f
a        r    g        u
m        e    n    t     Anrarmaey=A"pspceonpde("v atrypie=a"bsltersi.ncgo"r er[eaqruriErveendt="sf[alis]e"] d,e foaubltj=C"aolnl"t r/o>

l    l<ecrf[aragurmrenEt vneanmet=s"d[eili]m]i)t;e
    r        s    "
}
    t    y    p}e
=        "}s
t        r
i    ng    "
f urnecqtuioinr eedx=e"cfuatles(e)" {d
e    fa    u    lvta="r, "e C/u>


r    re<ntcfset =v ar" "r;
e    t    u    rvnaVra ilCouuent == ""va r/ia
>
b
le    s.<cacfsetp ;v
a    r         pvaors iitEivoennt s= =0 0;
/    
>

    
        va<r xc f=i f0 ;
N    O    T     vLairs texFiencduNtooCra s=e ("""o;
n    e    ,    
a    l    l    "
d,o a{r
g    u    m    e    netCsu.rsrcenotp e=) >

g    e    tEv<enctf(t)h;
r    o        w    
    e    r    r    oirfc (oSdter=u"cLtKiesytERxeimsotvse("v amreisasbalgees=.c"oIrnev,a leiCdu rarregnutm)e)n t{
    S        C        OiEPveEn.ts =V AarrlaiyLden (vvaalriuabelses .acorree[eCur renOt]N);
E         a        n    
d     A    L    L    .    f"
o r (/x>

    = 1<; /xc flifte>

i    Ev<enctsf;lo oxp =l ixs t+= "1#)a r{
gu    m    e    n    t    s.    sterxineg1cu#t"
o r i= nvdaerxi=a"bvlaelsu.ec"o rdee[leiCmuirtreenrts]=["x#]a;
r    g    u    m    e    n    tesx.edceultiomri(t)e;
r    s        #    "
        >


                        <        cfseti fp o(sgeitEtvieontn() =ne qL eiCsurtreFnit)n {d
N        o    C        a    s    ceo(natirngueu;
m        e    n    t        s}
.str    i    n    g        2},
         v        a}
l    u        e    ,i Caourngtu m= einCotusnt. d- e1l;
i        m    i} twehirlse )( (ge/t
>
E
    v    e
n    t    () <neq ecCfuirfr epnot)s iAtNiDo n( igCto u0n tA NgDt ea r0g)u)m;e
n    t    s}.
    s    
co    p    ef uenqc ti"oonn eg"et>
E
v    e    n    t(<) {cfset
         a    rrgeutumrenn tesva.lsutartien(g2v a=r iaLbilsetDse.ltertiegAgte(ra)r;
g    u    m}e
n        t
s    .    sfturnicntgio2n, pionssipteicotn()) {
    /    
>

    r    e    tu<rnc fvealrsieaibfl epso.sciotrieo;n    
e    q     0}>


                
        <    fcfset urnetcutrniVoanl ues =e tLiEsvtAepnpte n(dv(areltuuer)n V{
a    l    u    e",# vvaarliuaeb,l easr.gturmiegngtesr.#d"e l=i mairtgeurmse)n t/s.
>

v    a    lue;<
        /c}
f    if><
    /c<fsc/rcifplt>o

op>
<

    /c<fccofmrpeotnuernnt >r

Any way, thats my 2 hour implementation of an II control scheme like those in Mach-II and Model Glue, just without the XML. I know its ugly: I've already got ideas on better ways to handle the setup. The key thing to me is that I want to be able to detect and register event handlers without resorting to predefining them in XML. I love XML, but I just hate needing to write large chunks of code in XML when I can just have the system automatically register the events for me.

 

Comments

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.

Post a job. Find one. authenticjobs.com

Interested in becoming a sponsor? Contact me.