You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by as...@apache.org on 2006/02/24 04:11:42 UTC

svn commit: r380317 - in /jakarta/jcs/trunk: ant_eclipse.xml src/java/org/apache/jcs/config/OptionConverter.java src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java

Author: asmuts
Date: Thu Feb 23 19:11:41 2006
New Revision: 380317

URL: http://svn.apache.org/viewcvs?rev=380317&view=rev
Log:
I converted some of the configuration warnings to info logs.  If a default is used for the attributes class, we no longer log a warn.

added maven rmic to eclipse ant file

Modified:
    jakarta/jcs/trunk/ant_eclipse.xml
    jakarta/jcs/trunk/src/java/org/apache/jcs/config/OptionConverter.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java

Modified: jakarta/jcs/trunk/ant_eclipse.xml
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/ant_eclipse.xml?rev=380317&r1=380316&r2=380317&view=diff
==============================================================================
--- jakarta/jcs/trunk/ant_eclipse.xml (original)
+++ jakarta/jcs/trunk/ant_eclipse.xml Thu Feb 23 19:11:41 2006
@@ -32,6 +32,7 @@
 		<exec executable="${maven.script}" failonerror="true">
 			<arg value="java:jar-resources" />
 			<arg value="test:test-resources" />
+			<arg value="rmic" />
 		</exec>
 
 	</target>

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/config/OptionConverter.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/config/OptionConverter.java?rev=380317&r1=380316&r2=380317&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/config/OptionConverter.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/config/OptionConverter.java Thu Feb 23 19:11:41 2006
@@ -167,7 +167,10 @@
         String className = findAndSubst( key, props );
         if ( className == null )
         {
-            log.warn( "Could not find value for key " + key );
+            if ( log.isTraceEnabled() )
+            {
+                log.info( "Could not find value for key " + key );
+            }
             return defaultValue;
         }
         // Trim className to avoid trailing spaces that cause problems.

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java?rev=380317&r1=380316&r2=380317&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java Thu Feb 23 19:11:41 2006
@@ -38,11 +38,10 @@
 /**
  * This class configures JCS based on a properties object.
  * <p>
- * 
  * This class is based on the log4j class org.apache.log4j.PropertyConfigurator
  * which was made by: "Luke Blanshard" <Lu...@quiq.com>"Mark DONSZELMANN"
  * <Ma...@cern.ch>"Anders Kristensen" <ak...@dynamicsoft.com>
- *  
+ * 
  */
 public class CompositeCacheConfigurator
 {
@@ -118,6 +117,7 @@
      */
     public void doConfigure( Properties properties )
     {
+        long start = System.currentTimeMillis();
 
         // store props for use by non configured caches
         compositeCacheManager.props = properties;
@@ -135,6 +135,12 @@
         // setup preconfigured caches
         parseRegions( properties );
 
+        long end = System.currentTimeMillis();
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Finished configuration in " + ( end - start ) + " ms." );
+        }
+        
     }
 
     /**
@@ -147,7 +153,10 @@
         String value = OptionConverter.findAndSubst( DEFAULT_REGION, props );
         compositeCacheManager.defaultAuxValues = value;
 
-        log.info( "setting defaults to " + value );
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Setting default auxiliaries to " + value );
+        }
     }
 
     /**
@@ -206,11 +215,15 @@
         }
     }
 
-    /** Parse region elements. 
+    /**
+     * Parse region elements.
+     * 
      * @param props
      */
     protected void parseRegions( Properties props )
     {
+        List regionNames = new ArrayList();
+        
         Enumeration en = props.propertyNames();
         while ( en.hasMoreElements() )
         {
@@ -218,6 +231,9 @@
             if ( key.startsWith( REGION_PREFIX ) && ( key.indexOf( "attributes" ) == -1 ) )
             {
                 String regionName = key.substring( REGION_PREFIX.length() );
+                
+                regionNames.add( regionName );
+                
                 String value = OptionConverter.findAndSubst( key, props );
                 ICache cache;
                 synchronized ( regionName )
@@ -227,9 +243,17 @@
                 compositeCacheManager.caches.put( regionName, cache );
             }
         }
+        
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Parsed regions " + regionNames );
+        }
+        
     }
 
-    /** Create cache region. 
+    /**
+     * Create cache region.
+     * 
      * @param props
      * @param regName
      * @param value
@@ -285,7 +309,10 @@
 
         List auxList = new ArrayList();
 
-        log.debug( "Parsing region name '" + regName + "', value '" + value + "'" );
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Parsing region name '" + regName + "', value '" + value + "'" );
+        }
 
         // We must skip over ',' but not white space
         StringTokenizer st = new StringTokenizer( value, "," );
@@ -330,7 +357,9 @@
         return cache;
     }
 
-    /** Get an compositecacheattributes for the listed region. 
+    /**
+     * Get an compositecacheattributes for the listed region.
+     * 
      * @param props
      * @param regName
      * @return
@@ -356,13 +385,16 @@
         String attrName = regionPrefix + regName + CACHE_ATTRIBUTE_PREFIX;
 
         // auxFactory was not previously initialized.
-        //String prefix = regionPrefix + regName + ATTRIBUTE_PREFIX;
+        // String prefix = regionPrefix + regName + ATTRIBUTE_PREFIX;
         ccAttr = (ICompositeCacheAttributes) OptionConverter
             .instantiateByKey( props, attrName, org.apache.jcs.engine.behavior.ICompositeCacheAttributes.class, null );
 
         if ( ccAttr == null )
         {
-            log.warn( "Could not instantiate ccAttr named '" + attrName + "', using defaults." );
+            if ( log.isInfoEnabled() )
+            {
+                log.info( "No special CompositeCacheAttributes class defined for key [" + attrName + "], using default class." );
+            }
 
             ICompositeCacheAttributes ccAttr2 = compositeCacheManager.getDefaultCacheAttributes();
             ccAttr = ccAttr2.copy();
@@ -402,36 +434,49 @@
         String attrName = regionPrefix + regName + CompositeCacheConfigurator.ELEMENT_ATTRIBUTE_PREFIX;
 
         // auxFactory was not previously initialized.
-        //String prefix = regionPrefix + regName + ATTRIBUTE_PREFIX;
+        // String prefix = regionPrefix + regName + ATTRIBUTE_PREFIX;
         eAttr = (IElementAttributes) OptionConverter
             .instantiateByKey( props, attrName, org.apache.jcs.engine.behavior.IElementAttributes.class, null );
         if ( eAttr == null )
         {
-            log.warn( "Could not instantiate eAttr named '" + attrName + "', using defaults." );
+            if ( log.isInfoEnabled() )
+            {
+                log.info( "No special ElementAttribute class defined for key [" + attrName + "], using default class." );
+            }
 
             IElementAttributes eAttr2 = compositeCacheManager.getDefaultElementAttributes();
             eAttr = eAttr2.copy();
         }
 
-        log.debug( "Parsing options for '" + attrName + "'" );
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Parsing options for '" + attrName + "'" );
+        }
 
         PropertySetter.setProperties( eAttr, props, attrName + "." );
-        //eAttr.setCacheName( regName );
+        // eAttr.setCacheName( regName );
 
-        log.debug( "End of parsing for \"" + attrName + "\"." );
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "End of parsing for \"" + attrName + "\"." );
+        }
 
         // GET CACHE FROM FACTORY WITH ATTRIBUTES
-        //eAttr.setCacheName( regName );
+        // eAttr.setCacheName( regName );
         return eAttr;
     }
 
     /**
      * Get an aux cache for the listed aux for a region.
      * 
-     * @param cache the cache manager
-     * @param props the configuration propeties
-     * @param auxName the name of the auxiliary cache
-     * @param regName the name of the region.
+     * @param cache
+     *            the cache manager
+     * @param props
+     *            the configuration propeties
+     * @param auxName
+     *            the name of the auxiliary cache
+     * @param regName
+     *            the name of the region.
      * @return AuxiliaryCache
      */
     protected AuxiliaryCache parseAuxiliary( CompositeCache cache, Properties props, String auxName, String regName )
@@ -444,7 +489,7 @@
             // TODO change method signature if is isn't needed.
             log.debug( "parseAuxiliary, Cache = " + cache );
         }
-        
+
         // GET FACTORY
         AuxiliaryCacheFactory auxFac = compositeCacheManager.registryFacGet( auxName );
         if ( auxFac == null )



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