JBoss Portal SVN: r5879 - in trunk/portlet: . src/main/org/jboss/portal/test/portlet/jsr168/ext src/main/org/jboss/portal/test/portlet/jsr168/ext/common src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache src/resources/test/jsr168/ext src/resources/test/jsr168/ext/expiringcache-war/WEB-INF src/resources/test/jsr168/ext/neverexpiringcache-war src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-15 19:48:38 -0500 (Fri, 15 Dec 2006)
New Revision: 5879
Added:
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/NeverExpiringCacheTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheSequenceBuilder.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheSequenceBuilder.java
trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/
trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/
trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/portlet.xml
trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/web.xml
Modified:
trunk/portlet/build.xml
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java
trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml
Log:
JBPORTAL-1163 : preliminary refactoring of cache tests
Modified: trunk/portlet/build.xml
===================================================================
--- trunk/portlet/build.xml 2006-12-15 23:25:01 UTC (rev 5878)
+++ trunk/portlet/build.xml 2006-12-16 00:48:38 UTC (rev 5879)
@@ -238,6 +238,7 @@
<sequential>
<mkdir dir="${build.resources}/test/jsr168/ext/@{test}-war/WEB-INF/classes"/>
<copy todir="${build.resources}/test/jsr168/ext/@{test}-war/WEB-INF/classes">
+ <fileset dir="${build.classes}" includes="org/jboss/portal/test/portlet/jsr168/ext/common/**"/>
<fileset dir="${build.classes}" includes="org/jboss/portal/test/portlet/jsr168/ext/@{test}/**"/>
<fileset dir="${build.classes}" includes="org/jboss/portal/test/portlet/framework/**"/>
</copy>
@@ -378,6 +379,7 @@
<!-- Ext tests -->
<package-ext-test test="nocache"/>
<package-ext-test test="expiringcache"/>
+ <package-ext-test test="neverexpiringcache"/>
<package-ext-test test="preferences"/>
<package-ext-test test="session"/>
<package-ext-test test="portletresponses"/>
@@ -457,6 +459,7 @@
<x-test>
<!--Spec TCK Assertions tests-->
+<!--
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.tck.DispatcherTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.tck.PortletConfigTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.tck.PortletContextTestCase"/>
@@ -468,8 +471,10 @@
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.tck.PortletURLTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.tck.PreferencesTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.tck.WindowStatesTestCase"/>
+-->
<!--API Tests-->
+<!--
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.api.ActionRequestTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.api.ActionResponseTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.api.PortalContextTestCase"/>
@@ -483,8 +488,10 @@
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.api.RenderRequestTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.api.RenderResponseTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.api.WindowStateTestCase"/>
+-->
<!--Ext Tests-->
+<!--
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.DispatcherTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.PortletConfigTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.PortletModeTestCase"/>
@@ -492,11 +499,13 @@
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.PortletResponsesTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.PreferencesTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.SessionTestCase"/>
+-->
<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.ExpiringCacheTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.NoCacheTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.NeverExpiringCacheTestCase"/>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.ext.NoCacheTestCase"/>-->
<!--Misc Tests-->
- <test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.misc.Log4jTestCase"/>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.jsr168.misc.Log4jTestCase"/>-->
</x-test>
<x-classpath>
Added: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/NeverExpiringCacheTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/NeverExpiringCacheTestCase.java 2006-12-15 23:25:01 UTC (rev 5878)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/NeverExpiringCacheTestCase.java 2006-12-16 00:48:38 UTC (rev 5879)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.test.portlet.jsr168.ext;
+
+import org.jboss.portal.test.framework.server.runner.ServerTestRunner;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NeverExpiringCacheTestCase extends ServerTestRunner
+{
+ public NeverExpiringCacheTestCase()
+ {
+ super("test-jsr168-ext-neverexpiringcache.war");
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheSequenceBuilder.java 2006-12-15 23:25:01 UTC (rev 5878)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheSequenceBuilder.java 2006-12-16 00:48:38 UTC (rev 5879)
@@ -0,0 +1,536 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.test.portlet.jsr168.ext.common;
+
+import org.jboss.portal.test.framework.portlet.SequenceRegistryBuilder;
+import org.jboss.portal.test.framework.portlet.SequenceRegistry;
+import org.jboss.portal.test.framework.portlet.Joinpoint;
+import org.jboss.portal.test.framework.portlet.Sequence;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
+import org.jboss.portal.common.test.driver.DriverResponse;
+import org.jboss.portal.common.test.driver.response.EndTestResponse;
+import org.jboss.portal.common.util.CollectionBuilder;
+
+import javax.portlet.PortletURL;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionResponse;
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import java.util.Set;
+import java.util.HashSet;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractCacheSequenceBuilder extends SequenceRegistryBuilder
+{
+
+ protected final AbstractCacheSequenceBuilder.NavigationalStateConfigurator renderParameterConfigurator = new AbstractCacheSequenceBuilder.NavigationalStateConfigurator()
+ {
+ public PortletURL createPortletURL(RenderResponse resp)
+ {
+ PortletURL url = resp.createRenderURL();
+ url.setParameter("abc", "def");
+ return url;
+ }
+ public void configureNavigationalState(ActionResponse resp)
+ {
+ resp.setRenderParameter("abc", "fed");
+ }
+ };
+
+ /**
+ * Overriding the expiration cache to 0 disable the cache on a render or an action/render.
+ */
+ protected void createDisableDuringRender(String testName, SequenceRegistry registry, Joinpoint renderjp, Joinpoint actionjp)
+ {
+ final Set calls = new HashSet();
+ Sequence seq = new Sequence();
+ registry.addSequence(testName, seq);
+
+ //
+ seq.addAction(0, renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ //
+ calls.add("0");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+
+ // Refresh
+ String url = response.createRenderURL().toString();
+ return new InvokeGetResponse(url);
+ }
+ });
+
+ //
+ seq.addAction(1, renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ //
+ calls.add("1");
+ response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+
+ // Refresh
+ String url = response.createActionURL().toString();
+ return new InvokeGetResponse(url);
+ }
+ });
+
+ //
+ seq.addAction(2, actionjp, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ //
+ calls.add("2_action");
+ }
+ });
+ seq.addAction(2, renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("2_render");
+
+ //
+ Set expected = new CollectionBuilder().add("0").add("1").add("2_action").add("2_render").toHashSet();
+ assertEquals(expected, calls);
+
+ // End test
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ /**
+ * Caching happens after a render with the same render parameters for at most 5 seconds
+ * Calling render on the portlet with different render parameters invalidates the cache
+ */
+// public void createExpiringCache(SequenceRegistry registry)
+// {
+// final Set calls = new HashSet();
+// final String[] url = new String[1];
+// Sequence seq = new Sequence();
+// registry.addSequence("ExpiringCache", seq);
+//
+// //
+// seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Content is not cached
+// calls.add("0");
+//
+// // Refresh
+// url[0] = response.createRenderURL().toString();
+// return new InvokeGetResponse(url[0]);
+// }
+// });
+//
+// //
+// seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Should not be called
+// calls.add("1");
+// return null;
+// }
+// });
+// seq.addAction(1, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Refresh
+// return new InvokeGetResponse(url[0]);
+// }
+// });
+//
+// //
+// seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Could be called depending on whether the portal
+// // decides to invoke UTP2 or UTP3 first
+// // so if it's called we need to disable cache otherwise the next
+// // render will probably not be called
+// response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+// return null;
+// }
+// });
+// seq.addAction(2, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// try
+// {
+// assertFalse(calls.contains("1"));
+//
+// // Wait 5 seconds for the cache entry to be invalid
+// Thread.sleep(5 * 1000);
+//
+// // Refresh
+// return new InvokeGetResponse(url[0]);
+// }
+// catch (InterruptedException e)
+// {
+// return new ErrorResponse(e);
+// }
+// }
+// });
+//
+// //
+// seq.addAction(3, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Should be called
+// calls.add("3");
+//
+// // Invoke the same but with different render parameter
+// PortletURL tmp = response.createRenderURL();
+// tmp.setParameter("abc", "def");
+// url[0] = tmp.toString();
+// return new InvokeGetResponse(url[0]);
+// }
+// });
+//
+// //
+// seq.addAction(4, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Should be called
+// calls.add("4");
+//
+// // Refresh
+// return new InvokeGetResponse(url[0]);
+// }
+// });
+//
+// //
+// seq.addAction(5, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Should not be called
+// calls.add("5");
+// return null;
+// }
+// });
+// seq.addAction(5, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Refresh
+// return new InvokeGetResponse(url[0]);
+// }
+// });
+//
+// //
+// seq.addAction(6, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Could be called depending on whether the portal
+// // decides to invoke UTP2 or UTP3 first
+// // so if it's called we need to disable cache otherwise the next
+// // render will probably not be called
+// response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
+// return null;
+// }
+// });
+// seq.addAction(6, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// try
+// {
+// assertFalse(calls.contains("5"));
+//
+// // Wait 5 seconds for the cache entry to be invalid
+// Thread.sleep(5 * 1000);
+//
+// // Refresh
+// return new InvokeGetResponse(url[0]);
+// }
+// catch (InterruptedException e)
+// {
+// return new ErrorResponse(e);
+// }
+// }
+// });
+//
+// //
+// seq.addAction(7, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+// {
+// // Should be called
+// calls.add("7");
+//
+// //
+// Set expected = new CollectionBuilder().add("0").add("3").add("4").add("7").toHashSet();
+// assertEquals(expected, calls);
+//
+// // Refresh
+// return new EndTestResponse();
+// }
+// });
+// }
+
+ protected interface NavigationalStateConfigurator
+ {
+ PortletURL createPortletURL(RenderResponse resp);
+ void configureNavigationalState(ActionResponse resp);
+ }
+
+ /**
+ * Calling render on the portlet with different render parameters invalidates the cache
+ */
+ protected void createCacheMarkup(
+ String testName,
+ SequenceRegistry registry,
+ Joinpoint p1renderjp,
+ Joinpoint p1actionjp,
+ Joinpoint p2renderjp,
+ final AbstractCacheSequenceBuilder.NavigationalStateConfigurator configurator)
+ {
+ final Set calls = new HashSet();
+ final String[] url = new String[1];
+ Sequence seq = new Sequence();
+ registry.addSequence(testName, seq);
+
+ //
+ seq.addAction(0, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("0");
+
+ // Create invalidating action url for later use
+ url[0] = response.createActionURL().toString();
+
+ // Refresh
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.addAction(1, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("1");
+ return null;
+ }
+ });
+ seq.addAction(1, p2renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Invalidate with action
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, p1actionjp, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ calls.add("2_action");
+ }
+ });
+ seq.addAction(2, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("2_render");
+
+ // Refresh with different URL
+ PortletURL url = configurator.createPortletURL(response);
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(3, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("3");
+
+ // Invoke with same different URL
+ PortletURL url = configurator.createPortletURL(response);
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(4, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should not be called
+ calls.add("4");
+ return null;
+ }
+ });
+ seq.addAction(4, p2renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Invalidate with action
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(5, p1actionjp, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ calls.add("5_action");
+
+ // Configure the navitional state
+ configurator.configureNavigationalState(response);
+ }
+ });
+ seq.addAction(5, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should be called
+ calls.add("5_render");
+
+ // Refresh with different navigational state to check it will be called in the next render phase
+ PortletURL url = response.createRenderURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ //
+ seq.addAction(6, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ Set expected = new CollectionBuilder().add("0").add("2_action").add("2_render").add("3").add("5_action").add("5_render").toHashSet();
+ assertEquals(expected, calls);
+
+ // Refresh
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ /**
+ * Calling action on the portlet invalidates the cache.
+ */
+ protected void createActionInvalidates(
+ String testName,
+ SequenceRegistry registry,
+ Joinpoint p1renderjp,
+ Joinpoint p1actionjp,
+ Joinpoint p2renderjp)
+ {
+ final Set calls = new HashSet();
+ final String[] url = new String[1];
+ Sequence seq = new Sequence();
+ registry.addSequence(testName, seq);
+
+ //
+ seq.addAction(0, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("0");
+
+ // Refresh
+ url[0] = response.createActionURL().toString();
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ //
+ seq.addAction(1, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Should no be called
+ calls.add("1");
+ return null;
+ }
+ });
+ seq.addAction(1, p2renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Invalidate
+ return new InvokeGetResponse(url[0]);
+ }
+ });
+
+ //
+ seq.addAction(2, p1actionjp, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ //
+ calls.add("2_action");
+ }
+ });
+ seq.addAction(2, p1renderjp, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ // Content is not cached
+ calls.add("2_render");
+
+ //
+ Set expected = new CollectionBuilder().add("0").add("2_action").add("2_render").toHashSet();
+ assertEquals(expected, calls);
+
+ // End test
+ return new EndTestResponse();
+ }
+ });
+ }
+
+
+}
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java 2006-12-15 23:25:01 UTC (rev 5878)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheSequenceBuilder.java 2006-12-16 00:48:38 UTC (rev 5879)
@@ -22,45 +22,19 @@
******************************************************************************/
package org.jboss.portal.test.portlet.jsr168.ext.expiringcache;
-import org.jboss.portal.test.framework.portlet.SequenceRegistryBuilder;
import org.jboss.portal.test.framework.portlet.SequenceRegistry;
-import org.jboss.portal.test.framework.portlet.Sequence;
-import org.jboss.portal.test.framework.portlet.PortletTestContext;
-import org.jboss.portal.test.framework.portlet.Joinpoint;
-import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
-import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
-import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.portal.test.portlet.framework.UTP2;
import org.jboss.portal.test.portlet.framework.UTP3;
import org.jboss.portal.test.portlet.framework.UTP4;
import org.jboss.portal.test.portlet.framework.UTP5;
-import org.jboss.portal.test.portlet.framework.UTP6;
-import org.jboss.portal.test.portlet.framework.UTP7;
-import org.jboss.portal.test.portlet.framework.UTP8;
-import org.jboss.portal.test.portlet.framework.UTP9;
-import org.jboss.portal.test.portlet.framework.UTP10;
-import org.jboss.portal.common.test.driver.DriverResponse;
-import org.jboss.portal.common.test.driver.response.EndTestResponse;
-import org.jboss.portal.common.test.driver.response.ErrorResponse;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.test.portlet.jsr168.ext.common.AbstractCacheSequenceBuilder;
-import javax.portlet.Portlet;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletException;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletURL;
-import java.io.IOException;
-import java.util.Set;
-import java.util.HashSet;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class ExpiringCacheSequenceBuilder extends SequenceRegistryBuilder
+public class ExpiringCacheSequenceBuilder extends AbstractCacheSequenceBuilder
{
public void createDisableDuringRenderExpiringCache(SequenceRegistry registry)
@@ -68,475 +42,13 @@
createDisableDuringRender("DisableDuringRenderExpiringCache", registry, UTP1.RENDER_JOINPOINT, UTP1.ACTION_JOINPOINT);
}
- public void createDisableDuringRenderNeverExpiringCache(SequenceRegistry registry)
- {
- createDisableDuringRender("DisableDuringRenderNeverExpiringCache", registry, UTP6.RENDER_JOINPOINT, UTP6.ACTION_JOINPOINT);
- }
-
- /**
- * Overriding the expiration cache to 0 disable the cache on a render or an action/render.
- */
- private void createDisableDuringRender(String testName, SequenceRegistry registry, Joinpoint renderjp, Joinpoint actionjp)
- {
- final Set calls = new HashSet();
- Sequence seq = new Sequence();
- registry.addSequence(testName, seq);
-
- //
- seq.addAction(0, renderjp, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- //
- calls.add("0");
- response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
-
- // Refresh
- String url = response.createRenderURL().toString();
- return new InvokeGetResponse(url);
- }
- });
-
- //
- seq.addAction(1, renderjp, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- //
- calls.add("1");
- response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
-
- // Refresh
- String url = response.createActionURL().toString();
- return new InvokeGetResponse(url);
- }
- });
-
- //
- seq.addAction(2, actionjp, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
- {
- //
- calls.add("2_action");
- }
- });
- seq.addAction(2, renderjp, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Content is not cached
- calls.add("2_render");
-
- //
- Set expected = new CollectionBuilder().add("0").add("1").add("2_action").add("2_render").toHashSet();
- assertEquals(expected, calls);
-
- // End test
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * Caching happens after a render with the same render parameters for at most 5 seconds
- * Calling render on the portlet with different render parameters invalidates the cache
- */
public void createExpiringCache(SequenceRegistry registry)
{
- final Set calls = new HashSet();
- final String[] url = new String[1];
- Sequence seq = new Sequence();
- registry.addSequence("ExpiringCache", seq);
-
- //
- seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Content is not cached
- calls.add("0");
-
- // Refresh
- url[0] = response.createRenderURL().toString();
- return new InvokeGetResponse(url[0]);
- }
- });
-
- //
- seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should not be called
- calls.add("1");
- return null;
- }
- });
- seq.addAction(1, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Refresh
- return new InvokeGetResponse(url[0]);
- }
- });
-
- //
- seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Could be called depending on whether the portal
- // decides to invoke UTP2 or UTP3 first
- // so if it's called we need to disable cache otherwise the next
- // render will probably not be called
- response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
- return null;
- }
- });
- seq.addAction(2, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- try
- {
- assertFalse(calls.contains("1"));
-
- // Wait 5 seconds for the cache entry to be invalid
- Thread.sleep(5 * 1000);
-
- // Refresh
- return new InvokeGetResponse(url[0]);
- }
- catch (InterruptedException e)
- {
- return new ErrorResponse(e);
- }
- }
- });
-
- //
- seq.addAction(3, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should be called
- calls.add("3");
-
- // Invoke the same but with different render parameter
- PortletURL tmp = response.createRenderURL();
- tmp.setParameter("abc", "def");
- url[0] = tmp.toString();
- return new InvokeGetResponse(url[0]);
- }
- });
-
- //
- seq.addAction(4, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should be called
- calls.add("4");
-
- // Refresh
- return new InvokeGetResponse(url[0]);
- }
- });
-
- //
- seq.addAction(5, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should not be called
- calls.add("5");
- return null;
- }
- });
- seq.addAction(5, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Refresh
- return new InvokeGetResponse(url[0]);
- }
- });
-
- //
- seq.addAction(6, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Could be called depending on whether the portal
- // decides to invoke UTP2 or UTP3 first
- // so if it's called we need to disable cache otherwise the next
- // render will probably not be called
- response.setProperty(RenderResponse.EXPIRATION_CACHE, "0");
- return null;
- }
- });
- seq.addAction(6, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- try
- {
- assertFalse(calls.contains("5"));
-
- // Wait 5 seconds for the cache entry to be invalid
- Thread.sleep(5 * 1000);
-
- // Refresh
- return new InvokeGetResponse(url[0]);
- }
- catch (InterruptedException e)
- {
- return new ErrorResponse(e);
- }
- }
- });
-
- //
- seq.addAction(7, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should be called
- calls.add("7");
-
- //
- Set expected = new CollectionBuilder().add("0").add("3").add("4").add("7").toHashSet();
- assertEquals(expected, calls);
-
- // Refresh
- return new EndTestResponse();
- }
- });
+ createCacheMarkup("ExpiringCache", registry, UTP2.RENDER_JOINPOINT, UTP2.ACTION_JOINPOINT, UTP3.RENDER_JOINPOINT, renderParameterConfigurator);
}
- /**
- * Caching happens after a render with the same render parameters for at most 5 seconds
- * Calling render on the portlet with different render parameters invalidates the cache
- */
- public void createNeverExpiringCache(SequenceRegistry registry)
- {
- final Set calls = new HashSet();
- final String[] url = new String[1];
- Sequence seq = new Sequence();
- registry.addSequence("NeverExpiringCache", seq);
-
- //
- seq.addAction(0, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Content is not cached
- calls.add("0");
-
- // Create invalidating action url for later use
- url[0] = response.createActionURL().toString();
-
- // Refresh
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- //
- seq.addAction(1, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should not be called
- calls.add("1");
- return null;
- }
- });
- seq.addAction(1, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Invalidate with action
- return new InvokeGetResponse(url[0]);
- }
- });
-
- //
- seq.addAction(2, UTP9.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
- {
- calls.add("2_action");
- }
- });
- seq.addAction(2, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should be called
- calls.add("2_render");
-
- // Refresh with different render parameters
- PortletURL url = response.createRenderURL();
- url.setParameter("abc", "def");
- return new InvokeGetResponse(url.toString());
- }
- });
-
- //
- seq.addAction(3, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should be called
- calls.add("3");
-
- // Invoke the with same render parameters
- PortletURL url = response.createRenderURL();
- url.setParameter("abc", "def");
- return new InvokeGetResponse(url.toString());
- }
- });
-
- //
- seq.addAction(4, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should not be called
- calls.add("4");
- return null;
- }
- });
- seq.addAction(4, UTP10.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Invalidate with action
- return new InvokeGetResponse(url[0]);
- }
- });
-
- //
- seq.addAction(5, UTP9.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
- {
- calls.add("5_action");
- response.setRenderParameter("abc", "fed");
- }
- });
- seq.addAction(5, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should be called
- calls.add("5_render");
-
- // Refresh with different render parameters
- PortletURL url = response.createRenderURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- //
- seq.addAction(6, UTP9.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- Set expected = new CollectionBuilder().add("0").add("2_action").add("2_render").add("3").add("5_action").add("5_render").toHashSet();
- assertEquals(expected, calls);
-
- // Refresh
- return new EndTestResponse();
- }
- });
- }
-
public void createActionInvalidatesExpiringCache(SequenceRegistry registry)
{
createActionInvalidates("ActionInvalidatesExpiringCache", registry, UTP4.RENDER_JOINPOINT, UTP4.ACTION_JOINPOINT, UTP5.RENDER_JOINPOINT);
}
-
- public void createActionInvalidatesNeverExpiringCache(SequenceRegistry registry)
- {
- createActionInvalidates("ActionInvalidatesNeverExpiringCache", registry, UTP7.RENDER_JOINPOINT, UTP7.ACTION_JOINPOINT, UTP8.RENDER_JOINPOINT);
- }
-
- /**
- * Calling action on the portlet invalidates the cache.
- */
- public void createActionInvalidates(
- String testName,
- SequenceRegistry registry,
- Joinpoint p1renderjp,
- Joinpoint p1actionjp,
- Joinpoint p2renderjp)
- {
- final Set calls = new HashSet();
- final String[] url = new String[1];
- Sequence seq = new Sequence();
- registry.addSequence(testName, seq);
-
- //
- seq.addAction(0, p1renderjp, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Content is not cached
- calls.add("0");
-
- // Refresh
- url[0] = response.createActionURL().toString();
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- //
- seq.addAction(1, p1renderjp, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Should no be called
- calls.add("1");
- return null;
- }
- });
- seq.addAction(1, p2renderjp, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Invalidate
- return new InvokeGetResponse(url[0]);
- }
- });
-
- //
- seq.addAction(2, p1actionjp, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
- {
- //
- calls.add("2_action");
- }
- });
- seq.addAction(2, p1renderjp, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- // Content is not cached
- calls.add("2_render");
-
- //
- Set expected = new CollectionBuilder().add("0").add("2_action").add("2_render").toHashSet();
- assertEquals(expected, calls);
-
- // End test
- return new EndTestResponse();
- }
- });
- }
-
-
}
Added: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheSequenceBuilder.java 2006-12-15 23:25:01 UTC (rev 5878)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/neverexpiringcache/NeverExpiringCacheSequenceBuilder.java 2006-12-16 00:48:38 UTC (rev 5879)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.test.portlet.jsr168.ext.neverexpiringcache;
+
+import org.jboss.portal.test.portlet.jsr168.ext.common.AbstractCacheSequenceBuilder;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.portal.test.portlet.framework.UTP5;
+import org.jboss.portal.test.framework.portlet.SequenceRegistry;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NeverExpiringCacheSequenceBuilder extends AbstractCacheSequenceBuilder
+{
+
+ public void createDisableDuringRenderNeverExpiringCache(SequenceRegistry registry)
+ {
+ createDisableDuringRender("DisableDuringRenderNeverExpiringCache", registry, UTP1.RENDER_JOINPOINT, UTP1.ACTION_JOINPOINT);
+ }
+
+ public void createNeverExpiringCache(SequenceRegistry registry)
+ {
+ createCacheMarkup("NeverExpiringCache", registry, UTP2.RENDER_JOINPOINT, UTP2.ACTION_JOINPOINT, UTP3.RENDER_JOINPOINT, renderParameterConfigurator);
+ }
+
+ public void createActionInvalidatesNeverExpiringCache(SequenceRegistry registry)
+ {
+ createActionInvalidates("ActionInvalidatesNeverExpiringCache", registry, UTP4.RENDER_JOINPOINT, UTP4.ACTION_JOINPOINT, UTP5.RENDER_JOINPOINT);
+ }
+}
Modified: trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml
===================================================================
--- trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml 2006-12-15 23:25:01 UTC (rev 5878)
+++ trunk/portlet/src/resources/test/jsr168/ext/expiringcache-war/WEB-INF/portlet.xml 2006-12-16 00:48:38 UTC (rev 5879)
@@ -85,61 +85,4 @@
</portlet-info>
</portlet>
- <portlet>
- <portlet-name>TestUniversalPortletF</portlet-name>
- <portlet-class>org.jboss.portal.test.portlet.framework.UTP6</portlet-class>
- <expiration-cache>-1</expiration-cache>
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
- <portlet-info>
- <title></title>
- </portlet-info>
- </portlet>
-
- <portlet>
- <portlet-name>TestUniversalPortletG</portlet-name>
- <portlet-class>org.jboss.portal.test.portlet.framework.UTP7</portlet-class>
- <expiration-cache>-1</expiration-cache>
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
- <portlet-info>
- <title></title>
- </portlet-info>
- </portlet>
-
- <portlet>
- <portlet-name>TestUniversalPortletH</portlet-name>
- <portlet-class>org.jboss.portal.test.portlet.framework.UTP8</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
- <portlet-info>
- <title></title>
- </portlet-info>
- </portlet>
-
- <portlet>
- <portlet-name>TestUniversalPortletI</portlet-name>
- <portlet-class>org.jboss.portal.test.portlet.framework.UTP9</portlet-class>
- <expiration-cache>-1</expiration-cache>
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
- <portlet-info>
- <title></title>
- </portlet-info>
- </portlet>
-
- <portlet>
- <portlet-name>TestUniversalPortletJ</portlet-name>
- <portlet-class>org.jboss.portal.test.portlet.framework.UTP10</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
- <portlet-info>
- <title></title>
- </portlet-info>
- </portlet>
</portlet-app>
Added: trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/portlet.xml
===================================================================
--- trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/portlet.xml 2006-12-15 23:25:01 UTC (rev 5878)
+++ trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/portlet.xml 2006-12-16 00:48:38 UTC (rev 5879)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <portlet>
+ <portlet-name>TestUniversalPortletA</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletB</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP2</portlet-class>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletC</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP3</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletD</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP4</portlet-class>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletE</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP5</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
Added: trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/web.xml
===================================================================
--- trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/web.xml 2006-12-15 23:25:01 UTC (rev 5878)
+++ trunk/portlet/src/resources/test/jsr168/ext/neverexpiringcache-war/WEB-INF/web.xml 2006-12-16 00:48:38 UTC (rev 5879)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <listener>
+ <listener-class>org.jboss.portal.test.portlet.jsr168.ext.neverexpiringcache.NeverExpiringCacheSequenceBuilder</listener-class>
+ </listener>
+
+</web-app>
19 years, 4 months
JBoss Portal SVN: r5878 - trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-15 18:25:01 -0500 (Fri, 15 Dec 2006)
New Revision: 5878
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
Log:
JBPortal-1163 : Portlet cache does not take in account window state and modes
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2006-12-15 23:19:29 UTC (rev 5877)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2006-12-15 23:25:01 UTC (rev 5878)
@@ -34,6 +34,8 @@
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
import java.io.Serializable;
@@ -62,6 +64,8 @@
//
StateString navState = renderCtx.getNavigationalState();
+ WindowState windowState = renderCtx.getWindowState();
+ Mode mode = renderCtx.getMode();
//
CacheEntry cachedEntry = (CacheEntry)resolver.getAttribute(scopeKey);
@@ -102,6 +106,12 @@
{
useEntry = navState.equals(entryNavState);
}
+
+ // Then check window state equality
+ useEntry &= windowState.equals(cachedEntry.getWindowState());
+
+ // Then check mode equality
+ useEntry &= mode.equals(cachedEntry.getMode());
}
// Use the entry
@@ -142,7 +152,7 @@
// Cache if we can
if (expirationTimeMillis > 0)
{
- CacheEntry cacheEntry = new CacheEntry(navState, renderResult, expirationTimeMillis);
+ CacheEntry cacheEntry = new CacheEntry(navState, windowState, mode, renderResult, expirationTimeMillis);
resolver.setAttribute(scopeKey, cacheEntry);
}
}
@@ -175,16 +185,24 @@
/** The entry navigational state. */
private final StateString navigationalState;
+ /** . */
+ private WindowState windowState;
+
+ /** . */
+ private Mode mode;
+
/** The timed content. */
private final TimedContent cachedResult;
- public CacheEntry(StateString navigationalState, FragmentResponse result, long expirationTimeMillis)
+ public CacheEntry(StateString navigationalState, WindowState windowState, Mode mode, FragmentResponse result, long expirationTimeMillis)
{
if (expirationTimeMillis <= 0)
{
throw new IllegalArgumentException();
}
this.navigationalState = navigationalState;
+ this.windowState = windowState;
+ this.mode = mode;
this.cachedResult = new StrongTimedContent(result, expirationTimeMillis);
}
@@ -193,6 +211,16 @@
return navigationalState;
}
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
public long getExpirationTimeMillis()
{
return cachedResult.getExpirationTimeMillis();
19 years, 4 months
JBoss Portal SVN: r5877 - in trunk/wsrp/src/main/org/jboss/portal/wsrp: consumer producer
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-12-15 18:19:29 -0500 (Fri, 15 Dec 2006)
New Revision: 5877
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
Log:
- Consumer now try to register if needed before getting the service description instead of waiting for it to fail and then retry. This should improve response time. Code is also cleaner.
- Fixed an NPE in RegistrationHandler.createRegistrationProperties.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2006-12-15 22:41:27 UTC (rev 5876)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2006-12-15 23:19:29 UTC (rev 5877)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.consumer;
import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.InvokerUnavailableException;
import org.jboss.portal.portlet.NoSuchPortletException;
@@ -44,6 +45,7 @@
import org.jboss.portal.wsrp.consumer.portlet.WSRPPortlet;
import org.jboss.portal.wsrp.consumer.portlet.info.WSRPPortletInfo;
import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.LocalizedString;
import org.jboss.portal.wsrp.core.ModelDescription;
import org.jboss.portal.wsrp.core.PortletDescription;
@@ -152,19 +154,13 @@
public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
{
- if (portletContext == null)
- {
- throw new IllegalArgumentException("No null portlet context accepted");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
return getPortlet(portletContext.getId());
}
private Portlet getPortlet(String portletId) throws PortletInvokerException
{
- if (portletId == null)
- {
- throw new IllegalArgumentException("No null portlet id accepted");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletId, "portlet id", "PortletContext");
Map portlets;
try
@@ -514,59 +510,23 @@
{
GetServiceDescription request = getServiceDescriptionRequest();
+ // try initial registration if needed
+ registerIfNeeded();
+ request.setRegistrationContext(registrationContext);
+
final String producerId = getProducerId();
+
+ ServiceDescription serviceDescription;
try
{
- ServiceDescription serviceDescription = getServiceDescriptionService().getServiceDescription(request);
+ serviceDescription = getServiceDescriptionService().getServiceDescription(request);
if (serviceDescription != null)
{
- if (serviceDescription.isRequiresRegistration())
+ boolean shouldRetry = informUserIfMissingRegistrationInfo(serviceDescription, producerId);
+ if (shouldRetry)
{
- // try to register with the registration data provided at deployment time
- if (registrationData != null)
- {
- RegistrationContext registrationContext = getRegistrationService().register(registrationData);
-
- // if we reach this point, registration was successful so remember the returned registration context
- this.registrationContext = registrationContext;
-
- // add it to the request and try to get the service description again!
- request.setRegistrationContext(registrationContext);
- serviceDescription = getServiceDescriptionService().getServiceDescription(request);
- }
- else
- {
- ModelDescription registrationProperties = serviceDescription.getRegistrationPropertyDescription();
- StringBuffer message = new StringBuffer("Producer '").append(producerId)
- .append("' requires registration yet configuration of this producer does not provide any ")
- .append("registration data. Please refer to the documentation on how to configure a remote producer.");
- log.info(message);
-
- if (registrationProperties != null)
- {
- PropertyDescription[] propertyDescriptions = registrationProperties.getPropertyDescriptions();
- if (propertyDescriptions != null)
- {
- message.append("\nAdditionally, the producer required the following registration information: ");
- for (int i = 0; i < propertyDescriptions.length; i++)
- {
- PropertyDescription propertyDescription = propertyDescriptions[i];
- String name = propertyDescription.getName();
- String type = propertyDescription.getType().toString();
- LocalizedString nillableLabel = propertyDescription.getLabel();
- String label = nillableLabel == null ? null : nillableLabel.getValue();
- LocalizedString nillableHint = propertyDescription.getHint();
- String hint = nillableHint == null ? null : nillableHint.getValue();
- message.append("propertyDescription =\n- name:\t").append(name).append("\n- type:\t")
- .append(type).append("\n- label:\t").append(label).append("\n- hint:\t").append(hint)
- .append("\n");
- }
- }
- }
- throw new ServiceDescriptionUnavailableException(message.toString(), null);
- }
-
+ serviceDescription = getServiceDescriptionAndRegisterIfNeeded();
}
// do we need to call initCookie or not?
@@ -582,19 +542,109 @@
throw new NullPointerException("null service description: deal with it!");
}
}
- catch (ServiceDescriptionUnavailableException e)
+ catch (InvalidRegistrationFault e)
{
- throw e;
+ // our registration was not accepted, invalidate our registration data and retrieve registration data from producer
+ registrationContext = null;
+ registrationData = null;
+ request.setRegistrationContext(null);
+
+ // try again
+ serviceDescription = getServiceDescriptionAndRegisterIfNeeded();
}
catch (Exception e)
{
- log.debug(e);
+ log.debug("Caught Exception in getServiceDescriptionAndRegisterIfNeeded:\n", e);
Throwable cause = e.getCause();
throw new ServiceDescriptionUnavailableException("Problem getting service description for producer "
+ producerId, cause == null ? e : cause);
}
+
+ return serviceDescription;
}
+ /**
+ * Extract required registration information from the service description and informs the user if we are not
+ * registered and the Producer requires registration. This can happen if we haven't registered yet or after a retry
+ * if our initial registration information was rejected.
+ *
+ * @param serviceDescription
+ * @param producerId
+ * @return <code>true</code> if we should retry to get the service description, <code>false</code> otherwise
+ * @throws ServiceDescriptionUnavailableException
+ * if we need to inform the user of missing required registration data
+ * @since 2.6
+ */
+ private boolean informUserIfMissingRegistrationInfo(ServiceDescription serviceDescription, String producerId)
+ throws ServiceDescriptionUnavailableException
+ {
+ if (serviceDescription.isRequiresRegistration() && registrationContext == null)
+ {
+ StringBuffer message = new StringBuffer("Producer '").append(producerId)
+ .append("' requires registration. Configuration for this producer might need to be updated to register.");
+ log.info(message);
+
+ ModelDescription registrationProperties = serviceDescription.getRegistrationPropertyDescription();
+ if (registrationProperties != null)
+ {
+ PropertyDescription[] propertyDescriptions = registrationProperties.getPropertyDescriptions();
+ if (propertyDescriptions != null)
+ {
+ message.append("\nThe producer required the following registration information: ");
+ for (int i = 0; i < propertyDescriptions.length; i++)
+ {
+ PropertyDescription propertyDescription = propertyDescriptions[i];
+ String name = propertyDescription.getName();
+ String type = propertyDescription.getType().toString();
+ LocalizedString nillableLabel = propertyDescription.getLabel();
+ String label = nillableLabel == null ? null : nillableLabel.getValue();
+ LocalizedString nillableHint = propertyDescription.getHint();
+ String hint = nillableHint == null ? null : nillableHint.getValue();
+ message.append("propertyDescription =\n- name:\t").append(name).append("\n- type:\t")
+ .append(type).append("\n- label:\t").append(label).append("\n- hint:\t").append(hint)
+ .append("\n");
+ }
+ }
+ throw new ServiceDescriptionUnavailableException(message.toString(), null);
+ }
+ else
+ {
+ log.info("The producer didn't require any specific registration properties. Attempting to register with minimal information.");
+ registrationData = WSRPTypeFactory.createDefaultRegistrationData();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Attempts to register if our producer configuration provides registration data and we don't have a valid
+ * RegistrationContext yet.
+ *
+ * @throws ServiceDescriptionUnavailableException
+ *
+ */
+ private void registerIfNeeded() throws ServiceDescriptionUnavailableException
+ {
+ // producer configuration with registration data + no registrationContext = we need to register!
+ if (registrationData != null && registrationContext == null)
+ {
+ RegistrationContext registrationContext;
+ try
+ {
+ registrationContext = getRegistrationService().register(registrationData);
+ }
+ catch (Exception e)
+ {
+ throw new ServiceDescriptionUnavailableException("Couldn't register with producer '" + getProducerId() + "'", e);
+ }
+
+ // if we reach this point, registration was successful so remember the returned registration context
+ log.info("Successfully registered with handle: '" + registrationContext.getRegistrationHandle() + "'");
+ this.registrationContext = registrationContext;
+ }
+ }
+
private void setServiceDescriptionRequest(GetServiceDescription request)
{
serviceDescriptionRequest = request;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-12-15 22:41:27 UTC (rev 5876)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-12-15 23:19:29 UTC (rev 5877)
@@ -267,14 +267,21 @@
private Map createRegistrationProperties(RegistrationData registrationData)
{
Property[] regProperties = registrationData.getRegistrationProperties();
- Map properties = new HashMap(regProperties.length);
-
- for (int i = 0; i < regProperties.length; i++)
+ Map properties;
+ if (regProperties != null)
{
- Property property = regProperties[i];
- // todo: should be more detailed here... use the language, allow other value types...
- properties.put(new QName(property.getName()), property.getStringValue());
+ properties = new HashMap(regProperties.length);
+ for (int i = 0; i < regProperties.length; i++)
+ {
+ Property property = regProperties[i];
+ // todo: should be more detailed here... use the language, allow other value types...
+ properties.put(new QName(property.getName()), property.getStringValue());
+ }
}
+ else
+ {
+ properties = Collections.EMPTY_MAP;
+ }
return properties;
}
19 years, 4 months
JBoss Portal SVN: r5875 - trunk/core/src/main/org/jboss/portal/core/portlet/dashboard
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-12-15 17:23:38 -0500 (Fri, 15 Dec 2006)
New Revision: 5875
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
Log:
- fix null layout exception in dashboard
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-12-15 18:16:32 UTC (rev 5874)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-12-15 22:23:38 UTC (rev 5875)
@@ -171,6 +171,10 @@
// Get the current layout and theme
String layoutId = page.getDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ if (layoutId == null)
+ {
+ layoutId = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ }
PortalLayout currentLayout = layoutService.getLayout(layoutId, true);
String themeId = page.getProperty(ThemeConstants.PORTAL_PROP_THEME);
19 years, 4 months
JBoss Portal SVN: r5873 - in trunk: core/src/main/org/jboss/portal/core/impl/portlet/state core/src/main/org/jboss/portal/test/core/model/instance core/src/main/org/jboss/portal/test/core/state core/src/resources/portal-core-sar/META-INF core/src/resources/portal-core-sar/conf/hibernate/portlet core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state portlet/src/main/org/jboss/portal/portlet/im
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-15 12:31:20 -0500 (Fri, 15 Dec 2006)
New Revision: 5873
Added:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletState.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStateEntry.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStatePersistenceManager.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStateContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletState.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletStateContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletStatePersistenceManager.java
Removed:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateEntry.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPersistenceManager.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerState.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java
trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/state/RegistrationPersistenceManagerTestCase.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-sar/conf/hibernate/portlet/domain.hbm.xml
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/jboss-beans.xml
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/jboss-beans.xml
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/registration-persistence-manager-beans.xml
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterService.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterV0.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/StateConverter.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/state/StateConverterV0TestCase.java
trunk/portlet/src/resources/tck-sar/META-INF/jboss-service.xml
trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
Log:
Better name for producer state : PortletState
Modified: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -53,9 +53,9 @@
// Context
- private PersistentStateStore context;
+ private PersistentPortletStatePersistenceManager context;
- public PersistentConsumerGroup(PersistentStateStore context, String name)
+ public PersistentConsumerGroup(PersistentPortletStatePersistenceManager context, String name)
{
this.key = null;
this.persistentName = name;
@@ -77,7 +77,7 @@
public void setContext(Object context)
{
- this.context = (PersistentStateStore)context;
+ this.context = (PersistentPortletStatePersistenceManager)context;
}
// Hibernate
Copied: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletState.java (from rev 5872, trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletState.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -0,0 +1,220 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.core.impl.portlet.state;
+
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.state.AbstractPropertyMap;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.producer.PortletStateContext;
+import org.jboss.portal.portlet.state.producer.PortletState;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PersistentPortletState implements PortletStateContext
+{
+
+ /** The primary key. */
+ protected Long key;
+
+ /** The portlet id. */
+ protected String portletId;
+
+ /** The different entries. */
+ protected Map entries;
+
+ /** When the state has been created. */
+ protected Date creationTime;
+
+ /** When the state expires, a null value means there is no expiration date scheduled. */
+ protected Date terminationTime;
+
+ /** For now a registration id, later probably a one to many relationship with a registration entry. */
+ protected Long registrationId;
+
+ /** The clones of this state. */
+ protected Set children;
+
+ /** The state that we cloned from. */
+ protected PersistentPortletState parent;
+
+ /** . */
+ private PortletState ctx;
+
+ public PersistentPortletState()
+ {
+ this.key = null;
+ this.portletId = null;
+ this.entries = null;
+ this.creationTime = null;
+ this.terminationTime = null;
+ this.registrationId = null;
+ this.children = null;
+ this.parent = null;
+ this.ctx = null;
+ }
+
+ public PersistentPortletState(String portletId, PropertyMap propertyMap)
+ {
+ this.key = null;
+ this.portletId = portletId;
+ this.entries = new HashMap();
+ this.creationTime = Calendar.getInstance().getTime();
+ this.terminationTime = null;
+ this.registrationId = null;
+ this.children = new HashSet();
+ this.parent = null;
+ this.ctx = null;
+
+ //
+ for (Iterator i = propertyMap.keySet().iterator(); i.hasNext();)
+ {
+ String key = (String)i.next();
+ Value value = propertyMap.getProperty(key);
+ entries.put(key, new PersistentPortletStateEntry(key, value));
+ }
+ }
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
+ public String getId()
+ {
+ return key.toString();
+ }
+
+ public String getPortletId()
+ {
+ return portletId;
+ }
+
+ public void setPortletId(String portletId)
+ {
+ this.portletId = portletId;
+ }
+
+ public Map getEntries()
+ {
+ return entries;
+ }
+
+ public void setEntries(Map entries)
+ {
+ this.entries = entries;
+ }
+
+ public Date getCreationTime()
+ {
+ return creationTime;
+ }
+
+ public void setCreationTime(Date creationTime)
+ {
+ this.creationTime = creationTime;
+ }
+
+ public Date getTerminationTime()
+ {
+ return terminationTime;
+ }
+
+ public void setTerminationTime(Date terminationTime)
+ {
+ this.terminationTime = terminationTime;
+ }
+
+ public Long getRegistrationId()
+ {
+ return registrationId;
+ }
+
+ public void setRegistrationId(Long registrationId)
+ {
+ this.registrationId = registrationId;
+ }
+
+ public Set getChildren()
+ {
+ return children;
+ }
+
+ public void setChildren(Set children)
+ {
+ this.children = children;
+ }
+
+ public PersistentPortletState getParent()
+ {
+ return parent;
+ }
+
+ public void setParent(PersistentPortletState parent)
+ {
+ this.parent = parent;
+ }
+
+ //
+
+ public PortletState getState()
+ {
+ if (ctx == null)
+ {
+ PropertyMap props = new AbstractPropertyMap()
+ {
+ protected Map getDelegate()
+ {
+ return entries;
+ }
+
+ protected Object getInternalValue(Object value)
+ {
+ throw new IllegalArgumentException("Immutable");
+ }
+
+ protected Object getExternalValue(Object value)
+ {
+ PersistentPortletStateEntry entry = (PersistentPortletStateEntry)value;
+ return entry.getValue();
+ }
+ };
+ ctx = new PortletState(portletId, props);
+ }
+ return ctx;
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletState.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStateEntry.java (from rev 5872, trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateEntry.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateEntry.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStateEntry.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -0,0 +1,190 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.core.impl.portlet.state;
+
+import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.value.Value;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PersistentPortletStateEntry implements Serializable
+{
+
+ /** The primary key. */
+ private Long key;
+
+ /** The name. */
+ private String name;
+
+ /** The access mode. */
+ private boolean readOnly;
+
+ /** The preference type. */
+ private int type;
+
+ /** The preference values. */
+ private String[] strings;
+
+ /** The value implementation. */
+ private Value value;
+
+ // This flag is used because the value is made up of strings and type
+ // and it is not possible to update the value when strings or type
+ // is updated, so when strings of type is modified with set dirty
+ private boolean dirty;
+
+ public PersistentPortletStateEntry()
+ {
+ this.key = null;
+ this.name = null;
+ this.readOnly = false;
+ this.type = 0;
+ this.strings = null;
+ this.value = null;
+ this.dirty = false;
+ }
+
+ public PersistentPortletStateEntry(String name, Value value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.key = null;
+ this.name = name;
+ this.readOnly = false;
+ this.type = 1;
+ this.strings = value.asStringArray();
+ this.value = value;
+ this.dirty = false;
+ }
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
+ /**
+ *
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /** Called by hibernate. */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ *
+ */
+ public int getType()
+ {
+ return type;
+ }
+
+ /** Called by hibernate. */
+ public void setType(int type)
+ {
+ this.type = type;
+ this.dirty = true;
+ }
+
+ public boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ /**
+ *
+ */
+ public String[] getStrings()
+ {
+ return strings;
+ }
+
+ /** Called by hibernate. */
+ public void setStrings(String[] strings)
+ {
+ this.strings = strings;
+ this.dirty = true;
+ }
+
+ public Value getValue()
+ {
+ if (dirty)
+ {
+ value = new StringValue(strings);
+ dirty = false;
+ }
+ return value;
+ }
+
+ /**
+ *
+ */
+ public void setValue(Value value)
+ {
+ this.value = value;
+ this.strings = value.asStringArray();
+ }
+
+ /** Provide a default impl. */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer("[").append(name).append(",");
+ if (strings == null)
+ {
+ buffer.append("null,");
+ }
+ else
+ {
+ buffer.append("(");
+ for (int i = 0; i < strings.length; i++)
+ {
+ String s = strings[i];
+ buffer.append(i > 0 ? "," : "").append(s);
+ }
+ buffer.append("),");
+ }
+ buffer.append(value).append("]");
+ return buffer.toString();
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStateEntry.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStatePersistenceManager.java (from rev 5872, trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStatePersistenceManager.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -0,0 +1,513 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.core.impl.portlet.state;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.jems.hibernate.ObjectContextualizer;
+import org.jboss.portal.portlet.state.InvalidStateIdException;
+import org.jboss.portal.portlet.state.NoSuchStateException;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
+import org.jboss.portal.portlet.state.producer.PortletStatePersistenceManager;
+import org.jboss.portal.portlet.state.producer.PortletStateContext;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.DuplicateRegistrationException;
+import org.jboss.portal.registration.NoSuchRegistrationException;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationPersistenceManager;
+import org.jboss.portal.registration.RegistrationStatus;
+
+import javax.naming.InitialContext;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PersistentPortletStatePersistenceManager extends AbstractJBossService implements PortletStatePersistenceManager, RegistrationPersistenceManager
+{
+
+ /** . */
+ protected SessionFactory sessionFactory;
+
+ /** . */
+ protected String sessionFactoryJNDIName;
+
+ /** . */
+ protected ObjectContextualizer contextualizer;
+
+ public String getSessionFactoryJNDIName()
+ {
+ return sessionFactoryJNDIName;
+ }
+
+ public void setSessionFactoryJNDIName(String sessionFactoryJNDIName)
+ {
+ this.sessionFactoryJNDIName = sessionFactoryJNDIName;
+ }
+
+ public PortletStateContext loadState(String id) throws InvalidStateIdException, NoSuchStateException
+ {
+ Session session = getCurrentSession();
+ return loadState(session, id);
+ }
+
+ public String createState(String portletId, PropertyMap propertyMap)
+ {
+ if (portletId == null)
+ {
+ throw new IllegalArgumentException("id cannot be null");
+ }
+ if (propertyMap == null)
+ {
+ throw new IllegalArgumentException("No null value map accepted");
+ }
+
+ //
+ Session session = getCurrentSession();
+
+ // Create the persistent state
+ PersistentPortletState context = new PersistentPortletState(portletId, propertyMap);
+ session.save(context);
+ session.flush();
+
+ //
+ return context.getId();
+ }
+
+ public String cloneState(String stateId, PropertyMap propertyMap) throws InvalidStateIdException, NoSuchStateException
+ {
+ if (stateId == null)
+ {
+ throw new IllegalArgumentException("id cannot be null");
+ }
+ if (propertyMap == null)
+ {
+ throw new IllegalArgumentException("value map cannot be null");
+ }
+
+ //
+ Session session = getCurrentSession();
+ PersistentPortletState parentContext = loadState(session, stateId);
+
+ // Create the persistent state
+ PersistentPortletState context = new PersistentPortletState(parentContext.getPortletId(), propertyMap);
+ session.persist(context);
+
+ // Make the association
+ context.setParent(parentContext);
+ parentContext.getChildren().add(context);
+ session.update(parentContext);
+
+ //
+ session.flush();
+
+ //
+ return context.getId();
+ }
+
+ public String cloneState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
+ {
+ if (stateId == null)
+ {
+ throw new IllegalArgumentException("id cannot be null");
+ }
+
+ //
+ Session session = getCurrentSession();
+ PersistentPortletState parentContext = loadState(session, stateId);
+
+ // Create the persistent state
+ PersistentPortletState context = new PersistentPortletState(parentContext.getPortletId(), new SimplePropertyMap(parentContext.getState().getProperties()));
+ session.persist(context);
+
+ // Make the association
+ context.setParent(parentContext);
+ parentContext.getChildren().add(context);
+ session.update(parentContext);
+
+ //
+ session.flush();
+
+ //
+ return context.getId();
+ }
+
+ public void updateState(String stateId, PropertyMap propertyMap) throws InvalidStateIdException, NoSuchStateException
+ {
+ Session session = getCurrentSession();
+ PersistentPortletState context = loadState(session, stateId);
+
+ //
+ context.entries.clear();
+ for (Iterator i = propertyMap.keySet().iterator(); i.hasNext();)
+ {
+ String key = (String)i.next();
+ Value value = propertyMap.getProperty(key);
+ PersistentPortletStateEntry entry = new PersistentPortletStateEntry(key, value);
+ context.entries.put(key, entry);
+ }
+
+ //
+ session.update(context);
+ }
+
+ public void destroyState(String stateId) throws InvalidStateIdException, NoSuchStateException
+ {
+ if (stateId == null)
+ {
+ throw new IllegalArgumentException("No null state id accepted");
+ }
+
+ //
+ Session session = getCurrentSession();
+ PersistentPortletState context = loadState(session, stateId);
+
+ // Efficiently set the children parent to null
+ String update = "update PersistentPortletState p set p.parent=NULL where p.parent=:parent";
+ Query query = session.createQuery(update).setLong("parent", context.getKey().longValue());
+ query.executeUpdate();
+
+ // Delete the state
+ session.delete(context);
+ session.flush();
+ }
+
+ protected void startService() throws Exception
+ {
+ sessionFactory = (SessionFactory)new InitialContext().lookup(sessionFactoryJNDIName);
+ contextualizer = new ObjectContextualizer(this);
+ contextualizer.attach(sessionFactory);
+ }
+
+ protected void stopService() throws Exception
+ {
+ contextualizer = null;
+ sessionFactory = null;
+ }
+
+ protected Session getCurrentSession()
+ {
+ return sessionFactory.getCurrentSession();
+ }
+
+ private PersistentPortletState loadState(Session session, String stateId) throws NoSuchStateException, InvalidStateIdException
+ {
+ if (stateId == null)
+ {
+ throw new IllegalArgumentException("id cannot be null");
+ }
+
+ try
+ {
+ Long key = new Long(stateId);
+ PersistentPortletState context = (PersistentPortletState)session.get(PersistentPortletState.class, key);
+
+ //
+ if (context == null)
+ {
+ throw new NoSuchStateException(stateId);
+ }
+
+ //
+ return context;
+ }
+ catch (NumberFormatException e)
+ {
+ throw new InvalidStateIdException(e, stateId);
+ }
+ }
+
+ // RegistrationPersistenceManager ***********************************************************************************
+
+
+ public Consumer createConsumer(String consumerId, String consumerName) throws RegistrationException
+ {
+ if (consumerId == null)
+ {
+ throw new IllegalArgumentException("No null consumer id accepted");
+ }
+ if (consumerName == null)
+ {
+ throw new IllegalArgumentException("No null consumer name accepted");
+ }
+
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ PersistentConsumer consumer = new PersistentConsumer(consumerId, consumerName);
+ session.persist(consumer);
+
+ //
+ return consumer;
+ }
+
+ public ConsumerGroup getConsumerGroup(String name) throws RegistrationException
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ return findGroupByName(session, name);
+ }
+
+ public ConsumerGroup createConsumerGroup(String name) throws RegistrationException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name accepted");
+ }
+
+ // Get hibernate session
+ Session session = getCurrentSession();
+ PersistentConsumerGroup group = null;
+
+ // Detect duplicate
+ if (findGroupByName(session, name) != null)
+ {
+ throw new DuplicateRegistrationException("Group " + name + " already exists");
+ }
+
+ // Create and persist
+ group = new PersistentConsumerGroup(this, name);
+ session.persist(group);
+
+ //
+ return group;
+ }
+
+ public void removeConsumerGroup(String name) throws RegistrationException
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ PersistentConsumerGroup group = getGroupByName(session, name);
+
+ //
+ session.delete(group);
+ }
+
+ public void removeConsumer(String consumerId) throws RegistrationException
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ PersistentConsumer consumer = getConsumerById(session, consumerId);
+
+ //
+ session.delete(consumer);
+ }
+
+ public void removeRegistration(String registrationId) throws RegistrationException
+ {
+ if (registrationId == null)
+ {
+ throw new IllegalArgumentException("No null registration id accepted");
+ }
+
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ PersistentRegistration registration = getRegistrationById(session, registrationId);
+
+ // Get related consumer
+ PersistentConsumer consumer = registration.getRelatedConsumer();
+
+ // Destroy relationship
+ consumer.getRelatedRegistrations().remove(registration);
+ registration.setRelatedConsumer(null);
+
+ // Delete the registration
+ session.delete(registration);
+ session.flush();
+ }
+
+ public Consumer getConsumerById(String consumerId) throws RegistrationException
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ return findConsumerById(session, consumerId);
+ }
+
+ public Registration addRegistrationFor(String consumerId, Map registrationProperties) throws RegistrationException
+ {
+ if (registrationProperties == null)
+ {
+ throw new IllegalArgumentException("No null registration properties accepted");
+ }
+
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ // Perform lookup
+ PersistentConsumer consumer = getConsumerById(session, consumerId);
+
+ // Create and persist registration and build relationship
+ PersistentRegistration registration = new PersistentRegistration(registrationProperties, RegistrationStatus.PENDING);
+ registration.setRelatedConsumer(consumer);
+ consumer.getRelatedRegistrations().add(registration);
+ session.persist(registration);
+ session.saveOrUpdate(consumer);
+
+ //
+ return registration;
+ }
+
+ public Registration getRegistration(String registrationId)
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ return findRegistrationById(session, registrationId);
+ }
+
+ public Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws RegistrationException
+ {
+ Consumer consumer = getConsumerById(consumerId);
+
+ // Build relationship
+ ConsumerGroup group = getConsumerGroup(groupName);
+ consumer.setGroup(group);
+
+ //
+ return consumer;
+ }
+
+ public Collection getConsumerGroups()
+ {
+ Session session = getCurrentSession();
+ Query query = session.createQuery("from PersistentConsumerGroup");
+ return query.list();
+ }
+
+ public Collection getConsumers()
+ {
+ Session session = getCurrentSession();
+ Query query = session.createQuery("from PersistentConsumer");
+ return query.list();
+ }
+
+ private PersistentRegistration getRegistrationById(Session session, String registrationId) throws IllegalArgumentException, NoSuchRegistrationException
+ {
+ PersistentRegistration registration = findRegistrationById(session, registrationId);
+
+ //
+ if (registration == null)
+ {
+ throw new NoSuchRegistrationException("Cant find a consumer with the id " + registrationId);
+ }
+
+ //
+ return registration;
+ }
+
+ private PersistentRegistration findRegistrationById(Session session, String registrationId) throws IllegalArgumentException
+ {
+ if (registrationId == null)
+ {
+ throw new IllegalArgumentException("No null consumer id accepted");
+ }
+
+ try
+ {
+ // Parse the key
+ Long key = new Long(registrationId);
+
+ // Perform lookup
+ return (PersistentRegistration)session.get(PersistentRegistration.class, key);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Bad registration id format " + registrationId);
+ }
+ }
+
+ private PersistentConsumer getConsumerById(Session session, String consumerId) throws IllegalArgumentException, NoSuchRegistrationException
+ {
+ PersistentConsumer consumer = findConsumerById(session, consumerId);
+
+ //
+ if (consumer == null)
+ {
+ throw new NoSuchRegistrationException("Cant find a consumer with the id " + consumerId);
+ }
+
+ //
+ return consumer;
+ }
+
+ private PersistentConsumer findConsumerById(Session session, String consumerId) throws IllegalArgumentException
+ {
+ if (consumerId == null)
+ {
+ throw new IllegalArgumentException("No null consumer id accepted");
+ }
+
+ //
+ Query query = session.createQuery("from PersistentConsumer where persistentId=:consumerId");
+ query.setString("consumerId", consumerId);
+ return (PersistentConsumer)query.uniqueResult();
+ }
+
+ private PersistentConsumerGroup getGroupByName(Session session, String groupName) throws IllegalArgumentException, NoSuchRegistrationException
+ {
+ PersistentConsumerGroup group = findGroupByName(session, groupName);
+
+ //
+ if (group == null)
+ {
+ throw new NoSuchRegistrationException("Cant find a group with the name " + groupName);
+ }
+
+ //
+ return group;
+ }
+
+ private PersistentConsumerGroup findGroupByName(Session session, String groupName) throws IllegalArgumentException
+ {
+ if (groupName == null)
+ {
+ throw new IllegalArgumentException("No null group name accepted");
+ }
+
+ //
+ Query query = session.createQuery("from PersistentConsumerGroup where persistentName=:groupName");
+ query.setString("groupName", groupName);
+ return (PersistentConsumerGroup)query.uniqueResult();
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStatePersistenceManager.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -1,220 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.core.impl.portlet.state;
-
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.portlet.state.AbstractPropertyMap;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.producer.ProducerStateContext;
-import org.jboss.portal.portlet.state.producer.ProducerState;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PersistentState implements ProducerStateContext
-{
-
- /** The primary key. */
- protected Long key;
-
- /** The portlet id. */
- protected String portletId;
-
- /** The different entries. */
- protected Map entries;
-
- /** When the state has been created. */
- protected Date creationTime;
-
- /** When the state expires, a null value means there is no expiration date scheduled. */
- protected Date terminationTime;
-
- /** For now a registration id, later probably a one to many relationship with a registration entry. */
- protected Long registrationId;
-
- /** The clones of this state. */
- protected Set children;
-
- /** The state that we cloned from. */
- protected PersistentState parent;
-
- /** . */
- private ProducerState ctx;
-
- public PersistentState()
- {
- this.key = null;
- this.portletId = null;
- this.entries = null;
- this.creationTime = null;
- this.terminationTime = null;
- this.registrationId = null;
- this.children = null;
- this.parent = null;
- this.ctx = null;
- }
-
- public PersistentState(String portletId, PropertyMap propertyMap)
- {
- this.key = null;
- this.portletId = portletId;
- this.entries = new HashMap();
- this.creationTime = Calendar.getInstance().getTime();
- this.terminationTime = null;
- this.registrationId = null;
- this.children = new HashSet();
- this.parent = null;
- this.ctx = null;
-
- //
- for (Iterator i = propertyMap.keySet().iterator(); i.hasNext();)
- {
- String key = (String)i.next();
- Value value = propertyMap.getProperty(key);
- entries.put(key, new PersistentStateEntry(key, value));
- }
- }
-
- public Long getKey()
- {
- return key;
- }
-
- public void setKey(Long key)
- {
- this.key = key;
- }
-
- public String getId()
- {
- return key.toString();
- }
-
- public String getPortletId()
- {
- return portletId;
- }
-
- public void setPortletId(String portletId)
- {
- this.portletId = portletId;
- }
-
- public Map getEntries()
- {
- return entries;
- }
-
- public void setEntries(Map entries)
- {
- this.entries = entries;
- }
-
- public Date getCreationTime()
- {
- return creationTime;
- }
-
- public void setCreationTime(Date creationTime)
- {
- this.creationTime = creationTime;
- }
-
- public Date getTerminationTime()
- {
- return terminationTime;
- }
-
- public void setTerminationTime(Date terminationTime)
- {
- this.terminationTime = terminationTime;
- }
-
- public Long getRegistrationId()
- {
- return registrationId;
- }
-
- public void setRegistrationId(Long registrationId)
- {
- this.registrationId = registrationId;
- }
-
- public Set getChildren()
- {
- return children;
- }
-
- public void setChildren(Set children)
- {
- this.children = children;
- }
-
- public PersistentState getParent()
- {
- return parent;
- }
-
- public void setParent(PersistentState parent)
- {
- this.parent = parent;
- }
-
- //
-
- public ProducerState getState()
- {
- if (ctx == null)
- {
- PropertyMap props = new AbstractPropertyMap()
- {
- protected Map getDelegate()
- {
- return entries;
- }
-
- protected Object getInternalValue(Object value)
- {
- throw new IllegalArgumentException("Immutable");
- }
-
- protected Object getExternalValue(Object value)
- {
- PersistentStateEntry entry = (PersistentStateEntry)value;
- return entry.getValue();
- }
- };
- ctx = new ProducerState(portletId, props);
- }
- return ctx;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateEntry.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateEntry.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateEntry.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -1,190 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.core.impl.portlet.state;
-
-import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.common.value.Value;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PersistentStateEntry implements Serializable
-{
-
- /** The primary key. */
- private Long key;
-
- /** The name. */
- private String name;
-
- /** The access mode. */
- private boolean readOnly;
-
- /** The preference type. */
- private int type;
-
- /** The preference values. */
- private String[] strings;
-
- /** The value implementation. */
- private Value value;
-
- // This flag is used because the value is made up of strings and type
- // and it is not possible to update the value when strings or type
- // is updated, so when strings of type is modified with set dirty
- private boolean dirty;
-
- public PersistentStateEntry()
- {
- this.key = null;
- this.name = null;
- this.readOnly = false;
- this.type = 0;
- this.strings = null;
- this.value = null;
- this.dirty = false;
- }
-
- public PersistentStateEntry(String name, Value value)
- {
- if (value == null)
- {
- throw new IllegalArgumentException();
- }
- this.key = null;
- this.name = name;
- this.readOnly = false;
- this.type = 1;
- this.strings = value.asStringArray();
- this.value = value;
- this.dirty = false;
- }
-
- public Long getKey()
- {
- return key;
- }
-
- public void setKey(Long key)
- {
- this.key = key;
- }
-
- /**
- *
- */
- public String getName()
- {
- return name;
- }
-
- /** Called by hibernate. */
- public void setName(String name)
- {
- this.name = name;
- }
-
- /**
- *
- */
- public int getType()
- {
- return type;
- }
-
- /** Called by hibernate. */
- public void setType(int type)
- {
- this.type = type;
- this.dirty = true;
- }
-
- public boolean isReadOnly()
- {
- return readOnly;
- }
-
- public void setReadOnly(boolean readOnly)
- {
- this.readOnly = readOnly;
- }
-
- /**
- *
- */
- public String[] getStrings()
- {
- return strings;
- }
-
- /** Called by hibernate. */
- public void setStrings(String[] strings)
- {
- this.strings = strings;
- this.dirty = true;
- }
-
- public Value getValue()
- {
- if (dirty)
- {
- value = new StringValue(strings);
- dirty = false;
- }
- return value;
- }
-
- /**
- *
- */
- public void setValue(Value value)
- {
- this.value = value;
- this.strings = value.asStringArray();
- }
-
- /** Provide a default impl. */
- public String toString()
- {
- StringBuffer buffer = new StringBuffer("[").append(name).append(",");
- if (strings == null)
- {
- buffer.append("null,");
- }
- else
- {
- buffer.append("(");
- for (int i = 0; i < strings.length; i++)
- {
- String s = strings[i];
- buffer.append(i > 0 ? "," : "").append(s);
- }
- buffer.append("),");
- }
- buffer.append(value).append("]");
- return buffer.toString();
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -1,513 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.core.impl.portlet.state;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.jems.hibernate.ObjectContextualizer;
-import org.jboss.portal.portlet.state.InvalidStateIdException;
-import org.jboss.portal.portlet.state.NoSuchStateException;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.SimplePropertyMap;
-import org.jboss.portal.portlet.state.producer.ProducerPersistenceManager;
-import org.jboss.portal.portlet.state.producer.ProducerStateContext;
-import org.jboss.portal.registration.Consumer;
-import org.jboss.portal.registration.ConsumerGroup;
-import org.jboss.portal.registration.DuplicateRegistrationException;
-import org.jboss.portal.registration.NoSuchRegistrationException;
-import org.jboss.portal.registration.Registration;
-import org.jboss.portal.registration.RegistrationException;
-import org.jboss.portal.registration.RegistrationPersistenceManager;
-import org.jboss.portal.registration.RegistrationStatus;
-
-import javax.naming.InitialContext;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PersistentStateStore extends AbstractJBossService implements ProducerPersistenceManager, RegistrationPersistenceManager
-{
-
- /** . */
- protected SessionFactory sessionFactory;
-
- /** . */
- protected String sessionFactoryJNDIName;
-
- /** . */
- protected ObjectContextualizer contextualizer;
-
- public String getSessionFactoryJNDIName()
- {
- return sessionFactoryJNDIName;
- }
-
- public void setSessionFactoryJNDIName(String sessionFactoryJNDIName)
- {
- this.sessionFactoryJNDIName = sessionFactoryJNDIName;
- }
-
- public ProducerStateContext loadState(String id) throws InvalidStateIdException, NoSuchStateException
- {
- Session session = getCurrentSession();
- return loadState(session, id);
- }
-
- public String createState(String portletId, PropertyMap propertyMap)
- {
- if (portletId == null)
- {
- throw new IllegalArgumentException("id cannot be null");
- }
- if (propertyMap == null)
- {
- throw new IllegalArgumentException("No null value map accepted");
- }
-
- //
- Session session = getCurrentSession();
-
- // Create the persistent state
- PersistentState context = new PersistentState(portletId, propertyMap);
- session.save(context);
- session.flush();
-
- //
- return context.getId();
- }
-
- public String cloneState(String stateId, PropertyMap propertyMap) throws InvalidStateIdException, NoSuchStateException
- {
- if (stateId == null)
- {
- throw new IllegalArgumentException("id cannot be null");
- }
- if (propertyMap == null)
- {
- throw new IllegalArgumentException("value map cannot be null");
- }
-
- //
- Session session = getCurrentSession();
- PersistentState parentContext = loadState(session, stateId);
-
- // Create the persistent state
- PersistentState context = new PersistentState(parentContext.getPortletId(), propertyMap);
- session.persist(context);
-
- // Make the association
- context.setParent(parentContext);
- parentContext.getChildren().add(context);
- session.update(parentContext);
-
- //
- session.flush();
-
- //
- return context.getId();
- }
-
- public String cloneState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
- {
- if (stateId == null)
- {
- throw new IllegalArgumentException("id cannot be null");
- }
-
- //
- Session session = getCurrentSession();
- PersistentState parentContext = loadState(session, stateId);
-
- // Create the persistent state
- PersistentState context = new PersistentState(parentContext.getPortletId(), new SimplePropertyMap(parentContext.getState().getProperties()));
- session.persist(context);
-
- // Make the association
- context.setParent(parentContext);
- parentContext.getChildren().add(context);
- session.update(parentContext);
-
- //
- session.flush();
-
- //
- return context.getId();
- }
-
- public void updateState(String stateId, PropertyMap propertyMap) throws InvalidStateIdException, NoSuchStateException
- {
- Session session = getCurrentSession();
- PersistentState context = loadState(session, stateId);
-
- //
- context.entries.clear();
- for (Iterator i = propertyMap.keySet().iterator(); i.hasNext();)
- {
- String key = (String)i.next();
- Value value = propertyMap.getProperty(key);
- PersistentStateEntry entry = new PersistentStateEntry(key, value);
- context.entries.put(key, entry);
- }
-
- //
- session.update(context);
- }
-
- public void destroyState(String stateId) throws InvalidStateIdException, NoSuchStateException
- {
- if (stateId == null)
- {
- throw new IllegalArgumentException("No null state id accepted");
- }
-
- //
- Session session = getCurrentSession();
- PersistentState context = loadState(session, stateId);
-
- // Efficiently set the children parent to null
- String update = "update PersistentState p set p.parent=NULL where p.parent=:parent";
- Query query = session.createQuery(update).setLong("parent", context.getKey().longValue());
- query.executeUpdate();
-
- // Delete the state
- session.delete(context);
- session.flush();
- }
-
- protected void startService() throws Exception
- {
- sessionFactory = (SessionFactory)new InitialContext().lookup(sessionFactoryJNDIName);
- contextualizer = new ObjectContextualizer(this);
- contextualizer.attach(sessionFactory);
- }
-
- protected void stopService() throws Exception
- {
- contextualizer = null;
- sessionFactory = null;
- }
-
- protected Session getCurrentSession()
- {
- return sessionFactory.getCurrentSession();
- }
-
- private PersistentState loadState(Session session, String stateId) throws NoSuchStateException, InvalidStateIdException
- {
- if (stateId == null)
- {
- throw new IllegalArgumentException("id cannot be null");
- }
-
- try
- {
- Long key = new Long(stateId);
- PersistentState context = (PersistentState)session.get(PersistentState.class, key);
-
- //
- if (context == null)
- {
- throw new NoSuchStateException(stateId);
- }
-
- //
- return context;
- }
- catch (NumberFormatException e)
- {
- throw new InvalidStateIdException(e, stateId);
- }
- }
-
- // RegistrationPersistenceManager ***********************************************************************************
-
-
- public Consumer createConsumer(String consumerId, String consumerName) throws RegistrationException
- {
- if (consumerId == null)
- {
- throw new IllegalArgumentException("No null consumer id accepted");
- }
- if (consumerName == null)
- {
- throw new IllegalArgumentException("No null consumer name accepted");
- }
-
- // Get hibernate session
- Session session = getCurrentSession();
-
- //
- PersistentConsumer consumer = new PersistentConsumer(consumerId, consumerName);
- session.persist(consumer);
-
- //
- return consumer;
- }
-
- public ConsumerGroup getConsumerGroup(String name) throws RegistrationException
- {
- // Get hibernate session
- Session session = getCurrentSession();
-
- //
- return findGroupByName(session, name);
- }
-
- public ConsumerGroup createConsumerGroup(String name) throws RegistrationException
- {
- if (name == null)
- {
- throw new IllegalArgumentException("No null name accepted");
- }
-
- // Get hibernate session
- Session session = getCurrentSession();
- PersistentConsumerGroup group = null;
-
- // Detect duplicate
- if (findGroupByName(session, name) != null)
- {
- throw new DuplicateRegistrationException("Group " + name + " already exists");
- }
-
- // Create and persist
- group = new PersistentConsumerGroup(this, name);
- session.persist(group);
-
- //
- return group;
- }
-
- public void removeConsumerGroup(String name) throws RegistrationException
- {
- // Get hibernate session
- Session session = getCurrentSession();
-
- //
- PersistentConsumerGroup group = getGroupByName(session, name);
-
- //
- session.delete(group);
- }
-
- public void removeConsumer(String consumerId) throws RegistrationException
- {
- // Get hibernate session
- Session session = getCurrentSession();
-
- //
- PersistentConsumer consumer = getConsumerById(session, consumerId);
-
- //
- session.delete(consumer);
- }
-
- public void removeRegistration(String registrationId) throws RegistrationException
- {
- if (registrationId == null)
- {
- throw new IllegalArgumentException("No null registration id accepted");
- }
-
- // Get hibernate session
- Session session = getCurrentSession();
-
- //
- PersistentRegistration registration = getRegistrationById(session, registrationId);
-
- // Get related consumer
- PersistentConsumer consumer = registration.getRelatedConsumer();
-
- // Destroy relationship
- consumer.getRelatedRegistrations().remove(registration);
- registration.setRelatedConsumer(null);
-
- // Delete the registration
- session.delete(registration);
- session.flush();
- }
-
- public Consumer getConsumerById(String consumerId) throws RegistrationException
- {
- // Get hibernate session
- Session session = getCurrentSession();
-
- //
- return findConsumerById(session, consumerId);
- }
-
- public Registration addRegistrationFor(String consumerId, Map registrationProperties) throws RegistrationException
- {
- if (registrationProperties == null)
- {
- throw new IllegalArgumentException("No null registration properties accepted");
- }
-
- // Get hibernate session
- Session session = getCurrentSession();
-
- // Perform lookup
- PersistentConsumer consumer = getConsumerById(session, consumerId);
-
- // Create and persist registration and build relationship
- PersistentRegistration registration = new PersistentRegistration(registrationProperties, RegistrationStatus.PENDING);
- registration.setRelatedConsumer(consumer);
- consumer.getRelatedRegistrations().add(registration);
- session.persist(registration);
- session.saveOrUpdate(consumer);
-
- //
- return registration;
- }
-
- public Registration getRegistration(String registrationId)
- {
- // Get hibernate session
- Session session = getCurrentSession();
-
- //
- return findRegistrationById(session, registrationId);
- }
-
- public Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws RegistrationException
- {
- Consumer consumer = getConsumerById(consumerId);
-
- // Build relationship
- ConsumerGroup group = getConsumerGroup(groupName);
- consumer.setGroup(group);
-
- //
- return consumer;
- }
-
- public Collection getConsumerGroups()
- {
- Session session = getCurrentSession();
- Query query = session.createQuery("from PersistentConsumerGroup");
- return query.list();
- }
-
- public Collection getConsumers()
- {
- Session session = getCurrentSession();
- Query query = session.createQuery("from PersistentConsumer");
- return query.list();
- }
-
- private PersistentRegistration getRegistrationById(Session session, String registrationId) throws IllegalArgumentException, NoSuchRegistrationException
- {
- PersistentRegistration registration = findRegistrationById(session, registrationId);
-
- //
- if (registration == null)
- {
- throw new NoSuchRegistrationException("Cant find a consumer with the id " + registrationId);
- }
-
- //
- return registration;
- }
-
- private PersistentRegistration findRegistrationById(Session session, String registrationId) throws IllegalArgumentException
- {
- if (registrationId == null)
- {
- throw new IllegalArgumentException("No null consumer id accepted");
- }
-
- try
- {
- // Parse the key
- Long key = new Long(registrationId);
-
- // Perform lookup
- return (PersistentRegistration)session.get(PersistentRegistration.class, key);
- }
- catch (NumberFormatException e)
- {
- throw new IllegalArgumentException("Bad registration id format " + registrationId);
- }
- }
-
- private PersistentConsumer getConsumerById(Session session, String consumerId) throws IllegalArgumentException, NoSuchRegistrationException
- {
- PersistentConsumer consumer = findConsumerById(session, consumerId);
-
- //
- if (consumer == null)
- {
- throw new NoSuchRegistrationException("Cant find a consumer with the id " + consumerId);
- }
-
- //
- return consumer;
- }
-
- private PersistentConsumer findConsumerById(Session session, String consumerId) throws IllegalArgumentException
- {
- if (consumerId == null)
- {
- throw new IllegalArgumentException("No null consumer id accepted");
- }
-
- //
- Query query = session.createQuery("from PersistentConsumer where persistentId=:consumerId");
- query.setString("consumerId", consumerId);
- return (PersistentConsumer)query.uniqueResult();
- }
-
- private PersistentConsumerGroup getGroupByName(Session session, String groupName) throws IllegalArgumentException, NoSuchRegistrationException
- {
- PersistentConsumerGroup group = findGroupByName(session, groupName);
-
- //
- if (group == null)
- {
- throw new NoSuchRegistrationException("Cant find a group with the name " + groupName);
- }
-
- //
- return group;
- }
-
- private PersistentConsumerGroup findGroupByName(Session session, String groupName) throws IllegalArgumentException
- {
- if (groupName == null)
- {
- throw new IllegalArgumentException("No null group name accepted");
- }
-
- //
- Query query = session.createQuery("from PersistentConsumerGroup where persistentName=:groupName");
- query.setString("groupName", groupName);
- return (PersistentConsumerGroup)query.uniqueResult();
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -47,7 +47,7 @@
import org.jboss.portal.core.impl.model.instance.InstanceCustomizationImpl;
import org.jboss.portal.core.impl.model.instance.InstanceDefinitionImpl;
import org.jboss.portal.core.impl.model.instance.PersistentInstanceContainer;
-import org.jboss.portal.core.impl.portlet.state.PersistentStateStore;
+import org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceDefinition;
import org.jboss.portal.portlet.NoSuchPortletException;
@@ -171,7 +171,7 @@
private PersistentInstanceContainer instanceContainer;
/** . */
- private PersistentStateStore persistenceManager;
+ private PersistentPortletStatePersistenceManager persistenceManager;
/** . */
private ProducerPortletInvoker producer;
@@ -264,12 +264,12 @@
this.instanceContainer = instanceContainer;
}
- public PersistentStateStore getPersistenceManager()
+ public PersistentPortletStatePersistenceManager getPersistenceManager()
{
return persistenceManager;
}
- public void setPersistenceManager(PersistentStateStore persistenceManager)
+ public void setPersistenceManager(PersistentPortletStatePersistenceManager persistenceManager)
{
this.persistenceManager = persistenceManager;
}
@@ -379,7 +379,7 @@
TransactionAssert.beginTransaction();
Session session = instanceHibernateSupport.getCurrentSession();
assertEquals(0, session.createQuery("from InstanceDefinitionImpl").list().size());
- assertEquals(0, portletHibernateSupport.getCurrentSession().createQuery("from PersistentState").list().size());
+ assertEquals(0, portletHibernateSupport.getCurrentSession().createQuery("from PersistentPortletState").list().size());
TransactionAssert.commitTransaction();
}
Modified: trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -38,7 +38,7 @@
import org.jboss.portal.common.value.StringValue;
import org.jboss.portal.core.impl.portlet.state.PersistentConsumer;
import org.jboss.portal.core.impl.portlet.state.PersistentRegistration;
-import org.jboss.portal.core.impl.portlet.state.PersistentStateStore;
+import org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager;
import org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Portlet;
@@ -52,8 +52,8 @@
import org.jboss.portal.portlet.state.PropertyChange;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.state.SimplePropertyMap;
-import org.jboss.portal.portlet.state.producer.ProducerState;
-import org.jboss.portal.portlet.state.producer.ProducerStateContext;
+import org.jboss.portal.portlet.state.producer.PortletState;
+import org.jboss.portal.portlet.state.producer.PortletStateContext;
import org.jboss.portal.portlet.support.info.PreferencesInfoSupport;
import org.jboss.portal.portlet.test.ActionContextImpl;
import org.jboss.portal.portlet.test.InstanceContextImpl;
@@ -109,7 +109,7 @@
private HibernateSupport hibernateSupport;
/** . */
- private PersistentStateStore persistenceManager;
+ private PersistentPortletStatePersistenceManager persistenceManager;
/** . */
private ProducerPortletInvoker producer;
@@ -132,12 +132,12 @@
this.hibernateSupport = hibernateSupport;
}
- public PersistentStateStore getPersistenceManager()
+ public PersistentPortletStatePersistenceManager getPersistenceManager()
{
return persistenceManager;
}
- public void setPersistenceManager(PersistentStateStore persistenceManager)
+ public void setPersistenceManager(PersistentPortletStatePersistenceManager persistenceManager)
{
this.persistenceManager = persistenceManager;
}
@@ -333,7 +333,7 @@
// Check the clone state
TransactionAssert.beginTransaction();
assertTrue(cloneCtx.getId().startsWith("_"));
- ProducerStateContext cloneState = persistenceManager.loadState(cloneCtx.getId().substring(1));
+ PortletStateContext cloneState = persistenceManager.loadState(cloneCtx.getId().substring(1));
assertNotNull(cloneState);
assertEquals(cloneCtx.getId(), "_" + cloneState.getId());
assertEquals("SimplePortlet", cloneState.getState().getPortletId());
@@ -359,7 +359,7 @@
// Check the clone clone state
TransactionAssert.beginTransaction();
assertTrue(cloneCloneCtx.getId().startsWith("_"));
- ProducerStateContext cloneCloneState = persistenceManager.loadState(cloneCloneCtx.getId().substring(1));
+ PortletStateContext cloneCloneState = persistenceManager.loadState(cloneCloneCtx.getId().substring(1));
assertNotNull(cloneCloneState);
assertEquals(cloneCloneCtx.getId(), "_" + cloneCloneState.getId());
assertEquals("SimplePortlet", cloneCloneState.getState().getPortletId());
@@ -463,7 +463,7 @@
TransactionAssert.beginTransaction();
PortletContext cloneId = instanceContext.getClonedContext();
assertNotNull(cloneId);
- ProducerStateContext state = persistenceManager.loadState(cloneId.getId().substring(1));
+ PortletStateContext state = persistenceManager.loadState(cloneId.getId().substring(1));
assertNotNull(state);
assertEquals(cloneId.getId().substring(1), state.getId());
assertEquals("CloningPortlet", state.getState().getPortletId());
@@ -518,7 +518,7 @@
// Modify the state of the CCP
TransactionAssert.beginTransaction();
- ProducerState cloningPortletState = persistenceManager.loadState(cloningPortletId.getId().substring(1)).getState();
+ PortletState cloningPortletState = persistenceManager.loadState(cloningPortletId.getId().substring(1)).getState();
SimplePropertyMap newCloningPortletStateValue = new SimplePropertyMap(cloningPortletState.getProperties());
newCloningPortletStateValue.setProperty("abc", new StringValue("deff"));
persistenceManager.updateState(cloningPortletId.getId().substring(1), newCloningPortletStateValue);
@@ -538,7 +538,7 @@
TransactionAssert.beginTransaction();
PortletContext cloneId = instanceContext.getClonedContext();
assertNotNull(cloneId);
- ProducerStateContext state = persistenceManager.loadState(cloneId.getId().substring(1));
+ PortletStateContext state = persistenceManager.loadState(cloneId.getId().substring(1));
assertNotNull(state);
assertEquals(cloneId.getId().substring(1), state.getId());
assertEquals("CloningPortlet", state.getState().getPortletId());
@@ -568,7 +568,7 @@
// Check state
TransactionAssert.beginTransaction();
assertNull(instanceContext.getClonedContext());
- ProducerStateContext state = persistenceManager.loadState(cloningPortletId.getId().substring(1));
+ PortletStateContext state = persistenceManager.loadState(cloningPortletId.getId().substring(1));
assertNotNull(state);
assertEquals("CloningPortlet", state.getState().getPortletId());
assertEquals(cloningPortletId.getId().substring(1), state.getId());
Modified: trunk/core/src/main/org/jboss/portal/test/core/state/RegistrationPersistenceManagerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/RegistrationPersistenceManagerTestCase.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/RegistrationPersistenceManagerTestCase.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -32,7 +32,7 @@
import org.jboss.portal.common.test.TestParametrization;
import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.common.test.junit.POJOJUnitTest;
-import org.jboss.portal.core.impl.portlet.state.PersistentStateStore;
+import org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager;
import org.jboss.portal.registration.RegistrationPersistenceManager;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
@@ -78,7 +78,7 @@
private HibernateSupport hibernateSupport;
/** . */
- private PersistentStateStore persistenceManager;
+ private PersistentPortletStatePersistenceManager persistenceManager;
public String getName()
{
@@ -95,12 +95,12 @@
this.hibernateSupport = hibernateSupport;
}
- public PersistentStateStore getPersistenceManager()
+ public PersistentPortletStatePersistenceManager getPersistenceManager()
{
return persistenceManager;
}
- public void setPersistenceManager(PersistentStateStore persistenceManager)
+ public void setPersistenceManager(PersistentPortletStatePersistenceManager persistenceManager)
{
this.persistenceManager = persistenceManager;
}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-12-15 17:31:20 UTC (rev 5873)
@@ -859,7 +859,7 @@
<!-- The producer portlet invoker -->
<mbean
- code="org.jboss.portal.core.impl.portlet.state.PersistentStateStore"
+ code="org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager"
name="portal:service=PersistenceManager,type=Producer"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/core/src/resources/portal-core-sar/conf/hibernate/portlet/domain.hbm.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/hibernate/portlet/domain.hbm.xml 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/resources/portal-core-sar/conf/hibernate/portlet/domain.hbm.xml 2006-12-15 17:31:20 UTC (rev 5873)
@@ -27,7 +27,7 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
- name="org.jboss.portal.core.impl.portlet.state.PersistentState"
+ name="org.jboss.portal.core.impl.portlet.state.PersistentPortletState"
table="JBP_PORTLET_STATE">
<cache usage="@portal.hibernate.cache.usage@"/>
<id
@@ -69,7 +69,7 @@
<index
column="NAME"
type="java.lang.String"/>
- <one-to-many class="org.jboss.portal.core.impl.portlet.state.PersistentStateEntry"/>
+ <one-to-many class="org.jboss.portal.core.impl.portlet.state.PersistentPortletStateEntry"/>
</map>
<set
name="children"
@@ -79,18 +79,18 @@
lazy="extra">
<cache usage="@portal.hibernate.cache.usage@"/>
<key column="PARENT_PK"/>
- <one-to-many class="org.jboss.portal.core.impl.portlet.state.PersistentState"/>
+ <one-to-many class="org.jboss.portal.core.impl.portlet.state.PersistentPortletState"/>
</set>
<many-to-one
name="parent"
column="PARENT_PK"
- class="org.jboss.portal.core.impl.portlet.state.PersistentState"
+ class="org.jboss.portal.core.impl.portlet.state.PersistentPortletState"
cascade="none"
fetch="select"/>
</class>
<class
- name="org.jboss.portal.core.impl.portlet.state.PersistentStateEntry"
+ name="org.jboss.portal.core.impl.portlet.state.PersistentPortletStateEntry"
table="JBP_PORTLET_STATE_ENTRY">
<cache usage="@portal.hibernate.cache.usage@"/>
<id
Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/jboss-beans.xml
===================================================================
--- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/jboss-beans.xml 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/jboss-beans.xml 2006-12-15 17:31:20 UTC (rev 5873)
@@ -88,7 +88,7 @@
<bean name="StateManagementPolicy" class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService">
<property name="persistLocally"><inject bean="TestCaseConfig" property="persistLocally"/></property>
</bean>
- <bean name="PersistenceManager" class="org.jboss.portal.core.impl.portlet.state.PersistentStateStore">
+ <bean name="PersistenceManager" class="org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager">
<property name="sessionFactoryJNDIName">java:/PortletSessionFactory</property>
</bean>
<bean name="PortletContainer" class="org.jboss.portal.portlet.test.support.PortletInvokerSupport">
Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/jboss-beans.xml
===================================================================
--- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/jboss-beans.xml 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/jboss-beans.xml 2006-12-15 17:31:20 UTC (rev 5873)
@@ -74,7 +74,7 @@
<property name="persistLocally">true</property>
</bean>
- <bean name="PersistenceManager" class="org.jboss.portal.core.impl.portlet.state.PersistentStateStore">
+ <bean name="PersistenceManager" class="org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager">
<property name="sessionFactoryJNDIName">java:/SessionFactory</property>
</bean>
Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/registration-persistence-manager-beans.xml
===================================================================
--- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/registration-persistence-manager-beans.xml 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/registration-persistence-manager-beans.xml 2006-12-15 17:31:20 UTC (rev 5873)
@@ -67,7 +67,7 @@
<property name="jNDIName">java:/SessionFactory</property>
</bean>
- <bean name="PersistenceManager" class="org.jboss.portal.core.impl.portlet.state.PersistentStateStore">
+ <bean name="PersistenceManager" class="org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager">
<property name="sessionFactoryJNDIName">java:/SessionFactory</property>
</bean>
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterService.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterService.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterService.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -25,7 +25,7 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.state.StateConverter;
-import org.jboss.portal.portlet.state.producer.ProducerState;
+import org.jboss.portal.portlet.state.producer.PortletState;
import java.io.IOException;
@@ -36,7 +36,7 @@
public class StateConverterService extends AbstractJBossService implements StateConverter
{
- public byte[] marshall(ProducerState state)
+ public byte[] marshall(PortletState state)
{
try
{
@@ -48,11 +48,11 @@
}
}
- public ProducerState unmarshall(byte[] marshalledState)
+ public PortletState unmarshall(byte[] marshalledState)
{
try
{
- return (ProducerState)Tools.unserialize(marshalledState);
+ return (PortletState)Tools.unserialize(marshalledState);
}
catch (Exception e)
{
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterV0.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterV0.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterV0.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -28,7 +28,7 @@
import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.portlet.state.StateConversionException;
import org.jboss.portal.portlet.state.StateConverter;
-import org.jboss.portal.portlet.state.producer.ProducerState;
+import org.jboss.portal.portlet.state.producer.PortletState;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -58,7 +58,7 @@
/** . */
private static final byte VERSION_ID = 0;
- public byte[] marshall(ProducerState state) throws StateConversionException
+ public byte[] marshall(PortletState state) throws StateConversionException
{
if (state == null)
{
@@ -106,7 +106,7 @@
}
}
- public ProducerState unmarshall(byte[] marshalledState) throws StateConversionException
+ public PortletState unmarshall(byte[] marshalledState) throws StateConversionException
{
if (marshalledState == null)
{
@@ -146,7 +146,7 @@
StringValue value = new StringValue(strings);
properties.setProperty(key, value);
}
- return new ProducerState(portletId, properties);
+ return new PortletState(portletId, properties);
}
catch (IOException e)
{
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStateContextImpl.java (from rev 5872, trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStateContextImpl.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.portlet.impl.state.producer;
+
+import org.jboss.portal.portlet.state.producer.PortletStateContext;
+import org.jboss.portal.portlet.state.producer.PortletState;
+import org.jboss.portal.portlet.state.PropertyMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletStateContextImpl implements PortletStateContext
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private PortletState state;
+
+ public PortletStateContextImpl(String id, String portletId, PropertyMap propertyMap)
+ {
+ this.id = id;
+ this.state = new PortletState(portletId, propertyMap);
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public PortletState getState()
+ {
+ return state;
+ }
+}
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java (from rev 5872, trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -0,0 +1,146 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.portlet.impl.state.producer;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.portlet.state.InvalidStateIdException;
+import org.jboss.portal.portlet.state.NoSuchStateException;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
+import org.jboss.portal.portlet.state.producer.PortletStatePersistenceManager;
+import org.jboss.portal.portlet.state.producer.PortletStateContext;
+import org.jboss.portal.portlet.state.producer.PortletState;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletStatePersistenceManagerService extends AbstractJBossService implements PortletStatePersistenceManager
+{
+
+ /** . */
+ private Map store = new HashMap();
+
+ /** . */
+ private int counter = 0;
+
+
+ public synchronized PortletStateContext loadState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
+ {
+ if (stateId == null)
+ {
+ throw new IllegalArgumentException("No null state id accepted");
+ }
+ try
+ {
+ Integer.parseInt(stateId);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new InvalidStateIdException(e, stateId);
+ }
+ PortletStateContext context = (PortletStateContext)store.get(stateId);
+ if (context == null)
+ {
+ throw new NoSuchStateException(stateId);
+ }
+ return context;
+ }
+
+ private synchronized PortletState getState(String stateId) throws NoSuchStateException, InvalidStateIdException
+ {
+ PortletStateContext context = loadState(stateId);
+ return context.getState();
+ }
+
+ public synchronized String createState(String portletId, PropertyMap propertyMap)
+ {
+ if (portletId == null)
+ {
+ throw new IllegalArgumentException("No null portlet id accepted");
+ }
+ if (propertyMap == null)
+ {
+ throw new IllegalArgumentException("No null value map accepted");
+ }
+ String id = Integer.toString(counter++);
+ PortletStateContext state = new PortletStateContextImpl(id, portletId, new SimplePropertyMap(propertyMap));
+ store.put(id, state);
+ return id;
+ }
+
+ public synchronized String cloneState(String stateId, PropertyMap propertyMap) throws NoSuchStateException, InvalidStateIdException
+ {
+ if (propertyMap == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ PortletState stateContext = getState(stateId);
+ return createState(stateContext.getPortletId(), propertyMap);
+ }
+
+ public String cloneState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
+ {
+ PortletState state = getState(stateId);
+ return createState(state.getPortletId(), new SimplePropertyMap(state.getProperties()));
+ }
+
+ public synchronized void updateState(String stateId, PropertyMap propertyMap) throws NoSuchStateException, InvalidStateIdException
+ {
+ if (propertyMap == null)
+ {
+ throw new IllegalArgumentException("No null value map");
+ }
+ PortletState ctx = getState(stateId);
+ ctx.getProperties().clear();
+ ctx.getProperties().putAll(propertyMap);
+ }
+
+ public synchronized void destroyState(String stateId) throws InvalidStateIdException, NoSuchStateException
+ {
+ if (stateId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ try
+ {
+ Integer.parseInt(stateId);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new InvalidStateIdException(e, stateId);
+ }
+ if (store.remove(stateId) == null)
+ {
+ throw new NoSuchStateException(stateId);
+ }
+ }
+
+ public synchronized int getSize()
+ {
+ return store.size();
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -1,146 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.portlet.impl.state.producer;
-
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.portlet.state.InvalidStateIdException;
-import org.jboss.portal.portlet.state.NoSuchStateException;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.SimplePropertyMap;
-import org.jboss.portal.portlet.state.producer.ProducerPersistenceManager;
-import org.jboss.portal.portlet.state.producer.ProducerStateContext;
-import org.jboss.portal.portlet.state.producer.ProducerState;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ProducerPersistenceManagerService extends AbstractJBossService implements ProducerPersistenceManager
-{
-
- /** . */
- private Map store = new HashMap();
-
- /** . */
- private int counter = 0;
-
-
- public synchronized ProducerStateContext loadState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
- {
- if (stateId == null)
- {
- throw new IllegalArgumentException("No null state id accepted");
- }
- try
- {
- Integer.parseInt(stateId);
- }
- catch (NumberFormatException e)
- {
- throw new InvalidStateIdException(e, stateId);
- }
- ProducerStateContext context = (ProducerStateContext)store.get(stateId);
- if (context == null)
- {
- throw new NoSuchStateException(stateId);
- }
- return context;
- }
-
- private synchronized ProducerState getState(String stateId) throws NoSuchStateException, InvalidStateIdException
- {
- ProducerStateContext context = loadState(stateId);
- return context.getState();
- }
-
- public synchronized String createState(String portletId, PropertyMap propertyMap)
- {
- if (portletId == null)
- {
- throw new IllegalArgumentException("No null portlet id accepted");
- }
- if (propertyMap == null)
- {
- throw new IllegalArgumentException("No null value map accepted");
- }
- String id = Integer.toString(counter++);
- ProducerStateContext state = new ProducerStateContextImpl(id, portletId, new SimplePropertyMap(propertyMap));
- store.put(id, state);
- return id;
- }
-
- public synchronized String cloneState(String stateId, PropertyMap propertyMap) throws NoSuchStateException, InvalidStateIdException
- {
- if (propertyMap == null)
- {
- throw new IllegalArgumentException();
- }
- ProducerState stateContext = getState(stateId);
- return createState(stateContext.getPortletId(), propertyMap);
- }
-
- public String cloneState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
- {
- ProducerState state = getState(stateId);
- return createState(state.getPortletId(), new SimplePropertyMap(state.getProperties()));
- }
-
- public synchronized void updateState(String stateId, PropertyMap propertyMap) throws NoSuchStateException, InvalidStateIdException
- {
- if (propertyMap == null)
- {
- throw new IllegalArgumentException("No null value map");
- }
- ProducerState ctx = getState(stateId);
- ctx.getProperties().clear();
- ctx.getProperties().putAll(propertyMap);
- }
-
- public synchronized void destroyState(String stateId) throws InvalidStateIdException, NoSuchStateException
- {
- if (stateId == null)
- {
- throw new IllegalArgumentException();
- }
- try
- {
- Integer.parseInt(stateId);
- }
- catch (NumberFormatException e)
- {
- throw new InvalidStateIdException(e, stateId);
- }
- if (store.remove(stateId) == null)
- {
- throw new NoSuchStateException(stateId);
- }
- }
-
- public synchronized int getSize()
- {
- return store.size();
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -1,57 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.portlet.impl.state.producer;
-
-import org.jboss.portal.portlet.state.producer.ProducerStateContext;
-import org.jboss.portal.portlet.state.producer.ProducerState;
-import org.jboss.portal.portlet.state.PropertyMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ProducerStateContextImpl implements ProducerStateContext
-{
-
- /** . */
- private final String id;
-
- /** . */
- private ProducerState state;
-
- public ProducerStateContextImpl(String id, String portletId, PropertyMap propertyMap)
- {
- this.id = id;
- this.state = new ProducerState(portletId, propertyMap);
- }
-
- public String getId()
- {
- return id;
- }
-
- public ProducerState getState()
- {
- return state;
- }
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/state/StateConverter.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/StateConverter.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/StateConverter.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -22,11 +22,11 @@
******************************************************************************/
package org.jboss.portal.portlet.state;
-import org.jboss.portal.portlet.state.producer.ProducerState;
+import org.jboss.portal.portlet.state.producer.PortletState;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public interface StateConverter
{
@@ -38,7 +38,7 @@
* @throws StateConversionException if marshalling cannot be performed
* @throws IllegalArgumentException if the state is null
*/
- byte[] marshall(ProducerState state) throws StateConversionException, IllegalArgumentException;
+ byte[] marshall(PortletState state) throws StateConversionException, IllegalArgumentException;
/**
* Unmarshall the producer state from a byte array.
@@ -48,5 +48,5 @@
* @throws StateConversionException if unmarshalling cannot be performed
* @throws IllegalArgumentException if the argument is null
*/
- ProducerState unmarshall(byte[] marshalledState) throws StateConversionException, IllegalArgumentException;
+ PortletState unmarshall(byte[] marshalledState) throws StateConversionException, IllegalArgumentException;
}
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletState.java (from rev 5872, trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerState.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerState.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletState.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.portlet.state.producer;
+
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletState implements Serializable
+{
+
+ /** . */
+ private String portletId;
+
+ /** . */
+ private PropertyMap properties;
+
+ /** . */
+ private Date terminationTime;
+
+ public PortletState(String portletId)
+ {
+ this(portletId, new SimplePropertyMap());
+ }
+
+ public PortletState(String portletId, PropertyMap properties)
+ {
+ if (portletId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (properties == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.portletId = portletId;
+ this.properties = properties;
+ this.terminationTime = null;
+ }
+
+ public String getPortletId()
+ {
+ return portletId;
+ }
+
+ public PropertyMap getProperties()
+ {
+ return properties;
+ }
+
+ public Date getTerminationTime()
+ {
+ return terminationTime;
+ }
+
+ public void setTerminationTime(Date terminationTime)
+ {
+ this.terminationTime = terminationTime;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletState.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletStateContext.java (from rev 5872, trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletStateContext.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.portlet.state.producer;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface PortletStateContext
+{
+
+ /**
+ *
+ * @return
+ */
+ String getId();
+
+ /**
+ *
+ * @return
+ */
+ PortletState getState();
+
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletStateContext.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletStatePersistenceManager.java (from rev 5872, trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPersistenceManager.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPersistenceManager.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletStatePersistenceManager.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.portlet.state.producer;
+
+import org.jboss.portal.portlet.state.InvalidStateIdException;
+import org.jboss.portal.portlet.state.NoSuchStateException;
+import org.jboss.portal.portlet.state.PropertyMap;
+
+/**
+ * An abstraction for enabling state management on the producer side.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface PortletStatePersistenceManager
+{
+ /**
+ * Load the state.
+ *
+ * @param stateId the state id
+ * @return the value map or null if it does not exist
+ * @throws IllegalArgumentException if the state id is null
+ * @throws NoSuchStateException is the specified state does not exist
+ * @throws InvalidStateIdException if the state id is not valid
+ */
+ PortletStateContext loadState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
+
+ /**
+ * Create the initial state.
+ *
+ * @param portletId the id that this state refers to
+ * @return the id of the state created
+ * @throws IllegalArgumentException if the portlet id is null
+ */
+ String createState(String portletId, PropertyMap propertyMap) throws IllegalArgumentException;
+
+ /**
+ * Clone an existing state.
+ *
+ * @param stateId the id that this state refers to
+ * @return the state id
+ * @throws IllegalArgumentException if the state id is null
+ * @throws NoSuchStateException is the specified state does not exist
+ * @throws InvalidStateIdException if the state id is not valid
+ */
+ String cloneState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
+
+ /**
+ * Clone an existing state.
+ *
+ * @param stateId the id that this state refers to
+ * @param propertyMap the values of the cloned state
+ * @return the state id
+ * @throws IllegalArgumentException if the state id is null or the value is nul
+ * @throws NoSuchStateException is the specified state does not exist
+ * @throws InvalidStateIdException if the state id is not valid
+ */
+ String cloneState(String stateId, PropertyMap propertyMap) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
+
+ /**
+ * Update the state.
+ *
+ * @param stateId
+ * @param propertyMap the updated state
+ * @throws IllegalArgumentException if the state id is null or the values are null
+ * @throws NoSuchStateException is the specified state does not exist
+ * @throws org.jboss.portal.portlet.state.InvalidStateIdException
+ * if the state id is not valid
+ */
+ void updateState(String stateId, PropertyMap propertyMap) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
+
+ /**
+ * Destroy the state.
+ *
+ * @param stateId
+ * @throws IllegalArgumentException if the state id is null
+ * @throws NoSuchStateException is the specified state does not exist
+ * @throws InvalidStateIdException if the state id is not valid
+ */
+ void destroyState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/PortletStatePersistenceManager.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPersistenceManager.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPersistenceManager.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPersistenceManager.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -1,101 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.portlet.state.producer;
-
-import org.jboss.portal.portlet.state.InvalidStateIdException;
-import org.jboss.portal.portlet.state.NoSuchStateException;
-import org.jboss.portal.portlet.state.PropertyMap;
-
-/**
- * An abstraction for enabling state management on the producer side.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface ProducerPersistenceManager
-{
- /**
- * Load the state.
- *
- * @param stateId the state id
- * @return the value map or null if it does not exist
- * @throws IllegalArgumentException if the state id is null
- * @throws NoSuchStateException is the specified state does not exist
- * @throws InvalidStateIdException if the state id is not valid
- */
- ProducerStateContext loadState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
-
- /**
- * Create the initial state.
- *
- * @param portletId the id that this state refers to
- * @return the id of the state created
- * @throws IllegalArgumentException if the portlet id is null
- */
- String createState(String portletId, PropertyMap propertyMap) throws IllegalArgumentException;
-
- /**
- * Clone an existing state.
- *
- * @param stateId the id that this state refers to
- * @return the state id
- * @throws IllegalArgumentException if the state id is null
- * @throws NoSuchStateException is the specified state does not exist
- * @throws InvalidStateIdException if the state id is not valid
- */
- String cloneState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
-
- /**
- * Clone an existing state.
- *
- * @param stateId the id that this state refers to
- * @param propertyMap the values of the cloned state
- * @return the state id
- * @throws IllegalArgumentException if the state id is null or the value is nul
- * @throws NoSuchStateException is the specified state does not exist
- * @throws InvalidStateIdException if the state id is not valid
- */
- String cloneState(String stateId, PropertyMap propertyMap) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
-
- /**
- * Update the state.
- *
- * @param stateId
- * @param propertyMap the updated state
- * @throws IllegalArgumentException if the state id is null or the values are null
- * @throws NoSuchStateException is the specified state does not exist
- * @throws org.jboss.portal.portlet.state.InvalidStateIdException
- * if the state id is not valid
- */
- void updateState(String stateId, PropertyMap propertyMap) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
-
- /**
- * Destroy the state.
- *
- * @param stateId
- * @throws IllegalArgumentException if the state id is null
- * @throws NoSuchStateException is the specified state does not exist
- * @throws InvalidStateIdException if the state id is not valid
- */
- void destroyState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -74,7 +74,7 @@
private PortletInvoker portletInvoker;
/** . */
- private ProducerPersistenceManager persistenceManager;
+ private PortletStatePersistenceManager persistenceManager;
/** . */
private StateManagementPolicy stateManagementPolicy;
@@ -92,12 +92,12 @@
this.portletInvoker = portletInvoker;
}
- public ProducerPersistenceManager getPersistenceManager()
+ public PortletStatePersistenceManager getPersistenceManager()
{
return persistenceManager;
}
- public void setPersistenceManager(ProducerPersistenceManager ppm)
+ public void setPersistenceManager(PortletStatePersistenceManager ppm)
{
this.persistenceManager = ppm;
}
@@ -141,8 +141,8 @@
{
try
{
- ProducerState producerState = stateConverter.unmarshall(state);
- return portletInvoker.getPortlet(PortletContext.createPortletContext(producerState.getPortletId()));
+ PortletState portletState = stateConverter.unmarshall(state);
+ return portletInvoker.getPortlet(PortletContext.createPortletContext(portletState.getPortletId()));
}
catch (StateConversionException e)
{
@@ -159,8 +159,8 @@
try
{
String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
- ProducerStateContext stateContext = persistenceManager.loadState(stateId);
- ProducerState state = stateContext.getState();
+ PortletStateContext stateContext = persistenceManager.loadState(stateId);
+ PortletState state = stateContext.getState();
return portletInvoker.getPortlet(PortletContext.createPortletContext(state.getPortletId()));
}
catch (NoSuchStateException e)
@@ -626,7 +626,7 @@
{
try
{
- ProducerState sstate = new ProducerState(portletId, props);
+ PortletState sstate = new PortletState(portletId, props);
byte[] marshalledState = stateConverter.marshall(sstate);
return PortletContext.createStatefulPortletContext(CONSUMER_CLONE_ID, marshalledState);
}
@@ -683,7 +683,7 @@
String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
try
{
- ProducerStateContext stateContext = persistenceManager.loadState(stateId);
+ PortletStateContext stateContext = persistenceManager.loadState(stateId);
return new LocalContext(stateContext.getState().getPortletId(), stateContext.getState().getProperties(), stateContext.getId());
}
catch (NoSuchStateException e)
@@ -704,7 +704,7 @@
{
try
{
- final ProducerState state = stateConverter.unmarshall(bytes);
+ final PortletState state = stateConverter.unmarshall(bytes);
return new RemoteContext(state.getPortletId(), state.getProperties());
}
catch (StateConversionException e)
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerState.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerState.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerState.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -1,86 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.portlet.state.producer;
-
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.SimplePropertyMap;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ProducerState implements Serializable
-{
-
- /** . */
- private String portletId;
-
- /** . */
- private PropertyMap properties;
-
- /** . */
- private Date terminationTime;
-
- public ProducerState(String portletId)
- {
- this(portletId, new SimplePropertyMap());
- }
-
- public ProducerState(String portletId, PropertyMap properties)
- {
- if (portletId == null)
- {
- throw new IllegalArgumentException();
- }
- if (properties == null)
- {
- throw new IllegalArgumentException();
- }
- this.portletId = portletId;
- this.properties = properties;
- this.terminationTime = null;
- }
-
- public String getPortletId()
- {
- return portletId;
- }
-
- public PropertyMap getProperties()
- {
- return properties;
- }
-
- public Date getTerminationTime()
- {
- return terminationTime;
- }
-
- public void setTerminationTime(Date terminationTime)
- {
- this.terminationTime = terminationTime;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -1,44 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.portlet.state.producer;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface ProducerStateContext
-{
-
- /**
- *
- * @return
- */
- String getId();
-
- /**
- *
- * @return
- */
- ProducerState getState();
-
-}
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -29,7 +29,7 @@
import org.jboss.portal.portlet.impl.state.StateConverterService;
import org.jboss.portal.portlet.impl.state.StateManagementPolicyService;
import org.jboss.portal.portlet.impl.state.consumer.ConsumerPersistenceManagerService;
-import org.jboss.portal.portlet.impl.state.producer.ProducerPersistenceManagerService;
+import org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.state.AccessMode;
@@ -74,7 +74,7 @@
protected PortletInvokerSupport container;
/** . */
- protected ProducerPersistenceManagerService producerPersistenceManager;
+ protected PortletStatePersistenceManagerService portletStatePersistenceManager;
/** . */
protected StateManagementPolicyService stateManagementPolicy;
@@ -88,7 +88,7 @@
consumerPersistenceManager = new ConsumerPersistenceManagerService();
producer = new ProducerPortletInvoker();
container = new PortletInvokerSupport();
- producerPersistenceManager = new ProducerPersistenceManagerService();
+ portletStatePersistenceManager = new PortletStatePersistenceManagerService();
stateManagementPolicy = new StateManagementPolicyService();
stateConverter = new StateConverterService();
@@ -97,7 +97,7 @@
//
producer.setPortletInvoker(container);
- producer.setPersistenceManager(producerPersistenceManager);
+ producer.setPersistenceManager(portletStatePersistenceManager);
producer.setStateManagementPolicy(stateManagementPolicy);
producer.setStateConverter(stateConverter);
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -27,7 +27,7 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.impl.state.StateConverterService;
import org.jboss.portal.portlet.impl.state.StateManagementPolicyService;
-import org.jboss.portal.portlet.impl.state.producer.ProducerPersistenceManagerService;
+import org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.state.AccessMode;
@@ -66,7 +66,7 @@
protected PortletInvokerSupport container;
/** . */
- protected ProducerPersistenceManagerService persistenceManager;
+ protected PortletStatePersistenceManagerService persistenceManager;
/** . */
protected StateManagementPolicyService stateManagementPolicy;
@@ -78,7 +78,7 @@
{
producer = new ProducerPortletInvoker();
container = new PortletInvokerSupport();
- persistenceManager = new ProducerPersistenceManagerService();
+ persistenceManager = new PortletStatePersistenceManagerService();
stateManagementPolicy = new StateManagementPolicyService();
stateConverter = new StateConverterService();
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/StateConverterV0TestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/StateConverterV0TestCase.java 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/StateConverterV0TestCase.java 2006-12-15 17:31:20 UTC (rev 5873)
@@ -29,7 +29,7 @@
import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.portlet.state.StateConversionException;
import org.jboss.portal.portlet.state.StateConverter;
-import org.jboss.portal.portlet.state.producer.ProducerState;
+import org.jboss.portal.portlet.state.producer.PortletState;
import org.jboss.portal.portlet.test.ValueMapAssert;
/**
@@ -63,7 +63,7 @@
public void testAlteredMagic() throws StateConversionException
{
- byte[] bytes = converter.marshall(new ProducerState("foo"));
+ byte[] bytes = converter.marshall(new PortletState("foo"));
bytes[0] = (byte)0xCA;
bytes[1] = (byte)0xFE;
bytes[2] = (byte)0xBA;
@@ -80,7 +80,7 @@
public void testBadVersionNumber() throws StateConversionException
{
- byte[] bytes = converter.marshall(new ProducerState("foo"));
+ byte[] bytes = converter.marshall(new PortletState("foo"));
bytes[4] = (byte)0x01;
try
{
@@ -94,7 +94,7 @@
public void testWorks() throws Exception
{
- assertWorks(new ProducerState("foo"));
+ assertWorks(new PortletState("foo"));
//
PropertyMap props = new SimplePropertyMap();
@@ -105,14 +105,14 @@
props.setProperty("mn", new StringValue(new String[]{"op", null}));
props.setProperty("qr", new StringValue(new String[]{null, "st"}));
props.setProperty("uv", new StringValue(new String[]{"wx", null, "yz"}));
- assertWorks(new ProducerState("bar", props));
+ assertWorks(new PortletState("bar", props));
}
- private void assertWorks(ProducerState expectedState) throws Exception
+ private void assertWorks(PortletState expectedState) throws Exception
{
byte[] bytes = converter.marshall(expectedState);
assertNotNull(bytes);
- ProducerState state = converter.unmarshall(bytes);
+ PortletState state = converter.unmarshall(bytes);
assertNotNull(state);
//
Modified: trunk/portlet/src/resources/tck-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet/src/resources/tck-sar/META-INF/jboss-service.xml 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/resources/tck-sar/META-INF/jboss-service.xml 2006-12-15 17:31:20 UTC (rev 5873)
@@ -229,7 +229,7 @@
<!-- Preferences -->
<mbean
- code="org.jboss.portal.portlet.impl.state.producer.ProducerPersistenceManagerService"
+ code="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"
name="portal:service=StateStore,type=Producer"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml 2006-12-15 17:31:20 UTC (rev 5873)
@@ -207,7 +207,7 @@
<!-- The producer portlet invoker -->
<mbean
- code="org.jboss.portal.portlet.impl.state.producer.ProducerPersistenceManagerService"
+ code="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"
name="portal:service=PersistenceManager,type=Producer"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2006-12-15 16:04:07 UTC (rev 5872)
+++ trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2006-12-15 17:31:20 UTC (rev 5873)
@@ -108,7 +108,7 @@
<!-- The producer portlet invoker -->
<mbean
- code="org.jboss.portal.portlet.impl.state.producer.ProducerPersistenceManagerService"
+ code="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"
name="portal:service=PersistenceManager,type=Producer"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
19 years, 4 months
JBoss Portal SVN: r5872 - in trunk: core/src/main/org/jboss/portal/core/impl/portlet/state core/src/main/org/jboss/portal/test/core/state portlet portlet/src/main/org/jboss/portal/portlet/impl/state/producer portlet/src/main/org/jboss/portal/portlet/state/producer
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-15 11:04:07 -0500 (Fri, 15 Dec 2006)
New Revision: 5872
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java
trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
trunk/portlet/build.xml
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java
Log:
improve the ProducerPersistenceManager interface definition : don't make the ProducerStateContext a class that inherits ProducerState (a POJO), but rather have the ProducerStateContext be an interface that own a ProducerState object.
Modified: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java 2006-12-15 15:15:26 UTC (rev 5871)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentState.java 2006-12-15 16:04:07 UTC (rev 5872)
@@ -26,6 +26,7 @@
import org.jboss.portal.portlet.state.AbstractPropertyMap;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.state.producer.ProducerStateContext;
+import org.jboss.portal.portlet.state.producer.ProducerState;
import java.util.Calendar;
import java.util.Date;
@@ -39,7 +40,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PersistentState
+public class PersistentState implements ProducerStateContext
{
/** The primary key. */
@@ -67,7 +68,7 @@
protected PersistentState parent;
/** . */
- private ProducerStateContext ctx;
+ private ProducerState ctx;
public PersistentState()
{
@@ -188,7 +189,9 @@
this.parent = parent;
}
- public ProducerStateContext getContext()
+ //
+
+ public ProducerState getState()
{
if (ctx == null)
{
@@ -210,7 +213,7 @@
return entry.getValue();
}
};
- ctx = new ProducerStateContext(key.toString(), portletId, props);
+ ctx = new ProducerState(portletId, props);
}
return ctx;
}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java 2006-12-15 15:15:26 UTC (rev 5871)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java 2006-12-15 16:04:07 UTC (rev 5872)
@@ -77,8 +77,7 @@
public ProducerStateContext loadState(String id) throws InvalidStateIdException, NoSuchStateException
{
Session session = getCurrentSession();
- PersistentState persistentState = loadState(session, id);
- return persistentState.getContext();
+ return loadState(session, id);
}
public String createState(String portletId, PropertyMap propertyMap)
@@ -96,12 +95,12 @@
Session session = getCurrentSession();
// Create the persistent state
- PersistentState state = new PersistentState(portletId, propertyMap);
- session.save(state);
+ PersistentState context = new PersistentState(portletId, propertyMap);
+ session.save(context);
session.flush();
//
- return state.getId();
+ return context.getId();
}
public String cloneState(String stateId, PropertyMap propertyMap) throws InvalidStateIdException, NoSuchStateException
@@ -117,22 +116,22 @@
//
Session session = getCurrentSession();
- PersistentState parentState = loadState(session, stateId);
+ PersistentState parentContext = loadState(session, stateId);
// Create the persistent state
- PersistentState state = new PersistentState(parentState.getPortletId(), propertyMap);
- session.persist(state);
+ PersistentState context = new PersistentState(parentContext.getPortletId(), propertyMap);
+ session.persist(context);
// Make the association
- state.setParent(parentState);
- parentState.getChildren().add(state);
- session.update(parentState);
+ context.setParent(parentContext);
+ parentContext.getChildren().add(context);
+ session.update(parentContext);
//
session.flush();
//
- return state.getId();
+ return context.getId();
}
public String cloneState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
@@ -144,41 +143,41 @@
//
Session session = getCurrentSession();
- PersistentState parentState = loadState(session, stateId);
+ PersistentState parentContext = loadState(session, stateId);
// Create the persistent state
- PersistentState state = new PersistentState(parentState.getPortletId(), new SimplePropertyMap(parentState.getContext().getProperties()));
- session.persist(state);
+ PersistentState context = new PersistentState(parentContext.getPortletId(), new SimplePropertyMap(parentContext.getState().getProperties()));
+ session.persist(context);
// Make the association
- state.setParent(parentState);
- parentState.getChildren().add(state);
- session.update(parentState);
+ context.setParent(parentContext);
+ parentContext.getChildren().add(context);
+ session.update(parentContext);
//
session.flush();
//
- return state.getId();
+ return context.getId();
}
public void updateState(String stateId, PropertyMap propertyMap) throws InvalidStateIdException, NoSuchStateException
{
Session session = getCurrentSession();
- PersistentState state = loadState(session, stateId);
+ PersistentState context = loadState(session, stateId);
//
- state.entries.clear();
+ context.entries.clear();
for (Iterator i = propertyMap.keySet().iterator(); i.hasNext();)
{
String key = (String)i.next();
Value value = propertyMap.getProperty(key);
PersistentStateEntry entry = new PersistentStateEntry(key, value);
- state.entries.put(key, entry);
+ context.entries.put(key, entry);
}
//
- session.update(state);
+ session.update(context);
}
public void destroyState(String stateId) throws InvalidStateIdException, NoSuchStateException
@@ -190,15 +189,15 @@
//
Session session = getCurrentSession();
- PersistentState state = loadState(session, stateId);
+ PersistentState context = loadState(session, stateId);
// Efficiently set the children parent to null
String update = "update PersistentState p set p.parent=NULL where p.parent=:parent";
- Query query = session.createQuery(update).setLong("parent", state.getKey().longValue());
+ Query query = session.createQuery(update).setLong("parent", context.getKey().longValue());
query.executeUpdate();
// Delete the state
- session.delete(state);
+ session.delete(context);
session.flush();
}
@@ -230,16 +229,16 @@
try
{
Long key = new Long(stateId);
- PersistentState state = (PersistentState)session.get(PersistentState.class, key);
+ PersistentState context = (PersistentState)session.get(PersistentState.class, key);
//
- if (state == null)
+ if (context == null)
{
throw new NoSuchStateException(stateId);
}
//
- return state;
+ return context;
}
catch (NumberFormatException e)
{
Modified: trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-12-15 15:15:26 UTC (rev 5871)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-12-15 16:04:07 UTC (rev 5872)
@@ -336,8 +336,8 @@
ProducerStateContext cloneState = persistenceManager.loadState(cloneCtx.getId().substring(1));
assertNotNull(cloneState);
assertEquals(cloneCtx.getId(), "_" + cloneState.getId());
- assertEquals("SimplePortlet", cloneState.getPortletId());
- PropertyMap cloneValues = cloneState.getProperties();
+ assertEquals("SimplePortlet", cloneState.getState().getPortletId());
+ PropertyMap cloneValues = cloneState.getState().getProperties();
assertNotNull(cloneValues);
assertNotNull(cloneValues.keySet());
assertEquals(1, cloneValues.keySet().size());
@@ -362,8 +362,8 @@
ProducerStateContext cloneCloneState = persistenceManager.loadState(cloneCloneCtx.getId().substring(1));
assertNotNull(cloneCloneState);
assertEquals(cloneCloneCtx.getId(), "_" + cloneCloneState.getId());
- assertEquals("SimplePortlet", cloneCloneState.getPortletId());
- PropertyMap cloneCloneValues = cloneCloneState.getProperties();
+ assertEquals("SimplePortlet", cloneCloneState.getState().getPortletId());
+ PropertyMap cloneCloneValues = cloneCloneState.getState().getProperties();
assertNotNull(cloneCloneValues);
assertNotNull(cloneCloneValues.keySet());
assertEquals(1, cloneCloneValues.keySet().size());
@@ -466,11 +466,11 @@
ProducerStateContext state = persistenceManager.loadState(cloneId.getId().substring(1));
assertNotNull(state);
assertEquals(cloneId.getId().substring(1), state.getId());
- assertEquals("CloningPortlet", state.getPortletId());
+ assertEquals("CloningPortlet", state.getState().getPortletId());
SimplePropertyMap expectedValue = new SimplePropertyMap();
expectedValue.setProperty("abc", new StringValue("def"));
expectedValue.setProperty("_abc", new StringValue("_def"));
- ValueMapAssert.assertEquals(expectedValue, state.getProperties());
+ ValueMapAssert.assertEquals(expectedValue, state.getState().getProperties());
TransactionAssert.commitTransaction();
}
@@ -518,7 +518,7 @@
// Modify the state of the CCP
TransactionAssert.beginTransaction();
- ProducerState cloningPortletState = persistenceManager.loadState(cloningPortletId.getId().substring(1));
+ ProducerState cloningPortletState = persistenceManager.loadState(cloningPortletId.getId().substring(1)).getState();
SimplePropertyMap newCloningPortletStateValue = new SimplePropertyMap(cloningPortletState.getProperties());
newCloningPortletStateValue.setProperty("abc", new StringValue("deff"));
persistenceManager.updateState(cloningPortletId.getId().substring(1), newCloningPortletStateValue);
@@ -541,11 +541,11 @@
ProducerStateContext state = persistenceManager.loadState(cloneId.getId().substring(1));
assertNotNull(state);
assertEquals(cloneId.getId().substring(1), state.getId());
- assertEquals("CloningPortlet", state.getPortletId());
+ assertEquals("CloningPortlet", state.getState().getPortletId());
SimplePropertyMap expectedValue = new SimplePropertyMap();
expectedValue.setProperty("abc", new StringValue("deff"));
expectedValue.setProperty("_abc", new StringValue("_def"));
- ValueMapAssert.assertEquals(expectedValue, state.getProperties());
+ ValueMapAssert.assertEquals(expectedValue, state.getState().getProperties());
TransactionAssert.commitTransaction();
}
@@ -570,12 +570,12 @@
assertNull(instanceContext.getClonedContext());
ProducerStateContext state = persistenceManager.loadState(cloningPortletId.getId().substring(1));
assertNotNull(state);
- assertEquals("CloningPortlet", state.getPortletId());
+ assertEquals("CloningPortlet", state.getState().getPortletId());
assertEquals(cloningPortletId.getId().substring(1), state.getId());
SimplePropertyMap expectedValue = new SimplePropertyMap();
expectedValue.setProperty("abc", new StringValue("def"));
expectedValue.setProperty("_abc", new StringValue("_def"));
- ValueMapAssert.assertEquals(expectedValue, state.getProperties());
+ ValueMapAssert.assertEquals(expectedValue, state.getState().getProperties());
TransactionAssert.commitTransaction();
}
Modified: trunk/portlet/build.xml
===================================================================
--- trunk/portlet/build.xml 2006-12-15 15:15:26 UTC (rev 5871)
+++ trunk/portlet/build.xml 2006-12-15 16:04:07 UTC (rev 5872)
@@ -555,6 +555,10 @@
<x-sysproperty>
<sysproperty key="test.root" value="${build.lib}"/>
<sysproperty key="test.uri" value="/test/redirect/"/>
+<!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
+-->
</x-sysproperty>
<x-classpath>
<path refid="oswego.concurrent.classpath"/>
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java 2006-12-15 15:15:26 UTC (rev 5871)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerPersistenceManagerService.java 2006-12-15 16:04:07 UTC (rev 5872)
@@ -29,6 +29,7 @@
import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.portlet.state.producer.ProducerPersistenceManager;
import org.jboss.portal.portlet.state.producer.ProducerStateContext;
+import org.jboss.portal.portlet.state.producer.ProducerState;
import java.util.HashMap;
import java.util.Map;
@@ -46,7 +47,8 @@
/** . */
private int counter = 0;
- public synchronized ProducerStateContext loadState(String stateId) throws NoSuchStateException, InvalidStateIdException
+
+ public synchronized ProducerStateContext loadState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
{
if (stateId == null)
{
@@ -60,14 +62,20 @@
{
throw new InvalidStateIdException(e, stateId);
}
- ProducerStateContext state = (ProducerStateContext)store.get(stateId);
- if (state == null)
+ ProducerStateContext context = (ProducerStateContext)store.get(stateId);
+ if (context == null)
{
throw new NoSuchStateException(stateId);
}
- return state;
+ return context;
}
+ private synchronized ProducerState getState(String stateId) throws NoSuchStateException, InvalidStateIdException
+ {
+ ProducerStateContext context = loadState(stateId);
+ return context.getState();
+ }
+
public synchronized String createState(String portletId, PropertyMap propertyMap)
{
if (portletId == null)
@@ -79,7 +87,7 @@
throw new IllegalArgumentException("No null value map accepted");
}
String id = Integer.toString(counter++);
- ProducerStateContext state = new ProducerStateContext(id, portletId, new SimplePropertyMap(propertyMap));
+ ProducerStateContext state = new ProducerStateContextImpl(id, portletId, new SimplePropertyMap(propertyMap));
store.put(id, state);
return id;
}
@@ -90,13 +98,13 @@
{
throw new IllegalArgumentException();
}
- ProducerStateContext state = loadState(stateId);
- return createState(state.getPortletId(), propertyMap);
+ ProducerState stateContext = getState(stateId);
+ return createState(stateContext.getPortletId(), propertyMap);
}
public String cloneState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
{
- ProducerStateContext state = loadState(stateId);
+ ProducerState state = getState(stateId);
return createState(state.getPortletId(), new SimplePropertyMap(state.getProperties()));
}
@@ -106,7 +114,7 @@
{
throw new IllegalArgumentException("No null value map");
}
- ProducerStateContext ctx = loadState(stateId);
+ ProducerState ctx = getState(stateId);
ctx.getProperties().clear();
ctx.getProperties().putAll(propertyMap);
}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java 2006-12-15 15:15:26 UTC (rev 5871)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/ProducerStateContextImpl.java 2006-12-15 16:04:07 UTC (rev 5872)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.portlet.impl.state.producer;
+
+import org.jboss.portal.portlet.state.producer.ProducerStateContext;
+import org.jboss.portal.portlet.state.producer.ProducerState;
+import org.jboss.portal.portlet.state.PropertyMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProducerStateContextImpl implements ProducerStateContext
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private ProducerState state;
+
+ public ProducerStateContextImpl(String id, String portletId, PropertyMap propertyMap)
+ {
+ this.id = id;
+ this.state = new ProducerState(portletId, propertyMap);
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public ProducerState getState()
+ {
+ return state;
+ }
+}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2006-12-15 15:15:26 UTC (rev 5871)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2006-12-15 16:04:07 UTC (rev 5872)
@@ -158,7 +158,9 @@
{
try
{
- ProducerState state = persistenceManager.loadState(portletId.substring(PRODUCER_CLONE_ID_PREFIX.length()));
+ String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
+ ProducerStateContext stateContext = persistenceManager.loadState(stateId);
+ ProducerState state = stateContext.getState();
return portletInvoker.getPortlet(PortletContext.createPortletContext(state.getPortletId()));
}
catch (NoSuchStateException e)
@@ -189,47 +191,32 @@
InstanceContext instanceCtx = invocation.getInstanceContext();
AccessMode access = instanceCtx.getAccessMode();
- // Value map of the state loaded
- PropertyMap propertyMap = null;
+ // Get a state contxt for the portlet context
+ InternalPortletContext context = getStateContext(portletContext);
- // The next portlet to invoke
- String targetPortletId = portletContext.getId();
-
- // Try to get state
- ProducerState state = getProducerState(portletContext);
- if (state != null)
+ // If it is a producer offered portlet we consider read-write as read-only
+ if (context.isStateful() == false && access == AccessMode.READ_WRITE)
{
- propertyMap = state.getProperties();
- targetPortletId = state.getPortletId();
+ access = AccessMode.READ_ONLY;
}
- else
- {
- // If it is a producer offered portlet we consider read-write as read-only
- if (access == AccessMode.READ_WRITE)
- {
- access = AccessMode.READ_ONLY;
- }
- }
// Get the portlet container and set it on invocation
- Portlet portlet = portletInvoker.getPortlet(PortletContext.createPortletContext(targetPortletId));
+ Portlet portlet = portletInvoker.getPortlet(PortletContext.createPortletContext(context.getPortletId()));
if (portlet == null)
{
- throw new NoSuchPortletException("Portlet " + targetPortletId + " not found", targetPortletId);
+ throw new NoSuchPortletException("Portlet " + context.getPortletId() + " not found", context.getPortletId());
}
+
+ // Create prefs
PortletInfo info = portlet.getInfo();
-
- // Create prefs and set it on invocation
PreferencesInfo prefsInfo = info.getPreferences();
+ AbstractPropertyContext prefs = new AbstractPropertyContext(access, context.isStateful() ? ((StatefulContext)context).getProperties() : null, prefsInfo);
//
- AbstractPropertyContext prefs = new AbstractPropertyContext(access, propertyMap, prefsInfo);
-
- //
PortletInvocationResponse response;
try
{
- invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, PortletContext.createPortletContext(targetPortletId));
+ invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, PortletContext.createPortletContext(context.getPortletId()));
invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PREFERENCES_ATTRIBUTE, prefs);
invocation.setInfo(info);
@@ -256,15 +243,17 @@
if (access == AccessMode.CLONE_BEFORE_WRITE)
{
// Create the state
- if (state != null)
+ if (context.isStateful())
{
+ StatefulContext statefulContext = (StatefulContext)context;
boolean persist = stateManagementPolicy.persistLocally();
if (persist)
{
try
{
// The state id should be ok as it was used before to load the state
- String portletStateId = ((ProducerStateContext)state).getId();
+ LocalContext localContext = (LocalContext)statefulContext;
+ String portletStateId = localContext.getStateId();
String cloneStateId = persistenceManager.cloneState(portletStateId, newPrefs);
// Return the clone context
@@ -284,7 +273,7 @@
}
else
{
- PortletContext clonedCtx = marshall(state.getPortletId(), newPrefs);
+ PortletContext clonedCtx = marshall(context.getPortletId(), newPrefs);
StateEvent event = new StateEvent(clonedCtx, StateEvent.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
}
@@ -306,7 +295,7 @@
}
// Create the new state
- String cloneStateId = persistenceManager.createState(targetPortletId, newPrefs);
+ String cloneStateId = persistenceManager.createState(context.getPortletId(), newPrefs);
// Return the clone context
String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
@@ -317,13 +306,15 @@
}
else if (access == AccessMode.READ_WRITE)
{
- if (!(portletContext instanceof StatefulPortletContext))
+ StatefulContext statefulContext = (StatefulContext)context;
+ if (statefulContext.isLocal())
{
// Update the state
try
{
- String portletStateId = ((ProducerStateContext)state).getId();
- persistenceManager.updateState(portletStateId, newPrefs);
+ LocalContext localContext = (LocalContext)statefulContext;
+ String stateId = localContext.getStateId();
+ persistenceManager.updateState(stateId, newPrefs);
}
catch (NoSuchStateException e)
{
@@ -336,7 +327,7 @@
}
else
{
- PortletContext modifiedCtx = marshall(targetPortletId, newPrefs);
+ PortletContext modifiedCtx = marshall(context.getPortletId(), newPrefs);
StateEvent event = new StateEvent(modifiedCtx, StateEvent.PORTLET_MODIFIED_EVENT);
instanceCtx.onStateEvent(event);
}
@@ -344,7 +335,7 @@
else if (access == AccessMode.READ_ONLY)
{
throw new PortletStateChangeRequiredException("Modification was requested for portlet with id '"
- + targetPortletId + "' but access mode was READ ONLY.");
+ + context.getPortletId() + "' but access mode was READ ONLY.");
}
}
@@ -361,12 +352,13 @@
//
String portletId = portletContext.getId();
- ProducerState state = getProducerState(portletContext);
+ InternalPortletContext context = getStateContext(portletContext);
boolean useStore = stateManagementPolicy.persistLocally();
//
- if (state != null)
+ if (context.isStateful())
{
+ StatefulContext statefulContext = (StatefulContext)context;
if (useStore)
{
try
@@ -386,7 +378,7 @@
}
else
{
- return marshall(state.getPortletId(), state.getProperties());
+ return marshall(statefulContext.getPortletId(), statefulContext.getProperties());
}
}
else
@@ -478,17 +470,18 @@
//
String portletId = portletContext.getId();
- ProducerState state = getProducerState(portletContext);
+ InternalPortletContext context = getStateContext(portletContext);
//
- if (state != null)
+ if (context.isStateful())
{
- //
+ StatefulContext statefulContext = (StatefulContext)context;
+
// Get the content
- PropertyMap props = new SimplePropertyMap(state.getProperties());
+ PropertyMap props = new SimplePropertyMap(statefulContext.getProperties());
// Dereference the portlet
- String referencedPortletId = state.getPortletId();
+ String referencedPortletId = context.getPortletId();
// Get the container
Portlet referencedPortlet = portletInvoker.getPortlet(PortletContext.createPortletContext(referencedPortletId));
@@ -521,7 +514,7 @@
else
{
// Get the container
- return getPropertiesFromMetaData(portletId);
+ return getPropertiesFromMetaData(context.getPortletId());
}
}
@@ -546,16 +539,17 @@
//
String portletId = portletContext.getId();
- ProducerState state = getProducerState(portletContext);
+ InternalPortletContext context = getStateContext(portletContext);
//
- if (state == null)
+ if (context.isStateful() == false)
{
throw new InvalidPortletIdException("Cannot configure producer offered portlets", portletId);
}
+ StatefulContext statefulContext = (StatefulContext)context;
// Dereference the portlet
- String referencedPortletId = state.getPortletId();
+ String referencedPortletId = context.getPortletId();
// Get the container
Portlet referencedPortlet = portletInvoker.getPortlet(PortletContext.createPortletContext(referencedPortletId));
@@ -573,7 +567,7 @@
PreferencesInfo prefs = referencedPortletInfo.getPreferences();
// Clone the current state
- PropertyMap properties = new SimplePropertyMap(state.getProperties());
+ PropertyMap properties = new SimplePropertyMap(statefulContext.getProperties());
// Clone argument
for (int i = 0; i < changes.length; i++)
@@ -604,9 +598,10 @@
}
//
- if (!(portletContext instanceof StatefulPortletContext))
+ if (statefulContext.isLocal())
{
- String stateId = ((ProducerStateContext)state).getId();
+ LocalContext localContext = (LocalContext)statefulContext;
+ String stateId = localContext.getStateId();
try
{
persistenceManager.updateState(stateId, properties);
@@ -670,18 +665,17 @@
}
/**
- * Return the producer state from the specified portlet context or null if that portlet context reference a producer
- * offered portlet.
+ * Return an internal portlet context from the specified portlet context.
*
* @param portletContext the portlet context
* @return the state that the portlet context carries
* @throws NoSuchPortletException if the underlying state does not exist
* @throws InvalidPortletIdException if the state id is not valid
*/
- private ProducerState getProducerState(PortletContext portletContext) throws NoSuchPortletException, InvalidPortletIdException
+ private InternalPortletContext getStateContext(final PortletContext portletContext) throws NoSuchPortletException, InvalidPortletIdException
{
- byte[] state = portletContext.getState();
- if (state == null)
+ byte[] bytes = portletContext.getState();
+ if (bytes == null)
{
String portletId = portletContext.getId();
if (portletContext.getId().startsWith(PRODUCER_CLONE_ID_PREFIX))
@@ -689,7 +683,8 @@
String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
try
{
- return persistenceManager.loadState(stateId);
+ ProducerStateContext stateContext = persistenceManager.loadState(stateId);
+ return new LocalContext(stateContext.getState().getPortletId(), stateContext.getState().getProperties(), stateContext.getId());
}
catch (NoSuchStateException e)
{
@@ -702,14 +697,15 @@
}
else
{
- return null;
+ return new StatelessContext(portletContext.getId());
}
}
else
{
try
{
- return stateConverter.unmarshall(state);
+ final ProducerState state = stateConverter.unmarshall(bytes);
+ return new RemoteContext(state.getPortletId(), state.getProperties());
}
catch (StateConversionException e)
{
@@ -717,4 +713,132 @@
}
}
}
+
+ /**
+ * An internal portlet context that describe how the portlet was obtained.
+ */
+ private abstract static class InternalPortletContext
+ {
+
+ /** . */
+ private final String portletId;
+
+ /**
+ * @return true if the context represent a cloned portlet
+ */
+ public abstract boolean isStateful();
+
+ public InternalPortletContext(String portletId)
+ {
+ if (portletId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.portletId = portletId;
+ }
+
+ /**
+ * @return the portlet id in the context of the delegate
+ */
+ public String getPortletId()
+ {
+ return portletId;
+ }
+ }
+
+ /**
+ * Describe delegate portlets.
+ */
+ private static class StatelessContext extends InternalPortletContext
+ {
+ public StatelessContext(String portletId)
+ {
+ super(portletId);
+ }
+
+ public boolean isStateful()
+ {
+ return false;
+ }
+ }
+
+ /**
+ * A cloned portlet that points to a delegate portlet.
+ */
+ private abstract static class StatefulContext extends InternalPortletContext
+ {
+
+ /** . */
+ private final PropertyMap properties;
+
+ protected StatefulContext(String portletId, PropertyMap properties)
+ {
+ super(portletId);
+
+ //
+ if (properties == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.properties = properties;
+ }
+
+ /**
+ * @return true if the portlet is local
+ */
+ public abstract boolean isLocal();
+
+ public PropertyMap getProperties()
+ {
+ return properties;
+ }
+
+ public boolean isStateful()
+ {
+ return true;
+ }
+ }
+
+ private static class LocalContext extends StatefulContext
+ {
+
+ /** . */
+ private String stateId;
+
+ public LocalContext(String portletId, PropertyMap state, String stateId)
+ {
+ super(portletId, state);
+
+ //
+ if (stateId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.stateId = stateId;
+ }
+
+ public String getStateId()
+ {
+ return stateId;
+ }
+
+ public boolean isLocal()
+ {
+ return true;
+ }
+ }
+
+ private static class RemoteContext extends StatefulContext
+ {
+
+ public RemoteContext(String portletId, PropertyMap state)
+ {
+ super(portletId, state);
+ }
+
+ public boolean isLocal()
+ {
+ return false;
+ }
+ }
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java 2006-12-15 15:15:26 UTC (rev 5871)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerStateContext.java 2006-12-15 16:04:07 UTC (rev 5872)
@@ -22,46 +22,23 @@
******************************************************************************/
package org.jboss.portal.portlet.state.producer;
-import org.jboss.portal.portlet.state.PropertyMap;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
-public class ProducerStateContext extends ProducerState
+public interface ProducerStateContext
{
- /** . */
- private final String id;
+ /**
+ *
+ * @return
+ */
+ String getId();
- public ProducerStateContext(String id, String portletId)
- {
- super(portletId);
+ /**
+ *
+ * @return
+ */
+ ProducerState getState();
- //
- if (id == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- this.id = id;
- }
-
- public ProducerStateContext(String id, String portletId, PropertyMap properties)
- {
- super(portletId, properties);
-
- //
- if (id == null)
- {
- throw new IllegalArgumentException();
- }
- this.id = id;
- }
-
- public String getId()
- {
- return id;
- }
}
19 years, 4 months
JBoss Portal SVN: r5871 - in trunk/identity/src/main/org/jboss/portal/identity2: . db
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-15 10:15:26 -0500 (Fri, 15 Dec 2006)
New Revision: 5871
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/User.java
trunk/identity/src/main/org/jboss/portal/identity2/db/HibernateUserProfileModuleImpl.java
Log:
- correct User interface
Modified: trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java 2006-12-15 15:09:02 UTC (rev 5870)
+++ trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java 2006-12-15 15:15:26 UTC (rev 5871)
@@ -262,7 +262,7 @@
//moduleService.setIdentityContext(identityContext);
//register as an mbean
- if (isRegisterMBeans())
+ if (isRegisterMBeans() && (ds.getServiceName() != null))
{
getServer().registerMBean(datasource, new ObjectName(ds.getServiceName()));
}
@@ -342,7 +342,7 @@
//moduleService.setIdentityContext(identityContext);
//register as an mbean
- if (isRegisterMBeans())
+ if (isRegisterMBeans() && (module.getServiceName() != null))
{
getServer().registerMBean(moduleService, new ObjectName(module.getServiceName()));
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/User.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/User.java 2006-12-15 15:09:02 UTC (rev 5870)
+++ trunk/identity/src/main/org/jboss/portal/identity2/User.java 2006-12-15 15:15:26 UTC (rev 5871)
@@ -75,12 +75,6 @@
/** Set the password using proper encoding. */
public void updatePassword(String password);
- /** Set the password value directly */
- public void setPassword(String password);
-
- /** Returns password value */
- public String getPassword();
-
/** Return true if the password is valid. */
public boolean validatePassword(String password);
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/db/HibernateUserProfileModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/db/HibernateUserProfileModuleImpl.java 2006-12-15 15:09:02 UTC (rev 5870)
+++ trunk/identity/src/main/org/jboss/portal/identity2/db/HibernateUserProfileModuleImpl.java 2006-12-15 15:15:26 UTC (rev 5871)
@@ -61,6 +61,8 @@
private boolean acceptOtherImplementations = true;
+ private String defaultSynchronizePassword;
+
protected void startService() throws Exception
{
//
@@ -211,7 +213,11 @@
try
{
hu = new HibernateUserImpl(user.getUserName());
- user.updatePassword(user.getPassword());
+ //user.updatePassword(user.getPassword());
+ if (defaultSynchronizePassword != null)
+ {
+ user.updatePassword(getDefaultSynchronizePassword());
+ }
session = getCurrentSession();
session.save(hu);
return hu;
@@ -274,4 +280,15 @@
{
this.acceptOtherImplementations = acceptOtherImplementations;
}
+
+ public String getDefaultSynchronizePassword()
+ {
+ return defaultSynchronizePassword;
+ }
+
+ public void setDefaultSynchronizePassword(String defaultSynchronizePassword)
+ {
+ this.defaultSynchronizePassword = defaultSynchronizePassword;
+ }
}
+
19 years, 4 months
JBoss Portal SVN: r5870 - in trunk/identity/src/resources: . dtd test/config
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-12-15 10:09:02 -0500 (Fri, 15 Dec 2006)
New Revision: 5870
Added:
trunk/identity/src/resources/dtd/
trunk/identity/src/resources/dtd/identity-config_1_0.dtd
trunk/identity/src/resources/dtd/profile-config_1_0.dtd
Modified:
trunk/identity/src/resources/test/config/db-config.xml
trunk/identity/src/resources/test/config/opends-config.xml
trunk/identity/src/resources/test/config/profile-config.xml
trunk/identity/src/resources/test/config/rhds-config.xml
trunk/identity/src/resources/test/config/standardidentity-config.xml
Log:
- DTD files for identity configuration
Added: trunk/identity/src/resources/dtd/identity-config_1_0.dtd
===================================================================
--- trunk/identity/src/resources/dtd/identity-config_1_0.dtd 2006-12-15 03:35:00 UTC (rev 5869)
+++ trunk/identity/src/resources/dtd/identity-config_1_0.dtd 2006-12-15 15:09:02 UTC (rev 5870)
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!--
+<!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">
+-->
+
+<!--
+.
+-->
+<!ELEMENT identity-configuration (datasources,modules, options) >
+
+<!--
+.
+-->
+<!ELEMENT datasources (datasource*) >
+
+<!--
+.
+-->
+<!ELEMENT datasource (name, service-name?, class?, config) >
+
+<!--
+.
+-->
+<!ELEMENT name (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT service-name (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT class (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT config (option*)>
+
+<!--
+.
+-->
+<!ELEMENT option (name, value+) >
+
+<!--
+.
+-->
+<!ELEMENT value (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT modules (module*) >
+
+<!--
+.
+-->
+<!ELEMENT module (type, implementation, service-name?, class?, config) >
+
+<!--
+.
+-->
+<!ELEMENT type (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT implementation (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT options (option-group*)>
+
+<!--
+.
+-->
+<!ELEMENT option-group (group-name, option+)>
+
+<!--
+.
+-->
+<!ELEMENT group-name (#PCDATA) >
+
Added: trunk/identity/src/resources/dtd/profile-config_1_0.dtd
===================================================================
--- trunk/identity/src/resources/dtd/profile-config_1_0.dtd 2006-12-15 03:35:00 UTC (rev 5869)
+++ trunk/identity/src/resources/dtd/profile-config_1_0.dtd 2006-12-15 15:09:02 UTC (rev 5870)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!--
+<!DOCTYPE profile PUBLIC
+ "-//JBoss Portal//DTD JBoss User Profile Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/profile-config_1_0.dtd">
+-->
+
+
+<!--<profile>
+ --><!--Database mapping - jbp_user table column mapping--><!--
+ <property>
+ <name>portal.user.name.given</name>
+ <type>java.lang.String</type>
+ <access-mode>read-write</access-mode>
+ <usage>mandatory</usage>
+ <display-name xml:lang="en">Name</display-name>
+ <description xml:lang="en">The user name</description>
+ <mapping>
+ <database>
+ <type>column</type>
+ <value>jbp_username</value>
+ </database>
+ </mapping>
+ </property>-->
+
+<!--
+.
+-->
+<!ELEMENT profile (property+) >
+
+<!--
+.
+-->
+<!ELEMENT property (name, type, access-mode, usage, display-name, description, mapping>
+
+<!--
+.
+-->
+<!ELEMENT name (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT type (#PCDATA)>
+
+<!--
+.
+-->
+<!ELEMENT access-mode (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT usage (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT display-name (#PCDATA) >
+
+<!ATTLIST display-name
+ xml:lang #PCDATA>
+
+<!--
+.
+-->
+<!ELEMENT description (#PCDATA) >
+
+<!ATTLIST description
+ xml:lang #PCDATA>
+<!--
+.
+-->
+<!ELEMENT mapping (database?, ldap?) >
+
+<!--
+.
+-->
+<!ELEMENT database (type, value) >
+
+<!--
+.
+-->
+<!ELEMENT type (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT value (#PCDATA) >
+
+<!--
+.
+-->
+<!ELEMENT ldap (value) >
+
+
+
+
Modified: trunk/identity/src/resources/test/config/db-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/db-config.xml 2006-12-15 03:35:00 UTC (rev 5869)
+++ trunk/identity/src/resources/test/config/db-config.xml 2006-12-15 15:09:02 UTC (rev 5870)
@@ -21,6 +21,11 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+ <!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">
+
<identity-configuration>
<datasources>
<!--in tests Hibernate SF is created separately-->
@@ -66,4 +71,5 @@
<config/>
</module>
</modules>
+ <options/>
</identity-configuration>
\ No newline at end of file
Modified: trunk/identity/src/resources/test/config/opends-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/opends-config.xml 2006-12-15 03:35:00 UTC (rev 5869)
+++ trunk/identity/src/resources/test/config/opends-config.xml 2006-12-15 15:09:02 UTC (rev 5870)
@@ -21,6 +21,11 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+ <!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">
+
<identity-configuration>
<datasources>
<datasource>
Modified: trunk/identity/src/resources/test/config/profile-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/profile-config.xml 2006-12-15 03:35:00 UTC (rev 5869)
+++ trunk/identity/src/resources/test/config/profile-config.xml 2006-12-15 15:09:02 UTC (rev 5870)
@@ -21,6 +21,11 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+ <!DOCTYPE profile PUBLIC
+ "-//JBoss Portal//DTD JBoss User Profile Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/profile-config_1_0.dtd">
+
<profile>
<!--Database mapping - jbp_user table column mapping-->
<property>
Modified: trunk/identity/src/resources/test/config/rhds-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/rhds-config.xml 2006-12-15 03:35:00 UTC (rev 5869)
+++ trunk/identity/src/resources/test/config/rhds-config.xml 2006-12-15 15:09:02 UTC (rev 5870)
@@ -21,6 +21,11 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+ <!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">
+
<identity-configuration>
<datasources>
<datasource>
@@ -91,6 +96,7 @@
<module>
<type>ConnectionContext</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
</modules>
<options>
Modified: trunk/identity/src/resources/test/config/standardidentity-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-12-15 03:35:00 UTC (rev 5869)
+++ trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-12-15 15:09:02 UTC (rev 5870)
@@ -21,6 +21,12 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+
+<!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">
+
<identity-configuration>
<datasources>
<datasource>
19 years, 4 months
JBoss Portal SVN: r5869 - trunk/core/src/resources/portal-core-sar/conf/data
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2006-12-14 22:35:00 -0500 (Thu, 14 Dec 2006)
New Revision: 5869
Modified:
trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
Log:
removing the cms page from default-object.xml
Modified: trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2006-12-15 02:59:56 UTC (rev 5868)
+++ trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2006-12-15 03:35:00 UTC (rev 5869)
@@ -408,83 +408,5 @@
</policy-permission>
</security-constraint>
</portal>
- </deployment>
-
-
- <!-- cms administration tool page with the fine grained access control integrated -->
- <deployment>
- <parent-ref/>
- <if-exists>keep</if-exists>
- <portal>
- <portal-name>cms</portal-name>
- <properties>
- <!--
- | Set the layout for the default portal, see also portal-layouts.xml.
- -->
- <property>
- <name>layout.id</name>
- <value>generic</value>
- </property>
- <!--
- | Set the theme for the default portal, see also portal-themes.xml.
- -->
- <property>
- <name>theme.id</name>
- <value>renaissance</value>
- </property>
- <!--
- | Set the default render set name (used by the render tag in layouts), see also portal-renderSet.xml
- -->
- <property>
- <name>theme.renderSetId</name>
- <value>divRenderer</value>
- </property>
- <!--
- | Set the default strategy name (used by the strategy interceptor), see also portal-strategies.xml
- -->
- <property>
- <name>layout.strategyId</name>
- <value>maximizedRegion</value>
- </property>
- <!--
- | The default page name, if the property is not explicited then the default page name is "default"
- -->
- <property>
- <name>portal.defaultObjectName</name>
- <value>default</value>
- </property>
- </properties>
- <supported-modes>
- <mode>view</mode>
- <mode>edit</mode>
- <mode>help</mode>
- </supported-modes>
- <supported-window-states>
- <window-state>normal</window-state>
- <window-state>minimized</window-state>
- <window-state>maximized</window-state>
- </supported-window-states>
- <page>
- <page-name>default</page-name>
- <window>
- <window-name>CMSAdminPortletWindow</window-name>
- <instance-ref>CMSAdminPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- <window>
- <window-name>JSPPortletWindow</window-name>
- <instance-ref>JSPPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>UserPortletWindow</window-name>
- <instance-ref>UserPortletInstance</instance-ref>
- <region>left</region>
- <height>1</height>
- </window>
- </page>
- </portal>
- </deployment>
+ </deployment>
</deployments>
19 years, 4 months