RE: Relative path when instantiating a CFC?

2008-02-13 Thread Jonathon Stierman
The proxy approach has been blogged about:

http://corfield.org/blog/index.cfm/do/blog.entry/entry/Extending_Your_Root_A
pplicationcfc

Here's the jist of the layout:

/Application.cfc (root)
/ApplicationProxy.cfc (extends Application.cfc)
/sub/Application.cfc (extends ApplicationProxy.cfc)

Jonathon

-Original Message-
From: Adrian Lynch [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 13, 2008 7:02 AM
To: CF-Talk
Subject: RE: Relative path when instantiating a CFC?

Sorry for the hijack, but how are people using Application.cfc to create sub
applications with the following structure:

Application.cfc - Main app
admin\Application.cfc - Sub app

Where the sub app wants to have extend the main app's App.cfc?

Adrian

-Original Message-
From: Dan G. Switzer, II [mailto:[EMAIL PROTECTED]
Sent: 13 February 2008 12:52
To: CF-Talk
Subject: RE: Relative path when instantiating a CFC?


>>I want to use a relative path when instantiating a CFC.  Can this be 
>>done when using createObject()?  Can it be done at all?
>
>
>There is also a UDF at cflib that allows relative paths. Though it does 
>use coldfusion.runtime.TemplateProxy. So it might not work in CF8 if 
>access to internal java components is disabled.
>
>http://cflib.org/udf.cfm?ID=900

The updated version on my blog works with CF6/7/8:

http://blog.pengoworks.com/index.cfm/2003/3/27/UDF-component-for-CFMX

It uses the TemplateProxyFactory for CF7 & 8. The obviously uses undocument
internals for CF, so there's always the possibility it will break in the
future.

However, it's been working fine for me over 5 years.

-Dan




~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298873
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Relative path when instantiating a CFC?

2008-02-13 Thread Adrian Lynch
Sorry for the hijack, but how are people using Application.cfc to create sub
applications with the following structure:

Application.cfc - Main app
admin\Application.cfc - Sub app

Where the sub app wants to have extend the main app's App.cfc?

Adrian

-Original Message-
From: Dan G. Switzer, II [mailto:[EMAIL PROTECTED]
Sent: 13 February 2008 12:52
To: CF-Talk
Subject: RE: Relative path when instantiating a CFC?


>>I want to use a relative path when instantiating a CFC.  Can this be done
>>when using createObject()?  Can it be done at all?
>
>
>There is also a UDF at cflib that allows relative paths. Though it does use
>coldfusion.runtime.TemplateProxy. So it might not work in CF8 if access to
>internal java components is disabled.
>
>http://cflib.org/udf.cfm?ID=900

The updated version on my blog works with CF6/7/8:

http://blog.pengoworks.com/index.cfm/2003/3/27/UDF-component-for-CFMX

It uses the TemplateProxyFactory for CF7 & 8. The obviously uses undocument
internals for CF, so there's always the possibility it will break in the
future.

However, it's been working fine for me over 5 years.

-Dan


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298869
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Relative path when instantiating a CFC?

2008-02-13 Thread Dan G. Switzer, II
>>I want to use a relative path when instantiating a CFC.  Can this be done
>>when using createObject()?  Can it be done at all?
>
>
>There is also a UDF at cflib that allows relative paths. Though it does use
>coldfusion.runtime.TemplateProxy. So it might not work in CF8 if access to
>internal java components is disabled.
>
>http://cflib.org/udf.cfm?ID=900

The updated version on my blog works with CF6/7/8:

http://blog.pengoworks.com/index.cfm/2003/3/27/UDF-component-for-CFMX

It uses the TemplateProxyFactory for CF7 & 8. The obviously uses undocument
internals for CF, so there's always the possibility it will break in the
future.

However, it's been working fine for me over 5 years.

-Dan


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298866
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread Sonny Savage
Thanks for the enlightening interaction!  My dev env is CF7 and prod is
CF6.1.  The template instantiating the CFC is in a folder at the same depth
as the cfc, so I was hoping for ../ type relative paths.  The directory
structure looks something like this:
/app_name/[version]/scripts/cf/
/app_name/[version]/scripts/cfc/

What I ended up doing is using a version variable and calling the cfc like
this:
app_name.#version#.scripts.cfc.component

While my solution differed from the recommendations, they are definitely
keepers and I will refer back to them.

Thanks again!

On Feb 12, 2008 8:47 PM, s. isaac dealey <[EMAIL PROTECTED]> wrote:

> > it may be an option to refer to it from the app root. That could be a
> > crucial piece of information for the OP.
>
> Yes. :)
>
> --
> s. isaac dealey  ^  new epoch
>  isn't it time for a change?
> ph: 503.236.3691
>
> http://onTap.riaforge.org/blog
>
>
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298857
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread s. isaac dealey
> it may be an option to refer to it from the app root. That could be a
> crucial piece of information for the OP.

Yes. :) 

-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
 ph: 503.236.3691

http://onTap.riaforge.org/blog



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298849
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread C S
>I want to use a relative path when instantiating a CFC.  Can this be done
>when using createObject()?  Can it be done at all?


There is also a UDF at cflib that allows relative paths. Though it does use 
coldfusion.runtime.TemplateProxy. So it might not work in CF8 if access to 
internal java components is disabled.

http://cflib.org/udf.cfm?ID=900 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298848
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread Dominic Watson
>
> Heh... okay, given... but I was addressing the question of relative to
> the template where the component is being instantiated, i.e. the
> default definition of "relative"... "relative" isn't "relative to the
> application root" unless you specifically include the qualifying phrase
> "to the application root".


lol I think wires are crossed. Yes that's absolutely right - but my point is
that you don't neccessarily have to refer to a component relative to the
template from which you are calling it; it may be an option to refer to it
from the app root. That could be a crucial piece of information for the OP.

aarg


-- 
Blog it up: http://fusion.dominicwatson.co.uk


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298847
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread s. isaac dealey
> >
> > Well yes... but that's not "relative". I was only talking about relative
> > instantiation for the purpose of example.
> 
> 
> Lol, but it IS relative. The OP may not be aware that you can reference a
> cfc relative to the webroot and would in that case be thinking that he would
> need to use a path relative to the one the calling template was in. I was
> unaware of this for some time and even wrote the simplest of bean factories
> to "work around" the relative path "problem" until I realised it wasn't one
> in the situations where I thought it was.

Heh... okay, given... but I was addressing the question of relative to
the template where the component is being instantiated, i.e. the
default definition of "relative"... "relative" isn't "relative to the
application root" unless you specifically include the qualifying phrase
"to the application root". 

Though my understanding is that at least with previous versions of CF
(not sure about CF8 given the addition of application-specific mappings)
that it wasn't actually the application root, it was the web root and
that those were actually still not independent of a cfserver mapping,
because they relied on the "/" mapping created by the server when it's
installed. 

And yet, I had one instance in which I had actually created a bunch of
code that worked perfectly on my dev box by instantiating components
from the web root (using that mapping) and had then copied that working
code to a *nix server and it all suddenly failed. No explanation. The "/"
mapping existed and was pointed correctly at the web root. All the
pathing information was correct, it just didn't work. That's actually
how I learned about the "/" mapping in the first place. Prior to that I
hadn't realized that root-relative component discovery used a mapping,
though it didn't help any. Ultimately was unable to use root-relative
paths to load components on that server. 

So you and I had both been sort of "burned" by different aspects of that
feature. 

-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
 ph: 503.236.3691

http://onTap.riaforge.org/blog



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298843
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread s. isaac dealey
> >
> > My understanding is that it can only be done "one way" 
> >... downward... 
> 
> Not entirely true. You can reference any component from the root of
> the application you are in (see my previous post).

Well yes... but that's not "relative". I was only talking about relative
instantiation for the purpose of example. 

Oh... speaking of which -- to the original poster -- if you're using CF8
you might want to look into the new features in Application.cfc that
allow you to set per-application mappings. Not sure if anybody else
mentioned that. 

-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
 ph: 503.236.3691

http://onTap.riaforge.org/blog



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298830
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread Dominic Watson
>
> Lol, but it IS relative. The OP may not be aware that you can reference a
> cfc relative to the webroot


I mean to say application root.


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298832
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread Dominic Watson
>
> Well yes... but that's not "relative". I was only talking about relative
> instantiation for the purpose of example.


Lol, but it IS relative. The OP may not be aware that you can reference a
cfc relative to the webroot and would in that case be thinking that he would
need to use a path relative to the one the calling template was in. I was
unaware of this for some time and even wrote the simplest of bean factories
to "work around" the relative path "problem" until I realised it wasn't one
in the situations where I thought it was.

The truth is what matters ;)

Dominic

-- 
Blog it up: http://fusion.dominicwatson.co.uk


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298831
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread Dominic Watson
>
> My understanding is that it can only be done "one way" ... downward...


Not entirely true. You can reference any component from the root of the
application you are in (see my previous post).

Dominic

-- 
Blog it up: http://fusion.dominicwatson.co.uk


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298825
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread s. isaac dealey
> I want to use a relative path when instantiating a CFC.  Can this be
> done when using createObject()?  Can it be done at all?

My understanding is that it can only be done "one way" ... downward...
so if you've got 

/com/blah/thing.cfc 
/site/home.cfm 

Then you wouldn't be able to use a relative path to instantiate
thing.cfc from within home.cfm -- however, you could if you had 

/site/home.cfm 
/site/com/blah/thing.cfc 

then use CreateObject("component","com.blah.thing") within home.cfm --
the problem is that there's no way (as far as I know) to use "../" to
traverse the directory tree in reverse when instantiating a CFC because
it always interprets the dot as indicating a path separator, in spite of
the fact that I believe the server also allows you to use slashes to
mean the same thing in CFC paths. 

-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
 ph: 503.236.3691

http://onTap.riaforge.org/blog



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298818
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Relative path when instantiating a CFC?

2008-02-12 Thread Dominic Watson
>
> I want to use a relative path when instantiating a CFC.  Can this be done
> when using createObject()?  Can it be done at all?
>

It can't be done using relative notation. If the cfc is outside the root of
your application, you can use a ColdFusion mapping. If it is within the
root, a mapping is not required, i.e.

theAppRootFolder
--componentfolder
mycfc.cfc
--anotherFolder
myTemplate.cfm

anotherApplicationRoot
--myOthercfc.cfc

In myTemplate.cfm, you could use "compononentfolder.mycfc" to reference the
mycfc.cfc component becuase ColdFusion checks cfc paths relative to the
application root. If you wanted to instantiate the 'myOther.cfc' component
however, you would need to create a mapping to the 'anotherApplicationRoot'
folder then use 'myMapping.myOthercfc.cfc'.

Mappings are created in the ColdFusion administrator, or if you don't have
access you will need to put in a ticket with your host.

 You can also use something like ColdSpring to generate all your component
instances. You still need to create mappings, but it really is a great thing
so do check it out :)

Dominic

-- 
Blog it up: http://fusion.dominicwatson.co.uk


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298797
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Relative path when instantiating a CFC?

2008-02-12 Thread Sonny Savage
I want to use a relative path when instantiating a CFC.  Can this be done
when using createObject()?  Can it be done at all?

Thanks!

-- 
Edward A Savage Jr - "Sonny"
Senior Software Engineer
Creditdiscovery, LLC
"I was gratified to be able to answer promptly. I said I don't know." ~ Mark
Twain


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298790
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4