Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Pointer to handler?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
CaptainPalapa  
View profile  
 More options Jun 29, 12:22 pm
From: CaptainPalapa <captainpal...@gmail.com>
Date: Mon, 29 Jun 2009 09:22:59 -0700 (PDT)
Local: Mon, Jun 29 2009 12:22 pm
Subject: Pointer to handler?
After examining the Coldbox Cache (in Coldbox Debug information), I
don't see any reference to handlers.  I know they are cached, however,
if the setting for handler caching is on.

I'm wondering, if I wanted to do a little runtime analysis on a given
handler file, what's the best way to:
1) Get a pointer to the cached version of that handler so I can look
at the functions metadata
or
2) Properly create the object (without using runEvent()) so that my
instantiation of it allows Coldbox to use it later when it's ready.

Thoughts?  (Luis: This is part of the handler mapper we discussed.)

- Will B.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
whostheJBoss  
View profile  
 More options Jun 30, 4:06 am
From: whostheJBoss <dotfus...@changethings.org>
Date: Tue, 30 Jun 2009 01:06:29 -0700 (PDT)
Local: Tues, Jun 30 2009 4:06 am
Subject: Re: Pointer to handler?
I also need this.

On Jun 29, 9:22 am, CaptainPalapa <captainpal...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luis Majano  
View profile  
 More options Jun 30, 11:53 am
From: Luis Majano <lmaj...@gmail.com>
Date: Tue, 30 Jun 2009 08:53:21 -0700
Local: Tues, Jun 30 2009 11:53 am
Subject: Re: [coldbox:2985] Re: Pointer to handler?

Handler's are controlled by the HandlerService.  You have full access to the
handler service for any kind of funkyness you need to accomplish.
handlerService = controller.getHandlerService();

There are several useful methods in there, like for example, getHandler().
 You can easily get a reference to a handler.

On Tue, Jun 30, 2009 at 1:06 AM, whostheJBoss <dotfus...@changethings.org>wrote:

--
Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CaptainPalapa  
View profile  
 More options Jun 30, 12:36 pm
From: CaptainPalapa <captainpal...@gmail.com>
Date: Tue, 30 Jun 2009 09:36:56 -0700 (PDT)
Local: Tues, Jun 30 2009 12:36 pm
Subject: Re: Pointer to handler?
This is what I ended up doing:

I created an array of the paths, from the most specific potential
customized handler first and the most generic last.  Then I loop over
the array and used this code to determine if a) the handler itself (as
a file) existed and b) that the handler actually had the event I
needed.  The variable sMap is the full path along with the event nameI
needed.  This the one the interceptor would use as the overrideEvent()
value.  The nice thing is, using the Coldbox getRegisteredHandler()
function allows me to access the object whether it is cached or not,
allowing Coldbox to create it if it hasn't done so yet.

<cfloop from="1" to="#arrayLen(local.aPaths)#" index="local.iterPath">
        <cftry>
                <!--- Use the controller to "correctly" create this handler --->
                <cfset local.oEventHandlerBean = getController().getHandlerService
().getRegisteredHandler(local.aPaths[local.iterPath] & '.' &
args.event) />

                <!--- Actually try to grab the handler.event, will fail if not found
--->
                <cfset local.oHandler = getController().getHandlerService
().getHandler(local.oEventHandlerBean, arguments.eventString) />

                <!--- If we didn't have an error, then we found our deepest file
path, save it and break out --->
                <cfset local.sMap = local.aPaths[local.iterPath] & '.' & args.event /


                <cflock name="EventMapper-write" type="exclusive" timeout="5"
throwontimeout="false">
                        <cfset instance.stMap[local.lookupKey] = local.sMap />
                </cflock>
                <cfbreak />

                <!--- Catch the error Coldbox throws when the HANDLER doesn't exist
--->
                <cfcatch type="Framework.EventHandlerNotRegisteredException">
                        <!--- The handler wasn't found with this path, keep going. --->
                        <!--- Unless this is the last of the files to check, in that case,
rethrow --->
                        <cfif local.iterPath eq arrayLen(local.aPaths)>
                                <cfrethrow />
                        </cfif>
                </cfcatch>
                <!--- Catch the error Coldbox throws when the EVENT doesn't exist ---


                <cfcatch type="Framework.invalidEventException">
                        <!--- Found the handler, but the EVENT doesn't exist in it, keep
going. --->
                        <!--- Unless this is the last of the files to check, in that case,
rethrow --->
                        <cfif local.iterPath eq arrayLen(local.aPaths)>
                                <cfrethrow />
                        </cfif>
                </cfcatch>
        </cftry>
</cfloop>

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google