A better link:

http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/per-application-mappings-253

-----Original Message-----
From: Hayes, Joseph D. (JSC-IS)[TESSADA & ASSOC INC] 
Sent: Tuesday, May 18, 2010 12:08 PM
To: Mach-II for CFML
Subject: RE: [Mach-II] How To Share Code Between Applications

You might be able to accomplish this with per-application mappings.

http://www.forta.com/blog/index.cfm/2008/12/14/ColdFusion-Per-Application-Settings-v2
http://coldfusion8.blogspot.com/2008/03/per-app-settings-example.html

You may still have to touch CoreApp do get this working though (e.g. add a 
prefix to each component instantiation in CoreApp, then in both apps add a 
corresponding per application mapping that maps to the correct location).

For example, we've used the following to provide an absolute path prefix for 
our component instantiations, while still providing portability (if you move 
the app or create a copy of the code, the prefix then maps to the new location).

<!--- In Application.cfc: --->
<cfset this.mappings["/root"] = getDirectoryFromPath(getCurrentTemplatePath()) 
/>

<!--- In Mach-II config: --->
<listener name="userListener" 
type="root.components.listeners.user.UserListener" />


- Joe
 
-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Mike
Sent: Tuesday, May 18, 2010 10:31 AM
To: Mach-II for CFML
Subject: [Mach-II] How To Share Code Between Applications

Hi guys,

As the subject says, I'm looking for guidance on how to share a core
codebase between applications.  This looked promising
http://trac.mach-ii.com/machii/wiki/HowToShareCodeBetweenApplications
(and so did the conversation here on google groups that spawned the
entry) but it didn't get finished so I tried some stuff on my own and
have run into roadblocks.  I've searched and searched and have not
been able to find any clear picture of how to accomplish exactly what
I'm after, but I think it's a relatively common approach.

For reference I'm using Mach II 1.8.

I have a core application that runs on its own...let's call it
CoreApp.  Amongst other things, CoreApp handles all things "user":
logins, roles, addresses, etc..  For the sake of simplicity, let's
pretend that's all CoreApp does.

I now have another application - let's call it OtherApp - in which I
would like to reuse the "user" functionality from CoreApp.  So a user
hitting OtherApp looking to login would actually use the logic defined
in CoreApp.

What I thought would be the best way to accomplish this was to include
my CoreApp mach-ii.xml file in my OtherApp mach-ii.xml file so my
CoreApp listeners and events would be accessible.  The immediate
problem is that these applications are in different directories, and
the dot.paths are relative to the webroot for the specific app (e.g.
model.user.user exists in /root/CoreApp/model/user/ and that call
works fine from within CoreApp itself, but loading it into OtherApp
means that nothing can be found as it looks in /root/OtherApp/model/
user/ which doesn't exist).

I guess in the first instance, my question is: is there some simple
property that I'm overlooking here that would allow me to make calls
to my included CoreApp as if the objects were local to OtherApp from
within OtherApp itself?  What I mean is, can my call to CoreApp's
model.user.user from within OtherApp automatically be mapped to
CoreApp.model.user.user?

I suspect I can rejig my CoreApp to operate using absolute calls
inside of itself (instead of model.user.user use
CoreApp.model.user.user), but is that my only solution?

Any direct help you can provide would obviously be fantastic, but
failing that if you have a link or two that you think would help
please don't hesitate!  Anything at all will be appreciated!!

Thanks,
Mike


-- 
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

***New URLs as of April 29th, 2010***
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

-- 
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

***New URLs as of April 29th, 2010***
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to