[jboss-svn-commits] JBL Code SVN: r25683 - in labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src: main/resources and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Mar 17 06:01:38 EDT 2009
Author: lkrzyzanek
Date: 2009-03-17 06:01:37 -0400 (Tue, 17 Mar 2009)
New Revision: 25683
Added:
labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/resources/cache-config.xml
Modified:
labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManager.java
labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/resources/spring.xml
labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/test/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManagerTest.java
Log:
added Coherence caching
Modified: labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManager.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManager.java 2009-03-17 10:00:16 UTC (rev 25682)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManager.java 2009-03-17 10:01:37 UTC (rev 25683)
@@ -35,6 +35,7 @@
import com.jivesoftware.community.Document;
import com.jivesoftware.community.DocumentState;
+import com.jivesoftware.community.cache.Cache;
import com.jivesoftware.community.event.DocumentEvent;
import com.jivesoftware.community.event.DocumentListener;
@@ -53,7 +54,7 @@
* Key is DocumentID<br>
* Value is HF URL Title
*/
- private Map<String, String> hfURLCache;
+ private Cache<String, String> hfURLCache;
private HFURLDAO hfURLDAO;
@@ -92,7 +93,7 @@
public void updateIndex() {
hfURLDAO.updateIndex();
- // TODO clear cache
+ hfURLCache.clear();
}
public List<String> getDocumentID(String hfURLTitle) {
@@ -243,7 +244,7 @@
this.hfURLDAO = hfURLDAO;
}
- public void setHfURLCache(Map<String, String> hfURLCache) {
+ public void setHfURLCache(Cache<String, String> hfURLCache) {
this.hfURLCache = hfURLCache;
}
Added: labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/resources/cache-config.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/resources/cache-config.xml (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/resources/cache-config.xml 2009-03-17 10:01:37 UTC (rev 25683)
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!DOCTYPE cache-config SYSTEM "cache-config.dtd">
+
+
+ <!--
+ Definition doesn't work in version 2.5.2. This definition have to
+ be put to the WEB-INF/classes/coherence-cache-conf.xml
+ -->
+
+<cache-config>
+ <cache-mapping>
+ <cache-name>Human friendly URLs index</cache-name>
+ <scheme-name>default-near</scheme-name>
+ <init-params>
+ <init-param>
+ <param-name>back-size-high</param-name>
+ <param-value>131072</param-value>
+ </init-param>
+ <init-param>
+ <param-name>back-expiry</param-name>
+ <param-value>6h</param-value>
+ </init-param>
+ <init-param>
+ <param-name>back-size-low</param-name>
+ <param-value>117965</param-value>
+ </init-param>
+ </init-params>
+ </cache-mapping>
+</cache-config>
Property changes on: labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/resources/cache-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/resources/spring.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/resources/spring.xml 2009-03-17 10:00:16 UTC (rev 25682)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/resources/spring.xml 2009-03-17 10:01:37 UTC (rev 25683)
@@ -15,25 +15,21 @@
<property name="hfURLManager" ref="hfURLManager" />
</bean>
- <!--
- <bean id="hfURLCache" parent="cacheBean"
- depends-on="cacheFactoryManager"> <constructor-arg value="Human
- friendly URLs Map" /> </bean>
- -->
+ <bean id="hfURLCache" parent="cacheBean" depends-on="cacheFactoryManager">
+ <constructor-arg value="Human friendly URLs index" />
+ </bean>
<bean id="hfURLManager" class="org.jboss.labs.clearspace.plugin.hfurl.DbHFURLManager">
- <property name="hfURLCache">
- <map>
- </map>
+ <property name="hfURLCache" ref="hfURLCache">
</property>
<property name="hfURLDAO" ref="hfURLDAO" />
</bean>
- <bean id="hfURLDAO"
- class="org.jboss.labs.clearspace.plugin.hfurl.dao.DbHFURLDAOImpl">
- <property name="dataSource">
- <util:property-path path="dataSourceFactory.dataSource" />
- </property>
- </bean>
+ <bean id="hfURLDAO"
+ class="org.jboss.labs.clearspace.plugin.hfurl.dao.DbHFURLDAOImpl">
+ <property name="dataSource">
+ <util:property-path path="dataSourceFactory.dataSource" />
+ </property>
+ </bean>
</beans>
Modified: labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/test/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManagerTest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/test/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManagerTest.java 2009-03-17 10:00:16 UTC (rev 25682)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/test/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManagerTest.java 2009-03-17 10:01:37 UTC (rev 25683)
@@ -23,9 +23,7 @@
import static org.junit.Assert.assertEquals;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jboss.labs.clearspace.plugin.hfurl.dao.HFURLBean;
import org.jboss.labs.clearspace.plugin.hfurl.dao.HFURLDAO;
@@ -34,6 +32,8 @@
import org.springframework.dao.EmptyResultDataAccessException;
import com.jivesoftware.base.database.dao.DAOException;
+import com.jivesoftware.community.cache.Cache;
+import com.jivesoftware.community.cache.CoherenceCache;
/**
* Test of DbHFURLManager
@@ -45,13 +45,13 @@
private DbHFURLManager hfURLManager;
- private Map<String, String> hfURLCache;
+ private Cache<String, String> hfURLCache;
@Before
public void setupHFURLManager() {
hfURLManager = new DbHFURLManager();
- hfURLCache = new HashMap<String, String>();
+ hfURLCache = new CoherenceCache();
hfURLCache.put("DOC-1234", "documentwithfriendlyurl");
hfURLCache.put("DOC-2345", "documentwithfriendlyurl2");
More information about the jboss-svn-commits
mailing list