Paul,

Thank you very much.  I will certainly try your suggestion.

Robert J. Polickoski
Senior Programmer, ISRD Inc.
(540) 842-6339
[EMAIL PROTECTED]
AIM - RobertJFP



---------- Original Message ----------------------------------
From: "Paul Kenney" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date:  Tue, 17 Dec 2002 02:54:30 -0800

>Robert,
>
>You can create a struct in the Server (or Application) scope that 
holds a
>reference to each instantiated object.  Lets call this this
>"Server.stObjects".
>
>Each object needs a unique ID, so a UUID will be perfect.  Add a 
property
>called "ObjectID" in each component that you want to put inside 
this global
>reference struct.  When an object is instantiated, simply set the 
ObjectID
>property to a newly generated UUID.  Next, create a key in the 
global struct
>with its name set to the object's ObjectID and its value set to a 
reference
>to the new object.  You can put all this in the constructor 
code.  Here is
>the code:
>
>--------------------------------------------------------
>in Application.cfm:
>
><cfparam name="Server.stObjects" type="struct" default="#StructNew
()#"/>
>
>
>--------------------------------------------------------
>in component file:
>
><cfcomponent>
>       <cfproperty name="ObjectID" type="UUID"/>
>       ...
>       <cfif NOT Len(this.ObjectID)>
>               <cfset this.ObjectID = CreateUUID()>
>               <cfset Server.stObjects[this.ObjectID] = this>
>       </cfif>
></cfcomponent>
>--------------------------------------------------------
>
>To get the object back, simply use its ObjectID to access the key 
in the
>global struct.
>
>You might want to put this code into a base class so that you 
don't have to
>copy it all over the place.  In that class you could add the 
private methods
>"addRef", "removeRef" and "getRef", placing the constructor code 
above in
>the "addRef" method.
>"removeRef" would simply remove the object's key from the global 
struct.
>"getRef" would return a reference to the object with the 
specified ObjectID
>value.
>
>--------------------------------------------------------
>
>I hope this sheds some light on the possible solutions to your 
problem.
>
>Paul Kenney
>[EMAIL PROTECTED]
>
>
>> -----Original Message-----
>> From: Robert Polickoski [mailto:[EMAIL PROTECTED]]
>> Sent: Monday, December 16, 2002 1:35 PM
>> To: CF-Talk
>> Subject: CFC Instance Identification
>>
>>
>> All,
>>
>> Thank you in advance for you patience with my CFC 
tribulations.  I
>> am trying to find a string identifier for an instance of a CFC.
>>
>> The situation is this:  I am outputting a list of instantiated
>> objects to which a user has access.  In this list, I want to put
>> anchors that will call a specific method of an instantiated
>> object.  I have a function in a non-instantiated CFC that can do
>> this as long as I can pass a string identifier for the instance.
>>
>>      <cffunction name="DisplayCompMeth" access="remote"
>> output="true" displayname="Display Component Method" 
hint="Display
>> a specific method of a specific componentinstance">
>>              <!-- This function displays the specified method
>> of the specified component instance -->
>>              <cfargument name="Comp" type="string"
>> required="true" default="#URL.Comp#" displayname="Component"
>> hint="The component or instance thereof">
>>              <cfargument name="Meth" type="string"
>> required="true" default="#URL.Meth#" displayname="Method"
>> hint="The method to be invoked">
>>              <cfinvoke component="#evaluate("#Comp#")#"
>> method="#Meth#" returnvariable="DisplayPage"></cfinvoke>
>>              <cfoutput>
>>                      #DisplayPage#
>>              </cfoutput>
>>      </cffunction>
>>
>> This works fine when I know the name of the instance such as
>> SESSION.User.  But I am actually creating the menu by calling
>> methods from within the instantiated objects.  So I am looking 
for
>> a system level string identifier, like CFID, that is accessible
>> from within the instantiated object.  Does anyone know if there 
is
>> such a thing and if so, how to get it?
>>
>> Again, thank you for your patience, assistance and support.
>>
>> Robert J. Polickoski
>> Senior Programmer, ISRD Inc.
>> (540) 842-6339
>> [EMAIL PROTECTED]
>> AIM - RobertJFP
>> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to