Author: sohil.shah(a)jboss.com
Date: 2007-11-17 11:12:44 -0500 (Sat, 17 Nov 2007)
New Revision: 8991
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
Log:
integration
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
===================================================================
---
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-17
15:37:56 UTC (rev 8990)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-17
16:12:44 UTC (rev 8991)
@@ -120,7 +120,7 @@
public WindowContent render(RequestContext context, UIWindow window) throws Exception
{
- PortalObjectId windowId = null;
+ /*PortalObjectId windowId = null;
RenderWindowCommand rwc = new RenderWindowCommand(windowId);
ControllerContext ctx = new ControllerContext(context.getInvocation(),
controller);
WindowRendition rendition = rwc.render(ctx);
@@ -143,6 +143,8 @@
}
}
- return null;
+ return null;*/
+
+ return new WindowContent(-1, "MockTitle", "<div>Mock
Content</div>");
}
}
Modified: branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
---
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-17
15:37:56 UTC (rev 8990)
+++
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-17
16:12:44 UTC (rev 8991)
@@ -1096,9 +1096,9 @@
name="portal:service=PresentationServer"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
+ <xmbean/>
<depends optional-attribute-name="Processor"
proxy-type="attribute">portal:service=Processor</depends>
- <depends optional-attribute-name="ModelLoader"
proxy-type="attribute">portal:container=ModelLoader</depends>
+ <depends optional-attribute-name="ModelLoader"
proxy-type="attribute">portal:container=ModelLoader</depends>
<depends>portal:service=PageService</depends>
<depends>portal:commandFactory=DefaultPortal</depends>
<depends>portal:urlFactory=Delegating</depends>
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java 2007-11-17
15:37:56 UTC (rev 8990)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/controller/UIController.java 2007-11-17
16:12:44 UTC (rev 8991)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.controller;
+import java.util.List;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
@@ -42,6 +43,7 @@
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.ObjectState;
+import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.ServerException;
@@ -85,20 +87,36 @@
{
try
{
+ HttpServletRequest request = invocation.getServerContext().getClientRequest();
+
/**
* TODO: decouple the implementation via factory pattern
*/
RequestContext requestContext = new RequestContextImpl(this.presentationServer,
invocation);
+ request.setAttribute("requestContext", requestContext);
- ServerAction serverAction = this.getServerAction(requestContext,invocation);
+ String portalRequestPath = invocation.getServerContext().getPortalRequestPath();
+ if(portalRequestPath == null || portalRequestPath.equals("") ||
portalRequestPath.equals("/") ||
portalRequestPath.equals("/index.html"))
+ {
+ portalRequestPath = "/default/default";
+ }
+
+ UIPortal targetPortal = this.getTargetPortal(requestContext,portalRequestPath);
+ UIObject targetPortalObject =
this.getTargetPortalObject(requestContext,portalRequestPath);
+
+ /**
+ * TODO: move this functionality to another component like a UIPresenter etc
+ */
+ ServerAction serverAction = this.getServerAction(requestContext, targetPortal,
targetPortalObject);
+
ProcessorRequest processorRequest = new ProcessorRequest(serverAction);
ProcessorResponse processorResponse =
this.presentationServer.getProcessor().process(requestContext,
processorRequest);
//Process the response from the Processor
ServerResponse serverResponse = processorResponse.getResponse();
- this.handle(serverResponse);
+ this.handle(requestContext, targetPortal, targetPortalObject, serverResponse);
}
catch(Exception e)
{
@@ -111,16 +129,43 @@
* @param serverResponse
* @throws ServerException
*/
- private void handle(ServerResponse serverResponse) throws ServerException
+ private void handle(RequestContext requestContext, UIPortal targetPortal, UIObject
targetPortalObject, ServerResponse serverResponse) throws ServerException
{
- if(serverResponse instanceof ShowUIObjectResponse)
+ try
{
- ShowUIObjectResponse response = (ShowUIObjectResponse)serverResponse;
-
- //Setup the objects in the UIObjectTree
-
- //Populate the state of the Windows in the Page that is being displayed
+ if(serverResponse instanceof ShowUIObjectResponse)
+ {
+ if(targetPortalObject instanceof UIPage)
+ {
+ //Load the objects in the UITree
+ UIPortal portal =
requestContext.getUIContext().createChild(targetPortal.getName(), UIPortal.class);
+ UIPage page = portal.createChild(targetPortalObject.getName(),
UIPage.class);
+
+ //Populate the state of the Windows in the Page that is being displayed
+ //inside the UITree
+ List<UIWindow> windows = page.getChildren(UIWindow.class);
+ if(windows != null)
+ {
+ for(int i=0; i<windows.size(); i++)
+ {
+ UIWindow window = windows.get(i);
+ WindowContent windowContent =
this.presentationServer.render(requestContext, window);
+
+ /**
+ * TODO: decouple this from the model implementation by moving the
functinality
+ * to another component like a UIPresenter etc
+ */
+ ((org.jboss.portal.presentation.impl.model.UIWindowImpl)window).
+ setContent(windowContent);
+ }
+ }
+ }
+ }
}
+ catch(Exception e)
+ {
+ throw new ServerException(e);
+ }
}
/**
@@ -161,22 +206,14 @@
/**
*
*/
- private ServerAction getServerAction(RequestContext requestContext,ServerInvocation
invocation)
+ private ServerAction getServerAction(RequestContext requestContext, UIPortal
targetPortal, UIObject targetPortalObject)
{
ServerAction serverAction = null;
+ ServerInvocation invocation = requestContext.getInvocation();
ServerInvocationContext invocationContext = invocation.getServerContext();
HttpServletRequest request = invocationContext.getClientRequest();
-
- String portalRequestPath = invocation.getServerContext().getPortalRequestPath();
- if(portalRequestPath == null || portalRequestPath.equals("") ||
portalRequestPath.equals("/") ||
portalRequestPath.equals("/index.html"))
- {
- portalRequestPath = "/default/default";
- }
-
- UIPortal targetPortal = this.getTargetPortal(requestContext,portalRequestPath);
- UIObject targetPortalObject =
this.getTargetPortalObject(requestContext,portalRequestPath);
-
+
if(targetPortalObject instanceof UIPage)
{
serverAction = new ViewUIObjectAction(targetPortalObject.getId());
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java 2007-11-17
15:37:56 UTC (rev 8990)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/entry/PortalEntryPoint.java 2007-11-17
16:12:44 UTC (rev 8991)
@@ -68,6 +68,8 @@
import org.jboss.portal.presentation.impl.classic.layout.RegionLayoutManager;
import org.jboss.portal.presentation.server.ProcessorResponse;
import org.jboss.portal.presentation.entry.EntryPoint;
+import org.jboss.portal.presentation.RequestContext;
+import org.jboss.portal.presentation.model.UIContext;
/**
* The Portal Server Entry Point for classic html mode
@@ -334,7 +336,11 @@
try
{
InterceptorStackFactory stack = this.entryPoint.getInterceptorStackFactory();
- invocation.invoke(stack.getInterceptorStack());
+ invocation.invoke(stack.getInterceptorStack());
+
+ //Iterate through the UIContext Tree
+ RequestContext requestContext =
(RequestContext)req.getAttribute("requestContext");
+ UIContext uiContext = requestContext.getUIContext();
}
catch (ServerException e)
{
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-11-17
15:37:56 UTC (rev 8990)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-11-17
16:12:44 UTC (rev 8991)
@@ -43,22 +43,25 @@
*
*/
private WindowState windowState = null;
-
+
/**
*
*/
- private String markup = null;
+ private WindowContent content = null;
/**
*
+ * @return
*/
- private WindowContent content = null;
-
public WindowContent getContent()
{
return content;
}
+ /**
+ *
+ * @param content
+ */
public void setContent(WindowContent content)
{
this.content = content;
@@ -94,26 +97,10 @@
public void setWindowState(WindowState windowState)
{
this.windowState = windowState;
- }
-
- /**
- *
- */
- public String getMarkup()
- {
- return markup;
- }
+ }
/**
*
- */
- public void setMarkup(String markup)
- {
- this.markup = markup;
- }
-
- /**
- *
* @param <T>
* @param type
* @return
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java 2007-11-17
15:37:56 UTC (rev 8990)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java 2007-11-17
16:12:44 UTC (rev 8991)
@@ -54,16 +54,4 @@
* @param mode
*/
public void setMode(Mode mode);
-
- /**
- *
- * @return
- */
- public String getMarkup();
-
- /**
- *
- * @param markup
- */
- public void setMarkup(String markup);
}
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-17
15:37:56 UTC (rev 8990)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-17
16:12:44 UTC (rev 8991)
@@ -53,5 +53,5 @@
*
* @return
*/
- ModelLoader getModelLoader();
+ ModelLoader getModelLoader();
}
Modified: branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
===================================================================
---
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml 2007-11-17
15:37:56 UTC (rev 8990)
+++
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml 2007-11-17
16:12:44 UTC (rev 8991)
@@ -27,6 +27,7 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Add the GWT Client Filter to run the Portal in full Web 2.0 Ajax Mode. In
turn, to run in Classic Html Mode, turn this filter off -->
+ <!--
<filter>
<filter-name>GWTClientFilter</filter-name>
<filter-class>org.jboss.portal.presentation.entry.GWTClientFilter</filter-class>
@@ -35,6 +36,7 @@
<filter-name>GWTClientFilter</filter-name>
<servlet-name>PortalEntryPoint</servlet-name>
</filter-mapping>
+ -->
<!-- The portal servlet is the main entrance point -->
<servlet>