From portal-commits at lists.jboss.org Tue Nov 13 11:25:07 2007 Content-Type: multipart/mixed; boundary="===============2521413451279150878==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r8903 - in branches/UIServer: uiserver/src/main/org/jboss/portal/presentation/action/server and 2 other directories. Date: Tue, 13 Nov 2007 11:25:06 -0500 Message-ID: --===============2521413451279150878== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: sohil.shah(a)jboss.com Date: 2007-11-13 11:25:06 -0500 (Tue, 13 Nov 2007) New Revision: 8903 Modified: branches/UIServer/core/src/main/org/jboss/portal/core/presentation/serve= r/MainProcessor.java branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action= /server/LinkActivation.java branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server= /Processor.java branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server= /ProcessorRequest.java branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UI= Server.java Log: refactoring Modified: branches/UIServer/core/src/main/org/jboss/portal/core/presentatio= n/server/MainProcessor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/UIServer/core/src/main/org/jboss/portal/core/presentation/serv= er/MainProcessor.java 2007-11-13 15:43:48 UTC (rev 8902) +++ branches/UIServer/core/src/main/org/jboss/portal/core/presentation/serv= er/MainProcessor.java 2007-11-13 16:25:06 UTC (rev 8903) @@ -45,6 +45,7 @@ import org.jboss.portal.theme.page.WindowContext; import org.jboss.portal.theme.page.WindowResult; = +import org.jboss.portal.presentation.RequestContext; import org.jboss.portal.presentation.server.Processor; import org.jboss.portal.presentation.server.ProcessorRequest; import org.jboss.portal.presentation.server.ProcessorResponse; @@ -88,7 +89,7 @@ /** * = */ - public ProcessorResponse process(ProcessorRequest request) throws Serve= rException + public ProcessorResponse process(RequestContext requestContext, Process= orRequest request) throws ServerException { = try { Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation= /action/server/LinkActivation.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/actio= n/server/LinkActivation.java 2007-11-13 15:43:48 UTC (rev 8902) +++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/actio= n/server/LinkActivation.java 2007-11-13 16:25:06 UTC (rev 8903) @@ -24,6 +24,9 @@ = import java.util.Map; = +import org.jboss.portal.uiserver.protocol.Portal; +import org.jboss.portal.uiserver.protocol.PortalObject; + /** * @author Sohil Shah * @@ -43,7 +46,17 @@ /** * = */ - protected Map queryParameters =3D null; = + protected Map queryParameters =3D null; = + = + /** + * The Portal that the target object belongs to + */ + protected Portal portal =3D null; + = + /** + * Target object where action needs to be performed + */ + protected PortalObject target =3D null; = /** * = @@ -98,4 +111,40 @@ { this.url =3D url; } + + /** + * = + * @return + */ + public Portal getPortal() + { + return portal; + } + + /** + * = + * @param portal + */ + public void setPortal(Portal portal) + { + this.portal =3D portal; + } + + /** + * = + * @return + */ + public PortalObject getTarget() + { + return target; + } + + /** + * = + * @param target + */ + public void setTarget(PortalObject target) + { + this.target =3D target; + } } Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation= /server/Processor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/serve= r/Processor.java 2007-11-13 15:43:48 UTC (rev 8902) +++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/serve= r/Processor.java 2007-11-13 16:25:06 UTC (rev 8903) @@ -23,6 +23,7 @@ package org.jboss.portal.presentation.server; = import org.jboss.portal.server.ServerException; +import org.jboss.portal.presentation.RequestContext; = /** * UIServer calls the Processor to hand it = @@ -39,5 +40,5 @@ * @param request * @throws ServerException */ - public ProcessorResponse process(ProcessorRequest request) throws Serve= rException; + public ProcessorResponse process(RequestContext requestContext,Processo= rRequest request) throws ServerException; } Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation= /server/ProcessorRequest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/serve= r/ProcessorRequest.java 2007-11-13 15:43:48 UTC (rev 8902) +++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/serve= r/ProcessorRequest.java 2007-11-13 16:25:06 UTC (rev 8903) @@ -24,8 +24,6 @@ = import java.io.Serializable; = -import org.jboss.portal.uiserver.protocol.Portal; -import org.jboss.portal.uiserver.protocol.PortalObject; import org.jboss.portal.server.ServerInvocation; import org.jboss.portal.presentation.action.server.ServerAction; = @@ -39,18 +37,8 @@ * */ public class ProcessorRequest implements Serializable -{ = +{ = /** - * The Portal that the target object belongs to - */ - private Portal portal =3D null; - = - /** - * Target object where action needs to be performed - */ - private PortalObject target =3D null; - = - /** * The Portal action to be performed */ private ServerAction action =3D null; @@ -64,12 +52,10 @@ * = * */ - public ProcessorRequest(ServerAction action, ServerInvocation serverInv= ocation, Portal portal, PortalObject target) + public ProcessorRequest(ServerAction action, ServerInvocation serverInv= ocation) { this.action =3D action; - this.serverInvocation =3D serverInvocation; - this.portal =3D portal; - this.target =3D target; + this.serverInvocation =3D serverInvocation; = } = /** @@ -94,42 +80,6 @@ * = * @return */ - public Portal getPortal() - { - return portal; - } - - /** - * = - * @param portal - */ - public void setPortal(Portal portal) - { - this.portal =3D portal; - } - - /** - * = - * @return - */ - public PortalObject getTarget() - { - return target; - } - - /** - * = - * @param target - */ - public void setTarget(PortalObject target) - { - this.target =3D target; - } - - /** - * = - * @return - */ public ServerInvocation getServerInvocation() { return serverInvocation; @@ -150,7 +100,7 @@ public String toString() { StringBuffer buffer =3D new StringBuffer(); - buffer.append("[action=3D"+this.action+", portal=3D"+this.portal+", = target=3D"+this.target+"]"); + buffer.append("[action=3D"+this.action+"]"); return buffer.toString(); } } Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ser= vice/UIServer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/U= IServer.java 2007-11-13 15:43:48 UTC (rev 8902) +++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/U= IServer.java 2007-11-13 16:25:06 UTC (rev 8903) @@ -29,10 +29,13 @@ import org.jboss.portal.uiserver.protocol.PortalObject; import org.jboss.portal.uiserver.protocol.Portal; = +import org.jboss.portal.presentation.RequestContext; + import org.jboss.portal.presentation.server.ProcessorRequest; import org.jboss.portal.presentation.server.ProcessorResponse; import org.jboss.portal.presentation.server.PresentationServer; import org.jboss.portal.presentation.action.server.ServerAction; +import org.jboss.portal.presentation.action.server.LinkActivation; import org.jboss.portal.presentation.action.server.GetActivation; import org.jboss.portal.presentation.action.server.PostActivation; = @@ -77,65 +80,12 @@ public void handle(ServerInvocation invocation) throws ServerException { = try - { - String portalRequestPath =3D invocation.getServerContext().getPor= talRequestPath(); - = - //Process the incoming request and produce a proper ProcessorRequ= est to be - //processed by the core Portal component = - Portal portal =3D null; - PortalObject target =3D null; - StringTokenizer st =3D new StringTokenizer(portalRequestPath, "/"= ); - StringBuffer buffer =3D new StringBuffer("/"); - while(st.hasMoreTokens()) - { - String token =3D st.nextToken(); = - if(portal =3D=3D null) - { - portal =3D this.presentationServer.getPortalObjectReader().= findPortal(token); - if(portal !=3D null) - { - buffer.append(token); - if(st.hasMoreTokens()) - { - buffer.append("/"); - } - } - } - else - { - buffer.append(token); - String id =3D buffer.toString(); - if(st.hasMoreTokens()) - { - buffer.append("/"); - } - = - if(target =3D=3D null) - { - target =3D portal.findChild(id); - if(target =3D=3D null) - { - target =3D this.presentationServer.getPortalObjectRea= der().findPortalObject(portal, id); - } - } - else - { - PortalObject cour =3D target.findChild(id); - if(cour =3D=3D null) - { - target =3D this.presentationServer.getPortalObjectRea= der().findPortalObject(target, id); - } - else - { - target =3D cour; - } - } - } = - } = - = + { = ServerAction serverAction =3D this.getServerAction(invocation); - ProcessorRequest processorRequest =3D new ProcessorRequest(server= Action, invocation, portal, target); - ProcessorResponse processorResponse =3D this.presentationServer.g= etProcessor().process(processorRequest); + ProcessorRequest processorRequest =3D new ProcessorRequest(server= Action, invocation); + RequestContext requestContext =3D null; //Just use null until pro= per implementation is provided + ProcessorResponse processorResponse =3D this.presentationServer.g= etProcessor().process(requestContext, + processorRequest); = //Go ahead and render to the client based on ProcessorResponse re= ceived from the core Portal = if(processorResponse !=3D null) @@ -209,7 +159,75 @@ post.setQueryParameters(invocationContext.getQueryParameterMap()); post.setBodyParameters(invocationContext.getBodyParameterMap()); serverAction =3D post; - } = + } = + = + //If this is a link activation, then interpret the Portal and the Po= rtalObject that + //this link is targetted for + if(serverAction instanceof LinkActivation) + { + String portalRequestPath =3D invocation.getServerContext().getPor= talRequestPath(); + = + //Process the incoming request and produce a proper ProcessorRequ= est to be + //processed by the core Portal component = + Portal portal =3D null; + PortalObject target =3D null; + StringTokenizer st =3D new StringTokenizer(portalRequestPath, "/"= ); + StringBuffer buffer =3D new StringBuffer("/"); + while(st.hasMoreTokens()) + { + String token =3D st.nextToken(); = + if(portal =3D=3D null) + { + portal =3D this.presentationServer.getPortalObjectReader().= findPortal(token); + if(portal !=3D null) + { + buffer.append(token); + if(st.hasMoreTokens()) + { + buffer.append("/"); + } + } + } + else + { + buffer.append(token); + String id =3D buffer.toString(); + if(st.hasMoreTokens()) + { + buffer.append("/"); + } + = + if(target =3D=3D null) + { + target =3D portal.findChild(id); + if(target =3D=3D null) + { + target =3D this.presentationServer.getPortalObjectRea= der().findPortalObject(portal, id); + } + } + else + { + PortalObject cour =3D target.findChild(id); + if(cour =3D=3D null) + { + target =3D this.presentationServer.getPortalObjectRea= der().findPortalObject(target, id); + } + else + { + target =3D cour; + } + } + } = + } + = + //Setting up the proper targets for this link + ((LinkActivation)serverAction).setPortal(portal); + ((LinkActivation)serverAction).setTarget(target); + } + = + = return serverAction; } + = + = } --===============2521413451279150878==--