Re: any way to flag files that where replacements occured ?

Daniel Dekany <[email protected]> Wed, 3 Nov 2004 21:23:25 +0100
Newsgroups gmane.comp.text.fmpp
Message-ID <[email protected]>
Wednesday, November 3, 2004, 7:29:25 PM, Erich Oliphant wrote:

> At this point just detecting the fact that a file was infact changed 
> (had interpolations) would be sufficient.   At install time, I just want 
> to save off originals that have interpolations so that an install set 
> can be updated if there are parameter/variable changes.   The actual 
> variable is a nice to have but not necessary now.  With the exception of 
> this issue FMPP seems to meet all of my other requirements.  If you 
> could point me in the right direction, I'd be more than happy to work on 
> a hack and send it back to you so that you can decide whether or not to 
> include it in your next version.

I believe the place to start is Template.getRootTreeNode(). AFAIK this
provides access to the "abstract syntax tree" of the template. By
traversing that tree you can find out if what directives it uses, and it
it uses interpolations. I don't know that API, but you may look into the
FreeMarker sourcecode or ask about it on the FreeMarker developer list
if you stuck with it. (Also, the FreeMarker Eclipse pluging can
visualize the template tree based on this, so you may look into that...)

Now, about the FMPP integration... For obvious reasons it is not
possible in general to find out based on this if a template actually
contains dynamism, however for a particular application it may works.
Also, this feature is special enough. So I don't think it will be
out-of-the-box feature, but a "hook" can be added where you can plug
whatever custom Template investigation via a custom class. So this could
be an option like --before-template-execution=<className>. This hook
class should examine the Template object, and send feedback to the
embedding software (the installer system in your case) inform it: "Hey,
the X file contains interpolations.". The consumer of these feedback
messages may be made accessible with an Engine attribute (see in the
JavaDocs) for the hook object.

Then... I don't think you should invest too much into the FMPP part. On
the 11th November I have a deadline, and then certainly I will be free
for a while. I will have to do some higher priority OS tasks first, but
I guess I will start to work on the next FMPP release soon after the
deadline... so you may survive with whatever ugly (non-generalized) hack
until that.

-- 
Best regards,
 Daniel Dekany


____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click