JBoss Portal SVN: r6915 - in trunk: server and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-04 07:38:41 -0400 (Wed, 04 Apr 2007)
New Revision: 6915
Added:
trunk/server/src/main/org/jboss/portal/server/aspects/LockInterceptor.java
trunk/server/src/main/org/jboss/portal/server/aspects/server/SessionLockInterceptor.java
Removed:
trunk/server/src/main/org/jboss/portal/server/aspects/server/NavigationInterceptor.java
Modified:
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/server/build.xml
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java
Log:
adding a server interceptor that perform request locking based on the provided jsessionid in order to avoid concurrent modifications of the same session state.
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 2007-04-04 10:43:17 UTC (rev 6914)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-04 11:38:41 UTC (rev 6915)
@@ -94,6 +94,13 @@
<!-- Server stack -->
<mbean
+ code="org.jboss.portal.server.aspects.server.SessionLockInterceptor"
+ name="portal:service=Interceptor,type=Server,name=SessionLock"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
code="org.jboss.portal.core.aspects.server.TransactionInterceptor"
name="portal:service=Interceptor,type=Server,name=Transaction"
xmbean-dd=""
@@ -144,6 +151,7 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends-list optional-attribute-name="InterceptorNames">
+ <depends-list-element>portal:service=Interceptor,type=Server,name=SessionLock</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=Transaction</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=UserEvent</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=SessionInvalidator</depends-list-element>
Modified: trunk/server/build.xml
===================================================================
--- trunk/server/build.xml 2007-04-04 10:43:17 UTC (rev 6914)
+++ trunk/server/build.xml 2007-04-04 11:38:41 UTC (rev 6915)
@@ -102,6 +102,7 @@
<path refid="junit.junit.classpath"/>
<path refid="jboss.test.classpath"/>
<path refid="sun.servlet.classpath"/>
+ <path refid="jboss/backport.concurrent.classpath"/>
<pathelement location="jboss-bean-deployer.jar"/>
<pathelement location="jboss-container.jar"/>
<pathelement location="jboss-dependency.jar"/>
Added: trunk/server/src/main/org/jboss/portal/server/aspects/LockInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/LockInterceptor.java (rev 0)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/LockInterceptor.java 2007-04-04 11:38:41 UTC (rev 6915)
@@ -0,0 +1,143 @@
+/******************************************************************************
+ * 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.server.aspects;
+
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.common.invocation.Invocation;
+
+import edu.emory.mathcs.backport.java.util.concurrent.locks.Lock;
+import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class LockInterceptor implements Interceptor
+{
+
+ /** . */
+ private Map map = new HashMap();
+
+ /** . */
+ private Lock mapLock = new ReentrantLock();
+
+ public static class InternalLock
+ {
+
+ /** . */
+ private final Object id;
+
+ /** . */
+ private final Lock lock = new ReentrantLock();
+
+ /** . */
+ private int waiters = 0;
+
+ public InternalLock(Object id)
+ {
+ this.id = id;
+ }
+
+ Object invoke(Invocation invocation) throws Exception, InvocationException
+ {
+ lock.lock();
+ try
+ {
+ return invocation.invokeNext();
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+ }
+
+ protected InternalLock acquire(Object lockId)
+ {
+ mapLock.lock();
+ try
+ {
+ InternalLock lock;
+ if (map.containsKey(lockId))
+ {
+ lock = (InternalLock)map.get(lockId);
+ }
+ else
+ {
+ lock = new InternalLock(lockId);
+ map.put(lockId, lock);
+ }
+ lock.waiters++;
+ return lock;
+ }
+ finally
+ {
+ mapLock.unlock();
+ }
+ }
+
+ protected void release(InternalLock internalLock)
+ {
+ mapLock.lock();
+ try
+ {
+ if (--internalLock.waiters == 0)
+ {
+ map.remove(internalLock.id);
+ }
+ }
+ finally
+ {
+ mapLock.unlock();
+ }
+ }
+
+ protected abstract Object getLockId(Invocation invocation);
+
+ public Object invoke(Invocation invocation) throws Exception, InvocationException
+ {
+ Object lockId = getLockId(invocation);
+
+ //
+ if (lockId != null)
+ {
+ InternalLock internalLock = acquire(lockId);
+ try
+ {
+ return internalLock.invoke(invocation);
+ }
+ finally
+ {
+ release(internalLock);
+ }
+ }
+ else
+ {
+ return invocation.invokeNext();
+ }
+ }
+}
Deleted: trunk/server/src/main/org/jboss/portal/server/aspects/server/NavigationInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/server/NavigationInterceptor.java 2007-04-04 10:43:17 UTC (rev 6914)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/server/NavigationInterceptor.java 2007-04-04 11:38:41 UTC (rev 6915)
@@ -1,31 +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.server.aspects.server;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationInterceptor
-{
-}
Added: trunk/server/src/main/org/jboss/portal/server/aspects/server/SessionLockInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/server/SessionLockInterceptor.java (rev 0)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/server/SessionLockInterceptor.java 2007-04-04 11:38:41 UTC (rev 6915)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.server.aspects.server;
+
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.aspects.LockInterceptor;
+import org.jboss.portal.common.invocation.Invocation;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SessionLockInterceptor extends LockInterceptor
+{
+ protected Object getLockId(Invocation invocation)
+ {
+ ServerInvocation si = (ServerInvocation)invocation;
+
+ //
+ HttpServletRequest req = si.getServerContext().getClientRequest();
+
+ // We lock only if the client provides a session id
+ return req.getRequestedSessionId();
+ }
+}
Modified: trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java 2007-04-04 10:43:17 UTC (rev 6914)
+++ trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java 2007-04-04 11:38:41 UTC (rev 6915)
@@ -38,6 +38,11 @@
/** . */
private final Interceptor[] interceptors;
+ public JBossInterceptorStack(Interceptor interceptor)
+ {
+ this.interceptors = new Interceptor[]{interceptor};
+ }
+
public JBossInterceptorStack(Interceptor[] interceptors)
{
if (interceptors == null)
17 years, 3 months
JBoss Portal SVN: r6914 - in trunk: widget and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-04-04 06:43:17 -0400 (Wed, 04 Apr 2007)
New Revision: 6914
Modified:
trunk/testsuite/build.xml
trunk/widget/build.xml
Log:
- plug into testsuite
Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml 2007-04-04 10:32:31 UTC (rev 6913)
+++ trunk/testsuite/build.xml 2007-04-04 10:43:17 UTC (rev 6914)
@@ -157,6 +157,9 @@
<antcall target="internal-test-module">
<param name="module" value="core"/>
</antcall>
+ <antcall target="internal-test-module">
+ <param name="module" value="widget"/>
+ </antcall>
<antcall target="agent-undeploy"/>
</sequential>
<server:stop name="default"/>
Modified: trunk/widget/build.xml
===================================================================
--- trunk/widget/build.xml 2007-04-04 10:32:31 UTC (rev 6913)
+++ trunk/widget/build.xml 2007-04-04 10:43:17 UTC (rev 6914)
@@ -248,15 +248,9 @@
<x-classpath>
<pathelement location="${build.lib}/widget-lib.jar"/>
<pathelement location="${build.resources}/test"/>
- <pathelement location="${build.resources}"/>
- <!--temp-->
- <!--<pathelement location="/home/bdaw/Workshop/libs/mysql-connector-java-5.0.4/mysql-connector-java-5.0.4-bin.jar"/>-->
-
-
<path refid="beanshell.beanshell.classpath"/>
<path refid="apache.commons.classpath"/>
- <path refid="sun.opends.classpath"/>
<path refid="dom4j.dom4j.classpath"/>
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
@@ -264,7 +258,6 @@
<path refid="oswego.concurrent.classpath"/>
<path refid="apache.logging.classpath"/>
<path refid="apache.log4j.classpath"/>
- <path refid="hibernate.hibernate.classpath"/>
<path refid="antlr.antlr.classpath"/>
<path refid="asm.asm.classpath"/>
<path refid="apache.collections.classpath"/>
@@ -275,7 +268,6 @@
<path refid="jboss.portal-test.classpath"/>
<path refid="jboss.portal-common.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
- <path refid="sleepycat.sleepycat.classpath"/>
<path refid="sun.jaf.classpath"/>
</x-classpath>
</execute-tests>
17 years, 3 months
JBoss Portal SVN: r6913 - in trunk/widget: src/main/org/jboss/portal and 7 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-04-04 06:32:31 -0400 (Wed, 04 Apr 2007)
New Revision: 6913
Added:
trunk/widget/src/main/org/jboss/portal/test/
trunk/widget/src/main/org/jboss/portal/test/widget/
trunk/widget/src/main/org/jboss/portal/test/widget/google/
trunk/widget/src/main/org/jboss/portal/test/widget/google/PreferencesTestCase.java
trunk/widget/src/resources/test/
trunk/widget/src/resources/test/google/
trunk/widget/src/resources/test/google/gadget1.xml
trunk/widget/src/resources/test/google/gadget2.xml
Modified:
trunk/widget/build.xml
trunk/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetBuilder.java
Log:
- startup for widgets tests
- tiny bugfix
Modified: trunk/widget/build.xml
===================================================================
--- trunk/widget/build.xml 2007-04-03 15:21:57 UTC (rev 6912)
+++ trunk/widget/build.xml 2007-04-04 10:32:31 UTC (rev 6913)
@@ -91,6 +91,7 @@
<path refid="jbossas/core.libs.classpath"/>
<path refid="jboss/backport.concurrent.classpath"/>
<path refid="apache.log4j.classpath"/>
+ <path refid="junit.junit.classpath"/>
</path>
<!-- Configure modules -->
@@ -220,4 +221,64 @@
<delete file="${jboss.home}/server/${portal.deploy.dir}/widget.war"/>
</target>
+ <target name="package-tests" depends="init, output">
+ <!--Empty for now-->
+ <!--<jar jarfile="${build.lib}/portal-widget-test-lib.jar">
+ <fileset dir="${build.classes}" includes="org/jboss/portal/test/**"/>
+ <fileset dir="${build.resources}/portal-widget-test-jar"/>
+ </jar>-->
+
+ </target>
+
+ <target name="tests" depends="init, package-tests">
+ <property name="proto-libs" value="${project.root}/proto-libs"/>
+ <execute-tests>
+<!--
+
+ <x-sysproperty>
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
+ </x-sysproperty>
+-->
+
+
+ <x-test>
+ <test todir="${test.reports}" name="org.jboss.portal.test.widget.google.PreferencesTestCase"/>
+ </x-test>
+ <x-classpath>
+ <pathelement location="${build.lib}/widget-lib.jar"/>
+ <pathelement location="${build.resources}/test"/>
+ <pathelement location="${build.resources}"/>
+
+ <!--temp-->
+ <!--<pathelement location="/home/bdaw/Workshop/libs/mysql-connector-java-5.0.4/mysql-connector-java-5.0.4-bin.jar"/>-->
+
+
+ <path refid="beanshell.beanshell.classpath"/>
+ <path refid="apache.commons.classpath"/>
+ <path refid="sun.opends.classpath"/>
+ <path refid="dom4j.dom4j.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
+ <path refid="jboss.jbossxb.classpath"/>
+ <path refid="apache.xerces.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="apache.logging.classpath"/>
+ <path refid="apache.log4j.classpath"/>
+ <path refid="hibernate.hibernate.classpath"/>
+ <path refid="antlr.antlr.classpath"/>
+ <path refid="asm.asm.classpath"/>
+ <path refid="apache.collections.classpath"/>
+ <path refid="jbossas/core.libs.classpath"/>
+ <path refid="junit.junit.classpath"/>
+ <path refid="apache.logging.classpath"/>
+ <path refid="cglib.cglib.classpath"/>
+ <path refid="jboss.portal-test.classpath"/>
+ <path refid="jboss.portal-common.classpath"/>
+ <path refid="jboss.portal-jems.classpath"/>
+ <path refid="sleepycat.sleepycat.classpath"/>
+ <path refid="sun.jaf.classpath"/>
+ </x-classpath>
+ </execute-tests>
+ </target>
+
</project>
Added: trunk/widget/src/main/org/jboss/portal/test/widget/google/PreferencesTestCase.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/test/widget/google/PreferencesTestCase.java (rev 0)
+++ trunk/widget/src/main/org/jboss/portal/test/widget/google/PreferencesTestCase.java 2007-04-04 10:32:31 UTC (rev 6913)
@@ -0,0 +1,159 @@
+/*
+* 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.widget.google;
+
+import junit.framework.TestCase;
+import org.jboss.portal.widget.google.provider.GGWidgetBuilder;
+import org.jboss.portal.widget.google.GGWidget;
+import org.jboss.portal.widget.google.GGPreferencesInfo;
+import org.jboss.portal.widget.google.GGPreferenceInfo;
+import org.jboss.portal.widget.google.type.DataType;
+import org.jboss.portal.widget.google.type.EnumType;
+import org.jboss.portal.common.util.Tools;
+
+import java.net.URL;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class PreferencesTestCase extends TestCase
+{
+ public void testModulePrefs() throws Exception
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ URL url = tcl.getResource("google/gadget1.xml");
+
+ GGWidgetBuilder ggwb = constructBuilder(url);
+ GGWidget ggw = ggwb.create();
+
+ assertNotNull(ggw);
+ assertEquals("TestTitle",ggw.getTitle().getDefaultString());
+ assertEquals("TestDescription",ggw.getDescription().getDefaultString());
+ }
+
+ public void testUserPrefs() throws Exception
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ URL url = tcl.getResource("google/gadget2.xml");
+
+ GGWidgetBuilder ggwb = constructBuilder(url);
+ GGWidget ggw = ggwb.create();
+
+ assertNotNull(ggw);
+
+ GGPreferencesInfo prefs = ggw.getPreferencesInfo();
+
+ // String
+ GGPreferenceInfo pi = prefs.getPreferenceInfo("testString");
+ assertNotNull(pi);
+ assertEquals("testString", pi.getName());
+ assertEquals("Test String", pi.getDisplayName());
+ assertEquals("testStringDefaultValue", pi.getDefaultValue());
+ assertEquals(DataType.STRING, pi.getType().getOrdinal());
+
+ // Default
+ pi = prefs.getPreferenceInfo("testDefault");
+ assertNotNull(pi);
+ assertEquals("testDefault", pi.getName());
+ assertEquals("Test Default", pi.getDisplayName());
+ assertEquals("testDefaultValue", pi.getDefaultValue());
+ assertEquals(DataType.STRING, pi.getType().getOrdinal());
+
+ // Required
+ pi = prefs.getPreferenceInfo("testRequired");
+ assertNotNull(pi);
+ assertEquals("testRequired", pi.getName());
+ assertEquals("Test Required", pi.getDisplayName());
+ assertEquals("testRequiredDefaultValue", pi.getDefaultValue());
+ assertEquals(DataType.STRING, pi.getType().getOrdinal());
+ assertTrue(pi.isRequired());
+
+ // Enum
+ pi = prefs.getPreferenceInfo("testEnum");
+ assertNotNull(pi);
+ assertEquals("testEnum", pi.getName());
+ assertEquals("Test Enum", pi.getDisplayName());
+ //assertEquals("testDefaultValue", pi.getDefaultValue());
+ assertEquals(DataType.ENUM, pi.getType().getOrdinal());
+ EnumType enumer = (EnumType)pi.getType();
+ assertEquals(3, enumer.getSize());
+ assertEquals("1", enumer.getValue(0).getValue());
+ assertEquals("enumOne", enumer.getValue(0).getDisplayValue());
+ assertEquals("2", enumer.getValue(1).getValue());
+ assertEquals("enumTwo", enumer.getValue(1).getDisplayValue());
+ assertEquals("3", enumer.getValue(2).getValue());
+ assertEquals("enumThree", enumer.getValue(2).getDisplayValue());
+
+ // Bool
+ pi = prefs.getPreferenceInfo("testBool");
+ assertNotNull(pi);
+ assertEquals("testBool", pi.getName());
+ assertEquals("Test Bool", pi.getDisplayName());
+ assertEquals("testBoolDefaultValue", pi.getDefaultValue());
+ assertEquals(DataType.BOOL, pi.getType().getOrdinal());
+
+ // Hidden
+ pi = prefs.getPreferenceInfo("testHidden");
+ assertNotNull(pi);
+ assertEquals("testHidden", pi.getName());
+ assertEquals("Test Hidden", pi.getDisplayName());
+ assertEquals("testHiddenDefaultValue", pi.getDefaultValue());
+ assertEquals(DataType.HIDDEN, pi.getType().getOrdinal());
+
+ // List
+ pi = prefs.getPreferenceInfo("testList");
+ assertNotNull(pi);
+ assertEquals("testList", pi.getName());
+ assertEquals("Test List", pi.getDisplayName());
+ assertEquals("one|two|three|four|five", pi.getDefaultValue());
+ assertEquals(DataType.LIST, pi.getType().getOrdinal());
+
+
+
+
+
+ }
+
+ public GGWidgetBuilder constructBuilder(URL url) throws Exception
+ {
+ return new GGWidgetBuilder(url)
+ {
+ protected byte[] obtainWidget(URL url) throws Exception
+ {
+ File file = new File(url.getPath());
+ InputStream io = new FileInputStream(file);
+ byte[] bytes = Tools.getBytes(io);
+ io.close();
+ return bytes;
+ }
+ };
+ }
+
+
+
+
+}
Modified: trunk/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetBuilder.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetBuilder.java 2007-04-03 15:21:57 UTC (rev 6912)
+++ trunk/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetBuilder.java 2007-04-04 10:32:31 UTC (rev 6913)
@@ -52,7 +52,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-class GGWidgetBuilder implements ObjectLoader
+public class GGWidgetBuilder implements ObjectLoader
{
/** . */
@@ -92,7 +92,7 @@
{
DocumentBuilderFactory factory = XML.getDocumentBuilderFactory();
DocumentBuilder builder = factory.newDocumentBuilder();
- byte[] bytes = URLTools.performGET(url, 5000, 5000);
+ byte[] bytes = obtainWidget(url);
if (bytes == null)
{
throw new Exception("Cannot retrieve document " + url);
@@ -107,7 +107,7 @@
{
Element userPref = (Element)userPrefsEltIterator.next();
String nameAttr = userPref.getAttribute("name");
- String displayNameAttr = userPref.getAttribute("displayName");
+ String displayNameAttr = userPref.getAttribute("display_name");
String urlParamAttr = userPref.getAttribute("urlparam");
String dataTypeAttr = userPref.getAttribute("datatype");
String requiredAttr = userPref.getAttribute("required");
@@ -200,4 +200,9 @@
throw new Exception(); // Basic for now
}
}
+
+ protected byte[] obtainWidget(URL url) throws Exception
+ {
+ return URLTools.performGET(url, 5000, 5000);
+ }
}
Added: trunk/widget/src/resources/test/google/gadget1.xml
===================================================================
--- trunk/widget/src/resources/test/google/gadget1.xml (rev 0)
+++ trunk/widget/src/resources/test/google/gadget1.xml 2007-04-04 10:32:31 UTC (rev 6913)
@@ -0,0 +1,16 @@
+<Module>
+ <ModulePrefs title="TestTitle" height="500" scaling="false" directory_title="TestDirectoryTitle"
+ author_location="TestAuthorLocation" title_url="TestURL"
+ screenshot="TestScreenshot"
+ thumbnail="TestThumbnail"
+ description="TestDescription"
+ author="TestAuthor" author_email="TestAuthorEmail"
+ author_affiliation="TestAuthorAffiliation"/>
+ <UserPref>
+
+ </UserPref>
+ <UserPref>
+
+ </UserPref>
+ <Content/>
+</Module>
\ No newline at end of file
Added: trunk/widget/src/resources/test/google/gadget2.xml
===================================================================
--- trunk/widget/src/resources/test/google/gadget2.xml (rev 0)
+++ trunk/widget/src/resources/test/google/gadget2.xml 2007-04-04 10:32:31 UTC (rev 6913)
@@ -0,0 +1,46 @@
+<Module>
+ <ModulePrefs title="TestTitle" height="500" scaling="false" directory_title="TestDirectoryTitle"
+ author_location="TestAuthorLocation" title_url="TestURL"
+ screenshot="TestScreenshot"
+ thumbnail="TestThumbnail"
+ description="TestDescription"
+ author="TestAuthor" author_email="TestAuthorEmail"
+ author_affiliation="TestAuthorAffiliation"/>
+ <UserPref name="testString"
+ display_name="Test String"
+ datatype="string"
+ default_value="testStringDefaultValue"/>
+ <UserPref name="testDefault"
+ display_name="Test Default"
+ default_value="testDefaultValue"/>
+ <UserPref name="testRequired"
+ display_name="Test Required"
+ datatype="string"
+ required="true"
+ default_value="testRequiredDefaultValue"/>
+ <UserPref name="testEnum"
+ display_name="Test Enum"
+ datatype="enum"
+ default_value="2">
+ <EnumValue value="1" display_value="enumOne"/>
+ <EnumValue value="2" display_value="enumTwo"/>
+ <EnumValue value="3" display_value="enumThree"/>
+ </UserPref>
+ <UserPref name="testBool"
+ display_name="Test Bool"
+ datatype="bool"
+ default_value="testBoolDefaultValue"/>
+ <UserPref name="testHidden"
+ display_name="Test Hidden"
+ datatype="hidden"
+ default_value="testHiddenDefaultValue"/>
+ <UserPref name="testList"
+ display_name="Test List"
+ datatype="list"
+ default_value="one|two|three|four|five"/>
+ <UserPref name="testLocation"
+ display_name="Test Location"
+ datatype="location"
+ default_value="1 1"/>
+ <Content/>
+</Module>
\ No newline at end of file
17 years, 3 months
JBoss Portal SVN: r6912 - in trunk: core/src/main/org/jboss/portal/core/controller/command/info and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-03 11:21:57 -0400 (Tue, 03 Apr 2007)
New Revision: 6912
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/info/ActionCommandInfo.java
trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java
trunk/core/src/main/org/jboss/portal/core/controller/command/info/ViewCommandInfo.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/ImportPageToDashboardCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java
Log:
- remove obsolete command info fields
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -38,7 +38,7 @@
{
/** . */
- private static final CommandInfo info = new ActionCommandInfo(false, "view", false);
+ private static final CommandInfo info = new ActionCommandInfo(false);
/** . */
private String location;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/info/ActionCommandInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/info/ActionCommandInfo.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/info/ActionCommandInfo.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -32,13 +32,16 @@
/** . */
private final boolean idempotent;
- public ActionCommandInfo(boolean secured, String action, boolean idempotent)
+ public ActionCommandInfo(boolean idempotent)
{
- super(secured, action);
this.idempotent = idempotent;
}
- /** Return true if the command is idempotent, i.e it can be reinvoked again safely. */
+ /**
+ * Return true if the command is idempotent, i.e it can be reinvoked again safely.
+ *
+ * @return the idempotency of the command
+ */
public boolean isIdempotent()
{
return idempotent;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -31,33 +31,7 @@
public abstract class CommandInfo
{
- /** . */
- private final boolean secured;
-
- /** . */
- private final String action;
-
- public CommandInfo(boolean secured, String action)
+ public CommandInfo()
{
- this.secured = secured;
- this.action = action;
}
-
- /**
- * Is this command a secured command? If so, access rights to this command will be enforced via a security policy.
- * <p>The default returns false. Extending command classes need to set the <code>isSecured</code> member variable to
- * true in the command's constructor if they want to enforce access right checks for the command.</p>
- *
- * @return true if this command requires security checks
- */
- public boolean isSecured()
- {
- return secured;
- }
-
- /** @return the associated action of this command for security checks (is the user allowed to call this action...). */
- public String getAction()
- {
- return action;
- }
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/info/ViewCommandInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/info/ViewCommandInfo.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/info/ViewCommandInfo.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -28,8 +28,8 @@
*/
public class ViewCommandInfo extends CommandInfo
{
- public ViewCommandInfo(boolean secured, String action)
+ public ViewCommandInfo()
{
- super(secured, action);
+ super();
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/ImportPageToDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/ImportPageToDashboardCommand.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/ImportPageToDashboardCommand.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -43,7 +43,7 @@
{
/** . */
- private static final CommandInfo info = new ActionCommandInfo(true, "view", false);
+ private static final CommandInfo info = new ActionCommandInfo(false);
/** . */
private Portal dashboardPortal;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -53,7 +53,7 @@
private static final Logger log = Logger.getLogger(InvokePortletWindowActionCommand.class);
/** . */
- private static final CommandInfo info = new ActionCommandInfo(false, "view", false);
+ private static final CommandInfo info = new ActionCommandInfo(false);
/** . */
private StateString navigationalState;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -43,7 +43,7 @@
public class InvokePortletWindowRenderCommand extends InvokeWindowCommand
{
- private static final CommandInfo info = new ViewCommandInfo(false, "view");
+ private static final CommandInfo info = new ViewCommandInfo();
/** . */
protected final StateString navigationalState;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -40,7 +40,7 @@
{
/** . */
- private static final CommandInfo info = new ActionCommandInfo(false, "view", false);
+ private static final CommandInfo info = new ActionCommandInfo(false);
/** . */
private int fromPos;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -71,7 +71,7 @@
{
/** . */
- private static final CommandInfo info = new ViewCommandInfo(false, "view");
+ private static final CommandInfo info = new ViewCommandInfo();
/** The windows to render. */
private Collection windows;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -59,7 +59,7 @@
public static final String SHOW = "show";
/** . */
- private static final CommandInfo info = new ViewCommandInfo(true, "view");
+ private static final CommandInfo info = new ViewCommandInfo();
public RenderWindowCommand(PortalObjectId windowId)
throws IllegalArgumentException
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -42,7 +42,7 @@
{
/** . */
- private static final CommandInfo info = new ViewCommandInfo(false, "view");
+ private static final CommandInfo info = new ViewCommandInfo();
/** . */
private Portal dashboardPortal;
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java 2007-04-03 15:18:26 UTC (rev 6911)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java 2007-04-03 15:21:57 UTC (rev 6912)
@@ -49,7 +49,7 @@
public class StreamContentCommand extends ControllerCommand
{
- private static final CommandInfo info = new ViewCommandInfo(false, null);
+ private static final CommandInfo info = new ViewCommandInfo();
private String path;
17 years, 3 months
JBoss Portal SVN: r6911 - in trunk: theme/src/bin/portal-ajax-war/js/portal and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-03 11:18:26 -0400 (Tue, 03 Apr 2007)
New Revision: 6911
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/JSONMarshaller.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/response/UpdatePageStateResponse.java
Log:
- piggy back view state to client
- make ajax POST execute in a blocking manner
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03 13:34:24 UTC (rev 6910)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03 15:18:26 UTC (rev 6911)
@@ -367,7 +367,7 @@
PageResult res = new PageResult(page.getName(), page.getProperties(), portal.getProperties());
//
- UpdatePageStateResponse updatePage = new UpdatePageStateResponse();
+ UpdatePageStateResponse updatePage = new UpdatePageStateResponse(ctx.getViewId());
//
for (Iterator i = windowToRefresh.iterator();i.hasNext();)
Modified: trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js
===================================================================
--- trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js 2007-04-03 13:34:24 UTC (rev 6910)
+++ trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js 2007-04-03 15:18:26 UTC (rev 6911)
@@ -100,9 +100,12 @@
// of a post, the parameters will be appended to the body of the query which
// will lead to a non correct request
+ // If we process a form then we will perform a blocking interaction
+ var asynchronous = !form;
+
//
var options = {
- asynchronous:true,
+ asynchronous:asynchronous,
method: method,
postBody: body,
requestHeaders:headers,
@@ -127,6 +130,9 @@
markupContainer.innerHTML = markup;
}
}
+
+ // update view state
+ view_state = resp.view_state;
}
else if (resp.type == "update_page")
{
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/JSONMarshaller.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/JSONMarshaller.java 2007-04-03 13:34:24 UTC (rev 6910)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/JSONMarshaller.java 2007-04-03 15:18:26 UTC (rev 6911)
@@ -54,6 +54,7 @@
//
writer.key("type").value("update_markup");
+ writer.key("view_state").value(umr.getViewState());
//
writer.key("fragments").object();
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/response/UpdatePageStateResponse.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/response/UpdatePageStateResponse.java 2007-04-03 13:34:24 UTC (rev 6910)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/response/UpdatePageStateResponse.java 2007-04-03 15:18:26 UTC (rev 6911)
@@ -38,11 +38,20 @@
/** . */
private Map fragments;
- public UpdatePageStateResponse()
+ /** . */
+ private String viewState;
+
+ public UpdatePageStateResponse(String viewState)
{
- fragments = new HashMap();
+ this.viewState = viewState;
+ this.fragments = new HashMap();
}
+ public String getViewState()
+ {
+ return viewState;
+ }
+
public void addFragment(String id, String fragment)
{
fragments.put(id, fragment);
17 years, 3 months
JBoss Portal SVN: r6910 - in trunk: core/src/main/org/jboss/portal/core/controller/classic and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-03 09:34:24 -0400 (Tue, 03 Apr 2007)
New Revision: 6910
Removed:
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js
Log:
started to add support for ajax action URLs
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03 13:10:49 UTC (rev 6909)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03 13:34:24 UTC (rev 6910)
@@ -26,7 +26,9 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.Controller;
+import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
import org.jboss.portal.core.controller.classic.HandlerResponse;
+import org.jboss.portal.core.controller.classic.CommandForward;
import org.jboss.portal.core.model.portal.command.MoveWindowCommand;
import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
@@ -59,6 +61,9 @@
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.StateString;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletException;
@@ -204,21 +209,55 @@
// else
// {
// }
- AjaxResponse ar = (AjaxResponse)handlerResp;
- ar.sendResponse(controllerContext.getServerInvocation().getServerContext());
+
+ if (handlerResp instanceof CommandForward)
+ {
+ CommandForward forward = (CommandForward)handlerResp;
+// URLContext urlContext = ctx.getServerInvocation().getServerContext().getURLContext();
+// if (requiresRedirect(cmd, urlContext, forward))
+// {
+// String url = ctx.renderURL(forward.getCommand(), forward.getURLContext(), null);
+// sendResponse(ctx, new HTTPResponse.SendRedirect(url));
+// }
+// else
+// {
+// processCommand(ctx, forward.getCommand());
+// }
+ processCommand(controllerContext, forward.getCommand());
+ }
+ else
+ {
+ AjaxResponse ar = (AjaxResponse)handlerResp;
+ ar.sendResponse(controllerContext.getServerInvocation().getServerContext());
+ }
}
public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, Object response) throws IOException, ServletException, ServerException
{
if (response instanceof PortletWindowResponse)
{
-// PortletWindowResponse pwr = (PortletWindowResponse)response;
-// PortletInvocationResponse pir = pwr.getResult();
-// if (pir instanceof RenderResponse)
-// {
-// RenderResponse rr = (RenderResponse)pir;
-// }
- throw new Error("todo");
+ PortletWindowResponse pwr = (PortletWindowResponse)response;
+ PortletInvocationResponse pir = pwr.getResult();
+ if (pir instanceof RenderResponse)
+ {
+ RenderResponse rr = (RenderResponse)pir;
+ StateString navState = rr.getNavigationalState();
+ WindowState windowState = rr.getWindowState();
+ Mode mode = rr.getMode();
+ ControllerCommand renderCmd = PortletResponseHandler.createRenderCommand(mode, windowState, navState, pwr);
+ if (renderCmd != null)
+ {
+ return new CommandForward(renderCmd, null);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ throw new Error("todo");
+ }
}
else if (response instanceof UpdateWindowMarkupResponse)
{
Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2007-04-03 13:10:49 UTC (rev 6909)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2007-04-03 13:34:24 UTC (rev 6910)
@@ -29,11 +29,10 @@
import org.jboss.portal.core.controller.ControllerSecurityException;
import org.jboss.portal.core.controller.ResourceNotFoundException;
import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
import org.jboss.portal.core.model.portal.PortalObjectResponseHandler;
-import org.jboss.portal.core.model.portal.PortletWindowResponseHandler;
-import org.jboss.portal.core.model.instance.PortletInstanceResponseHandler;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
@@ -56,8 +55,7 @@
{
new ClassicResponseHandler(),
new PortalObjectResponseHandler(),
- new PortletWindowResponseHandler(),
- new PortletInstanceResponseHandler()
+ new PortletResponseHandler()
};
public void handle(ServerInvocation invocation) throws ServerException
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-04-03 13:10:49 UTC (rev 6909)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-04-03 13:34:24 UTC (rev 6910)
@@ -30,7 +30,11 @@
import org.jboss.portal.core.controller.classic.HTTPResponse;
import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.request.URLContext;
@@ -52,14 +56,34 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class PortletResponseHandler extends AbstractResponseHandler
+public class PortletResponseHandler extends AbstractResponseHandler
{
- protected abstract ControllerCommand createRenderCommand(
+ public static ControllerCommand createRenderCommand(
Mode mode,
WindowState windowState,
StateString navState,
- PortletResponse response);
+ PortletResponse response)
+ {
+ if (response instanceof PortletInstanceResponse)
+ {
+ PortletInstanceResponse ir = (PortletInstanceResponse)response;
+ return new InvokePortletInstanceRenderCommand(ir.getInstanceId(), navState);
+ }
+ else if (response instanceof PortletWindowResponse)
+ {
+ PortletWindowResponse pwr = (PortletWindowResponse)response;
+ return new InvokePortletWindowRenderCommand(
+ pwr.getWindowId(),
+ mode,
+ windowState,
+ navState);
+ }
+ else
+ {
+ return null;
+ }
+ }
public HandlerResponse processCommandResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
{
Deleted: trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-04-03 13:10:49 UTC (rev 6909)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-04-03 13:34:24 UTC (rev 6910)
@@ -1,52 +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.model.instance;
-
-import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
-import org.jboss.portal.core.controller.portlet.PortletResponse;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
-import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.StateString;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletInstanceResponseHandler extends PortletResponseHandler
-{
-
- protected ControllerCommand createRenderCommand(Mode mode, WindowState windowState, StateString navState, PortletResponse response)
- {
- if (response instanceof PortletInstanceResponse)
- {
- PortletInstanceResponse ir = (PortletInstanceResponse)response;
- return new InvokePortletInstanceRenderCommand(ir.getInstanceId(), navState);
- }
-
- //
- return null;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java 2007-04-03 13:10:49 UTC (rev 6909)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java 2007-04-03 13:34:24 UTC (rev 6910)
@@ -1,55 +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.model.portal;
-
-import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
-import org.jboss.portal.core.controller.portlet.PortletResponse;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletWindowResponseHandler extends PortletResponseHandler
-{
- protected ControllerCommand createRenderCommand(Mode mode, WindowState windowState, StateString navState, PortletResponse response)
- {
- if (response instanceof PortletWindowResponse)
- {
- PortletWindowResponse pwr = (PortletWindowResponse)response;
- return new InvokePortletWindowRenderCommand(
- pwr.getWindowId(),
- mode,
- windowState,
- navState);
- }
-
- //
- return null;
- }
-}
Modified: trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js
===================================================================
--- trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js 2007-04-03 13:10:49 UTC (rev 6909)
+++ trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js 2007-04-03 13:34:24 UTC (rev 6910)
@@ -60,43 +60,35 @@
method = "get";
body = "";
}
-// else if (source.nodeName == "INPUT" && source.type == "submit")
-// {
-// // Find enclosing form
-// var current = source.parentNode;
-// while (current.nodeName != 'FORM' && current.nodeName != 'BODY') {
-// current = current.parentNode;
-// }
-//
-// // Check we have a form and use it
-// if (current.nodeName == 'FORM') {
-//
-// //
-// url = current.action;
-//
-// // Get body if needed
-// if (current.method.toLowerCase() == "post") {
-// body = Form.serialize(current);
-// method = "post";
-// }
-// else
-// {
-// body = "";
-// method = "get";
-// }
-// }
-// }
+ else if (source.nodeName == "INPUT" && source.type == "submit")
+ {
+ // Find enclosing form
+ var current = source.parentNode;
+ while (current.nodeName != 'FORM' && current.nodeName != 'BODY') {
+ current = current.parentNode;
+ }
- // Handle links here
- if (url != null) {
+ // Check we have a form and use it
+ if (current.nodeName == 'FORM') {
- var parameters = "";
- var pos = url.indexOf("?");
- if (pos != -1) {
- parameters = url.substring(pos + 1);
- url = url.substring(0, pos);
+ //
+ url = current.action;
+
+ // Get body if needed
+ if (current.method.toLowerCase() == "post") {
+ body = Form.serialize(current);
+ method = "post";
+ }
+ else
+ {
+ body = "";
+ method = "get";
+ }
}
+ }
+ // Handle links here
+ if (url != null) {
//
var headers = ["ajax","true"];
if (view_state !== undefined)
@@ -104,9 +96,12 @@
headers.view_state = view_state;
}
+ // note : we don't convert query string to prototype parameters as in the case
+ // of a post, the parameters will be appended to the body of the query which
+ // will lead to a non correct request
+
//
var options = {
- parameters:parameters,
asynchronous:true,
method: method,
postBody: body,
17 years, 3 months
JBoss Portal SVN: r6909 - trunk/core/src/main/org/jboss/portal/core/model/portal/ns.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-03 09:10:49 -0400 (Tue, 03 Apr 2007)
New Revision: 6909
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java
Log:
simplified the navigational state change objects in order to compact create/update/destroy into a single object. remove unused listener interface def for now as it uses a batch delivery mechanism.
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java 2007-04-03 12:48:01 UTC (rev 6908)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java 2007-04-03 13:10:49 UTC (rev 6909)
@@ -83,13 +83,16 @@
if (changes != null)
{
NavigationalStateObjectChange change = (NavigationalStateObjectChange)changes.get(nsKey);
- switch(change.getType())
+ if (change != null)
{
- case NavigationalStateObjectChange.CREATE:
- case NavigationalStateObjectChange.UPDATE:
- return change.getNewValue();
- case NavigationalStateObjectChange.DESTROY:
- return null;
+ switch(change.getType())
+ {
+ case NavigationalStateObjectChange.CREATE:
+ case NavigationalStateObjectChange.UPDATE:
+ return change.getNewValue();
+ case NavigationalStateObjectChange.DESTROY:
+ return null;
+ }
}
}
17 years, 3 months
JBoss Portal SVN: r6908 - in trunk/core/src/main/org/jboss/portal/core: model/portal/ns and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-03 08:48:01 -0400 (Tue, 03 Apr 2007)
New Revision: 6908
Removed:
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChangeListener.java
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectCreated.java
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectDestroyed.java
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectUpdated.java
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChange.java
trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectChange.java
Log:
simplified the navigational state change objects in order to compact create/update/destroy into a single object. remove unused listener interface def for now as it uses a batch delivery mechanism.
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03 12:27:57 UTC (rev 6907)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03 12:48:01 UTC (rev 6908)
@@ -41,8 +41,8 @@
import org.jboss.portal.core.model.portal.ns.PortalObjectNavigationalStateContext;
import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
import org.jboss.portal.core.ns.NavigationalStateChange;
-import org.jboss.portal.core.ns.NavigationalStateObjectUpdated;
import org.jboss.portal.core.ns.NavigationalStateKey;
+import org.jboss.portal.core.ns.NavigationalStateObjectChange;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.theme.page.WindowResult;
@@ -247,54 +247,53 @@
{
NavigationalStateChange change = (NavigationalStateChange)i.next();
- //
- if (change instanceof NavigationalStateObjectUpdated)
+ // A change that modifies potentially the page structure
+ if (!(change instanceof NavigationalStateObjectChange))
{
- NavigationalStateObjectUpdated update = (NavigationalStateObjectUpdated)change;
+ refresh = true;
+ break;
+ }
+ NavigationalStateObjectChange update = (NavigationalStateObjectChange)change;
- // Get the state key
- NavigationalStateKey key = update.getKey();
+ // A change that modifies potentially the page structure
+ if (update.getType() != NavigationalStateObjectChange.UPDATE)
+ {
+ refresh = true;
+ break;
+ }
- // We consider only portal object types
- if (key.getType() == WindowNavigationalState.class)
- {
- // Get old window state
- WindowNavigationalState oldNS = (WindowNavigationalState)update.getOldValue();
- WindowState oldWindowState = oldNS != null ? oldNS.getWindowState() : null;
+ // Get the state key
+ NavigationalStateKey key = update.getKey();
- // Get new window state
- WindowNavigationalState newNS = (WindowNavigationalState)update.getNewValue();
- WindowState newWindowState = newNS != null ? newNS.getWindowState() : null;
+ // We consider only portal object types
+ if (key.getType() == WindowNavigationalState.class)
+ {
+ // Get old window state
+ WindowNavigationalState oldNS = (WindowNavigationalState)update.getOldValue();
+ WindowState oldWindowState = oldNS != null ? oldNS.getWindowState() : null;
- // Check if window state requires a refresh
- if (WindowState.MAXIMIZED.equals(oldWindowState))
- {
- if (!WindowState.MAXIMIZED.equals(newWindowState))
- {
- refresh = true;
- }
- }
- else if (WindowState.MAXIMIZED.equals(newWindowState))
- {
- refresh = true;
- }
+ // Get new window state
+ WindowNavigationalState newNS = (WindowNavigationalState)update.getNewValue();
+ WindowState newWindowState = newNS != null ? newNS.getWindowState() : null;
- //
- if (refresh)
+ // Check if window state requires a refresh
+ if (WindowState.MAXIMIZED.equals(oldWindowState))
+ {
+ if (!WindowState.MAXIMIZED.equals(newWindowState))
{
+ refresh = true;
break;
}
-
- // Collect the dirty window id
- dirtyWindowIds.add(key.getId());
}
+ else if (WindowState.MAXIMIZED.equals(newWindowState))
+ {
+ refresh = true;
+ break;
+ }
+
+ // Collect the dirty window id
+ dirtyWindowIds.add(key.getId());
}
- else
- {
- // A change that modifies potentially the page structure
- refresh = true;
- break;
- }
}
// Commit changes
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java 2007-04-03 12:27:57 UTC (rev 6907)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/ns/PortalObjectNavigationalStateContext.java 2007-04-03 12:48:01 UTC (rev 6908)
@@ -25,9 +25,6 @@
import org.jboss.portal.core.ns.NavigationalStateContext;
import org.jboss.portal.core.ns.NavigationalStateKey;
import org.jboss.portal.core.ns.NavigationalStateObjectChange;
-import org.jboss.portal.core.ns.NavigationalStateObjectCreated;
-import org.jboss.portal.core.ns.NavigationalStateObjectUpdated;
-import org.jboss.portal.core.ns.NavigationalStateObjectDestroyed;
import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
@@ -86,20 +83,14 @@
if (changes != null)
{
NavigationalStateObjectChange change = (NavigationalStateObjectChange)changes.get(nsKey);
- if (change instanceof NavigationalStateObjectCreated)
+ switch(change.getType())
{
- NavigationalStateObjectCreated created = (NavigationalStateObjectCreated)change;
- return created.getValue();
+ case NavigationalStateObjectChange.CREATE:
+ case NavigationalStateObjectChange.UPDATE:
+ return change.getNewValue();
+ case NavigationalStateObjectChange.DESTROY:
+ return null;
}
- else if (change instanceof NavigationalStateObjectUpdated)
- {
- NavigationalStateObjectUpdated updated = (NavigationalStateObjectUpdated)change;
- return updated.getNewValue();
- }
- else if (change instanceof NavigationalStateObjectDestroyed)
- {
- return null;
- }
}
//
@@ -151,18 +142,12 @@
changes.remove(effectiveKey);
//
- if (change instanceof NavigationalStateObjectCreated)
+ switch(change.getType())
{
- NavigationalStateObjectCreated created = (NavigationalStateObjectCreated)change;
- oldNS = (WindowNavigationalState)created.getValue();
+ case NavigationalStateObjectChange.CREATE:
+ case NavigationalStateObjectChange.UPDATE:
+ oldNS = (WindowNavigationalState)change.getOldValue();
}
- else if (change instanceof NavigationalStateObjectUpdated)
- {
- NavigationalStateObjectUpdated updated = (NavigationalStateObjectUpdated)change;
- oldNS = (WindowNavigationalState)updated.getNewValue();
- }
-
- //
}
}
@@ -178,7 +163,7 @@
{
if (oldNS != null)
{
- change = new NavigationalStateObjectDestroyed(effectiveKey, oldNS);
+ change = NavigationalStateObjectChange.newDestroy(effectiveKey, oldNS);
}
else
{
@@ -228,11 +213,11 @@
//
if (oldNS != null)
{
- change = new NavigationalStateObjectUpdated(effectiveKey, oldNS, newNS);
+ change = NavigationalStateObjectChange.newUpdate(effectiveKey, oldNS, newNS);
}
else
{
- change = new NavigationalStateObjectCreated(effectiveKey, newNS);
+ change = NavigationalStateObjectChange.newCreate(effectiveKey, newNS);
}
}
@@ -266,21 +251,7 @@
for (Iterator i = changes.values().iterator();i.hasNext();)
{
NavigationalStateObjectChange change = (NavigationalStateObjectChange)i.next();
- if (change instanceof NavigationalStateObjectCreated)
- {
- NavigationalStateObjectCreated created = (NavigationalStateObjectCreated)change;
- store.setAttribute(created.getKey(), created.getValue());
- }
- else if (change instanceof NavigationalStateObjectUpdated)
- {
- NavigationalStateObjectUpdated updated = (NavigationalStateObjectUpdated)change;
- store.setAttribute(updated.getKey(), updated.getNewValue());
- }
- else
- {
- NavigationalStateObjectDestroyed destroyed = (NavigationalStateObjectDestroyed)change;
- store.setAttribute(destroyed.getKey(), null);
- }
+ store.setAttribute(change.getKey(), change.getNewValue());
}
//
Modified: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChange.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChange.java 2007-04-03 12:27:57 UTC (rev 6907)
+++ trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChange.java 2007-04-03 12:48:01 UTC (rev 6908)
@@ -23,9 +23,11 @@
package org.jboss.portal.core.ns;
/**
+ * Base navigational state change.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class NavigationalStateChange
+public abstract class NavigationalStateChange
{
}
Deleted: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChangeListener.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChangeListener.java 2007-04-03 12:27:57 UTC (rev 6907)
+++ trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateChangeListener.java 2007-04-03 12:48:01 UTC (rev 6908)
@@ -1,31 +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.ns;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface NavigationalStateChangeListener
-{
-}
Modified: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectChange.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectChange.java 2007-04-03 12:27:57 UTC (rev 6907)
+++ trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectChange.java 2007-04-03 12:48:01 UTC (rev 6908)
@@ -23,6 +23,10 @@
package org.jboss.portal.core.ns;
/**
+ * The change of the navigational state of a single object. If both old and new values are not null, it denotes
+ * an update. Whenever the old value is null, a creation occured and conversely if the new value is null, a
+ * destruction occured.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
@@ -30,16 +34,82 @@
{
/** . */
+ public static final int UPDATE = 0;
+
+ /** . */
+ public static final int CREATE = 1;
+
+ /** . */
+ public static final int DESTROY = 2;
+
+ /** . */
+ private final Object oldValue;
+
+ /** . */
+ private final Object newValue;
+
+ /** . */
private NavigationalStateKey key;
- public NavigationalStateObjectChange(NavigationalStateKey key)
+ private NavigationalStateObjectChange(NavigationalStateKey key, Object oldValue, Object newValue)
{
+ if (key == null)
+ {
+ throw new IllegalArgumentException("No key provided");
+ }
this.key = key;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
}
+ public int getType()
+ {
+ return oldValue == null ? CREATE : (newValue == null ? DESTROY : UPDATE);
+ }
+
public NavigationalStateKey getKey()
{
return key;
}
+ public Object getOldValue()
+ {
+ return oldValue;
+ }
+
+ public Object getNewValue()
+ {
+ return newValue;
+ }
+
+ public static NavigationalStateObjectChange newUpdate(NavigationalStateKey key, Object oldValue, Object newValue)
+ {
+ if (oldValue == null)
+ {
+ throw new IllegalArgumentException("No old value provided");
+ }
+ if (newValue == null)
+ {
+ throw new IllegalArgumentException("No new value provided");
+ }
+ return new NavigationalStateObjectChange(key, oldValue, newValue);
+ }
+
+ public static NavigationalStateObjectChange newCreate(NavigationalStateKey key, Object newValue)
+ {
+ if (newValue == null)
+ {
+ throw new IllegalArgumentException("No new value provided");
+ }
+ return new NavigationalStateObjectChange(key, null, newValue);
+ }
+
+ public static NavigationalStateObjectChange newDestroy(NavigationalStateKey key, Object oldValue)
+ {
+ if (oldValue == null)
+ {
+ throw new IllegalArgumentException("No old value provided");
+ }
+ return new NavigationalStateObjectChange(key, oldValue, null);
+ }
}
Deleted: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectCreated.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectCreated.java 2007-04-03 12:27:57 UTC (rev 6907)
+++ trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectCreated.java 2007-04-03 12:48:01 UTC (rev 6908)
@@ -1,45 +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.ns;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class NavigationalStateObjectCreated extends NavigationalStateObjectChange
-{
-
- /** . */
- private final Object value;
-
- public NavigationalStateObjectCreated(NavigationalStateKey key, Object value)
- {
- super(key);
- this.value = value;
- }
-
- public Object getValue()
- {
- return value;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectDestroyed.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectDestroyed.java 2007-04-03 12:27:57 UTC (rev 6907)
+++ trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectDestroyed.java 2007-04-03 12:48:01 UTC (rev 6908)
@@ -1,45 +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.ns;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class NavigationalStateObjectDestroyed extends NavigationalStateObjectChange
-{
-
- /** . */
- private final Object value;
-
- public NavigationalStateObjectDestroyed(NavigationalStateKey key, Object value)
- {
- super(key);
- this.value = value;
- }
-
- public Object getValue()
- {
- return value;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectUpdated.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectUpdated.java 2007-04-03 12:27:57 UTC (rev 6907)
+++ trunk/core/src/main/org/jboss/portal/core/ns/NavigationalStateObjectUpdated.java 2007-04-03 12:48:01 UTC (rev 6908)
@@ -1,54 +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.ns;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class NavigationalStateObjectUpdated extends NavigationalStateObjectChange
-{
-
- /** . */
- private final Object oldValue;
-
- /** . */
- private final Object newValue;
-
- public NavigationalStateObjectUpdated(NavigationalStateKey key, Object oldValue, Object newValue)
- {
- super(key);
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
-
- public Object getOldValue()
- {
- return oldValue;
- }
-
- public Object getNewValue()
- {
- return newValue;
- }
-}
17 years, 3 months
JBoss Portal SVN: r6907 - in trunk/core/src/main/org/jboss/portal/core: model/portal/command and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-03 08:27:57 -0400 (Tue, 03 Apr 2007)
New Revision: 6907
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java
Log:
remove unnecessary state in UpdateWindowMarkupResponse as it may lead to incorrect usage
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03 12:23:07 UTC (rev 6906)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03 12:27:57 UTC (rev 6907)
@@ -48,7 +48,6 @@
import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.render.RenderContext;
-import org.jboss.portal.theme.render.PageRenderContext;
import org.jboss.portal.theme.render.WindowRenderContext;
import org.jboss.portal.theme.render.DecorationRenderContext;
import org.jboss.portal.theme.render.PortletRenderContext;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2007-04-03 12:23:07 UTC (rev 6906)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2007-04-03 12:27:57 UTC (rev 6907)
@@ -119,6 +119,6 @@
//
- return new UpdateWindowMarkupResponse(windowId, oldNS, newNS);
+ return new UpdateWindowMarkupResponse(windowId);
}
}
\ No newline at end of file
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java 2007-04-03 12:23:07 UTC (rev 6906)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java 2007-04-03 12:27:57 UTC (rev 6907)
@@ -23,9 +23,6 @@
package org.jboss.portal.core.model.portal.command.response;
import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.ns.WindowNavigationalState;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -37,46 +34,18 @@
/** . */
private final PortalObjectId windowId;
- /** If not null indicate the previous state. */
- private final WindowNavigationalState oldNavigationalState;
- /** Indicate the current state. */
- private final WindowNavigationalState newNavigationalState;
-
-
- public UpdateWindowMarkupResponse(PortalObjectId windowId, WindowNavigationalState oldNavigationalState, WindowNavigationalState newNavigationalState)
+ public UpdateWindowMarkupResponse(PortalObjectId windowId)
{
if (windowId == null)
{
throw new IllegalArgumentException();
}
this.windowId = windowId;
- this.oldNavigationalState = oldNavigationalState;
- this.newNavigationalState = newNavigationalState;
}
public PortalObjectId getWindowId()
{
return windowId;
}
-
- public WindowState getOldWindowState()
- {
- return oldNavigationalState != null ? oldNavigationalState.getWindowState() : null;
- }
-
- public WindowState getNewWindowState()
- {
- return newNavigationalState.getWindowState();
- }
-
- public Mode getOldMode()
- {
- return oldNavigationalState != null ? oldNavigationalState.getMode() : null;
- }
-
- public Mode getNewMode()
- {
- return newNavigationalState.getMode();
- }
}
17 years, 3 months
JBoss Portal SVN: r6906 - trunk/core-samples/src/resources/portal-samples-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-04-03 08:23:07 -0400 (Tue, 03 Apr 2007)
New Revision: 6906
Modified:
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml
Log:
Wrong key name
Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml 2007-04-03 12:18:06 UTC (rev 6905)
+++ trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml 2007-04-03 12:23:07 UTC (rev 6906)
@@ -65,8 +65,8 @@
<page-name>Test</page-name>
<properties>
<property>
- <name>theme.ajax.object_disabled</name>
- <value>true</value>
+ <name>theme.ajax.object_enabled</name>
+ <value>false</value>
</property>
<property>
<name>order</name>
17 years, 3 months