You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Greg Huber <gr...@gmail.com> on 2012/01/04 09:48:34 UTC

macros reloading from WEB-INF

Dave,

Here is a patch to get the macros to reload from the WEB-INF directory
(#parse(..)).  The normal way velocity does reloading not apply for
roller as the themes are stored in the
SharedThemeFormDirectory/WebsiteCustomTheme format and there is no
available mechanism for velocity to reload roller, even if we could
somehow workout if one file changed.

(See velocity tools WebappResourceLoader.java for inspiration)

##

To get it to work, disable caching >>
webapp.resource.loader.cache=false, and set  >>
velocimacro.library.autoreload=true.

velocity.properties
# for the loader we call 'webapp', use the WebappResourceLoader
webapp.resource.loader.description=Webapp Resource Loader
webapp.resource.loader.class=org.events.ui.rendering.velocity.WebappResourceLoader
#webapp.resource.loader.cache=true
webapp.resource.loader.cache=false
webapp.resource.loader.path=/WEB-INF/velocity,/WEB-INF/velocity/templates,/WEB-INF/velocity/templates/feeds,templates/weblog,templates/planet
webapp.resource.loader.modificationCheckInterval=2

# Change to false for deployment environments.
# Caching for the 'class' & 'webapp' ResourceLoaders must be false for
this to work
#velocimacro.library.autoreload=false
velocimacro.library.autoreload=true

##

Its driven from modifying the weblog theme, eg, change
WEB-INF/velocity/weblog.vm, then trigger the update by changing the
themes/basic/weblog.vm template (with theme reloading on, and logged
in!).

##

Java mods to get it to work:

Remove any paths from templates .vm called from the code and add them
to the velocity properties webapp.resource.loader.path.

searched on: templates/

##

We could also change the order:

resource.loader = webapp, theme, roller, class
to
resource.loader =  theme, roller, webapp, class

Which would reduce some checking.

##

Planet stuff, I have tried to do the required, but have not tested, as
do not have planet setup/running.

##

Should make the mobile theme dev a bit easier!

Cheers Greg

Re: macros reloading from WEB-INF

Posted by Greg Huber <gr...@gmail.com>.
Dave,

Where would the tabify be? (eclipse)

I have tested this version, the previous one had the wrong | separator, and
a incorrect package name.

This one with a save to the clipboard and then paste to the file.

Cheers Greg.

On 14 January 2012 20:21, Dave <sn...@gmail.com> wrote:
> It's kind of hard to review that patch because your editor seems to have
> changed spaces to tabs, so every line looks like a new line. Can you turn
> off that "tabify" behavior and create a new patch?
>
> - Dave
>
>
>
> On Wed, Jan 4, 2012 at 3:48 AM, Greg Huber <gr...@gmail.com> wrote:
>
>> Dave,
>>
>> Here is a patch to get the macros to reload from the WEB-INF directory
>> (#parse(..)).  The normal way velocity does reloading not apply for
>> roller as the themes are stored in the
>> SharedThemeFormDirectory/WebsiteCustomTheme format and there is no
>> available mechanism for velocity to reload roller, even if we could
>> somehow workout if one file changed.
>>
>> (See velocity tools WebappResourceLoader.java for inspiration)
>>
>> ##
>>
>> To get it to work, disable caching >>
>> webapp.resource.loader.cache=false, and set  >>
>> velocimacro.library.autoreload=true.
>>
>> velocity.properties
>> # for the loader we call 'webapp', use the WebappResourceLoader
>> webapp.resource.loader.description=Webapp Resource Loader
>>
>>
webapp.resource.loader.class=org.events.ui.rendering.velocity.WebappResourceLoader
>> #webapp.resource.loader.cache=true
>> webapp.resource.loader.cache=false
>>
>>
webapp.resource.loader.path=/WEB-INF/velocity,/WEB-INF/velocity/templates,/WEB-INF/velocity/templates/feeds,templates/weblog,templates/planet
>> webapp.resource.loader.modificationCheckInterval=2
>>
>> # Change to false for deployment environments.
>> # Caching for the 'class' & 'webapp' ResourceLoaders must be false for
>> this to work
>> #velocimacro.library.autoreload=false
>> velocimacro.library.autoreload=true
>>
>> ##
>>
>> Its driven from modifying the weblog theme, eg, change
>> WEB-INF/velocity/weblog.vm, then trigger the update by changing the
>> themes/basic/weblog.vm template (with theme reloading on, and logged
>> in!).
>>
>> ##
>>
>> Java mods to get it to work:
>>
>> Remove any paths from templates .vm called from the code and add them
>> to the velocity properties webapp.resource.loader.path.
>>
>> searched on: templates/
>>
>> ##
>>
>> We could also change the order:
>>
>> resource.loader = webapp, theme, roller, class
>> to
>> resource.loader =  theme, roller, webapp, class
>>
>> Which would reduce some checking.
>>
>> ##
>>
>> Planet stuff, I have tried to do the required, but have not tested, as
>> do not have planet setup/running.
>>
>> ##
>>
>> Should make the mobile theme dev a bit easier!
>>
>> Cheers Greg
>>
>
>
>
> --
> Dave M. Johnson
> Apache Roller PMC Chair
> http://rollerweblogger.org/roller

Re: macros reloading from WEB-INF

Posted by Dave <sn...@gmail.com>.
It's kind of hard to review that patch because your editor seems to have
changed spaces to tabs, so every line looks like a new line. Can you turn
off that "tabify" behavior and create a new patch?

- Dave



On Wed, Jan 4, 2012 at 3:48 AM, Greg Huber <gr...@gmail.com> wrote:

> Dave,
>
> Here is a patch to get the macros to reload from the WEB-INF directory
> (#parse(..)).  The normal way velocity does reloading not apply for
> roller as the themes are stored in the
> SharedThemeFormDirectory/WebsiteCustomTheme format and there is no
> available mechanism for velocity to reload roller, even if we could
> somehow workout if one file changed.
>
> (See velocity tools WebappResourceLoader.java for inspiration)
>
> ##
>
> To get it to work, disable caching >>
> webapp.resource.loader.cache=false, and set  >>
> velocimacro.library.autoreload=true.
>
> velocity.properties
> # for the loader we call 'webapp', use the WebappResourceLoader
> webapp.resource.loader.description=Webapp Resource Loader
>
> webapp.resource.loader.class=org.events.ui.rendering.velocity.WebappResourceLoader
> #webapp.resource.loader.cache=true
> webapp.resource.loader.cache=false
>
> webapp.resource.loader.path=/WEB-INF/velocity,/WEB-INF/velocity/templates,/WEB-INF/velocity/templates/feeds,templates/weblog,templates/planet
> webapp.resource.loader.modificationCheckInterval=2
>
> # Change to false for deployment environments.
> # Caching for the 'class' & 'webapp' ResourceLoaders must be false for
> this to work
> #velocimacro.library.autoreload=false
> velocimacro.library.autoreload=true
>
> ##
>
> Its driven from modifying the weblog theme, eg, change
> WEB-INF/velocity/weblog.vm, then trigger the update by changing the
> themes/basic/weblog.vm template (with theme reloading on, and logged
> in!).
>
> ##
>
> Java mods to get it to work:
>
> Remove any paths from templates .vm called from the code and add them
> to the velocity properties webapp.resource.loader.path.
>
> searched on: templates/
>
> ##
>
> We could also change the order:
>
> resource.loader = webapp, theme, roller, class
> to
> resource.loader =  theme, roller, webapp, class
>
> Which would reduce some checking.
>
> ##
>
> Planet stuff, I have tried to do the required, but have not tested, as
> do not have planet setup/running.
>
> ##
>
> Should make the mobile theme dev a bit easier!
>
> Cheers Greg
>



-- 
Dave M. Johnson
Apache Roller PMC Chair
http://rollerweblogger.org/roller