Changes between Initial Version and Version 1 of Ticket #420

Show
Ignore:
Timestamp:
10/04/10 15:07:17 (15 years ago)
Author:
boomfish
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #420

    • Property owner set to boomfish
    • Property status changed from new to assigned
  • Ticket #420 – description

    initial v1  
    1313event handlers. Here is a loop that comprises most of the logic. 
    1414 
    15  
    16                        <cftry> 
    17                                <cflog file="timer" text="trying to load 
     15{{{ 
     16           <cftry> 
     17                   <cflog file="timer" text="trying to load 
    1818#ehXml.xmlAttributes.name#/#ehXml.xmlAttributes.type# xml 
    1919#isXmlTypeList#"> 
    20                                <!--- If the event-handler already exists, get a reference to it ---> 
    21                                <cfif modelglue.hasEventHandler(ehXml.xmlAttributes.name)> 
    22                                        <cflog file="timer" text="The EH already existed. Woot."> 
    23                                        <cfset ehInst = modelglue.getEventHandler(ehXml.xmlAttributes.name) /> 
     20                   <!--- If the event-handler already exists, get a reference to it ---> 
     21                   <cfif modelglue.hasEventHandler(ehXml.xmlAttributes.name)> 
     22                           <cflog file="timer" text="The EH already existed. Woot."> 
     23                           <cfset ehInst = modelglue.getEventHandler(ehXml.xmlAttributes.name) /> 
    2424 
    25                                        <!--- If it's not an "extensible" event-handler, create a new eh object---> 
    26                                        <cfif not ehInst.extensible> 
    27                                                <cfset ehInst = ehFactory.create("EventHandler") /> 
    28                                        </cfif> 
    29                                <!--- Otherwise, try to instantiate the type. ---> 
    30                                <cfelse> 
    31                                        <cflog file="timer" text="Going to try to make it: 
     25                           <!--- If it's not an "extensible" event-handler, create a new eh object---> 
     26                           <cfif not ehInst.extensible> 
     27                                   <cfset ehInst = ehFactory.create("EventHandler") /> 
     28                           </cfif> 
     29                   <!--- Otherwise, try to instantiate the type. ---> 
     30                   <cfelse> 
     31                           <cflog file="timer" text="Going to try to make it: 
    3232#serializejson(getmetadata(ehfactory))#"> 
    33                                        <cfset ehInst = ehFactory.create(ehXml.xmlAttributes.type) > 
    34                                </cfif> 
    35                                <!--- If the type is not found, force a base EventHandler to be created ---> 
    36                                <cfcatch> 
    37                                        <cflog file="timer" text="I had to make a base EH"> 
    38                                        <cfset ehInst = ehFactory.create("EventHandler") /> 
    39                                </cfcatch> 
    40                        </cftry> 
    41  
     33                           <cfset ehInst = ehFactory.create(ehXml.xmlAttributes.type) > 
     34                   </cfif> 
     35                   <!--- If the type is not found, force a base EventHandler to be created ---> 
     36                   <cfcatch> 
     37                           <cflog file="timer" text="I had to make a base EH"> 
     38                           <cfset ehInst = ehFactory.create("EventHandler") /> 
     39                   </cfcatch> 
     40           </cftry> 
     41}}} 
    4242 
    4343Obviously the logs are mine. For each EH, it will attempt to create it 
     
    5252is code to see if it is an XML type: 
    5353 
    54                        <cfif structKeyExists(variables.eventTypes, ehXml.xmlAttributes.type) 
    55                                                or find(",", ehXml.xmlAttributes.type) 
    56                        > 
    57                                <cfset isXmlTypeList = "true" /> 
    58                        </cfif> 
     54{{{ 
     55           <cfif structKeyExists(variables.eventTypes, ehXml.xmlAttributes.type) 
     56                                   or find(",", ehXml.xmlAttributes.type) 
     57           > 
     58                   <cfset isXmlTypeList = "true" /> 
     59           </cfif> 
     60}}} 
    5961 
    6062So I modified that try/catch branch like so: 
    6163 
    62                        <cftry> 
    63                                <cflog file="timer" text="trying to load 
     64{{{ 
     65           <cftry> 
     66                   <cflog file="timer" text="trying to load 
    6467#ehXml.xmlAttributes.name#/#ehXml.xmlAttributes.type# xml 
    6568#isXmlTypeList#"> 
    66                                <!--- If the event-handler already exists, get a reference to it ---> 
    67                                <cfif modelglue.hasEventHandler(ehXml.xmlAttributes.name)> 
    68                                        <cflog file="timer" text="The EH already existed. Woot."> 
    69                                        <cfset ehInst = modelglue.getEventHandler(ehXml.xmlAttributes.name) /> 
     69                   <!--- If the event-handler already exists, get a reference to it ---> 
     70                   <cfif modelglue.hasEventHandler(ehXml.xmlAttributes.name)> 
     71                           <cflog file="timer" text="The EH already existed. Woot."> 
     72                           <cfset ehInst = modelglue.getEventHandler(ehXml.xmlAttributes.name) /> 
    7073 
    71                                        <!--- If it's not an "extensible" event-handler, create a new eh object---> 
    72                                        <cfif not ehInst.extensible> 
    73                                                <cfset ehInst = ehFactory.create("EventHandler") /> 
    74                                        </cfif> 
    75                                <!--- Otherwise, try to instantiate the type. ---> 
    76                                <cfelseif not isXmlTypeList> 
    77                                        <cflog file="timer" text="Going to try to make it: 
     74                           <!--- If it's not an "extensible" event-handler, create a new eh object---> 
     75                           <cfif not ehInst.extensible> 
     76                                   <cfset ehInst = ehFactory.create("EventHandler") /> 
     77                           </cfif> 
     78                   <!--- Otherwise, try to instantiate the type. ---> 
     79                   <cfelseif not isXmlTypeList> 
     80                           <cflog file="timer" text="Going to try to make it: 
    7881#serializejson(getmetadata(ehfactory))#"> 
    79                                        <cfset ehInst = ehFactory.create(ehXml.xmlAttributes.type) > 
    80                                <cfelse> 
    81                                        <cfset ehInst = ehFactory.create("EventHandler") /> 
    82                                </cfif> 
    83                                <!--- If the type is not found, force a base EventHandler to be created ---> 
    84                                <cfcatch> 
    85                                        <cflog file="timer" text="I had to make a base EH"> 
    86                                        <cfset ehInst = ehFactory.create("EventHandler") /> 
    87                                </cfcatch> 
    88                        </cftry> 
     82                           <cfset ehInst = ehFactory.create(ehXml.xmlAttributes.type) > 
     83                   <cfelse> 
     84                           <cfset ehInst = ehFactory.create("EventHandler") /> 
     85                   </cfif> 
     86                   <!--- If the type is not found, force a base EventHandler to be created ---> 
     87                   <cfcatch> 
     88                           <cflog file="timer" text="I had to make a base EH"> 
     89                           <cfset ehInst = ehFactory.create("EventHandler") /> 
     90                   </cfcatch> 
     91           </cftry> 
     92}}} 
    8993 
    9094Notice the new cfelseif? When I did this loading went from around 1.5 minutes to about 15 seconds.