portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r506339 [2/2] - in /portals/jetspeed-2/trunk: ./ applications/demo/src/webapp/WEB-INF/ applications/gems/src/java/org/apache/portals/gems/util/ applications/j2-admin/src/webapp/WEB-INF/ applications/rss/src/webapp/WEB-INF/ components/page-m...
Date Mon, 12 Feb 2007 07:03:09 GMT
Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ActionValveImpl.java Sun Feb 11 23:03:07 2007
@@ -16,7 +16,9 @@
 package org.apache.jetspeed.pipeline.valve.impl;
 
 import java.io.IOException;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 
 import javax.portlet.PortletException;
 import javax.servlet.http.HttpServletRequest;
@@ -25,10 +27,14 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.cache.JetspeedCache;
 import org.apache.jetspeed.container.window.PortletWindowAccessor;
+import org.apache.jetspeed.exception.JetspeedException;
 import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
+import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.ContentFragmentImpl;
+import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.pipeline.PipelineException;
@@ -38,6 +44,7 @@
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.om.entity.PortletEntity;
 import org.apache.pluto.om.window.PortletWindow;
 
 /**
@@ -61,17 +68,20 @@
     private PortletContainer container;
     private PortletWindowAccessor windowAccessor;
     private boolean patchResponseCommitted = false;
+    private JetspeedCache portletContentCache;
 
-    public ActionValveImpl(PortletContainer container, PortletWindowAccessor windowAccessor)
+    public ActionValveImpl(PortletContainer container, PortletWindowAccessor windowAccessor, JetspeedCache portletContentCache)
     {
         this.container = container;
         this.windowAccessor = windowAccessor;
+        this.portletContentCache = portletContentCache;
     }
     
-    public ActionValveImpl(PortletContainer container, PortletWindowAccessor windowAccessor, boolean patchResponseCommitted)
+    public ActionValveImpl(PortletContainer container, PortletWindowAccessor windowAccessor, JetspeedCache portletContentCache, boolean patchResponseCommitted)
     {
         this.container = container;
         this.windowAccessor = windowAccessor;
+        this.portletContentCache = portletContentCache;        
         this.patchResponseCommitted = patchResponseCommitted;
     }
 
@@ -119,6 +129,9 @@
                 
                 //msg.processActionMessage("todo", request);
                 
+                // clear the cache for all portlets on the current page
+                clearPortletCacheForPage(request, actionWindow);
+                
                 if (patchResponseCommitted)
                 {
                     responseCommitted = true;
@@ -172,6 +185,93 @@
 
     }
 
+    protected void clearPortletCacheForPage(RequestContext request, PortletWindow actionWindow)
+    throws JetspeedException
+    {
+        ContentPage page = request.getPage();
+        if (null == page)
+        {
+            throw new JetspeedException("Failed to find PSML Pin ContentPageAggregator.build");
+        }
+        ContentFragment root = page.getRootContentFragment();
+        if (root == null)
+        {
+            throw new JetspeedException("No root ContentFragment found in ContentPage");
+        }
+        if (!isNonStandardAction(actionWindow))
+        {
+            notifyFragments(root, request, page);
+        }
+        else
+        {
+            ContentFragment fragment = page.getContentFragmentById(actionWindow.getId().toString());
+            clearTargetCache(fragment, request);
+        }
+    }
+    
+    /**
+     * Actions can be marked as non-standard if they don't participate in
+     * JSR-168 standard action behavior. By default, actions are supposed
+     * to clear the cache of all other portlets on the page.
+     * By setting this parameter, we can ignore the standard behavior
+     * and not clear the cache on actions. This is useful for portlets
+     * which never participate with other portlets.
+     * 
+     */    
+    protected boolean isNonStandardAction(PortletWindow actionWindow)
+    {
+        PortletEntity entity = actionWindow.getPortletEntity();
+        if (entity != null)
+        {
+            PortletDefinitionComposite portletDefinition = (PortletDefinitionComposite)entity.getPortletDefinition();
+            if (portletDefinition != null)
+            {
+                Collection actionList = null;
+        
+                if (portletDefinition != null)
+                {
+                    actionList = portletDefinition.getMetadata().getFields(PortalReservedParameters.PORTLET_EXTENDED_DESCRIPTOR_NON_STANDARD_ACTION);
+                }
+                if (actionList != null) 
+                {
+                    if (!actionList.isEmpty())
+                        return true;
+                }
+            }
+        }
+        return false;
+    }
+   
+    protected void notifyFragments(ContentFragment f, RequestContext context, ContentPage page)
+    {
+        if (f.getContentFragments() != null && f.getContentFragments().size() > 0)
+        {
+            Iterator children = f.getContentFragments().iterator();
+            while (children.hasNext())
+            {
+                ContentFragment child = (ContentFragment) children.next();
+                if (!"hidden".equals(f.getState()))
+                {
+                    notifyFragments(child, context, page);
+                }
+            } 
+        }    
+        String cacheKey = portletContentCache.createCacheKey(context.getUserPrincipal().getName(), f.getId());
+        if (portletContentCache.isKeyInCache(cacheKey))
+        {
+            portletContentCache.remove(cacheKey);
+        }
+    }
+
+    protected void clearTargetCache(ContentFragment f, RequestContext context)
+    {
+        String cacheKey = portletContentCache.createCacheKey(context.getUserPrincipal().getName(), f.getId());
+        if (portletContentCache.isKeyInCache(cacheKey))
+        {
+            portletContentCache.remove(cacheKey);
+        }
+    }
+    
     /**
      * @see java.lang.Object#toString()
      */

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/SecurityAccessControllerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/SecurityAccessControllerImpl.java?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/SecurityAccessControllerImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/SecurityAccessControllerImpl.java Sun Feb 11 23:03:07 2007
@@ -19,6 +19,7 @@
 import java.security.AccessControlException;
 import java.security.AccessController;
 
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
 import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
 import org.apache.jetspeed.page.PageManager;
@@ -61,8 +62,8 @@
                     return true; // allow access
                 }
             }
-            // TODO: mask to list
-            return pageManager.checkConstraint(constraintRef, "view");                
+            String actions = JetspeedActions.getContainerActions(mask);
+            return pageManager.checkConstraint(constraintRef, actions);                
         }
         else
         {

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java Sun Feb 11 23:03:07 2007
@@ -38,10 +38,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.Jetspeed;
 import org.apache.jetspeed.PortalReservedParameters;
-import org.apache.jetspeed.aggregator.ContentDispatcher;
 import org.apache.jetspeed.aggregator.PortletRenderer;
 import org.apache.jetspeed.aggregator.impl.PortletAggregatorFragmentImpl;
-import org.apache.jetspeed.aggregator.impl.PortletRendererImpl;
 import org.apache.jetspeed.capabilities.CapabilityMap;
 import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
 import org.apache.jetspeed.components.portletentity.PortletEntityNotGeneratedException;

Modified: portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/container/state/TestNavigationalState.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/container/state/TestNavigationalState.java?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/container/state/TestNavigationalState.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/container/state/TestNavigationalState.java Sun Feb 11 23:03:07 2007
@@ -20,18 +20,14 @@
 
 import javax.portlet.PortletMode;
 import javax.portlet.WindowState;
-import javax.servlet.ServletConfig;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.jetspeed.JetspeedPortalContext;
 import org.apache.jetspeed.PortalContext;
-import org.apache.jetspeed.container.state.impl.JetspeedNavigationalStateCodec;
-import org.apache.jetspeed.container.state.impl.JetspeedNavigationalStateComponent;
+import org.apache.jetspeed.cache.JetspeedCache;
 import org.apache.jetspeed.container.state.impl.NavigationalStateCodec;
 import org.apache.jetspeed.container.state.impl.PathNavigationalState;
 import org.apache.jetspeed.container.state.impl.SessionFullNavigationalState;
@@ -46,8 +42,6 @@
 import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
 import org.apache.jetspeed.om.common.portlet.PortletApplication;
 import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
-import org.apache.jetspeed.request.JetspeedRequestContext;
-import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.testhelpers.SpringEngineHelper;
 import org.apache.jetspeed.util.JetspeedLongObjectID;
 import org.apache.pluto.om.entity.PortletEntity;
@@ -61,9 +55,7 @@
 import org.jmock.core.stub.VoidStub;
 
 import com.mockrunner.mock.web.MockHttpServletRequest;
-import com.mockrunner.mock.web.MockHttpServletResponse;
 import com.mockrunner.mock.web.MockHttpSession;
-import com.mockrunner.mock.web.MockServletConfig;
 
 /**
  * TestPortletContainer
@@ -84,6 +76,7 @@
     private Engine engine;
     private NavigationalStateCodec codec;
     private PortalContext portalContext;
+    private JetspeedCache cache;
 
     /**
      * Defines the testcase name for JUnit.
@@ -134,7 +127,8 @@
         portletFactory.registerPortletApplication((PortletApplication)portletApplicationMock.proxy(),Thread.currentThread().getContextClassLoader());
         
         codec = (NavigationalStateCodec) engine.getComponentManager().getComponent("NavigationalStateCodec");
-        portalContext = (PortalContext) engine.getComponentManager().getComponent("PortalContext");        
+        portalContext = (PortalContext) engine.getComponentManager().getComponent("PortalContext");  
+        cache = (JetspeedCache) engine.getComponentManager().getComponent("portletContentCache");
     }
 
     public static Test suite()
@@ -146,10 +140,10 @@
     
     public void testSessionFullStateAndQuery()
     {        
-        SessionFullNavigationalState navState = new SessionFullNavigationalState(codec);
+        SessionFullNavigationalState navState = new SessionFullNavigationalState(codec, cache);
         QueryStringEncodingPortalURL portalUrl = new QueryStringEncodingPortalURL(navState, portalContext);
         HttpServletRequest request = buildRequest(portalUrl, true);
-        navState = new SessionFullNavigationalState(codec);
+        navState = new SessionFullNavigationalState(codec, cache);
         portalUrl = new QueryStringEncodingPortalURL(navState, portalContext);
         doTestUrl(portalUrl, request);
         
@@ -157,20 +151,20 @@
     
     public void testSessionStateAndPathInfo()
     {        
-        SessionNavigationalState navState = new SessionNavigationalState(codec);
+        SessionNavigationalState navState = new SessionNavigationalState(codec, cache);
         PathInfoEncodingPortalURL portalUrl = new PathInfoEncodingPortalURL(navState, portalContext);
         HttpServletRequest request = buildRequest(portalUrl, false);
-        navState = new SessionNavigationalState(codec);
+        navState = new SessionNavigationalState(codec, cache);
         portalUrl = new PathInfoEncodingPortalURL(navState, portalContext);
         doTestUrl(portalUrl, request);
     }
     
     public void testPathStateAndPathInfo()
     {        
-        PathNavigationalState navState = new PathNavigationalState(codec);
+        PathNavigationalState navState = new PathNavigationalState(codec, cache);
         PathInfoEncodingPortalURL portalUrl = new PathInfoEncodingPortalURL(navState, portalContext);
         HttpServletRequest request = buildRequest(portalUrl, false);
-        navState = new PathNavigationalState(codec);
+        navState = new PathNavigationalState(codec, cache);
         portalUrl = new PathInfoEncodingPortalURL(navState, portalContext);
         doTestUrl(portalUrl, request);
     }

Modified: portals/jetspeed-2/trunk/components/profiler/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/profiler/pom.xml?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/components/profiler/pom.xml (original)
+++ portals/jetspeed-2/trunk/components/profiler/pom.xml Sun Feb 11 23:03:07 2007
@@ -71,6 +71,37 @@
     <!-- Build Configuration -->
 
     <build>
+         <testResources>
+            <testResource>
+                <directory>src/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                    <exclude>repository_database.xml</exclude>
+                </excludes>
+            </testResource>
+            <testResource>
+                <directory>src/test</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </testResource>
+            <testResource>
+                <directory>../../etc/log4j</directory>
+            </testResource>
+            <testResource>
+                <directory>../../etc/db-ojb</directory>
+            </testResource>
+            <testResource>
+                <directory>../../src/webapp/WEB-INF/assembly</directory>
+            </testResource>
+            <testResource>
+                <directory>test/assembly</directory>
+            </testResource>                                            
+            <testResource>
+                <directory>test/testdata/pages</directory>
+            </testResource>                                                        
+        </testResources>
+    
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

Modified: portals/jetspeed-2/trunk/core-build.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/core-build.xml?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/core-build.xml (original)
+++ portals/jetspeed-2/trunk/core-build.xml Sun Feb 11 23:03:07 2007
@@ -102,6 +102,13 @@
 	        <war.bundle>true</war.bundle>
 	      </properties>
 	    </dependency>
+	    <dependency>
+	      <id>ehcache</id>
+	      <version>1.2.4</version>
+	      <properties>
+	        <war.bundle>true</war.bundle>
+	      </properties>
+	    </dependency>
 		
 		<!-- jakarta commons and other misc. jakarta projects -->
 		<dependency>

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java Sun Feb 11 23:03:07 2007
@@ -65,4 +65,22 @@
     public static final String PAGE_THEME_OVERRIDE_ATTRIBUTE = "org.apache.jetspeed.theme.override";
     public static final String PORTAL_FILTER_ATTRIBUTE = "org.apache.jetspeed.login.filter.PortalFilter";
     
+    //
+    // Settings for Metadata on jetspeed-portlet.xml
+    //
+    /**
+     * Actions can be marked as non-standard if they don't participate in
+     * JSR-168 standard action behavior. By default, actions are supposed
+     * to clear the cache of all other portlets on the page.
+     * By setting this parameter, we can ignore the standard behavior
+     * and not clear the cache on actions. This is useful for portlets
+     * which never participate with other portlets.
+     */
+    public static final String PORTLET_EXTENDED_DESCRIPTOR_NON_STANDARD_ACTION = "nonStandardAction";
+    /**
+     * A portlet can have a specific setting for the timeout duration that the portal will wait
+     * before it gives up on rendering the portlet. This value overrides the system setting.
+     * The timeout value is in milliseconds 
+     */
+    public static final String PORTLET_EXTENDED_DESCRIPTOR_RENDER_TIMEOUT = "timeout";
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/ContentDispatcherCtrl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/ContentDispatcherCtrl.java?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/ContentDispatcherCtrl.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/ContentDispatcherCtrl.java Sun Feb 11 23:03:07 2007
@@ -28,13 +28,8 @@
  * @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
  * @version $Id$
  */
-public interface ContentDispatcherCtrl
+public interface ContentDispatcherCtrl extends ContentDispatcher
 {
-    /** Notify ContentDispatcher that the content for the specified OID is
-     * completely generated and is available for inclusion in other content
-     */
-//    public void notify(ObjectID oid);
-
     /**
      * Return the HttpServletResponse to use for a given PortletWindow
      * in order to be able to capture parallel rendering portlets

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletContent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletContent.java?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletContent.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletContent.java Sun Feb 11 23:03:07 2007
@@ -16,16 +16,61 @@
  *
  * </p>
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @author <a href="mailto:taylor@apache.org">David S. Taylor</a>  
  * @version $Id$
  *
  */
 public interface PortletContent
 {
+    /**
+     * Retrieve the actual content of a portlet as a string
+     * 
+     * @return
+     */
     String getContent();
     
+    /** 
+     * Has the renderer completed rendering the content?
+     * 
+     * @return
+     */
     boolean isComplete();
     
+    /**
+     * Notify that this content is completed.
+     *
+     */
     void complete();
     
+    /**
+     * Get a writer to the content to stream content into this object
+     * @return
+     */
     PrintWriter getWriter();
+    
+    /**
+     * Get the expiration setting for this content if it is cached.
+     * @return
+     */
+    int getExpiration();
+    
+    /**
+     * Get the cache key used to cache this content 
+     * @return
+     */
+    String getCacheKey();
+    
+    /**
+     * Get the title of the portlet, used during caching
+     * 
+     * @return
+     */
+    String getTitle();
+    
+    /**
+     * Set the title of this portlet, used during caching
+     * @param title
+     */
+    void setTitle(String title);
+        
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletRenderer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletRenderer.java?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletRenderer.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletRenderer.java Sun Feb 11 23:03:07 2007
@@ -63,4 +63,11 @@
      */
     public ContentDispatcher getDispatcher(RequestContext request, boolean isParallel);
 
+    /**
+     * Notify that content completed by worker jobs 
+     * So that renderer can update its state
+     * 
+     * @param content
+     */
+    public void notifyContentComplete(PortletContent content);
 }

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/CacheElement.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/CacheElement.java?view=auto&rev=506339
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/CacheElement.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/CacheElement.java Sun Feb 11 23:03:07 2007
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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;
+
+/**
+ * <p>
+ *  Provides interface to cached elements
+ *  Abstraction around atual cache implementation
+ * </p>
+ * 
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public interface CacheElement
+{
+    /**
+     * 
+     * @return the idle time in seconds for this cache element
+     */
+    int getTimeToIdleSeconds();
+    
+    /**
+     * 
+     * @return the idle time in seconds for this cache element
+     */
+    int getTimeToLiveSeconds();    
+    
+    void setTimeToLiveSeconds(int timeToLive);
+    
+    void setTimeToIdleSeconds(int timeToIdle);
+    
+    Object getContent();
+    
+    Object getKey();
+    
+    boolean isEternal();
+    
+    void setEternal(boolean eternal);
+    
+    
+    
+}
\ No newline at end of file

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/JetspeedCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/JetspeedCache.java?view=auto&rev=506339
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/JetspeedCache.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/JetspeedCache.java Sun Feb 11 23:03:07 2007
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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;
+
+/**
+ * <p>
+ *  Provides interface to Jetspeed for cache related activities
+ *  Abstraction around atual cache implementation
+ * </p>
+ * 
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public interface JetspeedCache
+{
+    /**
+     * Retrieve an object from the cache
+     * 
+     * @param key The key used to find the object
+     * @return the found object or null
+     */
+    CacheElement get(Object key);
+    
+    /**
+     * Put an object into the cache, adding it, or replacing if exists
+     * @param object
+     */
+    void put(CacheElement object);
+    
+    /**
+     * Create a cached element 
+     * 
+     * @param key
+     * @param content
+     * @return
+     */
+    CacheElement createElement(Object key, Object content);
+    
+    boolean isKeyInCache(Object key);
+    
+    /**
+     * Remove an object from the cache
+     * @param key
+     * @return true if the object was removed, false otherwise
+     */
+    boolean remove(Object key);
+    
+    /**
+     * 
+     * @return the default idle time in seconds for this cache
+     */
+    int getTimeToIdleSeconds();
+    
+    /**
+     * 
+     * @return the default idle time in seconds for this cache
+     */
+    int getTimeToLiveSeconds();
+
+    /**
+     * Evict all cached content for the given user
+     * 
+     * @param user
+     */
+    void evictContentForUser(String user);
+    
+    /**
+     * Create a cache key from a primary segment and secondary segment
+     * 
+     * @param primary
+     * @param secondary
+     * @return
+     */
+    String createCacheKey(String primary, String secondary);
+}
\ No newline at end of file

Modified: portals/jetspeed-2/trunk/layout-portlets/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/layout-portlets/src/webapp/WEB-INF/portlet.xml?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/layout-portlets/src/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/trunk/layout-portlets/src/webapp/WEB-INF/portlet.xml Sun Feb 11 23:03:07 2007
@@ -31,7 +31,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.LayoutPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -70,7 +70,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -111,7 +111,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -152,7 +152,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -193,7 +193,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -235,7 +235,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -276,7 +276,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -317,7 +317,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -356,7 +356,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -395,7 +395,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -433,7 +433,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -472,7 +472,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -513,7 +513,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -552,7 +552,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>
@@ -592,7 +592,7 @@
     </init-param>
     <portlet-class>org.apache.jetspeed.portlets.layout.MultiColumnPortlet</portlet-class>
     <resource-bundle>org.apache.jetspeed.portlets.layout.resources.LayoutResource</resource-bundle>
-    <expiration-cache>-1</expiration-cache>
+    <expiration-cache>0</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>view</portlet-mode>

Modified: portals/jetspeed-2/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/pom.xml?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/pom.xml (original)
+++ portals/jetspeed-2/trunk/pom.xml Sun Feb 11 23:03:07 2007
@@ -163,6 +163,7 @@
         <commons-pool.version>1.2</commons-pool.version>
         <ddlutils.version>1.0-RC1-PATCHED</ddlutils.version>        
         <directory.version>0.9.3</directory.version>      
+        <ehcache.version>1.2.4</ehcache.version>
         <hsqldb.version>1.8.0.2</hsqldb.version>
         <javolution.version>4.0.2</javolution.version>        
         <javax.activation.version>1.0.2</javax.activation.version>
@@ -660,7 +661,12 @@
                 <artifactId>commons-codec</artifactId>
                 <version>${commons-codec.version}</version>
             </dependency>
-
+            <dependency>
+                <groupId>ehcache</groupId>
+                <artifactId>ehcache</artifactId>
+                <version>${ehcache.version}</version>
+            </dependency>
+			
             <!-- Test -->
             <dependency>
                 <groupId>junit</groupId>

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/aggregation.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/aggregation.xml?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/aggregation.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/aggregation.xml Sun Feb 11 23:03:07 2007
@@ -45,9 +45,9 @@
         <constructor-arg>
             <ref bean="PortalStatistics" />
         </constructor-arg>                        
-        <constructor-arg>
-            <null/>
-        </constructor-arg>
+        <constructor-arg>
+            <ref bean="org.apache.pluto.services.title.DynamicTitleService" />
+        </constructor-arg>
         <!-- Default portlet timeout in milliseconds:
         Zero means no portlet timeout option by default.
         -->
@@ -61,8 +61,11 @@
             <value>true</value>
         </constructor-arg>           
         <constructor-arg>
-            <ref bean="org.apache.jetspeed.page.PageManager" />
-        </constructor-arg>             
+            <ref bean="org.apache.jetspeed.security.SecurityAccessController" />
+        </constructor-arg>             
+        <constructor-arg>
+        	<ref bean="portletContentCache"/>
+        </constructor-arg>
     </bean>
 
     <!-- Portlet Renderer w/title in http response header -->
@@ -83,6 +86,27 @@
         <constructor-arg>
             <ref bean="org.apache.pluto.services.title.DynamicTitleService" />
         </constructor-arg>
+        <!-- Default portlet timeout in milliseconds:
+        Zero means no portlet timeout option by default.
+        -->
+        <constructor-arg>
+            <value>0</value>
+        </constructor-arg>        
+        <!-- flag indicating whether to check jetspeed-portlet.xml security constraints
+             before rendering a portlet. If security check fails, do not display portlet content
+          -->
+        <constructor-arg type="boolean">
+            <value>true</value>
+        </constructor-arg>           
+        <constructor-arg>
+            <ref bean="org.apache.jetspeed.security.SecurityAccessController" />
+        </constructor-arg>             
+        <constructor-arg>
+        	<ref bean="portletContentCache"/>
+        </constructor-arg>
+        <constructor-arg type="boolean">
+            <value>true</value>   
+        </constructor-arg>       
     </bean>
 
     <!-- Aggregation: Page Leave in place until new development completed -->

Added: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/cache.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/cache.xml?view=auto&rev=506339
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/cache.xml (added)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/cache.xml Sun Feb 11 23:03:07 2007
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<!--
+Copyright 2004 The Apache Software Foundation
+
+Licensed 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>
+
+<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
+        <property name="configLocation" value="/WEB-INF/conf/ehcache.xml"/>
+</bean>
+
+<!-- Factory bean used to instantiate a EHCache with the specified name (and corresponding
+configuration in cacheManager.xml -->
+<bean id="ehPortletContentCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+<property name="cacheManager">
+<ref local="cacheManager"/>
+</property>
+        <property name="cacheName" value="portletContentCache"/>
+</bean>
+
+<bean id="portletContentCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
+    <constructor-arg>
+     	<ref bean="ehPortletContentCache"/>
+    </constructor-arg>       
+</bean>
+
+</beans>

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml Sun Feb 11 23:03:07 2007
@@ -128,7 +128,10 @@
    </constructor-arg>
    <constructor-arg>   
        <ref bean="PortletWindowAccessor" />    
-   </constructor-arg>   
+   </constructor-arg>
+   <constructor-arg>
+    	<ref bean="portletContentCache"/>
+   </constructor-arg>      
     <!-- 
          Setting to true will force Action response isCommitted to true
          as there is a bug in Websphere 5 where request.isCommitted always returns false
@@ -136,7 +139,7 @@
     <constructor-arg type="boolean">
         <value>false</value>
     </constructor-arg>                
-        -->       
+        -->          	
   </bean> 
 
   <bean id="desktopActionValve"
@@ -149,6 +152,17 @@
    <constructor-arg>   
        <ref bean="PortletWindowAccessor" />    
    </constructor-arg>   
+   <constructor-arg>
+    	<ref bean="portletContentCache"/>
+   </constructor-arg>      
+    <!-- 
+         Setting to true will force Action response isCommitted to true
+         as there is a bug in Websphere 5 where request.isCommitted always returns false
+         Set this boolean to TRUE if running on Websphere 5 pre-cumulative fix 5.1.1.9  
+    <constructor-arg type="boolean">
+        <value>false</value>
+    </constructor-arg>                
+        -->          	
   </bean> 
       
   <bean id="portletValve"

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/portal-url-generation.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/portal-url-generation.xml?view=diff&rev=506339&r1=506338&r2=506339
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/portal-url-generation.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/portal-url-generation.xml Sun Feb 11 23:03:07 2007
@@ -30,6 +30,9 @@
 	   singleton="false"
   >  	 
        <constructor-arg><ref bean="NavigationalStateCodec"/></constructor-arg>
+       <constructor-arg>
+        	<ref bean="portletContentCache"/>
+        </constructor-arg>       
   </bean>
   
   <!-- PortalURL we are currently using -->

Added: portals/jetspeed-2/trunk/src/webapp/WEB-INF/conf/ehcache.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/conf/ehcache.xml?view=auto&rev=506339
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/conf/ehcache.xml (added)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/conf/ehcache.xml Sun Feb 11 23:03:07 2007
@@ -0,0 +1,384 @@
+<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=230.0.0.1,
+                        multicastGroupPort=4446, timeToLive=1"/>
+
+
+    <!--
+    (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"/>
+
+
+    <!-- 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"
+            />
+
+    <!--
+    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>
+    -->
+
+</ehcache>



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


Mime
View raw message