You can configure the cache using a Properties object via the 
org.apache.jcs.engine.control.CompositeCacheManager.

Call:

CompositeCacheManager mgr = CompositeCacheManager.getUnconfiguredInstance()
Mgr.configure( properties );

Then use JCS the normal way:

JCS.getInstance( regionName );


Cheers,

Aaron

-----Original Message-----
From: xMySign for JCS [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 23, 2004 10:31 AM
To: Turbine JCS Developers List
Subject: Properties instead of config file

Hi 

I sent this almost 3 month before and I am interested in your comments about 
using Properties instead of a config file:

To set the config filename now on ehas to use th emethod setConfigFilename on 
org.apache.jcs.JCS It would be nice if there would be a second method on the 
JCS object which would allow it, to pass a Properties object instead of a 
filename. The problem which occurred in our web application is the following:
we need to parse the cache.ccf and set the paths for the file-cache on the 
startup of the servlet container.
in this case we need to write the cache.ccf after setting the paths to the file 
cache and pass then the filename of it with setConfigFilename to JCS. under 
some circumstances JCS now can't read the file (maybe it isn't written 
entirely?) and JCS gets a NullPointerException:

java.lang.NullPointerException
        at java.util.StringTokenizer.<init>(StringTokenizer.java:146)
        at java.util.StringTokenizer.<init>(StringTokenizer.java:162)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:272)
        at 
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:243)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:356)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:315)
        at 
org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:308)
        at org.apache.jcs.JCS.getInstance(JCS.java:103)

So if there's a way to pass the Properties object without writing it down to 
disk this would be great.
Maybe we can implement this in JCS, but we're not yet committer to the JCS 
project. What do the committers think about it?


best regards

Mike M�ller

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to