JBoss Portal SVN: r10895 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/errorhandling.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-06-02 01:28:47 -0400 (Mon, 02 Jun 2008)
New Revision: 10895
Added:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/errorhandling/errorHandling_management.png
Log:
8.5. Configuration using the Portal Management Application
- adding image
Added: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/errorhandling/errorHandling_management.png
===================================================================
(Binary files differ)
Property changes on: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/images/errorhandling/errorHandling_management.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 11 months
JBoss Portal SVN: r10894 - modules/common/trunk/common/src/main/java/org/jboss/portal/common/xml.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-01 19:30:25 -0400 (Sun, 01 Jun 2008)
New Revision: 10894
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/xml/XMLTools.java
Log:
add XMLTools.getChildren(Element) to get all the element nodes of an element
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/xml/XMLTools.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/xml/XMLTools.java 2008-06-01 23:15:21 UTC (rev 10893)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/xml/XMLTools.java 2008-06-01 23:30:25 UTC (rev 10894)
@@ -345,6 +345,18 @@
}
/**
+ * Return an iterator for all the children of the given element.
+ *
+ * @param element the parent element
+ * @return an iterator for the designated elements
+ * @throws IllegalArgumentException if the element is null or the name is null
+ */
+ public static Iterator<Element> getChildrenIterator(Element element) throws IllegalArgumentException
+ {
+ return getChildren(element).iterator();
+ }
+
+ /**
* Return an iterator for all the children of the given element having the specified name.
*
* @param element the parent element
@@ -373,6 +385,18 @@
}
/**
+ * Return all the children of the given element. The collection object can be modified.
+ *
+ * @param element the parent element
+ * @return a list of elements
+ * @throws IllegalArgumentException if the element is null or the name is null
+ */
+ public static List<Element> getChildren(Element element) throws IllegalArgumentException
+ {
+ return getChildren(element, null, null);
+ }
+
+ /**
* Return all the children of the given element having the specified name. The collection object can be modified.
*
* @param element the parent element
@@ -386,14 +410,22 @@
}
/**
- * Return all the children of the given element having the specified name and the optionally specified namespace URI.
- * The collection object can be modified.
+ * <p>Return all the children of the given element having the optionally specified name and the namespace URI.</p>
*
+ * <p>If the URI is specified then the element must have the same URI namespace in order to be included otherwise
+ * it will be included. If the URI is specified the name matching will be done against the element local name
+ * otherwise it will be done against the element tag name.</p>
+ *
+ * <p>If the name is specified then the element must have the same tag name or the same local name to be retained
+ * otherwise it will be included.</p>
+ *
+ * <p>The resulting element collection can be safely modified.</p>
+ *
* @param element the parent element
* @param uri the children uri
* @param name the children name
* @return a list of elements
- * @throws IllegalArgumentException if the element is null or the name is null
+ * @throws IllegalArgumentException if the element is null
*/
public static List<Element> getChildren(Element element, String uri, String name) throws IllegalArgumentException
{
@@ -401,10 +433,6 @@
{
throw new IllegalArgumentException("No element found");
}
- if (name == null)
- {
- throw new IllegalArgumentException("No name specified");
- }
ArrayList<Element> result = new ArrayList<Element>();
NodeList list = element.getChildNodes();
for (int i = 0; i < list.getLength(); i++)
@@ -417,14 +445,14 @@
//
if (uri == null)
{
- if (childElt.getTagName().equals(name))
+ if (name == null || childElt.getTagName().equals(name))
{
result.add(childElt);
}
}
else if (uri.equals(childElt.getNamespaceURI()))
{
- if (childElt.getLocalName().equals(name))
+ if (name == null || childElt.getLocalName().equals(name))
{
result.add(childElt);
}
17 years, 11 months
JBoss Portal SVN: r10893 - modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-01 19:15:21 -0400 (Sun, 01 Jun 2008)
New Revision: 10893
Added:
modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/ServletContextFactory.java
Log:
forgot to add a class / oups
Added: modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/ServletContextFactory.java
===================================================================
--- modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/ServletContextFactory.java (rev 0)
+++ modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/ServletContextFactory.java 2008-06-01 23:15:21 UTC (rev 10893)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.common.mc.bootstrap;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ServletContextFactory
+{
+
+ /** . */
+ private final ServletContext servletContext;
+
+ public ServletContextFactory(ServletContext servletContext)
+ {
+ this.servletContext = servletContext;
+ }
+
+ public ServletContext getInstance()
+ {
+ return servletContext;
+ }
+}
17 years, 11 months
JBoss Portal SVN: r10892 - modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-01 19:11:09 -0400 (Sun, 01 Jun 2008)
New Revision: 10892
Removed:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletPresentationServer.java
Log:
remove obsolete class
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletPresentationServer.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletPresentationServer.java 2008-06-01 23:08:16 UTC (rev 10891)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletPresentationServer.java 2008-06-01 23:11:09 UTC (rev 10892)
@@ -1,221 +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.portal.content.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.UINode;
-import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.portal.content.portlet.protocol.PortletContainerAction;
-import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletPageNavigationalState;
-import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletControllerContext;
-import org.jboss.portal.presentation.impl.model.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();
-
- //
- PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
- client,
- pageNode,
- portletInvoker);
-
- //
- PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
- portletControllerContext,
- client.getNavigationalStateContext(),
- PresentationPortletPageNavigationalState.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();
-/*
- }
-*/
- }
-
- 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();
-
- //
- PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
- client,
- pageNode,
- portletInvoker);
-
- PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
- portletControllerContext,
- client.getNavigationalStateContext(),
- PresentationPortletPageNavigationalState.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();
-
- //
- PresentationPortletPageNavigationalState blah = (PresentationPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
-
- //
- blah.flush();
- }
- }
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
-
- //
- return new PresentationResponse(new ShowUIObjectResponse(pageNode.getObject().getId()));
- }
- else
- {
- return next.process(client, request);
- }
-*/
- return null;
- }
-}
17 years, 11 months
JBoss Portal SVN: r10891 - in modules/presentation/trunk/portal/src/main: java/org/jboss/portal/presentation/portal and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-01 19:08:16 -0400 (Sun, 01 Jun 2008)
New Revision: 10891
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandlerRegistry.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
Log:
needed to add a notion of content handler/registry for window content similar to 2.7
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-01 15:32:27 UTC (rev 10890)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-01 23:08:16 UTC (rev 10891)
@@ -131,7 +131,6 @@
</constructor>
</bean>
-
<bean name="StructuralStateContext" class="org.jboss.portal.presentation.portal.model.StructuralStateContextImpl"/>
<bean name="StructuralStateContextImporter" class="org.jboss.portal.presentation.portal.servlet.StructuralStateContextImporter">
@@ -142,10 +141,25 @@
<bean name="PresentationServer" class="org.jboss.portal.presentation.portal.PresentationServerImpl">
<constructor>
<parameter><inject bean="StructuralStateContext"/></parameter>
- <parameter><inject bean="ConsumerPortletInvoker"/></parameter>
+ <parameter><inject bean="ContentHandlerRegistry"/></parameter>
</constructor>
</bean>
+ <bean name="ContentHandlerRegistry" class="org.jboss.portal.presentation.portal.content.ContentHandlerRegistry"/>
+ <bean name="PortletContentHandler" class="org.jboss.portal.presentation.portal.content.portlet.PortletContentHandler">
+ <property name="portletInvoker"><inject bean="ConsumerPortletInvoker"/></property>
+ <install bean="ContentHandlerRegistry" method="addContentHandler">
+ <parameter>portlet</parameter>
+ <parameter><this/></parameter>
+ </install>
+ </bean>
+ <bean name="MarkupContentHandler" class="org.jboss.portal.presentation.portal.content.markup.MarkupContentHandler">
+ <install bean="ContentHandlerRegistry" method="addContentHandler">
+ <parameter>markup</parameter>
+ <parameter><this/></parameter>
+ </install>
+ </bean>
+
</deployment>
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-01 15:32:27 UTC (rev 10890)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-01 23:08:16 UTC (rev 10891)
@@ -28,9 +28,8 @@
import org.jboss.portal.presentation.portal.model.WindowNode;
import org.jboss.portal.presentation.portal.model.PageNode;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
-import org.jboss.portal.presentation.portal.content.portlet.protocol.PortletContainerAction;
-import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletControllerContext;
-import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletPageNavigationalState;
+import org.jboss.portal.presentation.portal.content.ContentHandlerRegistry;
+import org.jboss.portal.presentation.portal.content.ContentHandler;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.protocol.ErrorResponse;
import org.jboss.portal.presentation.protocol.ProtocolAction;
@@ -38,22 +37,13 @@
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.ProtocolResponse;
import org.jboss.portal.presentation.server.PresentationRequest;
import org.jboss.portal.presentation.server.PresentationResponse;
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.common.NotYetImplemented;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
-import org.jboss.portal.portlet.controller.request.ControllerRequest;
-import org.jboss.portal.portlet.controller.request.PortletActionRequest;
-import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
-import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
-import org.jboss.portal.portlet.controller.response.ControllerResponse;
-import org.jboss.portal.portlet.controller.PortletController;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -66,12 +56,12 @@
private StructuralStateContextImpl structuralStateContext;
/** . */
- private PortletInvoker portletInvoker;
+ private ContentHandlerRegistry contentHandlerRegistry;
- public PresentationServerImpl(StructuralStateContextImpl structuralStateContext, PortletInvoker portletInvoker)
+ public PresentationServerImpl(StructuralStateContextImpl structuralStateContext, ContentHandlerRegistry contentHandlerRegistry)
{
this.structuralStateContext = structuralStateContext;
- this.portletInvoker = portletInvoker;
+ this.contentHandlerRegistry = contentHandlerRegistry;
}
public StructuralStateContext getStructuralStateContext()
@@ -81,13 +71,15 @@
public WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException
{
- WindowNode windowNode = (WindowNode)structuralStateContext.getNode(windowId);
+ WindowNode window = (WindowNode)structuralStateContext.getNode(windowId);
- WindowNode.Content content = windowNode.getContent();
+ WindowNode.Content content = window.getContent();
- WindowContent windowContent = content.render(windowNode, client, portletInvoker);
-
- return windowContent;
+ String contentType = content.getType();
+
+ ContentHandler handler = contentHandlerRegistry.getContentHandler(contentType);
+
+ return handler.render(window, client);
}
public PresentationResponse process(PresentationClient client, PresentationRequest request) throws PresentationServerException
@@ -124,88 +116,31 @@
ContentAction contentAction = (ContentAction)objectAction;
//
- WindowNode targetWindow = (WindowNode)targetNode;
+ WindowNode window = (WindowNode)targetNode;
//
- PageNode page = (PageNode)targetWindow.getParent();
+ WindowNode.Content content = window.getContent();
//
- if (contentAction instanceof PortletContainerAction)
- {
- PortletContainerAction pcAction = (PortletContainerAction)contentAction;
+ String contentType = content.getType();
+ //
+ ContentHandler handler = contentHandlerRegistry.getContentHandler(contentType);
- //
- PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
- client,
- page,
- portletInvoker);
+ //
+ ProtocolResponse response = handler.process(window, client, contentAction);
- PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
- portletControllerContext,
- client.getNavigationalStateContext(),
- PresentationPortletPageNavigationalState.CLONE_AND_WRITE_MODE);
+ //
+ if (response == null)
+ {
+ PageNode page = window.getPage();
//
- 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();
-
- //
- PresentationPortletPageNavigationalState blah = (PresentationPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
-
- //
- blah.flush();
- }
- }
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
-
- //
- return new PresentationResponse(new ShowUIObjectResponse(page.getId()));
+ response = new ShowUIObjectResponse(page.getId());
}
+
+ //
+ return new PresentationResponse(response);
}
}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java 2008-06-01 23:08:16 UTC (rev 10891)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.portal.content;
+
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.presentation.protocol.ProtocolResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface ContentHandler
+{
+
+ ProtocolResponse process(WindowNode window, PresentationClient client, ContentAction action) throws PresentationServerException;
+
+ WindowContent render(WindowNode window, PresentationClient client) throws PresentationServerException;
+
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandlerRegistry.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandlerRegistry.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandlerRegistry.java 2008-06-01 23:08:16 UTC (rev 10891)
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * 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.portal.content;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContentHandlerRegistry
+{
+
+ private final Map<String, ContentHandler> blah;
+
+ public ContentHandlerRegistry()
+ {
+ blah = new HashMap<String, ContentHandler>();
+ }
+
+ public void addContentHandler(String contentType, ContentHandler contentHandler)
+ {
+ if (contentType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (contentHandler == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (blah.containsKey(contentType))
+ {
+ throw new IllegalStateException("Content type " + contentType + " already registered");
+ }
+ blah.put(contentType, contentHandler);
+ }
+
+ public void removeContentHandler(String contentType)
+ {
+ if (contentType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (blah.remove(contentType) == null)
+ {
+ throw new IllegalStateException("Content type " + contentType + " is not registered");
+ }
+ }
+
+ public ContentHandler getContentHandler(String contentType)
+ {
+ if (contentType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return blah.get(contentType);
+ }
+}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java 2008-06-01 15:32:27 UTC (rev 10890)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java 2008-06-01 23:08:16 UTC (rev 10891)
@@ -48,6 +48,11 @@
return markup;
}
+ public String getType()
+ {
+ return "markup";
+ }
+
public WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException
{
return new WindowContent(0, "blah", "markup");
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java 2008-06-01 23:08:16 UTC (rev 10891)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * 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.portal.content.markup;
+
+import org.jboss.portal.presentation.portal.content.ContentHandler;
+import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
+import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.presentation.protocol.ProtocolResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MarkupContentHandler implements ContentHandler
+{
+
+ public ProtocolResponse process(WindowNode window, PresentationClient client, ContentAction action) throws PresentationServerException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public WindowContent render(WindowNode window, PresentationClient client) throws PresentationServerException
+ {
+ String markup = ((MarkupContent)window.getContent()).getMarkup();
+ return new WindowContent(0, "blah", markup);
+ }
+}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java 2008-06-01 15:32:27 UTC (rev 10890)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java 2008-06-01 23:08:16 UTC (rev 10891)
@@ -56,14 +56,15 @@
return ref;
}
+ public String getType()
+ {
+ return "portlet";
+ }
+
public WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException
{
-
try
{
- NavigationalStateContext navigationalStateContext = client.getNavigationalStateContext();
-
- //
PageNode page = (PageNode)window.getParent();
//
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-01 23:08:16 UTC (rev 10891)
@@ -0,0 +1,188 @@
+/******************************************************************************
+ * 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.portal.content.portlet;
+
+import org.jboss.portal.presentation.portal.content.ContentHandler;
+import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
+import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletControllerContext;
+import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletPageNavigationalState;
+import org.jboss.portal.presentation.portal.content.portlet.protocol.PortletContainerAction;
+import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.model.PageNode;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.presentation.protocol.ProtocolResponse;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+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.controller.state.PortletWindowNavigationalState;
+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.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.common.NotYetImplemented;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletContentHandler implements ContentHandler
+{
+
+ /** . */
+ private PortletInvoker portletInvoker;
+
+ public PortletInvoker getPortletInvoker()
+ {
+ return portletInvoker;
+ }
+
+ public void setPortletInvoker(PortletInvoker portletInvoker)
+ {
+ this.portletInvoker = portletInvoker;
+ }
+
+ public ProtocolResponse process(WindowNode window, PresentationClient client, ContentAction action) throws PresentationServerException
+ {
+ PortletContainerAction pcAction = (PortletContainerAction)action;
+
+ //
+ PageNode page = window.getPage();
+
+ //
+ PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
+ client,
+ page,
+ portletInvoker);
+
+ PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
+ portletControllerContext,
+ client.getNavigationalStateContext(),
+ PresentationPortletPageNavigationalState.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();
+
+ //
+ PresentationPortletPageNavigationalState blah = (PresentationPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
+
+ //
+ blah.flush();
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ return null;
+ }
+
+ public WindowContent render(WindowNode window, PresentationClient client) throws PresentationServerException
+ {
+ try
+ {
+ PageNode page = (PageNode)window.getParent();
+
+ //
+ PortletController controller = new PortletController();
+
+ //
+ PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
+ client,
+ page,
+ portletInvoker);
+
+ //
+ PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
+ portletControllerContext,
+ client.getNavigationalStateContext(),
+ PresentationPortletPageNavigationalState.READ_ONLY_MODE);
+
+ PortletInvocationResponse response = controller.render(portletControllerContext, null, pageNavigationalState, window.getId());
+
+ //
+ 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 " + window.getId(), "");
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new PresentationServerException(e);
+ }
+ }
+}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-01 15:32:27 UTC (rev 10890)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-01 23:08:16 UTC (rev 10891)
@@ -76,5 +76,8 @@
public static abstract class Content
{
public abstract WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException;
+
+ public abstract String getType();
+
}
}
17 years, 11 months
JBoss Portal SVN: r10890 - in modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal: model and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-01 11:32:27 -0400 (Sun, 01 Jun 2008)
New Revision: 10890
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
Log:
added pane node impl
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java 2008-06-01 15:12:54 UTC (rev 10889)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java 2008-06-01 15:32:27 UTC (rev 10890)
@@ -23,6 +23,10 @@
package org.jboss.portal.presentation.portal.content.markup;
import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.portlet.PortletInvoker;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -43,4 +47,9 @@
{
return markup;
}
+
+ public WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException
+ {
+ return new WindowContent(0, "blah", "markup");
+ }
}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java 2008-06-01 15:12:54 UTC (rev 10889)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java 2008-06-01 15:32:27 UTC (rev 10890)
@@ -25,6 +25,10 @@
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIPage;
+import java.util.Collection;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -40,4 +44,30 @@
{
return UIPage.class;
}
+
+ public Collection<WindowNode> getWindows()
+ {
+ List<WindowNode> windows = new ArrayList<WindowNode>();
+
+ //
+ collectWindows(this, windows);
+
+ //
+ return windows;
+ }
+
+ private void collectWindows(StructuralNode node, List<WindowNode> windows)
+ {
+ if (node instanceof WindowNode)
+ {
+ windows.add((WindowNode)node);
+ }
+ else if (node instanceof PaneNode)
+ {
+ for (StructuralNode child : node.getChildren())
+ {
+ collectWindows(child, windows);
+ }
+ }
+ }
}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java 2008-06-01 15:32:27 UTC (rev 10890)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIPane;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PaneNode extends StructuralNode
+{
+
+ public PaneNode(String name, StructuralStateContextImpl structuralStateContext)
+ {
+ super(name, structuralStateContext);
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return UIPane.class;
+ }
+}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-01 15:12:54 UTC (rev 10889)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-01 15:32:27 UTC (rev 10890)
@@ -49,6 +49,20 @@
return UIWindow.class;
}
+ public PageNode getPage()
+ {
+ for (StructuralNode current = getParent();current != null;current = current.getParent())
+ {
+ if (current instanceof PageNode)
+ {
+ return (PageNode)current;
+ }
+ }
+
+ //
+ return null;
+ }
+
public void setContent(Content content)
{
this.content = content;
@@ -61,9 +75,6 @@
public static abstract class Content
{
- public WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException
- {
- return new WindowContent(0, "blah", "markup");
- }
+ public abstract WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException;
}
}
17 years, 11 months
JBoss Portal SVN: r10889 - modules/presentation/trunk.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-01 11:12:54 -0400 (Sun, 01 Jun 2008)
New Revision: 10889
Modified:
modules/presentation/trunk/pom.xml
Log:
remove portlet module that was moved to the portal module
Modified: modules/presentation/trunk/pom.xml
===================================================================
--- modules/presentation/trunk/pom.xml 2008-06-01 15:12:31 UTC (rev 10888)
+++ modules/presentation/trunk/pom.xml 2008-06-01 15:12:54 UTC (rev 10889)
@@ -28,7 +28,6 @@
<modules>
<module>build</module>
<module>presentation</module>
- <!--<module>portlet</module>-->
<module>classic</module>
<module>portal</module>
<!--<module>ajax2</module>-->
17 years, 11 months
JBoss Portal SVN: r10888 - modules/presentation/trunk.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-01 11:12:31 -0400 (Sun, 01 Jun 2008)
New Revision: 10888
Removed:
modules/presentation/trunk/portlet/
Log:
remove portlet module that was moved to the portal module
17 years, 11 months
JBoss Portal SVN: r10887 - in modules/presentation/trunk: ajax/src/main/config/war/WEB-INF and 46 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-01 11:09:24 -0400 (Sun, 01 Jun 2008)
New Revision: 10887
Added:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderChain.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderChain.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionDecoder.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionEncoder.java
modules/presentation/trunk/portal/
modules/presentation/trunk/portal/pom.xml
modules/presentation/trunk/portal/src/
modules/presentation/trunk/portal/src/assemble/
modules/presentation/trunk/portal/src/assemble/presentation-portal-war.xml
modules/presentation/trunk/portal/src/main/
modules/presentation/trunk/portal/src/main/artifacts/
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/context.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-web.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/portlet.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/web.xml
modules/presentation/trunk/portal/src/main/java/
modules/presentation/trunk/portal/src/main/java/org/
modules/presentation/trunk/portal/src/main/java/org/jboss/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionDecoder.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionEncoder.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/protocol/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/protocol/ContentAction.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ContextNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralObjectImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralStateContextImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralStateImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
modules/presentation/trunk/portal/src/main/resources/
modules/presentation/trunk/portal/src/main/resources/org/
modules/presentation/trunk/portal/src/main/resources/org/jboss/
modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/
modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/
modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/
modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd
modules/presentation/trunk/portal/src/test/
modules/presentation/trunk/portal/src/test/java/
modules/presentation/trunk/portal/src/test/java/org/
modules/presentation/trunk/portal/src/test/java/org/jboss/
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
Removed:
modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/
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/state/structural/ContextNode.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/NodeImporter.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/StructuralObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateContextImpl.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/resources/org/jboss/portal/presentation/impl/state/structural/page_structure_1_0.xsd
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/structural/StructuralStateContextTestCase.java
Modified:
modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/build/pom.xml
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/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/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletPresentationServer.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationEventControllerContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletControllerContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationStateControllerContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletContainerAction.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationClientContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationInstanceContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortalContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortletInvocationContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationSecurityContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationServerContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationWindowContext.java
modules/presentation/trunk/presentation/pom.xml
Log:
refactor in PF
Modified: modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml 2008-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -27,7 +27,7 @@
<!-- PF Plugin Services: Out-Of-The-Box Plugin for PF integrated with the Mock Portal Server -->
<bean
name="StructuralStateContext"
- class="org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl">
+ class="org.jboss.portal.presentation.portal.model.StructuralStateContextImpl">
</bean>
<bean
name="PresentationServer"
Modified: modules/presentation/trunk/build/pom.xml
===================================================================
--- modules/presentation/trunk/build/pom.xml 2008-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/build/pom.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -143,7 +143,7 @@
<groupId>org.jboss.portal.common</groupId>
<artifactId>common-mc</artifactId>
<version>${version.jboss.portal.common}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.jboss.portal.web</groupId>
Modified: modules/presentation/trunk/classic/pom.xml
===================================================================
--- modules/presentation/trunk/classic/pom.xml 2008-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/classic/pom.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -104,26 +104,6 @@
<build>
<plugins>
-
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <finalName>classic</finalName>
- <descriptors>
- <descriptor>src/assemble/presentation-war.xml</descriptor>
- </descriptors>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
</plugins>
</build>
</project>
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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -28,9 +28,12 @@
import org.jboss.portal.presentation.view.PageViewPortScope;
import org.jboss.portal.presentation.classic.protocol.ActionDecoder;
import org.jboss.portal.presentation.classic.protocol.ActionEncoder;
+import org.jboss.portal.presentation.classic.protocol.ActionEncoderContext;
+import org.jboss.portal.presentation.classic.protocol.ActionDecoderContext;
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.impl.state.navigational.NavigationalStateContextSerialization;
import org.jboss.portal.presentation.model.UIModel;
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPort;
@@ -59,6 +62,9 @@
import org.jboss.portal.web.impl.DefaultServletContainerFactory;
import org.jboss.portal.common.servlet.URLFormat;
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 java.io.IOException;
import java.io.PrintWriter;
@@ -82,24 +88,48 @@
protected final PresentationServer server;
/** . */
- protected ActionEncoder encoder;
+ protected final ActionEncoder encoder;
/** . */
+ protected final ActionDecoder decoder;
+
+ /** . */
protected final ProtocolAction protocolAction;
/** . */
protected final NavigationalStateContext navigationalStateContext;
+ /** . */
+ private ActionEncoderContext encoderContext;
+
public ClassicPresentationClient(
WebRequest req,
WebResponse resp,
- PresentationServer server)
+ PresentationServer server,
+ ActionDecoder decoder,
+ ActionEncoder encoder)
{
- ActionDecoder decoder = new ActionDecoder();
- decoder.decode(req);
+ String nsString = req.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);
+ }
//
- NavigationalStateContext navigationalStateContext = decoder.getNavigationalStateContext();
+ ActionDecoderContext decoderContext = new ActionDecoderContext(
+ req.getVerb(),
+ req.getWebRequestPath(),
+ req.getQueryParameterMap(),
+ req.getBody()
+ );
+
+ //
+ ProtocolAction protocolAction = decoder.decode(decoderContext);
+
+ //
if (navigationalStateContext == null)
{
navigationalStateContext = new NavigationalStateContextImpl();
@@ -109,9 +139,10 @@
this.req = req;
this.resp = resp;
this.server = server;
- this.protocolAction = decoder.getProtocolAction();
+ this.protocolAction = protocolAction;
this.navigationalStateContext = navigationalStateContext;
- this.encoder = null;
+ this.encoder = encoder;
+ this.decoder = decoder;
}
public NavigationalStateContext getNavigationalStateContext()
@@ -131,7 +162,7 @@
}
//
- String link = encoder.encode(action, resp);
+ String link = encoder.encode(action, encoderContext);
//
@@ -198,7 +229,9 @@
private void renderDocument(ViewPortScope scope, String nodeId) throws IOException
{
- encoder = new ActionEncoder((NavigationalStateContextImpl)navigationalStateContext);
+ byte[] bytes = IOTools.serialize(new NavigationalStateContextSerialization(), SerializationFilter.COMPRESSOR, navigationalStateContext);
+ String ns = Base64.encodeBytes(bytes, true);
+ encoderContext = new ActionEncoderContext(ns, resp);
//
StructuralStateContext ssc = server.getStructuralStateContext();
@@ -263,7 +296,7 @@
{
ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
- String url = encoder.encode(viewPage, resp);
+ String url = encoder.encode(viewPage, encoderContext);
writer.print("<div>Link to page <a href=\"" + url + "\">" + object.getName() + "</a></div>");
}
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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -22,22 +22,17 @@
******************************************************************************/
package org.jboss.portal.presentation.classic;
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.presentation.impl.server.PresentationServerImpl;
-import org.jboss.portal.presentation.impl.state.structural.ContextNode;
-import org.jboss.portal.presentation.impl.state.structural.NodeImporter;
-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.presentation.classic.protocol.ActionEncoder;
+import org.jboss.portal.presentation.classic.protocol.ActionDecoder;
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.WebResponse;
import org.jboss.portal.web.endpoint.EndPointServlet;
-import org.jboss.portal.portlet.PortletInvoker;
import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-import java.io.InputStream;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -46,52 +41,45 @@
public class ClassicPresentationServlet extends EndPointServlet
{
- private PresentationServer server;
-
public void init() throws ServletException
{
super.init();
+ }
- //
- StructuralStateContextImpl structuralStateContext = new StructuralStateContextImpl();
+ protected void service(WebRequest req, WebResponse resp) throws ServletException, IOException
+ {
+ PresentationServer server = (PresentationServer)getServletContext().getAttribute("PresentationServer");
+ ActionEncoder encoder = (ActionEncoder)getServletContext().getAttribute("ActionEncoder");
+
+ ActionDecoder decoder = (ActionDecoder)getServletContext().getAttribute("ActionDecoder");
+
//
- InputStream in = getServletContext().getResourceAsStream("/WEB-INF/page-structure.xml");
- try
+ if (server == null)
{
- ContextNode root = structuralStateContext.getRoot();
- new NodeImporter(root).importDocument(in);
+ resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "No presentation server found");
}
- catch (Exception e)
+ else if (encoder == null)
{
- throw new ServletException(e);
+ resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "No action encoder found");
}
- finally
+ else if (decoder == null)
{
- IOTools.safeClose(in);
+ resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "No action decoder found");
}
-
- //
- PortletInvoker portletInvoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
-
- //
- PresentationServer blahServer = new PresentationServerImpl(structuralStateContext);
-
- //
- this.server = new PortletPresentationServer(portletInvoker, blahServer);
- }
-
- protected void service(WebRequest req, WebResponse resp) throws ServletException, IOException
- {
- ClassicPresentationClient client = new ClassicPresentationClient(req, resp, server);
-
- try
+ else
{
- client.process();
+ ClassicPresentationClient client = new ClassicPresentationClient(req, resp, server, decoder, encoder);
+
+ //
+ try
+ {
+ client.process();
+ }
+ catch (PresentationServerException e)
+ {
+ throw new ServletException(e);
+ }
}
- catch (PresentationServerException e)
- {
- throw new ServletException(e);
- }
}
}
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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -22,147 +22,15 @@
******************************************************************************/
package org.jboss.portal.presentation.classic.protocol;
-import org.jboss.portal.presentation.protocol.GetActivation;
-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.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;
-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 $
*/
-public class ActionDecoder
+public interface ActionDecoder
{
- /** The protocol action. */
- private ProtocolAction protocolAction;
+ ProtocolAction decode(ActionDecoderContext context);
- /** . */
- private NavigationalStateContext navigationalStateContext;
-
- public ProtocolAction getProtocolAction()
- {
- return protocolAction;
- }
-
- public NavigationalStateContext getNavigationalStateContext()
- {
- return navigationalStateContext;
- }
-
- public void decode(WebRequest request)
- {
- ProtocolAction action = null;
-
- //
- String webPath = request.getWebRequestPath();
-
- //
- if (webPath.startsWith("/view/"))
- {
- String targetId = webPath.substring("/view/".length());
- action = new ViewUIObjectAction(targetId);
- }
- else if (webPath.startsWith("/invoke/"))
- {
- int from = "/invoke/".length();
-
- //
- String path = null;
- int to = webPath.indexOf('/', from + 1);
- if (to == -1)
- {
- to = webPath.length();
- }
- else
- {
- path = webPath.substring(to + 1);
- }
-
- //
- String targetId = webPath.substring(from, to);
-
- //
- switch (request.getVerb())
- {
- case GET:
- action= new GetActivation(targetId, path, request.getQueryParameterMap());
- break;
- case POST:
- 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();
- }
- }
-
- //
- 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;
- }
-}
+ }
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderChain.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderChain.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderChain.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * 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.classic.protocol;
+
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ActionDecoderChain implements ActionDecoder
+{
+
+ /** . */
+ private final List<ActionDecoder> decoders;
+
+ public ActionDecoderChain(List<ActionDecoder> decoders)
+ {
+ this.decoders = decoders;
+ }
+
+ public ProtocolAction decode(ActionDecoderContext context)
+ {
+ for (ActionDecoder decoder : decoders)
+ {
+ ProtocolAction action = decoder.decode(context);
+
+ //
+ if (action != null)
+ {
+ return action;
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderContext.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * 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.classic.protocol;
+
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ActionDecoderContext
+{
+
+ /** . */
+ private final WebRequest.Verb verb;
+
+ /** . */
+ private final String path;
+
+ /** . */
+ private final Map<String, String[]> queryParameterMap;
+
+ /** . */
+ private final Body body;
+
+ public ActionDecoderContext(WebRequest.Verb verb, String path, Map<String, String[]> queryParameterMap, Body body)
+ {
+ this.verb = verb;
+ this.path = path;
+ this.queryParameterMap = queryParameterMap;
+ this.body = body;
+ }
+
+ public WebRequest.Verb getVerb()
+ {
+ return verb;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public Map<String, String[]> getQueryParameterMap()
+ {
+ return queryParameterMap;
+ }
+
+ public Body getBody()
+ {
+ return body;
+ }
+}
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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -22,103 +22,15 @@
******************************************************************************/
package org.jboss.portal.presentation.classic.protocol;
-import org.jboss.portal.common.text.FastURLEncoder;
-import org.jboss.portal.presentation.protocol.LinkActivation;
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.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;
-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 $
*/
-public class ActionEncoder
+public interface ActionEncoder
{
- /** An optional navigational state. */
- private String ns;
+ String encode(ProtocolAction action, ActionEncoderContext context);
- 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)
- {
- UIObjectAction objectAction = (UIObjectAction)action;
-
- //
- String targetId = FastURLEncoder.getUTF8Instance().encode(objectAction.getTargetId());
-
- //
- if (action instanceof ViewUIObjectAction)
- {
- return resp.renderURL("/view/" + targetId, null, null);
- }
- else if (action instanceof LinkActivation)
- {
- LinkActivation linkActivationAction = (LinkActivation)action;
-
- //
- 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;
- }
}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderChain.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderChain.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderChain.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * 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.classic.protocol;
+
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ActionEncoderChain implements ActionEncoder
+{
+
+ /** . */
+ private List<ActionEncoder> encoders;
+
+ public ActionEncoderChain(List<ActionEncoder> encoders)
+ {
+ this.encoders = encoders;
+ }
+
+ public String encode(ProtocolAction action, ActionEncoderContext context)
+ {
+ for (ActionEncoder encoder : encoders)
+ {
+ String v = encoder.encode(action, context);
+
+ //
+ if (v != null)
+ {
+ return v;
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderContext.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.classic.protocol;
+
+import org.jboss.portal.web.WebResponse;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ActionEncoderContext
+{
+
+ /** . */
+ private final String navigationalState;
+
+ /** . */
+ private final WebResponse webResponse;
+
+ public ActionEncoderContext(String navigationalState, WebResponse webResponse)
+ {
+ this.navigationalState = navigationalState;
+ this.webResponse = webResponse;
+ }
+
+ public String getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public String renderURL(String path, Map<String, String[]> parameters) throws IllegalArgumentException
+ {
+ return webResponse.renderURL(path, parameters, null);
+ }
+}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionDecoder.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionDecoder.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionDecoder.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * 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.classic.protocol;
+
+import org.jboss.portal.presentation.protocol.GetActivation;
+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.common.NotYetImplemented;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DefaultActionDecoder implements ActionDecoder
+{
+
+ public ProtocolAction decode(ActionDecoderContext context)
+ {
+ ProtocolAction action = null;
+
+ //
+ String webPath = context.getPath();
+
+ //
+ if (webPath.startsWith("/view/"))
+ {
+ String targetId = webPath.substring("/view/".length());
+ action = new ViewUIObjectAction(targetId);
+ }
+ else if (webPath.startsWith("/invoke/"))
+ {
+ int from = "/invoke/".length();
+
+ //
+ String path = null;
+ int to = webPath.indexOf('/', from + 1);
+ if (to == -1)
+ {
+ to = webPath.length();
+ }
+ else
+ {
+ path = webPath.substring(to + 1);
+ }
+
+ //
+ String targetId = webPath.substring(from, to);
+
+ //
+ switch (context.getVerb())
+ {
+ case GET:
+ action= new GetActivation(targetId, path, context.getQueryParameterMap());
+ break;
+ case POST:
+ action = new PostActivation(targetId, path, context.getQueryParameterMap(), context.getBody());
+ break;
+ default:
+ throw new NotYetImplemented();
+ }
+ }
+
+ //
+ return action;
+ }
+}
\ No newline at end of file
Copied: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionEncoder.java (from rev 10862, 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/DefaultActionEncoder.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionEncoder.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * 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.classic.protocol;
+
+import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.presentation.protocol.LinkActivation;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.presentation.protocol.UIObjectAction;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DefaultActionEncoder implements ActionEncoder
+{
+
+ public DefaultActionEncoder()
+ {
+ }
+
+ public String encode(ProtocolAction action, ActionEncoderContext context)
+ {
+ if (action instanceof UIObjectAction)
+ {
+ UIObjectAction objectAction = (UIObjectAction)action;
+
+ //
+ String targetId = FastURLEncoder.getUTF8Instance().encode(objectAction.getTargetId());
+
+ //
+ if (action instanceof ViewUIObjectAction)
+ {
+ return context.renderURL("/view/" + targetId, null);
+ }
+ else if (action instanceof LinkActivation)
+ {
+ LinkActivation linkActivationAction = (LinkActivation)action;
+
+ //
+ return context.renderURL("/invoke/" + targetId, linkActivationAction.getQueryParameters());
+ }
+ }
+
+ //
+ return null;
+ }
+}
\ No newline at end of file
Modified: modules/presentation/trunk/pom.xml
===================================================================
--- modules/presentation/trunk/pom.xml 2008-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/pom.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -28,8 +28,9 @@
<modules>
<module>build</module>
<module>presentation</module>
- <module>portlet</module>
+ <!--<module>portlet</module>-->
<module>classic</module>
+ <module>portal</module>
<!--<module>ajax2</module>-->
<!--<module>ajax</module>-->
</modules>
Added: modules/presentation/trunk/portal/pom.xml
===================================================================
--- modules/presentation/trunk/portal/pom.xml (rev 0)
+++ modules/presentation/trunk/portal/pom.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,143 @@
+<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-portal</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal Presentation Framework - Portal Module</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.portal.presentation</groupId>
+ <artifactId>presentation-presentation</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.presentation</groupId>
+ <artifactId>presentation-classic</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>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-mc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-samples</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.presentation</groupId>
+ <artifactId>presentation-presentation</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!-- To use in conjonctin with
+ export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
+ -->
+ <forkMode>never</forkMode>
+ <argLine>-enableassertions</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <finalName>portal</finalName>
+ <descriptors>
+ <descriptor>src/assemble/presentation-portal-war.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: modules/presentation/trunk/portal/src/assemble/presentation-portal-war.xml
===================================================================
--- modules/presentation/trunk/portal/src/assemble/presentation-portal-war.xml (rev 0)
+++ modules/presentation/trunk/portal/src/assemble/presentation-portal-war.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,52 @@
+<assembly>
+ <id>server</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+
+ <fileSet>
+ <directory>src/main/artifacts/presentation-portal-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>target/classes</directory>
+ <outputDirectory>WEB-INF/classes</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>WEB-INF/lib</outputDirectory>
+ <includes>
+
+ <include>org.jboss.portal.common:common-common</include>
+ <include>org.jboss.portal.common:common-portal</include>
+ <include>org.jboss.portal.common:common-mc</include>
+ <include>org.jboss.portal.web:web-web</include>
+ <include>org.jboss.portal.portlet:portlet-portlet</include>
+ <include>org.jboss.portal.portlet:portlet-controller</include>
+ <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-classic</include>
+
+ <include>javax.ccpp:ccpp</include>
+ <include>javax.portlet:portlet-api</include>
+
+ <include>org.jboss:jboss-common-core</include>
+ <include>org.jboss.microcontainer:jboss-kernel</include>
+ <include>org.jboss.microcontainer:jboss-dependency</include>
+ <include>org.jboss:jboss-reflect</include>
+ <include>org.jboss:jboss-mdr</include>
+ <include>org.jboss:jbossxb</include>
+
+ </includes>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
Added: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/context.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/context.xml (rev 0)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/context.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context privileged="true"/>
\ No newline at end of file
Added: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml (rev 0)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="PortletApplicationDeployer" class="org.jboss.portal.portlet.mc.PortletApplicationDeployer">
+ <alias>PortletApplicationRegistry</alias>
+ <property name="servletContainer"><inject bean="ServletContainer"/></property>
+ <property name="containerPortletInvoker"><inject bean="ContainerPortletInvoker"/></property>
+ </bean>
+
+ <!-- The ServletContainerFactory -->
+ <bean name="ServletContainerFactory" class="org.jboss.portal.web.impl.DefaultServletContainerFactory">
+ <constructor factoryClass="org.jboss.portal.web.impl.DefaultServletContainerFactory" factoryMethod="getInstance"/>
+ </bean>
+
+ <!-- The servlet container obtained from the ServletContainerFactory -->
+ <bean name="ServletContainer" class="org.jboss.portal.web.ServletContainer">
+ <constructor factoryMethod="getServletContainer">
+ <factory bean="ServletContainerFactory"/>
+ </constructor>
+ </bean>
+
+ <!-- The producer persistence manager -->
+ <bean name="ProducerPersistenceManager" class="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
+
+ <!-- The producer state management policy -->
+ <bean name="ProducerStateManagementPolicy" class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService">
+ <property name="persistLocally"><value>true</value></property>
+ </bean>
+
+ <!-- The producer state converter -->
+ <bean name="ProducerStateConverter" class="org.jboss.portal.portlet.impl.state.StateConverterV0"/>
+
+ <!-- The consumer portlet invoker -->
+ <bean name="ConsumerPortletInvoker" class="org.jboss.portal.portlet.PortletInvokerInterceptor">
+ <property name="next"><inject bean="ConsumerCacheInterceptor"/></property>
+ </bean>
+ <bean name="ConsumerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ConsumerCacheInterceptor">
+ <property name="next"><inject bean="PortletCustomizationInterceptor"/></property>
+ </bean>
+ <bean name="PortletCustomizationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.PortletCustomizationInterceptor">
+ <property name="next"><inject bean="ProducerPortletInvoker"/></property>
+ </bean>
+
+ <!-- The producer portlet invoker -->
+ <bean name="ProducerPortletInvoker" class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
+ <property name="next"><inject bean="ContainerPortletInvoker"/></property>
+ <property name="persistenceManager"><inject bean="ProducerPersistenceManager"/></property>
+ <property name="stateManagementPolicy"><inject bean="ProducerStateManagementPolicy"/></property>
+ <property name="stateConverter"><inject bean="ProducerStateConverter"/></property>
+ </bean>
+
+ <!-- The portlet container invoker -->
+ <bean name="ContainerPortletInvoker" class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
+ <property name="next"><inject bean="ValveInterceptor"/></property>
+ </bean>
+
+ <!-- Container stack -->
+ <bean name="ValveInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor">
+ <property name="portletApplicationRegistry"><inject bean="PortletApplicationRegistry" state="Instantiated"/></property>
+ <property name="next"><inject bean="SecureTransportInterceptor"/></property>
+ </bean>
+ <bean name="SecureTransportInterceptor" class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor">
+ <property name="next"><inject bean="ContextDispatcherInterceptor"/></property>
+ </bean>
+ <bean name="ContextDispatcherInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
+ <property name="servletContainerFactory"><inject bean="ServletContainerFactory"/></property>
+ <property name="next"><inject bean="ProducerCacheInterceptor"/></property>
+ </bean>
+ <bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor">
+ <property name="next"><inject bean="CCPPInterceptor"/></property>
+ </bean>
+ <bean name="CCPPInterceptor" class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor">
+ <property name="next"><inject bean="RequestAttributeConversationInterceptor"/></property>
+ </bean>
+ <bean name="RequestAttributeConversationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor">
+ <property name="next"><inject bean="EventPayloadInterceptor"/></property>
+ </bean>
+ <bean name="EventPayloadInterceptor" class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor">
+ <property name="next"><inject bean="PortletContainerDispatcher"/></property>
+ </bean>
+ <bean name="PortletContainerDispatcher" class="org.jboss.portal.portlet.container.ContainerPortletDispatcher">
+ </bean>
+
+
+
+ <bean name="DefaultActionEncoder" class="org.jboss.portal.presentation.classic.protocol.DefaultActionEncoder"/>
+ <bean name="PortletActionEncoder" class="org.jboss.portal.presentation.portal.content.portlet.protocol.PortletActionEncoder"/>
+ <bean name="ActionEncoder" class="org.jboss.portal.presentation.classic.protocol.ActionEncoderChain">
+ <constructor>
+ <parameter>
+ <list>
+ <inject bean="DefaultActionEncoder"/>
+ <inject bean="PortletActionEncoder"/>
+ </list>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="DefaultActionDecoder" class="org.jboss.portal.presentation.classic.protocol.DefaultActionDecoder"/>
+ <bean name="PortletActionDecoder" class="org.jboss.portal.presentation.portal.content.portlet.protocol.PortletActionDecoder"/>
+ <bean name="ActionDecoder" class="org.jboss.portal.presentation.classic.protocol.ActionDecoderChain">
+ <constructor>
+ <parameter>
+ <list>
+ <inject bean="DefaultActionDecoder"/>
+ <inject bean="PortletActionDecoder"/>
+ </list>
+ </parameter>
+ </constructor>
+ </bean>
+
+
+ <bean name="StructuralStateContext" class="org.jboss.portal.presentation.portal.model.StructuralStateContextImpl"/>
+
+ <bean name="StructuralStateContextImporter" class="org.jboss.portal.presentation.portal.servlet.StructuralStateContextImporter">
+ <property name="servletContext"><inject bean="ServletContext"/></property>
+ <property name="structuralStateContext"><inject bean="StructuralStateContext"/></property>
+ </bean>
+
+ <bean name="PresentationServer" class="org.jboss.portal.presentation.portal.PresentationServerImpl">
+ <constructor>
+ <parameter><inject bean="StructuralStateContext"/></parameter>
+ <parameter><inject bean="ConsumerPortletInvoker"/></parameter>
+ </constructor>
+ </bean>
+
+
+
+</deployment>
Added: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-web.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-web.xml (rev 0)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-web.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
+<jboss-web>
+ <class-loading java2ClassLoadingCompliance="false">
+ <loader-repository>test:loader=portlet</loader-repository>
+ </class-loading>
+</jboss-web>
\ No newline at end of file
Added: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml (rev 0)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<context-def
+ xmlns="urn:jboss:portal:presentation:page:1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <page-def name="default">
+ <simple-layout>
+ <window-def name="windowA">
+ <portlet ref="/portal-server.Catalog"/>
+ </window-def>
+ <window-def name="windowB">
+ <portlet ref="/portal-server.Cart"/>
+ </window-def>
+ </simple-layout>
+ <page-def name="child-page-default-1">
+ <simple-layout>
+ <window-def name="windowA">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum, libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante. Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ <window-def name="windowB">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum, libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante. Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ </simple-layout>
+ </page-def>
+ <page-def name="child-page-default-2">
+ <simple-layout>
+ <window-def name="windowA">
+ <portlet ref="/portal-server.PublicParameterPortlet1"/>
+ </window-def>
+ <window-def name="windowB">
+ <portlet ref="/portal-server.PublicParameterPortlet2"/>
+ </window-def>
+ <window-def name="windowC">
+ <portlet ref="/portal-server.PublicParameterPortlet3"/>
+ </window-def>
+ </simple-layout>
+ </page-def>
+ </page-def>
+ <page-def name="default-sibling-1">
+ <simple-layout>
+ <window-def name="windowA">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum, libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante. Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ <window-def name="windowB">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum, libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante. Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ <window-def name="windowC">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum, libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante. Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ <window-def name="windowD">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum, libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante. Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ <window-def name="windowE">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum, libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante. Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ </simple-layout>
+ </page-def>
+</context-def>
Added: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/portlet.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/portlet.xml (rev 0)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/portlet.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <description>Catalog Portlet</description>
+ <portlet-name>Catalog</portlet-name>
+ <display-name>Catalog Portlet</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.shoppingcart.CatalogPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Catalog Portlet</title>
+ <keywords>sample,event,catalog</keywords>
+ </portlet-info>
+ <supported-publishing-event>
+ <qname xmlns:jbp='urn:jboss:portal:samples:event'>jbp:CartEvent</qname>
+ </supported-publishing-event>
+ </portlet>
+
+ <portlet>
+ <description>Cart Portlet</description>
+ <portlet-name>Cart</portlet-name>
+ <display-name>Cart Portlet</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.shoppingcart.CartPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Cart Portlet</title>
+ <keywords>sample,event,cart</keywords>
+ </portlet-info>
+ <supported-processing-event>
+ <qname xmlns:jbp='urn:jboss:portal:samples:event'>jbp:CartEvent</qname>
+ </supported-processing-event>
+ </portlet>
+
+ <portlet>
+ <description>Portlet that manipulates its public render parameters</description>
+ <portlet-name>PublicParameterPortlet1</portlet-name>
+ <display-name>Public Parameter Portlet 1</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.basic.PublicParameterPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Public Parameter Portlet</title>
+ <keywords>sample,test</keywords>
+ </portlet-info>
+ <supported-public-render-parameter>foo</supported-public-render-parameter>
+ <supported-public-render-parameter>bar</supported-public-render-parameter>
+ </portlet>
+ <portlet>
+ <description>Portlet that manipulates its public render parameters</description>
+ <portlet-name>PublicParameterPortlet2</portlet-name>
+ <display-name>Public Parameter Portlet 2</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.basic.PublicParameterPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Public Parameter Portlet</title>
+ <keywords>sample,test</keywords>
+ </portlet-info>
+ <supported-public-render-parameter>foo</supported-public-render-parameter>
+ <supported-public-render-parameter>juu</supported-public-render-parameter>
+ </portlet>
+ <portlet>
+ <description>Portlet that manipulates its public render parameters</description>
+ <portlet-name>PublicParameterPortlet3</portlet-name>
+ <display-name>Public Parameter Portlet 3</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.basic.PublicParameterPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Public Parameter Portlet</title>
+ <keywords>sample,test</keywords>
+ </portlet-info>
+ <supported-public-render-parameter>bar</supported-public-render-parameter>
+ <supported-public-render-parameter>juu</supported-public-render-parameter>
+ </portlet>
+
+ <public-render-parameter>
+ <name>foo</name>
+ <identifier>foo</identifier>
+ </public-render-parameter>
+
+ <public-render-parameter>
+ <name>bar</name>
+ <identifier>bar</identifier>
+ </public-render-parameter>
+
+ <public-render-parameter>
+ <name>juu</name>
+ <identifier>juu</identifier>
+ </public-render-parameter>
+
+ <event-definition>
+ <qname xmlns:jbp='urn:jboss:portal:samples:event'>jbp:CartEvent</qname>
+ <value-type>org.jboss.portal.portlet.samples.shoppingcart.CartEvent</value-type>
+ </event-definition>
+
+</portlet-app>
+
Added: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/web.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/web.xml (rev 0)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/web.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <listener>
+ <listener-class>org.jboss.portal.common.mc.bootstrap.WebBootstrap</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>ContainerServlet</servlet-name>
+ <servlet-class>org.jboss.portal.web.impl.tomcat.TC6ContainerServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>ClassicPresentationServlet</servlet-name>
+ <servlet-class>org.jboss.portal.presentation.classic.ClassicPresentationServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ClassicPresentationServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
\ No newline at end of file
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java (from rev 10862, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,215 @@
+/******************************************************************************
+ * 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.portal;
+
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.portal.model.StructuralNode;
+import org.jboss.portal.presentation.portal.model.StructuralStateContextImpl;
+import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.model.PageNode;
+import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
+import org.jboss.portal.presentation.portal.content.portlet.protocol.PortletContainerAction;
+import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletControllerContext;
+import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletPageNavigationalState;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.protocol.ErrorResponse;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
+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.server.PresentationRequest;
+import org.jboss.portal.presentation.server.PresentationResponse;
+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.common.NotYetImplemented;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
+import org.jboss.portal.portlet.controller.request.ControllerRequest;
+import org.jboss.portal.portlet.controller.request.PortletActionRequest;
+import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
+import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
+import org.jboss.portal.portlet.controller.response.ControllerResponse;
+import org.jboss.portal.portlet.controller.PortletController;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationServerImpl implements PresentationServer
+{
+
+ /** . */
+ private StructuralStateContextImpl structuralStateContext;
+
+ /** . */
+ private PortletInvoker portletInvoker;
+
+ public PresentationServerImpl(StructuralStateContextImpl structuralStateContext, PortletInvoker portletInvoker)
+ {
+ this.structuralStateContext = structuralStateContext;
+ this.portletInvoker = portletInvoker;
+ }
+
+ public StructuralStateContext getStructuralStateContext()
+ {
+ return structuralStateContext;
+ }
+
+ public WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException
+ {
+ WindowNode windowNode = (WindowNode)structuralStateContext.getNode(windowId);
+
+ WindowNode.Content content = windowNode.getContent();
+
+ WindowContent windowContent = content.render(windowNode, client, portletInvoker);
+
+ return windowContent;
+ }
+
+ public PresentationResponse process(PresentationClient client, PresentationRequest request) throws PresentationServerException
+ {
+ ProtocolAction action = request.getProtocolAction();
+
+ if (action instanceof UIObjectAction)
+ {
+ UIObjectAction objectAction = (UIObjectAction)action;
+
+ //
+ String targetId = objectAction.getTargetId();
+
+ //
+ StructuralNode targetNode = structuralStateContext.getNode(targetId);
+
+ //
+ if (targetNode == null)
+ {
+ return new PresentationResponse(new ErrorResponse(404));
+ }
+
+ //
+ if (objectAction instanceof ViewUIObjectAction)
+ {
+ return new PresentationResponse(new ShowUIObjectResponse(targetId));
+ }
+ else if (objectAction instanceof LinkActivation)
+ {
+ throw new NotYetImplemented();
+ }
+ else if (objectAction instanceof ContentAction)
+ {
+ ContentAction contentAction = (ContentAction)objectAction;
+
+ //
+ WindowNode targetWindow = (WindowNode)targetNode;
+
+ //
+ PageNode page = (PageNode)targetWindow.getParent();
+
+ //
+ if (contentAction instanceof PortletContainerAction)
+ {
+ PortletContainerAction pcAction = (PortletContainerAction)contentAction;
+
+
+ //
+ PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
+ client,
+ page,
+ portletInvoker);
+
+ PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
+ portletControllerContext,
+ client.getNavigationalStateContext(),
+ PresentationPortletPageNavigationalState.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();
+
+ //
+ PresentationPortletPageNavigationalState blah = (PresentationPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
+
+ //
+ blah.flush();
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ return new PresentationResponse(new ShowUIObjectResponse(page.getId()));
+ }
+ }
+ }
+
+ //
+ throw new UnsupportedOperationException();
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.portal.content.markup;
+
+import org.jboss.portal.presentation.portal.model.WindowNode;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MarkupContent extends WindowNode.Content
+{
+
+ /** . */
+ private final String markup;
+
+ public MarkupContent(String markup)
+ {
+ this.markup = markup;
+ }
+
+ public String getMarkup()
+ {
+ return markup;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet (from rev 10862, modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet)
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * 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.portal.content.portlet;
+
+import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.model.PageNode;
+import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletControllerContext;
+import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletPageNavigationalState;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.portlet.controller.PortletController;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletContent extends WindowNode.Content
+{
+
+ /** . */
+ private final String ref;
+
+ public PortletContent(String ref)
+ {
+ this.ref = ref;
+ }
+
+ public String getRef()
+ {
+ return ref;
+ }
+
+ public WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException
+ {
+
+ try
+ {
+ NavigationalStateContext navigationalStateContext = client.getNavigationalStateContext();
+
+ //
+ PageNode page = (PageNode)window.getParent();
+
+ //
+ PortletController controller = new PortletController();
+
+ //
+ PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
+ client,
+ page,
+ portletInvoker);
+
+ //
+ PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
+ portletControllerContext,
+ client.getNavigationalStateContext(),
+ PresentationPortletPageNavigationalState.READ_ONLY_MODE);
+
+ PortletInvocationResponse response = controller.render(portletControllerContext, null, pageNavigationalState, window.getId());
+
+ //
+ 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 " + window.getId(), "");
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new PresentationServerException(e);
+ }
+ }
+}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletPresentationServer.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/PortletPresentationServer.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletPresentationServer.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet;
import org.jboss.portal.presentation.server.PresentationServer;
import org.jboss.portal.presentation.server.PresentationServerException;
@@ -33,9 +33,9 @@
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.model.UINode;
import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.portlet.protocol.PortletContainerAction;
-import org.jboss.portal.presentation.portlet.controller.PresentationPortletPageNavigationalState;
-import org.jboss.portal.presentation.portlet.controller.PresentationPortletControllerContext;
+import org.jboss.portal.presentation.portal.content.portlet.protocol.PortletContainerAction;
+import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletPageNavigationalState;
+import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletControllerContext;
import org.jboss.portal.presentation.impl.model.UINodeFactory;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
import org.jboss.portal.portlet.controller.request.PortletActionRequest;
@@ -76,6 +76,7 @@
public WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException
{
+/*
try
{
NavigationalStateContext navigationalStateContext = client.getNavigationalStateContext();
@@ -115,12 +116,16 @@
}
catch (PortletInvokerException e)
{
- throw new PresentationServerException(e);
+*/
+ throw new PresentationServerException();
+/*
}
+*/
}
public PresentationResponse process(PresentationClient client, PresentationRequest request) throws PresentationServerException
{
+/*
ProtocolAction action = request.getProtocolAction();
//
@@ -210,5 +215,7 @@
{
return next.process(client, request);
}
+*/
+ return null;
}
}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationEventControllerContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationEventControllerContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationEventControllerContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.controller;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.EventPhaseContext;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletControllerContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletControllerContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletControllerContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.controller;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -40,18 +40,18 @@
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.portal.content.portlet.spi.PresentationPortletInvocationContext;
+import org.jboss.portal.presentation.portal.content.portlet.spi.PresentationServerContext;
+import org.jboss.portal.presentation.portal.content.portlet.spi.PresentationWindowContext;
+import org.jboss.portal.presentation.portal.content.portlet.spi.PresentationInstanceContext;
+import org.jboss.portal.presentation.portal.content.portlet.spi.PresentationClientContext;
+import org.jboss.portal.presentation.portal.content.portlet.spi.PresentationPortalContext;
+import org.jboss.portal.presentation.portal.content.portlet.spi.PresentationSecurityContext;
+import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
+import org.jboss.portal.presentation.portal.model.PageNode;
+import org.jboss.portal.presentation.portal.model.StructuralNode;
+import org.jboss.portal.presentation.portal.model.WindowNode;
import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.model.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;
@@ -67,7 +67,7 @@
{
/** . */
- private final UINode pageNode;
+ private final PageNode page;
/** . */
private final PortletInvoker invoker;
@@ -79,7 +79,7 @@
private final Map<String, Portlet> portlets;
/** A map of window ids to windows. */
- private final Map<String, UINode> windows;
+ private final Map<String, WindowNode> windows;
/** . */
private final PresentationClient client;
@@ -89,31 +89,32 @@
public PresentationPortletControllerContext(
PresentationClient client,
- UINode pageNode,
+ PageNode page,
PortletInvoker invoker)
{
Map<String, Portlet> portlets = new HashMap<String, Portlet>();
- Map<String, UINode> windows = new HashMap<String, UINode>();
+ Map<String, WindowNode> windows = new HashMap<String, WindowNode>();
//
- for (UINode childNode : pageNode.getChildren())
+ for (StructuralNode child : page.getChildren())
{
- UIObject child = childNode.getObject();
-
- if (child instanceof UIWindow)
+ if (child instanceof WindowNode)
{
- String portletRef = child.getProperty(StateType.STRUCTURAL, "portlet-ref", String.class);
+ WindowNode.Content content = ((WindowNode)child).getContent();
//
- if (portletRef != null)
+ if (content instanceof PortletContent)
{
+ PortletContent portletContent = (PortletContent)content;
+
+ //
try
{
- Portlet portlet = invoker.getPortlet(PortletContext.createPortletContext(portletRef));
+ Portlet portlet = invoker.getPortlet(PortletContext.createPortletContext(portletContent.getRef()));
//
portlets.put(child.getId(), portlet);
- windows.put(child.getId(), childNode);
+ windows.put(child.getId(), (WindowNode)child);
}
catch (PortletInvokerException e)
{
@@ -125,7 +126,7 @@
//
this.client = client;
- this.pageNode = pageNode;
+ this.page = page;
this.invoker = invoker;
this.stateControllerContext = new PresentationStateControllerContext(this);
this.portlets = portlets;
@@ -135,7 +136,7 @@
public String getPageId()
{
- return pageNode.getObject().getId();
+ return page.getId();
}
public Set<String> getWindowIds()
@@ -178,7 +179,7 @@
PresentationPortletInvocationContext ctx = (PresentationPortletInvocationContext)portletInvocation.getContext();
//
- UINode window = windows.get(ctx.getWindowId());
+ WindowNode window = windows.get(ctx.getWindowId());
//
portletInvocation.setServerContext(new PresentationServerContext(client));
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationPortletPageNavigationalState.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.controller;
import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationStateControllerContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/controller/PresentationStateControllerContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationStateControllerContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.controller;
import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionDecoder.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionDecoder.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionDecoder.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * 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.portal.content.portlet.protocol;
+
+import org.jboss.portal.presentation.classic.protocol.ActionDecoder;
+import org.jboss.portal.presentation.classic.protocol.ActionDecoderContext;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.LifeCyclePhase;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.web.Body;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletActionDecoder implements ActionDecoder
+{
+
+ public ProtocolAction decode(ActionDecoderContext context)
+ {
+ ProtocolAction action = null;
+
+ //
+ if (context.getPath().startsWith("/portlet/"))
+ {
+ String targetId = context.getPath().substring("/portlet/".length());
+
+ //
+ String[] phaseParams = context.getQueryParameterMap().get("phase");
+ LifeCyclePhase phase = LifeCyclePhase.valueOf(phaseParams[0]);
+
+ //
+ String[] stateParams = context.getQueryParameterMap().get("state");
+ StateString state = stateParams != null ? ParametersStateString.create(stateParams[0]) : null;
+
+ //
+ String[] windowStateParams = context.getQueryParameterMap().get("ws");
+ WindowState windowState = windowStateParams != null ? WindowState.create(windowStateParams[0]) : null;
+
+ //
+ String[] modeParams = context.getQueryParameterMap().get("mode");
+ Mode mode = modeParams != null ? Mode.create(modeParams[0]) : null;
+
+ //
+ Map<String, String[]> form = null;
+ if (context.getBody() instanceof Body.Form)
+ {
+ form = ((Body.Form)context.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;
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionEncoder.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionEncoder.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionEncoder.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.portal.content.portlet.protocol;
+
+import org.jboss.portal.presentation.classic.protocol.ActionEncoder;
+import org.jboss.portal.presentation.classic.protocol.ActionEncoderContext;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletActionEncoder implements ActionEncoder
+{
+ public String encode(ProtocolAction action, ActionEncoderContext context)
+ {
+ 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()});
+ }
+
+ //
+ String ns = context.getNavigationalState();
+
+ //
+ if (ns != null)
+ {
+ parameters.put("ns", new String[]{ns});
+ }
+
+ //
+ parameters.put("phase", new String[]{pcAction.getPhase().toString()});
+
+ //
+ return context.renderURL("/portlet/" + pcAction.getTargetId(), parameters);
+ }
+
+ //
+ return null;
+ }
+}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletContainerAction.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/protocol/PortletContainerAction.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletContainerAction.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,9 +20,9 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.protocol;
-import org.jboss.portal.presentation.protocol.UIObjectCommandAction;
+import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
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 UIObjectCommandAction
+public class PortletContainerAction extends ContentAction
{
/** The portlet phase. */
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationClientContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationClientContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.spi;
import org.jboss.portal.common.util.MultiValuedPropertyMap;
import org.jboss.portal.common.util.SimpleMultiValuedPropertyMap;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationInstanceContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationInstanceContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,12 +20,12 @@
* 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;
+package org.jboss.portal.presentation.portal.content.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.UINode;
+import org.jboss.portal.presentation.portal.model.WindowNode;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -35,16 +35,16 @@
{
/** . */
- private final UINode window;
+ private final WindowNode window;
- public PresentationInstanceContext(UINode window)
+ public PresentationInstanceContext(WindowNode window)
{
this.window = window;
}
public String getId()
{
- return window.getObject().getId();
+ return window.getId();
}
public AccessMode getAccessMode()
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortalContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortalContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.spi;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortletInvocationContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortletInvocationContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortletInvocationContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,15 +20,15 @@
* 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;
+package org.jboss.portal.presentation.portal.content.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.PresentationPortletControllerContext;
+import org.jboss.portal.presentation.portal.content.portlet.protocol.PortletContainerAction;
+import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletControllerContext;
import org.jboss.portal.presentation.client.PresentationClient;
import java.io.Writer;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationSecurityContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationSecurityContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationSecurityContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.spi;
import org.jboss.portal.portlet.spi.SecurityContext;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationServerContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationServerContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.spi;
import org.jboss.portal.portlet.spi.ServerContext;
import org.jboss.portal.presentation.client.PresentationClient;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationWindowContext.java
===================================================================
--- modules/presentation/trunk/portlet/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java 2008-05-30 14:16:09 UTC (rev 10862)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationWindowContext.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -20,10 +20,10 @@
* 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;
+package org.jboss.portal.presentation.portal.content.portlet.spi;
import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.presentation.model.UINode;
+import org.jboss.portal.presentation.portal.model.WindowNode;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -33,15 +33,15 @@
{
/** . */
- private final UINode window;
+ private final WindowNode window;
- public PresentationWindowContext(UINode window)
+ public PresentationWindowContext(WindowNode window)
{
this.window = window;
}
public String getId()
{
- return window.getObject().getId();
+ return window.getId();
}
}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/protocol/ContentAction.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/protocol/ContentAction.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/protocol/ContentAction.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -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.portal.content.protocol;
+
+import org.jboss.portal.presentation.protocol.UIObjectCommandAction;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class ContentAction extends UIObjectCommandAction
+{
+ public ContentAction(String targetId)
+ throws IllegalArgumentException
+ {
+ super(targetId);
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ContextNode.java (from rev 10862, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/ContextNode.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ContextNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ContextNode.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIContext;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContextNode extends StructuralNode
+{
+ public ContextNode(String name, StructuralStateContextImpl structuralStateContext)
+ {
+ super(name, structuralStateContext);
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return UIContext.class;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java (from rev 10862, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/NodeImporter.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,256 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.xml.XMLTools;
+import org.jboss.portal.common.NotYetImplemented;
+import static org.jboss.portal.common.xml.XMLTools.*;
+import org.jboss.portal.presentation.model.layout.Constants;
+import org.jboss.portal.presentation.portal.content.markup.MarkupContent;
+import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NodeImporter
+{
+
+ /** . */
+ private final static Schema schema;
+
+ /** . */
+ private static final URL schemaURL;
+
+ static
+ {
+ try
+ {
+ schemaURL = NodeImporter.class.getClassLoader().getResource("org/jboss/portal/presentation/portal/page_structure_1_0.xsd");
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ schema = factory.newSchema(schemaURL);
+ }
+ catch (SAXException e)
+ {
+ throw new Error("Could not load the page structure 1.0 schema", e);
+ }
+
+ }
+
+ /** The root to import the children to. */
+ private final StructuralNode root;
+
+ public NodeImporter(StructuralNode root)
+ {
+ this.root = root;
+ }
+
+ /**
+ * Imports the specified document.
+ *
+ * @param document the document
+ * @throws IllegalArgumentException if the document is null
+ */
+ public void importDocument(Document document) throws IllegalArgumentException
+ {
+ if (document == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ importContextDef(document.getDocumentElement());
+ }
+
+ public void importDocument(InputStream in) throws IllegalArgumentException, ParserConfigurationException, IOException, SAXException
+ {
+ if (in == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ InputStream schemaStream = schemaURL.openStream();
+
+ try
+ {
+ DocumentBuilderFactory factory = XMLTools.getDocumentBuilderFactory();
+ factory.setValidating(true);
+ factory.setNamespaceAware(true);
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaStream);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(in);
+ importDocument(doc);
+ }
+ finally
+ {
+ IOTools.safeClose(schemaStream);
+ }
+ }
+
+ private void importContextDef(Element contextDefElt)
+ {
+ // Children pages
+ for (Element childElt : getChildren(contextDefElt, "page-def"))
+ {
+ importPageDef(root, childElt);
+ }
+ }
+
+ private PageNode importPageDef(StructuralNode parentNode, Element pageDefElt)
+ {
+ PageNode pageNode = createStructuralNode(parentNode, PageNode.class, pageDefElt);
+
+ // Sub pages
+ for (Element childElt : getChildren(pageDefElt, "page-def"))
+ {
+ importPageDef(pageNode, childElt);
+ }
+
+ //
+ Element layoutElt = getUniqueChild(pageDefElt, "simple-layout", false);
+
+ //
+ if (layoutElt != null)
+ {
+ importLayout(pageNode, layoutElt);
+ }
+
+ //
+ return pageNode;
+ }
+
+ private void importLayout(StructuralNode paneNode, Element layoutElt)
+ {
+ if ("simple-layout".equals(layoutElt.getNodeName()))
+ {
+ paneNode.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
+ paneNode.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION, Constants.VERTICAL_ORIENTATION);
+
+ //
+ int index = 0;
+ for (Element childElt : getChildren(layoutElt, "window-def"))
+ {
+ WindowNode windowNode = importWindowDef(paneNode, childElt);
+
+ //
+ windowNode.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ private WindowNode importWindowDef(StructuralNode parentNode, Element windowDefElt)
+ {
+ WindowNode windowNode = createStructuralNode(parentNode, WindowNode.class, windowDefElt);
+
+ //
+ WindowNode.Content content = null;
+ Element markupElt = getUniqueChild(windowDefElt, "markup", false);
+ if (markupElt != null)
+ {
+ String markup = asString(markupElt);
+ content = new MarkupContent(markup);
+ }
+ else
+ {
+ Element portletElt = getUniqueChild(windowDefElt, "portlet", false);
+ if (portletElt != null)
+ {
+ String portletRef = portletElt.getAttribute("ref");
+ content = new PortletContent(portletRef);
+ }
+ }
+
+ //
+ windowNode.setContent(content);
+
+ //
+ return windowNode;
+ }
+
+ private <T extends StructuralNode> T createStructuralNode(StructuralNode parent, Class<T> type, Element nodeDefElt)
+ {
+ String nodeName = nodeDefElt.getAttribute("name");
+
+ //
+ T node = parent.addChild(nodeName, type);
+
+ //
+ Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt, "properties", false);
+
+ //
+ if (propertiesElt != null)
+ {
+ for (Element propertyElt : XMLTools.getChildren(propertiesElt, "property"))
+ {
+ Element nameElt = XMLTools.getUniqueChild(propertyElt, "name", true);
+ String propertyName = XMLTools.asString(nameElt);
+
+ //
+ Element valueElt = XMLTools.getUniqueChild(propertyElt, "value", true);
+ String litteralPropertyValue = XMLTools.asString(valueElt);
+
+ Serializable propertyValue;
+ String propertyType = valueElt.getAttribute("type");
+ if (propertyType == null || "string".equals(propertyType))
+ {
+ propertyValue = litteralPropertyValue;
+ }
+ else if ("int".equals(propertyType))
+ {
+ propertyValue = Integer.parseInt(litteralPropertyValue);
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ //
+ node.setProperty(propertyName, propertyValue);
+ }
+ }
+
+ //
+ return node;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java (from rev 10862, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/PageNode.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIPage;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageNode extends StructuralNode
+{
+ public PageNode(String name, StructuralStateContextImpl structuralStateContext)
+ {
+ super(name, structuralStateContext);
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return UIPage.class;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralNode.java (from rev 10862, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralNode.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralNode.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,353 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.state.StaleStateException;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class StructuralNode
+{
+
+ /** . */
+ private final Set<String> EMPTY_STRING_SET = Collections.emptySet();
+
+ /** . */
+ private StructuralNode parent;
+
+ /** . */
+ private final Map<String, StructuralNode> children = new HashMap<String, StructuralNode>();
+
+ /** . */
+ private final StructuralStateContextImpl structuralStateContext;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private boolean valid;
+
+ /** . */
+ private final Map<String, Serializable> properties;
+
+ protected StructuralNode(String name, StructuralStateContextImpl structuralStateContext)
+ {
+ this.name = name;
+ this.id = structuralStateContext.nextId();
+ this.structuralStateContext = structuralStateContext;
+ this.properties = new HashMap<String, Serializable>();
+ this.valid = true;
+ }
+
+ public abstract Class<? extends UIObject> getType();
+
+ Collection<StructuralObject> takeChildrenSnapshot(StructuralObject structuralObject)
+ {
+ synchronized (this)
+ {
+ if (!takeSnapshot().equals(structuralObject))
+ {
+ throw new StaleStateException();
+ }
+
+ //
+ Set<StructuralObject> structuralChildren = new HashSet<StructuralObject>();
+ for (StructuralNode child : children.values())
+ {
+ structuralChildren.add(child.takeSnapshot());
+ }
+
+ //
+ return structuralChildren;
+ }
+ }
+
+ StructuralObject takeParentSnapshot(StructuralObject structuralObject)
+ {
+ synchronized (this)
+ {
+ if (!takeSnapshot().equals(structuralObject))
+ {
+ throw new StaleStateException();
+ }
+
+ //
+ return parent != null ? parent.takeSnapshot() : null;
+ }
+ }
+
+ StructuralObject takeSnapshot()
+ {
+ synchronized (this)
+ {
+ StructuralStateImpl state = new StructuralStateImpl(
+ getType(),
+ name,
+ Collections.unmodifiableMap(new HashMap<String, Serializable>(properties)));
+
+ //
+ Set<String> childrenIds = new HashSet<String>();
+ for (StructuralNode child : children.values())
+ {
+ childrenIds.add(child.id);
+ }
+
+ //
+ String parentId = parent != null ? parent.id : null;
+
+ //
+ return new StructuralObjectImpl(id, parentId, Collections.unmodifiableSet(childrenIds), state);
+ }
+ }
+
+ StructuralObject.Refresh refresh(StructuralObjectImpl structuralObject)
+ {
+ synchronized (this)
+ {
+ Map<String, StructuralNode> childrenMap = new HashMap<String, StructuralNode>();
+ for (StructuralNode child : children.values())
+ {
+ childrenMap.put(child.getId(), child);
+ }
+
+ //
+ Map<String, StructuralNode> addedChildrenMap = new HashMap<String, StructuralNode>(childrenMap);
+ addedChildrenMap.keySet().removeAll(structuralObject.getChildrenIds());
+
+ //
+ Map<String, StructuralNode> staleChildren = new HashMap<String, StructuralNode>(childrenMap);
+ staleChildren.keySet().retainAll(structuralObject.getChildrenIds());
+
+ //
+ Set<String> removedChildrenIds = new HashSet<String>(structuralObject.getChildrenIds());
+ removedChildrenIds.removeAll(staleChildren.keySet());
+
+ //
+ Set<StructuralObject> addedStructuralChildren = new HashSet<StructuralObject>();
+ for (StructuralNode addedChild : addedChildrenMap.values())
+ {
+ addedStructuralChildren.add(addedChild.takeSnapshot());
+ }
+
+ //
+ Map<String, StructuralObject> staleStructuralChildren = new HashMap<String, StructuralObject>();
+ for (StructuralNode stateChild : staleChildren.values())
+ {
+ staleStructuralChildren.put(stateChild.getId(), stateChild.takeSnapshot());
+ }
+
+ //
+ return new StructuralObject.Refresh(
+ parent != null ? parent.takeSnapshot() : null,
+ takeSnapshot(),
+ addedStructuralChildren,
+ removedChildrenIds,
+ staleStructuralChildren,
+ EMPTY_STRING_SET);
+ }
+ }
+
+ public boolean isValid()
+ {
+ return valid;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public StructuralNode getParent()
+ {
+ return parent;
+ }
+
+ public Set<String> getPropertyNames()
+ {
+ return Collections.unmodifiableSet(properties.keySet());
+ }
+
+ public Serializable getProperty(String propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name");
+ }
+
+ //
+ synchronized (this)
+ {
+ return properties.get(propertyName);
+ }
+ }
+
+ public void setProperty(String propertyName, Serializable propertyValue)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name");
+ }
+
+ //
+ synchronized (this)
+ {
+ if (propertyValue != null)
+ {
+ properties.put(propertyName, propertyValue);
+ }
+ else
+ {
+ properties.remove(propertyName);
+ }
+ }
+ }
+
+ public Collection<? extends StructuralNode> getChildren()
+ {
+ return Collections.unmodifiableCollection(children.values());
+ }
+
+ public <T extends StructuralNode> T addChild(String name, Class<T> type)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (type == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ T child;
+ try
+ {
+ Constructor<T> ctor = type.getConstructor(String.class, StructuralStateContextImpl.class);
+ child = ctor.newInstance(name, structuralStateContext);
+ }
+ catch (InstantiationException e)
+ {
+ throw new AssertionError(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new AssertionError(e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new AssertionError(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new AssertionError(e);
+ }
+
+ //
+ synchronized (this)
+ {
+ if (children.containsKey(name))
+ {
+ throw new IllegalArgumentException("Child already exist");
+ }
+ children.put(name, child);
+ child.parent = this;
+ }
+
+ //
+ structuralStateContext.nodes.put(child.id, child);
+
+ //
+ return child;
+ }
+
+ public void destroyChild(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ StructuralNode child;
+ synchronized (this)
+ {
+ if (!children.containsKey(name))
+ {
+ throw new IllegalArgumentException("No such child " + name);
+ }
+
+ child = children.get(name);
+
+ //
+ for (String blah : new ArrayList<String>(child.children.keySet()))
+ {
+ child.destroyChild(blah);
+ }
+
+ //
+ children.remove(name);
+ structuralStateContext.nodes.remove(child.id);
+
+ //
+ child.valid = false;
+ child.parent = null;
+ }
+ }
+
+ public StructuralNode getChild(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ synchronized (this)
+ {
+ return children.get(name);
+ }
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralObjectImpl.java (from rev 10862, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralObjectImpl.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralObjectImpl.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralObjectImpl.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,121 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.state.structural.StructuralState;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralObjectImpl implements StructuralObject
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final StructuralStateImpl state;
+
+ /** . */
+ private final String parentId;
+
+ /** . */
+ private final Set<String> childrenIds;
+
+ public StructuralObjectImpl(
+ String id,
+ String parentId,
+ Set<String> childrenIds,
+ StructuralStateImpl state)
+ {
+ this.id = id;
+ this.parentId = parentId;
+ this.childrenIds = childrenIds;
+ this.state = state;
+ }
+
+ String getParentId()
+ {
+ return parentId;
+ }
+
+ Set<String> getChildrenIds()
+ {
+ return childrenIds;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public StructuralState getState()
+ {
+ return state;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof StructuralObjectImpl)
+ {
+ StructuralObjectImpl that = (StructuralObjectImpl)obj;
+
+ //
+ if (!that.id.equals(this.id))
+ {
+ return false;
+ }
+
+ //
+ if (!that.state.equals(this.state))
+ {
+ return false;
+ }
+
+ //
+ if (that.parentId == null)
+ {
+ if (this.parentId != null)
+ {
+ return false;
+ }
+ }
+ else if (!that.parentId.equals(this.parentId))
+ {
+ return false;
+ }
+
+ //
+ return that.childrenIds.equals(this.childrenIds);
+ }
+ return false;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralStateContextImpl.java (from rev 10862, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateContextImpl.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralStateContextImpl.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralStateContextImpl.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,202 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.state.NoSuchStateException;
+import org.jboss.portal.presentation.state.StaleStateException;
+import org.jboss.portal.presentation.state.StateException;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.state.structural.StructuralStateContext;
+
+import java.util.Collection;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralStateContextImpl implements StructuralStateContext
+{
+
+ /** . */
+ private final AtomicLong sequence = new AtomicLong();
+
+ /** . */
+ final ConcurrentMap<String, StructuralNode> nodes = new ConcurrentHashMap<String, StructuralNode>();
+
+ /** . */
+ private final ContextNode root = new ContextNode("", this);
+
+ public StructuralStateContextImpl()
+ {
+ nodes.put(root.getId(), root);
+ }
+
+ String nextId()
+ {
+ return Long.toString(sequence.getAndIncrement());
+ }
+
+ public StructuralNode getNode(String nodeId)
+ {
+ if (nodeId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ return nodes.get(nodeId);
+ }
+
+ public ContextNode getRoot()
+ {
+ return root;
+ }
+
+ public void destroy(String objectId)
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ StructuralNode node = nodes.get(objectId);
+
+ //
+ StructuralNode parent = node.getParent();
+
+ //
+ if (parent == null)
+ {
+ throw new IllegalArgumentException("Cannot destroy root");
+ }
+
+ //
+ parent.destroyChild(node.getName());
+ }
+
+ public StructuralObject load(String objectId) throws IllegalArgumentException
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ StructuralNode node = nodes.get(objectId);
+
+ //
+ return node != null ? node.takeSnapshot() : null;
+ }
+
+ public Collection<StructuralObject> loadChildren(StructuralObject structuralParent) throws IllegalArgumentException, StateException
+ {
+ if (structuralParent == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ StructuralNode parentNode = nodes.get(structuralParent.getId());
+
+ //
+ if (parentNode == null)
+ {
+ throw new NoSuchStateException();
+ }
+
+ //
+ return parentNode.takeChildrenSnapshot(structuralParent);
+ }
+
+ public StructuralObject loadParent(StructuralObject structuralChild) throws IllegalArgumentException, StateException
+ {
+ if (structuralChild == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ StructuralNode childNode = nodes.get(structuralChild.getId());
+
+ //
+ if (childNode == null)
+ {
+ throw new NoSuchStateException();
+ }
+
+ //
+ return childNode.takeParentSnapshot(structuralChild);
+ }
+
+ public String getRootId()
+ {
+ return root.getId();
+ }
+
+ public void validate(StructuralObject structuralObject) throws IllegalArgumentException, StateException
+ {
+ if (structuralObject == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ StructuralNode structuralNode = nodes.get(structuralObject.getId());
+
+ //
+ if (structuralNode == null)
+ {
+ throw new NoSuchStateException();
+ }
+
+ //
+ if (!structuralNode.takeSnapshot().equals(structuralObject))
+ {
+ throw new StaleStateException();
+ }
+ }
+
+ public StructuralObject.Refresh refresh(StructuralObject structuralObject) throws IllegalArgumentException, StateException
+ {
+ if (structuralObject == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ StructuralNode structuralNode = nodes.get(structuralObject.getId());
+
+ //
+ if (structuralNode == null)
+ {
+ throw new NoSuchStateException();
+ }
+
+ //
+ return structuralNode.refresh((StructuralObjectImpl)structuralObject);
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralStateImpl.java (from rev 10862, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateImpl.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralStateImpl.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/StructuralStateImpl.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.state.structural.StructuralState;
+
+import java.util.Map;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralStateImpl implements StructuralState
+{
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, Serializable> properties;
+
+ public StructuralStateImpl(
+ Class<? extends UIObject> type,
+ String name,
+ Map<String, Serializable> properties)
+ {
+ this.type = type;
+ this.name = name;
+ this.properties = properties;
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<String, Serializable> getProperties()
+ {
+ return properties;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof StructuralStateImpl)
+ {
+ StructuralStateImpl that = (StructuralStateImpl)obj;
+
+ //
+ if (!that.type.equals(this.type))
+ {
+ return false;
+ }
+
+ //
+ if (!that.name.equals(this.name))
+ {
+ return false;
+ }
+
+ //
+ return that.properties.equals(this.properties);
+ }
+ return false;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java (from rev 10862, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/WindowNode.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.portlet.PortletInvoker;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class WindowNode extends StructuralNode
+{
+
+ /** . */
+ private Content content;
+
+ public WindowNode(String name, StructuralStateContextImpl structuralStateContext)
+ {
+ super(name, structuralStateContext);
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return UIWindow.class;
+ }
+
+ public void setContent(Content content)
+ {
+ this.content = content;
+ }
+
+ public Content getContent()
+ {
+ return content;
+ }
+
+ public static abstract class Content
+ {
+ public WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException
+ {
+ return new WindowContent(0, "blah", "markup");
+ }
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * 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.portal.servlet;
+
+import org.jboss.portal.presentation.portal.model.StructuralStateContextImpl;
+import org.jboss.portal.presentation.portal.model.NodeImporter;
+import org.jboss.portal.presentation.portal.model.ContextNode;
+import org.jboss.portal.common.io.IOTools;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralStateContextImporter
+{
+
+ /** . */
+ private ServletContext servletContext;
+
+ /** . */
+ private StructuralStateContextImpl structuralStateContext;
+
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ public void setServletContext(ServletContext servletContext)
+ {
+ this.servletContext = servletContext;
+ }
+
+ public StructuralStateContextImpl getStructuralStateContext()
+ {
+ return structuralStateContext;
+ }
+
+ public void setStructuralStateContext(StructuralStateContextImpl structuralStateContext)
+ {
+ this.structuralStateContext = structuralStateContext;
+ }
+
+ public void start() throws Exception
+ {
+ InputStream in = servletContext.getResourceAsStream("/WEB-INF/page-structure.xml");
+
+ //
+ try
+ {
+ ContextNode root = structuralStateContext.getRoot();
+ new NodeImporter(root).importDocument(in);
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ }
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd (from rev 10862, modules/presentation/trunk/presentation/src/main/resources/org/jboss/portal/presentation/impl/state/structural/page_structure_1_0.xsd)
===================================================================
--- modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd (rev 0)
+++ modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema
+ targetNamespace="urn:jboss:portal:presentation:page:1.0"
+ xmlns="urn:jboss:portal:presentation:page:1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0">
+
+ <xsd:element name="context-def" type="contextDefType">
+ </xsd:element>
+
+ <xsd:complexType name="nodeDefType">
+ <xsd:sequence>
+ <xsd:element name="properties" type="nodePropertiesType" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="namedNodeDefType">
+ <xsd:complexContent>
+ <xsd:extension base="nodeDefType">
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="nodePropertiesType">
+ <xsd:sequence>
+ <xsd:element name="property" type="nodePropertyType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="nodePropertyType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="value" type="propertyValueType" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="propertyValueType">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="type" use="optional" default="string">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="string"/>
+ <xsd:enumeration value="int"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="contextDefType">
+ <xsd:complexContent>
+ <xsd:extension base="nodeDefType">
+ <xsd:sequence>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="page-def" type="pageDefType"/>
+ </xsd:choice>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="pageDefType">
+ <xsd:complexContent>
+ <xsd:extension base="namedNodeDefType">
+ <xsd:sequence>
+ <xsd:choice minOccurs="1" maxOccurs="1">
+ <xsd:element name="simple-layout" type="simpleLayoutType"/>
+ <xsd:element name="region-layout" type="regionLayoutType"/>
+ </xsd:choice>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="page-def" type="pageDefType"/>
+ </xsd:choice>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="windowDefType">
+ <xsd:complexContent>
+ <xsd:extension base="namedNodeDefType">
+ <xsd:choice minOccurs="1" maxOccurs="1">
+ <xsd:element name="markup" type="markupContentType"/>
+ <xsd:element name="portlet" type="portletContentType"/>
+ </xsd:choice>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="markupContentType" >
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:complexType name="portletContentType">
+ <xsd:attribute name="ref" use="required" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="simpleLayoutType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="window-def" type="windowDefType"/>
+ </xsd:choice>
+ <xsd:attribute name="orientation" use="optional" default="vertical">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="vertical"/>
+ <xsd:enumeration value="horizontal"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+
+ <xsd:complexType name="regionLayoutType">
+ <xsd:sequence>
+ <xsd:element name="region" type="regionType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="regionType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="window-def" type="windowDefType"/>
+ </xsd:choice>
+ <xsd:attribute name="orientation" use="required" type="xsd:string"/>
+ </xsd:complexType>
+
+</xsd:schema>
Copied: modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java (from rev 10862, modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/structural/StructuralStateContextTestCase.java)
===================================================================
--- modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java (rev 0)
+++ modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -0,0 +1,137 @@
+/******************************************************************************
+ * 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.portal.model;
+
+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;
+import org.jboss.portal.presentation.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.test.model.AbstractModelTestCase;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralStateContextTestCase extends AbstractModelTestCase<StructuralNode>
+{
+
+ /** . */
+ private StructuralStateContextImpl structuralStateContext;
+
+ protected StructuralStateContext getStructuralStateContext()
+ {
+ return structuralStateContext;
+ }
+
+ protected StructuralNode getRoot()
+ {
+ return structuralStateContext.getRoot();
+ }
+
+ protected Set<String> getPropertyNames(StructuralNode structuralNode)
+ {
+ return structuralNode.getPropertyNames();
+ }
+
+ protected StructuralNode getParent(StructuralNode structuralNode)
+ {
+ return structuralNode.getParent();
+ }
+
+ protected List<? extends StructuralNode> getChildren(StructuralNode structuralNode)
+ {
+ return new ArrayList<StructuralNode>(structuralNode.getChildren());
+ }
+
+ protected String getName(StructuralNode structuralNode)
+ {
+ return structuralNode.getName();
+ }
+
+ protected boolean isValid(StructuralNode structuralNode)
+ {
+ return structuralNode.isValid();
+ }
+
+ protected Class<? extends UIObject> getType(StructuralNode structuralNode)
+ {
+ return structuralNode.getType();
+ }
+
+ protected String getId(StructuralNode structuralNode)
+ {
+ return structuralNode.getId();
+ }
+
+ protected StructuralNode addChild(StructuralNode structuralNode, String name, Class<? extends UIObject> modelType)
+ {
+ Class<? extends StructuralNode> structuralNodeType;
+
+ //
+ if (modelType == UIContext.class)
+ {
+ structuralNodeType = ContextNode.class;
+ }
+ else if (modelType == UIPage.class)
+ {
+ structuralNodeType = PageNode.class;
+ }
+ else if (modelType == UIWindow.class)
+ {
+ structuralNodeType = WindowNode.class;
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ //
+ return structuralNode.addChild(name, structuralNodeType);
+ }
+
+ protected void setProperty(StructuralNode structuralNode, String propertyName, String propertyValue)
+ {
+ structuralNode.setProperty(propertyName, propertyValue);
+ }
+
+ protected Serializable getProperty(StructuralNode structuralNode, String name)
+ {
+ return structuralNode.getProperty(name);
+ }
+
+ protected void destroy(StructuralNode structuralNode)
+ {
+ structuralStateContext.destroy(structuralNode.getId());
+ }
+
+ protected void setUp() throws Exception
+ {
+ structuralStateContext = new StructuralStateContextImpl();
+ }
+}
Modified: modules/presentation/trunk/presentation/pom.xml
===================================================================
--- modules/presentation/trunk/presentation/pom.xml 2008-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/pom.xml 2008-06-01 15:09:24 UTC (rev 10887)
@@ -50,6 +50,25 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <includes>
+ <include>org/**</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
</project>
Deleted: 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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,101 +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;
-
-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.model.content.WindowContent;
-import org.jboss.portal.presentation.protocol.ErrorResponse;
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
-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.server.PresentationRequest;
-import org.jboss.portal.presentation.server.PresentationResponse;
-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.common.NotYetImplemented;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationServerImpl implements PresentationServer
-{
-
- /** . */
- private StructuralStateContextImpl structuralStateContext;
-
- public PresentationServerImpl(StructuralStateContextImpl structuralStateContext)
- {
- this.structuralStateContext = structuralStateContext;
- }
-
- public StructuralStateContext getStructuralStateContext()
- {
- return structuralStateContext;
- }
-
- public WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException
- {
- throw new PresentationServerException();
- }
-
- public PresentationResponse process(PresentationClient client, PresentationRequest request) throws PresentationServerException
- {
- ProtocolAction action = request.getProtocolAction();
-
- if (action instanceof UIObjectAction)
- {
- UIObjectAction objectAction = (UIObjectAction)action;
-
- //
- String targetId = objectAction.getTargetId();
-
- //
- StructuralNode targetNode = structuralStateContext.getNode(targetId);
-
- //
- if (targetNode == null)
- {
- return new PresentationResponse(new ErrorResponse(404));
- }
-
- //
- if (objectAction instanceof ViewUIObjectAction)
- {
- return new PresentationResponse(new ShowUIObjectResponse(targetId));
- }
- else if (objectAction instanceof LinkActivation)
- {
- throw new NotYetImplemented();
- }
- }
-
- //
- throw new UnsupportedOperationException();
- }
-}
Deleted: 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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/ContextNode.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,43 +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.state.structural;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIContext;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ContextNode extends StructuralNode
-{
- public ContextNode(String name, StructuralStateContextImpl structuralStateContext)
- {
- super(name, structuralStateContext);
- }
-
- public Class<? extends UIObject> getType()
- {
- return UIContext.class;
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/NodeImporter.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/NodeImporter.java 2008-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/NodeImporter.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,240 +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.state.structural;
-
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.common.xml.XMLTools;
-import org.jboss.portal.common.NotYetImplemented;
-import static org.jboss.portal.common.xml.XMLTools.*;
-import org.jboss.portal.presentation.model.layout.Constants;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.URL;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class NodeImporter
-{
-
- /** . */
- private final static Schema schema;
-
- /** . */
- private static final URL schemaURL;
-
- static
- {
- try
- {
- schemaURL = NodeImporter.class.getResource("page_structure_1_0.xsd");
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- schema = factory.newSchema(schemaURL);
- }
- catch (SAXException e)
- {
- throw new Error("Could not load the page structure 1.0 schema", e);
- }
-
- }
-
- /** The root to import the children to. */
- private final StructuralNode root;
-
- public NodeImporter(StructuralNode root)
- {
- this.root = root;
- }
-
- /**
- * Imports the specified document.
- *
- * @param document the document
- * @throws IllegalArgumentException if the document is null
- */
- public void importDocument(Document document) throws IllegalArgumentException
- {
- if (document == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- importContextDef(document.getDocumentElement());
- }
-
- public void importDocument(InputStream in) throws IllegalArgumentException, ParserConfigurationException, IOException, SAXException
- {
- if (in == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- InputStream schemaStream = schemaURL.openStream();
-
- try
- {
- DocumentBuilderFactory factory = XMLTools.getDocumentBuilderFactory();
- factory.setValidating(true);
- factory.setNamespaceAware(true);
- factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaStream);
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(in);
- importDocument(doc);
- }
- finally
- {
- IOTools.safeClose(schemaStream);
- }
- }
-
- private void importContextDef(Element contextDefElt)
- {
- // Children pages
- for (Element childElt : getChildren(contextDefElt, "page-def"))
- {
- importPageDef(root, childElt);
- }
- }
-
- private PageNode importPageDef(StructuralNode parentNode, Element pageDefElt)
- {
- PageNode pageNode = createStructuralNode(parentNode, PageNode.class, pageDefElt);
-
- // Sub pages
- for (Element childElt : getChildren(pageDefElt, "page-def"))
- {
- importPageDef(pageNode, childElt);
- }
-
- //
- Element layoutElt = getUniqueChild(pageDefElt, "simple-layout", false);
-
- //
- if (layoutElt != null)
- {
- importLayout(pageNode, layoutElt);
- }
-
- //
- return pageNode;
- }
-
- private void importLayout(StructuralNode paneNode, Element layoutElt)
- {
- if ("simple-layout".equals(layoutElt.getNodeName()))
- {
- paneNode.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
- paneNode.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION, Constants.VERTICAL_ORIENTATION);
-
- //
- int index = 0;
- for (Element childElt : getChildren(layoutElt, "window-def"))
- {
- WindowNode windowNode = importWindowDef(paneNode, childElt);
-
- //
- windowNode.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
- }
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- private WindowNode importWindowDef(StructuralNode parentNode, Element windowDefElt)
- {
- WindowNode windowNode = createStructuralNode(parentNode, WindowNode.class, windowDefElt);
-
- //
- Element contentElt = getUniqueChild(windowDefElt, "content", true);
-
- //
- String content = asString(contentElt);
- windowNode.setContent(content);
-
- //
- return windowNode;
- }
-
- private <T extends StructuralNode> T createStructuralNode(StructuralNode parent, Class<T> type, Element nodeDefElt)
- {
- String nodeName = nodeDefElt.getAttribute("name");
-
- //
- T node = parent.addChild(nodeName, type);
-
- //
- Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt, "properties", false);
-
- //
- if (propertiesElt != null)
- {
- for (Element propertyElt : XMLTools.getChildren(propertiesElt, "property"))
- {
- Element nameElt = XMLTools.getUniqueChild(propertyElt, "name", true);
- String propertyName = XMLTools.asString(nameElt);
-
- //
- Element valueElt = XMLTools.getUniqueChild(propertyElt, "value", true);
- String litteralPropertyValue = XMLTools.asString(valueElt);
-
- Serializable propertyValue;
- String propertyType = valueElt.getAttribute("type");
- if (propertyType == null || "string".equals(propertyType))
- {
- propertyValue = litteralPropertyValue;
- }
- else if ("int".equals(propertyType))
- {
- propertyValue = Integer.parseInt(litteralPropertyValue);
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- node.setProperty(propertyName, propertyValue);
- }
- }
-
- //
- return node;
- }
-}
Deleted: 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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/PageNode.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,43 +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.state.structural;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIPage;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PageNode extends StructuralNode
-{
- public PageNode(String name, StructuralStateContextImpl structuralStateContext)
- {
- super(name, structuralStateContext);
- }
-
- public Class<? extends UIObject> getType()
- {
- return UIPage.class;
- }
-}
Deleted: 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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralNode.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,353 +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.state.structural;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.state.StaleStateException;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public abstract class StructuralNode
-{
-
- /** . */
- private final Set<String> EMPTY_STRING_SET = Collections.emptySet();
-
- /** . */
- private StructuralNode parent;
-
- /** . */
- private final Map<String, StructuralNode> children = new HashMap<String, StructuralNode>();
-
- /** . */
- private final StructuralStateContextImpl structuralStateContext;
-
- /** . */
- private final String id;
-
- /** . */
- private final String name;
-
- /** . */
- private boolean valid;
-
- /** . */
- private final Map<String, Serializable> properties;
-
- protected StructuralNode(String name, StructuralStateContextImpl structuralStateContext)
- {
- this.name = name;
- this.id = structuralStateContext.nextId();
- this.structuralStateContext = structuralStateContext;
- this.properties = new HashMap<String, Serializable>();
- this.valid = true;
- }
-
- public abstract Class<? extends UIObject> getType();
-
- Collection<StructuralObject> takeChildrenSnapshot(StructuralObject structuralObject)
- {
- synchronized (this)
- {
- if (!takeSnapshot().equals(structuralObject))
- {
- throw new StaleStateException();
- }
-
- //
- Set<StructuralObject> structuralChildren = new HashSet<StructuralObject>();
- for (StructuralNode child : children.values())
- {
- structuralChildren.add(child.takeSnapshot());
- }
-
- //
- return structuralChildren;
- }
- }
-
- StructuralObject takeParentSnapshot(StructuralObject structuralObject)
- {
- synchronized (this)
- {
- if (!takeSnapshot().equals(structuralObject))
- {
- throw new StaleStateException();
- }
-
- //
- return parent != null ? parent.takeSnapshot() : null;
- }
- }
-
- StructuralObject takeSnapshot()
- {
- synchronized (this)
- {
- StructuralStateImpl state = new StructuralStateImpl(
- getType(),
- name,
- Collections.unmodifiableMap(new HashMap<String, Serializable>(properties)));
-
- //
- Set<String> childrenIds = new HashSet<String>();
- for (StructuralNode child : children.values())
- {
- childrenIds.add(child.id);
- }
-
- //
- String parentId = parent != null ? parent.id : null;
-
- //
- return new StructuralObjectImpl(id, parentId, Collections.unmodifiableSet(childrenIds), state);
- }
- }
-
- StructuralObject.Refresh refresh(StructuralObjectImpl structuralObject)
- {
- synchronized (this)
- {
- Map<String, StructuralNode> childrenMap = new HashMap<String, StructuralNode>();
- for (StructuralNode child : children.values())
- {
- childrenMap.put(child.getId(), child);
- }
-
- //
- Map<String, StructuralNode> addedChildrenMap = new HashMap<String, StructuralNode>(childrenMap);
- addedChildrenMap.keySet().removeAll(structuralObject.getChildrenIds());
-
- //
- Map<String, StructuralNode> staleChildren = new HashMap<String, StructuralNode>(childrenMap);
- staleChildren.keySet().retainAll(structuralObject.getChildrenIds());
-
- //
- Set<String> removedChildrenIds = new HashSet<String>(structuralObject.getChildrenIds());
- removedChildrenIds.removeAll(staleChildren.keySet());
-
- //
- Set<StructuralObject> addedStructuralChildren = new HashSet<StructuralObject>();
- for (StructuralNode addedChild : addedChildrenMap.values())
- {
- addedStructuralChildren.add(addedChild.takeSnapshot());
- }
-
- //
- Map<String, StructuralObject> staleStructuralChildren = new HashMap<String, StructuralObject>();
- for (StructuralNode stateChild : staleChildren.values())
- {
- staleStructuralChildren.put(stateChild.getId(), stateChild.takeSnapshot());
- }
-
- //
- return new StructuralObject.Refresh(
- parent != null ? parent.takeSnapshot() : null,
- takeSnapshot(),
- addedStructuralChildren,
- removedChildrenIds,
- staleStructuralChildren,
- EMPTY_STRING_SET);
- }
- }
-
- public boolean isValid()
- {
- return valid;
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public StructuralNode getParent()
- {
- return parent;
- }
-
- public Set<String> getPropertyNames()
- {
- return Collections.unmodifiableSet(properties.keySet());
- }
-
- public Serializable getProperty(String propertyName)
- {
- if (propertyName == null)
- {
- throw new IllegalArgumentException("No null property name");
- }
-
- //
- synchronized (this)
- {
- return properties.get(propertyName);
- }
- }
-
- public void setProperty(String propertyName, Serializable propertyValue)
- {
- if (propertyName == null)
- {
- throw new IllegalArgumentException("No null property name");
- }
-
- //
- synchronized (this)
- {
- if (propertyValue != null)
- {
- properties.put(propertyName, propertyValue);
- }
- else
- {
- properties.remove(propertyName);
- }
- }
- }
-
- public Collection<? extends StructuralNode> getChildren()
- {
- return Collections.unmodifiableCollection(children.values());
- }
-
- public <T extends StructuralNode> T addChild(String name, Class<T> type)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
- if (type == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- T child;
- try
- {
- Constructor<T> ctor = type.getConstructor(String.class, StructuralStateContextImpl.class);
- child = ctor.newInstance(name, structuralStateContext);
- }
- catch (InstantiationException e)
- {
- throw new AssertionError(e);
- }
- catch (IllegalAccessException e)
- {
- throw new AssertionError(e);
- }
- catch (NoSuchMethodException e)
- {
- throw new AssertionError(e);
- }
- catch (InvocationTargetException e)
- {
- throw new AssertionError(e);
- }
-
- //
- synchronized (this)
- {
- if (children.containsKey(name))
- {
- throw new IllegalArgumentException("Child already exist");
- }
- children.put(name, child);
- child.parent = this;
- }
-
- //
- structuralStateContext.nodes.put(child.id, child);
-
- //
- return child;
- }
-
- public void destroyChild(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- StructuralNode child;
- synchronized (this)
- {
- if (!children.containsKey(name))
- {
- throw new IllegalArgumentException("No such child " + name);
- }
-
- child = children.get(name);
-
- //
- for (String blah : new ArrayList<String>(child.children.keySet()))
- {
- child.destroyChild(blah);
- }
-
- //
- children.remove(name);
- structuralStateContext.nodes.remove(child.id);
-
- //
- child.valid = false;
- child.parent = null;
- }
- }
-
- public StructuralNode getChild(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- synchronized (this)
- {
- return children.get(name);
- }
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralObjectImpl.java 2008-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralObjectImpl.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,121 +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.state.structural;
-
-import org.jboss.portal.presentation.state.structural.StructuralObject;
-import org.jboss.portal.presentation.state.structural.StructuralState;
-
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StructuralObjectImpl implements StructuralObject
-{
-
- /** . */
- private final String id;
-
- /** . */
- private final StructuralStateImpl state;
-
- /** . */
- private final String parentId;
-
- /** . */
- private final Set<String> childrenIds;
-
- public StructuralObjectImpl(
- String id,
- String parentId,
- Set<String> childrenIds,
- StructuralStateImpl state)
- {
- this.id = id;
- this.parentId = parentId;
- this.childrenIds = childrenIds;
- this.state = state;
- }
-
- String getParentId()
- {
- return parentId;
- }
-
- Set<String> getChildrenIds()
- {
- return childrenIds;
- }
-
- public String getId()
- {
- return id;
- }
-
- public StructuralState getState()
- {
- return state;
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof StructuralObjectImpl)
- {
- StructuralObjectImpl that = (StructuralObjectImpl)obj;
-
- //
- if (!that.id.equals(this.id))
- {
- return false;
- }
-
- //
- if (!that.state.equals(this.state))
- {
- return false;
- }
-
- //
- if (that.parentId == null)
- {
- if (this.parentId != null)
- {
- return false;
- }
- }
- else if (!that.parentId.equals(this.parentId))
- {
- return false;
- }
-
- //
- return that.childrenIds.equals(this.childrenIds);
- }
- return false;
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateContextImpl.java 2008-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateContextImpl.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,202 +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.state.structural;
-
-import org.jboss.portal.presentation.state.NoSuchStateException;
-import org.jboss.portal.presentation.state.StaleStateException;
-import org.jboss.portal.presentation.state.StateException;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
-import org.jboss.portal.presentation.state.structural.StructuralStateContext;
-
-import java.util.Collection;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StructuralStateContextImpl implements StructuralStateContext
-{
-
- /** . */
- private final AtomicLong sequence = new AtomicLong();
-
- /** . */
- final ConcurrentMap<String, StructuralNode> nodes = new ConcurrentHashMap<String, StructuralNode>();
-
- /** . */
- private final ContextNode root = new ContextNode("", this);
-
- public StructuralStateContextImpl()
- {
- nodes.put(root.getId(), root);
- }
-
- String nextId()
- {
- return Long.toString(sequence.getAndIncrement());
- }
-
- public StructuralNode getNode(String nodeId)
- {
- if (nodeId == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- return nodes.get(nodeId);
- }
-
- public ContextNode getRoot()
- {
- return root;
- }
-
- public void destroy(String objectId)
- {
- if (objectId == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- StructuralNode node = nodes.get(objectId);
-
- //
- StructuralNode parent = node.getParent();
-
- //
- if (parent == null)
- {
- throw new IllegalArgumentException("Cannot destroy root");
- }
-
- //
- parent.destroyChild(node.getName());
- }
-
- public StructuralObject load(String objectId) throws IllegalArgumentException
- {
- if (objectId == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- StructuralNode node = nodes.get(objectId);
-
- //
- return node != null ? node.takeSnapshot() : null;
- }
-
- public Collection<StructuralObject> loadChildren(StructuralObject structuralParent) throws IllegalArgumentException, StateException
- {
- if (structuralParent == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- StructuralNode parentNode = nodes.get(structuralParent.getId());
-
- //
- if (parentNode == null)
- {
- throw new NoSuchStateException();
- }
-
- //
- return parentNode.takeChildrenSnapshot(structuralParent);
- }
-
- public StructuralObject loadParent(StructuralObject structuralChild) throws IllegalArgumentException, StateException
- {
- if (structuralChild == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- StructuralNode childNode = nodes.get(structuralChild.getId());
-
- //
- if (childNode == null)
- {
- throw new NoSuchStateException();
- }
-
- //
- return childNode.takeParentSnapshot(structuralChild);
- }
-
- public String getRootId()
- {
- return root.getId();
- }
-
- public void validate(StructuralObject structuralObject) throws IllegalArgumentException, StateException
- {
- if (structuralObject == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- StructuralNode structuralNode = nodes.get(structuralObject.getId());
-
- //
- if (structuralNode == null)
- {
- throw new NoSuchStateException();
- }
-
- //
- if (!structuralNode.takeSnapshot().equals(structuralObject))
- {
- throw new StaleStateException();
- }
- }
-
- public StructuralObject.Refresh refresh(StructuralObject structuralObject) throws IllegalArgumentException, StateException
- {
- if (structuralObject == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- StructuralNode structuralNode = nodes.get(structuralObject.getId());
-
- //
- if (structuralNode == null)
- {
- throw new NoSuchStateException();
- }
-
- //
- return structuralNode.refresh((StructuralObjectImpl)structuralObject);
- }
-}
Deleted: 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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/StructuralStateImpl.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,99 +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.state.structural;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.state.structural.StructuralState;
-
-import java.util.Map;
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StructuralStateImpl implements StructuralState
-{
-
- /** . */
- private final Class<? extends UIObject> type;
-
- /** . */
- private final String name;
-
- /** . */
- private final Map<String, Serializable> properties;
-
- public StructuralStateImpl(
- Class<? extends UIObject> type,
- String name,
- Map<String, Serializable> properties)
- {
- this.type = type;
- this.name = name;
- this.properties = properties;
- }
-
- public Class<? extends UIObject> getType()
- {
- return type;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Map<String, Serializable> getProperties()
- {
- return properties;
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof StructuralStateImpl)
- {
- StructuralStateImpl that = (StructuralStateImpl)obj;
-
- //
- if (!that.type.equals(this.type))
- {
- return false;
- }
-
- //
- if (!that.name.equals(this.name))
- {
- return false;
- }
-
- //
- return that.properties.equals(this.properties);
- }
- return false;
- }
-}
Deleted: 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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/WindowNode.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,57 +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.state.structural;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIWindow;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class WindowNode extends StructuralNode
-{
-
- /** . */
- private String content;
-
- public WindowNode(String name, StructuralStateContextImpl structuralStateContext)
- {
- super(name, structuralStateContext);
- }
-
- public Class<? extends UIObject> getType()
- {
- return UIWindow.class;
- }
-
- public void setContent(String content)
- {
- this.content = content;
- }
-
- public String getContent()
- {
- return content;
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/resources/org/jboss/portal/presentation/impl/state/structural/page_structure_1_0.xsd
===================================================================
--- modules/presentation/trunk/presentation/src/main/resources/org/jboss/portal/presentation/impl/state/structural/page_structure_1_0.xsd 2008-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/main/resources/org/jboss/portal/presentation/impl/state/structural/page_structure_1_0.xsd 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsd:schema
- targetNamespace="urn:jboss:portal:presentation:page:1.0"
- xmlns="urn:jboss:portal:presentation:page:1.0"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified"
- attributeFormDefault="unqualified"
- version="1.0">
-
- <xsd:element name="context-def" type="contextDefType">
- </xsd:element>
-
- <xsd:complexType name="nodeDefType">
- <xsd:sequence>
- <xsd:element name="properties" type="nodePropertiesType" minOccurs="0" maxOccurs="1"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="namedNodeDefType">
- <xsd:complexContent>
- <xsd:extension base="nodeDefType">
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="nodePropertiesType">
- <xsd:sequence>
- <xsd:element name="property" type="nodePropertyType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="nodePropertyType">
- <xsd:sequence>
- <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
- <xsd:element name="value" type="propertyValueType" minOccurs="1" maxOccurs="1"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="propertyValueType">
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute name="type" use="optional" default="string">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="string"/>
- <xsd:enumeration value="int"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
-
- <xsd:simpleType name="contentType" >
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
-
- <xsd:complexType name="contextDefType">
- <xsd:complexContent>
- <xsd:extension base="nodeDefType">
- <xsd:sequence>
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="page-def" type="pageDefType"/>
- </xsd:choice>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="pageDefType">
- <xsd:complexContent>
- <xsd:extension base="namedNodeDefType">
- <xsd:sequence>
- <xsd:choice minOccurs="1" maxOccurs="1">
- <xsd:element name="simple-layout" type="simpleLayoutType"/>
- <xsd:element name="region-layout" type="regionLayoutType"/>
- </xsd:choice>
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="page-def" type="pageDefType"/>
- </xsd:choice>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="windowDefType">
- <xsd:complexContent>
- <xsd:extension base="namedNodeDefType">
- <xsd:sequence>
- <xsd:element name="content" type="contentType"/>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="simpleLayoutType">
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="window-def" type="windowDefType"/>
- </xsd:choice>
- <xsd:attribute name="orientation" use="optional" default="vertical">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="vertical"/>
- <xsd:enumeration value="horizontal"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
-
- <xsd:complexType name="regionLayoutType">
- <xsd:sequence>
- <xsd:element name="region" type="regionType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="regionType">
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="window-def" type="windowDefType"/>
- </xsd:choice>
- <xsd:attribute name="orientation" use="required" type="xsd:string"/>
- </xsd:complexType>
-
-</xsd:schema>
Deleted: 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-06-01 15:04:10 UTC (rev 10886)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/structural/StructuralStateContextTestCase.java 2008-06-01 15:09:24 UTC (rev 10887)
@@ -1,142 +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.test.state.structural;
-
-import org.jboss.portal.presentation.impl.state.structural.ContextNode;
-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.StructuralStateContextImpl;
-import org.jboss.portal.presentation.impl.state.structural.WindowNode;
-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;
-import org.jboss.portal.presentation.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.test.model.AbstractModelTestCase;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StructuralStateContextTestCase extends AbstractModelTestCase<StructuralNode>
-{
-
- /** . */
- private StructuralStateContextImpl structuralStateContext;
-
- protected StructuralStateContext getStructuralStateContext()
- {
- return structuralStateContext;
- }
-
- protected StructuralNode getRoot()
- {
- return structuralStateContext.getRoot();
- }
-
- protected Set<String> getPropertyNames(StructuralNode structuralNode)
- {
- return structuralNode.getPropertyNames();
- }
-
- protected StructuralNode getParent(StructuralNode structuralNode)
- {
- return structuralNode.getParent();
- }
-
- protected List<? extends StructuralNode> getChildren(StructuralNode structuralNode)
- {
- return new ArrayList<StructuralNode>(structuralNode.getChildren());
- }
-
- protected String getName(StructuralNode structuralNode)
- {
- return structuralNode.getName();
- }
-
- protected boolean isValid(StructuralNode structuralNode)
- {
- return structuralNode.isValid();
- }
-
- protected Class<? extends UIObject> getType(StructuralNode structuralNode)
- {
- return structuralNode.getType();
- }
-
- protected String getId(StructuralNode structuralNode)
- {
- return structuralNode.getId();
- }
-
- protected StructuralNode addChild(StructuralNode structuralNode, String name, Class<? extends UIObject> modelType)
- {
- Class<? extends StructuralNode> structuralNodeType;
-
- //
- if (modelType == UIContext.class)
- {
- structuralNodeType = ContextNode.class;
- }
- else if (modelType == UIPage.class)
- {
- structuralNodeType = PageNode.class;
- }
- else if (modelType == UIWindow.class)
- {
- structuralNodeType = WindowNode.class;
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- return structuralNode.addChild(name, structuralNodeType);
- }
-
- protected void setProperty(StructuralNode structuralNode, String propertyName, String propertyValue)
- {
- structuralNode.setProperty(propertyName, propertyValue);
- }
-
- protected Serializable getProperty(StructuralNode structuralNode, String name)
- {
- return structuralNode.getProperty(name);
- }
-
- protected void destroy(StructuralNode structuralNode)
- {
- structuralStateContext.destroy(structuralNode.getId());
- }
-
- protected void setUp() throws Exception
- {
- structuralStateContext = new StructuralStateContextImpl();
- }
-}
17 years, 11 months
JBoss Portal SVN: r10886 - in modules/common/trunk: mc and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-01 11:04:10 -0400 (Sun, 01 Jun 2008)
New Revision: 10886
Modified:
modules/common/trunk/build/pom.xml
modules/common/trunk/mc/pom.xml
modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java
Log:
update mc bootstrap to inject the ServletContext as an MC bean as it could be injected in dependant services
Modified: modules/common/trunk/build/pom.xml
===================================================================
--- modules/common/trunk/build/pom.xml 2008-06-01 15:03:26 UTC (rev 10885)
+++ modules/common/trunk/build/pom.xml 2008-06-01 15:04:10 UTC (rev 10886)
@@ -21,6 +21,7 @@
<version.log4j>1.2.14</version.log4j>
<version.apache.commons-httpclient>3.0.1</version.apache.commons-httpclient>
<version.jboss.microcontainer>2.0.0.Beta13</version.jboss.microcontainer>
+ <version.jboss.man>2.0.0.Beta12</version.jboss.man>
<version.cargo>0.8</version.cargo>
<version.junit>3.8.1</version.junit>
<version.ant>1.6.5</version.ant>
@@ -138,6 +139,12 @@
<version>${version.jboss.microcontainer}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <version>${version.jboss.man}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
Modified: modules/common/trunk/mc/pom.xml
===================================================================
--- modules/common/trunk/mc/pom.xml 2008-06-01 15:03:26 UTC (rev 10885)
+++ modules/common/trunk/mc/pom.xml 2008-06-01 15:04:10 UTC (rev 10886)
@@ -19,6 +19,11 @@
</dependency>
<dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>apache-log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
Modified: modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java
===================================================================
--- modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java 2008-06-01 15:03:26 UTC (rev 10885)
+++ modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java 2008-06-01 15:04:10 UTC (rev 10886)
@@ -28,6 +28,10 @@
import org.jboss.kernel.spi.event.KernelEvent;
import org.jboss.kernel.spi.registry.KernelRegistry;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
+import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
import org.apache.log4j.Logger;
import javax.servlet.ServletContext;
@@ -37,12 +41,17 @@
import java.net.MalformedURLException;
/**
- * A kernel bootstrap with a life cycle triggered by the <code>ServletContextListener</code> interface.
+ * <p>A kernel bootstrap with a life cycle triggered by the <code>ServletContextListener</code> interface.
* All beans will be injected as servlet context attributes. The bean xml file must be available as
- * a servlet context resource under the path <i>/WEB-INF/jboss-beans.xml</i>.
+ * a servlet context resource under the path <i>/WEB-INF/jboss-beans.xml</i>.</p>
*
+ * <p>A special bean with the name <code>ServletContext</code> is injected in the kernel before the deployment
+ * of the beans from the xml file are deployed. Thus it is possible to inject the servlet context as a bean
+ * into other beans.</p>
+ *
* @todo specify an alternative logger name
* @todo implement the specification of an alternative xml file path
+ * @todo implement kernel validate ?
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -93,6 +102,9 @@
/** . */
private ActualBootstrap bootstrap;
+ /** . */
+ private KernelControllerContext servletContextControllerContext;
+
public void contextInitialized(ServletContextEvent event)
{
servletContext = event.getServletContext();
@@ -125,6 +137,12 @@
}
//
+ if (servletContextControllerContext != null)
+ {
+ bootstrap.getKernel().getController().uninstall("ServletContext");
+ }
+
+ //
if (registered)
{
registered = false;
@@ -152,23 +170,28 @@
if (context instanceof String)
{
String key = (String)context;
- String type = event.getType();
- if ("KERNEL_REGISTRY_REGISTERED".equals(type))
+
+ // We add/remove every bean except the servlet context itself...
+ if (!"ServletContext".equals(key))
{
- KernelRegistryEntry entry = bootstrap.getKernel().getRegistry().getEntry(context);
- Object target = entry.getTarget();
- servletContext.setAttribute(key, target);
+ String type = event.getType();
+ if ("KERNEL_REGISTRY_REGISTERED".equals(type))
+ {
+ KernelRegistryEntry entry = bootstrap.getKernel().getRegistry().getEntry(context);
+ Object target = entry.getTarget();
+
+ servletContext.setAttribute(key, target);
+ }
+ else if ("KERNEL_REGISTRY_UNREGISTERED".equals(type))
+ {
+ servletContext.removeAttribute(key);
+ }
}
- else if ("KERNEL_REGISTRY_UNREGISTERED".equals(type))
- {
- servletContext.removeAttribute(key);
- }
}
}
void boostrap() throws Throwable
{
- //
bootstrap.getKernel().getRegistry().registerListener(WebBootstrap.this, null, "ABC");
registered = true;
@@ -176,6 +199,14 @@
deployer = new BeanXMLDeployer(bootstrap.getKernel());
//
+ AbstractBeanMetaData beanMD = new AbstractBeanMetaData("ServletContext", ServletContext.class.getName());
+ AbstractConstructorMetaData ctorMD = new AbstractConstructorMetaData();
+ ctorMD.setFactory(new AbstractValueMetaData(new ServletContextFactory(servletContext)));
+ ctorMD.setFactoryMethod("getInstance");
+ beanMD.setConstructor(ctorMD);
+ servletContextControllerContext = bootstrap.getKernel().getController().install(beanMD);
+
+ //
URL url = getBeansURL();
//
17 years, 11 months