cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <gkossakow...@apache.org>
Subject Re: Is EHDefaultStore using ehcache.xml?
Date Sun, 13 Jan 2008 01:03:01 GMT
Peter Wyngaard pisze:
> I think the answer is "no", and here's why:
> 
>  
> 
> I am using ExpiresCachingProcessingPipeline for an internal-only
> pipeline that provides read-only access to a set of objects from our
> database.  Many of the SQL Transformer queries are rather expensive,
> hence the caching.
> 
>  
> 
> One of the things I wanted to spike was the concept of creating a
> persistent ehcache file that could be built and used on a laptop in
> situations where access to our database was either too slow to be
> practical, or simple impossible.  At first glance, it looked like Cocoon
> 2.2 was going to make this easy, as I could create a custom ehcache.xml
> file in org.apache.cocoon.componets.store.impl, do something to prime
> the cache, then I'd have a couple of portable ehcache flatfiles with a
> subset of our database I could carry around on a laptop.

Very nice idea.

> Ran into a few roadblocks.  One I'll mention here, and one in a separate
> message.

[...]

> The EHDefaultStore bean is created by Spring in
> cocoon-store-impl-ehcache.xml, and named
> "org.apache.excalibur.store.Store".  The bean is created with the
> following properties:
> 
>  
> 
>     <property name="maxMemObjects"
> value="${org.apache.cocoon.store.maxobjects}"/>
> 
>     <property name="useCacheDirectory"
> value="${org.apache.cocoon.store.use-cache-directory}"/>
> 
>     <property name="settings"
> ref="org.apache.cocoon.configuration.Settings"/>
> 
>  
> 
> And those two variables come from cocoon-store-impl.properties, and are
> set to:
> 
>  
> 
> org.apache.cocoon.store.maxobjects=1000
> 
> org.apache.cocoon.store.use-cache-directory=true
> 
>  
> 
> by default.
> 
>  
> 
> So my questions:
> 
>  
> 
> * Am I supposed to create my own custom cocoon-store-impl-ehcache.xml
> and cocoon-store-impl.properties file, and set all the various ehcache
> parameters that way?

No and no but it's the right direction at all. All you have to do is to create a properties
file and
put it into /META-INF/cocoon/properties/ directory of your block. The name of this file should
be
chosen in a way that it's after cocoon-store-impl.properties file name when alphabetic order
is
considered so you can be sure that your file will really override default property values,
see[1]
for details.

Then, if you want to override properties of Spring bean that is not configured using properties
file
you need to create another properties file but put into /META-INF/cocoon/spring directory
this time.
The syntax for overriding bean properties is explained here[2].

This way you will get full control over EHCache configuration.

> 
> * Or, should EHDefaultStore be modified to allow the ehcache
> CacheManager to create caches using the defaults it reads from ehcache.xml?

The recommended way is to pass configurating using bean's properties because it enables such
useful
features as property overriding mentioned above.

> 
> My question:  what is the correct solution?

I hope that I helped you a little bit.

[1] http://cocoon.apache.org/subprojects/configuration/1.0/spring-configurator/1.0/1310_1_1.html
[2] http://cocoon.apache.org/subprojects/configuration/1.0/spring-configurator/1.0/1312_1_1.html

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message