gatein SVN: r5240 - portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-11-23 16:41:56 -0500 (Tue, 23 Nov 2010)
New Revision: 5240
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache-cluster.xml
Log:
GTNPORTAL-1684 : Use expiration eviction policy for picket link
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache-cluster.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache-cluster.xml 2010-11-23 21:34:05 UTC (rev 5239)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache-cluster.xml 2010-11-23 21:41:56 UTC (rev 5240)
@@ -8,10 +8,11 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
+ <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
eventQueueSize="1000000">
- <property name="maxNodes" value="1000000" />
+ <property name="maxNodes" value="100000" />
<property name="timeToLive" value="120000" />
+ <property name="warnNoExpirationKey" value="false" />
</default>
</eviction>
14 years, 1 month
gatein SVN: r5239 - portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-11-23 16:34:05 -0500 (Tue, 23 Nov 2010)
New Revision: 5239
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
Log:
remove unused field in the unit test
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-11-23 21:31:21 UTC (rev 5238)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-11-23 21:34:05 UTC (rev 5239)
@@ -36,7 +36,6 @@
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
@@ -70,9 +69,6 @@
/** . */
private DataStorage storage_;
- /** . */
- private POMSessionManager mgr;
-
private LinkedList<Event> events;
private ListenerService listenerService;
@@ -97,7 +93,6 @@
super.setUp();
PortalContainer container = PortalContainer.getInstance();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
events = new LinkedList<Event>();
listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
14 years, 1 month
gatein SVN: r5238 - in epp/portal/branches/EPP_5_1_Branch/component/portal/src: main/java/org/exoplatform/portal/pom/config and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-23 16:31:21 -0500 (Tue, 23 Nov 2010)
New Revision: 5238
Added:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/PortalNamesCache.java
Modified:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
Log:
JBEPP-658: getAllPortalNames bottleneck
Modified: epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2010-11-23 21:28:31 UTC (rev 5237)
+++ epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2010-11-23 21:31:21 UTC (rev 5238)
@@ -67,6 +67,16 @@
this(PORTAL_TYPE);
}
+ public PortalConfig(String type)
+ {
+ this(type, null);
+ }
+
+ public PortalConfig(String type, String ownerId)
+ {
+ this(type, ownerId, null);
+ }
+
public PortalConfig(String type, String ownerId, String storageId)
{
super(storageId);
@@ -74,16 +84,9 @@
//
this.type = type;
this.name = ownerId;
+ this.portalLayout = new Container();
}
- public PortalConfig(String type)
- {
- this.type = type;
-
- //
- setPortalLayout(new Container());
- }
-
public PortalConfig(PortalData data)
{
super(data.getStorageId());
@@ -99,14 +102,6 @@
this.portalLayout = new Container(data.getPortalLayout());
}
- PortalConfig(String storageId, String type)
- {
- super(storageId);
-
- //
- this.type = type;
- }
-
public String getType()
{
return type;
Modified: epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2010-11-23 21:28:31 UTC (rev 5237)
+++ epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2010-11-23 21:31:21 UTC (rev 5238)
@@ -23,6 +23,7 @@
import org.exoplatform.commons.chromattic.ChromatticManager;
import org.exoplatform.commons.chromattic.SessionContext;
import org.exoplatform.portal.pom.config.cache.DataCache;
+import org.exoplatform.portal.pom.config.cache.PortalNamesCache;
import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.jcr.RepositoryService;
@@ -69,7 +70,7 @@
this.manager = manager;
this.cache = cacheService.getCacheInstance("MOPSessionManager");
this.pomService = null;
- this.executor = new DataCache(new ExecutorDispatcher());
+ this.executor = new PortalNamesCache(new DataCache(new ExecutorDispatcher()));
}
public void cachePut(Serializable key, Object value)
Copied: epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/PortalNamesCache.java (from rev 5237, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/PortalNamesCache.java)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/PortalNamesCache.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/PortalNamesCache.java 2010-11-23 21:31:21 UTC (rev 5238)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.pom.config.cache;
+
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccessImpl;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMTask;
+import org.exoplatform.portal.pom.config.TaskExecutionDecorator;
+import org.exoplatform.portal.pom.config.TaskExecutor;
+import org.exoplatform.portal.pom.config.tasks.PortalConfigTask;
+import org.exoplatform.portal.pom.config.tasks.SearchTask;
+import org.exoplatform.portal.pom.data.PortalKey;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalNamesCache extends TaskExecutionDecorator
+{
+
+ public PortalNamesCache(TaskExecutor next)
+ {
+ super(next);
+ }
+
+ @Override
+ public <V> V execute(POMSession session, POMTask<V> task) throws Exception
+ {
+ if (!session.isModified())
+ {
+ if (task instanceof SearchTask.FindSiteKey)
+ {
+ List<PortalKey> data = (List<PortalKey>)session.getFromCache(SearchTask.FindSiteKey.class);
+ if (data == null)
+ {
+ V result = super.execute(session, task);
+ LazyPageList<PortalKey> list = (LazyPageList<PortalKey>)result;
+ session.putInCache(SearchTask.FindSiteKey.class, Collections.unmodifiableList(new ArrayList<PortalKey>(list.getAll())));
+ return result;
+ }
+ else
+ {
+ return (V)new LazyPageList<PortalKey>(new ListAccessImpl<PortalKey>(PortalKey.class, data), 10);
+ }
+ }
+ else if (task instanceof PortalConfigTask.Save || task instanceof PortalConfigTask.Remove)
+ {
+ V result = super.execute(session, task);
+ session.scheduleForEviction(SearchTask.FindSiteKey.class);
+ return result;
+ }
+ }
+
+ //
+ return super.execute(session, task);
+ }
+}
Modified: epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-11-23 21:28:31 UTC (rev 5237)
+++ epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-11-23 21:31:21 UTC (rev 5238)
@@ -21,11 +21,21 @@
import static org.exoplatform.portal.pom.config.Utils.split;
+import junit.framework.AssertionFailedError;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.Preference;
-import org.exoplatform.portal.config.model.*;
-import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Dashboard;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
@@ -35,7 +45,14 @@
import org.exoplatform.services.listener.Listener;
import org.exoplatform.services.listener.ListenerService;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
/**
* Created by The eXo Platform SARL Author : Tung Pham thanhtungty(a)gmail.com Nov
@@ -56,9 +73,6 @@
/** . */
private POMSessionManager mgr;
- /** . */
- private POMSession session;
-
private LinkedList<Event> events;
private ListenerService listenerService;
@@ -78,17 +92,16 @@
events.add(event);
}
};
-
+
+ //
super.setUp();
- begin();
PortalContainer container = PortalContainer.getInstance();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- session = mgr.openSession();
-
events = new LinkedList<Event>();
listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
-
+
+ //
listenerService.addListener(DataStorage.PAGE_CREATED, listener);
listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
@@ -98,11 +111,13 @@
listenerService.addListener(DataStorage.PORTAL_CONFIG_CREATED, listener);
listenerService.addListener(DataStorage.PORTAL_CONFIG_UPDATED, listener);
listenerService.addListener(DataStorage.PORTAL_CONFIG_REMOVED, listener);
+
+ //
+ begin();
}
protected void tearDown() throws Exception
{
- session.close();
end();
super.tearDown();
}
@@ -869,6 +884,117 @@
assertEquals("foo", storage_.getId(gadgetApp.getState()));
}
+ public void testGetAllPortalNames() throws Exception
+ {
+ final List<String> names = storage_.getAllPortalNames();
+
+ // Create new portal
+ storage_.create(new PortalConfig("portal", "testGetAllPortalNames"));
+
+ // Test during tx we see the good names
+ List<String> transientNames = storage_.getAllPortalNames();
+ assertTrue(transientNames.containsAll(names));
+ transientNames.removeAll(names);
+ assertEquals(Collections.singletonList("testGetAllPortalNames"), transientNames);
+
+ // Test we have not seen anything yet outside of tx
+ final CountDownLatch addSync = new CountDownLatch(1);
+ final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
+ new Thread()
+ {
+ @Override
+ public void run()
+ {
+ begin();
+ try
+ {
+ List<String> isolatedNames = storage_.getAllPortalNames();
+ assertEquals(new HashSet<String>(names), new HashSet<String>(isolatedNames));
+ }
+ catch (Throwable t)
+ {
+ error.set(t);
+ }
+ finally
+ {
+ addSync.countDown();
+ end();
+ }
+ }
+ }.start();
+
+ //
+ addSync.await();
+ if (error.get() != null)
+ {
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(error.get());
+ throw afe;
+ }
+
+ // Now commit tx
+ end(true);
+
+ // We test we observe the change
+ begin();
+ List<String> afterNames = storage_.getAllPortalNames();
+ assertTrue(afterNames.containsAll(names));
+ afterNames.removeAll(names);
+ assertEquals(Collections.singletonList("testGetAllPortalNames"), afterNames);
+
+ // Then we remove the newly created portal
+ storage_.remove(new PortalConfig("portal", "testGetAllPortalNames"));
+
+ // Test we are syeing the transient change
+ transientNames.clear();
+ transientNames = storage_.getAllPortalNames();
+ assertEquals(names, transientNames);
+
+ // Test we have not seen anything yet outside of tx
+ error.set(null);
+ final CountDownLatch removeSync = new CountDownLatch(1);
+ new Thread()
+ {
+ public void run()
+ {
+ begin();
+ try
+ {
+ List<String> isolatedNames = storage_.getAllPortalNames();
+ assertTrue(isolatedNames.containsAll(names));
+ isolatedNames.removeAll(names);
+ assertEquals(Collections.singletonList("testGetAllPortalNames"), isolatedNames);
+ }
+ catch (Throwable t)
+ {
+ error.set(t);
+ }
+ finally
+ {
+ removeSync.countDown();
+ end();
+ }
+ }
+ }.start();
+
+ //
+ removeSync.await();
+ if (error.get() != null)
+ {
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(error.get());
+ throw afe;
+ }
+
+ //
+ end(true);
+
+ // Now test it is still removed
+ begin();
+ afterNames = storage_.getAllPortalNames();
+ assertEquals(new HashSet<String>(names), new HashSet<String>(afterNames));
+ }
+
private Application<Portlet> create(String instanceId)
{
int i0 = instanceId.indexOf("#");
14 years, 1 month
gatein SVN: r5237 - portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-11-23 16:28:31 -0500 (Tue, 23 Nov 2010)
New Revision: 5237
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
Log:
improve unit test and remove unnecessary thing in it
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-11-23 21:12:49 UTC (rev 5236)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-11-23 21:28:31 UTC (rev 5237)
@@ -25,8 +25,17 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.Preference;
-import org.exoplatform.portal.config.model.*;
-import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Dashboard;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
@@ -36,7 +45,12 @@
import org.exoplatform.services.listener.Listener;
import org.exoplatform.services.listener.ListenerService;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
@@ -59,9 +73,6 @@
/** . */
private POMSessionManager mgr;
- /** . */
- private POMSession session;
-
private LinkedList<Event> events;
private ListenerService listenerService;
@@ -81,17 +92,16 @@
events.add(event);
}
};
-
+
+ //
super.setUp();
- begin();
PortalContainer container = PortalContainer.getInstance();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
- session = mgr.openSession();
-
events = new LinkedList<Event>();
listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
-
+
+ //
listenerService.addListener(DataStorage.PAGE_CREATED, listener);
listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
@@ -101,11 +111,13 @@
listenerService.addListener(DataStorage.PORTAL_CONFIG_CREATED, listener);
listenerService.addListener(DataStorage.PORTAL_CONFIG_UPDATED, listener);
listenerService.addListener(DataStorage.PORTAL_CONFIG_REMOVED, listener);
+
+ //
+ begin();
}
protected void tearDown() throws Exception
{
- session.close();
end();
super.tearDown();
}
@@ -921,12 +933,10 @@
}
// Now commit tx
- session.close(true);
end(true);
// We test we observe the change
begin();
- session = mgr.openSession();
List<String> afterNames = storage_.getAllPortalNames();
assertTrue(afterNames.containsAll(names));
afterNames.removeAll(names);
@@ -977,12 +987,10 @@
}
//
- session.close(true);
end(true);
// Now test it is still removed
begin();
- session = mgr.openSession();
afterNames = storage_.getAllPortalNames();
assertEquals(new HashSet<String>(names), new HashSet<String>(afterNames));
}
14 years, 1 month
gatein SVN: r5236 - in portal/trunk/component/portal/src: main/java/org/exoplatform/portal/pom/config and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-11-23 16:12:49 -0500 (Tue, 23 Nov 2010)
New Revision: 5236
Added:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/PortalNamesCache.java
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
Log:
GTNPORTAL-1685 : DataStorage getAllPortalNames() cache
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2010-11-23 19:51:32 UTC (rev 5235)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2010-11-23 21:12:49 UTC (rev 5236)
@@ -67,6 +67,16 @@
this(PORTAL_TYPE);
}
+ public PortalConfig(String type)
+ {
+ this(type, null);
+ }
+
+ public PortalConfig(String type, String ownerId)
+ {
+ this(type, ownerId, null);
+ }
+
public PortalConfig(String type, String ownerId, String storageId)
{
super(storageId);
@@ -74,16 +84,9 @@
//
this.type = type;
this.name = ownerId;
+ this.portalLayout = new Container();
}
- public PortalConfig(String type)
- {
- this.type = type;
-
- //
- setPortalLayout(new Container());
- }
-
public PortalConfig(PortalData data)
{
super(data.getStorageId());
@@ -99,14 +102,6 @@
this.portalLayout = new Container(data.getPortalLayout());
}
- PortalConfig(String storageId, String type)
- {
- super(storageId);
-
- //
- this.type = type;
- }
-
public String getType()
{
return type;
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2010-11-23 19:51:32 UTC (rev 5235)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2010-11-23 21:12:49 UTC (rev 5236)
@@ -23,6 +23,7 @@
import org.exoplatform.commons.chromattic.ChromatticManager;
import org.exoplatform.commons.chromattic.SessionContext;
import org.exoplatform.portal.pom.config.cache.DataCache;
+import org.exoplatform.portal.pom.config.cache.PortalNamesCache;
import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.jcr.RepositoryService;
@@ -69,7 +70,7 @@
this.manager = manager;
this.cache = cacheService.getCacheInstance("MOPSessionManager");
this.pomService = null;
- this.executor = new DataCache(new ExecutorDispatcher());
+ this.executor = new PortalNamesCache(new DataCache(new ExecutorDispatcher()));
}
public void cachePut(Serializable key, Object value)
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/PortalNamesCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/PortalNamesCache.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/PortalNamesCache.java 2010-11-23 21:12:49 UTC (rev 5236)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.pom.config.cache;
+
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccessImpl;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.POMTask;
+import org.exoplatform.portal.pom.config.TaskExecutionDecorator;
+import org.exoplatform.portal.pom.config.TaskExecutor;
+import org.exoplatform.portal.pom.config.tasks.PortalConfigTask;
+import org.exoplatform.portal.pom.config.tasks.SearchTask;
+import org.exoplatform.portal.pom.data.PortalKey;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalNamesCache extends TaskExecutionDecorator
+{
+
+ public PortalNamesCache(TaskExecutor next)
+ {
+ super(next);
+ }
+
+ @Override
+ public <V> V execute(POMSession session, POMTask<V> task) throws Exception
+ {
+ if (!session.isModified())
+ {
+ if (task instanceof SearchTask.FindSiteKey)
+ {
+ List<PortalKey> data = (List<PortalKey>)session.getFromCache(SearchTask.FindSiteKey.class);
+ if (data == null)
+ {
+ V result = super.execute(session, task);
+ LazyPageList<PortalKey> list = (LazyPageList<PortalKey>)result;
+ session.putInCache(SearchTask.FindSiteKey.class, Collections.unmodifiableList(new ArrayList<PortalKey>(list.getAll())));
+ return result;
+ }
+ else
+ {
+ return (V)new LazyPageList<PortalKey>(new ListAccessImpl<PortalKey>(PortalKey.class, data), 10);
+ }
+ }
+ else if (task instanceof PortalConfigTask.Save || task instanceof PortalConfigTask.Remove)
+ {
+ V result = super.execute(session, task);
+ session.scheduleForEviction(SearchTask.FindSiteKey.class);
+ return result;
+ }
+ }
+
+ //
+ return super.execute(session, task);
+ }
+}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-11-23 19:51:32 UTC (rev 5235)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-11-23 21:12:49 UTC (rev 5236)
@@ -21,6 +21,7 @@
import static org.exoplatform.portal.pom.config.Utils.split;
+import junit.framework.AssertionFailedError;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.Preference;
@@ -36,6 +37,8 @@
import org.exoplatform.services.listener.ListenerService;
import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
/**
* Created by The eXo Platform SARL Author : Tung Pham thanhtungty(a)gmail.com Nov
@@ -869,6 +872,121 @@
assertEquals("foo", storage_.getId(gadgetApp.getState()));
}
+ public void testGetAllPortalNames() throws Exception
+ {
+ final List<String> names = storage_.getAllPortalNames();
+
+ // Create new portal
+ storage_.create(new PortalConfig("portal", "testGetAllPortalNames"));
+
+ // Test during tx we see the good names
+ List<String> transientNames = storage_.getAllPortalNames();
+ assertTrue(transientNames.containsAll(names));
+ transientNames.removeAll(names);
+ assertEquals(Collections.singletonList("testGetAllPortalNames"), transientNames);
+
+ // Test we have not seen anything yet outside of tx
+ final CountDownLatch addSync = new CountDownLatch(1);
+ final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
+ new Thread()
+ {
+ @Override
+ public void run()
+ {
+ begin();
+ try
+ {
+ List<String> isolatedNames = storage_.getAllPortalNames();
+ assertEquals(new HashSet<String>(names), new HashSet<String>(isolatedNames));
+ }
+ catch (Throwable t)
+ {
+ error.set(t);
+ }
+ finally
+ {
+ addSync.countDown();
+ end();
+ }
+ }
+ }.start();
+
+ //
+ addSync.await();
+ if (error.get() != null)
+ {
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(error.get());
+ throw afe;
+ }
+
+ // Now commit tx
+ session.close(true);
+ end(true);
+
+ // We test we observe the change
+ begin();
+ session = mgr.openSession();
+ List<String> afterNames = storage_.getAllPortalNames();
+ assertTrue(afterNames.containsAll(names));
+ afterNames.removeAll(names);
+ assertEquals(Collections.singletonList("testGetAllPortalNames"), afterNames);
+
+ // Then we remove the newly created portal
+ storage_.remove(new PortalConfig("portal", "testGetAllPortalNames"));
+
+ // Test we are syeing the transient change
+ transientNames.clear();
+ transientNames = storage_.getAllPortalNames();
+ assertEquals(names, transientNames);
+
+ // Test we have not seen anything yet outside of tx
+ error.set(null);
+ final CountDownLatch removeSync = new CountDownLatch(1);
+ new Thread()
+ {
+ public void run()
+ {
+ begin();
+ try
+ {
+ List<String> isolatedNames = storage_.getAllPortalNames();
+ assertTrue(isolatedNames.containsAll(names));
+ isolatedNames.removeAll(names);
+ assertEquals(Collections.singletonList("testGetAllPortalNames"), isolatedNames);
+ }
+ catch (Throwable t)
+ {
+ error.set(t);
+ }
+ finally
+ {
+ removeSync.countDown();
+ end();
+ }
+ }
+ }.start();
+
+ //
+ removeSync.await();
+ if (error.get() != null)
+ {
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(error.get());
+ throw afe;
+ }
+
+ //
+ session.close(true);
+ end(true);
+
+ // Now test it is still removed
+ begin();
+ session = mgr.openSession();
+ afterNames = storage_.getAllPortalNames();
+ assertEquals(new HashSet<String>(names), new HashSet<String>(afterNames));
+ }
+
private Application<Portlet> create(String instanceId)
{
int i0 = instanceId.indexOf("#");
14 years, 1 month
gatein SVN: r5235 - epp/portal/branches/EPP_5_1_Branch.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-23 14:51:32 -0500 (Tue, 23 Nov 2010)
New Revision: 5235
Modified:
epp/portal/branches/EPP_5_1_Branch/pom.xml
Log:
JBEPP-663: Upgrade to PC 2.2.0.GA
Modified: epp/portal/branches/EPP_5_1_Branch/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/pom.xml 2010-11-23 19:48:21 UTC (rev 5234)
+++ epp/portal/branches/EPP_5_1_Branch/pom.xml 2010-11-23 19:51:32 UTC (rev 5235)
@@ -46,7 +46,7 @@
<nl.captcha.simplecaptcha.version>1.1.1-GA-Patch01</nl.captcha.simplecaptcha.version>
<org.gatein.common.version>2.0.3-GA</org.gatein.common.version>
<org.gatein.wci.version>2.0.2-GA</org.gatein.wci.version>
- <org.gatein.pc.version>2.2.0-CR02</org.gatein.pc.version>
+ <org.gatein.pc.version>2.2.0-GA</org.gatein.pc.version>
<org.picketlink.idm>1.1.7.CR01</org.picketlink.idm>
<org.gatein.wsrp.version>2.0.0-CR02</org.gatein.wsrp.version>
<org.gatein.mop.version>1.0.3-GA</org.gatein.mop.version>
14 years, 1 month
gatein SVN: r5234 - epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-23 14:48:21 -0500 (Tue, 23 Nov 2010)
New Revision: 5234
Modified:
epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache.xml
Log:
JBEPP-661: Use expiration eviction policy for picket link
Modified: epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache.xml 2010-11-23 19:19:18 UTC (rev 5233)
+++ epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache.xml 2010-11-23 19:48:21 UTC (rev 5234)
@@ -2,11 +2,12 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
+ <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
eventQueueSize="1000000">
- <property name="maxNodes" value="1000000" />
+ <property name="maxNodes" value="100000" />
<property name="timeToLive" value="120000" />
+ <property name="warnNoExpirationKey" value="false" />
</default>
</eviction>
-</jbosscache>
\ No newline at end of file
+</jbosscache>
14 years, 1 month
gatein SVN: r5233 - in epp/portal/branches/EPP_5_1_Branch: component/web/resources/src/main/java/org/exoplatform/portal/resource and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-23 14:19:18 -0500 (Tue, 23 Nov 2010)
New Revision: 5233
Modified:
epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/application/Image.java
epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java
epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/resource/CachedStylesheet.java
epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java
epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/javascript/JavascriptServlet.java
Log:
JBEPP-659: CSS file are not cached (in the browser)
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/application/Image.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/application/Image.java 2010-11-23 17:34:30 UTC (rev 5232)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/application/Image.java 2010-11-23 19:19:18 UTC (rev 5233)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.application;
+import java.util.Date;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -29,10 +31,19 @@
final ImageType type;
final byte[] bytes;
+
+ final long lastModified;
public Image(ImageType type, byte[] bytes)
{
this.type = type;
this.bytes = bytes;
+// Remove miliseconds because string of date retrieve from Http header doesn't have miliseconds
+ lastModified = (new Date().getTime() / 1000) * 1000;
}
+
+ public long getLastModified()
+ {
+ return lastModified;
+ }
}
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java 2010-11-23 17:34:30 UTC (rev 5232)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java 2010-11-23 19:19:18 UTC (rev 5233)
@@ -36,6 +36,7 @@
import java.io.OutputStream;
import java.net.URLDecoder;
import java.nio.charset.Charset;
+import java.util.Date;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -64,6 +65,10 @@
private ConcurrentMap<String, FutureTask<Image>> mirroredImageCache = new ConcurrentHashMap<String, FutureTask<Image>>();
+ public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
+
+ public static final String LAST_MODIFIED = "Last-Modified";
+
public void afterInit(FilterConfig filterConfig)
{
cfg = filterConfig;
@@ -77,11 +82,19 @@
final String uri = URLDecoder.decode(httpRequest.getRequestURI(), "UTF-8");
final HttpServletResponse httpResponse = (HttpServletResponse)response;
ExoContainer portalContainer = getContainer();
- SkinService skinService = (SkinService)portalContainer.getComponentInstanceOfType(SkinService.class);
+ final SkinService skinService = (SkinService) portalContainer.getComponentInstanceOfType(SkinService.class);
+ long ifModifiedSince = httpRequest.getDateHeader(IF_MODIFIED_SINCE);
//
if (uri.endsWith(".css"))
{
+// Check if cached resource has not been modifed, return 304 code
+ long cssLastModified = skinService.getLastModified(uri);
+ if (isNotModified(ifModifiedSince, cssLastModified)) {
+ httpResponse.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ return;
+ }
+
final OutputStream out = response.getOutputStream();
final BinaryOutput output = new BinaryOutput()
{
@@ -118,6 +131,9 @@
{
httpResponse.setHeader("Cache-Control", "no-cache");
}
+
+ long lastModified = skinService.getLastModified(uri);
+ processIfModified(lastModified, httpResponse);
}
};
@@ -192,8 +208,16 @@
Image img = futureImg.get();
if (img != null)
{
+ //Check if cached resource has not been modifed, return 304 code
+ long imgLastModified = img.getLastModified();
+ if (isNotModified(ifModifiedSince, imgLastModified)) {
+ httpResponse.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ return;
+ }
httpResponse.setContentType(img.type.getMimeType());
httpResponse.setContentLength(img.bytes.length);
+ processIfModified(imgLastModified, httpResponse);
+
OutputStream out = httpResponse.getOutputStream();
out.write(img.bytes);
out.close();
@@ -238,6 +262,30 @@
}
}
+ /**
+ * Add Last-Modified Http header to HttpServetResponse
+ */
+ public void processIfModified(long lastModified, HttpServletResponse httpResponse) {
+ httpResponse.setDateHeader(ResourceRequestFilter.LAST_MODIFIED, lastModified);
+ }
+
+ /**
+ * If cached resource has not changed since date in http header (If_Modified_Since), return true
+ * Else return false;
+ * @param ifModifedSince - String, and HttpHeader element
+ * @param lastModified
+ * @param httpResponse
+ * @return
+ */
+ public boolean isNotModified(long ifModifedSince, long lastModified) {
+ if (!PropertyManager.isDevelopping()) {
+ if (ifModifedSince >= lastModified) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public void destroy()
{
}
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/resource/CachedStylesheet.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/resource/CachedStylesheet.java 2010-11-23 17:34:30 UTC (rev 5232)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/resource/CachedStylesheet.java 2010-11-23 19:19:18 UTC (rev 5233)
@@ -24,6 +24,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Date;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -40,6 +41,8 @@
/** . */
private final byte[] bytes;
+
+ private long lastModified;
public CachedStylesheet(String text)
{
@@ -59,11 +62,18 @@
//
this.text = text;
this.bytes = bytes;
+// Remove miliseconds because string of date retrieve from Http header doesn't have miliseconds
+ lastModified = (new Date().getTime() / 1000) * 1000;
}
public String getText()
{
return text;
+ }
+
+ public long getLastModified()
+ {
+ return lastModified;
}
public void writeTo(BinaryOutput output) throws IOException
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java 2010-11-23 17:34:30 UTC (rev 5232)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java 2010-11-23 19:19:18 UTC (rev 5233)
@@ -48,6 +48,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
@@ -439,16 +440,6 @@
// Try cache first
if (!PropertyManager.isDevelopping())
{
-
- if (path.startsWith("/" + portalContainerName + "/resource"))
- {
- renderer.setExpiration(ONE_MONTH);
- }
- else
- {
- renderer.setExpiration(ONE_HOUR);
- }
-
//
Map<String, CachedStylesheet> cache = orientation == Orientation.LT ? ltCache : rtCache;
CachedStylesheet cachedCss = cache.get(path);
@@ -472,6 +463,16 @@
cachedCss = new CachedStylesheet(css);
cache.put(path, cachedCss);
}
+
+ if (path.startsWith("/" + portalContainerName + "/resource"))
+ {
+ renderer.setExpiration(ONE_MONTH);
+ }
+ else
+ {
+ renderer.setExpiration(ONE_HOUR);
+ }
+
cachedCss.writeTo(renderer.getOutput());
}
else
@@ -549,6 +550,41 @@
}
/**
+ * Return last modifed date of cached css
+ * Return null if cached css can not be found
+ * @param path - path must not be null
+ */
+ public long getLastModified(String path)
+ {
+ if (path == null)
+ {
+ throw new IllegalArgumentException("path must not be null");
+ }
+
+ Map<String, CachedStylesheet> cache = ltCache;
+ Orientation orientation = Orientation.LT;
+ if (path.endsWith("-lt.css"))
+ {
+ path = path.substring(0, path.length() - "-lt.css".length()) + ".css";
+ }
+ else if (path.endsWith("-rt.css"))
+ {
+ path = path.substring(0, path.length() - "-rt.css".length()) + ".css";
+ orientation = Orientation.RT;
+ }
+
+ CachedStylesheet cachedCSS = cache.get(path);
+ if (cachedCSS == null)
+ {
+ return Long.MAX_VALUE;
+ }
+ else
+ {
+ return cachedCSS.getLastModified();
+ }
+ }
+
+ /**
* Remove SkinConfig from Portal Skin Configs by module and skin name
* @param module
* @param skinName
@@ -878,4 +914,4 @@
DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(deployer);
DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(removal);
}
-}
\ No newline at end of file
+}
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-11-23 17:34:30 UTC (rev 5232)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/resources/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-11-23 19:19:18 UTC (rev 5233)
@@ -40,6 +40,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -64,6 +65,8 @@
private HashMap<String, String> extendedJavascripts;
private byte[] jsBytes = null;
+
+ private long lastModified = Long.MAX_VALUE;
/** . */
private JavascriptDeployer deployer;
@@ -278,6 +281,18 @@
*/
public void writeMergedJavascript(OutputStream out) throws IOException
{
+ jsBytes = getMergedJavascript();
+
+ //
+ out.write(jsBytes);
+ }
+
+ /**
+ * Return merged javascript in byte array
+ * @return byte[]
+ */
+ public byte[] getMergedJavascript()
+ {
if (jsBytes == null)
{
// Generate javascript in a buffer
@@ -314,10 +329,15 @@
log.error("Error when generating minified javascript, will use normal javascript instead", e);
jsBytes = bytes;
}
+// Remove miliseconds because string of date retrieve from Http header doesn't have miliseconds
+ lastModified = (new Date().getTime() / 1000) * 1000;
}
+ return jsBytes;
+ }
- //
- out.write(jsBytes);
+ public long getLastModified()
+ {
+ return lastModified;
}
/**
@@ -374,4 +394,4 @@
DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(removal);
}
-}
\ No newline at end of file
+}
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/javascript/JavascriptServlet.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/javascript/JavascriptServlet.java 2010-11-23 17:34:30 UTC (rev 5232)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/javascript/JavascriptServlet.java 2010-11-23 19:19:18 UTC (rev 5233)
@@ -19,10 +19,14 @@
package org.exoplatform.portal.webui.javascript;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.portal.application.ResourceRequestFilter;
import org.exoplatform.web.application.javascript.JavascriptConfigService;
import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -55,14 +59,23 @@
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException
{
- JavascriptConfigService service =
+ final JavascriptConfigService service =
(JavascriptConfigService)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(
JavascriptConfigService.class);
-
+ long lastModified = service.getLastModified();
+ long ifModifiedSince = request.getDateHeader(ResourceRequestFilter.IF_MODIFIED_SINCE);
+
// Julien: should we also set charset along with the content type ?
response.setContentType("application/x-javascript");
- ServletOutputStream stream = response.getOutputStream();
- service.writeMergedJavascript(stream);
+ if (!PropertyManager.isDevelopping()) {
+ if (ifModifiedSince >= lastModified) {
+ response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ return;
+ }
+ }
+
+ byte[] jsBytes = service.getMergedJavascript();
+ response.setDateHeader(ResourceRequestFilter.LAST_MODIFIED, lastModified);
+ response.getOutputStream().write(jsBytes);
}
-
}
14 years, 1 month
gatein SVN: r5232 - epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-23 12:34:30 -0500 (Tue, 23 Nov 2010)
New Revision: 5232
Modified:
epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
Log:
JBEPP-657: java.lang.Exception: Cannot find the configuration for the component
Modified: epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-23 16:41:10 UTC (rev 5231)
+++ epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-23 17:34:30 UTC (rev 5232)
@@ -19,6 +19,7 @@
package org.exoplatform.webui.application;
+import org.exoplatform.webui.config.Application;
import org.exoplatform.webui.config.Component;
import org.exoplatform.webui.config.ComponentHandle;
import org.exoplatform.webui.config.Event;
14 years, 1 month
gatein SVN: r5230 - portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-11-23 11:19:07 -0500 (Tue, 23 Nov 2010)
New Revision: 5230
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache.xml
Log:
GTNPORTAL-1684: Use expiration eviction policy for picket link
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache.xml 2010-11-23 16:16:33 UTC (rev 5229)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/jboss-cache.xml 2010-11-23 16:19:07 UTC (rev 5230)
@@ -2,11 +2,12 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
+ <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
eventQueueSize="1000000">
- <property name="maxNodes" value="1000000" />
+ <property name="maxNodes" value="100000" />
<property name="timeToLive" value="120000" />
+ <property name="warnNoExpirationKey" value="false" />
</default>
</eviction>
-</jbosscache>
\ No newline at end of file
+</jbosscache>
14 years, 1 month