svnno****@sourc*****
svnno****@sourc*****
2009年 3月 11日 (水) 11:13:53 JST
Revision: 1791 http://svn.sourceforge.jp/view?root=pal&view=rev&rev=1791 Author: sone Date: 2009-03-11 11:13:53 +0900 (Wed, 11 Mar 2009) Log Message: ----------- Undoing change committed in r1785, r1786, r1787, r1789 Modified Paths: -------------- pal-portal/branches/pal-portal-1.x/installer/etc/database/build.xml pal-portal/branches/pal-portal-1.x/installer/etc/database/import/assembly/import-page-manager.xml pal-portal/branches/pal-portal-1.x/installer/etc/database/import/import.properties pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/.classpath pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedImpl.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheImpl.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/test/org/apache/jetspeed/cache/TestContentCache.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/test/org/apache/jetspeed/cache/TestDecorationContentCache.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/project.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManagerCache.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/database-page-manager.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/interceptors.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/org/apache/jetspeed/page/TestTransactions.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/secure-database-page-manager.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/secure-permissions-database-page-manager.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/test/org/apache/jetspeed/container/state/TestNavigationalState.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/core-build.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/db-ojb/ehcache.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/assembly/import-page-manager.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/build.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/export.properties pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/import.properties pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/cache/JetspeedCache.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/maven.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/src/webapp/WEB-INF/assembly/alternate/db-page-manager.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/src/webapp/WEB-INF/assembly/cache.xml Added Paths: ----------- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/tx-page-manager.xml Removed Paths: ------------- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManagerCacheObject.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/database-page-manager-base.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/distributed-ehcache.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/ehcache.xml pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/log4j-stdout.properties pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/org/apache/jetspeed/page/cache/ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/db-ojb/distributed-ehcache.xml -------------- next part -------------- Modified: pal-portal/branches/pal-portal-1.x/installer/etc/database/build.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/installer/etc/database/build.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/installer/etc/database/build.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -343,7 +343,6 @@ <fileset dir="${jetspeedWebinfDir}" > <include name="assembly/transaction.xml"/> <include name="assembly/alternate/interceptors.xml"/> - <include name="assembly/cache.xml"/> </fileset> </copy> Modified: pal-portal/branches/pal-portal-1.x/installer/etc/database/import/assembly/import-page-manager.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/installer/etc/database/import/assembly/import-page-manager.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/installer/etc/database/import/assembly/import-page-manager.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -44,14 +44,14 @@ class="org.apache.jetspeed.page.impl.DatabasePageManager"> <!-- OJB configuration file resource path --> <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg> + <!-- folder/page/link cache size, default=128, min=128 --> + <constructor-arg index="1"><value>128</value></constructor-arg> + <!-- folder/page/link cache expires seconds, default=150, infinite=0, min=30 --> + <constructor-arg index="2"><value>0</value></constructor-arg> <!-- permissions security enabled flag, default=false --> - <constructor-arg index="1"><value>false</value></constructor-arg> + <constructor-arg index="3"><value>false</value></constructor-arg> <!-- constraints security enabled flag, default=true --> - <constructor-arg index="2"><value>false</value></constructor-arg> - <!-- folder/page/link cache --> - <constructor-arg index="3"><ref bean="pageManagerOidCache"/></constructor-arg> - <!-- folder/page/link path cache --> - <constructor-arg index="4"><ref bean="pageManagerPathCache"/></constructor-arg> + <constructor-arg index="4"><value>false</value></constructor-arg> </bean> <!-- Proxying --> Modified: pal-portal/branches/pal-portal-1.x/installer/etc/database/import/import.properties =================================================================== --- pal-portal/branches/pal-portal-1.x/installer/etc/database/import/import.properties 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/installer/etc/database/import/import.properties 2009-03-11 02:13:53 UTC (rev 1791) @@ -1,7 +1,7 @@ # comma-separated list of boot assemblies for Spring boot.assemblies = repository-datasource-spring.xml # comma-separated list of assemblies for Spring -assemblies = import-page-manager.xml, transaction.xml, interceptors.xml, cache.xml +assemblies = import-page-manager.xml, transaction.xml, interceptors.xml # root folder to start exporting from root.folder = / # overwrite folders flag, set to true to replace existing folders Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/.classpath =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/.classpath 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/.classpath 2009-03-11 02:13:53 UTC (rev 1791) @@ -108,6 +108,5 @@ <classpathentry kind="var" path="MAVEN_REPO/asm/jars/asm-2.2.jar"/> <classpathentry kind="var" path="MAVEN_REPO/asm/jars/asm-attrs-2.2.jar"/> <classpathentry kind="var" path="MAVEN_REPO/commonj/jars/commonj-twm-1.1.jar"/> - <classpathentry kind="var" path="MAVEN_REPO/commons-jexl/jars/commons-jexl-1.1.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Deleted: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheConfigResource.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -1,400 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.jetspeed.cache.impl; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - -import org.apache.commons.configuration.PropertiesConfiguration; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.core.io.AbstractResource; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; - -/** - * EhCacheConfigResource - * - * @author <a href="mailto:rwatl****@apach*****">Randy Watler</a> - * @version $Id: $ - */ -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"; - - public static final String EHCACHE_CONFIG_RESOURCE_DEFAULT = "ehcache.xml"; - - public static final String EHCACHE_CONFIG_RESOURCE_DISTRIBUTED_CACHE = "distributed-ehcache.xml"; - - public static final String EHCACHE_GROUP_ADDRESS_PROP_NAME = "org.apache.jetspeed.ehcache.group.address"; - - public static final String EHCACHE_GROUP_ADDRESS_DEFAULT = "230.0.0.1"; - - public static final String EHCACHE_GROUP_PORT_PROP_NAME = "org.apache.jetspeed.ehcache.group.port"; - - public static final String EHCACHE_GROUP_PORT_DEFAULT = "4446"; - - public static final String EHCACHE_GROUP_TTL_PROP_NAME = "org.apache.jetspeed.ehcache.group.ttl"; - - public static final String EHCACHE_GROUP_TTL_DEFAULT = "1"; - - public static final String EHCACHE_GROUP_TTL_TEST_DEFAULT = "0"; - - public static final String EHCACHE_HOSTNAME_PROP_NAME = "org.apache.jetspeed.ehcache.hostname"; - - public static final String EHCACHE_HOSTNAME_DEFAULT = ""; - - public static final String EHCACHE_HOSTNAME_TEST_DEFAULT = "localhost"; - - public static final String EHCACHE_PORT_PROP_NAME = "org.apache.jetspeed.ehcache.port"; - - public static final String EHCACHE_PORT_DEFAULT = "40001"; - - public static final String EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_LEGACY_PROP_NAME = "db.page.manager.cache.size"; - - public static final String EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_PROP_NAME = "org.apache.jetspeed.ehcache.pagemanager.maxelements"; - - public static final String EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_DEFAULT = "128"; - - public static final String EHCACHE_PAGE_MANAGER_ELEMENT_TTL_LEGACY_PROP_NAME = "db.page.manager.cache.expire"; - - public static final String EHCACHE_PAGE_MANAGER_ELEMENT_TTL_PROP_NAME = "org.apache.jetspeed.ehcache.pagemanager.element.ttl"; - - public static final String EHCACHE_PAGE_MANAGER_ELEMENT_TTL_DEFAULT = "150"; - - // Singleton implementation - - private static EhCacheConfigResource instance; - - public static EhCacheConfigResource getInstance( - final String defaultConfigResource, final boolean test) - { - // construct and return a default instance - if (instance == null) - { - instance = new EhCacheConfigResource(); - instance.setDefaultConfigResource(defaultConfigResource); - instance.setTest(test); - instance.afterPropertiesSet(); - } - return instance; - } - - // Members - - private PropertiesConfiguration configuration; - - private String defaultConfigResource; - - private boolean test; - - private String defaultGroupAddress; - - private String defaultGroupPort; - - private String defaultGroupTTL; - - private String defaultHostname; - - private String defaultPort; - - private String defaultPageManagerMaxElements; - - private String defaultPageManagerElementTTL; - - private ClassPathResource classPathResource; - - // InitializingBean implementation - - /* (non-Javadoc) - * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() - */ - 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); - } - } - - // set system properties used in global cache configuration - if (System.getProperty(EHCACHE_CONFIG_RESOURCE_PROP_NAME) == null) - { - System.setProperty(EHCACHE_CONFIG_RESOURCE_PROP_NAME, - ((defaultConfigResource != null) ? defaultConfigResource - : EHCACHE_CONFIG_RESOURCE_DEFAULT)); - } - if (System.getProperty(EHCACHE_GROUP_ADDRESS_PROP_NAME) == null) - { - System.setProperty(EHCACHE_GROUP_ADDRESS_PROP_NAME, - ((defaultGroupAddress != null) ? defaultGroupAddress - : EHCACHE_GROUP_ADDRESS_DEFAULT)); - } - if (System.getProperty(EHCACHE_GROUP_PORT_PROP_NAME) == null) - { - System.setProperty(EHCACHE_GROUP_PORT_PROP_NAME, - ((defaultGroupPort != null) ? defaultGroupPort - : EHCACHE_GROUP_PORT_DEFAULT)); - } - if (System.getProperty(EHCACHE_GROUP_TTL_PROP_NAME) == null) - { - System.setProperty(EHCACHE_GROUP_TTL_PROP_NAME, - ((defaultGroupTTL != null) ? defaultGroupTTL - : (test ? EHCACHE_GROUP_TTL_TEST_DEFAULT - : EHCACHE_GROUP_TTL_DEFAULT))); - } - if (System.getProperty(EHCACHE_HOSTNAME_PROP_NAME) == null) - { - System.setProperty(EHCACHE_HOSTNAME_PROP_NAME, - ((defaultHostname != null) ? defaultHostname - : (test ? EHCACHE_HOSTNAME_TEST_DEFAULT - : EHCACHE_HOSTNAME_DEFAULT))); - } - if (System.getProperty(EHCACHE_PORT_PROP_NAME) == null) - { - System - .setProperty(EHCACHE_PORT_PROP_NAME, - ((defaultPort != null) ? defaultPort - : EHCACHE_PORT_DEFAULT)); - } - - // set system properties used in page manager cache configuration - if (System.getProperty(EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_PROP_NAME) == null) - { - String pageManagerMaxElements = ((defaultPageManagerMaxElements != null) ? defaultPageManagerMaxElements - : System.getProperty( - EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_LEGACY_PROP_NAME, - EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_DEFAULT)); - if ((pageManagerMaxElements != null) - && (Integer.parseInt(pageManagerMaxElements) < 0)) - { - pageManagerMaxElements = EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_DEFAULT; - } - System.setProperty(EHCACHE_PAGE_MANAGER_MAX_ELEMENTS_PROP_NAME, - pageManagerMaxElements); - } - if (System.getProperty(EHCACHE_PAGE_MANAGER_ELEMENT_TTL_PROP_NAME) == null) - { - String pageManagerElementTTL = ((defaultPageManagerElementTTL != null) ? defaultPageManagerElementTTL - : System.getProperty( - EHCACHE_PAGE_MANAGER_ELEMENT_TTL_LEGACY_PROP_NAME, - EHCACHE_PAGE_MANAGER_ELEMENT_TTL_DEFAULT)); - if ((pageManagerElementTTL != null) - && (Integer.parseInt(pageManagerElementTTL) < 0)) - { - pageManagerElementTTL = EHCACHE_PAGE_MANAGER_ELEMENT_TTL_DEFAULT; - } - System.setProperty(EHCACHE_PAGE_MANAGER_ELEMENT_TTL_PROP_NAME, - pageManagerElementTTL); - } - - // setup delegate ClassPathResource - final String configResource = System - .getProperty(EHCACHE_CONFIG_RESOURCE_PROP_NAME); - log.info("Configured with resource: " + configResource); - classPathResource = new ClassPathResource(configResource); - } - - // AbstractResource implementation - - /* (non-Javadoc) - * @see org.springframework.core.io.AbstractResource#createRelative(java.lang.String) - */ - public Resource createRelative(String relativePath) throws IOException - { - // delegate to ClassPathResource - return classPathResource.createRelative(relativePath); - } - - /* (non-Javadoc) - * @see org.springframework.core.io.AbstractResource#getFile() - */ - public File getFile() throws IOException - { - // delegate to ClassPathResource - return classPathResource.getFile(); - } - - /* (non-Javadoc) - * @see org.springframework.core.io.AbstractResource#getFilename() - */ - public String getFilename() throws IllegalStateException - { - // delegate to ClassPathResource - return classPathResource.getFilename(); - } - - /* (non-Javadoc) - * @see org.springframework.core.io.AbstractResource#getURL() - */ - public URL getURL() throws IOException - { - // delegate to ClassPathResource - return classPathResource.getURL(); - } - - /* (non-Javadoc) - * @see org.springframework.core.io.Resource#getDescription() - */ - public String getDescription() - { - // delegate to ClassPathResource - return classPathResource.getDescription(); - } - - /* (non-Javadoc) - * @see org.springframework.core.io.InputStreamSource#getInputStream() - */ - public InputStream getInputStream() throws IOException - { - // delegate to ClassPathResource - return classPathResource.getInputStream(); - } - - // Data access - - /** - * @param configuration the configuration to set - */ - public void setConfiguration(PropertiesConfiguration configuration) - { - this.configuration = configuration; - } - - /** - * @param defaultConfigResource the defaultConfigResource to set - */ - public void setDefaultConfigResource(String defaultConfigResource) - { - this.defaultConfigResource = defaultConfigResource; - } - - /** - * @param test the test to set - */ - public void setTest(boolean test) - { - this.test = test; - } - - /** - * @param defaultGroupAddress the defaultGroupAddress to set - */ - public void setDefaultGroupAddress(String defaultGroupAddress) - { - this.defaultGroupAddress = defaultGroupAddress; - } - - /** - * @param defaultGroupPort the defaultGroupPort to set - */ - public void setDefaultGroupPort(String defaultGroupPort) - { - this.defaultGroupPort = defaultGroupPort; - } - - /** - * @param defaultGroupTTL the defaultGroupTTL to set - */ - public void setDefaultGroupTTL(String defaultGroupTTL) - { - this.defaultGroupTTL = defaultGroupTTL; - } - - /** - * @param defaultHostname the defaultHostname to set - */ - public void setDefaultHostname(String defaultHostname) - { - this.defaultHostname = defaultHostname; - } - - /** - * @param defaultPort the defaultPort to set - */ - public void setDefaultPort(String defaultPort) - { - this.defaultPort = defaultPort; - } - - /** - * @param defaultPageManagerMaxElements the defaultPageManagerMaxElements to set - */ - public void setDefaultPageManagerMaxElements( - String defaultPageManagerMaxElements) - { - this.defaultPageManagerMaxElements = defaultPageManagerMaxElements; - } - - /** - * @param defaultPageManagerElementTTL the defaultPageManagerElementTTL to set - */ - public void setDefaultPageManagerElementTTL( - String defaultPageManagerElementTTL) - { - this.defaultPageManagerElementTTL = defaultPageManagerElementTTL; - } -} Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedImpl.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedImpl.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedImpl.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -51,8 +51,6 @@ private Map refList = Collections.synchronizedMap(new HashMap()); - private boolean removeAllLocal = false; - public EhCacheDistributedImpl(Ehcache ehcache) { super(ehcache); @@ -96,11 +94,6 @@ public CacheElement createElement(Object key, Object content) { - if (!(key instanceof Serializable)) { throw new IllegalArgumentException( - "The cache key must be serializable."); } - if (!(content instanceof DistributedCacheObject)) { throw new IllegalArgumentException( - "The cache content must be a distributed cache object."); } - return new EhCacheDistributedElementImpl((Serializable) key, (DistributedCacheObject) content); } @@ -138,13 +131,7 @@ public void clear() { - // invoke removeAll with local flag set - synchronized (refList) - { - removeAllLocal = true; - super.clear(); - removeAllLocal = false; - } + super.clear(); notifyListeners(true, CacheElement.ActionRemoved, null, null); } @@ -319,23 +306,16 @@ } try { - // synchronize on refList to ensure exclusive - // operation on refList and removeAllLocal flag - synchronized (refList) + Iterator it = refList.entrySet().iterator(); + while (it.hasNext()) { - // notify all listeners of element removal - // and each element of its removal - Iterator it = refList.values().iterator(); - while (it.hasNext()) - { - EhCacheDistributedElementImpl e = (EhCacheDistributedElementImpl) it - .next(); - notifyListeners(removeAllLocal, CacheElement.ActionRemoved, - e.getKey(), e.getContent()); - e.notifyChange(CacheElement.ActionRemoved); - } - refList.clear(); + EhCacheDistributedElementImpl e = (EhCacheDistributedElementImpl) it + .next(); + notifyListeners(false, CacheElement.ActionRemoved, e.getKey(), + e); + e.notifyChange(CacheElement.ActionRemoved); } + refList.clear(); } catch (Exception e) { Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheImpl.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheImpl.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheImpl.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -23,10 +23,8 @@ import jp.sf.pal.portal.logging.Log; import jp.sf.pal.portal.logging.LogFactory; -import net.sf.ehcache.CacheException; import net.sf.ehcache.Ehcache; import net.sf.ehcache.Element; -import net.sf.ehcache.distribution.CacheManagerPeerProvider; import net.sf.ehcache.event.CacheEventListener; import org.apache.jetspeed.cache.CacheElement; @@ -80,17 +78,12 @@ public CacheElement createElement(Object key, Object content) { - if (!(key instanceof Serializable)) { throw new IllegalArgumentException( - "The cache key must be serializable."); } - if (content instanceof Serializable) - { - return new EhCacheElementImpl((Serializable) key, - (Serializable) content); - } - else - { - return new EhCacheElementImpl((Serializable) key, content); - } + if (!((key instanceof Serializable) || !(content instanceof Serializable))) + throw new IllegalArgumentException( + "The cache key and the object to cache must be serializable."); // return + // null; + return new EhCacheElementImpl((Serializable) key, + (Serializable) content); } public boolean remove(Object key) @@ -201,22 +194,6 @@ return ehcache.getKeys(); } - public boolean isDistributed() - { - // check if cache part of a distributed cluster - try - { - CacheManagerPeerProvider peerProvider = ehcache.getCacheManager() - .getCachePeerProvider(); - return ((peerProvider != null) && (peerProvider - .listRemoteCachePeers(ehcache).size() > 0)); - } - catch (CacheException ce) - { - } - return false; - } - // ------------------------------------------------------ public Object clone() throws CloneNotSupportedException Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/test/org/apache/jetspeed/cache/TestContentCache.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/test/org/apache/jetspeed/cache/TestContentCache.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/test/org/apache/jetspeed/cache/TestContentCache.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -26,7 +26,6 @@ import net.sf.ehcache.CacheManager; import org.apache.jetspeed.aggregator.PortletContent; -import org.apache.jetspeed.cache.impl.EhCacheConfigResource; import org.apache.jetspeed.cache.impl.EhPortletContentCacheImpl; import org.apache.jetspeed.cache.impl.JetspeedCacheKeyGenerator; import org.apache.jetspeed.mockobjects.request.MockRequestContext; @@ -53,8 +52,6 @@ public void testContentCacheByUser() throws Exception { // initialize ehCache - EhCacheConfigResource.getInstance( - EhCacheConfigResource.EHCACHE_CONFIG_RESOURCE_DEFAULT, true); CacheManager cacheManager = new CacheManager(); Cache ehContentCache = new Cache("ehPortletContentCache", 10000, false, false, 28800, 28800); @@ -154,8 +151,6 @@ public void testContentCacheBySession() throws Exception { // initialize ehCache - EhCacheConfigResource.getInstance( - EhCacheConfigResource.EHCACHE_CONFIG_RESOURCE_DEFAULT, true); CacheManager cacheManager = new CacheManager(); Cache ehContentCache = new Cache("ehPortletContentCache", 10000, false, false, 28800, 28800); Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/test/org/apache/jetspeed/cache/TestDecorationContentCache.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/test/org/apache/jetspeed/cache/TestDecorationContentCache.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/cm/src/test/org/apache/jetspeed/cache/TestDecorationContentCache.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -25,7 +25,6 @@ import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; -import org.apache.jetspeed.cache.impl.EhCacheConfigResource; import org.apache.jetspeed.cache.impl.EhDecorationContentCacheImpl; import org.apache.jetspeed.cache.impl.JetspeedCacheKeyGenerator; import org.apache.jetspeed.mockobjects.request.MockRequestContext; @@ -52,8 +51,6 @@ public void testContentCacheByUser() throws Exception { // initialize ehCache - EhCacheConfigResource.getInstance( - EhCacheConfigResource.EHCACHE_CONFIG_RESOURCE_DEFAULT, true); CacheManager cacheManager = new CacheManager(); Cache ehContentCache = new Cache("ehDecorationContentCache", 10000, false, false, 28800, 28800); @@ -149,8 +146,6 @@ public void testContentCacheBySession() throws Exception { // initialize ehCache - EhCacheConfigResource.getInstance( - EhCacheConfigResource.EHCACHE_CONFIG_RESOURCE_DEFAULT, true); CacheManager cacheManager = new CacheManager(); Cache ehContentCache = new Cache("ehDecorationContentCache", 10000, false, false, 28800, 28800); Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/project.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/project.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/project.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -80,11 +80,6 @@ <id>org.apache.portals.jetspeed-2:jetspeed-rdbms</id> <version>${jetspeed.version}</version> </dependency> - <dependency> - <groupId>commons-jexl</groupId> - <artifactId>commons-jexl</artifactId> - <version>1.1</version> - </dependency> </dependencies> <build> @@ -95,7 +90,6 @@ <excludes> <exclude>**/PageManagerTestShared.java</exclude> <exclude>**/DirectoryXMLTransform.java</exclude> - <exclude>**/DatabasePageManagerServer.java</exclude> <exclude>**/TestTransactions.java</exclude> </excludes> <resources> @@ -117,10 +111,6 @@ </resource> <resource> <directory>${basedir}/../../etc/db-ojb</directory> - <excludes> - <exclude>**/ehcache.xml</exclude> - <exclude>**/distributed-ehcache.xml</exclude> - </excludes> </resource> <resource> <directory>${basedir}/../../src/webapp/WEB-INF/assembly</directory> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -881,14 +881,6 @@ // nothing to shutdown by default } - /* (non-Javadoc) - * @see org.apache.jetspeed.page.PageManager#isDistributed() - */ - public boolean isDistributed() - { - return false; - } - /** * notifyNewNode - notify page manager event listeners of new node event * Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -28,7 +28,6 @@ import jp.sf.pal.portal.logging.LogFactory; import org.apache.jetspeed.JetspeedActions; -import org.apache.jetspeed.cache.JetspeedCache; import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport; import org.apache.jetspeed.om.common.SecurityConstraint; import org.apache.jetspeed.om.common.SecurityConstraints; @@ -87,7 +86,6 @@ import org.apache.jetspeed.page.document.DocumentNotFoundException; import org.apache.jetspeed.page.document.FailedToDeleteDocumentException; import org.apache.jetspeed.page.document.FailedToUpdateDocumentException; -import org.apache.jetspeed.page.document.Node; import org.apache.jetspeed.page.document.NodeException; import org.apache.jetspeed.page.document.NodeSet; import org.apache.jetspeed.page.document.impl.NodeImpl; @@ -107,6 +105,12 @@ implements PageManager { + private static final int DEFAULT_CACHE_SIZE = 128; + + private static final int MIN_CACHE_EXPIRES_SECONDS = 30; + + private static final int DEFAULT_CACHE_EXPIRES_SECONDS = 150; + private static Map modelClasses = new HashMap(); static { @@ -155,22 +159,60 @@ private DelegatingPageManager delegator; + private int cacheSize; + + private int cacheExpiresSeconds; + private PageManager pageManagerProxy; protected static final Log log = LogFactory .getLog(DatabasePageManager.class); - public DatabasePageManager(String repositoryPath, - boolean isPermissionsSecurity, boolean isConstraintsSecurity, - JetspeedCache oidCache, JetspeedCache pathCache) + public DatabasePageManager(String repositoryPath, int cacheSize, + int cacheExpiresSeconds, boolean isPermissionsSecurity, + boolean isConstraintsSecurity) { super(repositoryPath); delegator = new DelegatingPageManager(isPermissionsSecurity, isConstraintsSecurity, modelClasses); - DatabasePageManagerCache.cacheInit(oidCache, pathCache, this); + this.cacheSize = Math.max(cacheSize, DEFAULT_CACHE_SIZE); + if (cacheExpiresSeconds < 0) + { + this.cacheExpiresSeconds = DEFAULT_CACHE_EXPIRES_SECONDS; + } + else if (cacheExpiresSeconds == 0) + { + this.cacheExpiresSeconds = 0; + } + else + { + this.cacheExpiresSeconds = Math.max(cacheExpiresSeconds, + MIN_CACHE_EXPIRES_SECONDS); + } + DatabasePageManagerCache.cacheInit(this); } /** + * getCacheSize + * + * @return configured cache size + */ + public int getCacheSize() + { + return cacheSize; + } + + /** + * getCacheExpiresSeconds + * + * @return configured cache expiration in seconds + */ + public int getCacheExpiresSeconds() + { + return cacheExpiresSeconds; + } + + /** * getPageManagerProxy * * @return proxied page manager interface used to inject into Folder @@ -2204,21 +2246,4 @@ return pages.length; } - /* (non-Javadoc) - * @see org.apache.jetspeed.page.PageManager#isDistributed() - */ - public boolean isDistributed() - { - return DatabasePageManagerCache.isDistributed(); - } - - /* (non-Javadoc) - * @see org.apache.jetspeed.page.PageManager#notifyUpdatedNode(org.apache.jetspeed.page.document.Node) - */ - public void notifyUpdatedNode(Node node) - { - // notify page manager listeners - delegator.notifyUpdatedNode(node); - } - } Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManagerCache.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManagerCache.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManagerCache.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -16,15 +16,12 @@ */ package org.apache.jetspeed.page.impl; +import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Properties; -import org.apache.jetspeed.cache.CacheElement; -import org.apache.jetspeed.cache.JetspeedCache; -import org.apache.jetspeed.cache.JetspeedCacheEventListener; -import org.apache.jetspeed.om.folder.Folder; import org.apache.jetspeed.om.folder.impl.FolderImpl; import org.apache.jetspeed.page.PageManager; import org.apache.jetspeed.page.document.impl.NodeImpl; @@ -41,22 +38,22 @@ public class DatabasePageManagerCache implements ObjectCache { - // Members + private static HashMap cacheByOID; - private static JetspeedCache oidCache; + private static LinkedList cacheLRUList; - private static JetspeedCache pathCache; + private static HashMap cacheByPath; + private static int cacheSize; + + private static int cacheExpiresSeconds; + private static boolean constraintsEnabled; private static boolean permissionsEnabled; private static PageManager pageManager; - private static ThreadLocal transactionedOperations = new ThreadLocal(); - - // Implementation - /** * cacheInit * @@ -65,191 +62,24 @@ * @param pageManager * configured page manager */ - public synchronized static void cacheInit(final JetspeedCache oidCache, - final JetspeedCache pathCache, final DatabasePageManager pageManager) + public synchronized static void cacheInit(DatabasePageManager dbPageManager) { - - // initialize - DatabasePageManagerCache.oidCache = oidCache; - DatabasePageManagerCache.pathCache = pathCache; - constraintsEnabled = pageManager.getConstraintsEnabled(); - permissionsEnabled = pageManager.getPermissionsEnabled(); - - // setup local oid cache listener - oidCache.addEventListener(new JetspeedCacheEventListener() + if (pageManager != null) { - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementAdded(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementAdded(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - final NodeImpl node = (NodeImpl) element; - // infuse node with page manager configuration - // or the page manager itself and add to the - // paths cache - node.setConstraintsEnabled(constraintsEnabled); - node.setPermissionsEnabled(permissionsEnabled); - if (node instanceof FolderImpl) - { - ((FolderImpl) node).setPageManager(pageManager); - } - } - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementChanged(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementChanged(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - final NodeImpl node = (NodeImpl) element; - // infuse node with page manager configuration - // or the page manager itself and add to the - // paths cache - node.setConstraintsEnabled(constraintsEnabled); - node.setPermissionsEnabled(permissionsEnabled); - if (node instanceof FolderImpl) - { - ((FolderImpl) node).setPageManager(pageManager); - } - } - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementEvicted(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementEvicted(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - final NodeImpl node = (NodeImpl) element; - // reset internal FolderImpl caches - if (node instanceof FolderImpl) - { - ((FolderImpl) node).resetAll(false); - } - } - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementExpired(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementExpired(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - final NodeImpl node = (NodeImpl) element; - // reset internal FolderImpl caches - if (node instanceof FolderImpl) - { - ((FolderImpl) node).resetAll(false); - } - } - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementRemoved(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementRemoved(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - final NodeImpl node = (NodeImpl) element; - // reset internal FolderImpl caches - if (node instanceof FolderImpl) - { - ((FolderImpl) node).resetAll(false); - } - } - }, true); - - // setup remote path cache listener - pathCache.addEventListener(new JetspeedCacheEventListener() - { - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementAdded(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementAdded(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - } - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementChanged(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementChanged(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - } - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementEvicted(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementEvicted(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - } - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementExpired(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementExpired(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - } - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementRemoved(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object) - */ - public void notifyElementRemoved(final JetspeedCache cache, - final boolean local, final Object key, final Object element) - { - final DatabasePageManagerCacheObject cacheObject = (DatabasePageManagerCacheObject) element; - // remove cache object from local oid cache - if (cacheObject != null) - { - final Identity oid = cacheObject.getId(); - final String path = cacheObject.getPath(); - if ((oid != null) || (path != null)) - { - synchronized (DatabasePageManagerCache.class) - { - if (oid != null) - { - // get object cached by oid - final NodeImpl node = (NodeImpl) cacheLookup(oid); - // reset internal FolderImpl caches - if (node instanceof FolderImpl) - { - ((FolderImpl) node).resetAll(false); - } - // notify page manager of update - pageManager.notifyUpdatedNode(node); - // remove from cache - oidCache.removeQuiet(oid); - } - if (path != null) - { - // lookup parent object cached by path and oid - final int pathLastSeparatorIndex = path - .lastIndexOf(Folder.PATH_SEPARATOR); - final String parentPath = ((pathLastSeparatorIndex > 0) ? path - .substring(0, pathLastSeparatorIndex) - : Folder.PATH_SEPARATOR); - final NodeImpl parentNode = cacheLookup(parentPath); - // reset internal FolderImpl caches in case element removed - if (parentNode instanceof FolderImpl) - { - ((FolderImpl) parentNode).resetAll(false); - } - // ensure remove from cache - pathCache.removeQuiet(path); - } - } - } - } - } - }, false); + cacheClear(); + } + cacheByOID = new HashMap(); + cacheLRUList = new LinkedList(); + cacheByPath = new HashMap(); + cacheSize = dbPageManager.getCacheSize(); + cacheExpiresSeconds = dbPageManager.getCacheExpiresSeconds(); + constraintsEnabled = dbPageManager.getConstraintsEnabled(); + permissionsEnabled = dbPageManager.getPermissionsEnabled(); + pageManager = dbPageManager; } /** - * Override page manager specified during create with proxy. + * setPageManagerProxy * * @param proxy * proxied page manager interface used to inject into Folder @@ -269,223 +99,293 @@ /** * cacheLookup * - * Lookup object instances by unique path. + * Lookup node instances by unique path. * * @param path * node unique path * @return cached node */ - public synchronized static NodeImpl cacheLookup(final String path) + public synchronized static NodeImpl cacheLookup(String path) { if (path != null) { - // return valid object cached by path and oid - final CacheElement pathElement = pathCache.get(path); - if (pathElement != null) - { - final DatabasePageManagerCacheObject cacheObject = (DatabasePageManagerCacheObject) pathElement - .getContent(); - return (NodeImpl) cacheLookup(cacheObject.getId()); - } - + // return valid object cached by path + return (NodeImpl) cacheValidateEntry((Entry) cacheByPath.get(path)); } return null; } /** - * Add object to cache and cache instances by unique path; + * cacheAdd + * + * Add object to cache and cache node instances by unique path; infuse nodes * loaded by OJB with page manager configuration. * * @param oid - * object/node identity + * object/node indentity * @param obj * object/node to cache */ - public synchronized static void cacheAdd(final Identity oid, - final Object obj) + public synchronized static void cacheAdd(Identity oid, Object obj) { - if (obj instanceof NodeImpl) + Entry entry = (Entry) cacheByOID.get(oid); + if (entry != null) { - final NodeImpl node = (NodeImpl) obj; - final String nodePath = node.getPath(); - - // add node to caches - oidCache.remove(oid); - final CacheElement element = oidCache.createElement(oid, node); - oidCache.put(element); - pathCache.remove(nodePath); - final CacheElement pathElement = pathCache.createElement(nodePath, - new DatabasePageManagerCacheObject(oid, nodePath)); - pathCache.put(pathElement); + // update cache LRU order + cacheLRUList.remove(entry); + cacheLRUList.addFirst(entry); + // refresh cache entry + entry.touch(); } + else + { + // create new cache entry and map + entry = new Entry(obj, oid); + cacheByOID.put(oid, entry); + cacheLRUList.addFirst(entry); + // infuse node with page manager configuration + // or the page manager itself and add to the + // paths cache + if (obj instanceof NodeImpl) + { + NodeImpl node = (NodeImpl) obj; + node.setConstraintsEnabled(constraintsEnabled); + node.setPermissionsEnabled(permissionsEnabled); + cacheByPath.put(node.getPath(), entry); + if (obj instanceof FolderImpl) + { + ((FolderImpl) obj).setPageManager(pageManager); + } + } + // trim cache as required to maintain cache size + while (cacheLRUList.size() > cacheSize) + { + cacheRemoveEntry((Entry) cacheLRUList.getLast(), true); + } + } } /** * cacheClear * - * Clear object and path caches. + * Clear object and node caches. */ public synchronized static void cacheClear() { - // remove all items from oid cache individually - // to ensure notifications are run to detach - // elements; do not invoke oidCache.clear() - final Iterator removeOidIter = oidCache.getKeys().iterator(); - while (removeOidIter.hasNext()) + // remove all cache entries + Iterator removeIter = cacheLRUList.iterator(); + while (removeIter.hasNext()) { - oidCache.remove((Identity) removeOidIter.next()); + cacheRemoveEntry((Entry) removeIter.next(), false); } - // remove all items from path cache individually - // to avoid potential distributed clear invocation - // that would be performed against all peers; do - // not invoke pathCache.clear() - final Iterator removePathIter = pathCache.getKeys().iterator(); - while (removePathIter.hasNext()) - { - pathCache.removeQuiet(removePathIter.next()); - } + // clear cache + cacheByOID.clear(); + cacheLRUList.clear(); + cacheByPath.clear(); } /** + * cacheLookup + * * Lookup objects by identity. * * @param oid * object identity * @return cached object */ - public synchronized static Object cacheLookup(final Identity oid) + public synchronized static Object cacheLookup(Identity oid) { if (oid != null) { // return valid object cached by oid - final CacheElement element = oidCache.get(oid); - if (element != null) { return element.getContent(); } - + return cacheValidateEntry((Entry) cacheByOID.get(oid)); } return null; } /** - * Remove identified object from object and path caches. + * cacheRemove * + * Remove identified object from object and node caches. + * * @param oid * object identity */ - public synchronized static void cacheRemove(final Identity oid) + public synchronized static void cacheRemove(Identity oid) { // remove from cache by oid - if (oid != null) - { - final NodeImpl node = (NodeImpl) cacheLookup(oid); - if (node != null) - { - // remove from caches - oidCache.remove(oid); - pathCache.remove(node.getPath()); - } - } + cacheRemoveEntry((Entry) cacheByOID.get(oid), true); } /** - * Remove identified object from object and path caches. + * cacheRemove * + * Remove identified object from object and node caches. + * * @param path * object path */ - public synchronized static void cacheRemove(final String path) + public synchronized static void cacheRemove(String path) { // remove from cache by path - if (path != null) - { - final CacheElement pathElement = pathCache.get(path); - if (pathElement != null) - { - final DatabasePageManagerCacheObject cacheObject = (DatabasePageManagerCacheObject) pathElement - .getContent(); - // remove from caches - oidCache.remove(cacheObject.getId()); - pathCache.remove(path); - } - } + cacheRemoveEntry((Entry) cacheByPath.get(path), true); } /** - * Reset cached security constraints in all cached objects. + * cacheValidateEntry + * + * Validate specified entry from cache, returning cached object if valid. + * + * @param entry + * cache entry to validate + * @return validated object from cache */ - public synchronized static void resetCachedSecurityConstraints() + private synchronized static Object cacheValidateEntry(Entry entry) { - // reset cached objects - final Iterator resetIter = oidCache.getKeys().iterator(); - while (resetIter.hasNext()) + if (entry != null) { - final NodeImpl node = (NodeImpl) cacheLookup((Identity) resetIter - .next()); - node.resetCachedSecurityConstraints(); + if (!entry.isExpired()) + { + // update cache LRU order + cacheLRUList.remove(entry); + cacheLRUList.addFirst(entry); + // refresh cache entry and return object + entry.touch(); + return entry.getObject(); + } + else + { + // remove expired entry + cacheRemoveEntry(entry, true); + } } + return null; } /** - * Get transactions registered on current thread + * cacheRemoveEntry * - * @return transactions list + * Remove specified entry from cache. + * + * @param entry + * cache entry to remove + * @param remove + * enable removal from cache */ - public static List getTransactions() + private synchronized static void cacheRemoveEntry(Entry entry, + boolean remove) { - List operations = (List) transactionedOperations.get(); - if (operations == null) + if (entry != null) { - operations = new LinkedList(); - transactionedOperations.set(operations); + Object removeObj = entry.getObject(); + if (remove) + { + // remove entry, optimize for removal from end + // of list as cache size is met or entries expire + if (cacheLRUList.getLast() == entry) + { + cacheLRUList.removeLast(); + } + else + { + int removeIndex = cacheLRUList.lastIndexOf(entry); + if (removeIndex > 0) + { + cacheLRUList.remove(removeIndex); + } + } + // unmap entry + cacheByOID.remove(entry.getOID()); + if (removeObj instanceof NodeImpl) + { + cacheByPath.remove(((NodeImpl) removeObj).getPath()); + } + } + // reset internal FolderImpl caches + if (removeObj instanceof FolderImpl) + { + ((FolderImpl) removeObj).resetAll(false); + } } - return operations; } /** - * Register transactions with current thread + * resetCachedSecurityConstraints * - * @param operation transaction operation + * Reset cached security constraints in all cached node objects. */ - public static void addTransaction(TransactionedOperation operation) + public synchronized static void resetCachedSecurityConstraints() { - final List transactions = getTransactions(); - transactions.add(operation); + // reset cached objects + Iterator resetIter = cacheLRUList.iterator(); + while (resetIter.hasNext()) + { + Object obj = ((Entry) resetIter.next()).getObject(); + if (obj instanceof NodeImpl) + { + ((NodeImpl) obj).resetCachedSecurityConstraints(); + } + } } /** - * Rollback transactions registered with current thread. + * Entry + * + * Cache entry class adding entry timestamp to track expiration */ - public synchronized static void rollbackTransactions() + private static class Entry { - final Iterator transactions = getTransactions().iterator(); - while (transactions.hasNext()) + + public long timestamp; + + public Object object; + + public Identity oid; + + public Entry(Object object, Identity oid) { - final TransactionedOperation operation = (TransactionedOperation) transactions - .next(); - cacheRemove(operation.getPath()); + touch(); + this.object = object; + this.oid = oid; } - } - /** - * Clear transactions registered with current thread. - */ - public synchronized static void clearTransactions() - { - transactionedOperations.set(null); - } + public boolean isExpired() + { + if (DatabasePageManagerCache.cacheExpiresSeconds > 0) + { + long now = System.currentTimeMillis(); + if (((now - timestamp) / 1000) < DatabasePageManagerCache.cacheExpiresSeconds) + { + timestamp = now; + return false; + } + return true; + } + return false; + } - /** - * Returns whether this cache is currently part of a distributed cache cluster. - * - * @return distributed flag - */ - public static boolean isDistributed() - { - return pathCache.isDistributed(); - } + public void touch() + { + if (DatabasePageManagerCache.cacheExpiresSeconds > 0) + { + timestamp = System.currentTimeMillis(); + } + } - // OJB Constructor + public Object getObject() + { + return object; + } + public Identity getOID() + { + return oid; + } + } + /** + * DatabasePageManagerCache + * * Construct a cache instance using OJB compliant signatures. * * @param broker @@ -497,8 +397,6 @@ { } - // OJB ObjectCache Implementation - /* * (non-Javadoc) * @@ -545,24 +443,61 @@ cacheRemove(oid); } - // Utilities - - /** - * Dump cache paths and oids to standard out. - */ - public synchronized static void dump() { - System.out.println("--------------------------"); - final Iterator dumpIter = oidCache.getKeys().iterator(); + System.out.println("--------------------------1"); + Iterator dumpIter = cacheLRUList.iterator(); while (dumpIter.hasNext()) { - final Identity oid = (Identity) dumpIter.next(); - final NodeImpl node = (NodeImpl) cacheLookup(oid); - System.out.println("node=" + node.getPath() + ", oid=" + oid); + Entry entry = (Entry) dumpIter.next(); + Object entryObject = entry.getObject(); + if (entryObject instanceof NodeImpl) + { + System.out.println("entry = " + + ((NodeImpl) entryObject).getPath() + ", " + + entry.getOID()); + } + else + { + System.out.println("entry = <none>, " + entry.getOID()); + } } + System.out.println("--------------------------2"); + } - System.out.println("--------------------------"); + // TODO Findbugs + protected static ThreadLocal transactionedOperations = new ThreadLocal(); + + public static List getTransactions() + { + List operations = (List) transactionedOperations.get(); + if (operations == null) + { + operations = new LinkedList(); + transactionedOperations.set(operations); + } + + return operations; } + /** + * @param principal + * The principal to set. + */ + public static void addTransaction(TransactionedOperation operation) + { + List transactions = getTransactions(); + transactions.add(operation); + } + + public static void rollbackTransactions() + { + Iterator transactions = getTransactions().iterator(); + while (transactions.hasNext()) + { + TransactionedOperation operation = (TransactionedOperation) transactions + .next(); + cacheRemove(operation.getPath()); + } + } } Deleted: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManagerCacheObject.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManagerCacheObject.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManagerCacheObject.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.jetspeed.page.impl; - -import org.apache.jetspeed.cache.CacheElement; -import org.apache.jetspeed.cache.DistributedCacheObject; -import org.apache.ojb.broker.Identity; - -/** - * DatabasePageManagerCacheObject - * - * @author <a href="mailto:rwatl****@apach*****">Randy Watler</a> - * @version $Id: $ -*/ -public class DatabasePageManagerCacheObject implements DistributedCacheObject -{ - - private static final long serialVersionUID = 3575475610695136850L; - - // Members - - private Identity id = null; - - private String path = null; - - // Constructor - - /** - * Construct new cache object with id and path - * - * @param id - * @param path - */ - public DatabasePageManagerCacheObject(final Identity id, final String path) - { - this.path = path; - this.id = id; - } - - /** - * Serialization constructor - */ - public DatabasePageManagerCacheObject() - { - } - - // Implementation - - /* (non-Javadoc) - * @see org.apache.jetspeed.cache.DistributedCacheObject#notifyChange(int) - */ - public void notifyChange(int action) - { - switch (action) - { - case CacheElement.ActionAdded: - case CacheElement.ActionChanged: - case CacheElement.ActionRemoved: - case CacheElement.ActionEvicted: - case CacheElement.ActionExpired: - break; - default: - return; - } - return; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) - { - if ((obj != null) && (obj instanceof DatabasePageManagerCacheObject)) - { - final DatabasePageManagerCacheObject other = (DatabasePageManagerCacheObject) obj; - return getPath().equals(other.getPath()); - } - return false; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() - { - return getPath().hashCode(); - } - - // Data access - - /** - * @return wrapper id - */ - public Identity getId() - { - return id; - } - - /** - * @return wrapper path - */ - public String getPath() - { - return path; - } -} Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -46,11 +46,6 @@ DatabasePageManagerCache.rollbackTransactions(); throw exp; } - finally - { - DatabasePageManagerCache.clearTransactions(); - } - } } Deleted: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/database-page-manager-base.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/database-page-manager-base.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/database-page-manager-base.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -1,102 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> - - <!-- Page Manager Caches --> - <bean id="cacheManagerConfig" class="org.apache.jetspeed.cache.impl.EhCacheConfigResource"> - <property name="defaultConfigResource" value="ehcache.xml"/> - <property name="test" value="true"/> - </bean> - - <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> - <property name="configLocation" ref="cacheManagerConfig"/> - </bean> - - <bean id="ehPageManagerOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> - <property name="cacheManager" ref="cacheManager"/> - <property name="cacheName" value="pageManagerOidCache"/> - </bean> - - <bean id="ehPageManagerPathCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> - <property name="cacheManager" ref="cacheManager"/> - <property name="cacheName" value="pageManagerPathCache"/> - </bean> - - <bean id="pageManagerOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl"> - <constructor-arg><ref bean="ehPageManagerOidCache"/></constructor-arg> - </bean> - - <bean id="pageManagerPathCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl"> - <constructor-arg><ref bean="ehPageManagerPathCache"/></constructor-arg> - </bean> - - <!-- Transaction Proxying --> - <bean id="pageManagerInterceptor" class="org.apache.jetspeed.util.interceptors.PageManagerInterceptor"> - </bean> - - <bean id="pageManager" parent="baseTransactionProxy"> - <property name="proxyInterfaces"> - <value>org.apache.jetspeed.page.PageManager</value> - </property> - <property name="target"> - <ref bean="pageManagerImpl" /> - </property> - <property name="transactionAttributes"> - <props> - <prop key="getPage*">PROPAGATION_SUPPORTS</prop> - <prop key="getLink*">PROPAGATION_SUPPORTS</prop> - <prop key="getFolder*">PROPAGATION_SUPPORTS</prop> - <prop key="getContentPage">PROPAGATION_SUPPORTS</prop> - <prop key="getAll">PROPAGATION_SUPPORTS</prop> - <prop key="getUserFolder">PROPAGATION_SUPPORTS</prop> - <prop key="update*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> - <prop key="removePage">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> - <prop key="removeFolder">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> - <prop key="removeLink">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> - <prop key="removePageSecurity">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> - <prop key="createUserHomePagesFromRoles">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> - <prop key="deepCopy*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> - <prop key="addPages">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> - <prop key="folderExists">PROPAGATION_SUPPORTS</prop> - <prop key="pageExists">PROPAGATION_SUPPORTS</prop> - <prop key="linkExists">PROPAGATION_SUPPORTS</prop> - <prop key="userFolderExists">PROPAGATION_SUPPORTS</prop> - <prop key="userPageExists">PROPAGATION_SUPPORTS</prop> - </props> - </property> - <property name="preInterceptors"> - <list> - <ref bean="pageManagerInterceptor" /> - </list> - </property> - </bean> - - <!-- Inject Page Manager Proxy into Page Manager --> - <bean id="injectPageManagerProxy" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> - <property name="targetObject"><ref bean="pageManagerImpl"/></property> - <property name="targetMethod"><value>setPageManagerProxy</value></property> - <property name="arguments"> - <list> - <ref bean="pageManager"/> - </list> - </property> - </bean> - -</beans> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/database-page-manager.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/database-page-manager.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/database-page-manager.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -18,20 +18,65 @@ --> <beans> - <import resource="database-page-manager-base.xml"/> - <!-- Page Manager --> - <bean id="pageManagerImpl" init-method="init" class="org.apache.jetspeed.page.impl.DatabasePageManager"> + <bean id="org.apache.jetspeed.page.PageManagerImpl" + name="pageManagerImpl" + init-method="init" + class="org.apache.jetspeed.page.impl.DatabasePageManager"> <!-- OJB configuration file resource path --> - <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg> + <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg> + <!-- folder/page/link cache size, default=128, min=128 --> + <constructor-arg index="1"><value>128</value></constructor-arg> + <!-- folder/page/link cache expires seconds, default=150, infinite=0, min=30 --> + <constructor-arg index="2"><value>0</value></constructor-arg> <!-- permissions security enabled flag, default=false --> - <constructor-arg index="1"><value>false</value></constructor-arg> + <constructor-arg index="3"><value>false</value></constructor-arg> <!-- constraints security enabled flag, default=true --> - <constructor-arg index="2"><value>false</value></constructor-arg> - <!-- folder/page/link cache --> - <constructor-arg index="3"><ref bean="pageManagerOidCache"/></constructor-arg> - <!-- folder/page/link path cache --> - <constructor-arg index="4"><ref bean="pageManagerPathCache"/></constructor-arg> + <constructor-arg index="4"><value>false</value></constructor-arg> </bean> + <!-- Transaction Proxying --> + <bean id="org.apache.jetspeed.page.PageManager" name="pageManager" parent="baseTransactionProxy"> + <property name="proxyInterfaces"> + <value>org.apache.jetspeed.page.PageManager</value> + </property> + <property name="target"> + <ref bean="pageManagerImpl" /> + </property> + <property name="transactionAttributes"> + <props> + <prop key="getPage*">PROPAGATION_SUPPORTS</prop> + <prop key="getLink*">PROPAGATION_SUPPORTS</prop> + <prop key="getFolder*">PROPAGATION_SUPPORTS</prop> + <prop key="getContentPage">PROPAGATION_SUPPORTS</prop> + <prop key="getAll">PROPAGATION_SUPPORTS</prop> + <prop key="getUserFolder">PROPAGATION_SUPPORTS</prop> + <prop key="update*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removePage">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removeFolder">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removeLink">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removePageSecurity">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="createUserHomePagesFromRoles">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="deepCopy*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="addPages">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="folderExists">PROPAGATION_SUPPORTS</prop> + <prop key="pageExists">PROPAGATION_SUPPORTS</prop> + <prop key="linkExists">PROPAGATION_SUPPORTS</prop> + <prop key="userFolderExists">PROPAGATION_SUPPORTS</prop> + <prop key="userPageExists">PROPAGATION_SUPPORTS</prop> + </props> + </property> + </bean> + + <!-- Inject Page Manager Proxy into Page Manager --> + <bean id="injectPageManagerProxy" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> + <property name="targetObject"><ref bean="pageManagerImpl"/></property> + <property name="targetMethod"><value>setPageManagerProxy</value></property> + <property name="arguments"> + <list> + <ref bean="pageManager"/> + </list> + </property> + </bean> + </beans> Deleted: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/distributed-ehcache.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/distributed-ehcache.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/distributed-ehcache.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd"> - - <diskStore path="java.io.tmpdir"/> - - <cacheManagerEventListenerFactory class="" - properties=""/> - - - <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" - properties="peerDiscovery=automatic, - multicastGroupAddress=${org.apache.jetspeed.ehcache.group.address}, - multicastGroupPort=${org.apache.jetspeed.ehcache.group.port}, - timeToLive=${org.apache.jetspeed.ehcache.group.ttl}"/> - - <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" - properties="hostName=${org.apache.jetspeed.ehcache.hostname}, - port=${org.apache.jetspeed.ehcache.port}"/> - - <defaultCache maxElementsInMemory="10000" - eternal="false" - timeToIdleSeconds="120" - timeToLiveSeconds="120" - overflowToDisk="true" - maxElementsOnDisk="10000000" - diskPersistent="false" - diskExpiryThreadIntervalSeconds="120" - memoryStoreEvictionPolicy="LRU"/> - - <cache name="pageManagerOidCache" - maxElementsInMemory="${org.apache.jetspeed.ehcache.pagemanager.maxelements}" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - timeToLiveSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - memoryStoreEvictionPolicy="LFU"/> - - <cache name="pageManagerPathCache" - maxElementsInMemory="${org.apache.jetspeed.ehcache.pagemanager.maxelements}" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - timeToLiveSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - memoryStoreEvictionPolicy="LFU"> - <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" - properties="replicateAsynchronously=true, - replicatePuts=false, - replicateUpdates=false, - replicateUpdatesViaCopy=false, - replicateRemovals=true"/> - </cache> - -</ehcache> Deleted: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/ehcache.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/ehcache.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/ehcache.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd"> - - <diskStore path="java.io.tmpdir"/> - - <cacheManagerEventListenerFactory class="" - properties=""/> - - <defaultCache maxElementsInMemory="10000" - eternal="false" - timeToIdleSeconds="120" - timeToLiveSeconds="120" - overflowToDisk="true" - maxElementsOnDisk="10000000" - diskPersistent="false" - diskExpiryThreadIntervalSeconds="120" - memoryStoreEvictionPolicy="LRU"/> - - <cache name="pageManagerOidCache" - maxElementsInMemory="128" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="150" - timeToLiveSeconds="150" - memoryStoreEvictionPolicy="LFU"/> - - <cache name="pageManagerPathCache" - maxElementsInMemory="128" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="150" - timeToLiveSeconds="150" - memoryStoreEvictionPolicy="LFU"/> - -</ehcache> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/interceptors.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/interceptors.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/interceptors.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -16,14 +16,35 @@ limitations under the License. --> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> - +<!-- + Database PSML Manager Interception for handling Cache Rollback + We also have examples here of replay interception for failover to + a second database on update failures + --> <beans> - <!-- - Examples of replay interception for failover to - a second database on update failures - --> - <!-- + <bean id="pageManagerInterceptor" class="org.apache.jetspeed.util.interceptors.PageManagerInterceptor"> + </bean> + + + <bean id="PageManagerTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" + abstract="true"> + <property name="transactionManager"><ref bean="transactionManager"/></property> + <property name="transactionAttributes"> + <props> + <prop key="*">PROPAGATION_REQUIRED</prop> + </props> + </property> + <property name="preInterceptors"> + <list> + <ref local="pageManagerInterceptor" /> + </list> + </property> + </bean> + + <!-- + Replay support: + <bean id="replayTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true"> <property name="transactionManager"><ref bean="transactionManager"/></property> @@ -32,17 +53,17 @@ <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> - <property name="preInterceptors"> + <property name="preInterceptors"> <list> <ref local="methodReplayInterceptor" /> </list> </property> </bean> - - <bean id="replayDecisionMakerBean" + + <bean id="replayDecisionMakerBean" class="org.apache.jetspeed.util.interceptors.TransactionalMethodReplayDecisionMaker"> <property name="sqlErrorCodes"> - <value>9999, 400, -80</value> + <value>9999, 400, -80</value> <value>9999</value> </property> </bean> @@ -52,11 +73,11 @@ <value>3</value> </property> <property name="retryInterval"> - <value>500</value></property> retry every 500 milliseconds + <value>500</value></property> retry every 500 milliseconds <property name="replayDecisionMaker"> <ref bean="replayDecisionMakerBean"/> </property> </bean> - --> - + --> + </beans> Deleted: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/log4j-stdout.properties =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/log4j-stdout.properties 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/log4j-stdout.properties 2009-03-11 02:13:53 UTC (rev 1791) @@ -1,31 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ------------------------------------------------------------------------ -# -# Stdout Logging Configuration -# -# $Id: log4j.properties 722139 2008-12-01 17:22:03Z rwatler $ -# -# ------------------------------------------------------------------------ - -log4j.rootLogger = ERROR, stdout - -log4j.category.org.apache.jetspeed = INFO, stdout -log4j.additivity.org.apache.jetspeed = false - -log4j.appender.stdout = org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout = org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.conversionPattern = %d [%t] %-5p %c - %m%n Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/org/apache/jetspeed/page/TestTransactions.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/org/apache/jetspeed/page/TestTransactions.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/org/apache/jetspeed/page/TestTransactions.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -71,6 +71,12 @@ {"tx-page-manager.xml", "transaction.xml", "interceptors.xml"}; } + protected String[] getBootConfigurations() + { + return new String[] + {"boot/datasource.xml"}; + } + public void testTx() throws Exception { if (pageManager.folderExists("/")) Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/secure-database-page-manager.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/secure-database-page-manager.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/secure-database-page-manager.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -18,20 +18,65 @@ --> <beans> - <import resource="database-page-manager-base.xml"/> - <!-- Page Manager --> - <bean id="pageManagerImpl" init-method="init" class="org.apache.jetspeed.page.impl.DatabasePageManager"> + <bean id="org.apache.jetspeed.page.PageManagerImpl" + name="securePageManagerImpl" + init-method="init" + class="org.apache.jetspeed.page.impl.DatabasePageManager"> <!-- OJB configuration file resource path --> <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg> + <!-- folder/page/link cache size, default=128, min=128 --> + <constructor-arg index="1"><value>128</value></constructor-arg> + <!-- folder/page/link cache expires seconds, default=150, infinite=0, min=30 --> + <constructor-arg index="2"><value>0</value></constructor-arg> <!-- permissions security enabled flag, default=false --> - <constructor-arg index="1"><value>false</value></constructor-arg> + <constructor-arg index="3"><value>false</value></constructor-arg> <!-- constraints security enabled flag, default=true --> - <constructor-arg index="2"><value>true</value></constructor-arg> - <!-- folder/page/link cache --> - <constructor-arg index="3"><ref bean="pageManagerOidCache"/></constructor-arg> - <!-- folder/page/link path cache --> - <constructor-arg index="4"><ref bean="pageManagerPathCache"/></constructor-arg> + <constructor-arg index="4"><value>true</value></constructor-arg> </bean> + <!-- Transaction Proxying --> + <bean id="org.apache.jetspeed.page.PageManager" name="pageManager" parent="baseTransactionProxy"> + <property name="proxyInterfaces"> + <value>org.apache.jetspeed.page.PageManager</value> + </property> + <property name="target"> + <ref bean="securePageManagerImpl" /> + </property> + <property name="transactionAttributes"> + <props> + <prop key="getPage*">PROPAGATION_SUPPORTS</prop> + <prop key="getLink*">PROPAGATION_SUPPORTS</prop> + <prop key="getFolder*">PROPAGATION_SUPPORTS</prop> + <prop key="getContentPage">PROPAGATION_SUPPORTS</prop> + <prop key="getAll">PROPAGATION_SUPPORTS</prop> + <prop key="getUserFolder">PROPAGATION_SUPPORTS</prop> + <prop key="update*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removePage">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removeFolder">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removeLink">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removePageSecurity">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="createUserHomePagesFromRoles">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="deepCopy*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="addPages">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="folderExists">PROPAGATION_SUPPORTS</prop> + <prop key="pageExists">PROPAGATION_SUPPORTS</prop> + <prop key="linkExists">PROPAGATION_SUPPORTS</prop> + <prop key="userFolderExists">PROPAGATION_SUPPORTS</prop> + <prop key="userPageExists">PROPAGATION_SUPPORTS</prop> + </props> + </property> + </bean> + + <!-- Inject Page Manager Proxy into Page Manager --> + <bean id="injectPageManagerProxy" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> + <property name="targetObject"><ref bean="securePageManagerImpl"/></property> + <property name="targetMethod"><value>setPageManagerProxy</value></property> + <property name="arguments"> + <list> + <ref bean="pageManager"/> + </list> + </property> + </bean> + </beans> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/secure-permissions-database-page-manager.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/secure-permissions-database-page-manager.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/secure-permissions-database-page-manager.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -18,20 +18,65 @@ --> <beans> - <import resource="database-page-manager-base.xml"/> - <!-- Page Manager --> - <bean name="pageManagerImpl" init-method="init" class="org.apache.jetspeed.page.impl.DatabasePageManager"> + <bean id="org.apache.jetspeed.page.PageManagerImpl" + name="securePermissionsPageManagerImpl" + init-method="init" + class="org.apache.jetspeed.page.impl.DatabasePageManager"> <!-- OJB configuration file resource path --> <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg> + <!-- folder/page/link cache size, default=128, min=128 --> + <constructor-arg index="1"><value>128</value></constructor-arg> + <!-- folder/page/link cache expires seconds, default=150, infinite=0, min=30 --> + <constructor-arg index="2"><value>0</value></constructor-arg> <!-- permissions security enabled flag, default=false --> - <constructor-arg index="1"><value>true</value></constructor-arg> + <constructor-arg index="3"><value>true</value></constructor-arg> <!-- constraints security enabled flag, default=true --> - <constructor-arg index="2"><value>false</value></constructor-arg> - <!-- folder/page/link cache --> - <constructor-arg index="3"><ref bean="pageManagerOidCache"/></constructor-arg> - <!-- folder/page/link path cache --> - <constructor-arg index="4"><ref bean="pageManagerPathCache"/></constructor-arg> + <constructor-arg index="4"><value>false</value></constructor-arg> </bean> + <!-- Transaction Proxying --> + <bean id="org.apache.jetspeed.page.PageManager" name="pageManager" parent="baseTransactionProxy"> + <property name="proxyInterfaces"> + <value>org.apache.jetspeed.page.PageManager</value> + </property> + <property name="target"> + <ref bean="securePermissionsPageManagerImpl" /> + </property> + <property name="transactionAttributes"> + <props> + <prop key="getPage*">PROPAGATION_SUPPORTS</prop> + <prop key="getLink*">PROPAGATION_SUPPORTS</prop> + <prop key="getFolder*">PROPAGATION_SUPPORTS</prop> + <prop key="getContentPage">PROPAGATION_SUPPORTS</prop> + <prop key="getAll">PROPAGATION_SUPPORTS</prop> + <prop key="getUserFolder">PROPAGATION_SUPPORTS</prop> + <prop key="update*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removePage">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removeFolder">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removeLink">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removePageSecurity">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="createUserHomePagesFromRoles">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="deepCopy*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="addPages">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="folderExists">PROPAGATION_SUPPORTS</prop> + <prop key="pageExists">PROPAGATION_SUPPORTS</prop> + <prop key="linkExists">PROPAGATION_SUPPORTS</prop> + <prop key="userFolderExists">PROPAGATION_SUPPORTS</prop> + <prop key="userPageExists">PROPAGATION_SUPPORTS</prop> + </props> + </property> + </bean> + + <!-- Inject Page Manager Proxy into Page Manager --> + <bean id="injectPageManagerProxy" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> + <property name="targetObject"><ref bean="securePermissionsPageManagerImpl"/></property> + <property name="targetMethod"><value>setPageManagerProxy</value></property> + <property name="arguments"> + <list> + <ref bean="pageManager"/> + </list> + </property> + </bean> + </beans> Copied: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/tx-page-manager.xml (from rev 1784, pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/tx-page-manager.xml) =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/tx-page-manager.xml (rev 0) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/page-manager/src/test/tx-page-manager.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<beans> + + <!-- Page Manager --> + <bean id="org.apache.jetspeed.page.PageManagerImpl" + name="securePageManagerImpl" + init-method="init" + class="org.apache.jetspeed.page.impl.DatabasePageManager"> + <!-- OJB configuration file resource path --> + <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg> + <!-- folder/page/link cache size, default=128, min=128 --> + <constructor-arg index="1"><value>128</value></constructor-arg> + <!-- folder/page/link cache expires seconds, default=150, infinite=0, min=30 --> + <constructor-arg index="2"><value>0</value></constructor-arg> + <!-- permissions security enabled flag, default=false --> + <constructor-arg index="3"><value>false</value></constructor-arg> + <!-- constraints security enabled flag, default=true --> + <constructor-arg index="4"><value>false</value></constructor-arg> + </bean> + + <!-- Transaction Proxying --> + <bean id="org.apache.jetspeed.page.PageManager" name="pageManager" parent="PageManagerTransactionProxy"> + <property name="proxyInterfaces"> + <value>org.apache.jetspeed.page.PageManager</value> + </property> + <property name="target"> + <ref bean="securePageManagerImpl" /> + </property> + <property name="transactionAttributes"> + <props> + <prop key="getPage*">PROPAGATION_SUPPORTS</prop> + <prop key="getLink*">PROPAGATION_SUPPORTS</prop> + <prop key="getFolder*">PROPAGATION_SUPPORTS</prop> + <prop key="getContentPage">PROPAGATION_SUPPORTS</prop> + <prop key="getAll">PROPAGATION_SUPPORTS</prop> + <prop key="getUserFolder">PROPAGATION_SUPPORTS</prop> + <prop key="update*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removePage">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removeFolder">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removeLink">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="removePageSecurity">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="createUserHomePagesFromRoles">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="deepCopy*">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="addPages">PROPAGATION_REQUIRED,-org.apache.jetspeed.page.document.NodeException</prop> + <prop key="folderExists">PROPAGATION_SUPPORTS</prop> + <prop key="pageExists">PROPAGATION_SUPPORTS</prop> + <prop key="linkExists">PROPAGATION_SUPPORTS</prop> + <prop key="userFolderExists">PROPAGATION_SUPPORTS</prop> + <prop key="userPageExists">PROPAGATION_SUPPORTS</prop> + </props> + </property> + </bean> + + <!-- Inject Page Manager Proxy into Page Manager --> + <bean id="injectPageManagerProxy" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> + <property name="targetObject"><ref bean="securePageManagerImpl"/></property> + <property name="targetMethod"><value>setPageManagerProxy</value></property> + <property name="arguments"> + <list> + <ref bean="pageManager"/> + </list> + </property> + </bean> + +</beans> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/test/org/apache/jetspeed/container/state/TestNavigationalState.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/test/org/apache/jetspeed/container/state/TestNavigationalState.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/test/org/apache/jetspeed/container/state/TestNavigationalState.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -131,9 +131,6 @@ portletApplicationMock.expects(new AnyArgumentsMatcher()).method( "getId").withNoArguments().will( new ReturnStub(new JetspeedLongObjectID(1))); - portletApplicationMock.expects(new AnyArgumentsMatcher()).method( - "getName").withNoArguments().will(new ReturnStub("app1")); - portletDefinitionMock.expects(new AnyArgumentsMatcher()).method( "getPortletApplicationDefinition").withNoArguments().will( new ReturnStub(portletApplicationMock.proxy())); Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/core-build.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/core-build.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/core-build.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -106,25 +106,11 @@ </dependency> <dependency> <id>ehcache</id> - <version>1.5.0</version> + <version>1.2.4</version> <properties> <war.bundle>true</war.bundle> </properties> </dependency> - <dependency> - <id>backport-util-concurrent</id> - <version>3.1</version> - <properties> - <war.bundle>true</war.bundle> - </properties> - </dependency> - <dependency> - <id>jsr107cache</id> - <version>1.0</version> - <properties> - <war.bundle>true</war.bundle> - </properties> - </dependency> <!-- jakarta commons and other misc. jakarta projects --> <dependency> @@ -265,13 +251,6 @@ <war.bundle>false</war.bundle> </properties> </dependency> - <dependency> - <id>commons-jexl</id> - <version>1.1</version> - <properties> - <war.bundle>false</war.bundle> - </properties> - </dependency> <!--XML Apis and manipulation --> <dependency> Deleted: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/db-ojb/distributed-ehcache.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/db-ojb/distributed-ehcache.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/db-ojb/distributed-ehcache.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -1,543 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd"> - - <!-- - DiskStore configuration - - Sets the path to the directory where cache files are created. - - If the path is a Java System Property it is replaced by its value in the - running VM. - - The following properties are translated: - * user.home - User's home directory - * user.dir - User's current working directory - * java.io.tmpdir - Default temp file path - - Subdirectories can be specified below the property e.g. java.io.tmpdir/one - --> - <diskStore path="java.io.tmpdir"/> - - <!-- - Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider, - which is notified when Caches are added or removed from the CacheManager. - - The attributes of CacheManagerEventListenerFactory are: - * class - a fully qualified factory class name - * properties - comma separated properties having meaning only to the factory. - - Sets the fully qualified class name to be registered as the CacheManager event listener. - - The events include: - * adding a Cache - * removing a Cache - - Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility - of the implementer to safely handle the potential performance and thread safety issues - depending on what their listener is doing. - - If no class is specified, no listener is created. There is no default. - --> - <cacheManagerEventListenerFactory class="" properties=""/> - - - <!-- - (Enable for distributed operation) - - Specifies a CacheManagerPeerProviderFactory which will be used to create a - CacheManagerPeerProvider, which discovers other CacheManagers in the cluster. - - The attributes of cacheManagerPeerProviderFactory are: - * class - a fully qualified factory class name - * properties - comma separated properties having meaning only to the factory. - - Ehcache comes with a built-in RMI-based distribution system with two means of discovery of - CacheManager peers participating in the cluster: - * automatic, using a multicast group. This one automatically discovers peers and detects - changes such as peers entering and leaving the group - * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at - configuration time. - - Configuring Automatic Discovery: - Automatic discovery is configured as per the following example: - <cacheManagerPeerProviderFactory - class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" - properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, - multicastGroupPort=4446, timeToLive=32"/> - - Valid properties are: - * peerDiscovery (mandatory) - specify "automatic" - * multicastGroupAddress (mandatory) - specify a valid multicast group address - * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat - traffic - * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate. - By convention, the restrictions are: - 0 - the same host - 1 - the same subnet - 32 - the same site - 64 - the same region - 128 - the same continent - 255 - unrestricted - - Configuring Manual Discovery: - Manual discovery is configured as per the following example: - <cacheManagerPeerProviderFactory class= - "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" - properties="peerDiscovery=manual, - rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1 - | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/> - - Valid properties are: - * peerDiscovery (mandatory) - specify "manual" - * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form - //hostname:port - - The hostname is the hostname of the remote CacheManager peer. The port is the listening - port of the RMICacheManagerPeerListener of the remote CacheManager peer. - - An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other - CacheManagers in the cluster. Only manual discovery is supported. - - For cacheManagerPeerProviderFactory specify class - net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory. - - Correspondingly for cacheManagerPeerListenerFactory specify class - net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory. - - Configuring JNDI Manual Discovery: - Manual JNDI discovery is configured as per the following example: - <cacheManagerPeerProviderFactory class= - "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory" - properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true, - jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1 - |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/> - - Valid properties are: - * peerDiscovery (mandatory) - specify "manual" - * stashContexts (optional) - specify "true" or "false". Defaults to true. - java.naming.Context objects are stashed for performance. - * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true. - CachePeer objects are stashed for performance. - * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls, - in the form protocol//hostname:port - --> - - <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" - properties="peerDiscovery=automatic, - multicastGroupAddress=${org.apache.jetspeed.ehcache.group.address}, - multicastGroupPort=${org.apache.jetspeed.ehcache.group.port}, - timeToLive=${org.apache.jetspeed.ehcache.group.ttl}"/> - - <!-- - (Enable for distributed operation) - - Specifies a CacheManagerPeerListenerFactory which will be used to create a - CacheManagerPeerListener, which - listens for messages from cache replicators participating in the cluster. - - The attributes of cacheManagerPeerListenerFactory are: - class - a fully qualified factory class name - properties - comma separated properties having meaning only to the factory. - - Ehcache comes with a built-in RMI-based distribution system. The listener component is - RMICacheManagerPeerListener which is configured using - RMICacheManagerPeerListenerFactory. It is configured as per the following example: - - <cacheManagerPeerListenerFactory - class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" - properties="hostName=fully_qualified_hostname_or_ip, - port=40001, - socketTimeoutMillis=120000"/> - - All properties are optional. They are: - * hostName - the hostName of the host the listener is running on. Specify - where the host is multihomed and you want to control the interface over which cluster - messages are received. Defaults to the host name of the default interface if not - specified. - * port - the port the listener listens on. This defaults to a free port if not specified. - * socketTimeoutMillis - the number of ms client sockets will stay open when sending - messages to the listener. This should be long enough for the slowest message. - If not specified it defaults 120000ms. - - - An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of - listeners for messages from cache replicators participating in the cluster. For - cacheManagerPeerListenerFactory specify - class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory. - Correspondingly for cacheManagerPeerProviderFactory specify class - net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory. - Properties for JNDIRMICacheManagerPeerListenerFactory are the same as - RMICacheManagerPeerListenerFactory. - --> - - <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" - properties="hostName=${org.apache.jetspeed.ehcache.hostname}, - port=${org.apache.jetspeed.ehcache.port}"/> - - <!-- Cache configuration. - - The following attributes are required. - - name: - Sets the name of the cache. This is used to identify the cache. It must be unique. - - maxElementsInMemory: - Sets the maximum number of objects that will be created in memory - - maxElementsOnDisk: - Sets the maximum number of objects that will be maintained in the DiskStore - The default value is zero, meaning unlimited. - - eternal: - Sets whether elements are eternal. If eternal, timeouts are ignored and the - element is never expired. - - overflowToDisk: - Sets whether elements can overflow to disk when the memory store - has reached the maxInMemory limit. - - The following attributes are optional. - - timeToIdleSeconds: - Sets the time to idle for an element before it expires. - i.e. The maximum amount of time between accesses before an element expires - Is only used if the element is not eternal. - Optional attribute. A value of 0 means that an Element can idle for infinity. - The default value is 0. - - timeToLiveSeconds: - Sets the time to live for an element before it expires. - i.e. The maximum time between creation time and when an element expires. - Is only used if the element is not eternal. - Optional attribute. A value of 0 means that and Element can live for infinity. - The default value is 0. - - diskPersistent: - Whether the disk store persists between restarts of the Virtual Machine. - The default value is false. - - diskExpiryThreadIntervalSeconds: - The number of seconds between runs of the disk expiry thread. The default value - is 120 seconds. - - memoryStoreEvictionPolicy: - Policy would be enforced upon reaching the maxElementsInMemory limit. Default - policy is Least Recently Used (specified as LRU). Other policies available - - First In First Out (specified as FIFO) and Less Frequently Used - (specified as LFU) - - Cache elements can also contain sub elements which take the same format of a factory class - and properties. Defined sub-elements are: - - * cacheEventListenerFactory - Enables registration of listeners for cache events, such as - put, remove, update, and expire. - - * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a - cache on initialisation to prepopulate itself. - - Each cache that will be distributed needs to set a cache event listener which replicates - messages to the other CacheManager peers. For the built-in RMI implementation this is done - by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each - distributed cache's configuration as per the following example: - - <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" - properties="replicateAsynchronously=true, - replicatePuts=true, - replicateUpdates=true, - replicateUpdatesViaCopy=true, - replicateRemovals=true "/> - - The RMICacheReplicatorFactory recognises the following properties: - - * replicatePuts=true|false - whether new elements placed in a cache are - replicated to others. Defaults to true. - - * replicateUpdates=true|false - whether new elements which override an - element already existing with the same key are replicated. Defaults to true. - - * replicateRemovals=true - whether element removals are replicated. Defaults to true. - - * replicateAsynchronously=true | false - whether replications are - asynchronous (true) or synchronous (false). Defaults to true. - - * replicateUpdatesViaCopy=true | false - whether the new elements are - copied to other caches (true), or whether a remove message is sent. Defaults to true. - - * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous - replicator runs at a set interval of milliseconds. The default is 1000. The minimum - is 10. This property is only applicable if replicateAsynchronously=true - - The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are - used. It is configured as per the following example: - - <bootstrapCacheLoaderFactory - class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" - properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/> - - The RMIBootstrapCacheLoaderFactory recognises the following optional properties: - - * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background - after the cache has started. If false, bootstrapping must complete before the cache is - made available. The default value is true. - - * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the - memory limits of the VM. This property allows the bootstraper to fetched elements in - chunks. The default chunk size is 5000000 (5MB). - - --> - - <!-- - Mandatory Default Cache configuration. These settings will be applied to caches - created programmtically using CacheManager.add(String cacheName) - --> - <defaultCache - maxElementsInMemory="10000" - eternal="false" - timeToIdleSeconds="120" - timeToLiveSeconds="120" - overflowToDisk="true" - maxElementsOnDisk="10000000" - diskPersistent="false" - diskExpiryThreadIntervalSeconds="120" - memoryStoreEvictionPolicy="LRU" - /> - - <!-- - Jetspeed caches. - --> - - <!-- - JSR-168 Portlet Content Cache - This cache implements the JSR-168 caching specification. - The timeToIdle and timeToLive are set to defaults here, but are - always overriden on a per cache-element basis based on the portlet deployment - descriptor value. - - If there are more than 10000 elements it will overflow to the - disk cache, which in this configuration will go to wherever java.io.tmp is - defined on your system. On a standard Linux system this will be /tmp - timeToIdleSeconds and timeToLiveSeconds to live are both set at 8 hours (28800) - this is the default setting for portlets who set their expiration cache as -1 - --> - <cache name="portletContentCache" - maxElementsInMemory="10000" - maxElementsOnDisk="1000" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="28800" - timeToLiveSeconds="28800" - memoryStoreEvictionPolicy="LFU" - /> - - <cache name="preferencesCache" - maxElementsInMemory="10000" - maxElementsOnDisk="1000" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="28800" - timeToLiveSeconds="28800" - memoryStoreEvictionPolicy="LFU"> - <cacheEventListenerFactory - class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" - properties="replicateAsynchronously=true, replicatePuts=false, - replicateUpdates=false, replicateUpdatesViaCopy=false, - replicateRemovals=true"/> - </cache> - - - <cache name="portletApplicationOidCache" - maxElementsInMemory="500" - maxElementsOnDisk="1000" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="28800" - timeToLiveSeconds="28800" - memoryStoreEvictionPolicy="LFU"> - </cache> - - <cache name="portletApplicationNameCache" - maxElementsInMemory="500" - maxElementsOnDisk="1000" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="28800" - timeToLiveSeconds="28800" - memoryStoreEvictionPolicy="LFU"> - <cacheEventListenerFactory - class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" - properties="replicateAsynchronously=true, replicatePuts=false, - replicateUpdates=false, replicateUpdatesViaCopy=false, - replicateRemovals=true"/> - </cache> - - <cache name="portletDefinitionOidCache" - maxElementsInMemory="2000" - maxElementsOnDisk="1000" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="28800" - timeToLiveSeconds="28800" - memoryStoreEvictionPolicy="LFU"> - </cache> - - <cache name="portletDefinitionNameCache" - maxElementsInMemory="2000" - maxElementsOnDisk="1000" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="28800" - timeToLiveSeconds="28800" - memoryStoreEvictionPolicy="LFU"> - <cacheEventListenerFactory - class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" - properties="replicateAsynchronously=true, replicatePuts=false, - replicateUpdates=false, replicateUpdatesViaCopy=false, - replicateRemovals=true"/> - </cache> - - - <cache name="decorationConfigurationCache" - maxElementsInMemory="500" - maxElementsOnDisk="250" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="3600" - timeToLiveSeconds="3600" - memoryStoreEvictionPolicy="LFU"> - </cache> - - <cache name="desktopContentCache" - maxElementsInMemory="500" - maxElementsOnDisk="250" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="3600" - timeToLiveSeconds="3600" - memoryStoreEvictionPolicy="LFU"> - </cache> - - <!-- - Sample distributed cache named sampleDistributedCache1. - This cache replicates using defaults. - It also bootstraps from the cluster, using default properties. - <cache name="sampleDistributedCache1" - maxElementsInMemory="10" - eternal="false" - timeToIdleSeconds="100" - timeToLiveSeconds="100" - overflowToDisk="false"> - <cacheEventListenerFactory - class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/> - <bootstrapCacheLoaderFactory - class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/> - </cache> - --> - - - <!-- - Sample distributed cache named sampleDistributedCache2. - This cache replicates using specific properties. - It only replicates updates and does so synchronously via copy - <cache name="sampleDistributedCache2" - maxElementsInMemory="10" - eternal="false" - timeToIdleSeconds="100" - timeToLiveSeconds="100" - overflowToDisk="false"> - <cacheEventListenerFactory - class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" - properties="replicateAsynchronously=false, replicatePuts=false, - replicateUpdates=true, replicateUpdatesViaCopy=true, - replicateRemovals=false"/> - </cache> - --> - - <!-- - Sample distributed cache named sampleDistributedCache3. - This cache replicates using defaults except that the asynchronous replication - interval is set to 200ms. - <cache name="sampleDistributedCache3" - maxElementsInMemory="10" - eternal="false" - timeToIdleSeconds="100" - timeToLiveSeconds="100" - overflowToDisk="false"> - <cacheEventListenerFactory - class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" - properties="asynchronousReplicationIntervalMillis=200"/> - </cache> - --> - - <cache name="authenticationCache" - maxElementsInMemory="1000" - maxElementsOnDisk="1000" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="30" - timeToLiveSeconds="30" - memoryStoreEvictionPolicy="LFU" - /> - - <cache name="portletWindowCache" - maxElementsInMemory="200" - maxElementsOnDisk="1000" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="28800" - timeToLiveSeconds="28800" - memoryStoreEvictionPolicy="LFU"/> - - <cache name="decorationContentCache" - maxElementsInMemory="1000" - maxElementsOnDisk="1000" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="28800" - timeToLiveSeconds="28800" - memoryStoreEvictionPolicy="LFU" - /> - - <!-- - Jetspeed Page Manager Caches - --> - - <cache name="pageManagerOidCache" - maxElementsInMemory="${org.apache.jetspeed.ehcache.pagemanager.maxelements}" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - timeToLiveSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - memoryStoreEvictionPolicy="LFU"/> - - <cache name="pageManagerPathCache" - maxElementsInMemory="${org.apache.jetspeed.ehcache.pagemanager.maxelements}" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - timeToLiveSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - memoryStoreEvictionPolicy="LFU"> - <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" - properties="replicateAsynchronously=true, - replicatePuts=false, - replicateUpdates=false, - replicateUpdatesViaCopy=false, - replicateRemovals=true"/> - </cache> - -</ehcache> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/db-ojb/ehcache.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/db-ojb/ehcache.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/db-ojb/ehcache.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -135,7 +135,13 @@ * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true. CachePeer objects are stashed for performance. * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls, - in the form protocol//hostname:port + in the form protocol//hostname:port + + <cacheManagerPeerProviderFactory + class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" + properties="peerDiscovery=automatic, + multicastGroupAddress=230.0.0.1, + multicastGroupPort=4446, timeToLive=1"/> --> @@ -179,6 +185,9 @@ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory. Properties for JNDIRMICacheManagerPeerListenerFactory are the same as RMICacheManagerPeerListenerFactory. + + <cacheManagerPeerListenerFactory + class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/> --> @@ -323,7 +332,8 @@ If there are more than 10000 elements it will overflow to the disk cache, which in this configuration will go to wherever java.io.tmp is - defined on your system. On a standard Linux system this will be /tmp + defined on your system. On a standard Linux system this will be /tmp" + timeToIdleSeconds and timeToLiveSeconds to live are both set at 8 hours (28800) this is the default setting for portlets who set their expiration cache as -1 --> @@ -345,6 +355,13 @@ timeToIdleSeconds="28800" timeToLiveSeconds="28800" memoryStoreEvictionPolicy="LFU"> +<!-- + <cacheEventListenerFactory + class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" + properties="replicateAsynchronously=true, replicatePuts=false, + replicateUpdates=false, replicateUpdatesViaCopy=false, + replicateRemovals=true"/> + --> </cache> @@ -366,6 +383,13 @@ timeToIdleSeconds="28800" timeToLiveSeconds="28800" memoryStoreEvictionPolicy="LFU"> +<!-- + <cacheEventListenerFactory + class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" + properties="replicateAsynchronously=true, replicatePuts=false, + replicateUpdates=false, replicateUpdatesViaCopy=false, + replicateRemovals=true"/> + --> </cache> <cache name="portletDefinitionOidCache" @@ -386,6 +410,13 @@ timeToIdleSeconds="28800" timeToLiveSeconds="28800" memoryStoreEvictionPolicy="LFU"> + <!-- + <cacheEventListenerFactory + class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" + properties="replicateAsynchronously=true, replicatePuts=false, + replicateUpdates=false, replicateUpdatesViaCopy=false, + replicateRemovals=true"/> + --> </cache> @@ -510,24 +541,4 @@ memoryStoreEvictionPolicy="LFU" /> - <!-- - Jetspeed Page Manager Caches - --> - - <cache name="pageManagerOidCache" - maxElementsInMemory="${org.apache.jetspeed.ehcache.pagemanager.maxelements}" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - timeToLiveSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - memoryStoreEvictionPolicy="LFU"/> - - <cache name="pageManagerPathCache" - maxElementsInMemory="${org.apache.jetspeed.ehcache.pagemanager.maxelements}" - eternal="false" - overflowToDisk="false" - timeToIdleSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - timeToLiveSeconds="${org.apache.jetspeed.ehcache.pagemanager.element.ttl}" - memoryStoreEvictionPolicy="LFU"/> - </ehcache> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/assembly/import-page-manager.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/assembly/import-page-manager.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/assembly/import-page-manager.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -24,14 +24,14 @@ class="org.apache.jetspeed.page.impl.DatabasePageManager"> <!-- OJB configuration file resource path --> <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg> + <!-- folder/page/link cache size, default=128, min=128 --> + <constructor-arg index="1"><value>128</value></constructor-arg> + <!-- folder/page/link cache expires seconds, default=150, infinite=0, min=30 --> + <constructor-arg index="2"><value>0</value></constructor-arg> <!-- permissions security enabled flag, default=false --> - <constructor-arg index="1"><value>false</value></constructor-arg> + <constructor-arg index="3"><value>false</value></constructor-arg> <!-- constraints security enabled flag, default=true --> - <constructor-arg index="2"><value>false</value></constructor-arg> - <!-- folder/page/link cache --> - <constructor-arg index="3"><ref bean="pageManagerOidCache"/></constructor-arg> - <!-- folder/page/link path cache --> - <constructor-arg index="4"><ref bean="pageManagerPathCache"/></constructor-arg> + <constructor-arg index="4"><value>false</value></constructor-arg> </bean> <!-- Proxying --> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/build.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/build.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/build.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -89,7 +89,6 @@ <include name="etc/db-ojb/*"/> <include name="etc/import/assembly/import-page-manager.xml"/> <include name="etc/import/assembly/repository-datasource-spring.xml"/> - <include name="src/webapp/WEB-INF/assembly/cache.xml"/> <include name="src/webapp/WEB-INF/assembly/transaction.xml"/> <include name="src/webapp/WEB-INF/assembly/alternate/interceptors.xml"/> </fileset> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/export.properties =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/export.properties 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/export.properties 2009-03-11 02:13:53 UTC (rev 1791) @@ -16,7 +16,7 @@ # comma-separated list of boot assemblies for Spring boot.assemblies = repository-datasource-spring.xml # comma-separated list of assemblies for Spring -assemblies = import-page-manager.xml, transaction.xml, interceptors.xml, cache.xml +assemblies = import-page-manager.xml, transaction.xml, interceptors.xml # root folder to start importing from root.folder = / # overwrite folders flag, set to true to replace existing folders Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/import.properties =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/import.properties 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/etc/import/import.properties 2009-03-11 02:13:53 UTC (rev 1791) @@ -16,7 +16,7 @@ # comma-separated list of boot assemblies for Spring boot.assemblies = repository-datasource-spring.xml # comma-separated list of assemblies for Spring -assemblies = import-page-manager.xml, transaction.xml, interceptors.xml, cache.xml +assemblies = import-page-manager.xml, transaction.xml, interceptors.xml # root folder to start exporting from root.folder = / # overwrite folders flag, set to true to replace existing folders Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/cache/JetspeedCache.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/cache/JetspeedCache.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/cache/JetspeedCache.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -145,11 +145,4 @@ * @return the size of the cache */ int getSize(); - - /** - * Returns whether this cache is currently part of a distributed cache cluster. - * - * @return distributed flag - */ - boolean isDistributed(); } \ No newline at end of file Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java 2009-03-11 02:13:53 UTC (rev 1791) @@ -40,7 +40,6 @@ import org.apache.jetspeed.page.document.DocumentNotFoundException; import org.apache.jetspeed.page.document.FailedToDeleteDocumentException; import org.apache.jetspeed.page.document.FailedToUpdateDocumentException; -import org.apache.jetspeed.page.document.Node; import org.apache.jetspeed.page.document.NodeException; import org.apache.jetspeed.page.document.NodeSet; import org.apache.jetspeed.page.document.UnsupportedDocumentTypeException; @@ -782,19 +781,4 @@ * @return */ public boolean checkConstraint(String securityConstraintName, String actions); - - /** - * Returns whether the page manager cache is currently part of a distributed - * cache cluster. - * - * @return distributed flag - */ - public boolean isDistributed(); - - /** - * Notify page manager listeners that node modification was externally detected. - * - * @param node updated managed node if known - */ - public void notifyUpdatedNode(Node node); } Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/maven.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/maven.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/maven.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -348,8 +348,6 @@ file="./src/webapp/WEB-INF/assembly/transaction.xml"/> <copy todir="${maven.build.dir}/classes" file="./src/webapp/WEB-INF/assembly/alternate/interceptors.xml"/> - <copy todir="${maven.build.dir}/classes" - file="./src/webapp/WEB-INF/assembly/cache.xml"/> <java classname="org.apache.jetspeed.page.PageImporter" fork="yes"> <classpath> <path refid="maven.dependency.classpath"/> @@ -387,8 +385,6 @@ file="./src/webapp/WEB-INF/assembly/transaction.xml"/> <copy todir="${maven.build.dir}/classes" file="./src/webapp/WEB-INF/assembly/alternate/interceptors.xml"/> - <copy todir="${maven.build.dir}/classes" - file="./src/webapp/WEB-INF/assembly/cache.xml"/> <mkdir dir="./target/export/psml"></mkdir> <java classname="org.apache.jetspeed.page.PageImporter" fork="yes"> <classpath> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/src/webapp/WEB-INF/assembly/alternate/db-page-manager.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/src/webapp/WEB-INF/assembly/alternate/db-page-manager.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/src/webapp/WEB-INF/assembly/alternate/db-page-manager.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -25,14 +25,15 @@ class="org.apache.jetspeed.page.impl.DatabasePageManager"> <!-- OJB configuration file resource path --> <constructor-arg index="0"><value>JETSPEED-INF/ojb/page-manager-repository.xml</value></constructor-arg> + <!-- folder/page/link cache size, default=128, min=128 --> + <constructor-arg index="1"><value>128</value></constructor-arg> + <!-- folder/page/link cache expires seconds, default=-1, infinite=0, min=30 --> + <!-- (default is 150 seconds) --> + <constructor-arg index="2"><value>-1</value></constructor-arg> <!-- permissions security enabled flag, default=false --> - <constructor-arg index="1"><value>false</value></constructor-arg> + <constructor-arg index="3"><value>false</value></constructor-arg> <!-- constraints security enabled flag, default=true --> - <constructor-arg index="2"><value>true</value></constructor-arg> - <!-- folder/page/link cache --> - <constructor-arg index="3"><ref bean="pageManagerOidCache"/></constructor-arg> - <!-- folder/page/link path cache --> - <constructor-arg index="4"><ref bean="pageManagerPathCache"/></constructor-arg> + <constructor-arg index="4"><value>true</value></constructor-arg> </bean> <!-- Transaction Proxying --> Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/src/webapp/WEB-INF/assembly/cache.xml =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/src/webapp/WEB-INF/assembly/cache.xml 2009-03-08 00:21:20 UTC (rev 1790) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/src/webapp/WEB-INF/assembly/cache.xml 2009-03-11 02:13:53 UTC (rev 1791) @@ -18,15 +18,11 @@ --> <beans> - <!-- Cache Manager --> - <bean id="cacheManagerConfig" class="org.apache.jetspeed.cache.impl.EhCacheConfigResource"> - <!-- <property name="defaultConfigResource" value="distributed-ehcache.xml"/> --> - <property name="defaultConfigResource" value="ehcache.xml"/> - </bean> - <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> - <property name="configLocation" ref="cacheManagerConfig"/> + <!-- get it through the class path + <property name="configLocation" value="${applicationRoot}/WEB-INF/conf/ehcache.xml"/> + --> </bean> <!-- Factory bean used to instantiate a EHCache with the specified name (and corresponding @@ -104,7 +100,7 @@ <bean id="decorationConfigurationCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl"> <constructor-arg> - <ref bean="ehDesktopContentCache" /> + <ref bean="ehDecorationConfigurationCache" /> </constructor-arg> </bean> @@ -139,14 +135,6 @@ <property name="cacheName" value="portletApplicationNameCache" /> </bean> - <bean id="ehDesktopContentCache" - class="org.springframework.cache.ehcache.EhCacheFactoryBean"> - <property name="cacheManager"> - <ref local="cacheManager" /> - </property> - <property name="cacheName" value="desktopContentCache" /> - </bean> - <bean id="portletApplicationOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl"> <constructor-arg> @@ -161,13 +149,6 @@ </constructor-arg> </bean> - <bean id="desktopContentCache" - class="org.apache.jetspeed.cache.impl.EhCacheImpl"> - <constructor-arg> - <ref bean="ehDesktopContentCache" /> - </constructor-arg> - </bean> - <bean id="ehPortletDefinitionOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> <property name="cacheManager"> @@ -232,23 +213,30 @@ </constructor-arg> </bean> - <!-- Page Manager Caches --> - <bean id="ehPageManagerOidCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> - <property name="cacheManager" ref="cacheManager"/> - <property name="cacheName" value="pageManagerOidCache"/> - </bean> - - <bean id="ehPageManagerPathCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> - <property name="cacheManager" ref="cacheManager"/> - <property name="cacheName" value="pageManagerPathCache"/> - </bean> - - <bean id="pageManagerOidCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl"> - <constructor-arg><ref bean="ehPageManagerOidCache"/></constructor-arg> - </bean> - - <bean id="pageManagerPathCache" class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl"> - <constructor-arg><ref bean="ehPageManagerPathCache"/></constructor-arg> - </bean> - + <bean id="ehInternalPageFileCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> + <property name="cacheManager"> + <ref local="cacheManager" /> + </property> + <property name="cacheName" value="pageFileCache" /> + </bean> + + <bean id="internalPageFileCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl"> + <constructor-arg> + <ref bean="ehInternalPageFileCache" /> + </constructor-arg> + </bean> + + <bean id="ehInternalImportPageFileCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> + <property name="cacheManager"> + <ref local="cacheManager" /> + </property> + <property name="cacheName" value="importPageFileCache" /> + </bean> + + <bean id="internalImportPageFileCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl"> + <constructor-arg> + <ref bean="ehInternalImportPageFileCache" /> + </constructor-arg> + </bean> + </beans>