gatein SVN: r2026 - in portal/trunk: examples and 2 other directories.
by do-not-reply@jboss.org
Author: trong.tran
Date: 2010-03-07 21:48:56 -0500 (Sun, 07 Mar 2010)
New Revision: 2026
Added:
portal/trunk/examples/skins/
Removed:
portal/trunk/skins/
Modified:
portal/trunk/examples/pom.xml
portal/trunk/examples/skins/pom.xml
portal/trunk/examples/skins/simpleskin/pom.xml
Log:
Move the skins to a better place
Modified: portal/trunk/examples/pom.xml
===================================================================
--- portal/trunk/examples/pom.xml 2010-03-07 22:12:46 UTC (rev 2025)
+++ portal/trunk/examples/pom.xml 2010-03-08 02:48:56 UTC (rev 2026)
@@ -38,6 +38,7 @@
<module>extension</module>
<module>portal</module>
<module>portlets</module>
+ <module>skins</module>
</modules>
</project>
Copied: portal/trunk/examples/skins (from rev 2025, portal/trunk/skins)
Modified: portal/trunk/examples/skins/pom.xml
===================================================================
--- portal/trunk/skins/pom.xml 2010-03-07 22:12:46 UTC (rev 2025)
+++ portal/trunk/examples/skins/pom.xml 2010-03-08 02:48:56 UTC (rev 2026)
@@ -8,7 +8,7 @@
<version>3.0.0-CR02-SNAPSHOT</version>
</parent>
- <groupId>org.gatein.portal.skins</groupId>
+ <groupId>org.gatein.portal.examples.skins</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<name>GateIn Skins</name>
Modified: portal/trunk/examples/skins/simpleskin/pom.xml
===================================================================
--- portal/trunk/skins/simpleskin/pom.xml 2010-03-07 22:12:46 UTC (rev 2025)
+++ portal/trunk/examples/skins/simpleskin/pom.xml 2010-03-08 02:48:56 UTC (rev 2026)
@@ -23,7 +23,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.gatein.portal.skins</groupId>
+ <groupId>org.gatein.portal.examples.skins</groupId>
<artifactId>parent</artifactId>
<version>3.0.0-CR02-SNAPSHOT</version>
</parent>
14 years, 9 months
gatein SVN: r2025 - components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-03-07 17:12:46 -0500 (Sun, 07 Mar 2010)
New Revision: 2025
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RenderHandler.java
Log:
- No need to create a new ResourceURLRewriter per request as it's stateless and made the class package-local as tests are now in the package.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RenderHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RenderHandler.java 2010-03-07 22:09:00 UTC (rev 2024)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RenderHandler.java 2010-03-07 22:12:46 UTC (rev 2025)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -65,6 +65,7 @@
private static final String SEPARATOR = "_";
private static final org.gatein.pc.api.cache.CacheControl DEFAULT_CACHE_CONTROL = new org.gatein.pc.api.cache.CacheControl(0, CacheScope.PRIVATE, null);
+ private static final ResourceURLRewriter RESOURCE_REWRITER = new ResourceURLRewriter();
public RenderHandler(WSRPConsumerImpl consumer)
{
@@ -198,8 +199,7 @@
}
// means that the producer generated the URLs, so handle resources...
- ResourceURLRewriter rewriter = new ResourceURLRewriter();
- return URLTools.replaceURLsBy(markup, rewriter);
+ return URLTools.replaceURLsBy(markup, RESOURCE_REWRITER);
}
private org.gatein.pc.api.cache.CacheControl createCacheControl(MarkupContext markupContext)
@@ -279,8 +279,7 @@
}
}
- // @todo: public for tests
- public static class ResourceURLRewriter extends URLTools.URLReplacementGenerator
+ static class ResourceURLRewriter extends URLTools.URLReplacementGenerator
{
public String getReplacementFor(int currentIndex, URLTools.URLMatch currentMatch)
{
14 years, 9 months
gatein SVN: r2024 - components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-03-07 17:09:00 -0500 (Sun, 07 Mar 2010)
New Revision: 2024
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/InvocationHandler.java
Log:
- Use URLTools.safeEncodeForHTMLId.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/InvocationHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/InvocationHandler.java 2010-03-07 17:47:40 UTC (rev 2023)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/InvocationHandler.java 2010-03-07 22:09:00 UTC (rev 2024)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -23,6 +23,7 @@
package org.gatein.wsrp.consumer;
+import org.gatein.common.net.URLTools;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.response.ErrorResponse;
@@ -147,14 +148,9 @@
protected String getNamespaceFrom(WindowContext windowContext)
{
- // todo: use URLTools.EncodeForHTMLId when it's available in common
if (windowContext != null)
{
- String id = windowContext.getId();
- id = id.replace('=', '_');
- id = id.replace('/', '_');
- id = id.replace('.', '_');
- return id.replace('+', '_');
+ return URLTools.safeEncodeForHTMLId(windowContext.getId());
}
return null;
14 years, 9 months
gatein SVN: r2023 - in components/wsrp/trunk: consumer and 12 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-03-07 12:47:40 -0500 (Sun, 07 Mar 2010)
New Revision: 2023
Added:
components/wsrp/trunk/hibernate-impl/
components/wsrp/trunk/hibernate-impl/pom.xml
components/wsrp/trunk/hibernate-impl/src/
components/wsrp/trunk/hibernate-impl/src/main/
components/wsrp/trunk/hibernate-impl/src/main/java/
components/wsrp/trunk/hibernate-impl/src/main/java/org/
components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/
components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/
components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/
components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/RegistrationInfoPostLoadEventListener.java
components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/
components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/
Removed:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfoPostLoadEventListener.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/
Modified:
components/wsrp/trunk/consumer/pom.xml
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/HibernateConsumerRegistry.java
components/wsrp/trunk/pom.xml
Log:
- GTNWSRP-10: Extracted Hibernate specific code into a separate module.
Modified: components/wsrp/trunk/consumer/pom.xml
===================================================================
--- components/wsrp/trunk/consumer/pom.xml 2010-03-07 15:28:04 UTC (rev 2022)
+++ components/wsrp/trunk/consumer/pom.xml 2010-03-07 17:47:40 UTC (rev 2023)
@@ -1,6 +1,6 @@
<!--
~ JBoss, a division of Red Hat
- ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ Copyright 2010, Red Hat Middleware, LLC, and individual
~ contributors as indicated by the @authors tag. See the
~ copyright.txt in the distribution for a full listing of
~ individual contributors.
@@ -21,7 +21,8 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
@@ -82,10 +83,6 @@
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- </dependency>
<dependency>
<groupId>org.jboss.unit</groupId>
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-03-07 15:28:04 UTC (rev 2022)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-03-07 17:47:40 UTC (rev 2023)
@@ -228,7 +228,7 @@
public RegistrationInfo getRegistrationInfo()
{
- // update parent since it might not be set when unfrozen from Hibernate
+ // update parent since it might not be set when unfrozen from persistence
persistentRegistrationInfo.setParent(this);
return persistentRegistrationInfo;
}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfoPostLoadEventListener.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfoPostLoadEventListener.java 2010-03-07 15:28:04 UTC (rev 2022)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfoPostLoadEventListener.java 2010-03-07 17:47:40 UTC (rev 2023)
@@ -1,56 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * 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.gatein.wsrp.consumer;
-
-import org.hibernate.event.PostLoadEvent;
-import org.hibernate.event.def.DefaultPostLoadEventListener;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class RegistrationInfoPostLoadEventListener extends DefaultPostLoadEventListener
-{
- /**
- * Once the object is loaded from Hibernate, greedily load the associated RegistrationProperties and register with
- * them as a listener for changes in their value.
- *
- * @param event
- */
- public void onPostLoad(PostLoadEvent event)
- {
- Object entity = event.getEntity();
- if (entity instanceof RegistrationInfo)
- {
- RegistrationInfo info = (RegistrationInfo)entity;
-
- for (RegistrationProperty property : info.getRegistrationProperties().values())
- {
- property.setListener(info);
- }
- }
-
- super.onPostLoad(event);
- }
-}
Added: components/wsrp/trunk/hibernate-impl/pom.xml
===================================================================
--- components/wsrp/trunk/hibernate-impl/pom.xml (rev 0)
+++ components/wsrp/trunk/hibernate-impl/pom.xml 2010-03-07 17:47:40 UTC (rev 2023)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2010, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-parent</artifactId>
+ <version>1.0.0-CR01-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>hibernate-impl</artifactId>
+ <packaging>jar</packaging>
+ <name>GateIn WSRP Hibernate-based persistence implementation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-consumer</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.3.2.GA</version>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
Copied: components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/RegistrationInfoPostLoadEventListener.java (from rev 2001, components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfoPostLoadEventListener.java)
===================================================================
--- components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/RegistrationInfoPostLoadEventListener.java (rev 0)
+++ components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/RegistrationInfoPostLoadEventListener.java 2010-03-07 17:47:40 UTC (rev 2023)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * 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.gatein.wsrp.consumer;
+
+import org.hibernate.event.PostLoadEvent;
+import org.hibernate.event.def.DefaultPostLoadEventListener;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class RegistrationInfoPostLoadEventListener extends DefaultPostLoadEventListener
+{
+ /**
+ * Once the object is loaded from Hibernate, greedily load the associated RegistrationProperties and register with
+ * them as a listener for changes in their value.
+ *
+ * @param event
+ */
+ public void onPostLoad(PostLoadEvent event)
+ {
+ Object entity = event.getEntity();
+ if (entity instanceof RegistrationInfo)
+ {
+ RegistrationInfo info = (RegistrationInfo)entity;
+
+ for (RegistrationProperty property : info.getRegistrationProperties().values())
+ {
+ property.setListener(info);
+ }
+ }
+
+ super.onPostLoad(event);
+ }
+}
Copied: components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/hibernate (from rev 2001, components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/hibernate)
Modified: components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/HibernateConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/HibernateConsumerRegistry.java 2010-03-05 11:00:22 UTC (rev 2001)
+++ components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/HibernateConsumerRegistry.java 2010-03-07 17:47:40 UTC (rev 2023)
@@ -1,24 +1,25 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * 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.gatein.wsrp.consumer.registry.hibernate;
Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml 2010-03-07 15:28:04 UTC (rev 2022)
+++ components/wsrp/trunk/pom.xml 2010-03-07 17:47:40 UTC (rev 2023)
@@ -21,7 +21,8 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -55,7 +56,6 @@
<version.javax.mail>1.4.1</version.javax.mail>
<version.javax.xml.ws>2.1</version.javax.xml.ws>
<version.javax.xml.soap.saaj>1.3</version.javax.xml.soap.saaj>
- <version.hibernate>3.3.1.GA</version.hibernate>
</properties>
<dependencyManagement>
@@ -153,13 +153,6 @@
<artifactId>saaj-api</artifactId>
<version>${version.javax.xml.soap.saaj}</version>
</dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${version.hibernate}</version>
- </dependency>
-
</dependencies>
</dependencyManagement>
@@ -172,6 +165,7 @@
<module>consumer</module>
<module>admin-gui</module>
<module>wsrp-producer-war</module>
+ <module>hibernate-impl</module>
</modules>
<repositories>
14 years, 9 months
gatein SVN: r2022 - in portal/trunk/component: portal/src/main/java/org/exoplatform/portal/resource and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-03-07 10:28:04 -0500 (Sun, 07 Mar 2010)
New Revision: 2022
Added:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/ByteArrayOutput.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/CachedStylesheet.java
Log:
fixing what I broke
Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/ByteArrayOutput.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/ByteArrayOutput.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/ByteArrayOutput.java 2010-03-07 15:28:04 UTC (rev 2022)
@@ -0,0 +1,68 @@
+/*
+ * 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.commons.utils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ByteArrayOutput implements BinaryOutput {
+
+ /** . */
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ /** . */
+ private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ public Charset getCharset()
+ {
+ return UTF_8;
+ }
+
+ public void write(byte b) throws IOException
+ {
+ baos.write(b);
+ }
+
+ public void write(byte[] bytes) throws IOException
+ {
+ baos.write(bytes);
+ }
+
+ public void write(byte[] bytes, int off, int len) throws IOException
+ {
+ baos.write(bytes, off, len);
+ }
+
+ public byte[] getBytes()
+ {
+ return baos.toByteArray();
+ }
+
+ public String getString() throws UnsupportedEncodingException
+ {
+ return baos.toString(UTF_8.name());
+ }
+}
Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/CachedStylesheet.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/CachedStylesheet.java (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/CachedStylesheet.java 2010-03-07 15:28:04 UTC (rev 2022)
@@ -0,0 +1,73 @@
+/*
+ * 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.resource;
+
+import org.exoplatform.commons.utils.*;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class CachedStylesheet
+{
+
+ /** The optimized encoder. */
+ private static final TextEncoder encoder = new CharsetTextEncoder(new TableCharEncoder(CharsetCharEncoder.getUTF8()));
+
+ /** . */
+ private final String text;
+
+ /** . */
+ private final byte[] bytes;
+
+ public CachedStylesheet(String text)
+ {
+ // Compute encoded bytes
+ byte[] bytes;
+ try
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(text.length() * 2);
+ encoder.encode(text, 0, text.length(), baos);
+ baos.flush();
+ bytes = baos.toByteArray();
+ } catch (IOException e)
+ {
+ throw new UndeclaredThrowableException(e, "That should not happen");
+ }
+
+ //
+ this.text = text;
+ this.bytes = bytes;
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void writeTo(BinaryOutput output) throws IOException
+ {
+ output.write(bytes);
+ }
+}
14 years, 9 months
gatein SVN: r2021 - in portal/trunk: component/portal/src/main/java/org/exoplatform/portal/resource and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-03-07 04:53:34 -0500 (Sun, 07 Mar 2010)
New Revision: 2021
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/BinaryOutput.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/OutputStreamPrinter.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/OutputStreamWriterGroovyPrinter.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java
Log:
- get rid of the resource filter cache as it is possible to cache directly the binary encoded array in the css service itself (actually the cache was very badly used (my fault btw))
Modified: portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/BinaryOutput.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/BinaryOutput.java 2010-03-06 22:24:53 UTC (rev 2020)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/BinaryOutput.java 2010-03-07 09:53:34 UTC (rev 2021)
@@ -34,6 +34,6 @@
void write(byte[] bytes) throws IOException;
- void write(byte[] b, int off, int len) throws IOException;
+ void write(byte[] bytes, int off, int len) throws IOException;
}
Modified: portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/OutputStreamPrinter.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/OutputStreamPrinter.java 2010-03-06 22:24:53 UTC (rev 2020)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/OutputStreamPrinter.java 2010-03-07 09:53:34 UTC (rev 2021)
@@ -257,13 +257,13 @@
}
}
- public final void write(byte[] b, int off, int len) throws IOException
+ public final void write(byte[] bytes, int off, int len) throws IOException
{
if (!failed)
{
try
{
- out.write(b, off, len);
+ out.write(bytes, off, len);
}
catch (IOException e)
{
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java 2010-03-06 22:24:53 UTC (rev 2020)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java 2010-03-07 09:53:34 UTC (rev 2021)
@@ -19,6 +19,10 @@
package org.exoplatform.portal.resource;
+import org.exoplatform.commons.utils.BinaryOutput;
+
+import java.io.IOException;
+
/**
* An interface defining the renderer contract for a resource.
*
@@ -29,11 +33,12 @@
{
/**
- * Returns an appendable for the performing the rendering of the resource.
+ * Returns an output stream for performing resource rendering.
*
- * @return the appendable
+ * @return a stream
+ * @throws IOException any io exception
*/
- Appendable getAppendable();
+ BinaryOutput getOutput() throws IOException;
/**
* Instruct the renderer about the expiration time in seconds. A non positive value
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java 2010-03-06 22:24:53 UTC (rev 2020)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java 2010-03-07 09:53:34 UTC (rev 2021)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.resource;
+import org.exoplatform.commons.utils.BinaryOutput;
+import org.exoplatform.commons.utils.ByteArrayOutput;
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.commons.utils.Safe;
import org.exoplatform.container.ExoContainerContext;
@@ -111,9 +113,9 @@
private final HashSet<String> availableSkins_;
- private final Map<String, String> ltCache;
+ private final Map<String, CachedStylesheet> ltCache;
- private final Map<String, String> rtCache;
+ private final Map<String, CachedStylesheet> rtCache;
private final Map<String, Set<String>> portletThemes_;
@@ -137,8 +139,8 @@
portalSkins_ = new LinkedHashMap<SkinKey, SkinConfig>();
skinConfigs_ = new LinkedHashMap<SkinKey, SkinConfig>(20);
availableSkins_ = new HashSet<String>(5);
- ltCache = new ConcurrentHashMap<String, String>();
- rtCache = new ConcurrentHashMap<String, String>();
+ ltCache = new ConcurrentHashMap<String, CachedStylesheet>();
+ rtCache = new ConcurrentHashMap<String, CachedStylesheet>();
portletThemes_ = new HashMap<String, Set<String>>();
portalContainerName = context.getPortalContainerName();
mainResolver = new MainResourceResolver(portalContainerName, skinConfigs_);
@@ -174,10 +176,6 @@
*/
public void addPortalSkin(String module, String skinName, String cssPath, ServletContext scontext, boolean overwrite)
{
-
- // // Triggers a put if absent
- // mainResolver.registerContext(scontext);
-
availableSkins_.add(skinName);
SkinKey key = new SkinKey(module, skinName);
SkinConfig skinConfig = portalSkins_.get(key);
@@ -196,8 +194,8 @@
{
portalSkins_.put(key, new SimpleSkin(this, module, skinName, cssPath));
}
- ltCache.put(cssPath, cssData);
- rtCache.put(cssPath, cssData);
+ ltCache.put(cssPath, new CachedStylesheet(cssData));
+ rtCache.put(cssPath, new CachedStylesheet(cssData));
}
public void addSkin(String module, String skinName, String cssPath, ServletContext scontext)
@@ -230,9 +228,6 @@
public void addSkin(String module, String skinName, String cssPath, ServletContext scontext, boolean overwrite)
{
- // // Triggers a put if absent
- // mainResolver.registerContext(scontext);
-
availableSkins_.add(skinName);
SkinKey key = new SkinKey(module, skinName);
SkinConfig skinConfig = skinConfigs_.get(key);
@@ -245,7 +240,6 @@
public void addSkin(String module, String skinName, String cssPath, String cssData)
{
- //
availableSkins_.add(skinName);
SkinKey key = new SkinKey(module, skinName);
SkinConfig skinConfig = skinConfigs_.get(key);
@@ -253,8 +247,8 @@
{
skinConfigs_.put(key, new SimpleSkin(this, module, skinName, cssPath));
}
- ltCache.put(cssPath, cssData);
- rtCache.put(cssPath, cssData);
+ ltCache.put(cssPath, new CachedStylesheet(cssData));
+ rtCache.put(cssPath, new CachedStylesheet(cssData));
}
public void addTheme(String categoryName, List<String> themesName)
@@ -287,20 +281,18 @@
{
try
{
- final StringBuilder sb = new StringBuilder();
+ final ByteArrayOutput output = new ByteArrayOutput();
renderCSS(new ResourceRenderer()
{
- public Appendable getAppendable()
+ public BinaryOutput getOutput() throws IOException
{
- return sb;
+ return output;
}
-
public void setExpiration(long seconds)
{
-
}
}, cssPath);
- return sb.toString();
+ return output.toString();
}
catch (IOException e)
{
@@ -341,26 +333,30 @@
}
//
- Map<String, String> cache = orientation == Orientation.LT ? ltCache : rtCache;
- String css = cache.get(path);
+ Map<String, CachedStylesheet> cache = orientation == Orientation.LT ? ltCache : rtCache;
+ CachedStylesheet css = cache.get(path);
if (css == null)
{
StringBuilder sb = new StringBuilder();
processCSS(sb, path, orientation, true);
- css = sb.toString();
+ css = new CachedStylesheet(sb.toString());
cache.put(path, css);
}
- renderer.getAppendable().append(css);
+ css.writeTo(renderer.getOutput());
}
else
{
- processCSS(renderer.getAppendable(), path, orientation, false);
+ StringBuffer sb = new StringBuffer();
+ processCSS(sb, path, orientation, false);
+ byte[] bytes = sb.toString().getBytes("UTF-8");
+ renderer.getOutput().write(bytes);
}
}
public String getMergedCSS(String cssPath)
{
- return ltCache.get(cssPath);
+ CachedStylesheet stylesheet = ltCache.get(cssPath);
+ return stylesheet != null ? stylesheet.getText() : null;
}
public Collection<SkinConfig> getPortalSkins(String skinName)
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/OutputStreamWriterGroovyPrinter.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/OutputStreamWriterGroovyPrinter.java 2010-03-06 22:24:53 UTC (rev 2020)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/OutputStreamWriterGroovyPrinter.java 2010-03-07 09:53:34 UTC (rev 2021)
@@ -91,9 +91,9 @@
out.write(bytes);
}
- public void write(byte[] b, int off, int len) throws IOException
+ public void write(byte[] bytes, int off, int len) throws IOException
{
- out.write(b, off, len);
+ out.write(bytes, off, len);
}
public void write(byte b) throws IOException
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java 2010-03-06 22:24:53 UTC (rev 2020)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java 2010-03-07 09:53:34 UTC (rev 2021)
@@ -19,17 +19,11 @@
package org.exoplatform.portal.application;
-import org.exoplatform.commons.utils.CharsetCharEncoder;
-import org.exoplatform.commons.utils.CharsetTextEncoder;
-import org.exoplatform.commons.utils.PropertyManager;
-import org.exoplatform.commons.utils.TableCharEncoder;
-import org.exoplatform.commons.utils.TextEncoder;
+import org.exoplatform.commons.utils.*;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.web.AbstractFilter;
import org.exoplatform.portal.resource.ResourceRenderer;
import org.exoplatform.portal.resource.SkinService;
-import org.exoplatform.services.cache.ExoCache;
-import org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -41,6 +35,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLDecoder;
+import java.nio.charset.Charset;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -59,27 +54,22 @@
public class ResourceRequestFilter extends AbstractFilter
{
- protected static Log log = ExoLogger.getLogger("portal:ResourceRequestFilter");
+ protected static Log log = ExoLogger.getLogger(ResourceRequestFilter.class);
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
private FilterConfig cfg;
private ImageType[] imageTypes = ImageType.values();
- private ConcurrentMap<String, FutureTask<Image>> mirroredImageCache =
- new ConcurrentHashMap<String, FutureTask<Image>>();
+ private ConcurrentMap<String, FutureTask<Image>> mirroredImageCache = new ConcurrentHashMap<String, FutureTask<Image>>();
- private ExoCache cssCache = new ConcurrentFIFOExoCache(50);
-
public void afterInit(FilterConfig filterConfig)
{
cfg = filterConfig;
log.info("Cache eXo Resource at client: " + !PropertyManager.isDevelopping());
}
- /** The optimized encoder. */
- private static final TextEncoder encoder =
- new CharsetTextEncoder(new TableCharEncoder(CharsetCharEncoder.getUTF8()));
-
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException
{
@@ -93,75 +83,31 @@
if (uri.endsWith(".css"))
{
final OutputStream out = response.getOutputStream();
- final Appendable app = new Appendable()
+ final BinaryOutput output = new BinaryOutput()
{
- public Appendable append(CharSequence csq) throws IOException
+ public Charset getCharset()
{
- // julien : yeah there is a nasty cast but for now it is ok as we know it is a string
- // need to work on an optimized appender for
- String s = (String)csq;
-
- // Get existing bytes
- byte[] bytes = null;
- try
- {
- bytes = (byte[])cssCache.get(s);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- // Get bytes if needed
- if (bytes == null)
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(s.length() * 2);
- encoder.encode(s, 0, s.length(), baos);
- baos.flush();
- bytes = baos.toByteArray();
- try
- {
- cssCache.put(s, bytes);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- //
- try
- {
- out.write(bytes);
- }
- catch (IOException ignore)
- {
- }
-
- //
- return this;
+ return UTF_8;
}
-
- public Appendable append(CharSequence csq, int start, int end) throws IOException
+ public void write(byte b) throws IOException
{
- throw new UnsupportedOperationException("Should no be called");
+ out.write(b);
}
-
- public Appendable append(char c) throws IOException
+ public void write(byte[] bytes) throws IOException
{
- encoder.encode(c, out);
- return this;
+ out.write(bytes);
}
+ public void write(byte[] bytes, int off, int len) throws IOException
+ {
+ out.write(bytes, off, len);
+ }
};
-
ResourceRenderer renderer = new ResourceRenderer()
{
- public Appendable getAppendable()
+ public BinaryOutput getOutput() throws IOException
{
- //
- return app;
+ return output;
}
-
public void setExpiration(long seconds)
{
if (seconds > 0)
14 years, 9 months
gatein SVN: r2020 - portal/trunk/component/web/src/main/java/org/exoplatform/web/login.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-03-06 17:24:53 -0500 (Sat, 06 Mar 2010)
New Revision: 2020
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java
Log:
minor
Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java 2010-03-06 22:22:04 UTC (rev 2019)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java 2010-03-06 22:24:53 UTC (rev 2020)
@@ -25,13 +25,11 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.web.AbstractFilter;
-import org.exoplatform.services.security.IdentityRegistry;
import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.PortalLoginModule;
import org.jboss.web.tomcat.security.login.WebAuthentication;
-import javax.security.auth.login.LoginException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
14 years, 9 months
gatein SVN: r2019 - portal/trunk.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-03-06 17:22:04 -0500 (Sat, 06 Mar 2010)
New Revision: 2019
Modified:
portal/trunk/pom.xml
Log:
GTNPORTAL-747 : Exclude hibernate from WSRP consumer jar as it conflicts with GateIn hibernate version, somehow WSRP consumer should have its hibernate implementation in its own jar to make it optional
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2010-03-06 21:53:23 UTC (rev 2018)
+++ portal/trunk/pom.xml 2010-03-06 22:22:04 UTC (rev 2019)
@@ -298,6 +298,12 @@
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-consumer</artifactId>
<version>${org.gatein.wsrp.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.gatein.wsrp</groupId>
14 years, 9 months
gatein SVN: r2018 - portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-03-06 16:53:23 -0500 (Sat, 06 Mar 2010)
New Revision: 2018
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
Log:
GTNPORTAL-784 : "Resources could not be found or the invoker doesn't have adequate privileges to get the resource" errors at startup
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2010-03-06 21:04:00 UTC (rev 2017)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2010-03-06 21:53:23 UTC (rev 2018)
@@ -476,18 +476,18 @@
private String getDefaultConfig(String location, String path) throws Exception
{
String s = location + path;
- log.debug("Attempt to load file " + s);
+ String content = null;
try
{
- String content = IOUtil.getStreamContentAsString(cmanager_.getInputStream(s));
+ log.debug("Attempt to load file " + s);
+ content = IOUtil.getStreamContentAsString(cmanager_.getInputStream(s));
log.debug("Loaded file from path " + s + " with content " + content);
- return content;
}
catch (Exception ignore)
{
- log.debug("Could not get file " + s + " will return null instead", ignore);
- return null;
+ log.debug("Could not get file " + s + " will return null instead");
}
+ return content;
}
public Page createPageFromTemplate(String ownerType, String owner, String temp) throws Exception
14 years, 9 months
gatein SVN: r2017 - in portal/trunk/component/portal/src: test/java/org/exoplatform/portal/config and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-03-06 16:04:00 -0500 (Sat, 06 Mar 2010)
New Revision: 2017
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java
Log:
fix a bug due to caching null return values in mop cache
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java 2010-03-06 18:34:42 UTC (rev 2016)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java 2010-03-06 21:04:00 UTC (rev 2017)
@@ -86,7 +86,8 @@
private <K extends Serializable, V> V create(POMSession session, CacheableDataTask<K, V> task) throws Exception
{
- // Nothing to do for now
+ K key = task.getKey();
+ session.scheduleForEviction(key);
return super.execute(session, task);
}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java 2010-03-06 18:34:42 UTC (rev 2016)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java 2010-03-06 21:04:00 UTC (rev 2017)
@@ -49,6 +49,21 @@
mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
}
+ public void testGetNullInvalidation() throws Exception
+ {
+ begin();
+ session = mgr.openSession();
+ assertNull(storage_.getPage("portal::test::nonexisting"));
+ Page page = new Page();
+ page.setPageId("portal::test::nonexisting");
+ storage_.create(page);
+ end(true);
+ begin();
+ session = mgr.openSession();
+ assertNotNull(storage_.getPage("portal::test::nonexisting"));
+ end();
+ }
+
public void testDirtyWrite() throws Exception
{
begin();
14 years, 9 months