jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Carmichael <to...@concur.com>
Subject [PATCH] Changing behavior of jcs.default.elementattributes
Date Mon, 31 Mar 2003 17:05:55 GMT
In my case, my cache.ccf has several pre-defined regions so that I can
define the size of the cache, the algorithm, etc.  However, in these
pre-defined regions, I did not specify values for all elementattributes just
the class name.  In this case, all other default values specified by the
jcs.default.elementattributes entries in the cache.ccf are ignored and the
values that are hard coded in the class
org.apache.jcs.engine.ElementAttributes are used.  I have not tested the
case where you create a region on the fly (no pre-defined region) but I
don't see any other path in the code that would set these defaults from the
property file.   

I do see that you could specify a different class for this property then you
could setup your own default values.  If that is the intented mechansim for
controlling default values then this patch may not be desirable.  However, I
find it much easier to control these default values through the property
file.  I have not had a different need to create a new elementattribute
class yet.  

Here is the cvs diff -u output :

Index: CompositeCacheConfigurator.java
RCS file:
retrieving revision
diff -u -r1.1.1.1 CompositeCacheConfigurator.java
--- CompositeCacheConfigurator.java	21 Mar 2003 18:28:54 -0000
+++ CompositeCacheConfigurator.java	31 Mar 2003 17:01:12 -0000
@@ -311,19 +311,8 @@
         String attrName = regionPrefix + regName +
-        // auxFactory was not previously initialized.
-        //String prefix = regionPrefix + regName + ATTRIBUTE_PREFIX;
-        eAttr = ( IElementAttributes ) OptionConverter.instantiateByKey(
props, attrName,
null );
-        if ( eAttr == null )
-        {
-            log.warn( "Could not instantiate eAttr named '" + attrName +
-                      "', using defaults." );
-            IElementAttributes eAttr2 =
-            eAttr = eAttr2.copy();
-        }
+        IElementAttributes eAttr2 = ccMgr.getDefaultElementAttributes();
+        eAttr = eAttr2.copy();
         log.debug( "Parsing options for '" + attrName + "'" );

-----Original Message-----
From: Baum, Karl [mailto:Karl.Baum@Tallan.com] 
Sent: Saturday, March 29, 2003 8:32 PM
To: 'Turbine JCS Developers List'
Subject: RE: Changing behavior of jcs.default.elementattributes

So you are saying that specifying default attributes in the cache.ccf does
not affect the configuration of any of the regions?  If this is the case,
then I think there is a definite need for this patch.  

-----Original Message-----
From: Todd Carmichael [mailto:toddc@concur.com] 
Sent: Friday, March 28, 2003 1:38 PM
To: 'Turbine JCS Developers List'
Subject: Changing behavior of jcs.default.elementattributes

I have been debugging and trying to get the lateral cache to work and I have
a documentation bug and implementation question (possibly a bug) that I
would like the team to consider.

1.  In the documentation on how to setup the properties for a lateral cache,
the following string is used to identify the class implementing the lateral

.stratum should be removed.  This applies to all the documentation on the
property files.  

2.  In the property file for the Basic Web example, the cache.ccf file has
entries for element attributes like such:


Are these intended to be default values for elementattributes all the
regions?  If so, it doesn't work that way.  Each region gets the default
values for element attributes specified by the initialization values for the
property in the ElementAttributesClass.  It could work that way if the
method parseElementAttributes in the class
org.apache.jcs.engine.control.CompositeCacheConfigurator was changed to be
the following:

    protected IElementAttributes
        parseElementAttributes( Properties props,
                                String regName,
                                String regionPrefix )
        IElementAttributes eAttr;

        String attrName = regionPrefix + regName +

        // auxFactory was not previously initialized.
        //String prefix = regionPrefix + regName + ATTRIBUTE_PREFIX;
        IElementAttributes eAttr2 = ccMgr.getDefaultElementAttributes();
        eAttr = eAttr2.copy();

        PropertySetter.setProperties( eAttr, props, attrName + "." );

Then, each region would get default values and could override defaults by
specifying a new value in their region.  

Consider the above a patch if someone wants it.  


To unsubscribe, e-mail: turbine-jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-dev-help@jakarta.apache.org

View raw message