[gatein-commits] gatein SVN: r1974 - in portal/trunk: component/common and 6 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Mar 4 10:54:52 EST 2010
Author: julien_viet
Date: 2010-03-04 10:54:51 -0500 (Thu, 04 Mar 2010)
New Revision: 1974
Added:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/
portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/SimpleExoCacheCreator.java
Removed:
portal/trunk/component/scripting/src/main/java/conf/
Modified:
portal/trunk/component/common/pom.xml
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java
portal/trunk/pom.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
Log:
better cache confriguration
Modified: portal/trunk/component/common/pom.xml
===================================================================
--- portal/trunk/component/common/pom.xml 2010-03-04 14:37:07 UTC (rev 1973)
+++ portal/trunk/component/common/pom.xml 2010-03-04 15:54:51 UTC (rev 1974)
@@ -44,6 +44,10 @@
<artifactId>exo.kernel.commons</artifactId>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.exoplatform.core</groupId>
<artifactId>exo.core.component.database</artifactId>
</dependency>
Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/SimpleExoCacheCreator.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/SimpleExoCacheCreator.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/SimpleExoCacheCreator.java 2010-03-04 15:54:51 UTC (rev 1974)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.commons.cache;
+
+import org.exoplatform.services.cache.ExoCache;
+import org.exoplatform.services.cache.ExoCacheConfig;
+import org.exoplatform.services.cache.ExoCacheInitException;
+import org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache;
+import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
+import org.jboss.cache.Cache;
+
+import java.io.Serializable;
+
+/**
+ * Gives more flexibility in GateIn cache usage.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class SimpleExoCacheCreator implements ExoCacheCreator
+{
+ public ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> jbossCache) throws ExoCacheInitException
+ {
+ ExoCache<Serializable, Object> simple = new ConcurrentFIFOExoCache<Serializable, Object>();
+ simple.setName(config.getName());
+ simple.setLabel(config.getLabel());
+ simple.setMaxSize(config.getMaxSize());
+ simple.setLiveTime(config.getLiveTime());
+ return simple;
+ }
+
+ public Class<? extends ExoCacheConfig> getExpectedConfigType()
+ {
+ return ExoCacheConfig.class;
+ }
+
+ public String getExpectedImplementation()
+ {
+ return "simple";
+ }
+}
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java 2010-03-04 14:37:07 UTC (rev 1973)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java 2010-03-04 15:54:51 UTC (rev 1974)
@@ -60,13 +60,11 @@
private boolean cacheTemplate_ = true;
- public TemplateService(InitParams params, TemplateStatisticService statisticService, CacheService cservice)
- throws Exception
+ public TemplateService(TemplateStatisticService statisticService, CacheService cservice) throws Exception
{
- engine_ = new GroovyTemplateEngine();
+ this.engine_ = new GroovyTemplateEngine();
this.statisticService = statisticService;
- templatesCache_ = cservice.getCacheInstance(TemplateService.class.getName());
- getTemplatesCache().setLiveTime(10000);
+ this.templatesCache_ = cservice.getCacheInstance(TemplateService.class.getSimpleName());
}
public void merge(String name, BindingContext context) throws Exception
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2010-03-04 14:37:07 UTC (rev 1973)
+++ portal/trunk/pom.xml 2010-03-04 15:54:51 UTC (rev 1974)
@@ -127,6 +127,11 @@
<version>${org.exoplatform.kernel.version}</version>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.command</artifactId>
<version>${org.exoplatform.kernel.version}</version>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml 2010-03-04 14:37:07 UTC (rev 1973)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml 2010-03-04 15:54:51 UTC (rev 1974)
@@ -117,6 +117,17 @@
</component>
<component>
+ <key>org.exoplatform.services.cache.ExoCacheFactory</key>
+ <type>org.exoplatform.services.cache.impl.jboss.ExoCacheFactoryImpl</type>
+ <init-params>
+ <value-param>
+ <name>cache.config.template</name>
+ <value>classpath:/conf/jcr/jbosscache/cluster/config.xml</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
<key>org.exoplatform.commons.chromattic.ChromatticManager</key>
<type>org.exoplatform.commons.chromattic.ChromatticManager</type>
</component>
@@ -135,4 +146,70 @@
<type>org.exoplatform.management.RestManagementProvider</type>
</component>
+ <component>
+ <type>org.exoplatform.groovyscript.text.TemplateStatisticService</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>false</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.groovyscript.text.TemplateService</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>false</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.cache.ExoCacheFactory</target-component>
+ <component-plugin>
+ <name>addCreator</name>
+ <set-method>addCreator</set-method>
+ <type>org.exoplatform.services.cache.impl.jboss.ExoCacheCreatorPlugin</type>
+ <description>add Exo Cache Creator</description>
+ <init-params>
+ <object-param>
+ <name>LRU</name>
+ <description>The LRU cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheCreator"></object>
+ </object-param>
+ <object-param>
+ <name>simple</name>
+ <description>The Simple cache creator</description>
+ <object type="org.exoplatform.commons.cache.SimpleExoCacheCreator"></object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.cache.CacheService</target-component>
+ <component-plugin>
+ <name>addExoCacheConfig</name>
+ <set-method>addExoCacheConfig</set-method>
+ <type>org.exoplatform.services.cache.ExoCacheConfigPlugin</type>
+ <description>add Exo Cache Config</description>
+ <init-params>
+ <object-param>
+ <name>cache.config.TemplateService</name>
+ <description>The JBoss Cache LRU configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name">
+ <string>TemplateService</string>
+ </field>
+ <field name="liveTime">
+ <long>600000</long>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
</configuration>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2010-03-04 14:37:07 UTC (rev 1973)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2010-03-04 15:54:51 UTC (rev 1974)
@@ -194,17 +194,6 @@
</component-plugins>
</component>
- <component>
- <key>org.exoplatform.services.cache.ExoCacheFactory</key>
- <type>org.exoplatform.services.cache.impl.jboss.ExoCacheFactoryImpl</type>
- <init-params>
- <value-param>
- <name>cache.config.template</name>
- <value>classpath:/conf/jcr/jbosscache/cluster/config.xml</value>
- </value-param>
- </init-params>
- </component>
-
<external-component-plugins>
<target-component>org.exoplatform.services.organization.OrganizationService</target-component>
<component-plugin>
@@ -276,23 +265,6 @@
</external-component-plugins>
<external-component-plugins>
- <target-component>org.exoplatform.services.cache.ExoCacheFactory</target-component>
- <component-plugin>
- <name>addCreator</name>
- <set-method>addCreator</set-method>
- <type>org.exoplatform.services.cache.impl.jboss.ExoCacheCreatorPlugin</type>
- <description>add Exo Cache Creator</description>
- <init-params>
- <object-param>
- <name>LRU</name>
- <description>The LRU cache creator</description>
- <object type="org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheCreator"></object>
- </object-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
- <external-component-plugins>
<target-component>org.exoplatform.services.cache.CacheService</target-component>
<component-plugin>
<name>addExoCacheConfig</name>
@@ -319,6 +291,4 @@
</component-plugin>
</external-component-plugins>
-
-
</configuration>
More information about the gatein-commits
mailing list