JBoss Portal SVN: r10729 - in modules/common/tags/JBP_COMMON_1_2_0: mc and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-04-30 13:53:26 -0400 (Wed, 30 Apr 2008)
New Revision: 10729
Modified:
modules/common/tags/JBP_COMMON_1_2_0/build/pom.xml
modules/common/tags/JBP_COMMON_1_2_0/mc/pom.xml
Log:
minor
Modified: modules/common/tags/JBP_COMMON_1_2_0/build/pom.xml
===================================================================
--- modules/common/tags/JBP_COMMON_1_2_0/build/pom.xml 2008-04-30 11:47:33 UTC (rev 10728)
+++ modules/common/tags/JBP_COMMON_1_2_0/build/pom.xml 2008-04-30 17:53:26 UTC (rev 10729)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jboss.portal</groupId>
<artifactId>jboss-portal-parent</artifactId>
- <version>1-SNAPSHOT</version>
+ <version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.common</groupId>
Modified: modules/common/tags/JBP_COMMON_1_2_0/mc/pom.xml
===================================================================
--- modules/common/tags/JBP_COMMON_1_2_0/mc/pom.xml 2008-04-30 11:47:33 UTC (rev 10728)
+++ modules/common/tags/JBP_COMMON_1_2_0/mc/pom.xml 2008-04-30 17:53:26 UTC (rev 10729)
@@ -27,7 +27,7 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
-
+
</dependencies>
</project>
15 years, 11 months
JBoss Portal SVN: r10728 - modules/common/tags/JBP_COMMON_1_2_0/build.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-30 07:47:33 -0400 (Wed, 30 Apr 2008)
New Revision: 10728
Modified:
modules/common/tags/JBP_COMMON_1_2_0/build/pom.xml
Log:
update common parent to be 1.2.0
Modified: modules/common/tags/JBP_COMMON_1_2_0/build/pom.xml
===================================================================
--- modules/common/tags/JBP_COMMON_1_2_0/build/pom.xml 2008-04-28 11:31:16 UTC (rev 10727)
+++ modules/common/tags/JBP_COMMON_1_2_0/build/pom.xml 2008-04-30 11:47:33 UTC (rev 10728)
@@ -10,7 +10,7 @@
<artifactId>module-parent</artifactId>
<packaging>pom</packaging>
<name>JBoss Portal Modules Common</name>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.0</version>
<url>http://labs.jboss.com/jbossportal</url>
<properties>
15 years, 11 months
JBoss Portal SVN: r10727 - modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-28 07:31:16 -0400 (Mon, 28 Apr 2008)
New Revision: 10727
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java
Log:
added a bit of javadoc
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java 2008-04-28 11:29:14 UTC (rev 10726)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java 2008-04-28 11:31:16 UTC (rev 10727)
@@ -27,16 +27,33 @@
import java.util.Collection;
/**
+ * The node interface provides a pull style api for interacting with the structural context.
+ *
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
public interface UINode
{
+ /**
+ * Returns the related ui object.
+ *
+ * @return the ui object
+ */
UIObject getObject();
+ /**
+ * Returns the parent node or null if it does not exist.
+ *
+ * @return the parent node
+ */
UINode getParent();
-
+
+ /**
+ * Returns a collection of children nodes.
+ *
+ * @return the children
+ */
Collection<UINode> getChildren();
}
15 years, 12 months
JBoss Portal SVN: r10726 - in modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet: controller and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-28 07:29:14 -0400 (Mon, 28 Apr 2008)
New Revision: 10726
Added:
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationEventControllerContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletControllerContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletPageNavigationalState.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationStateControllerContext.java
Modified:
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/PortletPresentationServer.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortletInvocationContext.java
Log:
rename portlet controller integration classes with PF
Modified: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/PortletPresentationServer.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/PortletPresentationServer.java 2008-04-28 11:26:46 UTC (rev 10725)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/PortletPresentationServer.java 2008-04-28 11:29:14 UTC (rev 10726)
@@ -34,8 +34,8 @@
import org.jboss.portal.presentation.model.tree.UINode;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.portlet.protocol.PortletContainerAction;
-import org.jboss.portal.presentation.portlet.controller.StructuralPortletPageNavigationalState;
-import org.jboss.portal.presentation.portlet.controller.StructuralPortletControllerContext;
+import org.jboss.portal.presentation.portlet.controller.PresentationPortletPageNavigationalState;
+import org.jboss.portal.presentation.portlet.controller.PresentationPortletControllerContext;
import org.jboss.portal.presentation.impl.model.tree.UINodeFactory;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
import org.jboss.portal.portlet.controller.request.PortletActionRequest;
@@ -89,16 +89,16 @@
PortletController controller = new PortletController();
//
- StructuralPortletControllerContext portletControllerContext = new StructuralPortletControllerContext(
+ PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
client,
pageNode,
portletInvoker);
//
- StructuralPortletPageNavigationalState pageNavigationalState = new StructuralPortletPageNavigationalState(
+ PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
portletControllerContext,
client.getNavigationalStateContext(),
- StructuralPortletPageNavigationalState.READ_ONLY_MODE);
+ PresentationPortletPageNavigationalState.READ_ONLY_MODE);
PortletInvocationResponse response = controller.render(portletControllerContext, null, pageNavigationalState, windowId);
@@ -136,15 +136,15 @@
UINode pageNode = windowNode.getParent();
//
- StructuralPortletControllerContext portletControllerContext = new StructuralPortletControllerContext(
+ PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
client,
pageNode,
portletInvoker);
- StructuralPortletPageNavigationalState pageNavigationalState = new StructuralPortletPageNavigationalState(
+ PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
portletControllerContext,
client.getNavigationalStateContext(),
- StructuralPortletPageNavigationalState.CLONE_AND_WRITE_MODE);
+ PresentationPortletPageNavigationalState.CLONE_AND_WRITE_MODE);
//
ControllerRequest controllerRequest;
@@ -192,7 +192,7 @@
NavigationalStateContext nsc = client.getNavigationalStateContext();
//
- StructuralPortletPageNavigationalState blah = (StructuralPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
+ PresentationPortletPageNavigationalState blah = (PresentationPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
//
blah.flush();
Copied: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationEventControllerContext.java (from rev 10724, modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralEventControllerContext.java)
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationEventControllerContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationEventControllerContext.java 2008-04-28 11:29:14 UTC (rev 10726)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.controller;
+
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
+import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationEventControllerContext implements EventControllerContext
+{
+
+ /** . */
+ private final PresentationPortletControllerContext portletControllerContext;
+
+ public PresentationEventControllerContext(PresentationPortletControllerContext portletControllerContext)
+ {
+ this.portletControllerContext = portletControllerContext;
+ }
+
+ public void eventProduced(EventPhaseContext context, PortletWindowEvent producedEvent, PortletWindowEvent sourceEvent)
+ {
+ for (String windowId : portletControllerContext.getWindowIds())
+ {
+ PortletInfo portletInfo = portletControllerContext.getPortletInfo(windowId);
+ if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
+ {
+ PortletWindowEvent distributedEvent = new PortletWindowEvent(producedEvent.getName(), producedEvent.getPayload(), windowId);
+ context.queueEvent(distributedEvent);
+ }
+ }
+ }
+
+ public void eventConsumed(EventPhaseContext context, PortletWindowEvent consumedEvent, PortletInvocationResponse consumerResponse)
+ {
+ }
+
+ public void eventFailed(EventPhaseContext context, PortletWindowEvent failedEvent, Throwable throwable)
+ {
+ }
+
+ public void eventDiscarded(EventPhaseContext context, PortletWindowEvent discardedEvent, int cause)
+ {
+ }
+}
Copied: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletControllerContext.java (from rev 10724, modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletControllerContext.java)
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletControllerContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletControllerContext.java 2008-04-28 11:29:14 UTC (rev 10726)
@@ -0,0 +1,208 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.controller;
+
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
+import org.jboss.portal.portlet.controller.PortletControllerContext;
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.ResourceInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationPortletInvocationContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationServerContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationWindowContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationInstanceContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationClientContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationPortalContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationSecurityContext;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.model.tree.UINode;
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.state.StateType;
+
+import javax.servlet.http.Cookie;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationPortletControllerContext implements PortletControllerContext
+{
+
+ /** . */
+ private final UINode pageNode;
+
+ /** . */
+ private final PortletInvoker invoker;
+
+ /** . */
+ private final StateControllerContext stateControllerContext;
+
+ /** A map of window ids to portlets. */
+ private final Map<String, Portlet> portlets;
+
+ /** A map of window ids to windows. */
+ private final Map<String, UINode> windows;
+
+ /** . */
+ private final PresentationClient client;
+
+ /** . */
+ private final EventControllerContext eventControllerContext;
+
+ public PresentationPortletControllerContext(
+ PresentationClient client,
+ UINode pageNode,
+ PortletInvoker invoker)
+ {
+ Map<String, Portlet> portlets = new HashMap<String, Portlet>();
+ Map<String, UINode> windows = new HashMap<String, UINode>();
+
+ //
+ for (UINode childNode : pageNode.getChildren())
+ {
+ UIObject child = childNode.getObject();
+
+ if (child instanceof UIWindow)
+ {
+ String portletRef = child.getProperty(StateType.STRUCTURAL, "portlet-ref", String.class);
+
+ //
+ if (portletRef != null)
+ {
+ try
+ {
+ Portlet portlet = invoker.getPortlet(PortletContext.createPortletContext(portletRef));
+
+ //
+ portlets.put(child.getId(), portlet);
+ windows.put(child.getId(), childNode);
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ //
+ this.client = client;
+ this.pageNode = pageNode;
+ this.invoker = invoker;
+ this.stateControllerContext = new PresentationStateControllerContext(this);
+ this.portlets = portlets;
+ this.windows = windows;
+ this.eventControllerContext = new PresentationEventControllerContext(this);
+ }
+
+ public String getPageId()
+ {
+ return pageNode.getObject().getId();
+ }
+
+ public Set<String> getWindowIds()
+ {
+ return windows.keySet();
+ }
+
+ public PortletInfo getPortletInfo(String windowId)
+ {
+ return portlets.get(windowId).getInfo();
+ }
+
+ public PortletInvocationContext createPortletInvocationContext(String windowId, PortletPageNavigationalState pageNavigationalState)
+ {
+ return new PresentationPortletInvocationContext(client, this, windowId);
+ }
+
+ public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
+ {
+ return invoke((PortletInvocation)actionInvocation);
+ }
+
+ public PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
+ {
+ return invoke(eventInvocation);
+ }
+
+ public PortletInvocationResponse invoke(List<Cookie> requestCookies, RenderInvocation renderInvocation) throws PortletInvokerException
+ {
+ return invoke(renderInvocation);
+ }
+
+ public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException
+ {
+ return invoke((PortletInvocation)resourceInvocation);
+ }
+
+ private PortletInvocationResponse invoke(PortletInvocation portletInvocation) throws PortletInvokerException
+ {
+ PresentationPortletInvocationContext ctx = (PresentationPortletInvocationContext)portletInvocation.getContext();
+
+ //
+ UINode window = windows.get(ctx.getWindowId());
+
+ //
+ portletInvocation.setServerContext(new PresentationServerContext(client));
+ portletInvocation.setSecurityContext(new PresentationSecurityContext());
+ portletInvocation.setClientContext(new PresentationClientContext());
+ portletInvocation.setInstanceContext(new PresentationInstanceContext(window));
+ portletInvocation.setPortalContext(new PresentationPortalContext());
+ portletInvocation.setUserContext(new AbstractUserContext());
+ portletInvocation.setWindowContext(new PresentationWindowContext(window));
+
+ //
+ Portlet portlet = portlets.get(ctx.getWindowId());
+ portletInvocation.setTarget(portlet.getContext());
+
+ //
+ return invoker.invoke(portletInvocation);
+ }
+
+ public EventControllerContext getEventControllerContext()
+ {
+ return eventControllerContext;
+ }
+
+ public StateControllerContext getStateControllerContext()
+ {
+ return stateControllerContext;
+ }
+}
Copied: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletPageNavigationalState.java (from rev 10724, modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletPageNavigationalState.java)
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletPageNavigationalState.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletPageNavigationalState.java 2008-04-28 11:29:14 UTC (rev 10726)
@@ -0,0 +1,290 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.controller;
+
+import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.info.ParameterInfo;
+import org.jboss.portal.portlet.info.NavigationInfo;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import javax.xml.namespace.QName;
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationPortletPageNavigationalState implements PortletPageNavigationalState
+{
+
+ /** . */
+ public static final int READ_ONLY_MODE = 0;
+
+ /** . */
+ public static final int READ_WRITE_MODE = 1;
+
+ /** . */
+ public static final int CLONE_AND_WRITE_MODE = 2;
+
+ /** . */
+ private final PresentationPortletControllerContext portletControllerContext;
+
+ /** . */
+ private final NavigationalStateContext navigationalStateContext;
+
+ /** . */
+ private final boolean modifiable;
+
+ public PresentationPortletPageNavigationalState(
+ PresentationPortletControllerContext portletControllerContext,
+ NavigationalStateContext navigationalStateContext,
+ int mode)
+ {
+ boolean modifiable;
+ switch (mode)
+ {
+ case READ_ONLY_MODE:
+ modifiable = false;
+ break;
+ case READ_WRITE_MODE:
+ modifiable = true;
+ break;
+ case CLONE_AND_WRITE_MODE:
+ modifiable = true;
+ navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
+ this.portletControllerContext = portletControllerContext;
+ this.navigationalStateContext = navigationalStateContext;
+ this.modifiable = modifiable;
+ }
+
+ public PresentationPortletPageNavigationalState(
+ PresentationPortletPageNavigationalState pageNavigationalState,
+ int mode)
+ {
+ NavigationalStateContext navigationalStateContext = pageNavigationalState.navigationalStateContext;
+ boolean modifiable;
+ switch (mode)
+ {
+ case READ_ONLY_MODE:
+ modifiable = false;
+ break;
+ case READ_WRITE_MODE:
+ modifiable = true;
+ break;
+ case CLONE_AND_WRITE_MODE:
+ modifiable = true;
+ navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
+ this.portletControllerContext = pageNavigationalState.portletControllerContext;
+ this.navigationalStateContext = navigationalStateContext;
+ this.modifiable = modifiable;
+ }
+
+ public void flush()
+ {
+ if (navigationalStateContext instanceof DelegatingNavigationalStateContext)
+ {
+ ((DelegatingNavigationalStateContext)navigationalStateContext).flush(true);
+ }
+ }
+
+ public Set<String> getPortletWindowIds()
+ {
+ return portletControllerContext.getWindowIds();
+ }
+
+ public PortletWindowNavigationalState getPortletWindowNavigationalState(String portletWindowId) throws IllegalArgumentException
+ {
+ Mode mode = (Mode)navigationalStateContext.getProperty(portletWindowId, "mode");
+ WindowState windowState = (WindowState)navigationalStateContext.getProperty(portletWindowId, "windowstate");
+ StateString portletNavigationalState = (StateString)navigationalStateContext.getProperty(portletWindowId, "portlet");
+ return new PortletWindowNavigationalState(portletNavigationalState, mode, windowState);
+ }
+
+ public void setPortletWindowNavigationalState(String portletWindowId, PortletWindowNavigationalState portletWindowState) throws IllegalArgumentException, IllegalStateException
+ {
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ navigationalStateContext.setProperty(portletWindowId, "windowstate", portletWindowState.getWindowState());
+ navigationalStateContext.setProperty(portletWindowId, "mode", portletWindowState.getMode());
+ navigationalStateContext.setProperty(portletWindowId, "portlet", portletWindowState.getPortletNavigationalState());
+ }
+
+ public Map<String, String[]> getPortletPublicNavigationalState(String portletWindowId) throws IllegalArgumentException
+ {
+ Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ Map<String, String[]> portletParameters = null;
+
+ //
+ if (pageParameters != null)
+ {
+ NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
+
+ //
+ for (ParameterInfo parameterInfo : navigationInfo.getPublicParameters())
+ {
+ QName parameterName = parameterInfo.getName();
+ String[] parameterValue = pageParameters.get(parameterName);
+
+ //
+ if (parameterValue != null)
+ {
+ if (portletParameters == null)
+ {
+ portletParameters = new HashMap<String, String[]>();
+ }
+
+ //
+ portletParameters.put(parameterInfo.getId(), parameterValue);
+ }
+ }
+ }
+
+ //
+ return portletParameters;
+ }
+
+ public void setPortletPublicNavigationalState(String portletWindowId, Map<String, String[]> update) throws IllegalArgumentException, IllegalStateException
+ {
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ if (pageParameters == null)
+ {
+ pageParameters = new HashMap<QName, String[]>();
+ }
+
+ //
+ NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
+
+ //
+ for (Map.Entry<String, String[]> entry : update.entrySet())
+ {
+ ParameterInfo parameterInfo = navigationInfo.getPublicParameter(entry.getKey());
+
+ //
+ QName parameterName = parameterInfo.getName();
+
+ if (entry.getValue().length == 0)
+ {
+ pageParameters.remove(parameterName);
+ }
+ else
+ {
+ pageParameters.put(parameterName, entry.getValue());
+ }
+ }
+
+ //
+ navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
+ }
+
+ public Set<QName> getPublicNames()
+ {
+ HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ return pageParameters != null ? pageParameters.keySet() : null;
+ }
+
+ public String[] getPublicNavigationalState(QName name) throws IllegalArgumentException
+ {
+ Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ return pageParameters != null ? pageParameters.get(name) : null;
+ }
+
+ public void setPublicNavigationalState(QName name, String[] value) throws IllegalArgumentException, IllegalStateException
+ {
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ if (pageParameters == null)
+ {
+ pageParameters = new HashMap<QName, String[]>();
+ }
+
+ //
+ pageParameters.put(name, value);
+
+ //
+ navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
+ }
+
+ public void removePublicNavigationalState(QName name) throws IllegalArgumentException, IllegalStateException
+ {
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ if (pageParameters != null)
+ {
+ pageParameters.remove(name);
+
+ //
+ navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
+ }
+ }
+}
Copied: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationStateControllerContext.java (from rev 10724, modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralStateControllerContext.java)
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationStateControllerContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationStateControllerContext.java 2008-04-28 11:29:14 UTC (rev 10726)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.controller;
+
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationStateControllerContext implements StateControllerContext
+{
+
+ /** . */
+ private PresentationPortletControllerContext portletControllerContext;
+
+ public PresentationStateControllerContext(PresentationPortletControllerContext portletControllerContext)
+ {
+ this.portletControllerContext = portletControllerContext;
+ }
+
+ public PortletPageNavigationalState clonePortletPageNavigationalState(PortletPageNavigationalState portletPageNavigationalState, boolean modifiable)
+ {
+
+ return new PresentationPortletPageNavigationalState(
+ (PresentationPortletPageNavigationalState)portletPageNavigationalState,
+ modifiable ? PresentationPortletPageNavigationalState.CLONE_AND_WRITE_MODE : PresentationPortletPageNavigationalState.READ_ONLY_MODE);
+ }
+
+ public PortletPageNavigationalState createPortletPageNavigationalState(boolean modifiable)
+ {
+ return new PresentationPortletPageNavigationalState(
+ portletControllerContext,
+ new NavigationalStateContextImpl(),
+ modifiable ? PresentationPortletPageNavigationalState.READ_WRITE_MODE : PresentationPortletPageNavigationalState.READ_ONLY_MODE);
+ }
+}
Modified: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortletInvocationContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortletInvocationContext.java 2008-04-28 11:26:46 UTC (rev 10725)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortletInvocationContext.java 2008-04-28 11:29:14 UTC (rev 10726)
@@ -28,7 +28,7 @@
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.presentation.portlet.protocol.PortletContainerAction;
-import org.jboss.portal.presentation.portlet.controller.StructuralPortletControllerContext;
+import org.jboss.portal.presentation.portlet.controller.PresentationPortletControllerContext;
import org.jboss.portal.presentation.client.PresentationClient;
import java.io.Writer;
@@ -45,7 +45,7 @@
private final MarkupInfo markup = new MarkupInfo(MediaType.TEXT_HTML, "UTF-8");
/** . */
- private final StructuralPortletControllerContext portletControllerContext;
+ private final PresentationPortletControllerContext portletControllerContext;
/** . */
private final String windowId;
@@ -55,7 +55,7 @@
public PresentationPortletInvocationContext(
PresentationClient client,
- StructuralPortletControllerContext portletControllerContext,
+ PresentationPortletControllerContext portletControllerContext,
String windowId)
{
this.client = client;
15 years, 12 months
JBoss Portal SVN: r10724 - in modules/presentation/trunk: ajax/src/main/java/org/jboss/portal/presentation/ajax/model and 14 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-28 06:51:53 -0400 (Mon, 28 Apr 2008)
New Revision: 10724
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIObject.java
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/AjaxPresentationClient.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/AjaxUINode.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/AjaxViewPortContext.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/PageViewPortScope.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicUINode.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicViewPortContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/DefaultPageViewPortScope.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/PageViewPortScope.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletControllerContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/ContextNode.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/PageNode.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralNode.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/WindowNode.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContainer.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIPage.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIWindow.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/structural/StructuralState.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObject.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/CustomScope.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/NodeDef.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/UIObjectNode.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/UIObjectTree.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/structural/StructuralStateContextTestCase.java
Log:
move UIObject to ui package
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/AjaxPresentationClient.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/AjaxPresentationClient.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/AjaxPresentationClient.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -33,7 +33,7 @@
import org.jboss.portal.presentation.ajax.model.AjaxNavigationalStateContext;
import org.jboss.portal.presentation.impl.model.UIModelImpl;
import org.jboss.portal.presentation.model.UIModel;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
import org.jboss.portal.presentation.model.content.WindowContent;
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/AjaxUINode.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/AjaxUINode.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/AjaxUINode.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -25,7 +25,7 @@
import java.util.Collection;
import java.util.Map;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/AjaxViewPortContext.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/AjaxViewPortContext.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/AjaxViewPortContext.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -25,7 +25,7 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortContext;
/**
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/PageViewPortScope.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/PageViewPortScope.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/model/PageViewPortScope.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.ajax.model;
import org.jboss.portal.presentation.model.ObjectTraversalType;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortScope;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -32,7 +32,7 @@
import org.jboss.portal.presentation.impl.model.UIModelImpl;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.presentation.model.UIModel;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
import org.jboss.portal.presentation.model.content.WindowContent;
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicUINode.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicUINode.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicUINode.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.classic.model;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import java.util.Collection;
import java.util.Map;
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicViewPortContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicViewPortContext.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicViewPortContext.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.classic.model;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortContext;
import java.util.HashMap;
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/DefaultPageViewPortScope.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/DefaultPageViewPortScope.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/DefaultPageViewPortScope.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.classic.model;
import org.jboss.portal.presentation.model.ObjectTraversalType;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortScope;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/PageViewPortScope.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/PageViewPortScope.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/PageViewPortScope.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.classic.model;
import org.jboss.portal.presentation.model.ObjectTraversalType;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortScope;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
Modified: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletControllerContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletControllerContext.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletControllerContext.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -48,7 +48,7 @@
import org.jboss.portal.presentation.portlet.spi.PresentationSecurityContext;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.model.tree.UINode;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.state.StateType;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeImpl.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.impl.model.tree;
import org.jboss.portal.presentation.model.tree.UINode;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.structural.StructuralObject;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -24,7 +24,7 @@
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.reflect.Reflection;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/ContextNode.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/ContextNode.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/ContextNode.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIContext;
/**
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/PageNode.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/PageNode.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/PageNode.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIPage;
/**
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralNode.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralNode.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralNode.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.StaleStateException;
import org.jboss.portal.presentation.state.structural.StructuralObject;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateImpl.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.structural.StructuralState;
import java.util.Map;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/WindowNode.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/WindowNode.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/WindowNode.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIWindow;
/**
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.model;
+import org.jboss.portal.presentation.model.ui.UIObject;
+
/**
* This interface defines read-write access to the structural information of a viewport.
*
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.model;
+import org.jboss.portal.presentation.model.ui.UIObject;
+
/**
* Defines the scope of a viewport. This interface is separated from the viewport context in order to
* really affirm the split between the concern between the scope implementation that is used by the viewport
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.model.tree;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import java.util.Collection;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIAction.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIAction.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.model.ui;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
/**
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContainer.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContainer.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContainer.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.model.ui;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContext.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContext.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.model.ui;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIObject.java (from rev 10714, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObject.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIObject.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIObject.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model.ui;
+
+import org.jboss.portal.presentation.state.StateException;
+import org.jboss.portal.presentation.state.StateType;
+
+import java.util.Set;
+
+/**
+ * A wrapper of a structural object. The main goal of this object is to let the viewport add custom payload
+ * in addition of the structural state.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface UIObject
+{
+
+ /**
+ * Returns the id.
+ *
+ * @return the id
+ */
+ String getId();
+
+ /**
+ * Returns the name.
+ *
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * Returns a property value or null if it does not exist.
+ *
+ * @param stateType the state type
+ * @param propertyName the property name
+ * @param propertyType the expected property type @return the property value @return the property value
+ * @return the property value
+ * @throws IllegalArgumentException if any argument is null or not valid
+ * @throws StateException any state exception
+ */
+ <T> T getProperty(StateType stateType, String propertyName, Class<T> propertyType) throws IllegalArgumentException, StateException;
+
+ /**
+ * Returns the set of property names of this object
+ *
+ * @param stateType the state type
+ * @return the property names
+ */
+ Set<String> getPropertyNames(StateType stateType);
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIPage.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIPage.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIPage.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.model.ui;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIWindow.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIWindow.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIWindow.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -24,7 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/structural/StructuralState.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/structural/StructuralState.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/structural/StructuralState.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import java.util.Map;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.test.model;
import junit.framework.TestCase;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.state.NoSuchStateException;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.test.model.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.state.NoSuchStateException;
import org.jboss.portal.presentation.state.StaleStateException;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObject.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObject.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObject.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.test.model.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.structural.StructuralObject;
import java.util.List;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.test.model.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import java.util.ArrayList;
import java.util.Collections;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.test.model.state.structural;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.structural.StructuralState;
import java.util.Map;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/CustomScope.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/CustomScope.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/CustomScope.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -24,7 +24,7 @@
import org.jboss.portal.presentation.model.ObjectTraversalType;
import org.jboss.portal.presentation.model.UIModel;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortScope;
/**
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/NodeDef.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/NodeDef.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/NodeDef.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -24,7 +24,7 @@
import junit.framework.Assert;
import org.jboss.portal.presentation.model.ObjectTraversalType;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.test.model.state.structural.MockModel;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/UIObjectNode.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/UIObjectNode.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/UIObjectNode.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.test.model3;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.StateType;
import java.util.HashMap;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/UIObjectTree.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/UIObjectTree.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model3/UIObjectTree.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.test.model3;
import junit.framework.Assert;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortContext;
import java.util.ArrayList;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/structural/StructuralStateContextTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/structural/StructuralStateContextTestCase.java 2008-04-28 10:47:59 UTC (rev 10723)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/structural/StructuralStateContextTestCase.java 2008-04-28 10:51:53 UTC (rev 10724)
@@ -27,7 +27,7 @@
import org.jboss.portal.presentation.impl.state.structural.StructuralNode;
import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
import org.jboss.portal.presentation.impl.state.structural.WindowNode;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
15 years, 12 months
JBoss Portal SVN: r10723 - in modules/presentation/trunk: ajax/src/test/java/org/jboss/portal/presentation/test/portal and 29 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-28 06:47:59 -0400 (Mon, 28 Apr 2008)
New Revision: 10723
Added:
modules/presentation/trunk/portlet/
modules/presentation/trunk/portlet/pom.xml
modules/presentation/trunk/portlet/src/
modules/presentation/trunk/portlet/src/main/
modules/presentation/trunk/portlet/src/main/java/
modules/presentation/trunk/portlet/src/main/java/org/
modules/presentation/trunk/portlet/src/main/java/org/jboss/
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/PortletPresentationServer.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralEventControllerContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletControllerContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletPageNavigationalState.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralStateControllerContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/protocol/
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/protocol/PortletContainerAction.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortletInvocationContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationSecurityContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java
modules/presentation/trunk/portlet/src/main/resources/
modules/presentation/trunk/portlet/src/test/
modules/presentation/trunk/portlet/src/test/java/
modules/presentation/trunk/portlet/src/test/resources/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeFactory.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java
Removed:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralEventControllerContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletControllerContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletPageNavigationalState.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralStateControllerContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationClientContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationInstanceContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortalContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortletInvocationContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationSecurityContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationServerContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationWindowContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CommandAction.java
Modified:
modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/PresentationServerImpl.java
modules/presentation/trunk/classic/pom.xml
modules/presentation/trunk/classic/src/assemble/presentation-war.xml
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
modules/presentation/trunk/pom.xml
modules/presentation/trunk/presentation/pom.xml
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationClient.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateUpdatePhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectUpdate.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectVisit.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java
Log:
modularize portlet integration in a separate module
Modified: modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/PresentationServerImpl.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/PresentationServerImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -66,11 +66,6 @@
return structuralStateContext;
}
- public String render(ProtocolAction action) throws IllegalArgumentException
- {
- throw new UnsupportedOperationException();
- }
-
/**
*
*/
Modified: modules/presentation/trunk/classic/pom.xml
===================================================================
--- modules/presentation/trunk/classic/pom.xml 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/classic/pom.xml 2008-04-28 10:47:59 UTC (rev 10723)
@@ -21,6 +21,12 @@
</dependency>
<dependency>
+ <groupId>org.jboss.portal.presentation</groupId>
+ <artifactId>presentation-portlet</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>sun-servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
Modified: modules/presentation/trunk/classic/src/assemble/presentation-war.xml
===================================================================
--- modules/presentation/trunk/classic/src/assemble/presentation-war.xml 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/classic/src/assemble/presentation-war.xml 2008-04-28 10:47:59 UTC (rev 10723)
@@ -33,6 +33,7 @@
<include>org.jboss.portal.portlet:portlet-mc</include>
<include>org.jboss.portal.portlet:portlet-samples</include>
<include>org.jboss.portal.presentation:presentation-presentation</include>
+ <include>org.jboss.portal.presentation:presentation-portlet</include>
<include>javax.ccpp:ccpp</include>
<include>javax.portlet:portlet-api</include>
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.classic;
-import org.jboss.portal.portlet.URLFormat;
import org.jboss.portal.presentation.classic.model.ClassicUINode;
import org.jboss.portal.presentation.classic.model.ClassicViewPortContext;
import org.jboss.portal.presentation.classic.model.DefaultPageViewPortScope;
@@ -55,6 +54,7 @@
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.WebResponse;
import org.jboss.portal.web.impl.DefaultServletContainerFactory;
+import org.jboss.portal.common.servlet.URLFormat;
import java.io.IOException;
import java.io.PrintWriter;
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -29,6 +29,7 @@
import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
import org.jboss.portal.presentation.server.PresentationServer;
import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.presentation.portlet.PortletPresentationServer;
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.WebResponse;
import org.jboss.portal.web.endpoint.EndPointServlet;
@@ -74,7 +75,10 @@
PortletInvoker portletInvoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
//
- this.server = new PresentationServerImpl(structuralStateContext, portletInvoker);
+ PresentationServer blahServer = new PresentationServerImpl(structuralStateContext);
+
+ //
+ this.server = new PortletPresentationServer(portletInvoker, blahServer);
}
protected void service(WebRequest req, WebResponse resp) throws ServletException, IOException
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -26,9 +26,9 @@
import org.jboss.portal.presentation.protocol.PostActivation;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
-import org.jboss.portal.presentation.impl.server.portlet.PortletContainerAction;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextSerialization;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.portlet.protocol.PortletContainerAction;
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.Body;
import org.jboss.portal.portlet.LifeCyclePhase;
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -27,9 +27,9 @@
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.UIObjectAction;
import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
-import org.jboss.portal.presentation.impl.server.portlet.PortletContainerAction;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextSerialization;
+import org.jboss.portal.presentation.portlet.protocol.PortletContainerAction;
import org.jboss.portal.web.WebResponse;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.io.SerializationFilter;
Modified: modules/presentation/trunk/pom.xml
===================================================================
--- modules/presentation/trunk/pom.xml 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/pom.xml 2008-04-28 10:47:59 UTC (rev 10723)
@@ -28,6 +28,7 @@
<modules>
<module>build</module>
<module>presentation</module>
+ <module>portlet</module>
<module>classic</module>
<!--<module>ajax</module>-->
</modules>
Added: modules/presentation/trunk/portlet/pom.xml
===================================================================
--- modules/presentation/trunk/portlet/pom.xml (rev 0)
+++ modules/presentation/trunk/portlet/pom.xml 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,69 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.presentation</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>presentation-portlet</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal Presentation Framework - Portlet Module</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.portal.presentation</groupId>
+ <artifactId>presentation-presentation</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>sun-servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-portal</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-mc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.web</groupId>
+ <artifactId>web-web</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-controller</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/PortletPresentationServer.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/PortletPresentationServer.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/PortletPresentationServer.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,214 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet;
+
+import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.presentation.server.PresentationResponse;
+import org.jboss.portal.presentation.server.PresentationRequest;
+import org.jboss.portal.presentation.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.model.tree.UINode;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.portlet.protocol.PortletContainerAction;
+import org.jboss.portal.presentation.portlet.controller.StructuralPortletPageNavigationalState;
+import org.jboss.portal.presentation.portlet.controller.StructuralPortletControllerContext;
+import org.jboss.portal.presentation.impl.model.tree.UINodeFactory;
+import org.jboss.portal.portlet.controller.request.ControllerRequest;
+import org.jboss.portal.portlet.controller.request.PortletActionRequest;
+import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
+import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
+import org.jboss.portal.portlet.controller.PortletController;
+import org.jboss.portal.portlet.controller.response.ControllerResponse;
+import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.common.NotYetImplemented;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletPresentationServer implements PresentationServer
+{
+
+ /** . */
+ private PortletInvoker portletInvoker;
+
+ /** . */
+ private PresentationServer next;
+
+ public PortletPresentationServer(PortletInvoker portletInvoker, PresentationServer next)
+ {
+ this.portletInvoker = portletInvoker;
+ this.next = next;
+ }
+
+ public StructuralStateContext getStructuralStateContext()
+ {
+ return next.getStructuralStateContext();
+ }
+
+ public WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException
+ {
+ try
+ {
+ NavigationalStateContext navigationalStateContext = client.getNavigationalStateContext();
+ StructuralStateContext structuralStateContext = next.getStructuralStateContext();
+ UINode windowNode = UINodeFactory.createNode(navigationalStateContext, structuralStateContext, windowId);
+
+ //
+ UINode pageNode = windowNode.getParent();
+
+ //
+ PortletController controller = new PortletController();
+
+ //
+ StructuralPortletControllerContext portletControllerContext = new StructuralPortletControllerContext(
+ client,
+ pageNode,
+ portletInvoker);
+
+ //
+ StructuralPortletPageNavigationalState pageNavigationalState = new StructuralPortletPageNavigationalState(
+ portletControllerContext,
+ client.getNavigationalStateContext(),
+ StructuralPortletPageNavigationalState.READ_ONLY_MODE);
+
+ PortletInvocationResponse response = controller.render(portletControllerContext, null, pageNavigationalState, windowId);
+
+ //
+ if (response instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)response;
+ return new WindowContent(0, fragment.getTitle(), fragment.getContent());
+ }
+ else
+ {
+ return new WindowContent(0, "Unexpected response for window " + windowId, "");
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new PresentationServerException(e);
+ }
+ }
+
+ public PresentationResponse process(PresentationClient client, PresentationRequest request) throws PresentationServerException
+ {
+ ProtocolAction action = request.getProtocolAction();
+
+ //
+ if (action instanceof PortletContainerAction)
+ {
+ PortletContainerAction pcAction = (PortletContainerAction)action;
+
+ NavigationalStateContext navigationalStateContext = client.getNavigationalStateContext();
+ StructuralStateContext structuralStateContext = next.getStructuralStateContext();
+ UINode windowNode = UINodeFactory.createNode(navigationalStateContext, structuralStateContext, pcAction.getTargetId());
+
+ //
+ UINode pageNode = windowNode.getParent();
+
+ //
+ StructuralPortletControllerContext portletControllerContext = new StructuralPortletControllerContext(
+ client,
+ pageNode,
+ portletInvoker);
+
+ StructuralPortletPageNavigationalState pageNavigationalState = new StructuralPortletPageNavigationalState(
+ portletControllerContext,
+ client.getNavigationalStateContext(),
+ StructuralPortletPageNavigationalState.CLONE_AND_WRITE_MODE);
+
+ //
+ ControllerRequest controllerRequest;
+ switch (pcAction.getPhase())
+ {
+ case ACTION:
+ controllerRequest = new PortletActionRequest(
+ pcAction.getTargetId(),
+ pcAction.getState(),
+ pcAction.getForm(),
+ pageNavigationalState.getPortletWindowNavigationalState(pcAction.getTargetId()),
+ pageNavigationalState
+ );
+ break;
+ case RENDER:
+ PortletWindowNavigationalState windowNavigationalState = new PortletWindowNavigationalState(
+ pcAction.getState(),
+ pcAction.getMode(),
+ pcAction.getWindowState()
+ );
+ controllerRequest = new PortletRenderRequest(
+ pcAction.getTargetId(),
+ windowNavigationalState,
+ null,
+ pageNavigationalState
+ );
+ break;
+ default:
+ throw new NotYetImplemented();
+ }
+
+ //
+ PortletController controller = new PortletController();
+
+ //
+ try
+ {
+ ControllerResponse response = controller.process(portletControllerContext, controllerRequest);
+
+ if (response instanceof PageUpdateResponse)
+ {
+ PageUpdateResponse pageUpdate = (PageUpdateResponse)response;
+
+ //
+ NavigationalStateContext nsc = client.getNavigationalStateContext();
+
+ //
+ StructuralPortletPageNavigationalState blah = (StructuralPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
+
+ //
+ blah.flush();
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ return new PresentationResponse(new ShowUIObjectResponse(pageNode.getObject().getId()));
+ }
+ else
+ {
+ return next.process(client, request);
+ }
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralEventControllerContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralEventControllerContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralEventControllerContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.controller;
+
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
+import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralEventControllerContext implements EventControllerContext
+{
+
+ /** . */
+ private final StructuralPortletControllerContext portletControllerContext;
+
+ public StructuralEventControllerContext(StructuralPortletControllerContext portletControllerContext)
+ {
+ this.portletControllerContext = portletControllerContext;
+ }
+
+ public void eventProduced(EventPhaseContext context, PortletWindowEvent producedEvent, PortletWindowEvent sourceEvent)
+ {
+ for (String windowId : portletControllerContext.getWindowIds())
+ {
+ PortletInfo portletInfo = portletControllerContext.getPortletInfo(windowId);
+ if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
+ {
+ PortletWindowEvent distributedEvent = new PortletWindowEvent(producedEvent.getName(), producedEvent.getPayload(), windowId);
+ context.queueEvent(distributedEvent);
+ }
+ }
+ }
+
+ public void eventConsumed(EventPhaseContext context, PortletWindowEvent consumedEvent, PortletInvocationResponse consumerResponse)
+ {
+ }
+
+ public void eventFailed(EventPhaseContext context, PortletWindowEvent failedEvent, Throwable throwable)
+ {
+ }
+
+ public void eventDiscarded(EventPhaseContext context, PortletWindowEvent discardedEvent, int cause)
+ {
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletControllerContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletControllerContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletControllerContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,208 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.controller;
+
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
+import org.jboss.portal.portlet.controller.PortletControllerContext;
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.ResourceInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationPortletInvocationContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationServerContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationWindowContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationInstanceContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationClientContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationPortalContext;
+import org.jboss.portal.presentation.portlet.spi.PresentationSecurityContext;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.model.tree.UINode;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.state.StateType;
+
+import javax.servlet.http.Cookie;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralPortletControllerContext implements PortletControllerContext
+{
+
+ /** . */
+ private final UINode pageNode;
+
+ /** . */
+ private final PortletInvoker invoker;
+
+ /** . */
+ private final StateControllerContext stateControllerContext;
+
+ /** A map of window ids to portlets. */
+ private final Map<String, Portlet> portlets;
+
+ /** A map of window ids to windows. */
+ private final Map<String, UINode> windows;
+
+ /** . */
+ private final PresentationClient client;
+
+ /** . */
+ private final EventControllerContext eventControllerContext;
+
+ public StructuralPortletControllerContext(
+ PresentationClient client,
+ UINode pageNode,
+ PortletInvoker invoker)
+ {
+ Map<String, Portlet> portlets = new HashMap<String, Portlet>();
+ Map<String, UINode> windows = new HashMap<String, UINode>();
+
+ //
+ for (UINode childNode : pageNode.getChildren())
+ {
+ UIObject child = childNode.getObject();
+
+ if (child instanceof UIWindow)
+ {
+ String portletRef = child.getProperty(StateType.STRUCTURAL, "portlet-ref", String.class);
+
+ //
+ if (portletRef != null)
+ {
+ try
+ {
+ Portlet portlet = invoker.getPortlet(PortletContext.createPortletContext(portletRef));
+
+ //
+ portlets.put(child.getId(), portlet);
+ windows.put(child.getId(), childNode);
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ //
+ this.client = client;
+ this.pageNode = pageNode;
+ this.invoker = invoker;
+ this.stateControllerContext = new StructuralStateControllerContext(this);
+ this.portlets = portlets;
+ this.windows = windows;
+ this.eventControllerContext = new StructuralEventControllerContext(this);
+ }
+
+ public String getPageId()
+ {
+ return pageNode.getObject().getId();
+ }
+
+ public Set<String> getWindowIds()
+ {
+ return windows.keySet();
+ }
+
+ public PortletInfo getPortletInfo(String windowId)
+ {
+ return portlets.get(windowId).getInfo();
+ }
+
+ public PortletInvocationContext createPortletInvocationContext(String windowId, PortletPageNavigationalState pageNavigationalState)
+ {
+ return new PresentationPortletInvocationContext(client, this, windowId);
+ }
+
+ public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
+ {
+ return invoke((PortletInvocation)actionInvocation);
+ }
+
+ public PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
+ {
+ return invoke(eventInvocation);
+ }
+
+ public PortletInvocationResponse invoke(List<Cookie> requestCookies, RenderInvocation renderInvocation) throws PortletInvokerException
+ {
+ return invoke(renderInvocation);
+ }
+
+ public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException
+ {
+ return invoke((PortletInvocation)resourceInvocation);
+ }
+
+ private PortletInvocationResponse invoke(PortletInvocation portletInvocation) throws PortletInvokerException
+ {
+ PresentationPortletInvocationContext ctx = (PresentationPortletInvocationContext)portletInvocation.getContext();
+
+ //
+ UINode window = windows.get(ctx.getWindowId());
+
+ //
+ portletInvocation.setServerContext(new PresentationServerContext(client));
+ portletInvocation.setSecurityContext(new PresentationSecurityContext());
+ portletInvocation.setClientContext(new PresentationClientContext());
+ portletInvocation.setInstanceContext(new PresentationInstanceContext(window));
+ portletInvocation.setPortalContext(new PresentationPortalContext());
+ portletInvocation.setUserContext(new AbstractUserContext());
+ portletInvocation.setWindowContext(new PresentationWindowContext(window));
+
+ //
+ Portlet portlet = portlets.get(ctx.getWindowId());
+ portletInvocation.setTarget(portlet.getContext());
+
+ //
+ return invoker.invoke(portletInvocation);
+ }
+
+ public EventControllerContext getEventControllerContext()
+ {
+ return eventControllerContext;
+ }
+
+ public StateControllerContext getStateControllerContext()
+ {
+ return stateControllerContext;
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletPageNavigationalState.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletPageNavigationalState.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralPortletPageNavigationalState.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,290 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.controller;
+
+import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.info.ParameterInfo;
+import org.jboss.portal.portlet.info.NavigationInfo;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import javax.xml.namespace.QName;
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralPortletPageNavigationalState implements PortletPageNavigationalState
+{
+
+ /** . */
+ public static final int READ_ONLY_MODE = 0;
+
+ /** . */
+ public static final int READ_WRITE_MODE = 1;
+
+ /** . */
+ public static final int CLONE_AND_WRITE_MODE = 2;
+
+ /** . */
+ private final StructuralPortletControllerContext portletControllerContext;
+
+ /** . */
+ private final NavigationalStateContext navigationalStateContext;
+
+ /** . */
+ private final boolean modifiable;
+
+ public StructuralPortletPageNavigationalState(
+ StructuralPortletControllerContext portletControllerContext,
+ NavigationalStateContext navigationalStateContext,
+ int mode)
+ {
+ boolean modifiable;
+ switch (mode)
+ {
+ case READ_ONLY_MODE:
+ modifiable = false;
+ break;
+ case READ_WRITE_MODE:
+ modifiable = true;
+ break;
+ case CLONE_AND_WRITE_MODE:
+ modifiable = true;
+ navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
+ this.portletControllerContext = portletControllerContext;
+ this.navigationalStateContext = navigationalStateContext;
+ this.modifiable = modifiable;
+ }
+
+ public StructuralPortletPageNavigationalState(
+ StructuralPortletPageNavigationalState pageNavigationalState,
+ int mode)
+ {
+ NavigationalStateContext navigationalStateContext = pageNavigationalState.navigationalStateContext;
+ boolean modifiable;
+ switch (mode)
+ {
+ case READ_ONLY_MODE:
+ modifiable = false;
+ break;
+ case READ_WRITE_MODE:
+ modifiable = true;
+ break;
+ case CLONE_AND_WRITE_MODE:
+ modifiable = true;
+ navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
+ this.portletControllerContext = pageNavigationalState.portletControllerContext;
+ this.navigationalStateContext = navigationalStateContext;
+ this.modifiable = modifiable;
+ }
+
+ public void flush()
+ {
+ if (navigationalStateContext instanceof DelegatingNavigationalStateContext)
+ {
+ ((DelegatingNavigationalStateContext)navigationalStateContext).flush(true);
+ }
+ }
+
+ public Set<String> getPortletWindowIds()
+ {
+ return portletControllerContext.getWindowIds();
+ }
+
+ public PortletWindowNavigationalState getPortletWindowNavigationalState(String portletWindowId) throws IllegalArgumentException
+ {
+ Mode mode = (Mode)navigationalStateContext.getProperty(portletWindowId, "mode");
+ WindowState windowState = (WindowState)navigationalStateContext.getProperty(portletWindowId, "windowstate");
+ StateString portletNavigationalState = (StateString)navigationalStateContext.getProperty(portletWindowId, "portlet");
+ return new PortletWindowNavigationalState(portletNavigationalState, mode, windowState);
+ }
+
+ public void setPortletWindowNavigationalState(String portletWindowId, PortletWindowNavigationalState portletWindowState) throws IllegalArgumentException, IllegalStateException
+ {
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ navigationalStateContext.setProperty(portletWindowId, "windowstate", portletWindowState.getWindowState());
+ navigationalStateContext.setProperty(portletWindowId, "mode", portletWindowState.getMode());
+ navigationalStateContext.setProperty(portletWindowId, "portlet", portletWindowState.getPortletNavigationalState());
+ }
+
+ public Map<String, String[]> getPortletPublicNavigationalState(String portletWindowId) throws IllegalArgumentException
+ {
+ Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ Map<String, String[]> portletParameters = null;
+
+ //
+ if (pageParameters != null)
+ {
+ NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
+
+ //
+ for (ParameterInfo parameterInfo : navigationInfo.getPublicParameters())
+ {
+ QName parameterName = parameterInfo.getName();
+ String[] parameterValue = pageParameters.get(parameterName);
+
+ //
+ if (parameterValue != null)
+ {
+ if (portletParameters == null)
+ {
+ portletParameters = new HashMap<String, String[]>();
+ }
+
+ //
+ portletParameters.put(parameterInfo.getId(), parameterValue);
+ }
+ }
+ }
+
+ //
+ return portletParameters;
+ }
+
+ public void setPortletPublicNavigationalState(String portletWindowId, Map<String, String[]> update) throws IllegalArgumentException, IllegalStateException
+ {
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ if (pageParameters == null)
+ {
+ pageParameters = new HashMap<QName, String[]>();
+ }
+
+ //
+ NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
+
+ //
+ for (Map.Entry<String, String[]> entry : update.entrySet())
+ {
+ ParameterInfo parameterInfo = navigationInfo.getPublicParameter(entry.getKey());
+
+ //
+ QName parameterName = parameterInfo.getName();
+
+ if (entry.getValue().length == 0)
+ {
+ pageParameters.remove(parameterName);
+ }
+ else
+ {
+ pageParameters.put(parameterName, entry.getValue());
+ }
+ }
+
+ //
+ navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
+ }
+
+ public Set<QName> getPublicNames()
+ {
+ HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ return pageParameters != null ? pageParameters.keySet() : null;
+ }
+
+ public String[] getPublicNavigationalState(QName name) throws IllegalArgumentException
+ {
+ Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ return pageParameters != null ? pageParameters.get(name) : null;
+ }
+
+ public void setPublicNavigationalState(QName name, String[] value) throws IllegalArgumentException, IllegalStateException
+ {
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ if (pageParameters == null)
+ {
+ pageParameters = new HashMap<QName, String[]>();
+ }
+
+ //
+ pageParameters.put(name, value);
+
+ //
+ navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
+ }
+
+ public void removePublicNavigationalState(QName name) throws IllegalArgumentException, IllegalStateException
+ {
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+
+ //
+ if (pageParameters != null)
+ {
+ pageParameters.remove(name);
+
+ //
+ navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
+ }
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralStateControllerContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralStateControllerContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/StructuralStateControllerContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.controller;
+
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralStateControllerContext implements StateControllerContext
+{
+
+ /** . */
+ private StructuralPortletControllerContext portletControllerContext;
+
+ public StructuralStateControllerContext(StructuralPortletControllerContext portletControllerContext)
+ {
+ this.portletControllerContext = portletControllerContext;
+ }
+
+ public PortletPageNavigationalState clonePortletPageNavigationalState(PortletPageNavigationalState portletPageNavigationalState, boolean modifiable)
+ {
+
+ return new StructuralPortletPageNavigationalState(
+ (StructuralPortletPageNavigationalState)portletPageNavigationalState,
+ modifiable ? StructuralPortletPageNavigationalState.CLONE_AND_WRITE_MODE : StructuralPortletPageNavigationalState.READ_ONLY_MODE);
+ }
+
+ public PortletPageNavigationalState createPortletPageNavigationalState(boolean modifiable)
+ {
+ return new StructuralPortletPageNavigationalState(
+ portletControllerContext,
+ new NavigationalStateContextImpl(),
+ modifiable ? StructuralPortletPageNavigationalState.READ_WRITE_MODE : StructuralPortletPageNavigationalState.READ_ONLY_MODE);
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/protocol/PortletContainerAction.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/protocol/PortletContainerAction.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/protocol/PortletContainerAction.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,168 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.protocol;
+
+import org.jboss.portal.presentation.protocol.UIObjectCommandAction;
+import org.jboss.portal.portlet.LifeCyclePhase;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletContainerAction extends UIObjectCommandAction
+{
+
+ /** The portlet phase. */
+ private final LifeCyclePhase phase;
+
+ /** The navigational state. */
+ private final StateString state;
+
+ /** . */
+ private final Map<String, String[]> form;
+
+ /** . */
+ private final Mode mode;
+
+ /** . */
+ private final WindowState windowState;
+
+ /** . */
+ private final Map<String, String[]> publicNavigationalStateChanges;
+
+ private PortletContainerAction(
+ String targetId,
+ LifeCyclePhase phase,
+ StateString state,
+ Mode mode,
+ WindowState windowState,
+ Map<String, String[]> publicNavigationalStateChanges,
+ Map<String, String[]> form) throws IllegalArgumentException
+ {
+ super(targetId);
+
+ //
+ this.phase = phase;
+ this.state = state;
+ this.mode = mode;
+ this.windowState = windowState;
+ this.publicNavigationalStateChanges = publicNavigationalStateChanges;
+ this.form = form;
+ }
+
+ public LifeCyclePhase getPhase()
+ {
+ return phase;
+ }
+
+ public StateString getState()
+ {
+ return state;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public Map<String, String[]> getPublicNavigationalStateChanges()
+ {
+ return publicNavigationalStateChanges;
+ }
+
+ public Map<String, String[]> getForm()
+ {
+ return form;
+ }
+
+ public static PortletContainerAction create(String targetId, ContainerURL containerURL)
+ {
+ if (containerURL instanceof RenderURL)
+ {
+ RenderURL renderURL = (RenderURL)containerURL;
+
+ //
+ return new PortletContainerAction(
+ targetId,
+ LifeCyclePhase.RENDER,
+ renderURL.getNavigationalState(),
+ renderURL.getMode(),
+ renderURL.getWindowState(),
+ renderURL.getPublicNavigationalStateChanges(),
+ null);
+
+ }
+ else if (containerURL instanceof ActionURL)
+ {
+ ActionURL actionURL = (ActionURL)containerURL;
+
+ //
+ return new PortletContainerAction(
+ targetId,
+ LifeCyclePhase.ACTION,
+ actionURL.getInteractionState(),
+ actionURL.getMode(),
+ actionURL.getWindowState(),
+ null,
+ null);
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public static PortletContainerAction createRender(
+ String targetId,
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState,
+ Map<String, String[]> publicNavigationalStateChanges)
+ {
+ return new PortletContainerAction(targetId, LifeCyclePhase.RENDER, navigationalState, mode, windowState, publicNavigationalStateChanges, null);
+ }
+
+ public static PortletContainerAction createAction(
+ String targetId,
+ Mode mode,
+ WindowState windowState,
+ StateString interactionState,
+ Map<String, String[]> form)
+ {
+ return new PortletContainerAction(targetId, LifeCyclePhase.ACTION, interactionState, mode, windowState, null, form);
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.common.util.MultiValuedPropertyMap;
+import org.jboss.portal.common.util.SimpleMultiValuedPropertyMap;
+import org.jboss.portal.portlet.spi.ClientContext;
+
+import javax.servlet.http.Cookie;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationClientContext implements ClientContext
+{
+
+ public PresentationClientContext()
+ {
+ }
+
+ public String getMethod()
+ {
+ return "GET";
+ }
+
+ public MultiValuedPropertyMap<String> getProperties()
+ {
+ return new SimpleMultiValuedPropertyMap<String>();
+ }
+
+ public List<Cookie> getCookies()
+ {
+ return Collections.emptyList();
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.StateEvent;
+import org.jboss.portal.portlet.spi.InstanceContext;
+import org.jboss.portal.portlet.state.AccessMode;
+import org.jboss.portal.presentation.model.tree.UINode;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationInstanceContext implements InstanceContext
+{
+
+ /** . */
+ private final UINode window;
+
+ public PresentationInstanceContext(UINode window)
+ {
+ this.window = window;
+ }
+
+ public String getId()
+ {
+ return window.getObject().getId();
+ }
+
+ public AccessMode getAccessMode()
+ {
+ return AccessMode.READ_ONLY;
+ }
+
+ public void onStateEvent(StateEvent event)
+ {
+ throw new IllegalStateException();
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.portlet.spi.PortalContext;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationPortalContext implements PortalContext
+{
+ public String getInfo()
+ {
+ return "PresentationPortal";
+ }
+
+ public Set<WindowState> getWindowStates()
+ {
+ return Tools.toSet(WindowState.NORMAL);
+ }
+
+ public Set<Mode> getModes()
+ {
+ return Tools.toSet(Mode.VIEW);
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return Collections.emptyMap();
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortletInvocationContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortletInvocationContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortletInvocationContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,112 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.net.media.MediaType;
+import org.jboss.portal.presentation.portlet.protocol.PortletContainerAction;
+import org.jboss.portal.presentation.portlet.controller.StructuralPortletControllerContext;
+import org.jboss.portal.presentation.client.PresentationClient;
+
+import java.io.Writer;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationPortletInvocationContext implements PortletInvocationContext
+{
+
+ /** . */
+ private final MarkupInfo markup = new MarkupInfo(MediaType.TEXT_HTML, "UTF-8");
+
+ /** . */
+ private final StructuralPortletControllerContext portletControllerContext;
+
+ /** . */
+ private final String windowId;
+
+ /** . */
+ private final PresentationClient client;
+
+ public PresentationPortletInvocationContext(
+ PresentationClient client,
+ StructuralPortletControllerContext portletControllerContext,
+ String windowId)
+ {
+ this.client = client;
+ this.portletControllerContext = portletControllerContext;
+ this.windowId = windowId;
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+
+ public MarkupInfo getMarkupInfo()
+ {
+ return markup;
+ }
+
+ public String encodeResourceURL(String url) throws IllegalArgumentException
+ {
+ return url;
+ }
+
+ public String renderURL(ContainerURL containerURL, URLFormat format)
+ {
+ PortletContainerAction action = PortletContainerAction.create(windowId, containerURL);
+
+ //
+ String url = client.renderURL(action, null);
+
+
+// StateControllerContext stateControllerContext = portletControllerContext.getStateControllerContext();
+// PortletPageNavigationalStateSerialization serialiation = new PortletPageNavigationalStateSerialization(stateControllerContext);
+// ControllerRequestParameterMapFactory parameterMapFactory = new ControllerRequestParameterMapFactory(serialiation);
+//
+// Map<String, String> parameters = parameterMapFactory.encode(null, windowId, containerURL);
+//
+// Map<String, String[]> blah = new HashMap<String, String[]>();
+// for (Map.Entry<String, String> entry : parameters.entrySet())
+// {
+// blah.put(entry.getKey(), new String[]{entry.getValue()});
+// }
+//
+// GetActivation getActivation = new GetActivation(windowId, "/", blah);
+//
+// String url = client.renderURL(getActivation, null);
+
+ return url;
+ }
+
+ public void renderURL(Writer writer, ContainerURL containerURL, URLFormat format) throws IOException
+ {
+ writer.write(renderURL(containerURL, format));
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationSecurityContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationSecurityContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationSecurityContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.SecurityContext;
+
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationSecurityContext implements SecurityContext
+{
+ public boolean isSecure()
+ {
+ return false;
+ }
+
+ public boolean isAuthenticated()
+ {
+ return false;
+ }
+
+ public String getAuthType()
+ {
+ return null;
+ }
+
+ public String getRemoteUser()
+ {
+ return null;
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return null;
+ }
+
+ public boolean isUserInRole(String roleName)
+ {
+ return false;
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.ServerContext;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.web.RequestDispatchCallback;
+import org.jboss.portal.web.ServletContainer;
+import org.jboss.portal.web.ServletContextDispatcher;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationServerContext implements ServerContext
+{
+
+ /** . */
+ private final PresentationClient presentationClient;
+
+ public PresentationServerContext(PresentationClient presentationClient)
+ {
+ this.presentationClient = presentationClient;
+ }
+
+ public String getScheme()
+ {
+ return "http";
+ }
+
+ public String getServerName()
+ {
+ return "localhost";
+ }
+
+ public int getServerPort()
+ {
+ return 8080;
+ }
+
+ public Object dispatch(ServletContainer servletContainer, ServletContext targetServletContext, RequestDispatchCallback callback, Object handback) throws Exception
+ {
+ ServletContextDispatcher dispatcher = presentationClient.getDispatcher();
+
+ //
+ return dispatcher.include(targetServletContext, callback, handback);
+ }
+}
Added: modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java (rev 0)
+++ modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.presentation.model.tree.UINode;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationWindowContext implements WindowContext
+{
+
+ /** . */
+ private final UINode window;
+
+ public PresentationWindowContext(UINode window)
+ {
+ this.window = window;
+ }
+
+ public String getId()
+ {
+ return window.getObject().getId();
+ }
+}
Modified: modules/presentation/trunk/presentation/pom.xml
===================================================================
--- modules/presentation/trunk/presentation/pom.xml 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/pom.xml 2008-04-28 10:47:59 UTC (rev 10723)
@@ -22,12 +22,12 @@
<artifactId>common-common</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.portal.portlet</groupId>
- <artifactId>portlet-portlet</artifactId>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-portal</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.portal.portlet</groupId>
- <artifactId>portlet-controller</artifactId>
+ <groupId>org.jboss.portal.web</groupId>
+ <artifactId>web-web</artifactId>
</dependency>
</dependencies>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationClient.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationClient.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationClient.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -22,10 +22,10 @@
******************************************************************************/
package org.jboss.portal.presentation.client;
-import org.jboss.portal.portlet.URLFormat;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.web.ServletContextDispatcher;
+import org.jboss.portal.common.servlet.URLFormat;
import java.io.IOException;
import java.io.Writer;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -28,6 +28,7 @@
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.state.structural.StructuralObject;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -111,7 +112,7 @@
case SINGLE:
return new ObjectVisit(object, true);
case RECURSIVE:
- StructuralObject.Refresh refresh = structuralStateContext.refresh(object.structuralObject);
+ StructuralObject.Refresh refresh = structuralStateContext.refresh(object.getStructuralObject());
ChildrenVisit childrenVisit = new ChildrenVisit();
//
@@ -152,7 +153,7 @@
private ObjectVisit load(StructuralObject structuralObject)
{
- UIObjectImpl object = UIObjectImpl.create(navigationalStateContext, structuralObject);
+ UIObjectImpl object = UIObjectImpl.create(structuralObject, new InternalObjectContext(navigationalStateContext));
//
ObjectTraversalType traversalType = scope.enterObject(object);
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateUpdatePhase.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateUpdatePhase.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateUpdatePhase.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -23,6 +23,7 @@
package org.jboss.portal.presentation.impl.model;
import org.jboss.portal.presentation.model.ViewPortContext;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
import java.util.ArrayList;
import java.util.HashMap;
@@ -207,7 +208,7 @@
if (object != null)
{
return new ObjectUpdate.UpdateObject(
- object.structuralObject,
+ object.getStructuralObject(),
childrenStatus,
addedChildrenUpdates,
removedChildrenUpdates,
@@ -230,9 +231,12 @@
List<ObjectUpdate.RemoveChild> removedChildrenUpdates = new ArrayList<ObjectUpdate.RemoveChild>();
//
- if (object.childRefs != null)
+ InternalObjectContext objectContext = (InternalObjectContext)object.getContext();
+
+ //
+ if (objectContext.childRefs != null)
{
- for (UIObjectRef removedChildRef : object.childRefs.values())
+ for (UIObjectRef removedChildRef : objectContext.childRefs.values())
{
if (removedChildRef.loaded)
{
@@ -251,7 +255,7 @@
}
//
- return new ObjectUpdate.UpdateObject(object.structuralObject, removedChildrenUpdates);
+ return new ObjectUpdate.UpdateObject(object.getStructuralObject(), removedChildrenUpdates);
}
else
{
@@ -277,9 +281,12 @@
List<ObjectUpdate.RemoveObject> removedChildrenUpdates = new ArrayList<ObjectUpdate.RemoveObject>();
//
- if (object.childRefs != null)
+ InternalObjectContext objectContext = (InternalObjectContext)object.getContext();
+
+ //
+ if (objectContext.childRefs != null)
{
- for (UIObjectRef removedChildRef : object.childRefs.values())
+ for (UIObjectRef removedChildRef : objectContext.childRefs.values())
{
if (removedChildRef.loaded)
{
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model;
+
+import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class InternalObjectContext implements UIObjectContext
+{
+
+ /** We keep track of what was loaded by the scope. */
+ Map<String, UIObjectRef> childRefs;
+
+ final NavigationalStateContext navigationalStateContext;
+
+ InternalObjectContext(NavigationalStateContext navigationalStateContext)
+ {
+ this.navigationalStateContext = navigationalStateContext;
+ }
+
+ public NavigationalStateContext getNavigationalStateContext()
+ {
+ return navigationalStateContext;
+ }
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectUpdate.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectUpdate.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectUpdate.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model.ViewPortContext;
import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
import java.util.HashMap;
import java.util.List;
@@ -122,21 +123,24 @@
}
// Perform state update
- if (object.structuralObject.equals(structuralObject))
+ if (object.getStructuralObject().equals(structuralObject))
{
- object.structuralObject = structuralObject;
+ object.setStructuralObject(structuralObject);
context.updateObject(structuralObject.getId());
}
//
+ InternalObjectContext objectContext = (InternalObjectContext)object.getContext();
+
+ //
if (childrenStatus != null)
{
- if (object.childRefs == null)
+ if (objectContext.childRefs == null)
{
- object.childRefs = new HashMap<String, UIObjectRef>();
+ objectContext.childRefs = new HashMap<String, UIObjectRef>();
for (Map.Entry<String, Boolean> childRefEntry : childrenStatus.entrySet())
{
- object.childRefs.put(childRefEntry.getKey(), new UIObjectRef(childRefEntry.getKey(), childRefEntry.getValue()));
+ objectContext.childRefs.put(childRefEntry.getKey(), new UIObjectRef(childRefEntry.getKey(), childRefEntry.getValue()));
}
//
@@ -157,7 +161,7 @@
}
else
{
- if (object.childRefs != null)
+ if (objectContext.childRefs != null)
{
context.destroyChildren(structuralObject.getId());
}
@@ -238,10 +242,13 @@
//
if (childrenStatus != null)
{
- object.childRefs = new HashMap<String, UIObjectRef>();
+ InternalObjectContext objectContext = (InternalObjectContext)object.getContext();
+
+ //
+ objectContext.childRefs = new HashMap<String, UIObjectRef>();
for (Map.Entry<String, Boolean> childRefEntry : childrenStatus.entrySet())
{
- object.childRefs.put(childRefEntry.getKey(), new UIObjectRef(childRefEntry.getKey(), childRefEntry.getValue()));
+ objectContext.childRefs.put(childRefEntry.getKey(), new UIObjectRef(childRefEntry.getKey(), childRefEntry.getValue()));
}
//
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectVisit.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectVisit.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectVisit.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,148 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.model;
-
-import org.jboss.portal.common.NotYetImplemented;
-import org.jboss.portal.common.reflect.Reflection;
-import org.jboss.portal.presentation.impl.model.ui.UIContextImpl;
-import org.jboss.portal.presentation.impl.model.ui.UIPageImpl;
-import org.jboss.portal.presentation.impl.model.ui.UIWindowImpl;
-import org.jboss.portal.presentation.model.UIObject;
-import org.jboss.portal.presentation.model.ui.UIContext;
-import org.jboss.portal.presentation.model.ui.UIPage;
-import org.jboss.portal.presentation.model.ui.UIWindow;
-import org.jboss.portal.presentation.state.StateException;
-import org.jboss.portal.presentation.state.StateType;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public abstract class UIObjectImpl implements UIObject
-{
-
- /** . */
- private final NavigationalStateContext navigationalStateContext;
-
- /** . */
- StructuralObject structuralObject;
-
- /** We keep track of what was loaded by the scope. */
- Map<String, UIObjectRef> childRefs;
-
- public static UIObjectImpl create(NavigationalStateContext navigationalStateContext, StructuralObject structuralObject)
- {
- UIObjectImpl object;
-
- //
- Class type = structuralObject.getState().getType();
-
- //
- if (type == UIWindow.class)
- {
- object = new UIWindowImpl(navigationalStateContext, structuralObject);
- }
- else if (type == UIPage.class)
- {
- object = new UIPageImpl(navigationalStateContext, structuralObject);
- }
- else if (type == UIContext.class)
- {
- object = new UIContextImpl(navigationalStateContext, structuralObject);
- }
- else
- {
- throw new NotYetImplemented();
- }
-
- //
- return object;
- }
-
- public UIObjectImpl(NavigationalStateContext navigationalStateContext, StructuralObject structuralObject)
- {
- this.navigationalStateContext = navigationalStateContext;
- this.structuralObject = structuralObject;
- }
-
- public String getId()
- {
- return structuralObject.getId();
- }
-
- public String getName()
- {
- return structuralObject.getState().getName();
- }
-
- public <T> T getProperty(StateType stateType, String propertyName, Class<T> propertyType) throws IllegalArgumentException, StateException
- {
- if (stateType == null)
- {
- throw new IllegalArgumentException();
- }
- if (propertyName == null)
- {
- throw new IllegalArgumentException();
- }
- if (propertyType == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- switch (stateType)
- {
- case STRUCTURAL:
- return Reflection.safeCast(structuralObject.getState().getProperties().get(propertyName), propertyType);
- case NAVIGATIONAL:
- return Reflection.safeCast(navigationalStateContext.getProperty(structuralObject.getId(), propertyName), propertyType);
- default:
- throw new AssertionError();
- }
- }
-
- public Set<String> getPropertyNames(StateType stateType)
- {
- if (stateType == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- switch (stateType)
- {
- case STRUCTURAL:
- return structuralObject.getState().getProperties().keySet();
- case NAVIGATIONAL:
- return navigationalStateContext.getPropertyNames(structuralObject.getId());
- default:
- throw new AssertionError();
- }
- }
-}
\ No newline at end of file
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeFactory.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeFactory.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeFactory.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model.tree;
+
+import org.jboss.portal.presentation.model.tree.UINode;
+import org.jboss.portal.presentation.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UINodeFactory
+{
+
+ /**
+ * Creates a user interface node.
+ *
+ * @param navigationalStateContext the navigational state context
+ * @param structuralStateContext the structural state context
+ * @param objectId the object id
+ * @return the corresponding node
+ */
+ public static UINode createNode(
+ NavigationalStateContext navigationalStateContext,
+ StructuralStateContext structuralStateContext,
+ String objectId)
+ {
+ StructuralObject object = structuralStateContext.load(objectId);
+
+ //
+ if (object != null)
+ {
+ return new UINodeImpl(navigationalStateContext, structuralStateContext, object);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/tree/UINodeImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,164 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model.tree;
+
+import org.jboss.portal.presentation.model.tree.UINode;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class UINodeImpl implements UINode, UIObjectContext
+{
+
+ /** . */
+ private final NavigationalStateContext navigationalStateContext;
+
+ /** . */
+ private final StructuralStateContext structuralStateContext;
+
+ /** . */
+ private final StructuralObject structuralObject;
+
+ /** . */
+ private Collection<UINode> children;
+
+ /** . */
+ private UINode parent;
+
+ /** . */
+ private boolean parentVisited;
+
+ /** . */
+ private UIObject object;
+
+ UINodeImpl(NavigationalStateContext navigationalStateContext, StructuralStateContext structuralStateContext, StructuralObject structuralObject)
+ {
+ this.navigationalStateContext = navigationalStateContext;
+ this.structuralStateContext = structuralStateContext;
+ this.structuralObject = structuralObject;
+ this.children = null;
+ this.parentVisited = false;
+ }
+
+ private UINodeImpl(NavigationalStateContext navigationalStateContext, StructuralStateContext structuralStateContext, StructuralObject structuralObject, Collection<UINode> children)
+ {
+ this.navigationalStateContext = navigationalStateContext;
+ this.structuralStateContext = structuralStateContext;
+ this.structuralObject = structuralObject;
+ this.children = children;
+ this.parentVisited = true;
+ }
+
+ public UIObject getObject()
+ {
+ if (object == null)
+ {
+ object = UIObjectImpl.create(structuralObject, this);
+ }
+
+ //
+ return object;
+ }
+
+ public UINode getParent()
+ {
+ if (!parentVisited)
+ {
+ StructuralObject parentObject = structuralStateContext.loadParent(structuralObject);
+
+ //
+ if (parentObject != null)
+ {
+ Collection<StructuralObject> siblingObjects = structuralStateContext.loadChildren(parentObject);
+ ArrayList<UINode> siblings = new ArrayList<UINode>(siblingObjects.size());
+ for (StructuralObject siblingObject : siblingObjects)
+ {
+ UINodeImpl sibling;
+ if (siblingObject.getId().equals(structuralObject.getId()))
+ {
+ sibling = this;
+ }
+ else
+ {
+ sibling = new UINodeImpl(navigationalStateContext, structuralStateContext, siblingObject);
+ sibling.parent = this;
+ sibling.parentVisited = true;
+ }
+
+ //
+ siblings.add(sibling);
+ }
+
+ //
+ parent = new UINodeImpl(navigationalStateContext, structuralStateContext, parentObject, siblings);
+ }
+
+ //
+ parentVisited = true;
+ }
+
+ //
+ return parent;
+ }
+
+ public Collection<UINode> getChildren()
+ {
+ if (children == null)
+ {
+ Collection<StructuralObject> childrenObject = structuralStateContext.loadChildren(structuralObject);
+ ArrayList<UINode> children = new ArrayList<UINode>(childrenObject.size());
+ for (StructuralObject childObject : childrenObject)
+ {
+ UINodeImpl child = new UINodeImpl(navigationalStateContext, structuralStateContext, childObject);
+ child.parent = this;
+ child.parentVisited = true;
+
+ //
+ children.add(child);
+ }
+
+ //
+ this.children = children;
+ }
+
+ //
+ return children;
+ }
+
+ // UIObjectContext implementation ***********************************************************************************
+
+ public NavigationalStateContext getNavigationalStateContext()
+ {
+ return navigationalStateContext;
+ }
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -22,9 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model.ui;
-import org.jboss.portal.presentation.impl.model.UIObjectImpl;
import org.jboss.portal.presentation.model.ui.UIContext;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.state.structural.StructuralObject;
/**
@@ -33,8 +31,10 @@
*/
public class UIContextImpl extends UIObjectImpl implements UIContext
{
- public UIContextImpl(NavigationalStateContext navigationalStateContext, StructuralObject structuralObject)
+ public UIContextImpl(
+ StructuralObject structuralObject,
+ UIObjectContext context)
{
- super(navigationalStateContext, structuralObject);
+ super(structuralObject, context);
}
}
\ No newline at end of file
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model.ui;
+
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+
+/**
+ * Just some context data for a uiobject that can be used by different concerns.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface UIObjectContext
+{
+
+ NavigationalStateContext getNavigationalStateContext();
+
+}
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java (from rev 10714, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIObjectImpl.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model.ui;
+
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.reflect.Reflection;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ui.UIContext;
+import org.jboss.portal.presentation.model.ui.UIPage;
+import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.state.StateException;
+import org.jboss.portal.presentation.state.StateType;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class UIObjectImpl implements UIObject
+{
+
+ /** . */
+ private final UIObjectContext context;
+
+ /** . */
+ private StructuralObject structuralObject;
+
+ public static UIObjectImpl create(
+ StructuralObject structuralObject,
+ UIObjectContext objectContext)
+ {
+ UIObjectImpl object;
+
+ //
+ Class type = structuralObject.getState().getType();
+
+ //
+ if (type == UIWindow.class)
+ {
+ object = new UIWindowImpl(structuralObject, objectContext);
+ }
+ else if (type == UIPage.class)
+ {
+ object = new UIPageImpl(structuralObject, objectContext);
+ }
+ else if (type == UIContext.class)
+ {
+ object = new UIContextImpl(structuralObject, objectContext);
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+
+ //
+ return object;
+ }
+
+ public UIObjectImpl(
+ StructuralObject structuralObject,
+ UIObjectContext context)
+ {
+ this.structuralObject = structuralObject;
+ this.context = context;
+ }
+
+ public String getId()
+ {
+ return structuralObject.getId();
+ }
+
+ public String getName()
+ {
+ return structuralObject.getState().getName();
+ }
+
+ public <T> T getProperty(StateType stateType, String propertyName, Class<T> propertyType) throws IllegalArgumentException, StateException
+ {
+ if (stateType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ switch (stateType)
+ {
+ case STRUCTURAL:
+ return Reflection.safeCast(structuralObject.getState().getProperties().get(propertyName), propertyType);
+ case NAVIGATIONAL:
+ return Reflection.safeCast(context.getNavigationalStateContext().getProperty(getStructuralObject().getId(), propertyName), propertyType);
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ public Set<String> getPropertyNames(StateType stateType)
+ {
+ if (stateType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ switch (stateType)
+ {
+ case STRUCTURAL:
+ return structuralObject.getState().getProperties().keySet();
+ case NAVIGATIONAL:
+ return context.getNavigationalStateContext().getPropertyNames(structuralObject.getId());
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ public StructuralObject getStructuralObject()
+ {
+ return structuralObject;
+ }
+
+ public void setStructuralObject(StructuralObject structuralObject)
+ {
+ if (!structuralObject.getState().getType().equals(this.structuralObject.getState().getType()))
+ {
+ // It means that actually we should not update the state but rather recreate the node in the
+ // view port, we need to think about what to do when this happens
+ throw new NotYetImplemented();
+ }
+
+ //
+ this.structuralObject = structuralObject;
+ }
+
+ public UIObjectContext getContext()
+ {
+ return context;
+ }
+}
\ No newline at end of file
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -22,9 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model.ui;
-import org.jboss.portal.presentation.impl.model.UIObjectImpl;
import org.jboss.portal.presentation.model.ui.UIPage;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.state.structural.StructuralObject;
/**
@@ -33,8 +31,10 @@
*/
public class UIPageImpl extends UIObjectImpl implements UIPage
{
- public UIPageImpl(NavigationalStateContext navigationalStateContext, StructuralObject structuralObject)
+ public UIPageImpl(
+ StructuralObject structuralObject,
+ UIObjectContext context)
{
- super(navigationalStateContext, structuralObject);
+ super(structuralObject, context);
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -24,10 +24,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.presentation.impl.model.UIObjectImpl;
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.state.StateType;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.state.structural.StructuralObject;
/**
@@ -37,9 +35,11 @@
public class UIWindowImpl extends UIObjectImpl implements UIWindow
{
- public UIWindowImpl(NavigationalStateContext navigationalStateContext, StructuralObject structuralObject)
+ public UIWindowImpl(
+ StructuralObject structuralObject,
+ UIObjectContext context)
{
- super(navigationalStateContext, structuralObject);
+ super(structuralObject, context);
}
public WindowState getWindowState()
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -25,11 +25,6 @@
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.impl.state.structural.StructuralNode;
import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
-import org.jboss.portal.presentation.impl.state.structural.WindowNode;
-import org.jboss.portal.presentation.impl.state.structural.PageNode;
-import org.jboss.portal.presentation.impl.server.portlet.StructuralPortletControllerContext;
-import org.jboss.portal.presentation.impl.server.portlet.PortletContainerAction;
-import org.jboss.portal.presentation.impl.server.portlet.StructuralPortletPageNavigationalState;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.protocol.ErrorResponse;
import org.jboss.portal.presentation.protocol.ProtocolAction;
@@ -42,19 +37,6 @@
import org.jboss.portal.presentation.server.PresentationServer;
import org.jboss.portal.presentation.server.PresentationServerException;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.controller.request.ControllerRequest;
-import org.jboss.portal.portlet.controller.request.PortletActionRequest;
-import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
-import org.jboss.portal.portlet.controller.PortletController;
-import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
-import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
-import org.jboss.portal.portlet.controller.response.ControllerResponse;
-import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.common.NotYetImplemented;
/**
@@ -67,13 +49,9 @@
/** . */
private StructuralStateContextImpl structuralStateContext;
- /** . */
- private PortletInvoker portletInvoker;
-
- public PresentationServerImpl(StructuralStateContextImpl structuralStateContext, PortletInvoker portletInvoker)
+ public PresentationServerImpl(StructuralStateContextImpl structuralStateContext)
{
this.structuralStateContext = structuralStateContext;
- this.portletInvoker = portletInvoker;
}
public StructuralStateContext getStructuralStateContext()
@@ -81,52 +59,9 @@
return structuralStateContext;
}
- public String render(ProtocolAction action) throws IllegalArgumentException
- {
- throw new UnsupportedOperationException();
- }
-
public WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException
{
- try
- {
- WindowNode window = (WindowNode)structuralStateContext.getNode(windowId);
-
- //
- PageNode page = (PageNode)window.getParent();
-
- //
- PortletController controller = new PortletController();
-
- //
- StructuralPortletControllerContext portletControllerContext = new StructuralPortletControllerContext(
- client,
- page,
- portletInvoker);
-
- //
- StructuralPortletPageNavigationalState pageNavigationalState = new StructuralPortletPageNavigationalState(
- portletControllerContext,
- client.getNavigationalStateContext(),
- StructuralPortletPageNavigationalState.READ_ONLY_MODE);
-
- PortletInvocationResponse response = controller.render(portletControllerContext, null, pageNavigationalState, windowId);
-
- //
- if (response instanceof FragmentResponse)
- {
- FragmentResponse fragment = (FragmentResponse)response;
- return new WindowContent(0, fragment.getTitle(), fragment.getContent());
- }
- else
- {
- return new WindowContent(0, "Unexpected response for window " + windowId, "");
- }
- }
- catch (PortletInvokerException e)
- {
- throw new PresentationServerException(e);
- }
+ throw new PresentationServerException();
}
public PresentationResponse process(PresentationClient client, PresentationRequest request) throws PresentationServerException
@@ -158,87 +93,6 @@
{
throw new NotYetImplemented();
}
- else if (objectAction instanceof PortletContainerAction)
- {
- PortletContainerAction pcAction = (PortletContainerAction)objectAction;
-
- //
- WindowNode targetWindow = (WindowNode)targetNode;
-
- //
- PageNode targetPage = (PageNode)targetWindow.getParent();
-
- //
- StructuralPortletControllerContext portletControllerContext = new StructuralPortletControllerContext(
- client,
- targetPage,
- portletInvoker);
-
- StructuralPortletPageNavigationalState pageNavigationalState = new StructuralPortletPageNavigationalState(
- portletControllerContext,
- client.getNavigationalStateContext(),
- StructuralPortletPageNavigationalState.CLONE_AND_WRITE_MODE);
-
- //
- ControllerRequest controllerRequest;
- switch (pcAction.getPhase())
- {
- case ACTION:
- controllerRequest = new PortletActionRequest(
- targetWindow.getId(),
- pcAction.getState(),
- pcAction.getForm(),
- pageNavigationalState.getPortletWindowNavigationalState(targetWindow.getId()),
- pageNavigationalState
- );
- break;
- case RENDER:
- PortletWindowNavigationalState windowNavigationalState = new PortletWindowNavigationalState(
- pcAction.getState(),
- pcAction.getMode(),
- pcAction.getWindowState()
- );
- controllerRequest = new PortletRenderRequest(
- targetWindow.getId(),
- windowNavigationalState,
- null,
- pageNavigationalState
- );
- break;
- default:
- throw new NotYetImplemented();
- }
-
- //
- PortletController controller = new PortletController();
-
- //
- try
- {
- ControllerResponse response = controller.process(portletControllerContext, controllerRequest);
-
- if (response instanceof PageUpdateResponse)
- {
- PageUpdateResponse pageUpdate = (PageUpdateResponse)response;
-
- //
- NavigationalStateContext nsc = client.getNavigationalStateContext();
-
- //
- StructuralPortletPageNavigationalState blah = (StructuralPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
-
- //
- blah.flush();
- }
- }
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
-
- //
- return new PresentationResponse(new ShowUIObjectResponse(targetPage.getId()));
- }
}
//
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,168 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet;
-
-import org.jboss.portal.presentation.protocol.UIObjectCommandAction;
-import org.jboss.portal.portlet.LifeCyclePhase;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.common.NotYetImplemented;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletContainerAction extends UIObjectCommandAction
-{
-
- /** The portlet phase. */
- private final LifeCyclePhase phase;
-
- /** The navigational state. */
- private final StateString state;
-
- /** . */
- private final Map<String, String[]> form;
-
- /** . */
- private final Mode mode;
-
- /** . */
- private final WindowState windowState;
-
- /** . */
- private final Map<String, String[]> publicNavigationalStateChanges;
-
- private PortletContainerAction(
- String targetId,
- LifeCyclePhase phase,
- StateString state,
- Mode mode,
- WindowState windowState,
- Map<String, String[]> publicNavigationalStateChanges,
- Map<String, String[]> form) throws IllegalArgumentException
- {
- super(targetId);
-
- //
- this.phase = phase;
- this.state = state;
- this.mode = mode;
- this.windowState = windowState;
- this.publicNavigationalStateChanges = publicNavigationalStateChanges;
- this.form = form;
- }
-
- public LifeCyclePhase getPhase()
- {
- return phase;
- }
-
- public StateString getState()
- {
- return state;
- }
-
- public Mode getMode()
- {
- return mode;
- }
-
- public WindowState getWindowState()
- {
- return windowState;
- }
-
- public Map<String, String[]> getPublicNavigationalStateChanges()
- {
- return publicNavigationalStateChanges;
- }
-
- public Map<String, String[]> getForm()
- {
- return form;
- }
-
- public static PortletContainerAction create(String targetId, ContainerURL containerURL)
- {
- if (containerURL instanceof RenderURL)
- {
- RenderURL renderURL = (RenderURL)containerURL;
-
- //
- return new PortletContainerAction(
- targetId,
- LifeCyclePhase.RENDER,
- renderURL.getNavigationalState(),
- renderURL.getMode(),
- renderURL.getWindowState(),
- renderURL.getPublicNavigationalStateChanges(),
- null);
-
- }
- else if (containerURL instanceof ActionURL)
- {
- ActionURL actionURL = (ActionURL)containerURL;
-
- //
- return new PortletContainerAction(
- targetId,
- LifeCyclePhase.ACTION,
- actionURL.getInteractionState(),
- actionURL.getMode(),
- actionURL.getWindowState(),
- null,
- null);
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- public static PortletContainerAction createRender(
- String targetId,
- StateString navigationalState,
- Mode mode,
- WindowState windowState,
- Map<String, String[]> publicNavigationalStateChanges)
- {
- return new PortletContainerAction(targetId, LifeCyclePhase.RENDER, navigationalState, mode, windowState, publicNavigationalStateChanges, null);
- }
-
- public static PortletContainerAction createAction(
- String targetId,
- Mode mode,
- WindowState windowState,
- StateString interactionState,
- Map<String, String[]> form)
- {
- return new PortletContainerAction(targetId, LifeCyclePhase.ACTION, interactionState, mode, windowState, null, form);
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralEventControllerContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralEventControllerContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralEventControllerContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,70 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet;
-
-import org.jboss.portal.portlet.controller.event.EventControllerContext;
-import org.jboss.portal.portlet.controller.event.EventPhaseContext;
-import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.info.PortletInfo;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StructuralEventControllerContext implements EventControllerContext
-{
-
- /** . */
- private final StructuralPortletControllerContext portletControllerContext;
-
- public StructuralEventControllerContext(StructuralPortletControllerContext portletControllerContext)
- {
- this.portletControllerContext = portletControllerContext;
- }
-
- public void eventProduced(EventPhaseContext context, PortletWindowEvent producedEvent, PortletWindowEvent sourceEvent)
- {
- for (String windowId : portletControllerContext.getWindowIds())
- {
- PortletInfo portletInfo = portletControllerContext.getPortletInfo(windowId);
- if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
- {
- PortletWindowEvent distributedEvent = new PortletWindowEvent(producedEvent.getName(), producedEvent.getPayload(), windowId);
- context.queueEvent(distributedEvent);
- }
- }
- }
-
- public void eventConsumed(EventPhaseContext context, PortletWindowEvent consumedEvent, PortletInvocationResponse consumerResponse)
- {
- }
-
- public void eventFailed(EventPhaseContext context, PortletWindowEvent failedEvent, Throwable throwable)
- {
- }
-
- public void eventDiscarded(EventPhaseContext context, PortletWindowEvent discardedEvent, int cause)
- {
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletControllerContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletControllerContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletControllerContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,205 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet;
-
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
-import org.jboss.portal.portlet.controller.event.EventControllerContext;
-import org.jboss.portal.portlet.controller.state.StateControllerContext;
-import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.EventInvocation;
-import org.jboss.portal.portlet.invocation.ResourceInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.presentation.impl.state.structural.PageNode;
-import org.jboss.portal.presentation.impl.state.structural.StructuralNode;
-import org.jboss.portal.presentation.impl.state.structural.WindowNode;
-import org.jboss.portal.presentation.impl.server.portlet.spi.PresentationPortletInvocationContext;
-import org.jboss.portal.presentation.impl.server.portlet.spi.PresentationServerContext;
-import org.jboss.portal.presentation.impl.server.portlet.spi.PresentationWindowContext;
-import org.jboss.portal.presentation.impl.server.portlet.spi.PresentationInstanceContext;
-import org.jboss.portal.presentation.impl.server.portlet.spi.PresentationClientContext;
-import org.jboss.portal.presentation.impl.server.portlet.spi.PresentationPortalContext;
-import org.jboss.portal.presentation.impl.server.portlet.spi.PresentationSecurityContext;
-import org.jboss.portal.presentation.client.PresentationClient;
-
-import javax.servlet.http.Cookie;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StructuralPortletControllerContext implements PortletControllerContext
-{
-
- /** . */
- private final PageNode page;
-
- /** . */
- private final PortletInvoker invoker;
-
- /** . */
- private final StateControllerContext stateControllerContext;
-
- /** A map of window ids to portlets. */
- private final Map<String, Portlet> portlets;
-
- /** A map of window ids to windows. */
- private final Map<String, WindowNode> windows;
-
- /** . */
- private final PresentationClient client;
-
- /** . */
- private final EventControllerContext eventControllerContext;
-
- public StructuralPortletControllerContext(
- PresentationClient client,
- PageNode page,
- PortletInvoker invoker)
- {
- Map<String, Portlet> portlets = new HashMap<String, Portlet>();
- Map<String, WindowNode> windows = new HashMap<String, WindowNode>();
-
- //
- for (StructuralNode child : page.getChildren())
- {
- if (child instanceof WindowNode)
- {
- String portletRef = child.getProperty("portlet-ref");
-
- //
- if (portletRef != null)
- {
- try
- {
- Portlet portlet = invoker.getPortlet(PortletContext.createPortletContext(portletRef));
-
- //
- portlets.put(child.getId(), portlet);
- windows.put(child.getId(), (WindowNode)child);
- }
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
- }
- }
- }
-
- //
- this.client = client;
- this.page = page;
- this.invoker = invoker;
- this.stateControllerContext = new StructuralStateControllerContext(this);
- this.portlets = portlets;
- this.windows = windows;
- this.eventControllerContext = new StructuralEventControllerContext(this);
- }
-
- public String getPageId()
- {
- return page.getId();
- }
-
- public Set<String> getWindowIds()
- {
- return windows.keySet();
- }
-
- public PortletInfo getPortletInfo(String windowId)
- {
- return portlets.get(windowId).getInfo();
- }
-
- public PortletInvocationContext createPortletInvocationContext(String windowId, PortletPageNavigationalState pageNavigationalState)
- {
- return new PresentationPortletInvocationContext(client, this, windowId);
- }
-
- public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
- {
- return invoke((PortletInvocation)actionInvocation);
- }
-
- public PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
- {
- return invoke(eventInvocation);
- }
-
- public PortletInvocationResponse invoke(List<Cookie> requestCookies, RenderInvocation renderInvocation) throws PortletInvokerException
- {
- return invoke(renderInvocation);
- }
-
- public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException
- {
- return invoke((PortletInvocation)resourceInvocation);
- }
-
- private PortletInvocationResponse invoke(PortletInvocation portletInvocation) throws PortletInvokerException
- {
- PresentationPortletInvocationContext ctx = (PresentationPortletInvocationContext)portletInvocation.getContext();
-
- //
- WindowNode window = windows.get(ctx.getWindowId());
-
- //
- portletInvocation.setServerContext(new PresentationServerContext(client));
- portletInvocation.setSecurityContext(new PresentationSecurityContext());
- portletInvocation.setClientContext(new PresentationClientContext());
- portletInvocation.setInstanceContext(new PresentationInstanceContext(window));
- portletInvocation.setPortalContext(new PresentationPortalContext());
- portletInvocation.setUserContext(new AbstractUserContext());
- portletInvocation.setWindowContext(new PresentationWindowContext(window));
-
- //
- Portlet portlet = portlets.get(ctx.getWindowId());
- portletInvocation.setTarget(portlet.getContext());
-
- //
- return invoker.invoke(portletInvocation);
- }
-
- public EventControllerContext getEventControllerContext()
- {
- return eventControllerContext;
- }
-
- public StateControllerContext getStateControllerContext()
- {
- return stateControllerContext;
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletPageNavigationalState.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletPageNavigationalState.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletPageNavigationalState.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,290 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet;
-
-import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
-import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.info.ParameterInfo;
-import org.jboss.portal.portlet.info.NavigationInfo;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-
-import javax.xml.namespace.QName;
-import java.util.Set;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StructuralPortletPageNavigationalState implements PortletPageNavigationalState
-{
-
- /** . */
- public static final int READ_ONLY_MODE = 0;
-
- /** . */
- public static final int READ_WRITE_MODE = 1;
-
- /** . */
- public static final int CLONE_AND_WRITE_MODE = 2;
-
- /** . */
- private final StructuralPortletControllerContext portletControllerContext;
-
- /** . */
- private final NavigationalStateContext navigationalStateContext;
-
- /** . */
- private final boolean modifiable;
-
- public StructuralPortletPageNavigationalState(
- StructuralPortletControllerContext portletControllerContext,
- NavigationalStateContext navigationalStateContext,
- int mode)
- {
- boolean modifiable;
- switch (mode)
- {
- case READ_ONLY_MODE:
- modifiable = false;
- break;
- case READ_WRITE_MODE:
- modifiable = true;
- break;
- case CLONE_AND_WRITE_MODE:
- modifiable = true;
- navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
- break;
- default:
- throw new AssertionError();
- }
-
- //
- this.portletControllerContext = portletControllerContext;
- this.navigationalStateContext = navigationalStateContext;
- this.modifiable = modifiable;
- }
-
- public StructuralPortletPageNavigationalState(
- StructuralPortletPageNavigationalState pageNavigationalState,
- int mode)
- {
- NavigationalStateContext navigationalStateContext = pageNavigationalState.navigationalStateContext;
- boolean modifiable;
- switch (mode)
- {
- case READ_ONLY_MODE:
- modifiable = false;
- break;
- case READ_WRITE_MODE:
- modifiable = true;
- break;
- case CLONE_AND_WRITE_MODE:
- modifiable = true;
- navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
- break;
- default:
- throw new AssertionError();
- }
-
- //
- this.portletControllerContext = pageNavigationalState.portletControllerContext;
- this.navigationalStateContext = navigationalStateContext;
- this.modifiable = modifiable;
- }
-
- public void flush()
- {
- if (navigationalStateContext instanceof DelegatingNavigationalStateContext)
- {
- ((DelegatingNavigationalStateContext)navigationalStateContext).flush(true);
- }
- }
-
- public Set<String> getPortletWindowIds()
- {
- return portletControllerContext.getWindowIds();
- }
-
- public PortletWindowNavigationalState getPortletWindowNavigationalState(String portletWindowId) throws IllegalArgumentException
- {
- Mode mode = (Mode)navigationalStateContext.getProperty(portletWindowId, "mode");
- WindowState windowState = (WindowState)navigationalStateContext.getProperty(portletWindowId, "windowstate");
- StateString portletNavigationalState = (StateString)navigationalStateContext.getProperty(portletWindowId, "portlet");
- return new PortletWindowNavigationalState(portletNavigationalState, mode, windowState);
- }
-
- public void setPortletWindowNavigationalState(String portletWindowId, PortletWindowNavigationalState portletWindowState) throws IllegalArgumentException, IllegalStateException
- {
- if (!modifiable)
- {
- throw new IllegalStateException();
- }
-
- //
- navigationalStateContext.setProperty(portletWindowId, "windowstate", portletWindowState.getWindowState());
- navigationalStateContext.setProperty(portletWindowId, "mode", portletWindowState.getMode());
- navigationalStateContext.setProperty(portletWindowId, "portlet", portletWindowState.getPortletNavigationalState());
- }
-
- public Map<String, String[]> getPortletPublicNavigationalState(String portletWindowId) throws IllegalArgumentException
- {
- Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
-
- //
- Map<String, String[]> portletParameters = null;
-
- //
- if (pageParameters != null)
- {
- NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
-
- //
- for (ParameterInfo parameterInfo : navigationInfo.getPublicParameters())
- {
- QName parameterName = parameterInfo.getName();
- String[] parameterValue = pageParameters.get(parameterName);
-
- //
- if (parameterValue != null)
- {
- if (portletParameters == null)
- {
- portletParameters = new HashMap<String, String[]>();
- }
-
- //
- portletParameters.put(parameterInfo.getId(), parameterValue);
- }
- }
- }
-
- //
- return portletParameters;
- }
-
- public void setPortletPublicNavigationalState(String portletWindowId, Map<String, String[]> update) throws IllegalArgumentException, IllegalStateException
- {
- if (!modifiable)
- {
- throw new IllegalStateException();
- }
-
- //
- HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
-
- //
- if (pageParameters == null)
- {
- pageParameters = new HashMap<QName, String[]>();
- }
-
- //
- NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
-
- //
- for (Map.Entry<String, String[]> entry : update.entrySet())
- {
- ParameterInfo parameterInfo = navigationInfo.getPublicParameter(entry.getKey());
-
- //
- QName parameterName = parameterInfo.getName();
-
- if (entry.getValue().length == 0)
- {
- pageParameters.remove(parameterName);
- }
- else
- {
- pageParameters.put(parameterName, entry.getValue());
- }
- }
-
- //
- navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
- }
-
- public Set<QName> getPublicNames()
- {
- HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
-
- //
- return pageParameters != null ? pageParameters.keySet() : null;
- }
-
- public String[] getPublicNavigationalState(QName name) throws IllegalArgumentException
- {
- Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
-
- //
- return pageParameters != null ? pageParameters.get(name) : null;
- }
-
- public void setPublicNavigationalState(QName name, String[] value) throws IllegalArgumentException, IllegalStateException
- {
- if (!modifiable)
- {
- throw new IllegalStateException();
- }
-
- //
- HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
-
- //
- if (pageParameters == null)
- {
- pageParameters = new HashMap<QName, String[]>();
- }
-
- //
- pageParameters.put(name, value);
-
- //
- navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
- }
-
- public void removePublicNavigationalState(QName name) throws IllegalArgumentException, IllegalStateException
- {
- if (!modifiable)
- {
- throw new IllegalStateException();
- }
-
- //
- HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
-
- //
- if (pageParameters != null)
- {
- pageParameters.remove(name);
-
- //
- navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
- }
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralStateControllerContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralStateControllerContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralStateControllerContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,59 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet;
-
-import org.jboss.portal.portlet.controller.state.StateControllerContext;
-import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
-import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StructuralStateControllerContext implements StateControllerContext
-{
-
- /** . */
- private StructuralPortletControllerContext portletControllerContext;
-
- public StructuralStateControllerContext(StructuralPortletControllerContext portletControllerContext)
- {
- this.portletControllerContext = portletControllerContext;
- }
-
- public PortletPageNavigationalState clonePortletPageNavigationalState(PortletPageNavigationalState portletPageNavigationalState, boolean modifiable)
- {
-
- return new StructuralPortletPageNavigationalState(
- (StructuralPortletPageNavigationalState)portletPageNavigationalState,
- modifiable ? StructuralPortletPageNavigationalState.CLONE_AND_WRITE_MODE : StructuralPortletPageNavigationalState.READ_ONLY_MODE);
- }
-
- public PortletPageNavigationalState createPortletPageNavigationalState(boolean modifiable)
- {
- return new StructuralPortletPageNavigationalState(
- portletControllerContext,
- new NavigationalStateContextImpl(),
- modifiable ? StructuralPortletPageNavigationalState.READ_WRITE_MODE : StructuralPortletPageNavigationalState.READ_ONLY_MODE);
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationClientContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationClientContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationClientContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,58 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet.spi;
-
-import org.jboss.portal.common.util.MultiValuedPropertyMap;
-import org.jboss.portal.common.util.SimpleMultiValuedPropertyMap;
-import org.jboss.portal.portlet.spi.ClientContext;
-
-import javax.servlet.http.Cookie;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationClientContext implements ClientContext
-{
-
- public PresentationClientContext()
- {
- }
-
- public String getMethod()
- {
- return "GET";
- }
-
- public MultiValuedPropertyMap<String> getProperties()
- {
- return new SimpleMultiValuedPropertyMap<String>();
- }
-
- public List<Cookie> getCookies()
- {
- return Collections.emptyList();
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationInstanceContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationInstanceContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationInstanceContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,59 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet.spi;
-
-import org.jboss.portal.portlet.StateEvent;
-import org.jboss.portal.portlet.spi.InstanceContext;
-import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.presentation.impl.state.structural.WindowNode;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationInstanceContext implements InstanceContext
-{
-
- /** . */
- private final WindowNode window;
-
- public PresentationInstanceContext(WindowNode window)
- {
- this.window = window;
- }
-
- public String getId()
- {
- return window.getId();
- }
-
- public AccessMode getAccessMode()
- {
- return AccessMode.READ_ONLY;
- }
-
- public void onStateEvent(StateEvent event)
- {
- throw new IllegalStateException();
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortalContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortalContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortalContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,59 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet.spi;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.spi.PortalContext;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationPortalContext implements PortalContext
-{
- public String getInfo()
- {
- return "PresentationPortal";
- }
-
- public Set<WindowState> getWindowStates()
- {
- return Tools.toSet(WindowState.NORMAL);
- }
-
- public Set<Mode> getModes()
- {
- return Tools.toSet(Mode.VIEW);
- }
-
- public Map<String, String> getProperties()
- {
- return Collections.emptyMap();
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortletInvocationContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortletInvocationContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortletInvocationContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,112 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet.spi;
-
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.URLFormat;
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.net.media.MediaType;
-import org.jboss.portal.presentation.impl.server.portlet.StructuralPortletControllerContext;
-import org.jboss.portal.presentation.impl.server.portlet.PortletContainerAction;
-import org.jboss.portal.presentation.client.PresentationClient;
-
-import java.io.Writer;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationPortletInvocationContext implements PortletInvocationContext
-{
-
- /** . */
- private final MarkupInfo markup = new MarkupInfo(MediaType.TEXT_HTML, "UTF-8");
-
- /** . */
- private final StructuralPortletControllerContext portletControllerContext;
-
- /** . */
- private final String windowId;
-
- /** . */
- private final PresentationClient client;
-
- public PresentationPortletInvocationContext(
- PresentationClient client,
- StructuralPortletControllerContext portletControllerContext,
- String windowId)
- {
- this.client = client;
- this.portletControllerContext = portletControllerContext;
- this.windowId = windowId;
- }
-
- public String getWindowId()
- {
- return windowId;
- }
-
- public MarkupInfo getMarkupInfo()
- {
- return markup;
- }
-
- public String encodeResourceURL(String url) throws IllegalArgumentException
- {
- return url;
- }
-
- public String renderURL(ContainerURL containerURL, URLFormat format)
- {
- PortletContainerAction action = PortletContainerAction.create(windowId, containerURL);
-
- //
- String url = client.renderURL(action, null);
-
-
-// StateControllerContext stateControllerContext = portletControllerContext.getStateControllerContext();
-// PortletPageNavigationalStateSerialization serialiation = new PortletPageNavigationalStateSerialization(stateControllerContext);
-// ControllerRequestParameterMapFactory parameterMapFactory = new ControllerRequestParameterMapFactory(serialiation);
-//
-// Map<String, String> parameters = parameterMapFactory.encode(null, windowId, containerURL);
-//
-// Map<String, String[]> blah = new HashMap<String, String[]>();
-// for (Map.Entry<String, String> entry : parameters.entrySet())
-// {
-// blah.put(entry.getKey(), new String[]{entry.getValue()});
-// }
-//
-// GetActivation getActivation = new GetActivation(windowId, "/", blah);
-//
-// String url = client.renderURL(getActivation, null);
-
- return url;
- }
-
- public void renderURL(Writer writer, ContainerURL containerURL, URLFormat format) throws IOException
- {
- writer.write(renderURL(containerURL, format));
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationSecurityContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationSecurityContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationSecurityContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet.spi;
-
-import org.jboss.portal.portlet.spi.SecurityContext;
-
-import java.security.Principal;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationSecurityContext implements SecurityContext
-{
- public boolean isSecure()
- {
- return false;
- }
-
- public boolean isAuthenticated()
- {
- return false;
- }
-
- public String getAuthType()
- {
- return null;
- }
-
- public String getRemoteUser()
- {
- return null;
- }
-
- public Principal getUserPrincipal()
- {
- return null;
- }
-
- public boolean isUserInRole(String roleName)
- {
- return false;
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationServerContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationServerContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationServerContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,70 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet.spi;
-
-import org.jboss.portal.portlet.spi.ServerContext;
-import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.web.RequestDispatchCallback;
-import org.jboss.portal.web.ServletContainer;
-import org.jboss.portal.web.ServletContextDispatcher;
-
-import javax.servlet.ServletContext;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationServerContext implements ServerContext
-{
-
- /** . */
- private final PresentationClient presentationClient;
-
- public PresentationServerContext(PresentationClient presentationClient)
- {
- this.presentationClient = presentationClient;
- }
-
- public String getScheme()
- {
- return "http";
- }
-
- public String getServerName()
- {
- return "localhost";
- }
-
- public int getServerPort()
- {
- return 8080;
- }
-
- public Object dispatch(ServletContainer servletContainer, ServletContext targetServletContext, RequestDispatchCallback callback, Object handback) throws Exception
- {
- ServletContextDispatcher dispatcher = presentationClient.getDispatcher();
-
- //
- return dispatcher.include(targetServletContext, callback, handback);
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationWindowContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationWindowContext.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationWindowContext.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,47 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.server.portlet.spi;
-
-import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.presentation.impl.state.structural.WindowNode;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationWindowContext implements WindowContext
-{
-
- /** . */
- private final WindowNode window;
-
- public PresentationWindowContext(WindowNode window)
- {
- this.window = window;
- }
-
- public String getId()
- {
- return window.getId();
- }
-}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/tree/UINode.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model.tree;
+
+import org.jboss.portal.presentation.model.UIObject;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface UINode
+{
+
+ UIObject getObject();
+
+ UINode getParent();
+
+ Collection<UINode> getChildren();
+
+}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CommandAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CommandAction.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CommandAction.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -1,35 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.protocol;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public abstract class CommandAction extends UIObjectAction
-{
- protected CommandAction(String targetId) throws IllegalArgumentException
- {
- super(targetId);
- }
-}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java 2008-04-28 10:07:59 UTC (rev 10722)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java 2008-04-28 10:47:59 UTC (rev 10723)
@@ -36,8 +36,6 @@
StructuralStateContext getStructuralStateContext();
- String render(ProtocolAction action) throws IllegalArgumentException;
-
WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException;
PresentationResponse process(PresentationClient client, PresentationRequest request) throws PresentationServerException;
15 years, 12 months
JBoss Portal SVN: r10722 - in modules/portlet/trunk: portal and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-28 06:07:59 -0400 (Mon, 28 Apr 2008)
New Revision: 10722
Modified:
modules/portlet/trunk/controller/pom.xml
modules/portlet/trunk/portal/pom.xml
Log:
update poms to scope the portlet-portlet test jar used by portlet controller to test scope
Modified: modules/portlet/trunk/controller/pom.xml
===================================================================
--- modules/portlet/trunk/controller/pom.xml 2008-04-27 20:27:05 UTC (rev 10721)
+++ modules/portlet/trunk/controller/pom.xml 2008-04-28 10:07:59 UTC (rev 10722)
@@ -33,7 +33,7 @@
<artifactId>portlet-portlet</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<!--TEST SCOPE-->
Modified: modules/portlet/trunk/portal/pom.xml
===================================================================
--- modules/portlet/trunk/portal/pom.xml 2008-04-27 20:27:05 UTC (rev 10721)
+++ modules/portlet/trunk/portal/pom.xml 2008-04-28 10:07:59 UTC (rev 10722)
@@ -33,12 +33,6 @@
<groupId>org.jboss.portal.portlet</groupId>
<artifactId>portlet-controller</artifactId>
<version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.portal.portlet</groupId>
- <artifactId>portlet-portlet</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.portal.portlet</groupId>
15 years, 12 months
JBoss Portal SVN: r10721 - in modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation: protocol and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-27 16:27:05 -0400 (Sun, 27 Apr 2008)
New Revision: 10721
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectCommandAction.java
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java
Log:
a basic integration with page navigational state in PF
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java 2008-04-27 20:25:19 UTC (rev 10720)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java 2008-04-27 20:27:05 UTC (rev 10721)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.server.portlet;
-import org.jboss.portal.presentation.protocol.CommandAction;
+import org.jboss.portal.presentation.protocol.UIObjectCommandAction;
import org.jboss.portal.portlet.LifeCyclePhase;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ContainerURL;
@@ -38,7 +38,7 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PortletContainerAction extends CommandAction
+public class PortletContainerAction extends UIObjectCommandAction
{
/** The portlet phase. */
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectCommandAction.java (from rev 10720, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CommandAction.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectCommandAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectCommandAction.java 2008-04-27 20:27:05 UTC (rev 10721)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.protocol;
+
+/**
+ * Abstract command that allow protocol extention for ui objects.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class UIObjectCommandAction extends UIObjectAction
+{
+ protected UIObjectCommandAction(String targetId) throws IllegalArgumentException
+ {
+ super(targetId);
+ }
+}
15 years, 12 months
JBoss Portal SVN: r10720 - in modules/presentation/trunk: classic/src/main/java/org/jboss/portal/presentation/classic and 8 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-27 16:25:19 -0400 (Sun, 27 Apr 2008)
New Revision: 10720
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/DelegatingNavigationalStateContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextSerialization.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CommandAction.java
Modified:
modules/presentation/trunk/classic/pom.xml
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
modules/presentation/trunk/presentation/pom.xml
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletControllerContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletPageNavigationalState.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralStateControllerContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortletInvocationContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/navigational/NavigationalStateContext.java
Log:
a basic integration with page navigational state in PF
Modified: modules/presentation/trunk/classic/pom.xml
===================================================================
--- modules/presentation/trunk/classic/pom.xml 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/classic/pom.xml 2008-04-27 20:25:19 UTC (rev 10720)
@@ -36,6 +36,11 @@
</dependency>
<dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.portal.common</groupId>
<artifactId>common-portal</artifactId>
</dependency>
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -31,6 +31,7 @@
import org.jboss.portal.presentation.classic.protocol.ActionEncoder;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.impl.model.UIModelImpl;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.presentation.model.UIModel;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.ViewPort;
@@ -77,28 +78,49 @@
protected final PresentationServer server;
/** . */
- protected final ActionDecoder decoder = new ActionDecoder();
+ protected ActionEncoder encoder;
/** . */
- protected final ActionEncoder encoder = new ActionEncoder();
+ protected final ProtocolAction protocolAction;
+ /** . */
+ protected final NavigationalStateContext navigationalStateContext;
+
public ClassicPresentationClient(
WebRequest req,
WebResponse resp,
PresentationServer server)
{
+ ActionDecoder decoder = new ActionDecoder();
+ decoder.decode(req);
+
+ //
+ NavigationalStateContext navigationalStateContext = decoder.getNavigationalStateContext();
+ if (navigationalStateContext == null)
+ {
+ navigationalStateContext = new NavigationalStateContextImpl();
+ }
+
+ //
this.req = req;
this.resp = resp;
this.server = server;
+ this.protocolAction = decoder.getProtocolAction();
+ this.navigationalStateContext = navigationalStateContext;
+ this.encoder = null;
}
public NavigationalStateContext getNavigationalStateContext()
{
- return null;
+ return navigationalStateContext;
}
public String renderURL(ProtocolAction action, URLFormat format) throws IllegalArgumentException
{
+ if (encoder == null)
+ {
+ throw new IllegalStateException("It is not possible to render an URL during the process of an action");
+ }
if (action == null)
{
throw new IllegalArgumentException("No null action can be rendered");
@@ -136,13 +158,12 @@
public void process() throws IOException, PresentationServerException
{
- ProtocolAction action = decoder.decode(req);
PresentationResponse presentationResp = null;
- if (action != null)
+ if (protocolAction != null)
{
- PresentationRequest request = new PresentationRequest(action);
+ PresentationRequest request = new PresentationRequest(protocolAction);
presentationResp = server.process(this, request);
}
@@ -173,6 +194,9 @@
private void renderDocument(ViewPortScope scope, String nodeId) throws IOException
{
+ encoder = new ActionEncoder((NavigationalStateContextImpl)navigationalStateContext);
+
+ //
StructuralStateContext ssc = server.getStructuralStateContext();
ClassicViewPortContext context = new ClassicViewPortContext();
UIModel model = new UIModelImpl(null, ssc);
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -26,8 +26,23 @@
import org.jboss.portal.presentation.protocol.PostActivation;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.impl.server.portlet.PortletContainerAction;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextSerialization;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
+import org.jboss.portal.portlet.LifeCyclePhase;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.util.Base64;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -35,8 +50,24 @@
public class ActionDecoder
{
- public ProtocolAction decode(WebRequest request)
+ /** The protocol action. */
+ private ProtocolAction protocolAction;
+
+ /** . */
+ private NavigationalStateContext navigationalStateContext;
+
+ public ProtocolAction getProtocolAction()
{
+ return protocolAction;
+ }
+
+ public NavigationalStateContext getNavigationalStateContext()
+ {
+ return navigationalStateContext;
+ }
+
+ public void decode(WebRequest request)
+ {
ProtocolAction action = null;
//
@@ -71,14 +102,67 @@
switch (request.getVerb())
{
case GET:
- return new GetActivation(targetId, path, request.getQueryParameterMap());
+ action= new GetActivation(targetId, path, request.getQueryParameterMap());
+ break;
case POST:
- return new PostActivation(targetId, path, request.getQueryParameterMap(), request.getBody());
+ action = new PostActivation(targetId, path, request.getQueryParameterMap(), request.getBody());
+ break;
+ default:
+ throw new NotYetImplemented();
}
}
+ else if (webPath.startsWith("/portlet/"))
+ {
+ String targetId = webPath.substring("/portlet/".length());
+ //
+ LifeCyclePhase phase = LifeCyclePhase.valueOf(request.getQueryParameter("phase"));
+
+ //
+ String stateString = request.getQueryParameter("state");
+ StateString state = stateString != null ? ParametersStateString.create(stateString) : null;
+
+ //
+ String windowStateString = request.getQueryParameter("ws");
+ WindowState windowState = windowStateString != null ? WindowState.create(windowStateString) : null;
+
+ //
+ String modeString = request.getQueryParameter("mode");
+ Mode mode = modeString != null ? Mode.create(modeString) : null;
+
+ //
+ Map<String, String[]> form = null;
+ if (request.getBody() instanceof Body.Form)
+ {
+ form = ((Body.Form)request.getBody()).getParameters();
+ }
+
+ //
+ switch (phase)
+ {
+ case ACTION:
+ action = PortletContainerAction.createAction(targetId, mode, windowState, state, form);
+ break;
+ case RENDER:
+ action = PortletContainerAction.createRender(targetId, state, mode, windowState, null);
+ break;
+ default:
+ throw new NotYetImplemented();
+ }
+ }
+
//
- return action;
+ String nsString = request.getQueryParameter("ns");
+ NavigationalStateContext navigationalStateContext = null;
+ if (nsString != null)
+ {
+ byte[] bytes = Base64.decode(nsString, true);
+ NavigationalStateContextSerialization serialization = new NavigationalStateContextSerialization();
+ navigationalStateContext = IOTools.unserialize(serialization, SerializationFilter.COMPRESSOR ,bytes);
+ }
+
+ //
+ this.protocolAction = action;
+ this.navigationalStateContext = navigationalStateContext;
}
-
}
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -27,8 +27,17 @@
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.UIObjectAction;
import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.impl.server.portlet.PortletContainerAction;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextSerialization;
import org.jboss.portal.web.WebResponse;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.util.Base64;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -36,6 +45,19 @@
public class ActionEncoder
{
+ /** An optional navigational state. */
+ private String ns;
+
+ public ActionEncoder()
+ {
+ }
+
+ public ActionEncoder(NavigationalStateContextImpl navigationalStateContext)
+ {
+ byte[] bytes = IOTools.serialize(new NavigationalStateContextSerialization(), SerializationFilter.COMPRESSOR, navigationalStateContext);
+ ns = Base64.encodeBytes(bytes, true);
+ }
+
public String encode(ProtocolAction action, WebResponse resp)
{
if (action instanceof UIObjectAction)
@@ -57,10 +79,46 @@
//
return resp.renderURL("/invoke/" + targetId, linkActivationAction.getQueryParameters(), null);
}
+ else if (action instanceof PortletContainerAction)
+ {
+ PortletContainerAction pcAction = (PortletContainerAction)action;
+
+ //
+ Map<String, String[]> parameters = new HashMap<String, String[]>();
+
+ //
+ if (pcAction.getState() != null)
+ {
+ parameters.put("state", new String[]{pcAction.getState().getStringValue()});
+ }
+
+ //
+ if (pcAction.getMode() != null)
+ {
+ parameters.put("mode", new String[]{pcAction.getMode().toString()});
+ }
+
+ //
+ if (pcAction.getWindowState() != null)
+ {
+ parameters.put("ws", new String[]{pcAction.getWindowState().toString()});
+ }
+
+ //
+ if (ns != null)
+ {
+ parameters.put("ns", new String[]{ns});
+ }
+
+ //
+ parameters.put("phase", new String[]{pcAction.getPhase().toString()});
+
+ //
+ return resp.renderURL("/portlet/" + targetId, parameters, null);
+ }
}
//
return null;
}
-
}
Modified: modules/presentation/trunk/presentation/pom.xml
===================================================================
--- modules/presentation/trunk/presentation/pom.xml 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/presentation/pom.xml 2008-04-27 20:25:19 UTC (rev 10720)
@@ -13,18 +13,22 @@
<name>JBoss Portal Presentation Framework - Presentation Module</name>
<dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.portlet</groupId>
- <artifactId>portlet-portlet</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.portlet</groupId>
- <artifactId>portlet-controller</artifactId>
- </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-controller</artifactId>
+ </dependency>
</dependencies>
<build>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -28,6 +28,8 @@
import org.jboss.portal.presentation.impl.state.structural.WindowNode;
import org.jboss.portal.presentation.impl.state.structural.PageNode;
import org.jboss.portal.presentation.impl.server.portlet.StructuralPortletControllerContext;
+import org.jboss.portal.presentation.impl.server.portlet.PortletContainerAction;
+import org.jboss.portal.presentation.impl.server.portlet.StructuralPortletPageNavigationalState;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.protocol.ErrorResponse;
import org.jboss.portal.presentation.protocol.ProtocolAction;
@@ -35,7 +37,6 @@
import org.jboss.portal.presentation.protocol.UIObjectAction;
import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
import org.jboss.portal.presentation.protocol.LinkActivation;
-import org.jboss.portal.presentation.protocol.PostActivation;
import org.jboss.portal.presentation.server.PresentationRequest;
import org.jboss.portal.presentation.server.PresentationResponse;
import org.jboss.portal.presentation.server.PresentationServer;
@@ -44,18 +45,18 @@
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.controller.impl.ControllerRequestFactory;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
+import org.jboss.portal.portlet.controller.request.PortletActionRequest;
+import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
import org.jboss.portal.portlet.controller.PortletController;
+import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.web.Body;
+import org.jboss.portal.common.NotYetImplemented;
-import java.util.Map;
-
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -103,8 +104,14 @@
page,
portletInvoker);
- PortletInvocationResponse response = controller.render(portletControllerContext, null, null, windowId);
+ //
+ StructuralPortletPageNavigationalState pageNavigationalState = new StructuralPortletPageNavigationalState(
+ portletControllerContext,
+ client.getNavigationalStateContext(),
+ StructuralPortletPageNavigationalState.READ_ONLY_MODE);
+ PortletInvocationResponse response = controller.render(portletControllerContext, null, pageNavigationalState, windowId);
+
//
if (response instanceof FragmentResponse)
{
@@ -149,61 +156,88 @@
}
else if (objectAction instanceof LinkActivation)
{
- LinkActivation linkActivation = (LinkActivation)objectAction;
+ throw new NotYetImplemented();
+ }
+ else if (objectAction instanceof PortletContainerAction)
+ {
+ PortletContainerAction pcAction = (PortletContainerAction)objectAction;
//
- if (targetNode instanceof WindowNode)
- {
- WindowNode targetWindow = (WindowNode)targetNode;
+ WindowNode targetWindow = (WindowNode)targetNode;
- //
- PageNode targetPage = (PageNode)targetWindow.getParent();
+ //
+ PageNode targetPage = (PageNode)targetWindow.getParent();
- //
- ControllerRequestFactory factory = new ControllerRequestFactory(null);
+ //
+ StructuralPortletControllerContext portletControllerContext = new StructuralPortletControllerContext(
+ client,
+ targetPage,
+ portletInvoker);
- Body body = null;
- if (linkActivation instanceof PostActivation)
- {
- body = ((PostActivation)linkActivation).getBody();
- }
+ StructuralPortletPageNavigationalState pageNavigationalState = new StructuralPortletPageNavigationalState(
+ portletControllerContext,
+ client.getNavigationalStateContext(),
+ StructuralPortletPageNavigationalState.CLONE_AND_WRITE_MODE);
- //
- ControllerRequest controllerRequest = factory.decode(linkActivation.getQueryParameters(), body);
+ //
+ ControllerRequest controllerRequest;
+ switch (pcAction.getPhase())
+ {
+ case ACTION:
+ controllerRequest = new PortletActionRequest(
+ targetWindow.getId(),
+ pcAction.getState(),
+ pcAction.getForm(),
+ pageNavigationalState.getPortletWindowNavigationalState(targetWindow.getId()),
+ pageNavigationalState
+ );
+ break;
+ case RENDER:
+ PortletWindowNavigationalState windowNavigationalState = new PortletWindowNavigationalState(
+ pcAction.getState(),
+ pcAction.getMode(),
+ pcAction.getWindowState()
+ );
+ controllerRequest = new PortletRenderRequest(
+ targetWindow.getId(),
+ windowNavigationalState,
+ null,
+ pageNavigationalState
+ );
+ break;
+ default:
+ throw new NotYetImplemented();
+ }
- //
- PortletController controller = new PortletController();
+ //
+ PortletController controller = new PortletController();
- //
- StructuralPortletControllerContext portletControllerContext = new StructuralPortletControllerContext(
- client,
- targetPage,
- portletInvoker);
+ //
+ try
+ {
+ ControllerResponse response = controller.process(portletControllerContext, controllerRequest);
- //
- try
+ if (response instanceof PageUpdateResponse)
{
- ControllerResponse response = controller.process(portletControllerContext, controllerRequest);
+ PageUpdateResponse pageUpdate = (PageUpdateResponse)response;
- if (response instanceof PageUpdateResponse)
- {
- PageUpdateResponse pageUpdate = (PageUpdateResponse)response;
+ //
+ NavigationalStateContext nsc = client.getNavigationalStateContext();
- //
- NavigationalStateContext nsc = client.getNavigationalStateContext();
+ //
+ StructuralPortletPageNavigationalState blah = (StructuralPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
- //
- PortletPageNavigationalState blah = pageUpdate.getPageNavigationalState();
- }
+ //
+ blah.flush();
}
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
- //
- return new PresentationResponse(new ShowUIObjectResponse(targetPage.getId()));
- }
+ //
+ return new PresentationResponse(new ShowUIObjectResponse(targetPage.getId()));
}
}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/PortletContainerAction.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -0,0 +1,168 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.server.portlet;
+
+import org.jboss.portal.presentation.protocol.CommandAction;
+import org.jboss.portal.portlet.LifeCyclePhase;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletContainerAction extends CommandAction
+{
+
+ /** The portlet phase. */
+ private final LifeCyclePhase phase;
+
+ /** The navigational state. */
+ private final StateString state;
+
+ /** . */
+ private final Map<String, String[]> form;
+
+ /** . */
+ private final Mode mode;
+
+ /** . */
+ private final WindowState windowState;
+
+ /** . */
+ private final Map<String, String[]> publicNavigationalStateChanges;
+
+ private PortletContainerAction(
+ String targetId,
+ LifeCyclePhase phase,
+ StateString state,
+ Mode mode,
+ WindowState windowState,
+ Map<String, String[]> publicNavigationalStateChanges,
+ Map<String, String[]> form) throws IllegalArgumentException
+ {
+ super(targetId);
+
+ //
+ this.phase = phase;
+ this.state = state;
+ this.mode = mode;
+ this.windowState = windowState;
+ this.publicNavigationalStateChanges = publicNavigationalStateChanges;
+ this.form = form;
+ }
+
+ public LifeCyclePhase getPhase()
+ {
+ return phase;
+ }
+
+ public StateString getState()
+ {
+ return state;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public Map<String, String[]> getPublicNavigationalStateChanges()
+ {
+ return publicNavigationalStateChanges;
+ }
+
+ public Map<String, String[]> getForm()
+ {
+ return form;
+ }
+
+ public static PortletContainerAction create(String targetId, ContainerURL containerURL)
+ {
+ if (containerURL instanceof RenderURL)
+ {
+ RenderURL renderURL = (RenderURL)containerURL;
+
+ //
+ return new PortletContainerAction(
+ targetId,
+ LifeCyclePhase.RENDER,
+ renderURL.getNavigationalState(),
+ renderURL.getMode(),
+ renderURL.getWindowState(),
+ renderURL.getPublicNavigationalStateChanges(),
+ null);
+
+ }
+ else if (containerURL instanceof ActionURL)
+ {
+ ActionURL actionURL = (ActionURL)containerURL;
+
+ //
+ return new PortletContainerAction(
+ targetId,
+ LifeCyclePhase.ACTION,
+ actionURL.getInteractionState(),
+ actionURL.getMode(),
+ actionURL.getWindowState(),
+ null,
+ null);
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public static PortletContainerAction createRender(
+ String targetId,
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState,
+ Map<String, String[]> publicNavigationalStateChanges)
+ {
+ return new PortletContainerAction(targetId, LifeCyclePhase.RENDER, navigationalState, mode, windowState, publicNavigationalStateChanges, null);
+ }
+
+ public static PortletContainerAction createAction(
+ String targetId,
+ Mode mode,
+ WindowState windowState,
+ StateString interactionState,
+ Map<String, String[]> form)
+ {
+ return new PortletContainerAction(targetId, LifeCyclePhase.ACTION, interactionState, mode, windowState, null, form);
+ }
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletControllerContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletControllerContext.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletControllerContext.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -123,7 +123,7 @@
this.client = client;
this.page = page;
this.invoker = invoker;
- this.stateControllerContext = new StructuralStateControllerContext(this, client.getNavigationalStateContext());
+ this.stateControllerContext = new StructuralStateControllerContext(this);
this.portlets = portlets;
this.windows = windows;
this.eventControllerContext = new StructuralEventControllerContext(this);
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletPageNavigationalState.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletPageNavigationalState.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralPortletPageNavigationalState.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -28,6 +28,7 @@
import org.jboss.portal.portlet.info.ParameterInfo;
import org.jboss.portal.portlet.info.NavigationInfo;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
@@ -44,17 +45,87 @@
{
/** . */
+ public static final int READ_ONLY_MODE = 0;
+
+ /** . */
+ public static final int READ_WRITE_MODE = 1;
+
+ /** . */
+ public static final int CLONE_AND_WRITE_MODE = 2;
+
+ /** . */
private final StructuralPortletControllerContext portletControllerContext;
/** . */
private final NavigationalStateContext navigationalStateContext;
- public StructuralPortletPageNavigationalState(StructuralPortletControllerContext portletControllerContext, NavigationalStateContext navigationalStateContext)
+ /** . */
+ private final boolean modifiable;
+
+ public StructuralPortletPageNavigationalState(
+ StructuralPortletControllerContext portletControllerContext,
+ NavigationalStateContext navigationalStateContext,
+ int mode)
{
+ boolean modifiable;
+ switch (mode)
+ {
+ case READ_ONLY_MODE:
+ modifiable = false;
+ break;
+ case READ_WRITE_MODE:
+ modifiable = true;
+ break;
+ case CLONE_AND_WRITE_MODE:
+ modifiable = true;
+ navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
this.portletControllerContext = portletControllerContext;
this.navigationalStateContext = navigationalStateContext;
+ this.modifiable = modifiable;
}
+ public StructuralPortletPageNavigationalState(
+ StructuralPortletPageNavigationalState pageNavigationalState,
+ int mode)
+ {
+ NavigationalStateContext navigationalStateContext = pageNavigationalState.navigationalStateContext;
+ boolean modifiable;
+ switch (mode)
+ {
+ case READ_ONLY_MODE:
+ modifiable = false;
+ break;
+ case READ_WRITE_MODE:
+ modifiable = true;
+ break;
+ case CLONE_AND_WRITE_MODE:
+ modifiable = true;
+ navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
+ this.portletControllerContext = pageNavigationalState.portletControllerContext;
+ this.navigationalStateContext = navigationalStateContext;
+ this.modifiable = modifiable;
+ }
+
+ public void flush()
+ {
+ if (navigationalStateContext instanceof DelegatingNavigationalStateContext)
+ {
+ ((DelegatingNavigationalStateContext)navigationalStateContext).flush(true);
+ }
+ }
+
public Set<String> getPortletWindowIds()
{
return portletControllerContext.getWindowIds();
@@ -62,14 +133,20 @@
public PortletWindowNavigationalState getPortletWindowNavigationalState(String portletWindowId) throws IllegalArgumentException
{
- Mode mode = (Mode)navigationalStateContext.getProperty(portletWindowId, "windowstate");
- WindowState windowState = (WindowState)navigationalStateContext.getProperty(portletWindowId, "mode");
+ Mode mode = (Mode)navigationalStateContext.getProperty(portletWindowId, "mode");
+ WindowState windowState = (WindowState)navigationalStateContext.getProperty(portletWindowId, "windowstate");
StateString portletNavigationalState = (StateString)navigationalStateContext.getProperty(portletWindowId, "portlet");
return new PortletWindowNavigationalState(portletNavigationalState, mode, windowState);
}
public void setPortletWindowNavigationalState(String portletWindowId, PortletWindowNavigationalState portletWindowState) throws IllegalArgumentException, IllegalStateException
{
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
navigationalStateContext.setProperty(portletWindowId, "windowstate", portletWindowState.getWindowState());
navigationalStateContext.setProperty(portletWindowId, "mode", portletWindowState.getMode());
navigationalStateContext.setProperty(portletWindowId, "portlet", portletWindowState.getPortletNavigationalState());
@@ -113,6 +190,12 @@
public void setPortletPublicNavigationalState(String portletWindowId, Map<String, String[]> update) throws IllegalArgumentException, IllegalStateException
{
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
//
@@ -132,7 +215,7 @@
//
QName parameterName = parameterInfo.getName();
- if (entry.getValue().length > 0)
+ if (entry.getValue().length == 0)
{
pageParameters.remove(parameterName);
}
@@ -164,6 +247,12 @@
public void setPublicNavigationalState(QName name, String[] value) throws IllegalArgumentException, IllegalStateException
{
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
//
@@ -181,6 +270,12 @@
public void removePublicNavigationalState(QName name) throws IllegalArgumentException, IllegalStateException
{
+ if (!modifiable)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
//
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralStateControllerContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralStateControllerContext.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/StructuralStateControllerContext.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -36,22 +36,24 @@
/** . */
private StructuralPortletControllerContext portletControllerContext;
- /** . */
- private NavigationalStateContext navigationalStateContext;
-
- public StructuralStateControllerContext(StructuralPortletControllerContext portletControllerContext, NavigationalStateContext navigationalStateContext)
+ public StructuralStateControllerContext(StructuralPortletControllerContext portletControllerContext)
{
this.portletControllerContext = portletControllerContext;
- this.navigationalStateContext = navigationalStateContext;
}
public PortletPageNavigationalState clonePortletPageNavigationalState(PortletPageNavigationalState portletPageNavigationalState, boolean modifiable)
{
- return new StructuralPortletPageNavigationalState(portletControllerContext, navigationalStateContext);
+
+ return new StructuralPortletPageNavigationalState(
+ (StructuralPortletPageNavigationalState)portletPageNavigationalState,
+ modifiable ? StructuralPortletPageNavigationalState.CLONE_AND_WRITE_MODE : StructuralPortletPageNavigationalState.READ_ONLY_MODE);
}
public PortletPageNavigationalState createPortletPageNavigationalState(boolean modifiable)
{
- return new StructuralPortletPageNavigationalState(portletControllerContext, navigationalStateContext);
+ return new StructuralPortletPageNavigationalState(
+ portletControllerContext,
+ new NavigationalStateContextImpl(),
+ modifiable ? StructuralPortletPageNavigationalState.READ_WRITE_MODE : StructuralPortletPageNavigationalState.READ_ONLY_MODE);
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortletInvocationContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortletInvocationContext.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/portlet/spi/PresentationPortletInvocationContext.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -25,20 +25,14 @@
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.URLFormat;
-import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
-import org.jboss.portal.portlet.controller.impl.ControllerRequestParameterMapFactory;
-import org.jboss.portal.portlet.controller.state.PortletPageNavigationalStateSerialization;
-import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.presentation.impl.server.portlet.StructuralPortletControllerContext;
-import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.impl.server.portlet.PortletContainerAction;
import org.jboss.portal.presentation.client.PresentationClient;
import java.io.Writer;
import java.io.IOException;
-import java.util.Map;
-import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -86,22 +80,28 @@
public String renderURL(ContainerURL containerURL, URLFormat format)
{
- StateControllerContext stateControllerContext = portletControllerContext.getStateControllerContext();
- PortletPageNavigationalStateSerialization serialiation = new PortletPageNavigationalStateSerialization(stateControllerContext);
- ControllerRequestParameterMapFactory parameterMapFactory = new ControllerRequestParameterMapFactory(serialiation);
+ PortletContainerAction action = PortletContainerAction.create(windowId, containerURL);
- Map<String, String> parameters = parameterMapFactory.encode(null, windowId, containerURL);
+ //
+ String url = client.renderURL(action, null);
- Map<String, String[]> blah = new HashMap<String, String[]>();
- for (Map.Entry<String, String> entry : parameters.entrySet())
- {
- blah.put(entry.getKey(), new String[]{entry.getValue()});
- }
- GetActivation getActivation = new GetActivation(windowId, "/", blah);
+// StateControllerContext stateControllerContext = portletControllerContext.getStateControllerContext();
+// PortletPageNavigationalStateSerialization serialiation = new PortletPageNavigationalStateSerialization(stateControllerContext);
+// ControllerRequestParameterMapFactory parameterMapFactory = new ControllerRequestParameterMapFactory(serialiation);
+//
+// Map<String, String> parameters = parameterMapFactory.encode(null, windowId, containerURL);
+//
+// Map<String, String[]> blah = new HashMap<String, String[]>();
+// for (Map.Entry<String, String> entry : parameters.entrySet())
+// {
+// blah.put(entry.getKey(), new String[]{entry.getValue()});
+// }
+//
+// GetActivation getActivation = new GetActivation(windowId, "/", blah);
+//
+// String url = client.renderURL(getActivation, null);
- String url = client.renderURL(getActivation, null);
-
return url;
}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/DelegatingNavigationalStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/DelegatingNavigationalStateContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/DelegatingNavigationalStateContext.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -0,0 +1,177 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.state.navigational;
+
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.state.StateException;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DelegatingNavigationalStateContext implements NavigationalStateContext
+{
+
+ /** . */
+ private NavigationalStateContext delegate;
+
+ /** . */
+ private Map<String, Map<String, Serializable>> updates;
+
+ public DelegatingNavigationalStateContext(NavigationalStateContext delegate)
+ {
+ if (delegate == null)
+ {
+ throw new IllegalArgumentException("No null delegate accepted");
+ }
+
+ //
+ this.delegate = delegate;
+ }
+
+ public Set<String> getPropertyNames(String objectId)
+ {
+ Map<String, Serializable> properties = getProperties(objectId, false);
+
+ //
+ if (properties == null)
+ {
+ return delegate.getPropertyNames(objectId);
+ }
+ else
+ {
+ return properties.keySet();
+ }
+ }
+
+ public Serializable getProperty(String objectId, String key) throws IllegalArgumentException
+ {
+ Map<String, Serializable> properties = getProperties(objectId, false);
+
+ //
+ if (properties == null)
+ {
+ return delegate.getProperty(objectId, key);
+ }
+ else
+ {
+ return properties.get(key);
+ }
+ }
+
+ public void setProperty(String objectId, String key, Serializable navigationalState) throws StateException, IllegalArgumentException
+ {
+ Map<String, Serializable> properties = getProperties(objectId, true);
+
+ //
+ properties.put(key, navigationalState);
+ }
+
+ public NavigationalStateContext getDelegate()
+ {
+ return delegate;
+ }
+
+ public void flush(boolean deep)
+ {
+ if (updates != null)
+ {
+ for (Map.Entry<String, Map<String, Serializable>> update : updates.entrySet())
+ {
+ String objectId = update.getKey();
+ Map<String, Serializable> properties = update.getValue();
+
+ //
+ for (Map.Entry<String, Serializable> property : properties.entrySet())
+ {
+ delegate.setProperty(objectId, property.getKey(), property.getValue());
+ }
+ }
+
+ //
+ if (deep && delegate instanceof DelegatingNavigationalStateContext)
+ {
+ ((DelegatingNavigationalStateContext)delegate).flush(true);
+ }
+ }
+ }
+
+ public void clear(boolean deep)
+ {
+ updates.clear();
+
+ //
+ if (deep && delegate instanceof DelegatingNavigationalStateContext)
+ {
+ ((DelegatingNavigationalStateContext)delegate).clear(true);
+ }
+ }
+
+ private Map<String, Serializable> getProperties(String objectId, boolean create)
+ {
+ if (create)
+ {
+ if (updates == null)
+ {
+ updates = new HashMap<String, Map<String, Serializable>>();
+ }
+
+ //
+ Map<String, Serializable> properties = updates.get(objectId);
+
+ //
+ if (properties == null)
+ {
+ properties = new HashMap<String, Serializable>();
+
+ //
+ Set<String> propertyNames = delegate.getPropertyNames(objectId);
+
+ //
+ if (propertyNames != null)
+ {
+ for (String propertyName : propertyNames)
+ {
+ Serializable propertyValue = delegate.getProperty(objectId, propertyName);
+ properties.put(propertyName, propertyValue);
+ }
+ }
+
+ //
+ updates.put(objectId, properties);
+ }
+
+ //
+ return properties;
+ }
+ else
+ {
+ return updates != null ? updates.get(objectId) : null;
+ }
+ }
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextImpl.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextImpl.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -32,17 +32,26 @@
import java.io.Serializable;
/**
+ * An implementation of the {@link org.jboss.portal.presentation.state.navigational.NavigationalStateContext} interface
+ * that is serializable.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class NavigationalStateContextImpl implements NavigationalStateContext
+public class NavigationalStateContextImpl implements NavigationalStateContext, Serializable
{
/** . */
- private final Map<String, Map<String, Serializable>> map;
+ final Map<String, Map<String, Serializable>> map;
public NavigationalStateContextImpl(Map<String, Map<String, Serializable>> map)
{
+ if (map == null)
+ {
+ throw new IllegalArgumentException("No null map provided");
+ }
+
+ //
this.map = map;
}
@@ -59,7 +68,10 @@
}
//
- return map.get(objectId).keySet();
+ Map<String, Serializable> properties = map.get(objectId);
+
+ //
+ return properties != null ? properties.keySet() : null;
}
public void setProperty(String objectId, String key, Serializable navigationalState) throws StateChangeVetoException, StateException, IllegalArgumentException
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextSerialization.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextSerialization.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextSerialization.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.state.navigational;
+
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.common.io.IOTools;
+
+import java.io.OutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.DataOutputStream;
+import java.io.DataInputStream;
+
+/**
+ * A basic implementation.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NavigationalStateContextSerialization implements Serialization<NavigationalStateContext>
+{
+
+ public NavigationalStateContextSerialization()
+ {
+ }
+
+ public void serialize(NavigationalStateContext navigationalStateContext, OutputStream out) throws IOException, IllegalArgumentException
+ {
+ NavigationalStateContextImpl tmp = (NavigationalStateContextImpl)navigationalStateContext;
+
+ // Serialize to bytes
+ byte[] bytes = IOTools.serialize(tmp);
+
+ // See if we can reuse an existing data output stream
+ DataOutputStream dataOut = out instanceof DataOutputStream ? (DataOutputStream)out : new DataOutputStream(out);
+
+ // Write data
+ dataOut.writeInt(bytes.length);
+ dataOut.write(bytes);
+
+ // We only need to flush if we have our own data stream
+ if (!(out instanceof DataOutputStream))
+ {
+ dataOut.flush();
+ }
+ }
+
+ public NavigationalStateContext unserialize(InputStream in) throws IOException, IllegalArgumentException
+ {
+ DataInputStream dataIn = in instanceof DataInputStream ? (DataInputStream)in : new DataInputStream(in);
+
+ //
+ int length = dataIn.readInt();
+ byte[] bytes = new byte[length];
+ dataIn.readFully(bytes);
+
+ //
+ try
+ {
+ return (NavigationalStateContext)IOTools.unserialize(bytes);
+ }
+ catch (ClassNotFoundException e)
+ {
+ // Need to improve that later
+ throw new Error(e);
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CommandAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CommandAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CommandAction.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.protocol;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class CommandAction extends UIObjectAction
+{
+ protected CommandAction(String targetId) throws IllegalArgumentException
+ {
+ super(targetId);
+ }
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/navigational/NavigationalStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/navigational/NavigationalStateContext.java 2008-04-26 20:51:08 UTC (rev 10719)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/navigational/NavigationalStateContext.java 2008-04-27 20:25:19 UTC (rev 10720)
@@ -28,6 +28,8 @@
import java.io.Serializable;
/**
+ * Note that this object itself is not serializable on purpose as it may contain references to non serializable object.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
15 years, 12 months