[jboss-svn-commits] JBoss Portal SVN: r5136 - in trunk/core/src: main/org/jboss/portal/core main/org/jboss/portal/core/api main/org/jboss/portal/core/aspects/controller main/org/jboss/portal/core/cms main/org/jboss/portal/core/cms/command main/org/jboss/portal/core/command main/org/jboss/portal/core/controller main/org/jboss/portal/core/controller/command main/org/jboss/portal/core/controller/command/info main/org/jboss/portal/core/controller/command/mapper main/org/jboss/portal/core/controller/portlet main/org/jboss/portal/core/model/portal main/org/jboss/portal/core/portlet/cms main/org/jboss/portal/core/portlet/cms/admin main/org/jboss/portlet resources/portal-cms-sar/META-INF resources/portal-core-sar/META-INF
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Sep 4 11:02:54 EDT 2006
Author: julien at jboss.com
Date: 2006-09-04 11:00:38 -0400 (Mon, 04 Sep 2006)
New Revision: 5136
Added:
trunk/core/src/main/org/jboss/portal/core/controller/
trunk/core/src/main/org/jboss/portal/core/controller/CommandRedirectionException.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerException.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerSecurityException.java
trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java
trunk/core/src/main/org/jboss/portal/core/controller/InsufficientTransportGuaranteeException.java
trunk/core/src/main/org/jboss/portal/core/controller/ResourceAccessDeniedException.java
trunk/core/src/main/org/jboss/portal/core/controller/ResourceNotFoundException.java
trunk/core/src/main/org/jboss/portal/core/controller/command/
trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/MarkupCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/info/
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/
trunk/core/src/main/org/jboss/portal/core/controller/portlet/
trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerActionContext.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletInvocationContext.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerRenderContext.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerUserContext.java
Removed:
trunk/core/src/main/org/jboss/portal/core/CoreController.java
trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java
trunk/core/src/main/org/jboss/portal/core/command/CommandException.java
trunk/core/src/main/org/jboss/portal/core/command/CommandInterceptor.java
trunk/core/src/main/org/jboss/portal/core/command/CommandRedirectionException.java
trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java
trunk/core/src/main/org/jboss/portal/core/command/ControllerSecurityException.java
trunk/core/src/main/org/jboss/portal/core/command/ErrorResultException.java
trunk/core/src/main/org/jboss/portal/core/command/InsufficientTransportGuaranteeException.java
trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java
trunk/core/src/main/org/jboss/portal/core/command/ObjectNotFoundException.java
trunk/core/src/main/org/jboss/portal/core/command/ObjectSecurityException.java
trunk/core/src/main/org/jboss/portal/core/command/PortalObjectCommand.java
trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java
trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/command/WindowCommand.java
trunk/core/src/main/org/jboss/portal/core/command/info/
trunk/core/src/main/org/jboss/portal/core/command/mapper/
trunk/core/src/main/org/jboss/portal/core/command/portlet/
trunk/core/src/main/org/jboss/portal/core/controller/portlet/CoreActionContext.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/CorePortletInvocationContext.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/CoreRenderContext.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/CoreUserContext.java
Modified:
trunk/core/src/main/org/jboss/portal/core/api/PortalNodeURLFactory.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PolicyEnforcementInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java
trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java
trunk/core/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/info/ActionCommandInfo.java
trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java
trunk/core/src/main/org/jboss/portal/core/controller/command/info/ViewCommandInfo.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractURLFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactoryDelegate.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactoryService.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java
trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java
trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java
trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java
trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
refactored core controller/command package to have a cleaner organization.
Deleted: trunk/core/src/main/org/jboss/portal/core/CoreController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/CoreController.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/CoreController.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,432 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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;
-
-import org.jboss.portal.common.invocation.InterceptorStackFactory;
-import org.jboss.portal.common.system.AbstractJBossService;
-import org.jboss.portal.core.command.CommandException;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.ObjectNotFoundException;
-import org.jboss.portal.core.command.RenderPageCommand;
-import org.jboss.portal.core.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.command.CommandContext;
-import org.jboss.portal.core.command.InsufficientTransportGuaranteeException;
-import org.jboss.portal.core.command.ControllerSecurityException;
-import org.jboss.portal.core.command.CommandRedirectionException;
-import org.jboss.portal.core.command.info.CommandInfo;
-import org.jboss.portal.core.command.info.ActionCommandInfo;
-import org.jboss.portal.core.command.mapper.CommandFactory;
-import org.jboss.portal.core.command.mapper.URLFactory;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.output.SignOutResult;
-import org.jboss.portal.core.cms.command.StreamContentCommand;
-import org.jboss.portal.server.RequestController;
-import org.jboss.portal.server.ServerException;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerURL;
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.theme.page.PageService;
-import org.jboss.portal.theme.PageRendition;
-import org.jboss.portal.portlet.result.Result;
-import org.jboss.portal.portlet.result.RenderResult;
-import org.jboss.portal.portlet.result.HTTPRedirectionResult;
-import org.jboss.portal.portlet.result.InsufficientTransportGuaranteeResult;
-import org.jboss.portal.portlet.result.InsufficientPrivilegesResult;
-import org.jboss.portal.portlet.result.ErrorResult;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-import java.io.IOException;
-
-/**
- *
- * @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class CoreController extends AbstractJBossService implements RequestController
-{
-
- /** . */
- private PageService pageService;
-
- /** . */
- private CommandFactory commandFactory;
-
- /** . */
- private URLFactory urlFactory;
-
- /** . */
- private InterceptorStackFactory stackFactory;
-
- /** . */
- private PortalObjectContainer portalObjectContainer;
-
- /** . */
- private InstanceContainer instanceContainer;
-
- public InstanceContainer getInstanceContainer()
- {
- return instanceContainer;
- }
-
- public void setInstanceContainer(InstanceContainer instanceContainer)
- {
- this.instanceContainer = instanceContainer;
- }
-
- public PortalObjectContainer getPortalObjectContainer()
- {
- return portalObjectContainer;
- }
-
- public void setPortalObjectContainer(PortalObjectContainer portalObjectContainer)
- {
- this.portalObjectContainer = portalObjectContainer;
- }
-
- public URLFactory getURLFactory()
- {
- return urlFactory;
- }
-
- public void setURLFactory(URLFactory urlFactory)
- {
- this.urlFactory = urlFactory;
- }
-
- public CommandFactory getCommandFactory()
- {
- return commandFactory;
- }
-
- public void setCommandFactory(CommandFactory commandFactory)
- {
- this.commandFactory = commandFactory;
- }
-
- public PageService getPageService()
- {
- return pageService;
- }
-
- public void setPageService(PageService pageService)
- {
- this.pageService = pageService;
- }
-
- public InterceptorStackFactory getStackFactory()
- {
- return stackFactory;
- }
-
- public void setStackFactory(InterceptorStackFactory stackFactory)
- {
- this.stackFactory = stackFactory;
- }
-
- public void handle(ServerInvocation invocation) throws ServerException
- {
- URLContext urlContext = invocation.getServerContext().getURLContext();
- CommandContext commandContext = new CommandContext(invocation, this);
-
- // Invoke the chain that creates the initial command
- ControllerCommand cmd = commandFactory.doMapping(invocation, invocation.getServerContext().getPortalContextPath(), invocation.getServerContext().getPortalRequestPath());
-
- //
- if (cmd == null)
- {
- // Handle that case
- throw new ServerException("No valid command");
- }
-
- try
- {
- while (true)
- {
- Forward forward = null;
-
- // Execute command
- try
- {
- //
- commandContext.execute(cmd);
-
- // Handle the result
- forward = handleResult(cmd, invocation);
- }
- catch (CommandRedirectionException e)
- {
- // Handle the redirection as forward
- forward = new Forward(e.getRedirection(), null);
- }
-
- //
- if (forward == null)
- {
- break;
- }
-
- // Find out if we can execute in the same server invocation
- if (forward.requiresRedirect(invocation))
- {
- String url = commandContext.encodeURL(forward.getCommand(), forward.getURLContext(), null);
- if (url == null)
- {
- throw new CommandException();
- }
- sendRedirect(invocation, url);
- break;
- }
- else
- {
- cmd = forward.getCommand();
- }
- }
- }
- catch (InsufficientTransportGuaranteeException e)
- {
- urlContext = URLContext.newInstance(true, urlContext.isAuthenticated());
- ServerURL serverURL = getURLFactory().doMapping(invocation, cmd);
- String url = invocation.getResponse().encodeURL(serverURL, urlContext, null);
- sendRedirect(invocation, url);
- }
- catch (ControllerSecurityException e)
- {
- if (urlContext.isAuthenticated())
- {
- sendStatusCode(invocation, HttpServletResponse.SC_UNAUTHORIZED);
- }
- else
- {
- urlContext = URLContext.newInstance(urlContext.getSecure(), true);
- ServerURL serverURL = getURLFactory().doMapping(invocation, cmd);
- String url = invocation.getResponse().encodeURL(serverURL, urlContext, null);
- sendRedirect(invocation, url);
- }
- }
- catch (ObjectNotFoundException e)
- {
- sendStatusCode(invocation, HttpServletResponse.SC_NOT_FOUND);
- }
- catch (CommandException e)
- {
- throw new ServerException(e);
- }
- catch (ServletException e)
- {
- throw new ServerException(e);
- }
- catch (IOException e)
- {
- throw new ServerException(e);
- }
- }
-
- /**
- *
- */
- private Forward handleResult(ControllerCommand cmd, ServerInvocation invocation) throws IOException, ServletException, ServerException
- {
- if (cmd instanceof RenderPageCommand)
- {
- PageRendition rendition = ((RenderPageCommand)cmd).getResult();
- rendition.render(invocation);
- return null;
- }
- else if (cmd instanceof InvokeWindowActionCommand)
- {
- InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)cmd;
- PortletInvocation pinv = iwac.getInvocation();
-
- //
- Result result = pinv.getResult();
-
- //
- if (result instanceof RenderResult)
- {
- RenderResult renderResult = (RenderResult)result;
- StateString portletNavState = renderResult.getNavigationalState();
- WindowState windowState = renderResult.getWindowState();
- Mode mode = renderResult.getMode();
- InvokeWindowRenderCommand iwrc = new InvokeWindowRenderCommand(
- iwac.getWindowRef(),
- mode,
- windowState,
- portletNavState);
- return new Forward(iwrc, null);
- }
- else if (result instanceof HTTPRedirectionResult)
- {
- HTTPRedirectionResult redirectionResult = (HTTPRedirectionResult)result;
- String url = redirectionResult.getLocation();
- sendRedirect(invocation, url);
- }
- else if (result instanceof InsufficientTransportGuaranteeResult)
- {
- boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
- return new Forward(iwac, URLContext.newInstance(true, authenticated));
- }
- else if (result instanceof InsufficientPrivilegesResult)
- {
- boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
- return new Forward(iwac, URLContext.newInstance(true, authenticated));
- }
- else if (result instanceof SignOutResult)
- {
- SignOutResult signOut = (SignOutResult)result;
-
- // Indicate that we want a sign out to be done
- invocation.getResponse().setWantSignOut(true);
-
- // Get the optional signout location
- String location = signOut.getLocation();
-
- //
- if (location == null)
- {
- // Redirect to the same page
- Page page = iwac.getPage();
- RenderPageCommand renderCmd = new RenderPageCommand(page.getId());
- boolean secure = invocation.getServerContext().getURLContext().getSecure();
- URLContext urlInfo = URLContext.newInstance(secure, false);
- return new Forward(renderCmd, urlInfo);
- }
- else
- {
- sendRedirect(invocation, location);
- }
- }
- else if (result instanceof ErrorResult)
- {
- ErrorResult error = (ErrorResult)result;
- error.logErrorTo(log, "An portlet exception occured in portlet " + iwac.getInstance().getId());
- sendStatusCode(invocation, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- else
- {
- throw new IllegalStateException();
- }
- }
- else if (cmd instanceof InvokeWindowRenderCommand)
- {
- InvokeWindowRenderCommand iwrc = (InvokeWindowRenderCommand)cmd;
- RenderPageCommand renderCmd = new RenderPageCommand(iwrc.getPage().getId());
- return new Forward(renderCmd, null);
- }
- else if (cmd instanceof StreamContentCommand)
- {
- StreamContentCommand scc = (StreamContentCommand)cmd;
- scc.stream(invocation);
- }
- return null;
- }
-
- private void sendStatusCode(ServerInvocation invocation, int sc) throws ServerException
- {
- try
- {
- HttpServletResponse resp = invocation.getServerContext().getClientResponse();
- resp.sendError(sc);
- }
- catch (IOException e)
- {
- throw new ServerException(e);
- }
- }
-
- private void sendRedirect(ServerInvocation invocation, String redirect) throws ServerException
- {
- try
- {
- HttpServletResponse resp = invocation.getServerContext().getClientResponse();
- resp.sendRedirect(redirect);
- }
- catch (IOException e)
- {
- throw new ServerException(e);
- }
- }
-
- public static class Forward
- {
-
- /** . */
- private final ControllerCommand cmd;
-
- /** . */
- private final URLContext urlCtx;
-
- public Forward(ControllerCommand cmd, URLContext urlCtx)
- {
- if (cmd == null)
- {
- throw new IllegalArgumentException("No command provided");
- }
- this.cmd = cmd;
- this.urlCtx = urlCtx;
- }
-
- public boolean requiresRedirect(ServerInvocation invocation)
- {
- CommandInfo cmdInfo = cmd.getInfo();
- if (cmdInfo instanceof ActionCommandInfo && !((ActionCommandInfo)cmdInfo).isIdempotent())
- {
- return true;
- }
- else
- {
- boolean currentAuthenticated = invocation.getServerContext().getURLContext().isAuthenticated();
- if (urlCtx != null && currentAuthenticated != urlCtx.isAuthenticated())
- {
- return true;
- }
- else
- {
- boolean currentSecure = invocation.getServerContext().getURLContext().getSecure();
- if (urlCtx != null && urlCtx.getSecure() && !currentSecure)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- public ControllerCommand getCommand()
- {
- return cmd;
- }
-
- public URLContext getURLContext()
- {
- return urlCtx;
- }
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/core/api/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/api/PortalNodeURLFactory.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/api/PortalNodeURLFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -27,9 +27,9 @@
import org.jboss.portal.portlet.spi.SecurityContext;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.core.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.command.RenderPageCommand;
-import org.jboss.portal.core.command.portlet.CorePortletInvocationContext;
+import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.controller.portlet.ControllerPortletInvocationContext;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -145,7 +145,7 @@
public String toString()
{
- CorePortletInvocationContext ctx = (CorePortletInvocationContext)invocation.getContext();
+ ControllerPortletInvocationContext ctx = (ControllerPortletInvocationContext)invocation.getContext();
InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(handle, null, null, parameters);
URLContext info = getURLContext();
return ctx.encodeURL(cmd, info, relative);
@@ -162,7 +162,7 @@
public String toString()
{
- CorePortletInvocationContext ctx = (CorePortletInvocationContext)invocation.getContext();
+ ControllerPortletInvocationContext ctx = (ControllerPortletInvocationContext)invocation.getContext();
RenderPageCommand cmd = new RenderPageCommand(handle);
URLContext urlContext = getURLContext();
return ctx.encodeURL(cmd, urlContext, relative);
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -23,13 +23,13 @@
import java.util.Map;
-import org.jboss.portal.core.command.CommandInterceptor;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.command.WindowCommand;
-import org.jboss.portal.core.command.CommandContext;
-import org.jboss.portal.core.command.CommandRedirectionException;
+import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.CommandRedirectionException;
+import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.controller.command.WindowCommand;
import org.jboss.portal.core.api.JBossPortalNode;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.ParametersStateString;
@@ -54,7 +54,7 @@
*
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
*/
-public class EventBroadcasterInterceptor extends CommandInterceptor
+public class EventBroadcasterInterceptor extends ControllerInterceptor
{
private static Logger log = Logger.getLogger(EventBroadcasterInterceptor.class);
@@ -166,7 +166,7 @@
//
if (redirection != null)
{
- CommandContext ctx = (CommandContext)cmd.getContext();
+ ControllerContext ctx = (ControllerContext)cmd.getContext();
throw new CommandRedirectionException(redirection);
}
else
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -5,11 +5,11 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.command.CommandContext;
-import org.jboss.portal.core.command.CommandInterceptor;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.MarkupCommand;
-import org.jboss.portal.core.command.PortalObjectCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.MarkupCommand;
+import org.jboss.portal.core.controller.command.PortalObjectCommand;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -43,7 +43,7 @@
* @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
* @version $Revision$
*/
-public class PageNavigationInterceptor extends CommandInterceptor
+public class PageNavigationInterceptor extends ControllerInterceptor
{
private static final Logger log = Logger.getLogger(PageNavigationInterceptor.class);
@@ -68,8 +68,8 @@
try
{
- ServerInvocation sinv = ((CommandContext)cmd.getContext()).getServerInvocation();
- LayoutService layoutService = ((CommandContext)cmd.getContext()).getController().getPageService().getLayoutService();
+ ServerInvocation sinv = ((ControllerContext)cmd.getContext()).getServerInvocation();
+ LayoutService layoutService = ((ControllerContext)cmd.getContext()).getController().getPageService().getLayoutService();
AttributeResolver navCtx = cmd.getContext().getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
ensurePageNavigationalState(layoutService, navCtx, sinv, page);
}
@@ -82,7 +82,7 @@
cmd.invokeNext();
}
- public static void updatePageNavigationalState(LayoutService layoutService, CommandContext cmdContext,
+ public static void updatePageNavigationalState(LayoutService layoutService, ControllerContext cmdContext,
ServerInvocation sinv, Portal portal, Page page, Window window,
Mode mode, WindowState windowState) throws StrategyException
{
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PolicyEnforcementInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PolicyEnforcementInterceptor.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PolicyEnforcementInterceptor.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -23,9 +23,9 @@
import org.jboss.logging.Logger;
-import org.jboss.portal.core.command.CommandInterceptor;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.ControllerSecurityException;
+import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerSecurityException;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
@@ -45,7 +45,7 @@
* @see java.security.Permission
* @see java.security.Policy
*/
-public final class PolicyEnforcementInterceptor extends CommandInterceptor
+public final class PolicyEnforcementInterceptor extends ControllerInterceptor
{
/** Our logger. */
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -21,10 +21,10 @@
*/
package org.jboss.portal.core.aspects.controller;
-import org.jboss.portal.core.command.CommandInterceptor;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.WindowCommand;
-import org.jboss.portal.core.command.RenderPageCommand;
+import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.WindowCommand;
+import org.jboss.portal.core.controller.command.RenderPageCommand;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.Page;
@@ -37,7 +37,7 @@
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PortalNodeInterceptor extends CommandInterceptor
+public class PortalNodeInterceptor extends ControllerInterceptor
{
// private static Logger log = Logger.getLogger(PortalNodeInterceptor.class);
Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -27,9 +27,9 @@
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.core.cms.command.StreamContentCommand;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.command.mapper.AbstractCommandFactory;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.Mode;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.server.ServerInvocation;
Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -21,8 +21,8 @@
*/
package org.jboss.portal.core.cms;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.mapper.URLFactoryDelegate;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
import org.jboss.portal.core.cms.command.StreamContentCommand;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.AbstractServerURL;
Modified: trunk/core/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -28,9 +28,9 @@
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.command.info.CommandInfo;
-import org.jboss.portal.core.command.info.ViewCommandInfo;
-import org.jboss.portal.core.command.ControllerCommand;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.server.ServerInvocation;
import javax.management.MBeanServer;
Deleted: trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,131 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.server.request.URLFormat;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.ServerURL;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.InterceptorStack;
-import org.jboss.portal.common.invocation.AbstractInvocationContext;
-import org.jboss.portal.core.CoreController;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class CommandContext extends AbstractInvocationContext
-{
-
- /** The server invocation. */
- private ServerInvocation serverInvocation;
-
- /** The controller. */
- private CoreController controller;
-
- /** Depth of the next chain. */
- protected int nextDepth;
-
- /** . */
- protected URLContext forwardURLContext;
-
- public CommandContext(ServerInvocation serverInvocation, CoreController controller)
- {
- if (serverInvocation == null)
- {
- throw new IllegalArgumentException();
- }
- if (controller == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- this.serverInvocation = serverInvocation;
- this.controller = controller;
-
- //
- addResolver(ControllerCommand.REQUEST_SCOPE, serverInvocation.getContext());
- addResolver(ControllerCommand.SESSION_SCOPE, serverInvocation.getContext());
- addResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, serverInvocation.getContext());
- addResolver(ControllerCommand.PRINCIPAL_SCOPE, serverInvocation.getContext());
- }
-
- public void execute(ControllerCommand command) throws CommandException, InvocationException
- {
- if (command == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- command.setContext(this);
-
- //
- command.create();
-
- //
- try
- {
- //
- nextDepth++;
-
- // Execute
- InterceptorStack commandStack = controller.getStackFactory().getInterceptorStack();
-
- //
- command.invoke(commandStack);
- }
- catch (Exception e)
- {
- ControllerCommand.rethrow(e);
- }
- finally
- {
- // Call destroy
- command.destroy();
-
- //
- command.setContext(null);
-
- //
- nextDepth--;
- }
- }
-
- public String encodeURL(ControllerCommand cmd, URLContext urlContext, URLFormat format)
- {
- ServerURL serverURL = controller.getURLFactory().doMapping(serverInvocation, cmd);
- return serverInvocation.getResponse().encodeURL(serverURL, urlContext, format);
- }
-
- public ServerInvocation getServerInvocation()
- {
- return serverInvocation;
- }
-
- public CoreController getController()
- {
- return controller;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/CommandException.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/CommandException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/CommandException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,48 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class CommandException extends Exception
-{
- public CommandException()
- {
- }
-
- public CommandException(String message)
- {
- super(message);
- }
-
- public CommandException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public CommandException(Throwable cause)
- {
- super(cause);
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/CommandInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/CommandInterceptor.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/CommandInterceptor.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,41 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.common.invocation.Invocation;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.server.impl.invocation.JBossInterceptor;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class CommandInterceptor extends JBossInterceptor
-{
-
- public void invoke(Invocation invocation) throws Exception, InvocationException
- {
- invoke((ControllerCommand)invocation);
- }
-
- public abstract void invoke(ControllerCommand cmd) throws Exception, InvocationException;
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/CommandRedirectionException.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/CommandRedirectionException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/CommandRedirectionException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,46 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CommandRedirectionException extends CommandException
-{
-
- private final ControllerCommand redirection;
-
- public CommandRedirectionException(ControllerCommand redirection)
- {
- if (redirection == null)
- {
- throw new IllegalArgumentException("A command must be provided");
- }
- this.redirection = redirection;
- }
-
- public ControllerCommand getRedirection()
- {
- return redirection;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,140 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.common.invocation.Invocation;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.InvocationContext;
-import org.jboss.portal.common.invocation.Scope;
-import org.jboss.portal.common.invocation.InvocationHandler;
-import org.jboss.portal.security.PortalSecurityException;
-import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
-import org.jboss.portal.core.command.info.CommandInfo;
-
-/**
- * A controller command.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class ControllerCommand extends Invocation
-{
-
- /** . */
- public static final Scope PRINCIPAL_SCOPE = new Scope("principal");
-
- /** . */
- public static final Scope SESSION_SCOPE = new Scope("session");
-
- /** . */
- public static final Scope REQUEST_SCOPE = new Scope("request");
-
- /** . */
- public static final Scope NAVIGATIONAL_STATE_SCOPE = new Scope("navigationalstate");
-
- /** . */
- protected static Logger log = Logger.getLogger(ControllerCommand.class);
-
- /** The context of the command. */
- protected CommandContext context;
-
- /** Execute command when the end of the stack is reached. */
- private static final InvocationHandler handler = new InvocationHandler()
- {
- public void invoke(Invocation invocation) throws Exception, InvocationException
- {
- ControllerCommand cmd = (ControllerCommand)invocation;
- cmd.execute();
- }
- };
-
- protected ControllerCommand()
- {
- setHandler(handler);
- }
-
- /**
- * Return the meta data of this command.
- */
- public abstract CommandInfo getInfo();
-
- public InvocationContext getContext()
- {
- if (context == null)
- {
- throw new IllegalStateException();
- }
- return context;
- }
-
- public void setContext(CommandContext context)
- {
- this.context = context;
- }
-
- /**
- * Enforce the security on this command.
- *
- * @throws PortalSecurityException
- * @throws ControllerSecurityException
- */
- public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
- {
- }
-
- /**
- * Setup state before invocation.
- */
- public void create() throws CommandException
- {
- }
-
- /**
- * Destroy state after invocation.
- */
- public void destroy()
- {
- }
-
- /**
- * Execute the command.
- */
- public abstract void execute() throws CommandException;
-
- public static void rethrow(Exception e) throws CommandException, InvocationException, RuntimeException
- {
- if (e instanceof InvocationException)
- {
- throw (InvocationException)e;
- }
- if (e instanceof CommandException)
- {
- throw (CommandException)e;
- }
- if (e instanceof RuntimeException)
- {
- throw (RuntimeException)e;
- }
- throw new CommandException(e);
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/ControllerSecurityException.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ControllerSecurityException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/ControllerSecurityException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,51 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ControllerSecurityException extends CommandException
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = -157650218749390553L;
-
- public ControllerSecurityException()
- {
- }
-
- public ControllerSecurityException(String message)
- {
- super(message);
- }
-
- public ControllerSecurityException(Throwable cause)
- {
- super(cause);
- }
-
- public ControllerSecurityException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/ErrorResultException.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ErrorResultException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/ErrorResultException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,50 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.portlet.result.ErrorResult;
-import org.jboss.portal.core.command.CommandException;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ErrorResultException extends CommandException
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 836063972496196867L;
-
- /** . */
- private ErrorResult result;
-
- public ErrorResultException(ErrorResult result)
- {
- this.result = result;
- }
-
- public ErrorResult getResult()
- {
- return result;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/InsufficientTransportGuaranteeException.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InsufficientTransportGuaranteeException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/InsufficientTransportGuaranteeException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,31 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class InsufficientTransportGuaranteeException extends ControllerSecurityException
-{
-
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,137 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.command.portlet.CoreActionContext;
-import org.jboss.portal.core.command.info.CommandInfo;
-import org.jboss.portal.core.command.info.ActionCommandInfo;
-import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.server.ServerInvocation;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class InvokeWindowActionCommand extends InvokeWindowCommand
-{
-
- /** . */
- private static final Logger log = Logger.getLogger(InvokeWindowActionCommand.class);
-
- /** . */
- private static final CommandInfo info = new ActionCommandInfo(false, "view", false);
-
- /** . */
- private StateString navigationalState;
-
- /** . */
- private StateString interactionState;
-
- /** . */
- private Parameters formParameters;
-
- /** . */
- private PortletInvocation invocation;
-
- public InvokeWindowActionCommand(
- String windowRef,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- StateString interactionState,
- Parameters formParameters)
- throws IllegalArgumentException
- {
- super(windowRef, mode, windowState);
- this.navigationalState = navigationalState;
- this.interactionState = interactionState;
- this.formParameters = formParameters;
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-
- public StateString getInteractionState()
- {
- return interactionState;
- }
-
- public void setInteractionState(StateString interactionState)
- {
- this.interactionState = interactionState;
- }
-
- public Parameters getFormParameters()
- {
- return formParameters;
- }
-
- public void setFormParameters(Parameters formParameters)
- {
- this.formParameters = formParameters;
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public PortletInvocation getInvocation()
- {
- return invocation;
- }
-
- public void execute() throws CommandException
- {
- try
- {
- ServerInvocation sinv = context.getServerInvocation();
- CommandContext commandCtx = (CommandContext)getContext();
- CoreActionContext actionCtx = new CoreActionContext(commandCtx, sinv, portal, navigationalState, getWindowState(), getMode(), interactionState, formParameters, window);
- PortletInvocation invocation = actionCtx.createInvocation();
-
- //
- this.instance.invoke(invocation);
- this.invocation = invocation;
- }
- catch (PortletInvokerException e)
- {
- if (e instanceof NoSuchPortletException)
- {
- throw new ObjectNotFoundException(((NoSuchPortletException)e).getPortletId());
- }
- else
- {
- throw new CommandException(e);
- }
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,56 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class InvokeWindowCommand extends WindowCommand
-{
-
- /** . */
- protected final Mode mode;
-
- /** . */
- protected final WindowState windowState;
-
- public InvokeWindowCommand(String windowRef, Mode mode, WindowState windowState) throws IllegalArgumentException
- {
- super(windowRef);
- this.mode = mode;
- this.windowState = windowState;
- }
-
- public Mode getMode()
- {
- return mode;
- }
-
- public WindowState getWindowState()
- {
- return windowState;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,118 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.InvocationContext;
-import org.jboss.portal.core.aspects.controller.PageNavigationInterceptor;
-import org.jboss.portal.core.command.info.CommandInfo;
-import org.jboss.portal.core.command.info.ViewCommandInfo;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.theme.strategy.StrategyException;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.LayoutService;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class InvokeWindowRenderCommand extends InvokeWindowCommand
-{
-
- private static final CommandInfo info = new ViewCommandInfo(false, "view");
-
- /** . */
- protected final StateString navigationalState;
-
- public InvokeWindowRenderCommand(
- String windowRef,
- Mode mode,
- WindowState windowState,
- StateString navigationalState)
- throws IllegalArgumentException
- {
- super(windowRef, mode, windowState);
- this.navigationalState = navigationalState;
- }
-
- public InvokeWindowRenderCommand(
- String windowRef,
- Mode mode,
- WindowState windowState)
- throws IllegalArgumentException
- {
- super(windowRef, mode, windowState);
- this.navigationalState = null;
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public void execute() throws InvocationException
- {
- InvocationContext ctx = getContext();
-
- //
- if (navigationalState != null)
- {
- ctx.setAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef(), navigationalState);
- }
-
- // Update the window nav state
- WindowNavigationalState windowNavState = (WindowNavigationalState)ctx.getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef() + "_window");
- if (windowNavState == null)
- {
- windowNavState = new WindowNavigationalState();
- ctx.setAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
- }
- if (mode != null)
- {
- windowNavState.setMode(mode);
- }
- if (windowState != null)
- {
- windowNavState.setWindowState(windowState);
- }
-
- // Udpate the page nav state
- try
- {
- ServerInvocation sinv = ((CommandContext)getContext()).getServerInvocation();
- LayoutService layoutService = ((CommandContext)getContext()).getController().getPageService().getLayoutService();
- PageNavigationInterceptor.updatePageNavigationalState(layoutService, context, sinv, portal, page, window, getMode(), getWindowState());
- }
- catch (StrategyException e)
- {
- throw new InvocationException(e);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,715 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.invocation.AttributeResolver;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.util.Exceptions;
-import org.jboss.portal.core.command.portlet.CorePortletInvocationContext;
-import org.jboss.portal.core.command.info.CommandInfo;
-import org.jboss.portal.core.command.info.ViewCommandInfo;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectPermission;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.portlet.Properties;
-import org.jboss.portal.portlet.info.ModeInfo;
-import org.jboss.portal.portlet.info.WindowStateInfo;
-import org.jboss.portal.portlet.result.ErrorResult;
-import org.jboss.portal.portlet.result.FragmentResult;
-import org.jboss.portal.portlet.result.InsufficientPrivilegesResult;
-import org.jboss.portal.portlet.result.InsufficientTransportGuaranteeResult;
-import org.jboss.portal.portlet.result.Result;
-import org.jboss.portal.portlet.result.UnavailableResult;
-import org.jboss.portal.portlet.spi.PortalContext;
-import org.jboss.portal.security.PortalSecurityException;
-import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.PortalTheme;
-import org.jboss.portal.theme.ServerRegistrationID;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.ThemeResult;
-import org.jboss.portal.theme.ThemeService;
-import org.jboss.portal.theme.PageRendition;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.page.MarkupContainer;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
-import org.jboss.portal.theme.page.PageService;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.render.MarkupResult;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * Abstract base class for portal object commands that produce markup (of a page, region, window). <p>This command
- * contains all the shared functionality amongst all commands that create page , or page fragment markup, like the
- * RenderPageCommand and the RenderRegionCommand.</p>
- *
- * @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public abstract class MarkupCommand extends PortalObjectCommand
-{
-
- /** . */
- private static String WINDOW_ACCESS_DENIED = "core.render.window_access_denied";
-
- /** . */
- private static String WINDOW_UNAVAILABLE = "core.render.window_unavailable";
-
- /** . */
- private static String WINDOW_ERROR = "core.render.window_error";
-
- /** . */
- private static String WINDOW_INTERNAL_ERROR = "core.render.window_internal_error";
-
- /** . */
- private static String WINDOW_NOT_FOUND = "core.render.window_not_found";
-
- /** . */
- private static String HIDE = "hide";
-
- /** . */
- private static String SHOW = "show";
-
- /** . */
- private static final CommandInfo info = new ViewCommandInfo(false, "view");
-
- /** . */
- private final String pageRef;
-
- /** . */
- private final MarkupContainer markupContainer;
-
- /** . */
- private Page page;
-
- /** . */
- private PortalLayout layout;
-
- /** . */
- private boolean personalizable;
-
- /** . */
- private PageRendition result;
-
- /**
- * render the entire page
- *
- * @param pageRef the page idenitifier of the page to render
- */
- public MarkupCommand(String pageRef)
- {
- this(pageRef, null);
- }
-
- /**
- * render a fragment on the page (a region or a window on the page)
- *
- * @param pageRef the page idenitifier of the page to render
- * @param markupContainer the fragment to render (the region or the window); if the argument is null, the entire page
- * will be rendered
- */
- public MarkupCommand(String pageRef, MarkupContainer markupContainer)
- {
- if (pageRef == null)
- {
- throw new IllegalArgumentException();
- }
- this.pageRef = pageRef;
- this.markupContainer = markupContainer;
- }
-
- /**
- * call the component invocation(s) to create the markup fragment(s) for this request
- *
- * @param cfg the server config to get config information (for error behaviour )
- * @param navCtx the navigational state context to get to the window navigational state
- * @return a markup result containing the fragments rendered by the portlets in this command
- * @throws InvocationException
- */
- public abstract MarkupResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws CommandException;
-
- /**
- * for security checks and navigational state, return the page of the requested MarkupContainer
- *
- * @return the requested page (or the page of the requested region or window)
- */
- public PortalObject getTarget()
- {
- return page;
- }
-
- /**
- * Get the command info (runtime info about the command)
- *
- * @return info about the command
- */
- public CommandInfo getInfo()
- {
- return info;
- }
-
- /**
- * Get the identifier of the requeste page
- *
- * @return the identifier of the requeste page
- */
- public String getPageRef()
- {
- return pageRef;
- }
-
- /**
- * Get the requeste page
- *
- * @return the requested page
- */
- public Page getPage()
- {
- return page;
- }
-
- /**
- * Get the layout that was determined for this request (based on portal and page properties)
- *
- * @return the layout to use for this request
- */
- public PortalLayout getLayout()
- {
- return layout;
- }
-
- /**
- * Get the fragment identifier of the page fragment that was requested
- *
- * @return the region or window to render as part of this request
- */
- public MarkupContainer getMarkupContainer()
- {
- return markupContainer;
- }
-
- public PageRendition getResult()
- {
- return result;
- }
-
- /**
- * initialize the command
- *
- * @throws InvocationException
- */
- public void create() throws CommandException
- {
- // Get page
- page = (Page)context.getController().getPortalObjectContainer().getObject(pageRef);
- if (page == null)
- {
- throw new ObjectNotFoundException(pageRef);
- }
-
- // Get nearest portal ancestor
- if (page.getPortal() == null)
- {
- throw new ObjectNotFoundException("Portal for " + pageRef);
- }
-
- //
- LayoutService layoutService = context.getController().getPageService().getLayoutService();
- layout = getLayout(layoutService, page);
- }
-
- public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
- {
- //
- super.enforceSecurity(pam);
-
- // Check if the user can personalize the page
- String uri = page.getId();
- PortalObjectPermission perm = new PortalObjectPermission(uri, PortalObjectPermission.PERSONALIZE_MASK);
- personalizable = pam.checkPermission(perm);
- }
-
- /**
- * execute the command
- *
- * @throws InvocationException
- */
- public final void execute() throws CommandException, InvocationException
- {
- ServerInvocation sinv = context.getServerInvocation();
- HttpServletRequest request = sinv.getServerContext().getClientRequest();
- try
- {
- // Ensure that the page nav state is in place
- AttributeResolver navCtx = sinv.getContext().getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
- PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(page.getId());
-
- if (pageNavState == null)
- {
- throw new InvocationException("PageNavigationalState not available in NavigationalStateContext");
- }
-
- //
- PageService pageService = context.getController().getPageService();
- PortalTheme theme = null;
-
- if (personalizable)
- {
- CommandContext commandCtx = (CommandContext)getContext();
- User user = (User)commandCtx.getServerInvocation().getRequest().getUser();
- if (user != null)
- {
- String themeId = user.getTheme();
- if (themeId != null)
- {
- theme = getTheme(themeId);
- }
- }
- }
-
- // If nothing get it from the object properties
- if (theme == null)
- {
- String themeId = page.getProperty(ThemeConstants.PORTAL_PROP_THEME);
- theme = getTheme(themeId);
- }
-
- // Make the theme available as servlet request attribute (needed for CM)
- if (theme != null)
- {
- // render the theme markup and place it into the request so that the markup assembler (theme tag) can pick it up there
- ThemeResult themeResult = theme.assembleResponse(sinv.getRequest(), sinv.getResponse());
- request.setAttribute(ThemeConstants.ATTR_THEMERESULT, themeResult);
- request.setAttribute(ThemeConstants.ATTR_THEME, theme);
- }
-
- // Call the portlet container to create the markup fragment(s) for each portlet that needs to render itself
- ServerConfig cfg = sinv.getRequest().getServer().getConfig();
- MarkupResult renderResult = renderFragments(cfg, navCtx);
-
- //
- result = new PageRendition(layout, pageNavState, renderResult, pageService);
- }
- catch (Exception e)
- {
- ControllerCommand.rethrow(e);
- }
- finally
- {
- request.removeAttribute(ThemeConstants.ATTR_THEMESERVER);
- request.removeAttribute(ThemeConstants.ATTR_THEME);
- request.removeAttribute(ThemeConstants.ATTR_THEMERESULT);
- }
- }
-
- private PortalTheme getTheme(String themeIdString)
- {
- //
- ThemeService service = context.getController().getPageService().getThemeService();
-
- // If the id is provided in the form of context.name then look up the theme via a registration id
- if (themeIdString.lastIndexOf(".") > 0)
- {
- ServerRegistrationID themeId = ServerRegistrationID.createID(ServerRegistrationID.TYPE_THEME, parseID(themeIdString));
- return service.getTheme(themeId, true);
- }
- else
- {
- // Otherwise use the ordinary theme name provided and lookup the theme via the name
- return service.getTheme(themeIdString, true);
- }
- }
-
- /**
- * Get the portal layout to use for the provided page. <p>The name of the layout to use can be defined as a property
- * in the portal, or the individual page. The page property overwrites the portal property. If no property was set, a
- * default layout with the name "nodesk" is assumed.</p>
- *
- * @param layoutService the layout service that allows access to the layout
- * @param page the page that hosts the markup container to render (the page, region, window,...)
- * @return a <code>PortalLayout</code> for the defined layout name
- */
- public static PortalLayout getLayout(LayoutService layoutService, Page page)
- {
- String layoutIDString = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
-
- // Last resort: use the nodesk layout
- if (layoutIDString == null)
- {
- layoutIDString = "nodesk";
- }
-
- //
- PortalLayout layout = null;
- if (layoutIDString.lastIndexOf(".") > 0)
- {
- // if the id is provided in the form of context.name then look up the layout via a registration id
- ServerRegistrationID layoutID = ServerRegistrationID.createID(ServerRegistrationID.TYPE_LAYOUT, parseID(layoutIDString));
- layout = layoutService.getLayout(layoutID, true);
- }
- else
- {
- // otherwise use the ordinary layout name provided and lookup the layout via the name
- layout = layoutService.getLayout(layoutIDString, true);
- }
-
- // We don't like that situation
- if (layout == null)
- {
- throw new IllegalStateException("NO LAYOUT FOUND FOR " + layoutIDString);
- }
-
- //
- return layout;
- }
-
- /**
- * Call the component container to render the markup fragment of a window
- *
- * @param cfg the server config to get information about the error behaviour
- * @param window the window to render
- * @return a result containing markup, or other result information (redirect url, etc.)
- * @throws InvocationException
- */
- protected MarkupResult renderPortletWindow(ServerConfig cfg, Window window) throws CommandException
- {
- // Execute render command
- String windowRef = window.getId();
-
- //
- String windowTitle;
- String contentChars = "";
- String headerChars = null;
- Map actionMap = new HashMap();
- Properties responseProps;
- Map windowProps = window.getDeclaredPropertyMap();
-
- try
- {
- RenderWindowCommand renderCmd = new RenderWindowCommand(windowRef);
-
- //
- context.execute(renderCmd);
-
- // The result should be a fragment result
- Result result = renderCmd.getResult();
-
- //
- if (result instanceof InsufficientTransportGuaranteeResult)
- {
- throw new InsufficientTransportGuaranteeException();
- }
-
- // Compute actions
- CorePortletInvocationContext invCtx = (CorePortletInvocationContext)renderCmd.getInvocation().getContext();
-
- // Get window navigational state
- WindowNavigationalState windowNavState = (WindowNavigationalState)this.context.getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window");
-
- //
- if (result instanceof FragmentResult)
- {
- FragmentResult fragment = (FragmentResult)result;
- windowTitle = fragment.getTitle();
- if (windowTitle == null)
- {
- windowTitle = window.getName();
- }
- headerChars = fragment.getHeader();
- responseProps = fragment.getProperties();
-
- //
- PortalContext ctx = renderCmd.getInvocation().getPortalContext();
- Instance instance = renderCmd.getInstance();
-
- //
- List supportedWindowStates = new ArrayList();
- for (Iterator i = instance.getPortlet().getInfo().getCapabilities().getAllWindowStates().iterator(); i.hasNext();)
- {
- WindowStateInfo windowStateInfo = (WindowStateInfo)i.next();
- WindowState windowState = windowStateInfo.getWindowState();
- if (ctx.getWindowStates().contains(windowState))
- {
- supportedWindowStates.add(windowState);
- }
- }
-
- //
- List supportedModes = new ArrayList();
- for (Iterator i = instance.getPortlet().getInfo().getCapabilities().getAllModes().iterator(); i.hasNext();)
- {
- ModeInfo modeInfo = (ModeInfo)i.next();
- Mode mode = modeInfo.getMode();
- if (ctx.getModes().contains(mode))
- {
- supportedModes.add(mode);
- }
- }
-
- // Remove edit mode if the user is not logged it
- // commenting out for now since it breaks the tests
- /*if (renderCmd.getInvocation().getUserContext().getUser() == null)
- {
- supportedModes.remove(Mode.EDIT);
- }*/
-
- //
- addModeActions(actionMap, windowNavState.getMode(), supportedModes, invCtx);
-
- //
- addStateActions(actionMap, windowNavState.getWindowState(), supportedWindowStates, invCtx);
-
- switch (fragment.getType())
- {
- case FragmentResult.TYPE_CHARS:
- contentChars = fragment.getChars().toString();
- break;
- case FragmentResult.TYPE_BYTES:
- // Funny for now we don't know how to interpret that or we should not
- // because it is for some kind of flash portal ?
- contentChars = fragment.getBytes().toString();
- break;
- case FragmentResult.TYPE_EMPTY:
- // Do nothing, the contentChars is already empty string
- break;
- }
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
- }
- else if (result instanceof ErrorResult)
- {
- ErrorResult errorResult = (ErrorResult)result;
- String logMessage = "Rendering portlet window " + windowRef + " triggered the following error :";
- errorResult.logErrorTo(log, logMessage);
- String property = cfg.getProperty(WINDOW_ERROR);
- if (!HIDE.equals(property))
- {
- windowTitle = "An error occured while rendering window '" + windowRef + "'";
- responseProps = new Properties();
- contentChars = errorResult.getMessage();
- Throwable t = errorResult.getThrowable();
- if (t != null && SHOW.equals(property))
- {
- contentChars = Exceptions.toHTML(t, true);
- }
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
- }
- }
- else if (result instanceof UnavailableResult)
- {
- if (SHOW.equals(cfg.getProperty(WINDOW_UNAVAILABLE)))
- {
- windowTitle = "Portlet unavailable";
- contentChars = "Portlet unavailable";
- actionMap = new HashMap();
- actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
- actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
- responseProps = new Properties();
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
- }
- }
- else if (result instanceof InsufficientPrivilegesResult)
- {
- // Julien : go to the section below, I know it is very ugly
- throw new ObjectSecurityException(windowRef);
- }
- else
- {
- log.error("Unexpected result from a portlet invocation " + result);
- return null;
- }
- }
- catch (ObjectSecurityException e)
- {
- if (log.isTraceEnabled())
- {
- log.trace("Window access denied", e);
- }
- if (SHOW.equals(cfg.getProperty(WINDOW_ACCESS_DENIED)))
- {
- actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
- actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
- windowTitle = "Access denied";
- contentChars = "Access denied";
- responseProps = new Properties();
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
- }
- }
- catch (ObjectNotFoundException e)
- {
- if (log.isTraceEnabled())
- {
- log.trace("Window not found", e);
- }
- if (SHOW.equals(cfg.getProperty(WINDOW_NOT_FOUND)))
- {
- actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
- actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
- windowTitle = "Cannot render";
- contentChars = "Object not found " + e.getRef();
- responseProps = new Properties();
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
- }
- }
- catch (CommandException e)
- {
- // It's a CommandException that we rethrow
- throw e;
- }
- catch (Exception e)
- {
- log.error("Rendering portlet window " + windowRef + " produced an internal error", e);
- String property = cfg.getProperty(WINDOW_INTERNAL_ERROR);
- if (SHOW.equals(property))
- {
- windowTitle = "An internal error occured while rendering window '" + window + "'";
- responseProps = new Properties();
- contentChars = Exceptions.toHTML(e, true);
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
- }
- }
-
- return null;
- }
-
- /**
- * parse the provided String for '.' as a separator. For each token, add an entry to a String[] that will be returned
- * as the result
- *
- * @param layoutIDString the string to be examined
- * @return an array of Strings
- */
- private static String[] parseID(String layoutIDString)
- {
- List names = new ArrayList();
- StringTokenizer tokens = new StringTokenizer(layoutIDString, ".");
- if (tokens.countTokens() > 1)
- {
- while (tokens.hasMoreElements())
- {
- names.add(tokens.nextToken());
- }
- }
- else
- {
- names.add(layoutIDString);
- }
-
- String[] id = new String[names.size()];
- names.toArray(id);
- return id;
- }
-
- /**
- * Create the action URLs for the allowed window states of the rendered portlet window and add them to the provided
- * actionMap
- *
- * @param actionMap
- * @param currentWindowState
- * @param invCtx
- */
- private static void addStateActions(Map actionMap, WindowState currentWindowState, List supportedWindowStates, CorePortletInvocationContext invCtx)
- {
- List windowStates = new ArrayList(supportedWindowStates.size());
- for (Iterator j = supportedWindowStates.iterator(); j.hasNext();)
- {
- WindowState windowState = (WindowState)j.next();
- String url = invCtx.createUpdateNavigationalStateURL(null, windowState);
- boolean disabled = windowState.equals(currentWindowState);
- WindowResult.Action action = new WindowResult.Action(windowState, url, !disabled);
- windowStates.add(action);
- }
- actionMap.put(WindowResult.WINDOWSTATES_KEY, windowStates);
- }
-
- /**
- * Create the action URLs for the allowed portlet modes of the rendered portlet window and add them to the provided
- * actionMap
- *
- * @param actionMap
- * @param currentMode
- * @param invCtx
- */
- private static void addModeActions(Map actionMap, Mode currentMode, List supportedModes, CorePortletInvocationContext invCtx)
- {
- List modes = new ArrayList(supportedModes.size());
- for (Iterator j = supportedModes.iterator(); j.hasNext();)
- {
- Mode mode = (Mode)j.next();
- String url = invCtx.createUpdateNavigationalStateURL(mode, null);
- boolean disabled = mode.equals(currentMode);
- WindowResult.Action action = new WindowResult.Action(mode, url, !disabled);
- modes.add(action);
- }
- actionMap.put(WindowResult.MODES_KEY, modes);
- }
-
-/*
- private static void createMoveActions(Map actionMap, WindowNavigationalState state, RenderInvocation render, String handle)
- {
- Parameters ctrlParams = new Parameters();
-
- ctrlParams.setValue("cmd", "move");
- ctrlParams.setValue("window", handle);
-
- ServerURL serverURL = new ServerURL();
- serverURL.setParameters("ctrl", ctrlParams);
-
- ServerInvocation serverInvocation = context.getServerInvocation();
- ServerResponseContext serverResponseContext = serverInvocation.getResponse().getContext();
- String url = serverResponseContext.encodeURL(serverURL);
-
- WindowResult.Action action = new WindowResult.Action("move", url, true);
- List moves = new ArrayList();
- moves.add(action);
- actionMap.put("move", moves);
-
-// List windowStates = new ArrayList(render.getRequest().getSupportedWindowStates().size());
-// for (Iterator j = render.getRequest().getSupportedWindowStates().iterator(); j.hasNext();)
-// {
-// WindowState windowState = (WindowState)j.next();
-// ServerURL serverURL = crespctx.createUpdateNavigationalStateURL(null, windowState);
-// String url = serverResponseContext.encodeURL(serverURL);
-// boolean disabled = windowState.equals(state.getWindowState());
-// WindowResult.Action action = new WindowResult.Action(windowState.toString(), url, !disabled);
-// windowStates.add(action);
-// }
-// actionMap.put("windowstate", windowStates);
- }
-*/
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/ObjectNotFoundException.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ObjectNotFoundException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/ObjectNotFoundException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,53 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.core.command.CommandException;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ObjectNotFoundException extends CommandException
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -1311521920998110717L;
-
- /** Object reference pointing to the not found object. */
- private String ref;
-
- public ObjectNotFoundException(String ref)
- {
- super("Not allowed to access resource " + ref);
- this.ref = ref;
- }
-
- /**
- /**
- * Return some kind of reference to the not found object.
- */
- public String getRef()
- {
- return ref;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/ObjectSecurityException.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ObjectSecurityException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/ObjectSecurityException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,56 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ObjectSecurityException extends ControllerSecurityException
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 3506674156010581342L;
-
- /** Object reference pointing to the not found object. */
- private String ref;
-
- public ObjectSecurityException(String message, String ref)
- {
- super(ref + " has denied access: " + message);
- this.ref = ref;
- }
-
- public ObjectSecurityException(String ref)
- {
- super(ref + " has denied access");
- this.ref = ref;
- }
-
- /**
- * Return some kind of reference to the not found object.
- */
- public String getRef()
- {
- return ref;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/PortalObjectCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/PortalObjectCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/PortalObjectCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,59 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectPermission;
-import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
-import org.jboss.portal.security.PortalSecurityException;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class PortalObjectCommand extends ControllerCommand
-{
-
- /**
- * Enforce the security on this command using the provided portal authorization manager.
- *
- * @param pam the portal authorization manager
- * @throws ControllerSecurityException if the access is not granted
- */
- public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
- {
- PortalObject target = getTarget();
- String id = target.getId();
- PortalObjectPermission perm = new PortalObjectPermission(id, PortalObjectPermission.VIEW_MASK);
- if(!pam.checkPermission(perm))
- {
- throw new ObjectSecurityException("Not Authorized");
- }
- }
-
- /**
- * Return the target portal object of this command.
- *
- * @return the target portal object
- */
- public abstract PortalObject getTarget();
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,91 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.AttributeResolver;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.render.MarkupResult;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * Render a full page.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public final class RenderPageCommand extends MarkupCommand
-{
- public RenderPageCommand(String pageRef)
- {
- super(pageRef);
- }
-
- /**
- * Call the component / portlet invocation for each window on the page, and create a markup result with the resulting markup fragments in it
- *
- * @param cfg the server configuration to get access to customizable error behaviour
- * @param navCtx the navigational state context to access page and window navigational state
- * @return a modifiable page result containing the markup fragments from the individual portlets on this page
- * @throws InvocationException
- */
- public MarkupResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws CommandException
- {
- PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(getPage().getId());
- ModifiablePageResult pageResult = new ModifiablePageResult(navCtx, getPage().getName(), getPage().getDeclaredPropertyMap(), getPage().getPortal().getDeclaredPropertyMap());
-
- // all windows on the page
- Collection windows = getPage().getChildren();
-
- // Render
- for (Iterator i = windows.iterator(); i.hasNext();)
- {
- PortalObject o = (PortalObject)i.next();
-
- // Render only window children
- if (o instanceof Window)
- {
- Window window = (Window)o;
-
- // That are visible ?
- if (pageNavState.isWindowVisible(window.getId()))
- {
- MarkupResult result = renderPortletWindow(cfg, window);
- if (result != null)
- {
- pageResult.addWindowContext(pageNavState.getWindowContext(window.getId()));
- pageResult.addWindowResult(window.getId(), (WindowResult)result);
- }
- }
- }
- }
-
- return pageResult;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,127 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.core.command.portlet.CoreRenderContext;
-import org.jboss.portal.core.command.info.CommandInfo;
-import org.jboss.portal.core.command.info.ViewCommandInfo;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.result.Result;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-
-/**
- * Render a single window.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class RenderWindowCommand extends WindowCommand
-{
-
- private static final CommandInfo info = new ViewCommandInfo(true, "view");
-
- // private RenderInvocation render;
-
- private Result result;
-
- private RenderInvocation invocation;
-
- public RenderWindowCommand(String windowRef)
- throws IllegalArgumentException
- {
- super(windowRef);
- }
-
- public Result getResult()
- {
- return result;
- }
-
-// public CoreRenderContext getRenderContext()
-// {
-// return renderContext;
-// }
-
- public RenderInvocation getInvocation()
- {
- return invocation;
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public void execute() throws CommandException
- {
- ServerInvocation sinv = context.getServerInvocation();
-
- //
- StateString ns = (StateString)getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef());
-
- //
- WindowNavigationalState windowNavState = (WindowNavigationalState)getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, windowRef + "_window");
- if (windowNavState == null)
- {
- windowNavState = new WindowNavigationalState();
- setAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
- }
-
- // Get the mode
- Mode mode = windowNavState.getMode();
-
- // Get the window state
- WindowState windowState = windowNavState.getWindowState();
-
- //
- CoreRenderContext renderContext = new CoreRenderContext((CommandContext)getContext(), sinv, portal, ns, mode, windowState, window);
-
- //
- invocation = (RenderInvocation)renderContext.createInvocation();
-
- //
- try
- {
- instance.invoke(invocation);
- }
- catch (PortletInvokerException e)
- {
- if (e instanceof NoSuchPortletException)
- {
- throw new ObjectNotFoundException(((NoSuchPortletException)e).getPortletId());
- }
- else
- {
- throw new CommandException(e);
- }
- }
-
- //
- result = invocation.getResult();
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/command/WindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/WindowCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/command/WindowCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,137 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command;
-
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
-import org.jboss.portal.security.PortalSecurityException;
-
-/**
- * A superclass for command that target a specific window.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class WindowCommand extends PortalObjectCommand
-{
-
- /** The window ref. */
- protected String windowRef;
-
- /** The portal. */
- protected Portal portal;
-
- /** The portal. */
- protected Page page;
-
- /** The window. */
- protected Window window;
-
- /** The instance. */
- protected Instance instance;
-
- public WindowCommand(String windowRef) throws IllegalArgumentException
- {
- if (windowRef == null)
- {
- throw new IllegalArgumentException();
- }
- this.windowRef = windowRef;
- }
-
- public PortalObject getTarget()
- {
- return window;
- }
-
- public Instance getInstance()
- {
- return instance;
- }
-
- public String getWindowRef()
- {
- return windowRef;
- }
-
- public Portal getPortal()
- {
- return portal;
- }
-
- public Page getPage()
- {
- return page;
- }
-
- public Window getWindow()
- {
- return window;
- }
-
- public void create() throws CommandException
- {
- // Retrieve the window
- window = (Window)context.getController().getPortalObjectContainer().getObject(windowRef);
- if (window == null)
- {
- throw new ObjectNotFoundException(windowRef);
- }
-
- // First retrieve the target
- page = (Page)window.getParent();
- if (page == null)
- {
- throw new ObjectNotFoundException(windowRef);
- }
-
- // Get hardcoded portal for now
- portal = page.getPortal();
- if (portal == null)
- {
- throw new ObjectNotFoundException(windowRef);
- }
-
- // Get instance
- instance = context.getController().getInstanceContainer().getInstance(window.getInstanceRef());
- if (instance == null)
- {
- throw new ObjectNotFoundException(window.getInstanceRef());
- }
- }
-
-
- /**
- * We only enforce security at instance and component level.
- *
- * @param pam
- * @throws ControllerSecurityException
- * @throws org.jboss.portal.security.PortalSecurityException
- */
- public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
- {
- }
-}
Copied: trunk/core/src/main/org/jboss/portal/core/controller/CommandRedirectionException.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/command/CommandRedirectionException.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/CommandRedirectionException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/CommandRedirectionException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CommandRedirectionException extends ControllerException
+{
+
+ private final ControllerCommand redirection;
+
+ public CommandRedirectionException(ControllerCommand redirection)
+ {
+ if (redirection == null)
+ {
+ throw new IllegalArgumentException("A command must be provided");
+ }
+ this.redirection = redirection;
+ }
+
+ public ControllerCommand getRedirection()
+ {
+ return redirection;
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/controller/ControllerCommand.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ControllerCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,140 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.common.invocation.Scope;
+import org.jboss.portal.common.invocation.InvocationHandler;
+import org.jboss.portal.security.PortalSecurityException;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+
+/**
+ * A controller command.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class ControllerCommand extends Invocation
+{
+
+ /** . */
+ public static final Scope PRINCIPAL_SCOPE = new Scope("principal");
+
+ /** . */
+ public static final Scope SESSION_SCOPE = new Scope("session");
+
+ /** . */
+ public static final Scope REQUEST_SCOPE = new Scope("request");
+
+ /** . */
+ public static final Scope NAVIGATIONAL_STATE_SCOPE = new Scope("navigationalstate");
+
+ /** . */
+ protected static Logger log = Logger.getLogger(ControllerCommand.class);
+
+ /** The context of the command. */
+ protected ControllerContext context;
+
+ /** Execute command when the end of the stack is reached. */
+ private static final InvocationHandler handler = new InvocationHandler()
+ {
+ public void invoke(Invocation invocation) throws Exception, InvocationException
+ {
+ ControllerCommand cmd = (ControllerCommand)invocation;
+ cmd.execute();
+ }
+ };
+
+ protected ControllerCommand()
+ {
+ setHandler(handler);
+ }
+
+ /**
+ * Return the meta data of this command.
+ */
+ public abstract CommandInfo getInfo();
+
+ public InvocationContext getContext()
+ {
+ if (context == null)
+ {
+ throw new IllegalStateException();
+ }
+ return context;
+ }
+
+ public void setContext(ControllerContext context)
+ {
+ this.context = context;
+ }
+
+ /**
+ * Enforce the security on this command.
+ *
+ * @throws PortalSecurityException
+ * @throws org.jboss.portal.core.controller.ControllerSecurityException
+ */
+ public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
+ {
+ }
+
+ /**
+ * Setup state before invocation.
+ */
+ public void create() throws ControllerException
+ {
+ }
+
+ /**
+ * Destroy state after invocation.
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ * Execute the command.
+ */
+ public abstract void execute() throws ControllerException;
+
+ public static void rethrow(Exception e) throws ControllerException, InvocationException, RuntimeException
+ {
+ if (e instanceof InvocationException)
+ {
+ throw (InvocationException)e;
+ }
+ if (e instanceof ControllerException)
+ {
+ throw (ControllerException)e;
+ }
+ if (e instanceof RuntimeException)
+ {
+ throw (RuntimeException)e;
+ }
+ throw new ControllerException(e);
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/ControllerCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/CommandContext.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,132 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InterceptorStack;
+import org.jboss.portal.common.invocation.AbstractInvocationContext;
+import org.jboss.portal.core.controller.CoreController;
+import org.jboss.portal.core.controller.ControllerCommand;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ControllerContext extends AbstractInvocationContext
+{
+
+ /** The server invocation. */
+ private ServerInvocation serverInvocation;
+
+ /** The controller. */
+ private CoreController controller;
+
+ /** Depth of the next chain. */
+ protected int nextDepth;
+
+ /** . */
+ protected URLContext forwardURLContext;
+
+ public ControllerContext(ServerInvocation serverInvocation, CoreController controller)
+ {
+ if (serverInvocation == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (controller == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.serverInvocation = serverInvocation;
+ this.controller = controller;
+
+ //
+ addResolver(ControllerCommand.REQUEST_SCOPE, serverInvocation.getContext());
+ addResolver(ControllerCommand.SESSION_SCOPE, serverInvocation.getContext());
+ addResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, serverInvocation.getContext());
+ addResolver(ControllerCommand.PRINCIPAL_SCOPE, serverInvocation.getContext());
+ }
+
+ public void execute(ControllerCommand command) throws ControllerException, InvocationException
+ {
+ if (command == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ command.setContext(this);
+
+ //
+ command.create();
+
+ //
+ try
+ {
+ //
+ nextDepth++;
+
+ // Execute
+ InterceptorStack commandStack = controller.getStackFactory().getInterceptorStack();
+
+ //
+ command.invoke(commandStack);
+ }
+ catch (Exception e)
+ {
+ ControllerCommand.rethrow(e);
+ }
+ finally
+ {
+ // Call destroy
+ command.destroy();
+
+ //
+ command.setContext(null);
+
+ //
+ nextDepth--;
+ }
+ }
+
+ public String encodeURL(ControllerCommand cmd, URLContext urlContext, URLFormat format)
+ {
+ ServerURL serverURL = controller.getURLFactory().doMapping(serverInvocation, cmd);
+ return serverInvocation.getResponse().encodeURL(serverURL, urlContext, format);
+ }
+
+ public ServerInvocation getServerInvocation()
+ {
+ return serverInvocation;
+ }
+
+ public CoreController getController()
+ {
+ return controller;
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/ControllerException.java (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/CommandException.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/CommandException.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ControllerException extends Exception
+{
+ public ControllerException()
+ {
+ }
+
+ public ControllerException(String message)
+ {
+ super(message);
+ }
+
+ public ControllerException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public ControllerException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/ControllerException.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/CommandInterceptor.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/CommandInterceptor.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.server.impl.invocation.JBossInterceptor;
+import org.jboss.portal.core.controller.ControllerCommand;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class ControllerInterceptor extends JBossInterceptor
+{
+
+ public void invoke(Invocation invocation) throws Exception, InvocationException
+ {
+ invoke((ControllerCommand)invocation);
+ }
+
+ public abstract void invoke(ControllerCommand cmd) throws Exception, InvocationException;
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/ControllerSecurityException.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/command/ControllerSecurityException.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ControllerSecurityException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerSecurityException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+import org.jboss.portal.core.controller.ControllerException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ControllerSecurityException extends ControllerException
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -157650218749390553L;
+
+ public ControllerSecurityException()
+ {
+ }
+
+ public ControllerSecurityException(String message)
+ {
+ super(message);
+ }
+
+ public ControllerSecurityException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public ControllerSecurityException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/ControllerSecurityException.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/CoreController.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/CoreController.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,425 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.system.AbstractJBossService;
+import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.controller.command.mapper.CommandFactory;
+import org.jboss.portal.core.controller.command.mapper.URLFactory;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.output.SignOutResult;
+import org.jboss.portal.core.cms.command.StreamContentCommand;
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.theme.page.PageService;
+import org.jboss.portal.theme.PageRendition;
+import org.jboss.portal.portlet.result.Result;
+import org.jboss.portal.portlet.result.RenderResult;
+import org.jboss.portal.portlet.result.HTTPRedirectionResult;
+import org.jboss.portal.portlet.result.InsufficientTransportGuaranteeResult;
+import org.jboss.portal.portlet.result.InsufficientPrivilegesResult;
+import org.jboss.portal.portlet.result.ErrorResult;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ *
+ * @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class CoreController extends AbstractJBossService implements RequestController
+{
+
+ /** . */
+ private PageService pageService;
+
+ /** . */
+ private CommandFactory commandFactory;
+
+ /** . */
+ private URLFactory urlFactory;
+
+ /** . */
+ private InterceptorStackFactory stackFactory;
+
+ /** . */
+ private PortalObjectContainer portalObjectContainer;
+
+ /** . */
+ private InstanceContainer instanceContainer;
+
+ public InstanceContainer getInstanceContainer()
+ {
+ return instanceContainer;
+ }
+
+ public void setInstanceContainer(InstanceContainer instanceContainer)
+ {
+ this.instanceContainer = instanceContainer;
+ }
+
+ public PortalObjectContainer getPortalObjectContainer()
+ {
+ return portalObjectContainer;
+ }
+
+ public void setPortalObjectContainer(PortalObjectContainer portalObjectContainer)
+ {
+ this.portalObjectContainer = portalObjectContainer;
+ }
+
+ public URLFactory getURLFactory()
+ {
+ return urlFactory;
+ }
+
+ public void setURLFactory(URLFactory urlFactory)
+ {
+ this.urlFactory = urlFactory;
+ }
+
+ public CommandFactory getCommandFactory()
+ {
+ return commandFactory;
+ }
+
+ public void setCommandFactory(CommandFactory commandFactory)
+ {
+ this.commandFactory = commandFactory;
+ }
+
+ public PageService getPageService()
+ {
+ return pageService;
+ }
+
+ public void setPageService(PageService pageService)
+ {
+ this.pageService = pageService;
+ }
+
+ public InterceptorStackFactory getStackFactory()
+ {
+ return stackFactory;
+ }
+
+ public void setStackFactory(InterceptorStackFactory stackFactory)
+ {
+ this.stackFactory = stackFactory;
+ }
+
+ public void handle(ServerInvocation invocation) throws ServerException
+ {
+ URLContext urlContext = invocation.getServerContext().getURLContext();
+ ControllerContext controllerContext = new ControllerContext(invocation, this);
+
+ // Invoke the chain that creates the initial command
+ ControllerCommand cmd = commandFactory.doMapping(invocation, invocation.getServerContext().getPortalContextPath(), invocation.getServerContext().getPortalRequestPath());
+
+ //
+ if (cmd == null)
+ {
+ // Handle that case
+ throw new ServerException("No valid command");
+ }
+
+ try
+ {
+ while (true)
+ {
+ Forward forward = null;
+
+ // Execute command
+ try
+ {
+ //
+ controllerContext.execute(cmd);
+
+ // Handle the result
+ forward = handleResult(cmd, invocation);
+ }
+ catch (CommandRedirectionException e)
+ {
+ // Handle the redirection as forward
+ forward = new Forward(e.getRedirection(), null);
+ }
+
+ //
+ if (forward == null)
+ {
+ break;
+ }
+
+ // Find out if we can execute in the same server invocation
+ if (forward.requiresRedirect(invocation))
+ {
+ String url = controllerContext.encodeURL(forward.getCommand(), forward.getURLContext(), null);
+ if (url == null)
+ {
+ throw new ControllerException();
+ }
+ sendRedirect(invocation, url);
+ break;
+ }
+ else
+ {
+ cmd = forward.getCommand();
+ }
+ }
+ }
+ catch (InsufficientTransportGuaranteeException e)
+ {
+ urlContext = URLContext.newInstance(true, urlContext.isAuthenticated());
+ ServerURL serverURL = getURLFactory().doMapping(invocation, cmd);
+ String url = invocation.getResponse().encodeURL(serverURL, urlContext, null);
+ sendRedirect(invocation, url);
+ }
+ catch (ControllerSecurityException e)
+ {
+ if (urlContext.isAuthenticated())
+ {
+ sendStatusCode(invocation, HttpServletResponse.SC_UNAUTHORIZED);
+ }
+ else
+ {
+ urlContext = URLContext.newInstance(urlContext.getSecure(), true);
+ ServerURL serverURL = getURLFactory().doMapping(invocation, cmd);
+ String url = invocation.getResponse().encodeURL(serverURL, urlContext, null);
+ sendRedirect(invocation, url);
+ }
+ }
+ catch (ResourceNotFoundException e)
+ {
+ sendStatusCode(invocation, HttpServletResponse.SC_NOT_FOUND);
+ }
+ catch (ControllerException e)
+ {
+ throw new ServerException(e);
+ }
+ catch (ServletException e)
+ {
+ throw new ServerException(e);
+ }
+ catch (IOException e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ /**
+ *
+ */
+ private Forward handleResult(ControllerCommand cmd, ServerInvocation invocation) throws IOException, ServletException, ServerException
+ {
+ if (cmd instanceof RenderPageCommand)
+ {
+ PageRendition rendition = ((RenderPageCommand)cmd).getResult();
+ rendition.render(invocation);
+ return null;
+ }
+ else if (cmd instanceof InvokeWindowActionCommand)
+ {
+ InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)cmd;
+ PortletInvocation pinv = iwac.getInvocation();
+
+ //
+ Result result = pinv.getResult();
+
+ //
+ if (result instanceof RenderResult)
+ {
+ RenderResult renderResult = (RenderResult)result;
+ StateString portletNavState = renderResult.getNavigationalState();
+ WindowState windowState = renderResult.getWindowState();
+ Mode mode = renderResult.getMode();
+ InvokeWindowRenderCommand iwrc = new InvokeWindowRenderCommand(
+ iwac.getWindowRef(),
+ mode,
+ windowState,
+ portletNavState);
+ return new Forward(iwrc, null);
+ }
+ else if (result instanceof HTTPRedirectionResult)
+ {
+ HTTPRedirectionResult redirectionResult = (HTTPRedirectionResult)result;
+ String url = redirectionResult.getLocation();
+ sendRedirect(invocation, url);
+ }
+ else if (result instanceof InsufficientTransportGuaranteeResult)
+ {
+ boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
+ return new Forward(iwac, URLContext.newInstance(true, authenticated));
+ }
+ else if (result instanceof InsufficientPrivilegesResult)
+ {
+ boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
+ return new Forward(iwac, URLContext.newInstance(true, authenticated));
+ }
+ else if (result instanceof SignOutResult)
+ {
+ SignOutResult signOut = (SignOutResult)result;
+
+ // Indicate that we want a sign out to be done
+ invocation.getResponse().setWantSignOut(true);
+
+ // Get the optional signout location
+ String location = signOut.getLocation();
+
+ //
+ if (location == null)
+ {
+ // Redirect to the same page
+ Page page = iwac.getPage();
+ RenderPageCommand renderCmd = new RenderPageCommand(page.getId());
+ boolean secure = invocation.getServerContext().getURLContext().getSecure();
+ URLContext urlInfo = URLContext.newInstance(secure, false);
+ return new Forward(renderCmd, urlInfo);
+ }
+ else
+ {
+ sendRedirect(invocation, location);
+ }
+ }
+ else if (result instanceof ErrorResult)
+ {
+ ErrorResult error = (ErrorResult)result;
+ error.logErrorTo(log, "An portlet exception occured in portlet " + iwac.getInstance().getId());
+ sendStatusCode(invocation, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ else
+ {
+ throw new IllegalStateException();
+ }
+ }
+ else if (cmd instanceof InvokeWindowRenderCommand)
+ {
+ InvokeWindowRenderCommand iwrc = (InvokeWindowRenderCommand)cmd;
+ RenderPageCommand renderCmd = new RenderPageCommand(iwrc.getPage().getId());
+ return new Forward(renderCmd, null);
+ }
+ else if (cmd instanceof StreamContentCommand)
+ {
+ StreamContentCommand scc = (StreamContentCommand)cmd;
+ scc.stream(invocation);
+ }
+ return null;
+ }
+
+ private void sendStatusCode(ServerInvocation invocation, int sc) throws ServerException
+ {
+ try
+ {
+ HttpServletResponse resp = invocation.getServerContext().getClientResponse();
+ resp.sendError(sc);
+ }
+ catch (IOException e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ private void sendRedirect(ServerInvocation invocation, String redirect) throws ServerException
+ {
+ try
+ {
+ HttpServletResponse resp = invocation.getServerContext().getClientResponse();
+ resp.sendRedirect(redirect);
+ }
+ catch (IOException e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ public static class Forward
+ {
+
+ /** . */
+ private final ControllerCommand cmd;
+
+ /** . */
+ private final URLContext urlCtx;
+
+ public Forward(ControllerCommand cmd, URLContext urlCtx)
+ {
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No command provided");
+ }
+ this.cmd = cmd;
+ this.urlCtx = urlCtx;
+ }
+
+ public boolean requiresRedirect(ServerInvocation invocation)
+ {
+ CommandInfo cmdInfo = cmd.getInfo();
+ if (cmdInfo instanceof ActionCommandInfo && !((ActionCommandInfo)cmdInfo).isIdempotent())
+ {
+ return true;
+ }
+ else
+ {
+ boolean currentAuthenticated = invocation.getServerContext().getURLContext().isAuthenticated();
+ if (urlCtx != null && currentAuthenticated != urlCtx.isAuthenticated())
+ {
+ return true;
+ }
+ else
+ {
+ boolean currentSecure = invocation.getServerContext().getURLContext().getSecure();
+ if (urlCtx != null && urlCtx.getSecure() && !currentSecure)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public ControllerCommand getCommand()
+ {
+ return cmd;
+ }
+
+ public URLContext getURLContext()
+ {
+ return urlCtx;
+ }
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/InsufficientTransportGuaranteeException.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/command/InsufficientTransportGuaranteeException.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InsufficientTransportGuaranteeException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/InsufficientTransportGuaranteeException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+import org.jboss.portal.core.controller.ControllerSecurityException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InsufficientTransportGuaranteeException extends ControllerSecurityException
+{
+
+}
Copied: trunk/core/src/main/org/jboss/portal/core/controller/ResourceAccessDeniedException.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/command/ObjectSecurityException.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ObjectSecurityException.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ResourceAccessDeniedException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+import org.jboss.portal.core.controller.ControllerSecurityException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ResourceAccessDeniedException extends ControllerSecurityException
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 3506674156010581342L;
+
+ /** Object reference pointing to the not found object. */
+ private String ref;
+
+ public ResourceAccessDeniedException(String message, String ref)
+ {
+ super(ref + " has denied access: " + message);
+ this.ref = ref;
+ }
+
+ public ResourceAccessDeniedException(String ref)
+ {
+ super(ref + " has denied access");
+ this.ref = ref;
+ }
+
+ /**
+ * Return some kind of reference to the not found object.
+ */
+ public String getRef()
+ {
+ return ref;
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/ResourceAccessDeniedException.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/ResourceNotFoundException.java (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/ObjectNotFoundException.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/ObjectNotFoundException.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ResourceNotFoundException.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller;
+
+import org.jboss.portal.core.controller.ControllerException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ResourceNotFoundException extends ControllerException
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -1311521920998110717L;
+
+ /** Object reference pointing to the not found object. */
+ private String ref;
+
+ public ResourceNotFoundException(String ref)
+ {
+ super("Resource not found " + ref);
+ this.ref = ref;
+ }
+
+ /**
+ * Return some kind of reference to the not found object.
+ */
+ public String getRef()
+ {
+ return ref;
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/ResourceNotFoundException.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowActionCommand.java (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowActionCommand.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowActionCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,140 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.command;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.controller.portlet.ControllerActionContext;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.server.ServerInvocation;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InvokeWindowActionCommand extends InvokeWindowCommand
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(InvokeWindowActionCommand.class);
+
+ /** . */
+ private static final CommandInfo info = new ActionCommandInfo(false, "view", false);
+
+ /** . */
+ private StateString navigationalState;
+
+ /** . */
+ private StateString interactionState;
+
+ /** . */
+ private Parameters formParameters;
+
+ /** . */
+ private PortletInvocation invocation;
+
+ public InvokeWindowActionCommand(
+ String windowRef,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ StateString interactionState,
+ Parameters formParameters)
+ throws IllegalArgumentException
+ {
+ super(windowRef, mode, windowState);
+ this.navigationalState = navigationalState;
+ this.interactionState = interactionState;
+ this.formParameters = formParameters;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public void setInteractionState(StateString interactionState)
+ {
+ this.interactionState = interactionState;
+ }
+
+ public Parameters getFormParameters()
+ {
+ return formParameters;
+ }
+
+ public void setFormParameters(Parameters formParameters)
+ {
+ this.formParameters = formParameters;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public PortletInvocation getInvocation()
+ {
+ return invocation;
+ }
+
+ public void execute() throws ControllerException
+ {
+ try
+ {
+ ServerInvocation sinv = context.getServerInvocation();
+ ControllerContext controllerCtx = (ControllerContext)getContext();
+ ControllerActionContext actionCtx = new ControllerActionContext(controllerCtx, sinv, portal, navigationalState, getWindowState(), getMode(), interactionState, formParameters, window);
+ PortletInvocation invocation = actionCtx.createInvocation();
+
+ //
+ this.instance.invoke(invocation);
+ this.invocation = invocation;
+ }
+ catch (PortletInvokerException e)
+ {
+ if (e instanceof NoSuchPortletException)
+ {
+ throw new ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
+ }
+ else
+ {
+ throw new ControllerException(e);
+ }
+ }
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowActionCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowCommand.java (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowCommand.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.command;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.controller.command.WindowCommand;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class InvokeWindowCommand extends WindowCommand
+{
+
+ /** . */
+ protected final Mode mode;
+
+ /** . */
+ protected final WindowState windowState;
+
+ public InvokeWindowCommand(String windowRef, Mode mode, WindowState windowState) throws IllegalArgumentException
+ {
+ super(windowRef);
+ this.mode = mode;
+ this.windowState = windowState;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowRenderCommand.java (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/InvokeWindowRenderCommand.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowRenderCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,120 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.command;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.core.aspects.controller.PageNavigationInterceptor;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.theme.strategy.StrategyException;
+import org.jboss.portal.theme.navigation.WindowNavigationalState;
+import org.jboss.portal.theme.LayoutService;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InvokeWindowRenderCommand extends InvokeWindowCommand
+{
+
+ private static final CommandInfo info = new ViewCommandInfo(false, "view");
+
+ /** . */
+ protected final StateString navigationalState;
+
+ public InvokeWindowRenderCommand(
+ String windowRef,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState)
+ throws IllegalArgumentException
+ {
+ super(windowRef, mode, windowState);
+ this.navigationalState = navigationalState;
+ }
+
+ public InvokeWindowRenderCommand(
+ String windowRef,
+ Mode mode,
+ WindowState windowState)
+ throws IllegalArgumentException
+ {
+ super(windowRef, mode, windowState);
+ this.navigationalState = null;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public void execute() throws InvocationException
+ {
+ InvocationContext ctx = getContext();
+
+ //
+ if (navigationalState != null)
+ {
+ ctx.setAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef(), navigationalState);
+ }
+
+ // Update the window nav state
+ WindowNavigationalState windowNavState = (WindowNavigationalState)ctx.getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef() + "_window");
+ if (windowNavState == null)
+ {
+ windowNavState = new WindowNavigationalState();
+ ctx.setAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
+ }
+ if (mode != null)
+ {
+ windowNavState.setMode(mode);
+ }
+ if (windowState != null)
+ {
+ windowNavState.setWindowState(windowState);
+ }
+
+ // Udpate the page nav state
+ try
+ {
+ ServerInvocation sinv = ((ControllerContext)getContext()).getServerInvocation();
+ LayoutService layoutService = ((ControllerContext)getContext()).getController().getPageService().getLayoutService();
+ PageNavigationInterceptor.updatePageNavigationalState(layoutService, context, sinv, portal, page, window, getMode(), getWindowState());
+ }
+ catch (StrategyException e)
+ {
+ throw new InvocationException(e);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/command/InvokeWindowRenderCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/MarkupCommand.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/MarkupCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/MarkupCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,723 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.command;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.util.Exceptions;
+import org.jboss.portal.core.controller.portlet.ControllerPortletInvocationContext;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.InsufficientTransportGuaranteeException;
+import org.jboss.portal.core.controller.ResourceAccessDeniedException;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.controller.command.RenderWindowCommand;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.portlet.Properties;
+import org.jboss.portal.portlet.info.ModeInfo;
+import org.jboss.portal.portlet.info.WindowStateInfo;
+import org.jboss.portal.portlet.result.ErrorResult;
+import org.jboss.portal.portlet.result.FragmentResult;
+import org.jboss.portal.portlet.result.InsufficientPrivilegesResult;
+import org.jboss.portal.portlet.result.InsufficientTransportGuaranteeResult;
+import org.jboss.portal.portlet.result.Result;
+import org.jboss.portal.portlet.result.UnavailableResult;
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.security.PortalSecurityException;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.config.ServerConfig;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.PortalTheme;
+import org.jboss.portal.theme.ServerRegistrationID;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.ThemeResult;
+import org.jboss.portal.theme.ThemeService;
+import org.jboss.portal.theme.PageRendition;
+import org.jboss.portal.theme.navigation.PageNavigationalState;
+import org.jboss.portal.theme.navigation.WindowNavigationalState;
+import org.jboss.portal.theme.page.MarkupContainer;
+import org.jboss.portal.theme.page.ModifiableWindowResult;
+import org.jboss.portal.theme.page.PageService;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.render.MarkupResult;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+/**
+ * Abstract base class for portal object commands that produce markup (of a page, region, window). <p>This command
+ * contains all the shared functionality amongst all commands that create page , or page fragment markup, like the
+ * RenderPageCommand and the RenderRegionCommand.</p>
+ *
+ * @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
+ * @version $Revision$
+ */
+public abstract class MarkupCommand extends PortalObjectCommand
+{
+
+ /** . */
+ private static String WINDOW_ACCESS_DENIED = "core.render.window_access_denied";
+
+ /** . */
+ private static String WINDOW_UNAVAILABLE = "core.render.window_unavailable";
+
+ /** . */
+ private static String WINDOW_ERROR = "core.render.window_error";
+
+ /** . */
+ private static String WINDOW_INTERNAL_ERROR = "core.render.window_internal_error";
+
+ /** . */
+ private static String WINDOW_NOT_FOUND = "core.render.window_not_found";
+
+ /** . */
+ private static String HIDE = "hide";
+
+ /** . */
+ private static String SHOW = "show";
+
+ /** . */
+ private static final CommandInfo info = new ViewCommandInfo(false, "view");
+
+ /** . */
+ private final String pageRef;
+
+ /** . */
+ private final MarkupContainer markupContainer;
+
+ /** . */
+ private Page page;
+
+ /** . */
+ private PortalLayout layout;
+
+ /** . */
+ private boolean personalizable;
+
+ /** . */
+ private PageRendition result;
+
+ /**
+ * render the entire page
+ *
+ * @param pageRef the page idenitifier of the page to render
+ */
+ public MarkupCommand(String pageRef)
+ {
+ this(pageRef, null);
+ }
+
+ /**
+ * render a fragment on the page (a region or a window on the page)
+ *
+ * @param pageRef the page idenitifier of the page to render
+ * @param markupContainer the fragment to render (the region or the window); if the argument is null, the entire page
+ * will be rendered
+ */
+ public MarkupCommand(String pageRef, MarkupContainer markupContainer)
+ {
+ if (pageRef == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.pageRef = pageRef;
+ this.markupContainer = markupContainer;
+ }
+
+ /**
+ * call the component invocation(s) to create the markup fragment(s) for this request
+ *
+ * @param cfg the server config to get config information (for error behaviour )
+ * @param navCtx the navigational state context to get to the window navigational state
+ * @return a markup result containing the fragments rendered by the portlets in this command
+ * @throws InvocationException
+ */
+ public abstract MarkupResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws ControllerException;
+
+ /**
+ * for security checks and navigational state, return the page of the requested MarkupContainer
+ *
+ * @return the requested page (or the page of the requested region or window)
+ */
+ public PortalObject getTarget()
+ {
+ return page;
+ }
+
+ /**
+ * Get the command info (runtime info about the command)
+ *
+ * @return info about the command
+ */
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ /**
+ * Get the identifier of the requeste page
+ *
+ * @return the identifier of the requeste page
+ */
+ public String getPageRef()
+ {
+ return pageRef;
+ }
+
+ /**
+ * Get the requeste page
+ *
+ * @return the requested page
+ */
+ public Page getPage()
+ {
+ return page;
+ }
+
+ /**
+ * Get the layout that was determined for this request (based on portal and page properties)
+ *
+ * @return the layout to use for this request
+ */
+ public PortalLayout getLayout()
+ {
+ return layout;
+ }
+
+ /**
+ * Get the fragment identifier of the page fragment that was requested
+ *
+ * @return the region or window to render as part of this request
+ */
+ public MarkupContainer getMarkupContainer()
+ {
+ return markupContainer;
+ }
+
+ public PageRendition getResult()
+ {
+ return result;
+ }
+
+ /**
+ * initialize the command
+ *
+ * @throws InvocationException
+ */
+ public void create() throws ControllerException
+ {
+ // Get page
+ page = (Page)context.getController().getPortalObjectContainer().getObject(pageRef);
+ if (page == null)
+ {
+ throw new ResourceNotFoundException(pageRef);
+ }
+
+ // Get nearest portal ancestor
+ if (page.getPortal() == null)
+ {
+ throw new ResourceNotFoundException("Portal for " + pageRef);
+ }
+
+ //
+ LayoutService layoutService = context.getController().getPageService().getLayoutService();
+ layout = getLayout(layoutService, page);
+ }
+
+ public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
+ {
+ //
+ super.enforceSecurity(pam);
+
+ // Check if the user can personalize the page
+ String uri = page.getId();
+ PortalObjectPermission perm = new PortalObjectPermission(uri, PortalObjectPermission.PERSONALIZE_MASK);
+ personalizable = pam.checkPermission(perm);
+ }
+
+ /**
+ * execute the command
+ *
+ * @throws InvocationException
+ */
+ public final void execute() throws ControllerException, InvocationException
+ {
+ ServerInvocation sinv = context.getServerInvocation();
+ HttpServletRequest request = sinv.getServerContext().getClientRequest();
+ try
+ {
+ // Ensure that the page nav state is in place
+ AttributeResolver navCtx = sinv.getContext().getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
+ PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(page.getId());
+
+ if (pageNavState == null)
+ {
+ throw new InvocationException("PageNavigationalState not available in NavigationalStateContext");
+ }
+
+ //
+ PageService pageService = context.getController().getPageService();
+ PortalTheme theme = null;
+
+ if (personalizable)
+ {
+ ControllerContext controllerCtx = (ControllerContext)getContext();
+ User user = (User)controllerCtx.getServerInvocation().getRequest().getUser();
+ if (user != null)
+ {
+ String themeId = user.getTheme();
+ if (themeId != null)
+ {
+ theme = getTheme(themeId);
+ }
+ }
+ }
+
+ // If nothing get it from the object properties
+ if (theme == null)
+ {
+ String themeId = page.getProperty(ThemeConstants.PORTAL_PROP_THEME);
+ theme = getTheme(themeId);
+ }
+
+ // Make the theme available as servlet request attribute (needed for CM)
+ if (theme != null)
+ {
+ // render the theme markup and place it into the request so that the markup assembler (theme tag) can pick it up there
+ ThemeResult themeResult = theme.assembleResponse(sinv.getRequest(), sinv.getResponse());
+ request.setAttribute(ThemeConstants.ATTR_THEMERESULT, themeResult);
+ request.setAttribute(ThemeConstants.ATTR_THEME, theme);
+ }
+
+ // Call the portlet container to create the markup fragment(s) for each portlet that needs to render itself
+ ServerConfig cfg = sinv.getRequest().getServer().getConfig();
+ MarkupResult renderResult = renderFragments(cfg, navCtx);
+
+ //
+ result = new PageRendition(layout, pageNavState, renderResult, pageService);
+ }
+ catch (Exception e)
+ {
+ ControllerCommand.rethrow(e);
+ }
+ finally
+ {
+ request.removeAttribute(ThemeConstants.ATTR_THEMESERVER);
+ request.removeAttribute(ThemeConstants.ATTR_THEME);
+ request.removeAttribute(ThemeConstants.ATTR_THEMERESULT);
+ }
+ }
+
+ private PortalTheme getTheme(String themeIdString)
+ {
+ //
+ ThemeService service = context.getController().getPageService().getThemeService();
+
+ // If the id is provided in the form of context.name then look up the theme via a registration id
+ if (themeIdString.lastIndexOf(".") > 0)
+ {
+ ServerRegistrationID themeId = ServerRegistrationID.createID(ServerRegistrationID.TYPE_THEME, parseID(themeIdString));
+ return service.getTheme(themeId, true);
+ }
+ else
+ {
+ // Otherwise use the ordinary theme name provided and lookup the theme via the name
+ return service.getTheme(themeIdString, true);
+ }
+ }
+
+ /**
+ * Get the portal layout to use for the provided page. <p>The name of the layout to use can be defined as a property
+ * in the portal, or the individual page. The page property overwrites the portal property. If no property was set, a
+ * default layout with the name "nodesk" is assumed.</p>
+ *
+ * @param layoutService the layout service that allows access to the layout
+ * @param page the page that hosts the markup container to render (the page, region, window,...)
+ * @return a <code>PortalLayout</code> for the defined layout name
+ */
+ public static PortalLayout getLayout(LayoutService layoutService, Page page)
+ {
+ String layoutIDString = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+
+ // Last resort: use the nodesk layout
+ if (layoutIDString == null)
+ {
+ layoutIDString = "nodesk";
+ }
+
+ //
+ PortalLayout layout = null;
+ if (layoutIDString.lastIndexOf(".") > 0)
+ {
+ // if the id is provided in the form of context.name then look up the layout via a registration id
+ ServerRegistrationID layoutID = ServerRegistrationID.createID(ServerRegistrationID.TYPE_LAYOUT, parseID(layoutIDString));
+ layout = layoutService.getLayout(layoutID, true);
+ }
+ else
+ {
+ // otherwise use the ordinary layout name provided and lookup the layout via the name
+ layout = layoutService.getLayout(layoutIDString, true);
+ }
+
+ // We don't like that situation
+ if (layout == null)
+ {
+ throw new IllegalStateException("NO LAYOUT FOUND FOR " + layoutIDString);
+ }
+
+ //
+ return layout;
+ }
+
+ /**
+ * Call the component container to render the markup fragment of a window
+ *
+ * @param cfg the server config to get information about the error behaviour
+ * @param window the window to render
+ * @return a result containing markup, or other result information (redirect url, etc.)
+ * @throws InvocationException
+ */
+ protected MarkupResult renderPortletWindow(ServerConfig cfg, Window window) throws ControllerException
+ {
+ // Execute render command
+ String windowRef = window.getId();
+
+ //
+ String windowTitle;
+ String contentChars = "";
+ String headerChars = null;
+ Map actionMap = new HashMap();
+ Properties responseProps;
+ Map windowProps = window.getDeclaredPropertyMap();
+
+ try
+ {
+ RenderWindowCommand renderCmd = new RenderWindowCommand(windowRef);
+
+ //
+ context.execute(renderCmd);
+
+ // The result should be a fragment result
+ Result result = renderCmd.getResult();
+
+ //
+ if (result instanceof InsufficientTransportGuaranteeResult)
+ {
+ throw new InsufficientTransportGuaranteeException();
+ }
+
+ // Compute actions
+ ControllerPortletInvocationContext invCtx = (ControllerPortletInvocationContext)renderCmd.getInvocation().getContext();
+
+ // Get window navigational state
+ WindowNavigationalState windowNavState = (WindowNavigationalState)this.context.getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window");
+
+ //
+ if (result instanceof FragmentResult)
+ {
+ FragmentResult fragment = (FragmentResult)result;
+ windowTitle = fragment.getTitle();
+ if (windowTitle == null)
+ {
+ windowTitle = window.getName();
+ }
+ headerChars = fragment.getHeader();
+ responseProps = fragment.getProperties();
+
+ //
+ PortalContext ctx = renderCmd.getInvocation().getPortalContext();
+ Instance instance = renderCmd.getInstance();
+
+ //
+ List supportedWindowStates = new ArrayList();
+ for (Iterator i = instance.getPortlet().getInfo().getCapabilities().getAllWindowStates().iterator(); i.hasNext();)
+ {
+ WindowStateInfo windowStateInfo = (WindowStateInfo)i.next();
+ WindowState windowState = windowStateInfo.getWindowState();
+ if (ctx.getWindowStates().contains(windowState))
+ {
+ supportedWindowStates.add(windowState);
+ }
+ }
+
+ //
+ List supportedModes = new ArrayList();
+ for (Iterator i = instance.getPortlet().getInfo().getCapabilities().getAllModes().iterator(); i.hasNext();)
+ {
+ ModeInfo modeInfo = (ModeInfo)i.next();
+ Mode mode = modeInfo.getMode();
+ if (ctx.getModes().contains(mode))
+ {
+ supportedModes.add(mode);
+ }
+ }
+
+ // Remove edit mode if the user is not logged it
+ // commenting out for now since it breaks the tests
+ /*if (renderCmd.getInvocation().getUserContext().getUser() == null)
+ {
+ supportedModes.remove(Mode.EDIT);
+ }*/
+
+ //
+ addModeActions(actionMap, windowNavState.getMode(), supportedModes, invCtx);
+
+ //
+ addStateActions(actionMap, windowNavState.getWindowState(), supportedWindowStates, invCtx);
+
+ switch (fragment.getType())
+ {
+ case FragmentResult.TYPE_CHARS:
+ contentChars = fragment.getChars().toString();
+ break;
+ case FragmentResult.TYPE_BYTES:
+ // Funny for now we don't know how to interpret that or we should not
+ // because it is for some kind of flash portal ?
+ contentChars = fragment.getBytes().toString();
+ break;
+ case FragmentResult.TYPE_EMPTY:
+ // Do nothing, the contentChars is already empty string
+ break;
+ }
+ return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
+ }
+ else if (result instanceof ErrorResult)
+ {
+ ErrorResult errorResult = (ErrorResult)result;
+ String logMessage = "Rendering portlet window " + windowRef + " triggered the following error :";
+ errorResult.logErrorTo(ControllerCommand.log, logMessage);
+ String property = cfg.getProperty(WINDOW_ERROR);
+ if (!HIDE.equals(property))
+ {
+ windowTitle = "An error occured while rendering window '" + windowRef + "'";
+ responseProps = new Properties();
+ contentChars = errorResult.getMessage();
+ Throwable t = errorResult.getThrowable();
+ if (t != null && SHOW.equals(property))
+ {
+ contentChars = Exceptions.toHTML(t, true);
+ }
+ return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
+ }
+ }
+ else if (result instanceof UnavailableResult)
+ {
+ if (SHOW.equals(cfg.getProperty(WINDOW_UNAVAILABLE)))
+ {
+ windowTitle = "Portlet unavailable";
+ contentChars = "Portlet unavailable";
+ actionMap = new HashMap();
+ actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
+ actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
+ responseProps = new Properties();
+ return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
+ }
+ }
+ else if (result instanceof InsufficientPrivilegesResult)
+ {
+ // Julien : go to the section below, I know it is very ugly
+ throw new ResourceAccessDeniedException(windowRef);
+ }
+ else
+ {
+ ControllerCommand.log.error("Unexpected result from a portlet invocation " + result);
+ return null;
+ }
+ }
+ catch (ResourceAccessDeniedException e)
+ {
+ if (ControllerCommand.log.isTraceEnabled())
+ {
+ ControllerCommand.log.trace("Window access denied", e);
+ }
+ if (SHOW.equals(cfg.getProperty(WINDOW_ACCESS_DENIED)))
+ {
+ actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
+ actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
+ windowTitle = "Access denied";
+ contentChars = "Access denied";
+ responseProps = new Properties();
+ return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
+ }
+ }
+ catch (ResourceNotFoundException e)
+ {
+ if (ControllerCommand.log.isTraceEnabled())
+ {
+ ControllerCommand.log.trace("Window not found", e);
+ }
+ if (SHOW.equals(cfg.getProperty(WINDOW_NOT_FOUND)))
+ {
+ actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
+ actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
+ windowTitle = "Cannot render";
+ contentChars = "Object not found " + e.getRef();
+ responseProps = new Properties();
+ return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
+ }
+ }
+ catch (ControllerException e)
+ {
+ // It's a CommandException that we rethrow
+ throw e;
+ }
+ catch (Exception e)
+ {
+ ControllerCommand.log.error("Rendering portlet window " + windowRef + " produced an internal error", e);
+ String property = cfg.getProperty(WINDOW_INTERNAL_ERROR);
+ if (SHOW.equals(property))
+ {
+ windowTitle = "An internal error occured while rendering window '" + window + "'";
+ responseProps = new Properties();
+ contentChars = Exceptions.toHTML(e, true);
+ return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * parse the provided String for '.' as a separator. For each token, add an entry to a String[] that will be returned
+ * as the result
+ *
+ * @param layoutIDString the string to be examined
+ * @return an array of Strings
+ */
+ private static String[] parseID(String layoutIDString)
+ {
+ List names = new ArrayList();
+ StringTokenizer tokens = new StringTokenizer(layoutIDString, ".");
+ if (tokens.countTokens() > 1)
+ {
+ while (tokens.hasMoreElements())
+ {
+ names.add(tokens.nextToken());
+ }
+ }
+ else
+ {
+ names.add(layoutIDString);
+ }
+
+ String[] id = new String[names.size()];
+ names.toArray(id);
+ return id;
+ }
+
+ /**
+ * Create the action URLs for the allowed window states of the rendered portlet window and add them to the provided
+ * actionMap
+ *
+ * @param actionMap
+ * @param currentWindowState
+ * @param invCtx
+ */
+ private static void addStateActions(Map actionMap, WindowState currentWindowState, List supportedWindowStates, ControllerPortletInvocationContext invCtx)
+ {
+ List windowStates = new ArrayList(supportedWindowStates.size());
+ for (Iterator j = supportedWindowStates.iterator(); j.hasNext();)
+ {
+ WindowState windowState = (WindowState)j.next();
+ String url = invCtx.createUpdateNavigationalStateURL(null, windowState);
+ boolean disabled = windowState.equals(currentWindowState);
+ WindowResult.Action action = new WindowResult.Action(windowState, url, !disabled);
+ windowStates.add(action);
+ }
+ actionMap.put(WindowResult.WINDOWSTATES_KEY, windowStates);
+ }
+
+ /**
+ * Create the action URLs for the allowed portlet modes of the rendered portlet window and add them to the provided
+ * actionMap
+ *
+ * @param actionMap
+ * @param currentMode
+ * @param invCtx
+ */
+ private static void addModeActions(Map actionMap, Mode currentMode, List supportedModes, ControllerPortletInvocationContext invCtx)
+ {
+ List modes = new ArrayList(supportedModes.size());
+ for (Iterator j = supportedModes.iterator(); j.hasNext();)
+ {
+ Mode mode = (Mode)j.next();
+ String url = invCtx.createUpdateNavigationalStateURL(mode, null);
+ boolean disabled = mode.equals(currentMode);
+ WindowResult.Action action = new WindowResult.Action(mode, url, !disabled);
+ modes.add(action);
+ }
+ actionMap.put(WindowResult.MODES_KEY, modes);
+ }
+
+/*
+ private static void createMoveActions(Map actionMap, WindowNavigationalState state, RenderInvocation render, String handle)
+ {
+ Parameters ctrlParams = new Parameters();
+
+ ctrlParams.setValue("cmd", "move");
+ ctrlParams.setValue("window", handle);
+
+ ServerURL serverURL = new ServerURL();
+ serverURL.setParameters("ctrl", ctrlParams);
+
+ ServerInvocation serverInvocation = context.getServerInvocation();
+ ServerResponseContext serverResponseContext = serverInvocation.getResponse().getContext();
+ String url = serverResponseContext.encodeURL(serverURL);
+
+ WindowResult.Action action = new WindowResult.Action("move", url, true);
+ List moves = new ArrayList();
+ moves.add(action);
+ actionMap.put("move", moves);
+
+// List windowStates = new ArrayList(render.getRequest().getSupportedWindowStates().size());
+// for (Iterator j = render.getRequest().getSupportedWindowStates().iterator(); j.hasNext();)
+// {
+// WindowState windowState = (WindowState)j.next();
+// ServerURL serverURL = crespctx.createUpdateNavigationalStateURL(null, windowState);
+// String url = serverResponseContext.encodeURL(serverURL);
+// boolean disabled = windowState.equals(state.getWindowState());
+// WindowResult.Action action = new WindowResult.Action(windowState.toString(), url, !disabled);
+// windowStates.add(action);
+// }
+// actionMap.put("windowstate", windowStates);
+ }
+*/
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/command/MarkupCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/command/PortalObjectCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/PortalObjectCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.command;
+
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.core.controller.ResourceAccessDeniedException;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+import org.jboss.portal.security.PortalSecurityException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class PortalObjectCommand extends ControllerCommand
+{
+
+ /**
+ * Enforce the security on this command using the provided portal authorization manager.
+ *
+ * @param pam the portal authorization manager
+ * @throws org.jboss.portal.core.controller.ControllerSecurityException if the access is not granted
+ */
+ public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
+ {
+ PortalObject target = getTarget();
+ String id = target.getId();
+ PortalObjectPermission perm = new PortalObjectPermission(id, PortalObjectPermission.VIEW_MASK);
+ if(!pam.checkPermission(perm))
+ {
+ throw new ResourceAccessDeniedException("Not Authorized");
+ }
+ }
+
+ /**
+ * Return the target portal object of this command.
+ *
+ * @return the target portal object
+ */
+ public abstract PortalObject getTarget();
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/RenderPageCommand.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,92 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.command;
+
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.server.config.ServerConfig;
+import org.jboss.portal.theme.navigation.PageNavigationalState;
+import org.jboss.portal.theme.page.ModifiablePageResult;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.render.MarkupResult;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Render a full page.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public final class RenderPageCommand extends MarkupCommand
+{
+ public RenderPageCommand(String pageRef)
+ {
+ super(pageRef);
+ }
+
+ /**
+ * Call the component / portlet invocation for each window on the page, and create a markup result with the resulting markup fragments in it
+ *
+ * @param cfg the server configuration to get access to customizable error behaviour
+ * @param navCtx the navigational state context to access page and window navigational state
+ * @return a modifiable page result containing the markup fragments from the individual portlets on this page
+ * @throws InvocationException
+ */
+ public MarkupResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws ControllerException
+ {
+ PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(getPage().getId());
+ ModifiablePageResult pageResult = new ModifiablePageResult(navCtx, getPage().getName(), getPage().getDeclaredPropertyMap(), getPage().getPortal().getDeclaredPropertyMap());
+
+ // all windows on the page
+ Collection windows = getPage().getChildren();
+
+ // Render
+ for (Iterator i = windows.iterator(); i.hasNext();)
+ {
+ PortalObject o = (PortalObject)i.next();
+
+ // Render only window children
+ if (o instanceof Window)
+ {
+ Window window = (Window)o;
+
+ // That are visible ?
+ if (pageNavState.isWindowVisible(window.getId()))
+ {
+ MarkupResult result = renderPortletWindow(cfg, window);
+ if (result != null)
+ {
+ pageResult.addWindowContext(pageNavState.getWindowContext(window.getId()));
+ pageResult.addWindowResult(window.getId(), (WindowResult)result);
+ }
+ }
+ }
+ }
+
+ return pageResult;
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/RenderWindowCommand.java (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/RenderWindowCommand.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/RenderWindowCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,132 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.command;
+
+import org.jboss.portal.core.controller.portlet.ControllerRenderContext;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.command.WindowCommand;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.result.Result;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.theme.navigation.WindowNavigationalState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+/**
+ * Render a single window.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class RenderWindowCommand extends WindowCommand
+{
+
+ private static final CommandInfo info = new ViewCommandInfo(true, "view");
+
+ // private RenderInvocation render;
+
+ private Result result;
+
+ private RenderInvocation invocation;
+
+ public RenderWindowCommand(String windowRef)
+ throws IllegalArgumentException
+ {
+ super(windowRef);
+ }
+
+ public Result getResult()
+ {
+ return result;
+ }
+
+// public CoreRenderContext getRenderContext()
+// {
+// return renderContext;
+// }
+
+ public RenderInvocation getInvocation()
+ {
+ return invocation;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public void execute() throws ControllerException
+ {
+ ServerInvocation sinv = context.getServerInvocation();
+
+ //
+ StateString ns = (StateString)getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef());
+
+ //
+ WindowNavigationalState windowNavState = (WindowNavigationalState)getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, windowRef + "_window");
+ if (windowNavState == null)
+ {
+ windowNavState = new WindowNavigationalState();
+ setAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
+ }
+
+ // Get the mode
+ Mode mode = windowNavState.getMode();
+
+ // Get the window state
+ WindowState windowState = windowNavState.getWindowState();
+
+ //
+ ControllerRenderContext renderContext = new ControllerRenderContext((ControllerContext)getContext(), sinv, portal, ns, mode, windowState, window);
+
+ //
+ invocation = (RenderInvocation)renderContext.createInvocation();
+
+ //
+ try
+ {
+ instance.invoke(invocation);
+ }
+ catch (PortletInvokerException e)
+ {
+ if (e instanceof NoSuchPortletException)
+ {
+ throw new ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
+ }
+ else
+ {
+ throw new ControllerException(e);
+ }
+ }
+
+ //
+ result = invocation.getResult();
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/command/RenderWindowCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java (from rev 5135, trunk/core/src/main/org/jboss/portal/core/command/WindowCommand.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/WindowCommand.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,140 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.command;
+
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+import org.jboss.portal.security.PortalSecurityException;
+
+/**
+ * A superclass for command that target a specific window.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class WindowCommand extends PortalObjectCommand
+{
+
+ /** The window ref. */
+ protected String windowRef;
+
+ /** The portal. */
+ protected Portal portal;
+
+ /** The portal. */
+ protected Page page;
+
+ /** The window. */
+ protected Window window;
+
+ /** The instance. */
+ protected Instance instance;
+
+ public WindowCommand(String windowRef) throws IllegalArgumentException
+ {
+ if (windowRef == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.windowRef = windowRef;
+ }
+
+ public PortalObject getTarget()
+ {
+ return window;
+ }
+
+ public Instance getInstance()
+ {
+ return instance;
+ }
+
+ public String getWindowRef()
+ {
+ return windowRef;
+ }
+
+ public Portal getPortal()
+ {
+ return portal;
+ }
+
+ public Page getPage()
+ {
+ return page;
+ }
+
+ public Window getWindow()
+ {
+ return window;
+ }
+
+ public void create() throws ControllerException
+ {
+ // Retrieve the window
+ window = (Window)context.getController().getPortalObjectContainer().getObject(windowRef);
+ if (window == null)
+ {
+ throw new ResourceNotFoundException(windowRef);
+ }
+
+ // First retrieve the target
+ page = (Page)window.getParent();
+ if (page == null)
+ {
+ throw new ResourceNotFoundException(windowRef);
+ }
+
+ // Get hardcoded portal for now
+ portal = page.getPortal();
+ if (portal == null)
+ {
+ throw new ResourceNotFoundException(windowRef);
+ }
+
+ // Get instance
+ instance = context.getController().getInstanceContainer().getInstance(window.getInstanceRef());
+ if (instance == null)
+ {
+ throw new ResourceNotFoundException(window.getInstanceRef());
+ }
+ }
+
+
+ /**
+ * We only enforce security at instance and component level.
+ *
+ * @param pam
+ * @throws org.jboss.portal.core.controller.ControllerSecurityException
+ * @throws org.jboss.portal.security.PortalSecurityException
+ */
+ public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
+ {
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/info (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/info)
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/info/ActionCommandInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/info/ActionCommandInfo.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/info/ActionCommandInfo.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.info;
+package org.jboss.portal.core.controller.command.info;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/info/CommandInfo.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.info;
+package org.jboss.portal.core.controller.command.info;
/**
* Runtime meta data for a command, this object is immutable.
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/info/ViewCommandInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/info/ViewCommandInfo.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/info/ViewCommandInfo.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.info;
+package org.jboss.portal.core.controller.command.info;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
Copied: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/mapper)
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/AbstractCommandFactory.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractCommandFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,11 +19,11 @@
* 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.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
import org.jboss.portal.common.system.AbstractJBossService;
import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.core.command.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerCommand;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/AbstractURLFactory.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractURLFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
import org.jboss.portal.common.system.AbstractJBossService;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/CommandFactory.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,10 +19,10 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.core.command.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerCommand;
/**
* The <code>CommandMapper</code> interface defines a service that can map an invocation to a command
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactoryDelegate.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/CommandFactoryDelegate.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactoryDelegate.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,9 +19,9 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
-import org.jboss.portal.core.command.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.server.ServerInvocation;
/**
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/DelegatingCommandFactory.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
/**
* A command mapper that delegates to other mappers based on the prefix of the request path.
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactoryService.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/DelegatingCommandFactoryService.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactoryService.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,9 +19,9 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
-import org.jboss.portal.core.command.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.servlet.PathParser;
import org.jboss.portal.server.servlet.PathMapping;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/DelegatingURLFactory.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/DelegatingURLFactoryService.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,11 +19,11 @@
* 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.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
-import org.jboss.portal.core.command.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerCommand;
import java.util.Map;
import java.util.HashMap;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/URLFactory.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,13 +19,11 @@
* 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.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.server.request.URLFormat;
-import org.jboss.portal.core.command.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerCommand;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/mapper/URLFactoryDelegate.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.portal.core.command.mapper;
+package org.jboss.portal.core.controller.command.mapper;
/**
*
Copied: trunk/core/src/main/org/jboss/portal/core/controller/portlet (from rev 5134, trunk/core/src/main/org/jboss/portal/core/command/portlet)
Added: trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerActionContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/ControllerActionContext.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerActionContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,109 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.ActionContext;
+import org.jboss.portal.server.ServerInvocation;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ControllerActionContext extends ControllerPortletInvocationContext implements ActionContext
+{
+
+ private HttpServletRequest req;
+ private StateString interactionState;
+ private Parameters form;
+
+ public ControllerActionContext(
+ ControllerContext controllerContext,
+ ServerInvocation invocation,
+ Portal portal,
+ StateString navigationalState,
+ WindowState windowState,
+ Mode mode,
+ StateString interactionState,
+ Parameters form,
+ Window window)
+ {
+ super(controllerContext, invocation, portal, navigationalState, mode, windowState, window);
+ this.req = invocation.getServerContext().getClientRequest();
+ this.interactionState = interactionState;
+ this.form = form;
+ }
+
+
+ public String getCharacterEncoding()
+ {
+ return req.getCharacterEncoding();
+ }
+
+ public BufferedReader getReader() throws IOException
+ {
+ return req.getReader();
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ return req.getInputStream();
+ }
+
+ public int getContentLength()
+ {
+ return req.getContentLength();
+ }
+
+ public String getContentType()
+ {
+ return req.getContentType();
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public Parameters getForm()
+ {
+ return form;
+ }
+
+ protected PortletInvocation newInvocation()
+ {
+ return new ActionInvocation(this);
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerActionContext.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletInvocationContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/ControllerPortletInvocationContext.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletInvocationContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,212 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalContextImpl;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.WindowContextImpl;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
+import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.portlet.spi.SecurityContext;
+import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5064 $
+ */
+public abstract class ControllerPortletInvocationContext extends AbstractPortletInvocationContext implements PortletInvocationContext
+{
+
+ /** . */
+ protected ControllerContext controllerContext;
+
+ /** . */
+ protected ServerInvocation invocation;
+
+ /** . */
+ private Mode mode;
+
+ /** . */
+ private WindowState windowState;
+
+ /** . */
+ private Window window;
+
+ /** . */
+ protected StateString navigationalState;
+
+ /** . */
+ protected PortalContext portalContext;
+
+ /** . */
+ protected RequestContext requestContext;
+
+ /** . */
+ protected SecurityContext securityContext;
+
+ /** . */
+ protected UserContext userContext;
+
+ /** . */
+ protected WindowContext windowContext;
+
+ public ControllerPortletInvocationContext(
+ ControllerContext controllerContext,
+ ServerInvocation invocation,
+ Portal portal,
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState,
+ Window window)
+ {
+ this.controllerContext = controllerContext;
+ this.invocation = invocation;
+ this.window = window;
+ this.mode = mode;
+ this.windowState = windowState;
+ this.navigationalState = navigationalState;
+
+ this.requestContext = new AbstractRequestContext(invocation.getServerContext().getClientRequest(), invocation.getServerContext().getClientResponse());
+ this.securityContext = new AbstractSecurityContext(invocation.getServerContext().getClientRequest());
+ this.userContext = new ControllerUserContext(invocation);
+ this.portalContext = new PortalContextImpl(portal);
+ this.windowContext = new WindowContextImpl(window);
+
+ //
+ addResolver(PortletInvocation.REQUEST_SCOPE, controllerContext);
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, controllerContext);
+ }
+
+ public HttpServletResponse getClientResponse()
+ {
+ return invocation.getServerContext().getClientResponse();
+ }
+
+ public HttpServletRequest getClientRequest()
+ {
+ return invocation.getServerContext().getClientRequest();
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public HTTPStreamInfo getStreamInfo()
+ {
+ return invocation.getResponse().getStreamInfo();
+ }
+
+ public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+ {
+ ControllerCommand cmd = null;
+ if (portletURL instanceof ActionURL)
+ {
+ ActionURL actionURL = (ActionURL)portletURL;
+ cmd = new InvokeWindowActionCommand(window.getId(), portletURL.getMode(), portletURL.getWindowState(), actionURL.getNavigationalState(), actionURL.getInteractionState(), null);
+ }
+ else
+ {
+ cmd = new InvokeWindowRenderCommand(window.getId(), portletURL.getMode(), portletURL.getWindowState(), ((RenderURL)portletURL).getNavigationalState());
+ }
+
+ //
+ boolean secure = invocation.getServerContext().getURLContext().getSecure();
+ if (wantSecure != null)
+ {
+ secure = wantSecure.booleanValue();
+ }
+
+ //
+ boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
+ if (wantAuthenticated != null)
+ {
+ authenticated = wantAuthenticated.booleanValue();
+ }
+
+ URLContext info = URLContext.newInstance(secure, authenticated);
+ return controllerContext.encodeURL(cmd, info, URLFormat.newInstance(relative, true));
+ }
+
+ public PortletInvocation createInvocation()
+ {
+ PortletInvocation invocation = newInvocation();
+
+ // Contextualize
+ invocation.setSecurityContext(securityContext);
+ invocation.setRequestContext(requestContext);
+ invocation.setPortalContext(portalContext);
+ invocation.setWindowContext(windowContext);
+ invocation.setUserContext(userContext);
+ return invocation;
+ }
+
+ protected abstract PortletInvocation newInvocation();
+
+ public String encodeURL(ControllerCommand cmd, URLContext urlContext, boolean relative)
+ {
+ return controllerContext.encodeURL(cmd, urlContext, URLFormat.newInstance(relative, true));
+ }
+
+ public String createUpdateNavigationalStateURL(Mode mode, WindowState windowState)
+ {
+ InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(window.getId(), mode, windowState);
+ boolean secure = invocation.getServerContext().getURLContext().getSecure();
+ boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
+ URLContext urlContext = URLContext.newInstance(secure, authenticated);
+ return controllerContext.encodeURL(cmd, urlContext, URLFormat.newInstance(true, true));
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletInvocationContext.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerRenderContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/ControllerRenderContext.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerRenderContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.portlet;
+
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.Mode;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.WindowState;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ControllerRenderContext extends ControllerPortletInvocationContext implements RenderContext
+{
+
+ public ControllerRenderContext(
+ ControllerContext controllerContext,
+ ServerInvocation invocation,
+ Portal portal,
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState,
+ Window window)
+ {
+ super(controllerContext, invocation, portal, navigationalState, mode, windowState, window);
+ }
+
+ protected PortletInvocation newInvocation()
+ {
+ return new RenderInvocation(this);
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerRenderContext.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerUserContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/ControllerUserContext.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerUserContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -0,0 +1,81 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.controller.portlet;
+
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.server.ServerInvocation;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ControllerUserContext implements UserContext
+{
+
+ /** . */
+ private final ServerInvocation invocation;
+
+ public ControllerUserContext(ServerInvocation invocation)
+ {
+ this.invocation = invocation;
+ }
+
+ /** This implementation returns the remote user value from the underlying http request. */
+ public String getId()
+ {
+ return invocation.getServerContext().getClientRequest().getRemoteUser();
+ }
+
+ public Map getInformations()
+ {
+ User user = getUser();
+ if (user != null)
+ {
+ return user.getProperties();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public User getUser()
+ {
+ return (User)invocation.getRequest().getUser();
+ }
+
+ public Locale getLocale()
+ {
+ return invocation.getRequest().getLocale();
+ }
+
+ public List getLocales()
+ {
+ return Tools.toList(invocation.getRequest().getLocales());
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerUserContext.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/portlet/CoreActionContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreActionContext.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/CoreActionContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,109 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command.portlet;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.command.CommandContext;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.spi.ActionContext;
-import org.jboss.portal.server.ServerInvocation;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class CoreActionContext extends CorePortletInvocationContext implements ActionContext
-{
-
- private HttpServletRequest req;
- private StateString interactionState;
- private Parameters form;
-
- public CoreActionContext(
- CommandContext commandContext,
- ServerInvocation invocation,
- Portal portal,
- StateString navigationalState,
- WindowState windowState,
- Mode mode,
- StateString interactionState,
- Parameters form,
- Window window)
- {
- super(commandContext, invocation, portal, navigationalState, mode, windowState, window);
- this.req = invocation.getServerContext().getClientRequest();
- this.interactionState = interactionState;
- this.form = form;
- }
-
-
- public String getCharacterEncoding()
- {
- return req.getCharacterEncoding();
- }
-
- public BufferedReader getReader() throws IOException
- {
- return req.getReader();
- }
-
- public InputStream getInputStream() throws IOException
- {
- return req.getInputStream();
- }
-
- public int getContentLength()
- {
- return req.getContentLength();
- }
-
- public String getContentType()
- {
- return req.getContentType();
- }
-
- public StateString getInteractionState()
- {
- return interactionState;
- }
-
- public Parameters getForm()
- {
- return form;
- }
-
- protected PortletInvocation newInvocation()
- {
- return new ActionInvocation(this);
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/portlet/CorePortletInvocationContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/CorePortletInvocationContext.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/CorePortletInvocationContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,212 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command.portlet;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.command.CommandContext;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.PortalContextImpl;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.WindowContextImpl;
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
-import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
-import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.spi.PortalContext;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.portlet.spi.RequestContext;
-import org.jboss.portal.portlet.spi.SecurityContext;
-import org.jboss.portal.portlet.spi.UserContext;
-import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.server.request.URLFormat;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5064 $
- */
-public abstract class CorePortletInvocationContext extends AbstractPortletInvocationContext implements PortletInvocationContext
-{
-
- /** . */
- protected CommandContext commandContext;
-
- /** . */
- protected ServerInvocation invocation;
-
- /** . */
- private Mode mode;
-
- /** . */
- private WindowState windowState;
-
- /** . */
- private Window window;
-
- /** . */
- protected StateString navigationalState;
-
- /** . */
- protected PortalContext portalContext;
-
- /** . */
- protected RequestContext requestContext;
-
- /** . */
- protected SecurityContext securityContext;
-
- /** . */
- protected UserContext userContext;
-
- /** . */
- protected WindowContext windowContext;
-
- public CorePortletInvocationContext(
- CommandContext commandContext,
- ServerInvocation invocation,
- Portal portal,
- StateString navigationalState,
- Mode mode,
- WindowState windowState,
- Window window)
- {
- this.commandContext = commandContext;
- this.invocation = invocation;
- this.window = window;
- this.mode = mode;
- this.windowState = windowState;
- this.navigationalState = navigationalState;
-
- this.requestContext = new AbstractRequestContext(invocation.getServerContext().getClientRequest(), invocation.getServerContext().getClientResponse());
- this.securityContext = new AbstractSecurityContext(invocation.getServerContext().getClientRequest());
- this.userContext = new CoreUserContext(invocation);
- this.portalContext = new PortalContextImpl(portal);
- this.windowContext = new WindowContextImpl(window);
-
- //
- addResolver(PortletInvocation.REQUEST_SCOPE, commandContext);
- addResolver(PortletInvocation.PRINCIPAL_SCOPE, commandContext);
- }
-
- public HttpServletResponse getClientResponse()
- {
- return invocation.getServerContext().getClientResponse();
- }
-
- public HttpServletRequest getClientRequest()
- {
- return invocation.getServerContext().getClientRequest();
- }
-
- public Mode getMode()
- {
- return mode;
- }
-
- public WindowState getWindowState()
- {
- return windowState;
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-
- public HTTPStreamInfo getStreamInfo()
- {
- return invocation.getResponse().getStreamInfo();
- }
-
- public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
- {
- ControllerCommand cmd = null;
- if (portletURL instanceof ActionURL)
- {
- ActionURL actionURL = (ActionURL)portletURL;
- cmd = new InvokeWindowActionCommand(window.getId(), portletURL.getMode(), portletURL.getWindowState(), actionURL.getNavigationalState(), actionURL.getInteractionState(), null);
- }
- else
- {
- cmd = new InvokeWindowRenderCommand(window.getId(), portletURL.getMode(), portletURL.getWindowState(), ((RenderURL)portletURL).getNavigationalState());
- }
-
- //
- boolean secure = invocation.getServerContext().getURLContext().getSecure();
- if (wantSecure != null)
- {
- secure = wantSecure.booleanValue();
- }
-
- //
- boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
- if (wantAuthenticated != null)
- {
- authenticated = wantAuthenticated.booleanValue();
- }
-
- URLContext info = URLContext.newInstance(secure, authenticated);
- return commandContext.encodeURL(cmd, info, URLFormat.newInstance(relative, true));
- }
-
- public PortletInvocation createInvocation()
- {
- PortletInvocation invocation = newInvocation();
-
- // Contextualize
- invocation.setSecurityContext(securityContext);
- invocation.setRequestContext(requestContext);
- invocation.setPortalContext(portalContext);
- invocation.setWindowContext(windowContext);
- invocation.setUserContext(userContext);
- return invocation;
- }
-
- protected abstract PortletInvocation newInvocation();
-
- public String encodeURL(ControllerCommand cmd, URLContext urlContext, boolean relative)
- {
- return commandContext.encodeURL(cmd, urlContext, URLFormat.newInstance(relative, true));
- }
-
- public String createUpdateNavigationalStateURL(Mode mode, WindowState windowState)
- {
- InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(window.getId(), mode, windowState);
- boolean secure = invocation.getServerContext().getURLContext().getSecure();
- boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
- URLContext urlContext = URLContext.newInstance(secure, authenticated);
- return commandContext.encodeURL(cmd, urlContext, URLFormat.newInstance(true, true));
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/portlet/CoreRenderContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreRenderContext.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/CoreRenderContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,58 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command.portlet;
-
-import org.jboss.portal.core.command.CommandContext;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.portlet.spi.RenderContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.Mode;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.WindowState;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class CoreRenderContext extends CorePortletInvocationContext implements RenderContext
-{
-
- public CoreRenderContext(
- CommandContext commandContext,
- ServerInvocation invocation,
- Portal portal,
- StateString navigationalState,
- Mode mode,
- WindowState windowState,
- Window window)
- {
- super(commandContext, invocation, portal, navigationalState, mode, windowState, window);
- }
-
- protected PortletInvocation newInvocation()
- {
- return new RenderInvocation(this);
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/controller/portlet/CoreUserContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/command/portlet/CoreUserContext.java 2006-09-04 12:43:32 UTC (rev 5134)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/CoreUserContext.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -1,81 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.command.portlet;
-
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.portlet.spi.UserContext;
-import org.jboss.portal.server.ServerInvocation;
-
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class CoreUserContext implements UserContext
-{
-
- /** . */
- private final ServerInvocation invocation;
-
- public CoreUserContext(ServerInvocation invocation)
- {
- this.invocation = invocation;
- }
-
- /** This implementation returns the remote user value from the underlying http request. */
- public String getId()
- {
- return invocation.getServerContext().getClientRequest().getRemoteUser();
- }
-
- public Map getInformations()
- {
- User user = getUser();
- if (user != null)
- {
- return user.getProperties();
- }
- else
- {
- return null;
- }
- }
-
- public User getUser()
- {
- return (User)invocation.getRequest().getUser();
- }
-
- public Locale getLocale()
- {
- return invocation.getRequest().getLocale();
- }
-
- public List getLocales()
- {
- return Tools.toList(invocation.getRequest().getLocales());
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -21,10 +21,10 @@
*/
package org.jboss.portal.core.model.portal;
-import org.jboss.portal.core.command.mapper.CommandFactory;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.RenderPageCommand;
-import org.jboss.portal.core.command.mapper.AbstractCommandFactory;
+import org.jboss.portal.core.controller.command.mapper.CommandFactory;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.server.ServerInvocation;
/**
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -23,11 +23,11 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.command.RenderPageCommand;
-import org.jboss.portal.core.command.mapper.AbstractCommandFactory;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.portlet.PortletRequestDecoder;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerRequest;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -22,12 +22,12 @@
package org.jboss.portal.core.model.portal;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.core.command.ControllerCommand;
-import org.jboss.portal.core.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.command.InvokeWindowCommand;
-import org.jboss.portal.core.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.command.RenderPageCommand;
-import org.jboss.portal.core.command.mapper.URLFactoryDelegate;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.PortletRequestDecoder;
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -28,7 +28,7 @@
import org.jboss.portal.cms.model.File;
import org.jboss.portal.cms.util.FileUtil;
import org.jboss.portal.core.cms.command.StreamContentCommand;
-import org.jboss.portal.core.command.portlet.CorePortletInvocationContext;
+import org.jboss.portal.core.controller.portlet.ControllerPortletInvocationContext;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portlet.JBossRenderResponse;
@@ -266,7 +266,7 @@
{
StreamContentCommand cmd = new StreamContentCommand(path);
PortletInvocation invocation = ((JBossRenderResponse) resp).getInvocation();
- CorePortletInvocationContext ccrc = (CorePortletInvocationContext) invocation.getContext();
+ ControllerPortletInvocationContext ccrc = (ControllerPortletInvocationContext) invocation.getContext();
return ccrc.encodeURL(cmd, null, true);
}
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -37,11 +37,9 @@
import org.jboss.portal.cms.util.FileUtil;
import org.jboss.portal.cms.util.NodeUtil;
import org.jboss.portal.core.cms.command.StreamContentCommand;
-import org.jboss.portal.core.command.portlet.CorePortletInvocationContext;
+import org.jboss.portal.core.controller.portlet.ControllerPortletInvocationContext;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.theme.PortalTheme;
-import org.jboss.portal.theme.ThemeLink;
import org.jboss.portlet.JBossActionRequest;
import org.jboss.portlet.JBossActionResponse;
import org.jboss.portlet.JBossPortlet;
@@ -863,7 +861,7 @@
{
StreamContentCommand cmd = new StreamContentCommand(path);
PortletInvocation invocation = ((JBossRenderResponse)resp).getInvocation();
- CorePortletInvocationContext ccrc = (CorePortletInvocationContext)invocation.getContext();
+ ControllerPortletInvocationContext ccrc = (ControllerPortletInvocationContext)invocation.getContext();
String url = ccrc.encodeURL(cmd, URLContext.newInstance(false, false), true);
return url;
}
Modified: trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -26,7 +26,7 @@
import javax.portlet.PortletPreferences;
import org.jboss.portal.core.api.Navigation;
-import org.jboss.portal.core.command.portlet.CoreUserContext;
+import org.jboss.portal.core.controller.portlet.ControllerUserContext;
import org.jboss.portlet.util.Parameters;
import org.jboss.portal.portlet.impl.jsr168.ActionRequestImpl;
import org.jboss.portal.portlet.invocation.ActionInvocation;
@@ -67,9 +67,9 @@
*/
public User getUser()
{
- if (userContext instanceof CoreUserContext)
+ if (userContext instanceof ControllerUserContext)
{
- return ((CoreUserContext)userContext).getUser();
+ return ((ControllerUserContext)userContext).getUser();
}
else
{
Modified: trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2006-09-04 15:00:38 UTC (rev 5136)
@@ -26,12 +26,10 @@
import javax.portlet.PortletPreferences;
import org.jboss.portal.core.api.Navigation;
-import org.jboss.portal.core.command.portlet.CoreUserContext;
+import org.jboss.portal.core.controller.portlet.ControllerUserContext;
import org.jboss.portlet.util.Parameters;
import org.jboss.portal.portlet.impl.jsr168.RenderRequestImpl;
import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.theme.PortalTheme;
-import org.jboss.portal.theme.ThemeConstants;
import org.jboss.portal.identity.User;
import org.jboss.portal.api.node.PortalNode;
@@ -77,9 +75,9 @@
*/
public User getUser()
{
- if (userContext instanceof CoreUserContext)
+ if (userContext instanceof ControllerUserContext)
{
- return ((CoreUserContext)userContext).getUser();
+ return ((ControllerUserContext)userContext).getUser();
}
else
{
Modified: trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2006-09-04 15:00:38 UTC (rev 5136)
@@ -247,7 +247,7 @@
<depends optional-attribute-name="CMSService" proxy-type="attribute">portal:service=CMS</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.command.mapper.CommandFactoryDelegate"
+ code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
name="portal:commandFactory=Delegate,prefix=content"
xmbean-dd=""
xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-09-04 14:45:10 UTC (rev 5135)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-09-04 15:00:38 UTC (rev 5136)
@@ -525,7 +525,7 @@
<!-- Command factories -->
<mbean
- code="org.jboss.portal.core.command.mapper.DelegatingCommandFactoryService"
+ code="org.jboss.portal.core.controller.command.mapper.DelegatingCommandFactoryService"
name="portal:commandFactory=Delegating"
xmbean-dd=""
xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
@@ -555,7 +555,7 @@
proxy-type="attribute">portal:container=PortalObject</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.command.mapper.CommandFactoryDelegate"
+ code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
name="portal:commandFactory=Delegate,prefix=portal"
xmbean-dd=""
xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
@@ -571,7 +571,7 @@
<!-- URL factories -->
<mbean
- code="org.jboss.portal.core.command.mapper.DelegatingURLFactoryService"
+ code="org.jboss.portal.core.controller.command.mapper.DelegatingURLFactoryService"
name="portal:urlFactory=Delegating"
xmbean-dd=""
xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
@@ -662,7 +662,7 @@
<!-- The core controller -->
<mbean
- code="org.jboss.portal.core.CoreController"
+ code="org.jboss.portal.core.controller.CoreController"
name="portal:controller=Request"
xmbean-dd=""
xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean">
More information about the jboss-svn-commits
mailing list