Author: thomas.heute(a)jboss.com
Date: 2008-07-30 12:08:41 -0400 (Wed, 30 Jul 2008)
New Revision: 11657
Modified:
tags/JBoss_Portal_2_7_0_BETA1/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
tags/JBoss_Portal_2_7_0_BETA1/core-admin/src/resources/portal-admin-war/jsf/common/showPortletDetails.xhtml
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
tags/JBoss_Portal_2_7_0_BETA1/faces/src/main/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java
Log:
- Reduced coordination prefix's size
- WSRP needs navigational state to be passed when creating an action command for
templating purpose.
PortletRequestEncoder.encodeAction can just discard the NS instead of throwing an
exception.
- Suddenly JSF+Facelets doesn't like Sets anymore...
Modified:
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
---
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-07-30
15:41:01 UTC (rev 11656)
+++
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-07-30
16:08:41 UTC (rev 11657)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.controller.portlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
@@ -38,10 +35,10 @@
import
org.jboss.portal.core.model.portal.command.action.InvokePortletWindowResourceCommand;
import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ResourceURL;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
import org.jboss.portal.portlet.invocation.ActionInvocation;
@@ -53,6 +50,8 @@
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
@@ -69,9 +68,9 @@
public static ThreadLocal<UserContext> userContextTL = new
ThreadLocal<UserContext>();
public static InvokePortletCommandFactory createInvokePortletCommandFactory(
- ControllerContext controllerContext,
- Window window,
- PortletPageNavigationalState pageNavigationalState)
+ ControllerContext controllerContext,
+ Window window,
+ PortletPageNavigationalState pageNavigationalState)
{
return new InternalInvokePortletCommandFactory(window, controllerContext,
pageNavigationalState);
}
@@ -83,24 +82,24 @@
}
public static PortletInvocationContext createInvocationContext(
- ControllerContext controllerContext,
- Window window,
- PortletPageNavigationalState pageNavigationalState)
+ ControllerContext controllerContext,
+ Window window,
+ PortletPageNavigationalState pageNavigationalState)
{
InvokePortletCommandFactory ipcf =
createInvokePortletCommandFactory(controllerContext, window, pageNavigationalState);
return createInvocationContext(controllerContext, ipcf);
}
public static ActionInvocation createAction(
- ControllerContext controllerContext,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- StateString interactionState,
- ParameterMap form,
- Window window,
- Portal portal,
- PortletPageNavigationalState pageNavigationalState)
+ ControllerContext controllerContext,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ StateString interactionState,
+ ParameterMap form,
+ Window window,
+ Portal portal,
+ PortletPageNavigationalState pageNavigationalState)
{
PortletContextFactory cf = new PortletContextFactory(controllerContext, portal,
window);
InvokePortletCommandFactory cpc =
createInvokePortletCommandFactory(controllerContext, window, pageNavigationalState);
@@ -108,14 +107,14 @@
}
public static ActionInvocation createAction(
- ControllerContext controllerContext,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- StateString interactionState,
- ParameterMap form,
- PortletContextFactory cf,
- InvokePortletCommandFactory cpc)
+ ControllerContext controllerContext,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ StateString interactionState,
+ ParameterMap form,
+ PortletContextFactory cf,
+ InvokePortletCommandFactory cpc)
{
PortletInvocationContext portletInvocationContext =
createInvocationContext(controllerContext, cpc);
@@ -137,13 +136,13 @@
}
public static RenderInvocation createRender(
- ControllerContext controllerContext,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- Window window,
- Portal portal,
- PortletPageNavigationalState pageNavigationalState)
+ ControllerContext controllerContext,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ Window window,
+ Portal portal,
+ PortletPageNavigationalState pageNavigationalState)
{
PortletContextFactory cf = new PortletContextFactory(controllerContext, portal,
window);
InvokePortletCommandFactory cpc =
createInvokePortletCommandFactory(controllerContext, window, pageNavigationalState);
@@ -153,12 +152,12 @@
}
public static RenderInvocation createRender(
- ControllerContext controllerContext,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- PortletContextFactory cf,
- InvokePortletCommandFactory cpc)
+ ControllerContext controllerContext,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ PortletContextFactory cf,
+ InvokePortletCommandFactory cpc)
{
PortletInvocationContext portletInvocationContext =
createInvocationContext(controllerContext, cpc);
@@ -178,9 +177,9 @@
}
public static void contextualize(
- ControllerContext controllerContext,
- PortletContextFactory cf,
- PortletInvocation invocation)
+ ControllerContext controllerContext,
+ PortletContextFactory cf,
+ PortletInvocation invocation)
{
invocation.setAttribute("controller_context", controllerContext);
@@ -240,9 +239,9 @@
private ControllerContext controllerContext;
public ControllerPortletInvocationContext(
- InvokePortletCommandFactory cmdFactory,
- ControllerContext controllerContext,
- MarkupInfo markupInfo)
+ InvokePortletCommandFactory cmdFactory,
+ ControllerContext controllerContext,
+ MarkupInfo markupInfo)
{
super(markupInfo);
@@ -325,9 +324,9 @@
Map<String, String[]> publicNavigationalState;
public InternalInvokePortletCommandFactory(
- Window window,
- ControllerContext controllerContext,
- PortletPageNavigationalState pageNavigationalState)
+ Window window,
+ ControllerContext controllerContext,
+ PortletPageNavigationalState pageNavigationalState)
{
this.controllerContext = controllerContext;
this.window = window;
@@ -337,12 +336,12 @@
public ControllerCommand createInvokeActionCommand(ActionURL actionURL)
{
return new InvokePortletWindowActionCommand(
- window.getId(),
- actionURL.getMode(),
- actionURL.getWindowState(),
- null,
- actionURL.getInteractionState(),
- null);
+ window.getId(),
+ actionURL.getMode(),
+ actionURL.getWindowState(),
+ actionURL.getNavigationalState(),
+ actionURL.getInteractionState(),
+ null);
}
public ControllerCommand createInvokeRenderCommand(RenderURL renderURL)
@@ -406,20 +405,20 @@
//
return new InvokePortletWindowRenderCommand(
- window.getId(),
- renderURL.getMode(),
- renderURL.getWindowState(),
- navigationalState);
+ window.getId(),
+ renderURL.getMode(),
+ renderURL.getWindowState(),
+ navigationalState);
}
public ControllerCommand createInvokeResourceCommand(ResourceURL resourceURL)
{
return new InvokePortletWindowResourceCommand(
- window.getId(),
- resourceURL.getCacheability(),
- resourceURL.getResourceId(),
- resourceURL.getResourceState(),
- null
+ window.getId(),
+ resourceURL.getCacheability(),
+ resourceURL.getResourceId(),
+ resourceURL.getResourceState(),
+ null
);
}
}
Modified:
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
===================================================================
---
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-07-30
15:41:01 UTC (rev 11656)
+++
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-07-30
16:08:41 UTC (rev 11657)
@@ -63,7 +63,7 @@
public static final String BINDING = "binding";
- public static final String PREFIX =
"org.jboss.portal.core.controller.coordination";
+ public static final String PREFIX = "coordination";
public static final String QNAME_SEPARATOR = ";";
Modified:
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
===================================================================
---
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-07-30
15:41:01 UTC (rev 11656)
+++
tags/JBoss_Portal_2_7_0_BETA1/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-07-30
16:08:41 UTC (rev 11657)
@@ -24,21 +24,17 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.cache.CacheLevel;
-import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.common.NotYetImplemented;
import java.util.Map;
/**
- * This class is designed to provide the encoding in the query string of a URL of the
following state :
- * <ul>
- * <li>A set of parameters</li>
- * <li>A mode value</li>
- * <li>A window state value</li>
- * <li>A invocation type (action or render)</li>
+ * This class is designed to provide the encoding in the query string of a URL of the
following state : <ul> <li>A set
+ * of parameters</li> <li>A mode value</li> <li>A window state
value</li> <li>A invocation type (action or render)</li>
* </ul>
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -67,9 +63,9 @@
}
public void encodeResource(
- CacheLevel cacheability,
- String resourceId,
- StateString resourceState)
+ CacheLevel cacheability,
+ String resourceId,
+ StateString resourceState)
{
queryParameters.clear();
@@ -110,10 +106,10 @@
}
public void encodeAction(
- StateString navigationalState,
- StateString interactionState,
- Mode mode,
- WindowState windowState) throws IllegalArgumentException
+ StateString navigationalState,
+ StateString interactionState,
+ Mode mode,
+ WindowState windowState) throws IllegalArgumentException
{
queryParameters.clear();
@@ -125,10 +121,10 @@
{
if (interactionState instanceof ParametersStateString)
{
- if (navigationalState != null)
- {
- throw new IllegalArgumentException("Cannot handle case with both non
opaque interaction and navigational state");
- }
+ // we don't need to encode the navigational state in the URL (stored in
session)
+ // but we shouldn't throw an exception here because it's needed for
template creation in WSRP
+ // so just discard it
+ navigationalState = null;
// Add the parameters
Map<String, String[]> parameters =
((ParametersStateString)interactionState).getParameters();
@@ -154,9 +150,9 @@
}
public void encodeRender(
- StateString navigationalState,
- Mode mode,
- WindowState windowState)
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState)
{
queryParameters.clear();
Modified:
tags/JBoss_Portal_2_7_0_BETA1/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
===================================================================
---
tags/JBoss_Portal_2_7_0_BETA1/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2008-07-30
15:41:01 UTC (rev 11656)
+++
tags/JBoss_Portal_2_7_0_BETA1/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2008-07-30
16:08:41 UTC (rev 11657)
@@ -25,6 +25,7 @@
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.IteratorStatus;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.core.impl.model.content.ContentProviderRegistryService;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.spi.portlet.ContentPortlet;
@@ -45,8 +46,11 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.TransportGuarantee;
import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.WindowStateInfo;
import org.jboss.portal.security.AuthorizationDomainRegistry;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
import org.jboss.portal.theme.LayoutService;
@@ -173,27 +177,38 @@
}
}
});
- portletDecorator.setProperty("modes", new
AbstractPropertyDecorator(Set.class)
+ portletDecorator.setProperty("modes", new
AbstractPropertyDecorator(List.class)
{
public Object getValue(Object bean) throws IllegalArgumentException
{
Portlet portlet = (Portlet)bean;
- return portlet.getInfo().getCapabilities().getModes(MediaType.TEXT_HTML);
+ Set<ModeInfo> set = portlet.getInfo().getCapabilities().getAllModes();
+ return Tools.toList(set.iterator());
}
});
- portletDecorator.setProperty("windowStates", new
AbstractPropertyDecorator(Set.class)
+ portletDecorator.setProperty("windowStates", new
AbstractPropertyDecorator(List.class)
{
public Object getValue(Object bean) throws IllegalArgumentException
{
Portlet portlet = (Portlet)bean;
- return
portlet.getInfo().getCapabilities().getWindowStates(MediaType.TEXT_HTML);
+ Set<WindowStateInfo> set =
portlet.getInfo().getCapabilities().getWindowStates(MediaType.TEXT_HTML);
+ return Tools.toList(set.iterator());
}
});
- portletDecorator.setProperty("locales", new
AbstractPropertyDecorator(Set.class)
+ portletDecorator.setProperty("mediaTypes", new
AbstractPropertyDecorator(List.class)
{
public Object getValue(Object bean) throws IllegalArgumentException
{
Portlet portlet = (Portlet)bean;
+ Set<MediaType> set =
portlet.getInfo().getCapabilities().getMediaTypes();
+ return Tools.toList(set.iterator());
+ }
+ });
+ portletDecorator.setProperty("locales", new
AbstractPropertyDecorator(List.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
Set<Locale> locales =
portlet.getInfo().getCapabilities().getAllLocales();
if (locales != null)
{
@@ -205,6 +220,22 @@
}
}
});
+ portletDecorator.setProperty("transportGuarantees", new
AbstractPropertyDecorator(List.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ Set<TransportGuarantee> tg =
portlet.getInfo().getSecurity().getTransportGuarantees();
+ if (tg != null)
+ {
+ return new ArrayList<TransportGuarantee>(tg);
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
+ });
portletDecorator.setProperty("smallIconLocation", new
PortletIconPropertyDecorator(PortletIconInfo.SMALL));
portletDecorator.setProperty("largeIconLocation", new
PortletIconPropertyDecorator(PortletIconInfo.LARGE));
registerDecorator(Portlet.class, portletDecorator);
Modified:
tags/JBoss_Portal_2_7_0_BETA1/core-admin/src/resources/portal-admin-war/jsf/common/showPortletDetails.xhtml
===================================================================
---
tags/JBoss_Portal_2_7_0_BETA1/core-admin/src/resources/portal-admin-war/jsf/common/showPortletDetails.xhtml 2008-07-30
15:41:01 UTC (rev 11656)
+++
tags/JBoss_Portal_2_7_0_BETA1/core-admin/src/resources/portal-admin-war/jsf/common/showPortletDetails.xhtml 2008-07-30
16:08:41 UTC (rev 11657)
@@ -43,7 +43,7 @@
<div class="full-width sub-header2">
<ul>
<li
class="third-width"><label>#{bundle.COMMON_TRANSPORT_GUARANTEES}:
</label>
- <c:forEach var="transportGuarantees"
items="#{portlet.info.security.transportGuarantees}">
+ <c:forEach var="transportGuarantees"
items="#{portlet.transportGuarantees}">
#{transportGuarantees}  
</c:forEach>
</li>
@@ -59,7 +59,7 @@
<portal:box class="whiteWithLtGreyHeader meta-box">
<h3>#{bundle.COMMON_MEDIA_TYPES}</h3>
<dl>
- <c:forEach var="mediaType"
items="#{portlet.info.capabilities.mediaTypes}">
+ <c:forEach var="mediaType"
items="#{portlet.mediaTypes}">
<dt>
#{mediaType.value}
</dt>
@@ -72,7 +72,7 @@
<portal:box class="whiteWithLtGreyHeader meta-box">
<h3>#{bundle.COMMON_PORTLET_MODES}</h3>
<dl>
- <c:forEach var="mode"
items="#{portlet.info.capabilities.allModes}">
+ <c:forEach var="mode" items="#{portlet.modes}">
<dt>
#{mode.modeName}
</dt>
@@ -85,7 +85,7 @@
<portal:box class="whiteWithLtGreyHeader meta-box">
<h3>#{bundle.COMMON_WINDOW_STATES}</h3>
<dl>
- <c:forEach var="windowState"
items="#{portlet.info.capabilities.allWindowStates}">
+ <c:forEach var="windowState"
items="#{portlet.windowStates}">
<dt>
#{windowState.windowStateName}
</dt>
Modified:
tags/JBoss_Portal_2_7_0_BETA1/faces/src/main/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java
===================================================================
---
tags/JBoss_Portal_2_7_0_BETA1/faces/src/main/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java 2008-07-30
15:41:01 UTC (rev 11656)
+++
tags/JBoss_Portal_2_7_0_BETA1/faces/src/main/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java 2008-07-30
16:08:41 UTC (rev 11657)
@@ -25,24 +25,17 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.StateString;
import java.util.Iterator;
import java.util.Map;
/**
- * This class is designed to provide the encoding in the query string of a URL of the
following state :
- * <ul>
- * <li>A set of parameters</li>
- * <li>A mode value</li>
- * <li>A window state value</li>
- * <li>A invocation type (action or render)</li>
+ * This class is designed to provide the encoding in the query string of a URL of the
following state : <ul> <li>A set
+ * of parameters</li> <li>A mode value</li> <li>A window state
value</li> <li>A invocation type (action or render)</li>
* </ul>
- *
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
@@ -69,10 +62,10 @@
}
public void encodeAction(
- StateString navigationalState,
- StateString interactionState,
- Mode mode,
- WindowState windowState) throws IllegalArgumentException
+ StateString navigationalState,
+ StateString interactionState,
+ Mode mode,
+ WindowState windowState) throws IllegalArgumentException
{
queryParameters.clear();
@@ -84,10 +77,10 @@
{
if (interactionState instanceof ParametersStateString)
{
- if (navigationalState != null)
- {
- throw new IllegalArgumentException("Cannot handle case with both non
opaque interaction and navigational state");
- }
+ // we don't need to encode the navigational state in the URL (stored in
session)
+ // but we shouldn't throw an exception here because it's needed for
template creation in WSRP
+ // so just discard it
+ navigationalState = null;
// Add the parameters
Map<String, String[]> parameters =
((ParametersStateString)interactionState).getParameters();
@@ -113,9 +106,9 @@
}
public void encodeRender(
- StateString navigationalState,
- Mode mode,
- WindowState windowState)
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState)
{
queryParameters.clear();