Author: julien(a)jboss.com
Date: 2006-11-22 09:45:08 -0500 (Wed, 22 Nov 2006)
New Revision: 5709
Added:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/
trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/PortletInstanceResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java
Removed:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletCommand.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.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/controller/classic/ClassicController.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/SimpleURLFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
- converted the ui configurator to a portlet instance invoker that can invoke portlet
instance without page support
- improved the DelegatingURLFactory mechanism to be more flexible and avoid to base its
decisions on the classname which does not let room to use command properties or any other
contextual information to create the right URL for the command
- disabled ajax DnD on the configurator
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -36,8 +36,8 @@
import org.jboss.portal.core.controller.CommandRedirectionException;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
import org.jboss.portal.core.model.instance.Instance;
@@ -119,7 +119,7 @@
//
if (interactionParams != null)
{
- redirection = new InvokeWindowActionCommand(
+ redirection = new InvokePortletWindowActionCommand(
nodeRef,
mode,
windowState,
@@ -139,7 +139,7 @@
//
if (navigationalParams != null)
{
- redirection = new InvokeWindowRenderCommand(
+ redirection = new InvokePortletWindowRenderCommand(
nodeRef,
mode,
windowState,
@@ -148,7 +148,7 @@
}
else if (nextEvent instanceof WindowNavigationEvent)
{
- redirection = new InvokeWindowRenderCommand(
+ redirection = new InvokePortletWindowRenderCommand(
nodeRef,
mode,
windowState);
@@ -159,7 +159,7 @@
if (event instanceof WindowActionEvent)
{
WindowActionEvent wae = (WindowActionEvent)event;
- InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)cmd;
+ InvokePortletWindowActionCommand iwac =
(InvokePortletWindowActionCommand)cmd;
Map params = wae.getParameters();
if (params instanceof LazyParameterMap)
{
@@ -198,9 +198,9 @@
Portlet portlet = instance.getPortlet();
if (portlet != null && portlet.isRemote() == false)
{
- if (cmd instanceof InvokeWindowActionCommand)
+ if (cmd instanceof InvokePortletWindowActionCommand)
{
- InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)wc;
+ InvokePortletWindowActionCommand iwac =
(InvokePortletWindowActionCommand)wc;
//
Parameters formParams = iwac.getFormParameters();
@@ -244,9 +244,9 @@
action.setParameters(params);
return action;
}
- else if (cmd instanceof InvokeWindowRenderCommand)
+ else if (cmd instanceof InvokePortletWindowRenderCommand)
{
- InvokeWindowRenderCommand iwrc = (InvokeWindowRenderCommand)wc;
+ InvokePortletWindowRenderCommand iwrc =
(InvokePortletWindowRenderCommand)wc;
StateString navigationalState = iwrc.getNavigationalState();
//
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -29,7 +29,7 @@
import org.jboss.portal.server.request.URLFormat;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -128,7 +128,7 @@
public String toString()
{
- InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(handle, null,
null, parameters);
+ InvokePortletWindowRenderCommand cmd = new
InvokePortletWindowRenderCommand(handle, null, null, parameters);
URLContext urlContext = getURLContext();
return controllerContext.renderURL(cmd, urlContext,
URLFormat.newInstance(relative, true));
}
Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2006-11-22
03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -29,7 +29,7 @@
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.server.ServerInvocation;
@@ -119,7 +119,7 @@
parameters.setValue("path", portalRequestPath);
// Perform a render URL on the target window
- return new InvokeWindowRenderCommand(targetWindowRef, Mode.VIEW, null,
parameters);
+ return new InvokePortletWindowRenderCommand(targetWindowRef, Mode.VIEW,
null, parameters);
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java 2006-11-22
03:13:47 UTC (rev 5708)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -36,9 +36,6 @@
{
/** . */
- private static final String[] COMMAND_CLASS_NAMES =
{StreamContentCommand.class.getName()};
-
- /** . */
private String path;
public String getPath()
@@ -51,11 +48,6 @@
this.path = path;
}
- protected String[] getCommandClassNames()
- {
- return COMMAND_CLASS_NAMES;
- }
-
public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
{
if (cmd == null)
@@ -79,9 +71,8 @@
asu.setPortalRequestPath(buffer.toString());
return asu;
}
- else
- {
- throw new IllegalArgumentException("Command " +
cmd.getClass().getName() + " not accepted");
- }
+
+ //
+ return null;
}
}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -32,8 +32,9 @@
import org.jboss.portal.core.controller.InsufficientTransportGuaranteeException;
import org.jboss.portal.core.controller.ControllerSecurityException;
import org.jboss.portal.core.controller.ResourceNotFoundException;
-import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
import org.jboss.portal.core.model.portal.PortalObjectResponseHandler;
+import org.jboss.portal.core.model.portal.PortletWindowResponseHandler;
+import org.jboss.portal.core.model.instance.PortletInstanceResponseHandler;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
@@ -55,7 +56,8 @@
{
new ClassicResponseHandler(),
new PortalObjectResponseHandler(),
- new PortletResponseHandler()
+ new PortletWindowResponseHandler(),
+ new PortletInstanceResponseHandler()
};
public void handle(ServerInvocation invocation) throws ServerException
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingURLFactoryService.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -26,9 +26,7 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import java.util.ArrayList;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -37,7 +35,8 @@
public class DelegatingURLFactoryService extends AbstractURLFactory implements
DelegatingURLFactory
{
- private Map delegates = new HashMap();
+ /** The different delegates. */
+ private ArrayList delegates = new ArrayList();
public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
{
@@ -45,25 +44,23 @@
{
throw new IllegalArgumentException("No null command accepted");
}
- URLFactory delegate = null;
+
+ //
if (delegates != null)
{
- String commandClassName = cmd.getClass().getName();
- delegate = (URLFactory)delegates.get(commandClassName);
+ for (int i = 0;i < delegates.size();i++)
+ {
+ URLFactory delegate = (URLFactory)delegates.get(i);
+ ServerURL url = delegate.doMapping(invocation, cmd);
+ if (url != null)
+ {
+ return url;
+ }
+ }
}
- if (delegate != null)
- {
- return delegate.doMapping(invocation, cmd);
- }
- else
- {
- throw new IllegalArgumentException("Command " +
cmd.getClass().getName() + " not accepted");
- }
- }
- public Map getFactoryMapping()
- {
- return new HashMap(delegates);
+ //
+ return null;
}
public void register(URLFactoryDelegate factory)
@@ -74,19 +71,16 @@
}
synchronized (this)
{
- Map copy = new HashMap(delegates);
- String[] classNames = factory.getCommandClassNames();
- for (int i = 0; i < classNames.length; i++)
+ if (delegates.contains(factory))
{
- String factoryClassName = classNames[i];
- Object value = copy.get(factoryClassName);
- if (value != null && !value.equals(factory))
- {
- throw new IllegalArgumentException("Factory already registered for
command " + factoryClassName);
- }
- copy.put(factoryClassName, factory);
+ log.warn("Dual registration of URL factory " + factory);
}
- delegates = copy;
+ else
+ {
+ ArrayList copy = new ArrayList(delegates);
+ copy.add(factory);
+ delegates = copy;
+ }
}
}
@@ -98,16 +92,16 @@
}
synchronized (this)
{
- Map copy = new HashMap(delegates);
- for (Iterator i = copy.entrySet().iterator(); i.hasNext();)
+ if (delegates.contains(factory))
{
- Map.Entry entry = (Map.Entry)i.next();
- if (factory.equals(entry.getValue()))
- {
- i.remove();
- }
+ log.warn("Unregistration of URL factory " + factory + " failed
because it is not registered");
}
- delegates = copy;
+ else
+ {
+ ArrayList copy = new ArrayList(delegates);
+ copy.remove(factory);
+ delegates = copy;
+ }
}
}
}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -62,9 +62,21 @@
public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
{
- AbstractServerURL url = new AbstractServerURL();
- url.setPortalRequestPath(path);
- return url;
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No null cmd accepted");
+ }
+ String className = cmd.getClass().getName();
+ for (int i = 0;i < classNames.length;i++)
+ {
+ if (className.equals(classNames[i]))
+ {
+ AbstractServerURL url = new AbstractServerURL();
+ url.setPortalRequestPath(path);
+ return url;
+ }
+ }
+ return null;
}
protected String[] getCommandClassNames()
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/URLFactoryDelegate.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -29,6 +29,7 @@
public abstract class URLFactoryDelegate extends AbstractURLFactory
{
+ /** . */
private DelegatingURLFactory factory;
public DelegatingURLFactory getFactory()
@@ -41,8 +42,6 @@
this.factory = factory;
}
- protected abstract String[] getCommandClassNames();
-
protected void startService() throws Exception
{
factory.register(this);
Copied:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java
(from rev 5700,
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java 2006-11-21
10:09:27 UTC (rev 5700)
+++
trunk/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.portlet;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.RenderURL;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface InvokePortletCommandFactory
+{
+ ControllerCommand createInvokeActionCommand(ActionURL portletURL);
+ ControllerCommand createInvokeRenderCommand(RenderURL portletURL);
+}
Deleted:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCommandFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,37 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.controller.portlet;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.RenderURL;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface PortletCommandFactory
-{
- ControllerCommand createInvokeActionCommand(ActionURL portletURL);
- ControllerCommand createInvokeRenderCommand(RenderURL portletURL);
-}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -36,8 +36,8 @@
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.Mode;
@@ -67,7 +67,7 @@
Portal portal)
{
PortletContextFactory cf = new PortletContextFactory(controllerContext, portal,
window);
- InternalPortletCommandFactory cpc = new InternalPortletCommandFactory(window,
controllerContext);
+ InternalInvokePortletCommandFactory cpc = new
InternalInvokePortletCommandFactory(window, controllerContext);
return createRender(controllerContext, mode, windowState, navigationalState, cf,
cpc);
}
@@ -83,7 +83,7 @@
Portal portal)
{
PortletContextFactory cf = new PortletContextFactory(controllerContext, portal,
window);
- InternalPortletCommandFactory cpc = new InternalPortletCommandFactory(window,
controllerContext);
+ InternalInvokePortletCommandFactory cpc = new
InternalInvokePortletCommandFactory(window, controllerContext);
return createAction(controllerContext, mode, windowState, navigationalState,
interactionState, form, cf, cpc);
}
@@ -95,7 +95,7 @@
StateString interactionState,
Parameters form,
PortletContextFactory cf,
- PortletCommandFactory cpc)
+ InvokePortletCommandFactory cpc)
{
HTTPStreamInfo streamInfo =
controllerContext.getServerInvocation().getResponse().getStreamInfo();
@@ -132,7 +132,7 @@
WindowState windowState,
StateString navigationalState,
PortletContextFactory cf,
- PortletCommandFactory cpc)
+ InvokePortletCommandFactory cpc)
{
HTTPStreamInfo streamInfo =
controllerContext.getServerInvocation().getResponse().getStreamInfo();
@@ -164,9 +164,9 @@
private static class ControllerActionContext extends AbstractActionContext
{
- private PortletCommandFactory cmdFactory;
+ private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
- public ControllerActionContext(PortletCommandFactory cmdFactory, ControllerContext
controllerContext, Mode mode, WindowState windowState, StateString navigationalState,
HTTPStreamInfo streamInfo, StateString interactionState, Parameters form)
+ public ControllerActionContext(InvokePortletCommandFactory cmdFactory,
ControllerContext controllerContext, Mode mode, WindowState windowState, StateString
navigationalState, HTTPStreamInfo streamInfo, StateString interactionState, Parameters
form)
{
super(mode, windowState, navigationalState, streamInfo, interactionState,
form);
@@ -196,9 +196,9 @@
private static class ControllerRenderContext extends AbstractRenderContext
{
- private PortletCommandFactory cmdFactory;
+ private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
- public ControllerRenderContext(PortletCommandFactory cmdFactory, ControllerContext
controllerContext, Mode mode, WindowState windowState, StateString navigationalState,
HTTPStreamInfo streamInfo)
+ public ControllerRenderContext(InvokePortletCommandFactory cmdFactory,
ControllerContext controllerContext, Mode mode, WindowState windowState, StateString
navigationalState, HTTPStreamInfo streamInfo)
{
super(mode, windowState, navigationalState, streamInfo);
@@ -228,7 +228,7 @@
public static String renderURL(
ControllerContext controllerContext,
- PortletCommandFactory factory,
+ InvokePortletCommandFactory factory,
PortletURL portletURL,
Boolean wantSecure,
Boolean wantAuthenticated,
@@ -262,7 +262,7 @@
return controllerContext.renderURL(cmd, info, URLFormat.newInstance(relative,
true));
}
- private static class InternalPortletCommandFactory implements PortletCommandFactory
+ private static class InternalInvokePortletCommandFactory implements
InvokePortletCommandFactory
{
/** . */
@@ -271,7 +271,7 @@
/** . */
ControllerContext controllerContext;
- public InternalPortletCommandFactory(Window window, ControllerContext
controllerContext)
+ public InternalInvokePortletCommandFactory(Window window, ControllerContext
controllerContext)
{
this.controllerContext = controllerContext;
this.window = window;
@@ -279,12 +279,12 @@
public ControllerCommand createInvokeActionCommand(ActionURL actionURL)
{
- return new InvokeWindowActionCommand(window.getId(), actionURL.getMode(),
actionURL.getWindowState(), actionURL.getNavigationalState(),
actionURL.getInteractionState(), null);
+ return new InvokePortletWindowActionCommand(window.getId(), actionURL.getMode(),
actionURL.getWindowState(), actionURL.getNavigationalState(),
actionURL.getInteractionState(), null);
}
public ControllerCommand createInvokeRenderCommand(RenderURL renderURL)
{
- return new InvokeWindowRenderCommand(window.getId(), renderURL.getMode(),
renderURL.getWindowState(), renderURL.getNavigationalState());
+ return new InvokePortletWindowRenderCommand(window.getId(), renderURL.getMode(),
renderURL.getWindowState(), renderURL.getNavigationalState());
}
}
}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponse.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -30,34 +30,21 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PortletResponse
+public abstract class PortletResponse
{
/** . */
- private String windowId;
-
- /** . */
private PortletInvocationResponse response;
- public PortletResponse(String windowId, PortletInvocationResponse response)
+ public PortletResponse(PortletInvocationResponse response)
{
- if (windowId == null)
- {
- throw new IllegalArgumentException();
- }
if (response == null)
{
throw new IllegalArgumentException();
}
- this.windowId = windowId;
this.response = response;
}
- public String getWindowId()
- {
- return windowId;
- }
-
public PortletInvocationResponse getResult()
{
return response;
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -26,8 +26,7 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.classic.AbstractResponseHandler;
import org.jboss.portal.core.controller.classic.CommandForward;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.server.ServerException;
@@ -51,9 +50,15 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PortletResponseHandler extends AbstractResponseHandler
+public abstract class PortletResponseHandler extends AbstractResponseHandler
{
+ protected abstract ControllerCommand createRenderCommand(
+ Mode mode,
+ WindowState windowState,
+ StateString navState,
+ PortletResponse response);
+
public CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd,
Object response) throws IOException, ServletException, ServerException
{
if (response instanceof PortletResponse)
@@ -61,18 +66,23 @@
ServerInvocation invocation = ctx.getServerInvocation();
PortletResponse pr = (PortletResponse)response;
PortletInvocationResponse pir = pr.getResult();
+
+ //
if (pir instanceof RenderResponse)
{
RenderResponse renderResult = (RenderResponse)pir;
- StateString portletNavState = renderResult.getNavigationalState();
+ StateString navState = renderResult.getNavigationalState();
WindowState windowState = renderResult.getWindowState();
Mode mode = renderResult.getMode();
- InvokeWindowRenderCommand iwrc = new InvokeWindowRenderCommand(
- pr.getWindowId(),
- mode,
- windowState,
- portletNavState);
- return new CommandForward(iwrc, null);
+ ControllerCommand renderCmd = createRenderCommand(mode, windowState,
navState, pr);
+ if (renderCmd != null)
+ {
+ return new CommandForward(renderCmd, null);
+ }
+ else
+ {
+ return null;
+ }
}
else if (pir instanceof HTTPRedirectionResponse)
{
@@ -105,7 +115,7 @@
if (location == null)
{
// Redirect to the same page
- InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)cmd;
+ InvokePortletWindowActionCommand iwac =
(InvokePortletWindowActionCommand)cmd;
Page page = iwac.getPage();
RenderPageCommand renderCmd = new RenderPageCommand(page.getId());
boolean secure =
invocation.getServerContext().getURLContext().getSecure();
Copied:
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java (from
rev 5700,
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java 2006-11-21
10:09:27 UTC (rev 5700)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceActionCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.portlet.impl.PortletRequestDecoder;
+import org.jboss.portal.server.ServerInvocation;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InstanceCommandFactory extends AbstractCommandFactory
+{
+
+ /** The instance id of the command to create. */
+ private String instanceId;
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ public ControllerCommand doMapping(ServerInvocation invocation, String
portalContextPath, String portalRequestPath)
+ {
+ PortletRequestDecoder decoder = new PortletRequestDecoder();
+ decoder.decode(invocation.getServerContext().getQueryParameterMap(),
invocation.getServerContext().getBodyParameterMap());
+ switch (decoder.getType())
+ {
+ case PortletRequestDecoder.NAV_TYPE:
+ {
+ return createPortletNavCommand(decoder);
+ }
+ case PortletRequestDecoder.RENDER_TYPE:
+ {
+ return createPortletRenderCommand(decoder);
+ }
+ case PortletRequestDecoder.ACTION_TYPE:
+ {
+ return createPortletActionCommand(decoder);
+ }
+ }
+
+ //
+ return null;
+ }
+
+ /**
+ *
+ */
+ public ControllerCommand createPortletActionCommand(PortletRequestDecoder decoder)
+ {
+ return new InvokePortletInstanceActionCommand(
+ instanceId,
+ decoder.getNavigationalstate(),
+ decoder.getInteractionState(),
+ decoder.getForm());
+ }
+
+ /**
+ *
+ */
+ protected ControllerCommand createPortletRenderCommand(PortletRequestDecoder decoder)
+ {
+ return new InvokePortletInstanceRenderCommand(instanceId,
decoder.getNavigationalstate());
+ }
+
+ /**
+ *
+ */
+ protected ControllerCommand createPortletNavCommand(PortletRequestDecoder decoder)
+ {
+ return new InvokePortletInstanceRenderCommand(instanceId,
decoder.getNavigationalstate());
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java
(from rev 5700,
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java 2006-11-21
10:09:27 UTC (rev 5700)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance;
+
+import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceActionCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceCommand;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.portlet.impl.PortletRequestEncoder;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InstanceURLFactory extends URLFactoryDelegate
+{
+
+ /** . */
+ private String path;
+
+ /** . */
+ private String instanceId;
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
+ {
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No null command accepted");
+ }
+
+ //
+ if (cmd instanceof InvokePortletInstanceCommand)
+ {
+ InvokePortletInstanceCommand iic = (InvokePortletInstanceCommand)cmd;
+ if (iic.getInstanceId().equals(instanceId))
+ {
+ ServerURL url = new AbstractServerURL();
+ url.setPortalRequestPath(path);
+ if (cmd instanceof InvokePortletInstanceRenderCommand)
+ {
+ InvokePortletInstanceRenderCommand iprc =
(InvokePortletInstanceRenderCommand)cmd;
+ PortletRequestEncoder.encodeRender(url, iprc.getNavigationalState(), null,
null);
+ }
+ else
+ {
+ InvokePortletInstanceActionCommand iprc =
(InvokePortletInstanceActionCommand)cmd;
+ PortletRequestEncoder.encodeAction(url, iprc.getNavigationalState(),
iprc.getInteractionState(), null, null);
+ }
+ return url;
+
+ }
+ }
+
+ //
+ return null;
+ }
+}
Copied:
trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java
(from rev 5700,
trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java 2006-11-21
10:09:27 UTC (rev 5700)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance;
+
+import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceActionCommand;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.RenderURL;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InvokePortletInstanceCommandFactory implements InvokePortletCommandFactory
+{
+
+ /** . */
+ private String instanceId;
+
+ public InvokePortletInstanceCommandFactory(String instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ public ControllerCommand createInvokeActionCommand(ActionURL portletURL)
+ {
+ return new InvokePortletInstanceActionCommand(
+ instanceId,
+ portletURL.getNavigationalState(),
+ portletURL.getInteractionState(),
+ null);
+ }
+
+ public ControllerCommand createInvokeRenderCommand(RenderURL portletURL)
+ {
+ return new InvokePortletInstanceRenderCommand(
+ instanceId,
+ portletURL.getNavigationalState());
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance;
+
+import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
+import org.jboss.portal.core.controller.portlet.PortletResponse;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
+import org.jboss.portal.core.model.instance.command.InvokePortletInstanceRenderCommand;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletInstanceResponseHandler extends PortletResponseHandler
+{
+
+ protected ControllerCommand createRenderCommand(Mode mode, WindowState windowState,
StateString navState, PortletResponse response)
+ {
+ if (response instanceof PortletInstanceResponse)
+ {
+ PortletInstanceResponse ir = (PortletInstanceResponse)response;
+ return new InvokePortletInstanceRenderCommand(ir.getInstanceId(), navState);
+ }
+
+ //
+ return null;
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,106 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance.command;
+
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.portlet.PortletContextFactory;
+import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
+import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InvokePortletInstanceActionCommand extends InvokePortletInstanceCommand
+{
+
+ /** The interaction state. */
+ private StateString interactionState;
+
+ /** The nform. */
+ private Parameters form;
+
+ public InvokePortletInstanceActionCommand(String instanceId, StateString
navigationalState, StateString interactionState, Parameters form)
+ {
+ super(instanceId, navigationalState);
+
+ //
+ this.interactionState = interactionState;
+ this.form = form;
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public Parameters getForm()
+ {
+ return form;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return null;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ try
+ {
+ PortletContextFactory pcf1 = new PortletContextFactory(context);
+ InvokePortletCommandFactory pcf2 = new
InvokePortletInstanceCommandFactory(instanceId);
+
+ //
+ ActionInvocation action = PortletInvocationFactory.createAction(
+ context,
+ Mode.VIEW,
+ WindowState.MAXIMIZED,
+ navigationalState,
+ interactionState,
+ form,
+ pcf1,
+ pcf2);
+
+ //
+ PortletInvocationResponse response = instance.invoke(action);
+
+ //
+ return new PortletInstanceResponse(instanceId, response);
+ }
+ catch (PortletInvokerException e)
+ {
+ return new ControllerException(e);
+ }
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance.command;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class InvokePortletInstanceCommand extends ControllerCommand
+{
+
+ /** The instance id. */
+ protected String instanceId;
+
+ /** The navigational state. */
+ protected StateString navigationalState;
+
+ /** The instance displayed. */
+ protected Instance instance;
+
+ protected InvokePortletInstanceCommand(String instanceId, StateString
navigationalState)
+ {
+ if (instanceId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.instanceId = instanceId;
+ this.navigationalState = navigationalState;
+
+ }
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+
+ protected void create() throws ControllerException
+ {
+ InstanceContainer container = context.getController().getInstanceContainer();
+
+ //
+ instance = container.getInstance(instanceId);
+ if (instance == null)
+ {
+ throw new ControllerException("Configurator portlet instance " +
instanceId + " not found");
+ }
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,136 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance.command;
+
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.portlet.PortletContextFactory;
+import org.jboss.portal.core.controller.portlet.InvokePortletCommandFactory;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.theme.PageRendition;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.navigation.PageNavigationalState;
+import org.jboss.portal.theme.page.PageService;
+import org.jboss.portal.theme.page.ModifiablePageResult;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.ModifiableWindowResult;
+import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InvokePortletInstanceRenderCommand extends InvokePortletInstanceCommand
+{
+
+ public InvokePortletInstanceRenderCommand(String instanceId, StateString
navigationalState)
+ {
+ super(instanceId, navigationalState);
+ }
+
+ public CommandInfo getInfo()
+ {
+ return null;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ try
+ {
+ PortletContextFactory pcf1 = new PortletContextFactory(context);
+ InvokePortletCommandFactory pcf2 = new
InvokePortletInstanceCommandFactory(instanceId);
+ RenderInvocation render = PortletInvocationFactory.createRender(context,
Mode.VIEW, WindowState.MAXIMIZED, navigationalState, pcf1, pcf2);
+ PortletInvocationResponse response = instance.invoke(render);
+
+ // For now let the controller handle non fragment response
+ String content;
+ if (response instanceof FragmentResponse)
+ {
+ content = ((FragmentResponse)response).getContent();
+ }
+ else if (response instanceof ErrorResponse)
+ {
+ content = ((ErrorResponse)response).toHTML();
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+
+ //
+ PageService ps = context.getController().getPageService();
+ LayoutService ls = ps.getLayoutService();
+ PortalLayout layout = ls.getLayout("generic", true);
+ Map pageProperties = new HashMap();
+ pageProperties.put(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED,
"true");
+ Map portalProperties = new HashMap();
+ portalProperties.put("theme.renderSetId", "divRenderer");
+ portalProperties.put("theme.id", "renaissance");
+ portalProperties.put("layout.strategyId",
"maximizedRegion");
+ ModifiablePageResult result = new ModifiablePageResult("BILTO",
pageProperties, portalProperties);
+
+ //
+ Map windowProps = new HashMap();
+ windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER,
"emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER,
"emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER,
"emptyRenderer");
+
+ //
+ WindowResult res = new ModifiableWindowResult("", content,
Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+ WindowContext blah = new WindowContext("BILTO", "BILTO",
"maximized", 0);
+ result.addWindowContext(blah);
+ result.addWindowResult("BILTO", res);
+
+ //
+ PageNavigationalState pns = new PageNavigationalState();
+ HashMap tmp = new HashMap();
+ tmp.put("BILTO", blah);
+ pns.initialize(tmp);
+ pns.setLayoutURI("/layouts/generic/maximized.jsp");
+ pns.setLayoutState("maximized");
+
+ //
+ return new PageRendition(layout, pns, result, ps);
+ }
+ catch (PortletInvokerException e)
+ {
+ return new ControllerException(e);
+ }
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/PortletInstanceResponse.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/PortletInstanceResponse.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/command/response/PortletInstanceResponse.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.instance.command.response;
+
+import org.jboss.portal.core.controller.portlet.PortletResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletInstanceResponse extends PortletResponse
+{
+
+ /** . */
+ private String instanceId;
+
+ public PortletInstanceResponse(String instanceId, PortletInvocationResponse response)
+ {
+ super(response);
+
+ //
+ this.instanceId = instanceId;
+ }
+
+ public String getInstanceId()
+ {
+ return instanceId;
+ }
+}
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-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -25,8 +25,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.portlet.impl.PortletRequestDecoder;
@@ -138,13 +138,13 @@
switch (decoder.getType())
{
case PortletRequestDecoder.NAV_TYPE:
- cmd = new InvokeWindowRenderCommand(window.getId(), mode, windowState);
+ cmd = new InvokePortletWindowRenderCommand(window.getId(), mode,
windowState);
break;
case PortletRequestDecoder.ACTION_TYPE:
- cmd = new InvokeWindowActionCommand(window.getId(), mode, windowState,
decoder.getNavigationalstate(), decoder.getInteractionState(), decoder.getForm());
+ cmd = new InvokePortletWindowActionCommand(window.getId(), mode,
windowState, decoder.getNavigationalstate(), decoder.getInteractionState(),
decoder.getForm());
break;
case PortletRequestDecoder.RENDER_TYPE:
- cmd = new InvokeWindowRenderCommand(window.getId(), mode, windowState,
decoder.getNavigationalstate());
+ cmd = new InvokePortletWindowRenderCommand(window.getId(), mode,
windowState, decoder.getNavigationalstate());
break;
}
}
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -27,7 +27,7 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.command.response.UpdateViewResponse;
-import org.jboss.portal.core.model.portal.command.UpdateWindowMarkupResponse;
+import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import org.jboss.portal.server.ServerException;
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-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -26,10 +26,11 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.InvokeWindowCommand;
-import org.jboss.portal.core.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.impl.PortletRequestEncoder;
@@ -45,14 +46,6 @@
{
/** . */
- private static final String[] COMMAND_CLASS_NAMES =
- {
- RenderPageCommand.class.getName(),
- InvokeWindowActionCommand.class.getName(),
- InvokeWindowRenderCommand.class.getName()
- };
-
- /** . */
private String path;
public String getPath()
@@ -65,11 +58,6 @@
this.path = path;
}
- protected String[] getCommandClassNames()
- {
- return PortalObjectURLFactory.COMMAND_CLASS_NAMES;
- }
-
public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
{
if (cmd == null)
@@ -78,42 +66,44 @@
}
//
- if (cmd instanceof RenderPageCommand)
+ if (cmd instanceof PortalObjectCommand)
{
- RenderPageCommand rpCmd = (RenderPageCommand)cmd;
- String pageRef = rpCmd.getTargetId();
- return getBaseURL(pageRef);
- }
- else if (cmd instanceof InvokeWindowCommand)
- {
- InvokeWindowCommand iwaCmd = (InvokeWindowCommand)cmd;
-
- // The base URL
- AbstractServerURL serverURL = getBaseURL(iwaCmd.getTargetId());
-
- Mode mode = iwaCmd.getMode();
- WindowState windowState = iwaCmd.getWindowState();
-
- //
- if (iwaCmd instanceof InvokeWindowActionCommand)
+ if (cmd instanceof RenderPageCommand)
{
- StateString interactionState =
((InvokeWindowActionCommand)iwaCmd).getInteractionState();
- StateString navigationalState =
((InvokeWindowActionCommand)iwaCmd).getNavigationalState();
- PortletRequestEncoder.encodeAction(serverURL, navigationalState,
interactionState, mode, windowState);
+ RenderPageCommand rpCmd = (RenderPageCommand)cmd;
+ String pageRef = rpCmd.getTargetId();
+ return getBaseURL(pageRef);
}
- else
+ else if (cmd instanceof InvokeWindowCommand)
{
- StateString navigationalState =
((InvokeWindowRenderCommand)iwaCmd).getNavigationalState();
- PortletRequestEncoder.encodeRender(serverURL, navigationalState, mode,
windowState);
- }
+ InvokeWindowCommand iwaCmd = (InvokeWindowCommand)cmd;
- //
- return serverURL;
+ // The base URL
+ AbstractServerURL serverURL = getBaseURL(iwaCmd.getTargetId());
+
+ Mode mode = iwaCmd.getMode();
+ WindowState windowState = iwaCmd.getWindowState();
+
+ //
+ if (iwaCmd instanceof InvokePortletWindowActionCommand)
+ {
+ StateString interactionState =
((InvokePortletWindowActionCommand)iwaCmd).getInteractionState();
+ StateString navigationalState =
((InvokePortletWindowActionCommand)iwaCmd).getNavigationalState();
+ PortletRequestEncoder.encodeAction(serverURL, navigationalState,
interactionState, mode, windowState);
+ }
+ else
+ {
+ StateString navigationalState =
((InvokePortletWindowRenderCommand)iwaCmd).getNavigationalState();
+ PortletRequestEncoder.encodeRender(serverURL, navigationalState, mode,
windowState);
+ }
+
+ //
+ return serverURL;
+ }
}
- else
- {
- throw new IllegalArgumentException("Command " +
cmd.getClass().getName() + " not accepted");
- }
+
+ //
+ return null;
}
private AbstractServerURL getBaseURL(String objectRef)
Added:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortletWindowResponseHandler.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal;
+
+import org.jboss.portal.core.controller.portlet.PortletResponseHandler;
+import org.jboss.portal.core.controller.portlet.PortletResponse;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletWindowResponseHandler extends PortletResponseHandler
+{
+ protected ControllerCommand createRenderCommand(Mode mode, WindowState windowState,
StateString navState, PortletResponse response)
+ {
+ if (response instanceof PortletWindowResponse)
+ {
+ PortletWindowResponse pwr = (PortletWindowResponse)response;
+ return new InvokePortletWindowRenderCommand(
+ pwr.getWindowId(),
+ mode,
+ windowState,
+ navState);
+ }
+
+ //
+ return null;
+ }
+}
Copied:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
(from rev 5706,
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java 2006-11-21
21:51:07 UTC (rev 5706)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,140 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+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.portlet.invocation.response.PortletInvocationResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InvokePortletWindowActionCommand extends InvokeWindowCommand
+{
+
+ /** . */
+ private static final Logger log =
Logger.getLogger(InvokePortletWindowActionCommand.class);
+
+ /** . */
+ private static final CommandInfo info = new ActionCommandInfo(false, "view",
false);
+
+ /** . */
+ private StateString navigationalState;
+
+ /** . */
+ private StateString interactionState;
+
+ /** . */
+ private Parameters formParameters;
+
+ public InvokePortletWindowActionCommand(
+ String windowId,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ StateString interactionState,
+ Parameters formParameters)
+ throws IllegalArgumentException
+ {
+ super(windowId, 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 Object execute() throws ControllerException
+ {
+ try
+ {
+ PortletInvocation invocation = PortletInvocationFactory.createAction(
+ context,
+ mode,
+ windowState,
+ navigationalState,
+ interactionState,
+ formParameters,
+ window,
+ portal);
+
+ //
+ PortletInvocationResponse response = instance.invoke(invocation);
+
+ //
+ return new PortletWindowResponse(targetId, response);
+ }
+ 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/model/portal/command/InvokePortletWindowActionCommand.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/model/portal/command/InvokePortletWindowRenderCommand.java
(from rev 5706,
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java 2006-11-21
21:51:07 UTC (rev 5706)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,124 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.core.aspects.controller.PageNavigationInterceptor;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.navigation.WindowNavigationalState;
+import org.jboss.portal.theme.strategy.StrategyException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InvokePortletWindowRenderCommand extends InvokeWindowCommand
+{
+
+ private static final CommandInfo info = new ViewCommandInfo(false, "view");
+
+ /** . */
+ protected final StateString navigationalState;
+
+ public InvokePortletWindowRenderCommand(
+ String windowRef,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState)
+ throws IllegalArgumentException
+ {
+ super(windowRef, mode, windowState);
+ this.navigationalState = navigationalState;
+ }
+
+ public InvokePortletWindowRenderCommand(
+ String windowId,
+ Mode mode,
+ WindowState windowState)
+ throws IllegalArgumentException
+ {
+ super(windowId, mode, windowState);
+ this.navigationalState = null;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Object execute() throws InvocationException
+ {
+ InvocationContext ctx = getContext();
+
+ //
+ if (navigationalState != null)
+ {
+ ctx.setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef(),
navigationalState);
+ }
+
+ // Update the window nav state
+ WindowNavigationalState windowNavState =
(WindowNavigationalState)ctx.getAttribute(NAVIGATIONAL_STATE_SCOPE,
window.getInstanceRef() + "_window");
+ if (windowNavState == null)
+ {
+ windowNavState = new WindowNavigationalState();
+ ctx.setAttribute(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);
+ }
+
+ //
+ return new UpdateWindowMarkupResponse(window.getId());
+ }
+}
\ No newline at end of file
Property changes on:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.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/model/portal/command/InvokeWindowActionCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowActionCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,140 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.ResourceNotFoundException;
-import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.portlet.PortletResponse;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-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.portlet.invocation.response.PortletInvocationResponse;
-
-/**
- * @author <a href="mailto:julien@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;
-
- public InvokeWindowActionCommand(
- String windowId,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- StateString interactionState,
- Parameters formParameters)
- throws IllegalArgumentException
- {
- super(windowId, 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 Object execute() throws ControllerException
- {
- try
- {
- PortletInvocation invocation = PortletInvocationFactory.createAction(
- context,
- mode,
- windowState,
- navigationalState,
- interactionState,
- formParameters,
- window,
- portal);
-
- //
- PortletInvocationResponse resp = instance.invoke(invocation);
-
- //
- return new PortletResponse(targetId, resp);
- }
- catch (PortletInvokerException e)
- {
- if (e instanceof NoSuchPortletException)
- {
- throw new
ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
- }
- else
- {
- throw new ControllerException(e);
- }
- }
- }
-}
Deleted:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowRenderCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,124 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.invocation.InvocationContext;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.aspects.controller.PageNavigationInterceptor;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
-import org.jboss.portal.core.model.portal.command.UpdateWindowMarkupResponse;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.strategy.StrategyException;
-
-/**
- * @author <a href="mailto:julien@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 windowId,
- Mode mode,
- WindowState windowState)
- throws IllegalArgumentException
- {
- super(windowId, mode, windowState);
- this.navigationalState = null;
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public Object execute() throws InvocationException
- {
- InvocationContext ctx = getContext();
-
- //
- if (navigationalState != null)
- {
- ctx.setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef(),
navigationalState);
- }
-
- // Update the window nav state
- WindowNavigationalState windowNavState =
(WindowNavigationalState)ctx.getAttribute(NAVIGATIONAL_STATE_SCOPE,
window.getInstanceRef() + "_window");
- if (windowNavState == null)
- {
- windowNavState = new WindowNavigationalState();
- ctx.setAttribute(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);
- }
-
- //
- return new UpdateWindowMarkupResponse(window.getId());
- }
-}
\ No newline at end of file
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -41,7 +41,7 @@
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.model.portal.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.identity.User;
import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.info.ModeInfo;
@@ -401,7 +401,7 @@
try
{
- RenderWindowCommand renderCmd = new RenderWindowCommand(windowRef);
+ RenderPortletWindowCommand renderCmd = new
RenderPortletWindowCommand(windowRef);
//
PortletResponse portletResponse = (PortletResponse)context.execute(renderCmd);
@@ -632,7 +632,7 @@
public String createUpdateNavigationalStateURL(Window window, Mode mode, WindowState
windowState)
{
- InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(window.getId(), mode,
windowState);
+ InvokePortletWindowRenderCommand cmd = new
InvokePortletWindowRenderCommand(window.getId(), mode, windowState);
ControllerContext controllerContext = getControllerContext();
ServerInvocationContext serverContext =
controllerContext.getServerInvocation().getServerContext();
boolean secure = serverContext.getURLContext().getSecure();
Copied:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
(from rev 5706,
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2006-11-21
21:51:07 UTC (rev 5706)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,109 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.theme.navigation.WindowNavigationalState;
+
+/**
+ * Render a single window.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class RenderPortletWindowCommand extends WindowCommand
+{
+
+ /** . */
+ private static final CommandInfo info = new ViewCommandInfo(true, "view");
+
+ public RenderPortletWindowCommand(String windowRef) throws IllegalArgumentException
+ {
+ super(windowRef);
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public Object execute() throws ControllerException
+ {
+ StateString navigationalState = (StateString)getAttribute(NAVIGATIONAL_STATE_SCOPE,
window.getInstanceRef());
+
+ //
+ WindowNavigationalState windowNavState =
(WindowNavigationalState)getAttribute(NAVIGATIONAL_STATE_SCOPE, targetId +
"_window");
+ if (windowNavState == null)
+ {
+ windowNavState = new WindowNavigationalState();
+ setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window",
windowNavState);
+ }
+
+ // Get the mode
+ Mode mode = windowNavState.getMode();
+
+ // Get the window state
+ WindowState windowState = windowNavState.getWindowState();
+
+ //
+ RenderInvocation invocation = PortletInvocationFactory.createRender(
+ context,
+ mode,
+ windowState,
+ navigationalState,
+ window,
+ portal);
+
+ //
+ try
+ {
+ PortletInvocationResponse resp = instance.invoke(invocation);
+
+ //
+ return new PortletWindowResponse(targetId, resp);
+ }
+ 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/model/portal/command/RenderPortletWindowCommand.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/model/portal/command/RenderWindowCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,109 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.ResourceNotFoundException;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
-import org.jboss.portal.core.controller.portlet.PortletResponse;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-
-/**
- * Render a single window.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class RenderWindowCommand extends WindowCommand
-{
-
- /** . */
- private static final CommandInfo info = new ViewCommandInfo(true, "view");
-
- public RenderWindowCommand(String windowRef) throws IllegalArgumentException
- {
- super(windowRef);
- }
-
- public CommandInfo getInfo()
- {
- return info;
- }
-
- public Object execute() throws ControllerException
- {
- StateString navigationalState = (StateString)getAttribute(NAVIGATIONAL_STATE_SCOPE,
window.getInstanceRef());
-
- //
- WindowNavigationalState windowNavState =
(WindowNavigationalState)getAttribute(NAVIGATIONAL_STATE_SCOPE, targetId +
"_window");
- if (windowNavState == null)
- {
- windowNavState = new WindowNavigationalState();
- setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window",
windowNavState);
- }
-
- // Get the mode
- Mode mode = windowNavState.getMode();
-
- // Get the window state
- WindowState windowState = windowNavState.getWindowState();
-
- //
- RenderInvocation invocation = PortletInvocationFactory.createRender(
- context,
- mode,
- windowState,
- navigationalState,
- window,
- portal);
-
- //
- try
- {
- PortletInvocationResponse resp = instance.invoke(invocation);
-
- //
- return new PortletResponse(targetId, resp);
- }
- catch (PortletInvokerException e)
- {
- if (e instanceof NoSuchPortletException)
- {
- throw new
ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
- }
- else
- {
- throw new ControllerException(e);
- }
- }
- }
-}
Deleted:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,48 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class UpdateWindowMarkupResponse
-{
-
- /** . */
- private String windowId;
-
- public UpdateWindowMarkupResponse(String windowId)
- {
- if (windowId == null)
- {
- throw new IllegalArgumentException();
- }
- this.windowId = windowId;
- }
-
- public String getWindowId()
- {
- return windowId;
- }
-}
Added:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.response;
+
+import org.jboss.portal.core.controller.portlet.PortletResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+/**
+ * A portlet response related to a portal object window.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletWindowResponse extends PortletResponse
+{
+
+ /** The window id targetting the portlet. */
+ private String windowId;
+
+ public PortletWindowResponse(String windowId, PortletInvocationResponse response)
+ {
+ super(response);
+
+ //
+ if (windowId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.windowId = windowId;
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+}
Copied:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java
(from rev 5706,
trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/UpdateWindowMarkupResponse.java 2006-11-21
21:51:07 UTC (rev 5706)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.command.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UpdateWindowMarkupResponse
+{
+
+ /** . */
+ private String windowId;
+
+ public UpdateWindowMarkupResponse(String windowId)
+ {
+ if (windowId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.windowId = windowId;
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+}
Deleted:
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorCommandFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,87 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.ui.configurator;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
-import org.jboss.portal.portlet.impl.PortletRequestDecoder;
-import org.jboss.portal.server.ServerInvocation;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ConfiguratorCommandFactory extends AbstractCommandFactory
-{
-
- public ControllerCommand doMapping(ServerInvocation invocation, String
portalContextPath, String portalRequestPath)
- {
- PortletRequestDecoder decoder = new PortletRequestDecoder();
- decoder.decode(invocation.getServerContext().getQueryParameterMap(),
invocation.getServerContext().getBodyParameterMap());
- switch (decoder.getType())
- {
- case PortletRequestDecoder.NAV_TYPE:
- {
- return createPortletNavCommand(decoder);
- }
- case PortletRequestDecoder.RENDER_TYPE:
- {
- return createPortletRenderCommand(decoder);
- }
- case PortletRequestDecoder.ACTION_TYPE:
- {
- return createPortletActionCommand(decoder);
- }
- }
-
- //
- return null;
- }
-
- /**
- *
- */
- public ControllerCommand createPortletActionCommand(PortletRequestDecoder decoder)
- {
- return new InvokePortletActionCommand(
- decoder.getNavigationalstate(),
- decoder.getInteractionState(),
- decoder.getForm());
- }
-
- /**
- *
- */
- protected ControllerCommand createPortletRenderCommand(PortletRequestDecoder decoder)
- {
- return new InvokePortletRenderCommand(decoder.getNavigationalstate());
- }
-
- /**
- *
- */
- protected ControllerCommand createPortletNavCommand(PortletRequestDecoder decoder)
- {
- return new InvokePortletRenderCommand(decoder.getNavigationalstate());
- }
-}
Deleted:
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/ui/configurator/ConfiguratorURLFactory.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,76 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.ui.configurator;
-
-import org.jboss.portal.core.controller.command.mapper.URLFactoryDelegate;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.server.ServerURL;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.AbstractServerURL;
-import org.jboss.portal.portlet.impl.PortletRequestEncoder;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ConfiguratorURLFactory extends URLFactoryDelegate
-{
-
- /** . */
- private String path;
-
- protected String[] getCommandClassNames()
- {
- return new String[]{
- InvokePortletRenderCommand.class.getName(),
- InvokePortletActionCommand.class.getName()
- };
- }
-
- public String getPath()
- {
- return path;
- }
-
- public void setPath(String path)
- {
- this.path = path;
- }
-
- public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
- {
- ServerURL url = new AbstractServerURL();
- url.setPortalRequestPath(path);
- if (cmd instanceof InvokePortletRenderCommand)
- {
- InvokePortletRenderCommand iprc = (InvokePortletRenderCommand)cmd;
- PortletRequestEncoder.encodeRender(url, iprc.getNavigationalState(), null,
null);
- }
- else
- {
- InvokePortletActionCommand iprc = (InvokePortletActionCommand)cmd;
- PortletRequestEncoder.encodeAction(url, iprc.getNavigationalState(),
iprc.getInteractionState(), null, null);
- }
- return url;
- }
-}
Deleted:
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletActionCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,135 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.ui.configurator;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.portlet.PortletContextFactory;
-import org.jboss.portal.core.controller.portlet.PortletCommandFactory;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.theme.page.PageService;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.PageRendition;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
-import org.jboss.portal.common.NotYetImplemented;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class InvokePortletActionCommand extends InvokePortletCommand
-{
-
- /** The interaction state. */
- private StateString interactionState;
-
- /** The nform. */
- private Parameters form;
-
- public InvokePortletActionCommand(StateString navigationalState, StateString
interactionState, Parameters form)
- {
- super(navigationalState);
- this.interactionState = interactionState;
- this.form = form;
- }
-
- public StateString getInteractionState()
- {
- return interactionState;
- }
-
- public Parameters getForm()
- {
- return form;
- }
-
- public CommandInfo getInfo()
- {
- return null;
- }
-
- public Object execute() throws ControllerException
- {
- try
- {
- PortletContextFactory pcf1 = new PortletContextFactory(context);
- PortletCommandFactory pcf2 = new PortletCommandFactoryImpl();
- ActionInvocation action = PortletInvocationFactory.createAction(
- context,
- Mode.VIEW,
- WindowState.MAXIMIZED,
- navigationalState,
- interactionState,
- form,
- pcf1,
- pcf2);
- PortletInvocationResponse response = instance.invoke(action);
-
- // For now let the controller handle non fragment response
- String content = "";
- if (response instanceof FragmentResponse)
- {
- content = ((FragmentResponse)response).getContent();
- }
- else if (response instanceof ErrorResponse)
- {
- content = ((ErrorResponse)response).toHTML();
- }
- else
- {
- throw new NotYetImplemented();
- }
-
-
- //
- return null;
- }
- catch (PortletInvokerException e)
- {
- return new ControllerException(e);
- }
- }
-}
Deleted:
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,73 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.ui.configurator;
-
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.portlet.StateString;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class InvokePortletCommand extends ControllerCommand
-{
-
- /** The navigational state. */
- protected StateString navigationalState;
-
- /** The instance displayed. */
- protected Instance instance;
-
- public InvokePortletCommand(StateString navigationalState)
- {
- this.navigationalState = navigationalState;
- }
-
- protected void create() throws ControllerException
- {
- InstanceContainer container = context.getController().getInstanceContainer();
-
- String instanceId = "ConfiguratorPortletInstance";
-
- //
- if (instanceId == null)
- {
- throw new ControllerException("No portlet instance configured on the
configurator");
- }
-
- //
- instance = container.getInstance(instanceId);
- if (instance == null)
- {
- throw new ControllerException("Configurator portlet instance " +
instanceId + " not found");
- }
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-}
Deleted:
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/ui/configurator/InvokePortletRenderCommand.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,134 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.ui.configurator;
-
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.portlet.PortletContextFactory;
-import org.jboss.portal.core.controller.portlet.PortletCommandFactory;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.theme.PageRendition;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
-import org.jboss.portal.theme.page.PageService;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.NotYetImplemented;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class InvokePortletRenderCommand extends InvokePortletCommand
-{
-
- public InvokePortletRenderCommand(StateString navigationalState)
- {
- super(navigationalState);
- }
-
- public CommandInfo getInfo()
- {
- return null;
- }
-
- public Object execute() throws ControllerException
- {
- try
- {
- PortletContextFactory pcf1 = new PortletContextFactory(context);
- PortletCommandFactory pcf2 = new PortletCommandFactoryImpl();
- RenderInvocation render = PortletInvocationFactory.createRender(context,
Mode.VIEW, WindowState.MAXIMIZED, navigationalState, pcf1, pcf2);
- PortletInvocationResponse response = instance.invoke(render);
-
- // For now let the controller handle non fragment response
- String content = "";
- if (response instanceof FragmentResponse)
- {
- content = ((FragmentResponse)response).getContent();
- }
- else if (response instanceof ErrorResponse)
- {
- content = ((ErrorResponse)response).toHTML();
- }
- else
- {
- throw new NotYetImplemented();
- }
-
- //
- PageService ps = context.getController().getPageService();
- LayoutService ls = ps.getLayoutService();
- PortalLayout layout = ls.getLayout("generic", true);
- Map pageProperties = new HashMap();
- Map portalProperties = new HashMap();
- portalProperties.put("theme.renderSetId", "divRenderer");
- portalProperties.put("theme.id", "renaissance");
- portalProperties.put("layout.strategyId",
"maximizedRegion");
- ModifiablePageResult result = new ModifiablePageResult("BILTO",
pageProperties, portalProperties);
-
- //
- Map windowProps = new HashMap();
- windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER,
"emptyRenderer");
- windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER,
"emptyRenderer");
- windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER,
"emptyRenderer");
-
- //
- WindowResult res = new ModifiableWindowResult("", content,
Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
- WindowContext blah = new WindowContext("BILTO", "BILTO",
"maximized", 0);
- result.addWindowContext(blah);
- result.addWindowResult("BILTO", res);
-
- //
- PageNavigationalState pns = new PageNavigationalState();
- HashMap tmp = new HashMap();
- tmp.put("BILTO", blah);
- pns.initialize(tmp);
- pns.setLayoutURI("/layouts/generic/maximized.jsp");
- pns.setLayoutState("maximized");
-
- //
- return new PageRendition(layout, pns, result, ps);
- }
- catch (PortletInvokerException e)
- {
- return new ControllerException(e);
- }
- }
-}
Deleted:
trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java 2006-11-22
03:13:47 UTC (rev 5708)
+++
trunk/core/src/main/org/jboss/portal/core/ui/configurator/PortletCommandFactoryImpl.java 2006-11-22
14:45:08 UTC (rev 5709)
@@ -1,45 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.ui.configurator;
-
-import org.jboss.portal.core.controller.portlet.PortletCommandFactory;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.RenderURL;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletCommandFactoryImpl implements PortletCommandFactory
-{
- public ControllerCommand createInvokeActionCommand(ActionURL portletURL)
- {
- return new InvokePortletActionCommand(portletURL.getNavigationalState(),
portletURL.getInteractionState(), null);
- }
-
- public ControllerCommand createInvokeRenderCommand(RenderURL portletURL)
- {
- return new InvokePortletRenderCommand(portletURL.getNavigationalState());
- }
-}
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-11-22
03:13:47 UTC (rev 5708)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-11-22
14:45:08 UTC (rev 5709)
@@ -689,11 +689,12 @@
proxy-type="attribute">portal:commandFactory=Dashboard</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.ui.configurator.ConfiguratorCommandFactory"
+ code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
name="portal:commandFactory=Configurator"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
+ <attribute
name="InstanceId">ConfiguratorPortletInstance</attribute>
</mbean>
<mbean
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
@@ -709,6 +710,28 @@
optional-attribute-name="DelegateFactory"
proxy-type="attribute">portal:commandFactory=Configurator</depends>
</mbean>
+ <mbean
+
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+ name="portal:commandFactory=Delegate,path=test"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Path">/test</attribute>
+ <depends
+ optional-attribute-name="DelegatingFactory"
+
proxy-type="attribute">portal:commandFactory=Delegating</depends>
+ <depends
+ optional-attribute-name="DelegateFactory"
+ proxy-type="attribute">portal:commandFactory=Test</depends>
+ </mbean>
+ <mbean
+ code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
+ name="portal:commandFactory=Test"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="InstanceId">TestPortletInstance</attribute>
+ </mbean>
<!-- URL factories -->
<mbean
@@ -754,16 +777,29 @@
proxy-type="attribute">portal:urlFactory=Delegating</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.ui.configurator.ConfiguratorURLFactory"
+ code="org.jboss.portal.core.model.instance.InstanceURLFactory"
name="portal:urlFactory=Configurator"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
+ <attribute
name="InstanceId">ConfiguratorPortletInstance</attribute>
<attribute name="Path">/configure</attribute>
<depends
optional-attribute-name="Factory"
proxy-type="attribute">portal:urlFactory=Delegating</depends>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.model.instance.InstanceURLFactory"
+ name="portal:urlFactory=Test"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="InstanceId">TestPortletInstance</attribute>
+ <attribute name="Path">/test</attribute>
+ <depends
+ optional-attribute-name="Factory"
+
proxy-type="attribute">portal:urlFactory=Delegating</depends>
+ </mbean>
<!-- The federating portlet invoker -->
<mbean