Author: sohil.shah(a)jboss.com
Date: 2007-08-30 01:40:15 -0400 (Thu, 30 Aug 2007)
New Revision: 8108
Added:
branches/UIServer/core/src/main/org/jboss/portal/core/processor/
branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java
branches/UIServer/core/src/main/org/jboss/portal/core/processor/Processor.java
branches/UIServer/core/src/main/org/jboss/portal/core/processor/ProcessorRequest.java
Modified:
branches/UIServer/build/build.xml
branches/UIServer/core/build.xml
branches/UIServer/core/src/main/org/jboss/portal/core/theme/PageRendition.java
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/UIServer/uiserver/build.xml
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
Log:
Prototype architecture for modeling the HTTP -> UIServer -> Core Portal interaction
Modified: branches/UIServer/build/build.xml
===================================================================
--- branches/UIServer/build/build.xml 2007-08-30 00:19:03 UTC (rev 8107)
+++ branches/UIServer/build/build.xml 2007-08-30 05:40:15 UTC (rev 8108)
@@ -145,7 +145,7 @@
<group name="portal">
<include
- modules="common, test, api, web, jems, server, security, identity,
search, format, portlet, portlet-server, bridge, faces, portlet-federation, theme,
workflow, cms, registration, uiserver, core, wsrp, core-admin, core-cms, core-management,
core-samples, widget"/>
+ modules="common, test, api, web, jems, server, security, identity,
search, format, portlet, portlet-server, bridge, faces, portlet-federation, theme,
workflow, cms, registration, core, uiserver, wsrp, core-admin, core-cms, core-management,
core-samples, widget"/>
</group>
<group name="cms">
Modified: branches/UIServer/core/build.xml
===================================================================
--- branches/UIServer/core/build.xml 2007-08-30 00:19:03 UTC (rev 8107)
+++ branches/UIServer/core/build.xml 2007-08-30 05:40:15 UTC (rev 8108)
@@ -133,7 +133,9 @@
<path refid="jboss.portlet-api.classpath"/>
<path refid="jboss.portal-theme.classpath"/>
<path refid="jboss.portal-security.classpath"/>
+ <!--
<path refid="jboss.portal-uiserver.classpath"/>
+ -->
<path refid="jboss.portal-test.classpath"/>
</path>
@@ -334,8 +336,7 @@
<fileset dir="${jboss.portal-security.root}/lib"
includes="portal-security-lib.jar"/>
<fileset dir="${jboss.portal-search.root}/lib"
includes="portal-search-lib.jar"/>
<fileset dir="${jboss.portal-identity.root}/lib"
includes="portal-identity-lib.jar"/>
- <fileset dir="${jboss.portal-registration.root}/lib"
includes="portal-registration-lib.jar"/>
- <fileset dir="${jboss.portal-uiserver.root}/lib"
includes="portal-uiserver-lib.jar"/>
+ <fileset dir="${jboss.portal-registration.root}/lib"
includes="portal-registration-lib.jar"/>
<fileset dir="${ehcache.ehcache.lib}"
includes="ehcache.jar"/>
<fileset dir="${apache.collections.lib}"
includes="commons-collections.jar"/>
<fileset dir="${javassist.javassist.lib}"
includes="javassist.jar"/>
@@ -382,6 +383,13 @@
<!-- Build the jboss-portal.sar -->
<target name="output" depends="artifacts">
+ <copy todir="${build.resources}/jboss-portal/lib">
+ <fileset dir="${jboss.portal-uiserver.root}/lib"
includes="portal-uiserver-lib.jar"/>
+ </copy>
+ <copy todir="${build.resources}/jboss-portal.sar/lib">
+ <fileset dir="${jboss.portal-uiserver.root}/lib"
includes="portal-uiserver-lib.jar"/>
+ </copy>
+
<!-- Build configurations -->
<copy todir="${build.resources}/jboss-portal.sar">
<fileset dir="${build.resources}/jboss-portal"
excludes="**/*.xml"/>
@@ -731,11 +739,11 @@
<!--
Some convenience build targets to help deployment during development
-->
- <target name="deploy-explode" depends="output,explode">
+ <target name="deploy-explode" depends="output,explode">
<require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <copy
todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar"
overwrite="true">
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar"
overwrite="true">
<fileset dir="${build.lib}/jboss-portal-exploded.sar"/>
- </copy>
+ </copy>
</target>
<target name="explode-ha" depends="init">
<explode
Added: branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java
(rev 0)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/processor/MainProcessor.java 2007-08-30
05:40:15 UTC (rev 8108)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.processor;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.server.RequestControllerDispatcher;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.RequestController;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MainProcessor extends AbstractJBossService implements Processor
+{
+ /**
+ *
+ */
+ private RequestController temp = null;
+
+
+ /**
+ *
+ */
+ public void 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
+
+
+ //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
+ System.out.println(request);
+ request.getServerInvocation().setHandler(new
RequestControllerDispatcher(this.temp));
+ request.getServerInvocation().invokeNext();
+ }
+ catch(Exception e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ public RequestController getTemp()
+ {
+ return temp;
+ }
+
+ /**
+ *
+ * @param temp
+ */
+ public void setTemp(RequestController temp)
+ {
+ this.temp = temp;
+ }
+}
Added: branches/UIServer/core/src/main/org/jboss/portal/core/processor/Processor.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/processor/Processor.java
(rev 0)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/processor/Processor.java 2007-08-30
05:40:15 UTC (rev 8108)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.processor;
+
+import org.jboss.portal.server.ServerException;
+
+/**
+ * Processor is the service exposed by the Core Portal to the UIServer. UIServer calls
the Processor to hand it
+ * processing of an incoming Portal Request using the protocol between the two
components
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface Processor
+{
+ public void process(ProcessorRequest request) throws ServerException;
+}
Added:
branches/UIServer/core/src/main/org/jboss/portal/core/processor/ProcessorRequest.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/processor/ProcessorRequest.java
(rev 0)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/processor/ProcessorRequest.java 2007-08-30
05:40:15 UTC (rev 8108)
@@ -0,0 +1,153 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.processor;
+
+import java.io.Serializable;
+
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.server.ServerInvocation;
+
+
+/**
+ * ProcessorRequest is used to communicate information from the UIServer to the core
Portal for it to process the incoming Portal request.
+ *
+ * This object is part of the protocol between the UIServer and the core
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class ProcessorRequest implements Serializable
+{
+ /**
+ * Target object where action needs to be performed
+ */
+ private PortalObject target = null;
+
+ /**
+ * The Portal that the target object belongs to
+ */
+ private Portal portal = null;
+
+ /**
+ * The Portal action to be performed. For now, action and render
+ */
+ private String actionType = null;
+
+
+ private ServerInvocation serverInvocation = null;
+
+ /**
+ *
+ *
+ */
+ public ProcessorRequest(String actionType, ServerInvocation serverInvocation, Portal
portal, PortalObject target)
+ {
+ this.actionType = actionType;
+ this.serverInvocation = serverInvocation;
+ this.portal = portal;
+ this.target = target;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getActionType()
+ {
+ return actionType;
+ }
+
+ /**
+ *
+ * @param actionType
+ */
+ public void setActionType(String actionType)
+ {
+ this.actionType = actionType;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Portal getPortal()
+ {
+ return portal;
+ }
+
+ /**
+ *
+ * @param portal
+ */
+ public void setPortal(Portal portal)
+ {
+ this.portal = portal;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public PortalObject getTarget()
+ {
+ return target;
+ }
+
+ /**
+ *
+ * @param target
+ */
+ public void setTarget(PortalObject target)
+ {
+ this.target = target;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public ServerInvocation getServerInvocation()
+ {
+ return serverInvocation;
+ }
+
+ /**
+ *
+ * @param serverInvocation
+ */
+ public void setServerInvocation(ServerInvocation serverInvocation)
+ {
+ this.serverInvocation = serverInvocation;
+ }
+
+ /**
+ *
+ */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("[actionType="+this.actionType+",
portal="+this.portal+", target="+this.target+"]");
+ return buffer.toString();
+ }
+}
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/theme/PageRendition.java
===================================================================
---
branches/UIServer/core/src/main/org/jboss/portal/core/theme/PageRendition.java 2007-08-30
00:19:03 UTC (rev 8107)
+++
branches/UIServer/core/src/main/org/jboss/portal/core/theme/PageRendition.java 2007-08-30
05:40:15 UTC (rev 8108)
@@ -43,7 +43,7 @@
import java.util.List;
import java.util.ArrayList;
-import org.jboss.portal.uiserver.service.UIServer;
+//import org.jboss.portal.uiserver.service.UIServer;
/**
* Should not be a controller response, but it comes from legacy design.
@@ -81,7 +81,6 @@
/** Performs the page rendition. */
public void render(MarkupInfo markupInfo, ServletContextDispatcher dispatcher) throws
IOException, ServletException
{
- /*
// Compute correct content type response header
//String contentType = rendererContext.getContentType() + "; charset=" +
rendererContext.getCharset();
String contentType = markupInfo.getContentType() + "; charset=" +
markupInfo.getCharset();
@@ -107,8 +106,8 @@
{
e.printStackTrace();
}
- */
+ /*
//Prototyping with the new ui server delegated rendering
UIServer uiServer = new UIServer(); //This will actually be a jmx service...instead
of instantiating the UiServer here
@@ -132,6 +131,7 @@
//Delegate Rendering to the UIServer
uiServer.render(new PrintWriter(dispatcher.getResponse().getOutputStream()),
uiPageResult);
+ */
}
public PageResult getPageResult()
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-08-30
00:19:03 UTC (rev 8107)
+++
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-08-30
05:40:15 UTC (rev 8108)
@@ -1053,7 +1053,7 @@
<!-- The controller -->
<mbean
code="org.jboss.portal.core.controller.Controller"
- name="portal:service=Controller"
+ name="portal:service=Temp"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
@@ -1091,6 +1091,44 @@
optional-attribute-name="PageControlPolicy"
proxy-type="attribute">portal:service=ControlPolicy,type=Page</depends>
</mbean>
+ <mbean
+ code="org.jboss.portal.uiserver.service.UIServer"
+ name="portal:service=Controller"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends optional-attribute-name="PortalObjectContainer"
proxy-type="attribute">portal:container=PortalObject</depends>
+ <depends optional-attribute-name="Processor"
proxy-type="attribute">portal:service=Processor</depends>
+ <depends>portal:service=PageService</depends>
+ <depends>portal:commandFactory=DefaultPortal</depends>
+ <depends>portal:urlFactory=Delegating</depends>
+ <depends>portal:service=InterceptorStackFactory,type=Command</depends>
+ <depends>portal:container=Instance</depends>
+ <depends>portal:service=PortalAuthorizationManagerFactory</depends>
+ <depends>portal:service=CustomizationManager</depends>
+ <depends>portal:service=ContentProviderRegistry</depends>
+ <depends>portal:service=ResponseHandler,type=Selector</depends>
+ <depends>portal:service=ControlPolicy,type=Page</depends>
+ </mbean>
+ <mbean
+ code="org.jboss.portal.core.processor.MainProcessor"
+ name="portal:service=Processor"
+ 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>portal:container=PortalObject</depends>
+ <depends>portal:service=PageService</depends>
+ <depends>portal:commandFactory=DefaultPortal</depends>
+ <depends>portal:urlFactory=Delegating</depends>
+ <depends>portal:service=InterceptorStackFactory,type=Command</depends>
+ <depends>portal:container=Instance</depends>
+ <depends>portal:service=PortalAuthorizationManagerFactory</depends>
+ <depends>portal:service=CustomizationManager</depends>
+ <depends>portal:service=ContentProviderRegistry</depends>
+ <depends>portal:service=ResponseHandler,type=Selector</depends>
+ <depends>portal:service=ControlPolicy,type=Page</depends>
+ </mbean>
<!-- The controller factory -->
<mbean
Modified: branches/UIServer/uiserver/build.xml
===================================================================
--- branches/UIServer/uiserver/build.xml 2007-08-30 00:19:03 UTC (rev 8107)
+++ branches/UIServer/uiserver/build.xml 2007-08-30 05:40:15 UTC (rev 8108)
@@ -102,6 +102,7 @@
<path refid="jboss.portal-server.classpath"/>
<path refid="jboss.portal-theme.classpath"/>
<path refid="jboss.portal-web.classpath"/>
+ <path refid="jboss.portal-core.classpath"/>
</path>
<!--+=======================================+-->
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-08-30
00:19:03 UTC (rev 8107)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-08-30
05:40:15 UTC (rev 8108)
@@ -25,8 +25,14 @@
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;
+import java.util.StringTokenizer;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+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;
@@ -39,6 +45,18 @@
import org.jboss.portal.uiserver.protocol.PageResult;
import org.jboss.portal.uiserver.protocol.WindowResult;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerInvocation;
+
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalContainer;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.processor.Processor;
+import org.jboss.portal.core.processor.ProcessorRequest;
+
/**
* The UIServer is responsible for generating the output that is sent back to the client
based on the Portal state of a particular Portal Request
*
@@ -49,18 +67,80 @@
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
-public class UIServer
+public class UIServer extends AbstractJBossService implements RequestController
{
/**
*
+ */
+ private PortalObjectContainer portalObjectContainer = null;
+
+ /**
+ *
+ */
+ private Processor processor = null;
+
+ /**
+ *
*
*/
public UIServer()
{
}
+
/**
+ * handle is the entry point for handling an incoming Portal request. The request is
handed over
+ * from the Http Layer via the main Portal Servlet
+ *
+ */
+ public void handle(ServerInvocation invocation) throws ServerException
+ {
+ String portalRequestPath = invocation.getServerContext().getPortalRequestPath();
+ PortalContainer container = this.portalObjectContainer.getContext();
+
+ //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, "/");
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+
+ if(portal == null)
+ {
+ portal = container.getPortal(token);
+ }
+ else
+ {
+ if(target == null)
+ {
+ target = portal.getChild(token);
+ }
+ else
+ {
+ target = target.getChild(token);
+ }
+ }
+ }
+
+ 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);
+ this.processor.process(processorRequest);
+ }
+
+ /**
+ * 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
+ * from the Core Portal Processor
+ *
* @param clientConnection
* @param page
*/
@@ -106,9 +186,42 @@
//Sending the results back to the Client
clientConnection.write(buffer.toString());
clientConnection.flush();
+ }
+
//-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public PortalObjectContainer getPortalObjectContainer()
+ {
+ return this.portalObjectContainer;
}
+
+ /**
+ *
+ * @param portalObjectContainer
+ */
+ public void setPortalObjectContainer(PortalObjectContainer portalObjectContainer)
+ {
+ this.portalObjectContainer = portalObjectContainer;
+ }
-
+ /**
+ *
+ * @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-------------------------------------------------------------------------------------------------
/**
@@ -290,5 +403,5 @@
layoutManager.addRegionConstraints(centerConstraints);
return new Object[]{page, layoutManager};
- }
+ }
}