Author: sohil.shah(a)jboss.com
Date: 2007-10-15 15:28:21 -0400 (Mon, 15 Oct 2007)
New Revision: 8660
Added:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/ProcessorResponse.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Component.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Container.java
Removed:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Component.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Container.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Page.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Window.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/protocol/
Modified:
branches/UIServer/core-uiserver/build.xml
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/Processor.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Page.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/PortalObject.java
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Window.java
branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
branches/UIServer/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestFlexibleGrid.java
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestRegionLayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutService.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGrid.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGridLayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/RegionLayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
Log:
(Core Portal-Presentation Framework-HTTP layer)- architecture for interaction during
sending response back from Portal
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java
===================================================================
---
branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -39,11 +39,13 @@
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.CustomizationManager;
import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerException;
+import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.web.spi.ServletContainerContext;
import javax.servlet.ServletException;
@@ -307,7 +309,7 @@
ControllerResponse response = forward.getResponse();
processCommandResponse(controllerContext, command, response);
}
- else if (handlerResponse instanceof HTTPResponse)
+ /*else if (handlerResponse instanceof HTTPResponse)
{
HTTPResponse hr = (HTTPResponse)handlerResponse;
sendResponse(controllerContext, hr);
@@ -316,13 +318,13 @@
{
AjaxResponse ar = (AjaxResponse)handlerResponse;
sendResponse(controllerContext, ar);
- }
+ }*/
}
/**
* All http responses in the stack should be handled here.
*/
- protected void sendResponse(ControllerContext ctx, HTTPResponse resp)
+ /*protected void sendResponse(ControllerContext ctx, HTTPResponse resp)
{
try
{
@@ -335,13 +337,13 @@
catch (ServletException e)
{
log.error("Cound not send http response", e);
- }
- }
+ }
+ }*/
/**
* All http responses in the stack should be handled here.
*/
- protected void sendResponse(ControllerContext ctx, AjaxResponse resp)
+ /*protected void sendResponse(ControllerContext ctx, AjaxResponse resp)
{
try
{
@@ -355,5 +357,5 @@
{
log.error("Cound not send http response", e);
}
- }
-}
+ }*/
+}
\ No newline at end of file
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
---
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -60,7 +60,15 @@
if (requiresRedirect(controllerCommand, urlContext, forward))
{
String url = controllerContext.renderURL(forward.getCommand(),
forward.getURLContext(), null);
- return HTTPResponse.sendRedirect(url);
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
controllerContext.getServerInvocation().getServerContext().getClientRequest().setAttribute("pfTask",
"redirect");
+
controllerContext.getServerInvocation().getServerContext().getClientRequest().setAttribute("url",
url);
+
+ //return HTTPResponse.sendRedirect(url);
+ return null;
}
}
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
===================================================================
---
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -49,6 +49,8 @@
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+
import java.io.IOException;
/**
@@ -72,9 +74,15 @@
if (controllerResponse instanceof PageRendition)
{
final PageRendition rendition = (PageRendition)controllerResponse;
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"aggregate");
+
invocation.getServerContext().getClientRequest().setAttribute("pageResult",
rendition.getPageResult());
// Defer execution of rendition to the right place which is in the classic
controller send response
- return new HTTPResponse()
+ /*return new HTTPResponse()
{
public void sendResponse(ServerInvocationContext ctx) throws IOException,
ServletException
{
@@ -82,7 +90,8 @@
MarkupInfo markupInfo =
(MarkupInfo)invocation.getResponse().getContentInfo();
rendition.render(markupInfo, dispatcher);
}
- };
+ };*/
+ return null;
}
else if (controllerResponse instanceof SignOutResponse)
{
@@ -101,14 +110,30 @@
URLContext urlContext = invocation.getServerContext().getURLContext();
location = controllerContext.renderURL(renderCmd,
urlContext.asNonAuthenticated(), null);
}
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"redirect");
+ invocation.getServerContext().getClientRequest().setAttribute("url",
location);
//
- return HTTPResponse.sendRedirect(location);
+ //return HTTPResponse.sendRedirect(location);
+ return null;
}
else if (controllerResponse instanceof StreamContentResponse)
{
StreamContentResponse scr = (StreamContentResponse)controllerResponse;
- return HTTPResponse.sendBinary(scr.getContentType(), scr.getInputStream());
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"stream");
+
invocation.getServerContext().getClientRequest().setAttribute("contentType",
scr.getContentType());
+
invocation.getServerContext().getClientRequest().setAttribute("inputStream",
scr.getInputStream());
+
+ //return HTTPResponse.sendBinary(scr.getContentType(), scr.getInputStream());
+ return null;
}
else if (controllerResponse instanceof SecurityErrorResponse)
{
@@ -118,14 +143,29 @@
{
if (controllerContext.getUser() != null)
{
- return HTTPResponse.sendForbidden();
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"error");
+
invocation.getServerContext().getClientRequest().setAttribute("errorCode", new
Integer(HttpServletResponse.SC_FORBIDDEN));
+
+ //return HTTPResponse.sendForbidden();
+ return null;
}
else
{
urlContext = URLContext.newInstance(urlContext.isSecure(), true);
ServerURL serverURL =
controllerContext.getController().getURLFactory().doMapping(controllerContext,
controllerContext.getServerInvocation(), controllerCommand);
String url =
controllerContext.getServerInvocation().getResponse().renderURL(serverURL, urlContext,
null);
- return HTTPResponse.sendRedirect(url);
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"redirect");
+
invocation.getServerContext().getClientRequest().setAttribute("url", url);
+
+ //return HTTPResponse.sendRedirect(url);
+ return null;
}
}
else
@@ -133,7 +173,15 @@
urlContext = URLContext.newInstance(true, urlContext.isAuthenticated());
ServerURL serverURL =
controllerContext.getController().getURLFactory().doMapping(controllerContext,
controllerContext.getServerInvocation(), controllerCommand);
String url =
controllerContext.getServerInvocation().getResponse().renderURL(serverURL, urlContext,
null);
- return HTTPResponse.sendRedirect(url);
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"redirect");
+
invocation.getServerContext().getClientRequest().setAttribute("url", url);
+
+ //return HTTPResponse.sendRedirect(url);
+ return null;
}
}
else if (controllerResponse instanceof ErrorResponse)
@@ -148,15 +196,29 @@
{
log.error("An error occured", cause);
}
-
- return HTTPResponse.sendError();
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"error");
+
invocation.getServerContext().getClientRequest().setAttribute("errorCode", new
Integer(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
+
+ //return HTTPResponse.sendError();
+ return null;
}
else if (controllerResponse instanceof UnavailableResourceResponse)
{
UnavailableResourceResponse unavailable =
(UnavailableResourceResponse)controllerResponse;
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"error");
+
invocation.getServerContext().getClientRequest().setAttribute("errorCode", new
Integer(HttpServletResponse.SC_NOT_FOUND));
//
- return HTTPResponse.sendNotFound();
+ //return HTTPResponse.sendNotFound();
+ return null;
}
else
{
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
===================================================================
---
branches/UIServer/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -57,7 +57,14 @@
RenderPortletInstanceCommand render= new
RenderPortletInstanceCommand(upir.getInstanceId(), upir.getNavigationalState());
final PageRendition rendition =
(PageRendition)controllerContext.execute(render);
final ServerInvocation invocation = controllerContext.getServerInvocation();
- return new HTTPResponse()
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"aggregate");
+
invocation.getServerContext().getClientRequest().setAttribute("pageResult",
rendition.getPageResult());
+
+ /*return new HTTPResponse()
{
public void sendResponse(ServerInvocationContext ctx) throws IOException,
ServletException
{
@@ -65,7 +72,8 @@
MarkupInfo markupInfo =
(MarkupInfo)invocation.getResponse().getContentInfo();
rendition.render(markupInfo, dispatcher);
}
- };
+ };*/
+ return null;
}
catch (ControllerException e)
{
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
---
branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -78,7 +78,14 @@
{
final PageRendition rendition = (PageRendition)resp;
final ServerInvocation invocation =
controllerContext.getServerInvocation();
- return new HTTPResponse()
+
+ /**
+ * Used for integration with the new Presentation Framework
+ */
+
invocation.getServerContext().getClientRequest().setAttribute("pfTask",
"aggregate");
+
invocation.getServerContext().getClientRequest().setAttribute("pageResult",
rendition.getPageResult());
+
+ /*return new HTTPResponse()
{
public void sendResponse(ServerInvocationContext ctx) throws
IOException, ServletException
{
@@ -86,7 +93,8 @@
MarkupInfo markupInfo =
(MarkupInfo)invocation.getResponse().getContentInfo();
rendition.render(markupInfo, dispatcher);
}
- };
+ };*/
+ return null;
}
else
{
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java
===================================================================
---
branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -22,15 +22,34 @@
******************************************************************************/
package org.jboss.portal.core.processor;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
import org.apache.log4j.Logger;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletOutputStream;
+
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.server.RequestControllerDispatcher;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.theme.page.PageResult;
+import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.uiserver.processor.Processor;
import org.jboss.portal.uiserver.processor.ProcessorRequest;
+import org.jboss.portal.uiserver.processor.ProcessorResponse;
+import org.jboss.portal.uiserver.protocol.Page;
+import org.jboss.portal.uiserver.protocol.Window;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -46,55 +65,160 @@
/**
*
*/
- private RequestController temp = null;
+ private RequestController requestController = null;
-
/**
*
+ * @return
+ */
+ public RequestController getRequestController()
+ {
+ return requestController;
+ }
+
+ /**
+ *
+ * @param requestController
*/
- public void process(ProcessorRequest request) throws ServerException
+ public void setRequestController(RequestController requestController)
+ {
+ this.requestController = requestController;
+ }
+
+ /**
+ *
+ */
+ public ProcessorResponse process(ProcessorRequest request) throws ServerException
{
try
{
- //This should process the request sent in from the UIServer using whatever
framework the core Portal implements
- //Basically based on the information sent in by the ProcessorRequest this
component should have all the information
- //it needs to perform necessary action inside the Portal
-
+ /*
+ This should process the request sent in from the UIServer using whatever
framework the core Portal implements
+ Basically based on the information sent in by the ProcessorRequest this
component should have all the information
+ it needs to perform necessary action inside the Portal
+ the Processor should use the values sent in the ProcessorRequest object to
perform
+ the appropriate action and then send its Response back to the UIServer which
should process
+ the Response and sent a Response back to the client
+ */
+ ProcessorResponse response = null;
- //the Processor should use the values sent in the ProcessorRequest object to
perform
- //the appropriate action and then send its Response back to the UIServer which
should process
- //the Response and sent a Response back to the client
+ //For now, just for prototype sake just use the existing Controller to produce
the outcome
+ request.getServerInvocation().setHandler(new
RequestControllerDispatcher(this.requestController));
+ request.getServerInvocation().invokeNext();
+
+ //Get access to the core Portal objects to be used after the execution of the
incoming Portal request
+ //by the Portal Controller
+ ServerInvocation invocation = request.getServerInvocation();
+ ServletContextDispatcher dispatcher = new
ServletContextDispatcher(invocation.getServerContext().getClientRequest(),
+ invocation.getServerContext().getClientResponse(),
invocation.getRequest().getServer().getServletContainerContext());
+ String task =
(String)invocation.getServerContext().getClientRequest().getAttribute("pfTask");
+ if(task.equals("aggregate"))
+ {
+ //Handle page aggregation and sending result back to the client
+ MarkupInfo markupInfo =
(MarkupInfo)invocation.getResponse().getContentInfo();
+ PageResult pageResult =
(PageResult)invocation.getServerContext().getClientRequest().getAttribute("pageResult");
+
+ //Now generate a ProcessorResponse by mapping the data produced during the
execution of
+ //the Portal Request
+ String contentType = markupInfo.getContentType() + "; charset=" +
markupInfo.getCharset();
+ Page pageToBeDisplayed = new Page();
+ pageToBeDisplayed.setCurrentlyDisplayed(true);
+
+ //Setup information inside the page object
+ pageToBeDisplayed.setName(pageResult.getPageName());
+ List windows = this.getWindows(pageResult.getWindowContextMap());
+ if(windows != null)
+ {
+ pageToBeDisplayed.getChildren().addAll(windows);
+ }
+
+ //
+ List updatedPages = new ArrayList();
+ updatedPages.add(pageToBeDisplayed);
+
+ //Generate the response to be sent back for processing by the Presentation
Framework
+ response = new ProcessorResponse(dispatcher, contentType,
markupInfo.getCharset(), updatedPages);
+ }
+ else if(task.equals("stream"))
+ {
+ //Handle sending back binary content back to the client
+ String contentType =
(String)invocation.getServerContext().getClientRequest().getAttribute("contentType");
+ InputStream in =
(InputStream)invocation.getServerContext().getClientRequest().getAttribute("inputStream");
+
+ //Process and see if binary content needs to be sent back...
+ //In this case write the response to the OutputStream directly
+ //There is no need for any Presentation Framework processing
+ if(contentType != null && in != null)
+ {
+ HttpServletResponse resp =
invocation.getServerContext().getClientResponse();
+ resp.setContentType(contentType);
+ ServletOutputStream sout = null;
+ try
+ {
+ sout = resp.getOutputStream();
+ byte[] buf = new byte[2048];
+ int len;
+ while ((len = in.read(buf)) > 0)
+ {
+ sout.write(buf, 0, len);
+ }
+ sout.flush();
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ IOTools.safeClose(sout);
+ }
+ }
+ }
+ else if(task.equals("redirect"))
+ {
+ //Handle sendRedirect back to the client
+ String url =
(String)invocation.getServerContext().getClientRequest().getAttribute("url");
+ invocation.getServerContext().getClientResponse().sendRedirect(url);
+ }
+ else if(task.equals("error"))
+ {
+ //Handle sendingErrror back to the client
+ Integer errorCode =
(Integer)invocation.getServerContext().getClientRequest().getAttribute("errorCode");
+
invocation.getServerContext().getClientResponse().sendError(errorCode.intValue());
+ }
- //Just outputting values coming in on ProcessorRequest.....Just for testing
- log.info("Action="+request.getActionType());
- log.info("Portal="+request.getPortal());
- log.info("Target="+request.getTarget());
- //For now, just for prototype sake just use the existing Controller to produce
the outcome
- request.getServerInvocation().setHandler(new
RequestControllerDispatcher(this.temp));
- request.getServerInvocation().invokeNext();
+ return response;
}
catch(Exception e)
{
throw new ServerException(e);
}
}
-
+
/**
*
+ * @param windowContexts
* @return
*/
- public RequestController getTemp()
+ private List getWindows(Map windowContexts)
{
- return temp;
+ List windows = null;
+
+ if(windowContexts != null)
+ {
+ windows = new ArrayList();
+ for(Iterator itr=windowContexts.keySet().iterator(); itr.hasNext();)
+ {
+ String windowId = (String)itr.next();
+ WindowContext windowContext = (WindowContext)windowContexts.get(windowId);
+ WindowResult windowResult = windowContext.getResult();
+
+ Window window = new Window(windowId, windowResult.getTitle(),
+ windowResult.getContent(), windowResult.getHeaderContent(),
+ windowResult.getWindowState(), windowResult.getMode());
+
+ windows.add(window);
+ }
+ }
+
+ return windows;
}
-
- /**
- *
- * @param temp
- */
- public void setTemp(RequestController temp)
- {
- this.temp = temp;
- }
}
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-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-10-15
19:28:21 UTC (rev 8660)
@@ -1053,7 +1053,7 @@
<!-- The controller -->
<mbean
code="org.jboss.portal.core.controller.Controller"
- name="portal:service=Temp"
+ name="portal:service=RequestController"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
@@ -1097,7 +1097,7 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="Temp"
proxy-type="attribute">portal:service=Temp</depends>
+ <depends optional-attribute-name="RequestController"
proxy-type="attribute">portal:service=RequestController</depends>
<depends>portal:container=PortalObject</depends>
<depends>portal:service=PageService</depends>
<depends>portal:commandFactory=DefaultPortal</depends>
Modified: branches/UIServer/core-uiserver/build.xml
===================================================================
--- branches/UIServer/core-uiserver/build.xml 2007-10-15 15:21:39 UTC (rev 8659)
+++ branches/UIServer/core-uiserver/build.xml 2007-10-15 19:28:21 UTC (rev 8660)
@@ -96,7 +96,9 @@
<!-- Configure modules -->
<call target="configure-modules"/>
<path id="dependentmodule.classpath">
+ <path refid="jboss.portlet-api.classpath"/>
<path refid="jboss.portal-server.classpath"/>
+ <path refid="jboss.portal-web.classpath"/>
</path>
<!--+=======================================+-->
Modified:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/Processor.java
===================================================================
---
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/Processor.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/Processor.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -39,5 +39,5 @@
* @param request
* @throws ServerException
*/
- public void process(ProcessorRequest request) throws ServerException;
+ public ProcessorResponse process(ProcessorRequest request) throws ServerException;
}
Added:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/ProcessorResponse.java
===================================================================
---
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/ProcessorResponse.java
(rev 0)
+++
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/processor/ProcessorResponse.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -0,0 +1,171 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver.processor;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.jboss.portal.web.ServletContextDispatcher;
+
+import org.jboss.portal.uiserver.protocol.Page;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class ProcessorResponse implements Serializable
+{
+ /**
+ *
+ */
+ private ServletContextDispatcher dispatcher = null;
+
+ /**
+ * Contains a list of pages that need to be updated on the client. These pages may not
necessarily
+ * be the currently displayed page, but nevertheless, these are pages whose window
content changed
+ * as a result of this particular Portal request processing.
+ *
+ * For most usecases this probably only consist of the Page that is currently being
displayed on the client
+ */
+ private List updatedPages = null;
+
+ /**
+ * Content Type of the response being sent back to the client
+ */
+ private String contentType = null;
+
+ /**
+ * Character Set of the response being sent back to the client
+ */
+ private String charSet = null;
+
+
+ /**
+ *
+ * @param dispatcher
+ * @param updatedPages
+ */
+ public ProcessorResponse(ServletContextDispatcher dispatcher, String contentType,
String charSet, List updatedPages)
+ {
+ this.dispatcher = dispatcher;
+ this.contentType = contentType;
+ this.charSet = charSet;
+ this.updatedPages = updatedPages;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public ServletContextDispatcher getDispatcher()
+ {
+ return dispatcher;
+ }
+
+ /**
+ *
+ * @param dispatcher
+ */
+ public void setDispatcher(ServletContextDispatcher dispatcher)
+ {
+ this.dispatcher = dispatcher;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public List getUpdatedPages()
+ {
+ return updatedPages;
+ }
+
+ /**
+ *
+ * @param updatedPages
+ */
+ public void setUpdatedPages(List updatedPages)
+ {
+ this.updatedPages = updatedPages;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getCharSet()
+ {
+ return charSet;
+ }
+
+ /**
+ *
+ * @param charSet
+ */
+ public void setCharSet(String charSet)
+ {
+ this.charSet = charSet;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ /**
+ *
+ * @param contentType
+ */
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Page findDisplayedPage()
+ {
+ Page displayedPage = null;
+
+ if(this.updatedPages != null)
+ {
+ for(int i=0; i<this.updatedPages.size(); i++)
+ {
+ Page cour = (Page)this.updatedPages.get(i);
+ if(cour.isCurrentlyDisplayed())
+ {
+ displayedPage = cour;
+ break;
+ }
+ }
+ }
+
+ return displayedPage;
+ }
+}
Added:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Component.java
===================================================================
---
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Component.java
(rev 0)
+++
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Component.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver.protocol;
+
+import java.io.Serializable;
+
+/**
+ * Component represents a UI entity that will be rendered eventually on the client
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface Component extends Serializable
+{
+ /**
+ *
+ * @return
+ */
+ public String getId();
+
+ /**
+ *
+ * @param id
+ */
+ public void setId(String id);
+
+
+ /**
+ *
+ * @return
+ */
+ public String getMarkup();
+}
Added:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Container.java
===================================================================
---
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Container.java
(rev 0)
+++
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Container.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -0,0 +1,134 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver.protocol;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Container is an organizational entity which aggregates the Components that will be
rendered on the client
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Container implements Serializable
+{
+ /**
+ * required unique id of the container. uniqueness in relation to
+ * other containers added to the same instance of the page
+ */
+ protected String id = null;
+
+
+ /**
+ *
+ */
+ private List components = null;
+
+ /**
+ *
+ *
+ */
+ public Container(String id)
+ {
+ this.id = id;
+ this.components = new ArrayList();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public List getComponents()
+ {
+ return components;
+ }
+
+ /**
+ *
+ * @param components
+ */
+ public void setComponents(List components)
+ {
+ this.components = components;
+ }
+
+ /**
+ *
+ * @param componentId
+ * @return
+ */
+ public Component getComponent(String componentId)
+ {
+ Component component = null;
+
+ if(this.components != null)
+ {
+ for(int i=0;i<this.components.size();i++)
+ {
+ Component cour = (Component)this.components.get(i);
+ if(cour.getId().equals(componentId))
+ {
+ component = cour;
+ break;
+ }
+ }
+ }
+
+ return component;
+ }
+
+ /**
+ *
+ * @param component
+ */
+ public void addComponent(Component component)
+ {
+ if(this.components == null)
+ {
+ this.components = new ArrayList();
+ }
+
+ this.components.add(component);
+ }
+}
Modified:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Page.java
===================================================================
---
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Page.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Page.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -22,6 +22,10 @@
******************************************************************************/
package org.jboss.portal.uiserver.protocol;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
@@ -29,10 +33,100 @@
public class Page extends PortalObject
{
/**
+ * A page consists of multiple containers that are to be displayed/aggregated along
with their corresponding
+ * UI components
+ */
+ private List containers = null;
+
+ /**
+ * Signifies if this page is currently being displayed on the client
+ */
+ private boolean currentlyDisplayed = false;
+
+ /**
*
+ *
*/
+ public Page()
+ {
+ super();
+ this.containers = new ArrayList();
+ }
+
+ /**
+ *
+ */
public String toString()
{
return "Page: "+super.toString();
}
+
+ /**
+ *
+ * @return
+ */
+ public List getWindows()
+ {
+ List windows = new ArrayList();
+
+ if(this.children != null)
+ {
+ for(Iterator itr=this.children.iterator(); itr.hasNext();)
+ {
+ Object child = itr.next();
+
+ if(child instanceof Window)
+ {
+ windows.add(child);
+ }
+ }
+ }
+
+ return windows;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public List getContainers()
+ {
+ return containers;
+ }
+
+ /**
+ *
+ * @param containers
+ */
+ public void setContainers(List containers)
+ {
+ this.containers = containers;
+ }
+
+ /**
+ *
+ * @param container
+ */
+ public void addContainer(Container container)
+ {
+ this.getContainers().add(container);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public boolean isCurrentlyDisplayed()
+ {
+ return currentlyDisplayed;
+ }
+
+ /**
+ *
+ * @param currentlyDisplayed
+ */
+ public void setCurrentlyDisplayed(boolean currentlyDisplayed)
+ {
+ this.currentlyDisplayed = currentlyDisplayed;
+ }
}
Modified:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/PortalObject.java
===================================================================
---
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/PortalObject.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/PortalObject.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -23,9 +23,11 @@
package org.jboss.portal.uiserver.protocol;
import java.io.Serializable;
+import java.util.Map;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.HashMap;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -37,6 +39,7 @@
protected String name = null;
protected PortalObject parent = null;
protected Collection children = null;
+ protected Map properties = null;
/**
*
@@ -45,6 +48,7 @@
public PortalObject()
{
this.children = new ArrayList();
+ this.properties = new HashMap(5);
}
/**
@@ -172,7 +176,25 @@
/**
*
+ * @return
+ */
+ public Map getProperties()
+ {
+ return properties;
+ }
+
+ /**
+ *
+ * @param properties
*/
+ public void setProperties(Map properties)
+ {
+ this.properties = properties;
+ }
+
+ /**
+ *
+ */
public String toString()
{
String rep = null;
Modified:
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Window.java
===================================================================
---
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Window.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/core-uiserver/src/main/org/jboss/portal/uiserver/protocol/Window.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -22,18 +22,219 @@
******************************************************************************/
package org.jboss.portal.uiserver.protocol;
+import java.util.Map;
+import java.util.HashMap;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
-public class Window extends PortalObject
+public class Window extends PortalObject implements Component
{
/**
+ * Title for this Window
+ */
+ private String title = null;
+
+ /**
+ * Content/Markup to be displayed inside this Window
+ */
+ private String content = null;
+
+ /**
+ * Content/Markup related to the header of this Window
+ */
+ private final String headerContent;
+
+ /**
+ * The State of this Window such as Normal, Maximized, Minimized etc
+ */
+ private final WindowState windowState;
+
+ /**
+ * The Mode of this Window such as View, Edit, Help etc
+ */
+ private final Mode mode;
+
+ /**
+ * Runtime View related meta data associated with this particular window.
*
+ * The meta data is provided in the form of Name/Value pairs with Name being the key
of the and Value being the Value
+ * of a Map entry
*/
+ private Map viewMetaData = null;
+
+
+ /**
+ *
+ *
+ */
+ public Window()
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.headerContent = null;
+ this.windowState = null;
+ this.mode = null;
+ }
+
+ /**
+ *
+ *
+ */
+ public Window(String id,String title, String content, String headerContent,
WindowState windowState, Mode mode)
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.id = id;
+ this.title = title;
+ this.content = content;
+ this.headerContent = headerContent;
+ this.windowState = windowState;
+ this.mode = mode;
+ }
+
+ /**
+ *
+ * @param id
+ * @param content
+ */
+ public Window(String id, String content)
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.id = id;
+ this.content = content;
+ this.headerContent = null;
+ this.windowState = null;
+ this.mode = null;
+ }
+
+ /**
+ *
+ * @param id
+ * @param content
+ */
+ public Window(String id)
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.id = id;
+ this.headerContent = null;
+ this.windowState = null;
+ this.mode = null;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getContent()
+ {
+ return content;
+ }
+
+
+ /**
+ *
+ * @param content
+ */
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getHeaderContent()
+ {
+ return headerContent;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+
+
+ /**
+ *
+ * @param title
+ */
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+
+ /**
+ *
+ */
public String toString()
{
return "Window: "+super.toString();
}
+
+ /**
+ *
+ */
+ public String getMarkup()
+ {
+ String markup = "";
+
+ markup = this.content;
+
+ return markup;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map getViewMetaData()
+ {
+ return viewMetaData;
+ }
+
+ /**
+ *
+ * @param viewMetaData
+ */
+ public void setViewMetaData(Map viewMetaData)
+ {
+ this.viewMetaData = viewMetaData;
+ }
}
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestFlexibleGrid.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestFlexibleGrid.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestFlexibleGrid.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -28,9 +28,9 @@
import java.io.FileOutputStream;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Window;
-import org.jboss.portal.uiserver.layout.Page;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Window;
+import org.jboss.portal.uiserver.protocol.Page;
import org.jboss.portal.uiserver.layout.classic.FlexibleGrid;
import org.jboss.portal.uiserver.layout.classic.FlexibleGridConstraints;
import org.jboss.portal.uiserver.layout.classic.FlexibleGridLayoutManager;
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestRegionLayoutManager.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestRegionLayoutManager.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/test/uiserver/layout/TestRegionLayoutManager.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -28,9 +28,9 @@
import java.io.FileOutputStream;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Window;
-import org.jboss.portal.uiserver.layout.Page;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Window;
+import org.jboss.portal.uiserver.protocol.Page;
import org.jboss.portal.uiserver.layout.classic.RegionConstraints;
import org.jboss.portal.uiserver.layout.classic.RegionLayoutManager;
Deleted:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Component.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Component.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Component.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -1,73 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.uiserver.layout;
-
-import java.io.Serializable;
-
-/**
- * Component represents a UI entity that will be rendered eventually on the client
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public abstract class Component implements Serializable
-{
- /**
- * required unique id of the component. uniqueness in relation to
- * other components added to the same instance of the container
- */
- protected String id = null;
-
- /**
- *
- * @param id
- */
- public Component(String id)
- {
- this.id = id;
- }
-
- /**
- *
- * @return
- */
- public String getId()
- {
- return id;
- }
-
- /**
- *
- * @param id
- */
- public void setId(String id)
- {
- this.id = id;
- }
-
- /**
- *
- * @return
- */
- public abstract String getMarkup();
-}
Deleted:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Container.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Container.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Container.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -1,134 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.uiserver.layout;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Container is an organizational entity which aggregates the Components that will be
rendered on the client
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class Container implements Serializable
-{
- /**
- * required unique id of the container. uniqueness in relation to
- * other containers added to the same instance of the page
- */
- protected String id = null;
-
-
- /**
- *
- */
- private List components = null;
-
- /**
- *
- *
- */
- public Container(String id)
- {
- this.id = id;
- this.components = new ArrayList();
- }
-
- /**
- *
- * @return
- */
- public String getId()
- {
- return id;
- }
-
- /**
- *
- * @param id
- */
- public void setId(String id)
- {
- this.id = id;
- }
-
-
- /**
- *
- * @return
- */
- public List getComponents()
- {
- return components;
- }
-
- /**
- *
- * @param components
- */
- public void setComponents(List components)
- {
- this.components = components;
- }
-
- /**
- *
- * @param componentId
- * @return
- */
- public Component getComponent(String componentId)
- {
- Component component = null;
-
- if(this.components != null)
- {
- for(int i=0;i<this.components.size();i++)
- {
- Component cour = (Component)this.components.get(i);
- if(cour.getId().equals(componentId))
- {
- component = cour;
- break;
- }
- }
- }
-
- return component;
- }
-
- /**
- *
- * @param component
- */
- public void addComponent(Component component)
- {
- if(this.components == null)
- {
- this.components = new ArrayList();
- }
-
- this.components.add(component);
- }
-}
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutManager.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutManager.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutManager.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.uiserver.layout;
+import org.jboss.portal.uiserver.protocol.Page;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutService.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutService.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/LayoutService.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.uiserver.layout;
+import org.jboss.portal.uiserver.protocol.Page;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Page.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Page.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Page.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -1,83 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.uiserver.layout;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * A Page is a domain level representation of the final output produced by the Portal.
- *
- * It aggregates the output of multiple containers. It is decoupled from any particular
LayoutManager
- *
- * Eventually the LayoutService processes an instance of a Page to properly layout the
containers depending on
- * the layout strategy of the LayoutManager
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class Page implements Serializable
-{
- /**
- * A page consists of multiple containers that are to be displayed/aggregated along
with their corresponding
- * UI components
- */
- private List containers = null;
-
- /**
- *
- *
- */
- public Page()
- {
- this.containers = new ArrayList();
- }
-
- /**
- *
- * @return
- */
- public List getContainers()
- {
- return containers;
- }
-
- /**
- *
- * @param containers
- */
- public void setContainers(List containers)
- {
- this.containers = containers;
- }
-
- /**
- *
- * @param container
- */
- public void addContainer(Container container)
- {
- this.getContainers().add(container);
- }
-}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Window.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Window.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/Window.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -1,87 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.uiserver.layout;
-
-/**
- * Window is a UI component which represents a Portlet Window and its corresponding
markup which will be eventually rendered on the client
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class Window extends Component
-{
- /**
- *
- */
- private String content = null;
-
- /**
- *
- * @param id
- */
- public Window(String id)
- {
- super(id);
- }
-
- /**
- *
- * @param id
- * @param content markup content produced by a portlet to be displayed inside this
window
- */
- public Window(String id,String content)
- {
- this(id);
- this.content = content;
- }
-
- /**
- *
- * @return
- */
- public String getContent()
- {
- return content;
- }
-
- /**
- *
- * @param content
- */
- public void setContent(String content)
- {
- this.content = content;
- }
-
- /**
- *
- */
- public String getMarkup()
- {
- String markup = "";
-
- markup = this.content;
-
- return markup;
- }
-}
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGrid.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGrid.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGrid.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -24,8 +24,8 @@
import org.apache.log4j.Logger;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Window;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Window;
import java.io.Serializable;
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGridLayoutManager.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGridLayoutManager.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/FlexibleGridLayoutManager.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -22,10 +22,11 @@
******************************************************************************/
package org.jboss.portal.uiserver.layout.classic;
-import org.jboss.portal.uiserver.layout.Container;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Page;
import org.jboss.portal.uiserver.layout.LayoutManager;
-import org.jboss.portal.uiserver.layout.Page;
+
import java.util.List;
import java.util.ArrayList;
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/RegionLayoutManager.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/RegionLayoutManager.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/layout/classic/RegionLayoutManager.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -26,9 +26,9 @@
import java.util.ArrayList;
import org.jboss.portal.uiserver.layout.LayoutManager;
-import org.jboss.portal.uiserver.layout.Page;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Window;
+import org.jboss.portal.uiserver.protocol.Page;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Window;
/**
* This layout manager splits the page up into Regions. Containers which contain the
Portlet Windows
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-10-15
15:21:39 UTC (rev 8659)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-10-15
19:28:21 UTC (rev 8660)
@@ -32,9 +32,11 @@
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.portal.uiserver.layout.Container;
-import org.jboss.portal.uiserver.layout.Page;
-import org.jboss.portal.uiserver.layout.Window;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Page;
+import org.jboss.portal.uiserver.protocol.Window;
+import org.jboss.portal.uiserver.protocol.PortalObject;
+import org.jboss.portal.uiserver.protocol.Portal;
import org.jboss.portal.uiserver.layout.LayoutManager;
import org.jboss.portal.uiserver.layout.classic.FlexibleGrid;
import org.jboss.portal.uiserver.layout.classic.FlexibleGridConstraints;
@@ -42,13 +44,10 @@
import org.jboss.portal.uiserver.layout.classic.RegionLayoutManager;
import org.jboss.portal.uiserver.layout.classic.RegionConstraints;
-import org.jboss.portal.uiserver.protocol.PageResult;
-import org.jboss.portal.uiserver.protocol.WindowResult;
-import org.jboss.portal.uiserver.protocol.PortalObject;
-import org.jboss.portal.uiserver.protocol.Portal;
import org.jboss.portal.uiserver.processor.Processor;
import org.jboss.portal.uiserver.processor.ProcessorRequest;
+import org.jboss.portal.uiserver.processor.ProcessorResponse;
import org.jboss.portal.uiserver.spi.PortalObjectReader;
import org.jboss.portal.jems.as.system.AbstractJBossService;
@@ -94,74 +93,128 @@
*
*/
public void handle(ServerInvocation invocation) throws ServerException
- {
- String portalRequestPath = invocation.getServerContext().getPortalRequestPath();
-
- //Process the incoming request and produce a proper ProcessorRequest to be
- //processed by the core Portal component
- Portal portal = null;
- PortalObject target = null;
- String actionType = "render";
- StringTokenizer st = new StringTokenizer(portalRequestPath, "/");
- StringBuffer buffer = new StringBuffer("/");
- while(st.hasMoreTokens())
+ {
+ try
{
- String token = st.nextToken();
- if(portal == null)
+ String portalRequestPath =
invocation.getServerContext().getPortalRequestPath();
+
+ //Process the incoming request and produce a proper ProcessorRequest to be
+ //processed by the core Portal component
+ Portal portal = null;
+ PortalObject target = null;
+ String actionType = "render";
+ StringTokenizer st = new StringTokenizer(portalRequestPath, "/");
+ StringBuffer buffer = new StringBuffer("/");
+ while(st.hasMoreTokens())
{
- portal = this.portalObjectReader.findPortal(token);
- if(portal != null)
+ String token = st.nextToken();
+ if(portal == null)
{
+ portal = this.portalObjectReader.findPortal(token);
+ if(portal != null)
+ {
+ buffer.append(token);
+ if(st.hasMoreTokens())
+ {
+ buffer.append("/");
+ }
+ }
+ }
+ else
+ {
buffer.append(token);
+ String id = buffer.toString();
if(st.hasMoreTokens())
{
buffer.append("/");
}
- }
- }
- else
- {
- buffer.append(token);
- String id = buffer.toString();
- if(st.hasMoreTokens())
- {
- buffer.append("/");
- }
-
- if(target == null)
- {
- target = portal.findChild(id);
+
if(target == null)
{
- target = this.portalObjectReader.findPortalObject(portal, id);
+ target = portal.findChild(id);
+ if(target == null)
+ {
+ target = this.portalObjectReader.findPortalObject(portal, id);
+ }
}
- }
- else
- {
- PortalObject cour = target.findChild(id);
- if(cour == null)
- {
- target = this.portalObjectReader.findPortalObject(target, id);
- }
else
{
- target = cour;
+ PortalObject cour = target.findChild(id);
+ if(cour == null)
+ {
+ target = this.portalObjectReader.findPortalObject(target, id);
+ }
+ else
+ {
+ target = cour;
+ }
}
+ }
+ }
+
+ String actionParam =
invocation.getServerContext().getClientRequest().getParameter("action");
+ if(actionParam != null && actionParam.trim().length()>0 &&
actionParam.equals("1"))
+ {
+ actionType = "action";
+ }
+
+ ProcessorRequest processorRequest = new ProcessorRequest(actionType, invocation,
portal, target);
+ ProcessorResponse processorResponse = this.processor.process(processorRequest);
+
+ //Go ahead and render to the client based on ProcessorResponse received from the
core Portal
+ if(processorResponse != null)
+ {
+ Page displayedPage = processorResponse.findDisplayedPage();
+ if(displayedPage != null)
+ {
+ this.render(invocation.getServerContext().getClientResponse().getWriter(),
+ displayedPage);
}
- }
- }
-
- String actionParam =
invocation.getServerContext().getClientRequest().getParameter("action");
- if(actionParam != null && actionParam.trim().length()>0 &&
actionParam.equals("1"))
+ }
+ }
+ catch(Exception e)
{
- actionType = "action";
+ throw new ServerException(e);
}
-
- ProcessorRequest processorRequest = new ProcessorRequest(actionType, invocation,
portal, target);
- this.processor.process(processorRequest);
+ }
+
//-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public PortalObjectReader getPortalObjectReader()
+ {
+ return portalObjectReader;
}
/**
+ *
+ * @param portalObjectReader
+ */
+ public void setPortalObjectReader(PortalObjectReader portalObjectReader)
+ {
+ this.portalObjectReader = portalObjectReader;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Processor getProcessor()
+ {
+ return processor;
+ }
+
+ /**
+ *
+ * @param processor
+ */
+ public void setProcessor(Processor processor)
+ {
+ this.processor = processor;
+ }
+ //---------All these are just helper methods for the
prototype-----------------------------------------------------------------------------------------------
+ //----It containts mostly hard coded logic for the
prototype-------------------------------------------------------------------------------------------------
+ /**
* Based on the latest design discussion, this method is not needed.
*
* This will be an implementation detail of the UIServer processing the Response that
is sent back to it
@@ -170,7 +223,7 @@
* @param clientConnection
* @param page
*/
- public void render(PrintWriter clientConnection, PageResult pageResult)
+ private void render(PrintWriter clientConnection, Page pageResult)
{
/**
* Special Note: Currently this prototype code and layout configuration including
page result creation is hard coded for the purpose
@@ -183,20 +236,19 @@
*
*/
-
/**
* Some flexible grid layout testing code
*/
- //Object[] gridData = this.getFlexibleGridLayoutManager(pageResult);
- //Page page = (Page)gridData[0];
- //LayoutManager layoutManager = (LayoutManager)gridData[1];
+ Object[] gridData = this.getFlexibleGridLayoutManager(pageResult);
+ Page page = (Page)gridData[0];
+ LayoutManager layoutManager = (LayoutManager)gridData[1];
/**
* Some region layout testing code
*/
- Object[] regionData = this.getRegionBasedLayoutManager(pageResult);
- Page page = (Page)regionData[0];
- LayoutManager layoutManager = (LayoutManager)regionData[1];
+ //Object[] regionData = this.getRegionBasedLayoutManager(pageResult);
+ //Page page = (Page)regionData[0];
+ //LayoutManager layoutManager = (LayoutManager)regionData[1];
//Peform Page Layout
String output = layoutManager.doLayout(page);
@@ -212,49 +264,13 @@
//Sending the results back to the Client
clientConnection.write(buffer.toString());
clientConnection.flush();
- }
-
//-----------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- *
- */
- public PortalObjectReader getPortalObjectReader()
- {
- return portalObjectReader;
}
-
+
/**
*
- * @param portalObjectReader
*/
- public void setPortalObjectReader(PortalObjectReader portalObjectReader)
+ private Object[] getFlexibleGridLayoutManager(Page pageResult)
{
- this.portalObjectReader = portalObjectReader;
- }
-
- /**
- *
- * @return
- */
- public Processor getProcessor()
- {
- return processor;
- }
-
- /**
- *
- * @param processor
- */
- public void setProcessor(Processor processor)
- {
- this.processor = processor;
- }
- //---------All these are just helper methods for the
prototype-----------------------------------------------------------------------------------------------
- //----It containts mostly hard coded logic for the
prototype-------------------------------------------------------------------------------------------------
- /**
- *
- */
- private Object[] getFlexibleGridLayoutManager(PageResult pageResult)
- {
/**
* Hard coding the FlexibleGridLayout Management here
*/
@@ -305,7 +321,7 @@
int counter = 0;
for(Iterator itr=windows.iterator();itr.hasNext();)
{
- WindowResult result = (WindowResult)itr.next();
+ Window result = (Window)itr.next();
switch(counter)
{
@@ -380,7 +396,7 @@
* @param pageResult
* @return
*/
- private Object[] getRegionBasedLayoutManager(PageResult pageResult)
+ private Object[] getRegionBasedLayoutManager(Page pageResult)
{
Page page = new Page();
Container left = new Container("left");
@@ -393,7 +409,7 @@
int counter = 0;
for(Iterator itr=windows.iterator();itr.hasNext();)
{
- WindowResult result = (WindowResult)itr.next();
+ Window result = (Window)itr.next();
Window uiWindow = new Window(result.getId());
uiWindow.setContent(result.getContent());
switch(counter)