Re: cfcomponent inheritance path

2010-02-26 Thread Dave Watts

> Lets say for example I have a component called baseapp.cfc sitting in
> the web root. I also have an application.cfc in a directory named
> /blog. If I want the application.cfc to extend the baseapp.cfc, I have
> to use the following syntax:
>    extends="/.baseapp"

You shouldn't need the slash or the dot, just extends="baseapp", if
it's in the web root.

> Along the same lines of thought, is there a way to extend a component
> without knowing it's exact location? Lets say that the blog directory
> is now a subdirectory of /myapps. I want an application.cfc that is in
> /myapps/blog/admin to extend the application.cfc sitting one level up
> in /myapps/blog. I don't know if the blog directory is in the root of
> the site, in myapps, or in some other location. All I know is that the
> application.cfc I want to extend is one directory up. Is there a way
> to do relative inheritance?
>
> I expect the answer is no.

The answer is no, as you expected.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsit

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331169
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfcomponent inheritance path

2010-02-25 Thread Kym Kovan

On 26/02/2010 17:43, Judah McAuley wrote:
>
> And there is a quirk that I did not know. Interesting, I've never
> before seen / in an inheritance declaration. Do you know if this
> follows the Java standard or is this a CF-only thing?

CF certainly.

its a bit old but still relevant:

http://corfield.org/blog/index.cfm/do/blog.entry/entry/Extending_Your_Root_Applicationcfc



-- 

Yours,

Kym Kovan
mbcomms.net.au


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331157
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfcomponent inheritance path

2010-02-25 Thread Judah McAuley

And there is a quirk that I did not know. Interesting, I've never
before seen / in an inheritance declaration. Do you know if this
follows the Java standard or is this a CF-only thing?

On Thu, Feb 25, 2010 at 10:40 PM, Michael Dinowitz
 wrote:
>
> That works until the cfc being extended (parent) has the same name as
> the cfc doing the extending (child). If I have an application.cfc in
> the blog directory and I want it to extend the application.cfc that's
> in the root, I have to use "/.application"
>
>
> On Fri, Feb 26, 2010 at 1:05 AM, Matt Quackenbush  
> wrote:
>>
>> When requesting a CFC (either by createObject() or extends=""), you must
>> supply a dot-notated path that is absolute to the web root.  For instance...
>>
>> - /wwwroot
>>   baseapp.cfc
>> - - /blog
>>     myclass.cfc
>>
>> For /blog/myclass.cfc to extend /baseapp.cfc it would be...
>>
>> extends="baseapp"
>>
>> You could, of course, use a mapping, but that just makes a path outside the
>> web root accessible (by CF internally) as though its residence was inside
>> the web root.  In other words, you'd still be calling an absolute path.
>>
>> The bottom line is, relative paths do not work with CFCs.
>>
>> HTH
>>
>>
>>
>
> 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331156
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfcomponent inheritance path

2010-02-25 Thread Michael Dinowitz

That works until the cfc being extended (parent) has the same name as
the cfc doing the extending (child). If I have an application.cfc in
the blog directory and I want it to extend the application.cfc that's
in the root, I have to use "/.application"


On Fri, Feb 26, 2010 at 1:05 AM, Matt Quackenbush  wrote:
>
> When requesting a CFC (either by createObject() or extends=""), you must
> supply a dot-notated path that is absolute to the web root.  For instance...
>
> - /wwwroot
>   baseapp.cfc
> - - /blog
>     myclass.cfc
>
> For /blog/myclass.cfc to extend /baseapp.cfc it would be...
>
> extends="baseapp"
>
> You could, of course, use a mapping, but that just makes a path outside the
> web root accessible (by CF internally) as though its residence was inside
> the web root.  In other words, you'd still be calling an absolute path.
>
> The bottom line is, relative paths do not work with CFCs.
>
> HTH
>
>
> 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331155
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfcomponent inheritance path

2010-02-25 Thread Kym Kovan

On 26/02/2010 16:42, Michael Dinowitz wrote:
>
> I'm just looking for verification on what I know about extending cfcs
> in the cfcomponent tag.
>
> Lets say for example I have a component called baseapp.cfc sitting in
> the web root. I also have an application.cfc in a directory named
> /blog. If I want the application.cfc to extend the baseapp.cfc,

I was under the (possibly wrong) impression that the behaviour is 
different when dealing with application.cfc.


-- 

Yours,

Kym Kovan
mbcomms.net.au


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331154
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfcomponent inheritance path

2010-02-25 Thread Michael Dinowitz

>>    extends="/.baseapp"
>
> I haven't actually seen a forward slash used in any component paths, I
> don't believe it is allowed. It should be a dot delimited path from
> the webroot, so if your baseapp.cfc is in the directory blog under the
> webroot, it should be referred to as blog.baseapp

It's allowed and from what I know its the only way to reference a cfc
sitting in the web root. My example had the baseapp.cfc sitting in the
web root, not in a subdirectory.

> However, this second part is where Dependency Injection frameworks come in.

I'm updating my "From UDFs to CFCs" article to CF9 for the book and it
deals with the core concepts. No frameworks (yet). 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331153
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfcomponent inheritance path

2010-02-25 Thread Judah McAuley

On Thu, Feb 25, 2010 at 9:42 PM, Michael Dinowitz
 wrote:
>
> I'm just looking for verification on what I know about extending cfcs
> in the cfcomponent tag.
>
> Lets say for example I have a component called baseapp.cfc sitting in
> the web root. I also have an application.cfc in a directory named
> /blog. If I want the application.cfc to extend the baseapp.cfc, I have
> to use the following syntax:
>    extends="/.baseapp"

I haven't actually seen a forward slash used in any component paths, I
don't believe it is allowed. It should be a dot delimited path from
the webroot, so if your baseapp.cfc is in the directory blog under the
webroot, it should be referred to as blog.baseapp

> I didn't see anything in CF9 to change the need for this syntax. Is it
> possible I missed something? Is there a better way other than creating
> a mapping in the CF Admin or moving the extended file out of the root
> dir?
>
> Along the same lines of thought, is there a way to extend a component
> without knowing it's exact location? Lets say that the blog directory
> is now a subdirectory of /myapps. I want an application.cfc that is in
> /myapps/blog/admin to extend the application.cfc sitting one level up
> in /myapps/blog. I don't know if the blog directory is in the root of
> the site, in myapps, or in some other location. All I know is that the
> application.cfc I want to extend is one directory up. Is there a way
> to do relative inheritance?
>
> I expect the answer is no.
>
> Just double/triple/quadruple checking the basics of inheritance in ColdFusion.

As far as I'm aware, CF only does inheritance the way you have
covered, either through mappings or references relative to webroot.
However, this second part is where Dependency Injection frameworks
come in. With a DI framework (like Coldspring or Lightwire) you can
set up aliases and pathing and such and just tell your objects "go
fetch this thing and make sure that it is all properly set up". I use
the DI container baked into Coldbox so I'm not 100% up to speed on the
syntax for Coldspring and Lightwire, but I know they will do it.

I should mention, however, that as far as I'm aware, DI frameworks
don't really do inheritance, they do composition. There is a whole
school of discussion much greater than I about the merits of
inheritance vs composition, but most people seem to favor composition
over inheritance when possible. So, depending on your particular
situation, you might find that a framework like Coldspring will solve
all your problems in a very elegant fashion without having to resort
to inheritance.

Cheers,
Jud

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331152
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfcomponent inheritance path

2010-02-25 Thread Matt Quackenbush

When requesting a CFC (either by createObject() or extends=""), you must
supply a dot-notated path that is absolute to the web root.  For instance...

- /wwwroot
   baseapp.cfc
- - /blog
 myclass.cfc

For /blog/myclass.cfc to extend /baseapp.cfc it would be...

extends="baseapp"

You could, of course, use a mapping, but that just makes a path outside the
web root accessible (by CF internally) as though its residence was inside
the web root.  In other words, you'd still be calling an absolute path.

The bottom line is, relative paths do not work with CFCs.

HTH


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331151
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


cfcomponent inheritance path

2010-02-25 Thread Michael Dinowitz

I'm just looking for verification on what I know about extending cfcs
in the cfcomponent tag.

Lets say for example I have a component called baseapp.cfc sitting in
the web root. I also have an application.cfc in a directory named
/blog. If I want the application.cfc to extend the baseapp.cfc, I have
to use the following syntax:
extends="/.baseapp"

I didn't see anything in CF9 to change the need for this syntax. Is it
possible I missed something? Is there a better way other than creating
a mapping in the CF Admin or moving the extended file out of the root
dir?

Along the same lines of thought, is there a way to extend a component
without knowing it's exact location? Lets say that the blog directory
is now a subdirectory of /myapps. I want an application.cfc that is in
/myapps/blog/admin to extend the application.cfc sitting one level up
in /myapps/blog. I don't know if the blog directory is in the root of
the site, in myapps, or in some other location. All I know is that the
application.cfc I want to extend is one directory up. Is there a way
to do relative inheritance?

I expect the answer is no.

Just double/triple/quadruple checking the basics of inheritance in ColdFusion.

Thanks

--
Michael Dinowitz

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331150
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4