portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r724843 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java jetspeed-portal-resources/src/main/resources/assembly/cache.xml
Date Tue, 09 Dec 2008 19:28:24 GMT
Author: rwatler
Date: Tue Dec  9 11:28:24 2008
New Revision: 724843

URL: http://svn.apache.org/viewvc?rev=724843&view=rev
Log:
EhCache Configuration Cleanup
- accessed portal_configuration bean to pickup ehcache properties from jetspeed.properties/override.properties


Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/cache.xml

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java?rev=724843&r1=724842&r2=724843&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java
Tue Dec  9 11:28:24 2008
@@ -26,6 +26,10 @@
 import org.springframework.core.io.Resource;
 import org.springframework.beans.factory.InitializingBean;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.components.util.ConfigurationProperties;
+
 /**
  * EhCacheConfigResource
  * 
@@ -34,6 +38,8 @@
  */
 public class EhCacheConfigResource extends AbstractResource implements InitializingBean
 {
+    protected static Log log = LogFactory.getLog(EhCacheConfigResource.class);
+    
     // Constants
     
     public static final String EHCACHE_CONFIG_RESOURCE_PROP_NAME = "org.apache.jetspeed.ehcache.config.resource";
@@ -82,6 +88,7 @@
     
     // Members
 
+    private ConfigurationProperties configuration;
     private String defaultConfigResource;
     private boolean test;
     private String defaultGroupAddress;
@@ -102,6 +109,47 @@
      */
     public void afterPropertiesSet()
     {
+        // copy specified configuration settings
+        if (configuration != null)
+        {
+            if (configuration.getString(EHCACHE_CONFIG_RESOURCE_PROP_NAME) != null)
+            {
+                defaultConfigResource = configuration.getString(EHCACHE_CONFIG_RESOURCE_PROP_NAME);
+            }
+            if (configuration.getString(EHCACHE_GROUP_ADDRESS_PROP_NAME) != null)
+            {
+                defaultGroupAddress = configuration.getString(EHCACHE_GROUP_ADDRESS_PROP_NAME);
+            }
+            if (configuration.getString(EHCACHE_GROUP_PORT_PROP_NAME) != null)
+            {
+                defaultGroupPort = configuration.getString(EHCACHE_GROUP_PORT_PROP_NAME);
+            }
+            if (configuration.getString(EHCACHE_GROUP_TTL_PROP_NAME) != null)
+            {
+                defaultGroupTTL = configuration.getString(EHCACHE_GROUP_TTL_PROP_NAME);
+            }
+            if (configuration.getString(EHCACHE_HOSTNAME_PROP_NAME) != null)
+            {
+                defaultHostname = configuration.getString(EHCACHE_HOSTNAME_PROP_NAME);
+            }
+            if (configuration.getString(EHCACHE_PORT_PROP_NAME) != null)
+            {
+                defaultPort = configuration.getString(EHCACHE_PORT_PROP_NAME);
+            }
+            if (configuration.getString(EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_PROP_NAME) != null)
+            {
+                defaultPageManagerMaxElements = configuration.getString(EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_PROP_NAME);
+            }
+            if (configuration.getString(EHCACHE_PAGE_MANAGER_ELEMENT_TTL_PROP_NAME) != null)
+            {
+                defaultPageManagerElementTTL = configuration.getString(EHCACHE_PAGE_MANAGER_ELEMENT_TTL_PROP_NAME);
+            }
+            if (configuration.getString(EHCACHE_PAGE_MANAGER_MAX_FILES_PROP_NAME) != null)
+            {
+                defaultPageManagerMaxFiles = configuration.getString(EHCACHE_PAGE_MANAGER_MAX_FILES_PROP_NAME);
+            }
+        }
+        
         // set system properties used in global cache configuration
         if (System.getProperty(EHCACHE_CONFIG_RESOURCE_PROP_NAME) == null)
         {
@@ -153,7 +201,9 @@
         }
 
         // setup delegate ClassPathResource
-        classPathResource = new ClassPathResource(System.getProperty(EHCACHE_CONFIG_RESOURCE_PROP_NAME));
+        final String configResource = System.getProperty(EHCACHE_CONFIG_RESOURCE_PROP_NAME);
+        log.info("Configured with resource: "+configResource);
+        classPathResource = new ClassPathResource(configResource);
     }
     
     // AbstractResource implementation
@@ -215,6 +265,14 @@
     // Data access
         
     /**
+     * @param configuration the configuration to set
+     */
+    public void setConfiguration(ConfigurationProperties configuration)
+    {
+        this.configuration = configuration;
+    }
+
+    /**
      * @param defaultConfigResource the defaultConfigResource to set
      */
     public void setDefaultConfigResource(String defaultConfigResource)

Modified: portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/cache.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/cache.xml?rev=724843&r1=724842&r2=724843&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/cache.xml
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/cache.xml
Tue Dec  9 11:28:24 2008
@@ -21,6 +21,7 @@
     <!-- Cache Manager -->
     <bean id="cacheManagerConfig" class="org.apache.jetspeed.cache.impl.EhCacheConfigResource">
         <meta key="j2:cat" value="default,cache"/>
+        <property name="configuration" ref="portal_configuration"/>
         <property name="defaultConfigResource" value="ehcache.xml"/>
     </bean>
 



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


Mime
View raw message