JBoss Portal SVN: r11552 - tags/JBoss_Portal_2_6_6/server/src/main/org/jboss/portal/server/deployment/jboss.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-23 06:56:17 -0400 (Wed, 23 Jul 2008)
New Revision: 11552
Modified:
tags/JBoss_Portal_2_6_6/server/src/main/org/jboss/portal/server/deployment/jboss/PortalDeploymentInfoContext.java
Log:
JBPORTAL-1832: -object.xml files should be orderable
Contribution from Sylvain FRANCOIS (syllant), thanks !
Modified: tags/JBoss_Portal_2_6_6/server/src/main/org/jboss/portal/server/deployment/jboss/PortalDeploymentInfoContext.java
===================================================================
--- tags/JBoss_Portal_2_6_6/server/src/main/org/jboss/portal/server/deployment/jboss/PortalDeploymentInfoContext.java 2008-07-23 10:50:46 UTC (rev 11551)
+++ tags/JBoss_Portal_2_6_6/server/src/main/org/jboss/portal/server/deployment/jboss/PortalDeploymentInfoContext.java 2008-07-23 10:56:17 UTC (rev 11552)
@@ -30,10 +30,12 @@
import java.io.IOException;
import java.net.URL;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;
+import java.util.TreeSet;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -189,10 +191,14 @@
public void create() throws DeploymentException
{
- for (Iterator i = deployments.keySet().iterator(); i.hasNext();)
+ // @syllant-patch@ : patch to sort -object.xml files
+ Set<URL> sortedDeploymentKeys = new TreeSet<URL>(new URLComparator());
+ sortedDeploymentKeys.addAll(deployments.keySet());
+ for (Iterator<URL> i = sortedDeploymentKeys.iterator(); i.hasNext();)
{
URL url = (URL)i.next();
- for (Iterator j = deployments.iterator(url); j.hasNext();)
+
+ for (Iterator<DeploymentContext> j = deployments.iterator(url); j.hasNext();)
{
DeploymentContext ctx = (DeploymentContext)j.next();
ctx.create();
@@ -202,10 +208,13 @@
public void start() throws DeploymentException
{
- for (Iterator i = deployments.keySet().iterator(); i.hasNext();)
+ // @syllant-patch@ : patch to sort -object.xml files
+ Set<URL> sortedDeploymentKeys = new TreeSet<URL>(new URLComparator());
+ sortedDeploymentKeys.addAll(deployments.keySet());
+ for (Iterator<URL> i = sortedDeploymentKeys.iterator(); i.hasNext();)
{
URL url = (URL)i.next();
- for (Iterator j = deployments.iterator(url); j.hasNext();)
+ for (Iterator<DeploymentContext> j = deployments.iterator(url); j.hasNext();)
{
DeploymentContext ctx = (DeploymentContext)j.next();
ctx.start();
@@ -215,10 +224,13 @@
public void stop() throws DeploymentException
{
- for (Iterator i = deployments.keySet().iterator(); i.hasNext();)
+ // @syllant-patch@ : patch to sort -object.xml files
+ Set<URL> sortedDeploymentKeys = new TreeSet<URL>(new OppositeURLComparator());
+ sortedDeploymentKeys.addAll(deployments.keySet());
+ for (Iterator<URL> i = sortedDeploymentKeys.iterator(); i.hasNext();)
{
URL url = (URL)i.next();
- for (Iterator j = deployments.iterator(url); j.hasNext();)
+ for (Iterator<DeploymentContext> j = deployments.iterator(url); j.hasNext();)
{
DeploymentContext ctx = (DeploymentContext)j.next();
ctx.stop();
@@ -228,14 +240,34 @@
public void destroy() throws DeploymentException
{
- for (Iterator i = deployments.keySet().iterator(); i.hasNext();)
+ // @syllant-patch@ : patch to sort -object.xml files
+ Set<URL> sortedDeploymentKeys = new TreeSet<URL>(new OppositeURLComparator());
+ sortedDeploymentKeys.addAll(deployments.keySet());
+ for (Iterator<URL> i = sortedDeploymentKeys.iterator(); i.hasNext();)
{
URL url = (URL)i.next();
- for (Iterator j = deployments.iterator(url); j.hasNext();)
+ for (Iterator<DeploymentContext> j = deployments.iterator(url); j.hasNext();)
{
DeploymentContext ctx = (DeploymentContext)j.next();
ctx.destroy();
}
}
}
+
+ // @syllant-patch@ : patch to sort -object.xml files
+ private class URLComparator implements Comparator<URL>
+ {
+ public int compare(URL o1, URL o2)
+ {
+ return o1.getPath().compareTo(o2.getPath());
+ }
+ }
+
+ private class OppositeURLComparator implements Comparator<URL>
+ {
+ public int compare(URL o1, URL o2)
+ {
+ return - o1.getPath().compareTo(o2.getPath());
+ }
+ }
}
15 years, 11 months
JBoss Portal SVN: r11551 - branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/deployment/jboss.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-23 06:50:46 -0400 (Wed, 23 Jul 2008)
New Revision: 11551
Modified:
branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/deployment/jboss/PortalDeploymentInfoContext.java
Log:
JBPORTAL-1832: -object.xml files should be orderable
Modified: branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/deployment/jboss/PortalDeploymentInfoContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/deployment/jboss/PortalDeploymentInfoContext.java 2008-07-23 07:14:59 UTC (rev 11550)
+++ branches/JBoss_Portal_Branch_2_6/server/src/main/org/jboss/portal/server/deployment/jboss/PortalDeploymentInfoContext.java 2008-07-23 10:50:46 UTC (rev 11551)
@@ -30,10 +30,12 @@
import java.io.IOException;
import java.net.URL;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;
+import java.util.TreeSet;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -189,10 +191,14 @@
public void create() throws DeploymentException
{
- for (Iterator i = deployments.keySet().iterator(); i.hasNext();)
+ // @syllant-patch@ : patch to sort -object.xml files
+ Set<URL> sortedDeploymentKeys = new TreeSet<URL>(new URLComparator());
+ sortedDeploymentKeys.addAll(deployments.keySet());
+ for (Iterator<URL> i = sortedDeploymentKeys.iterator(); i.hasNext();)
{
URL url = (URL)i.next();
- for (Iterator j = deployments.iterator(url); j.hasNext();)
+
+ for (Iterator<DeploymentContext> j = deployments.iterator(url); j.hasNext();)
{
DeploymentContext ctx = (DeploymentContext)j.next();
ctx.create();
@@ -202,10 +208,13 @@
public void start() throws DeploymentException
{
- for (Iterator i = deployments.keySet().iterator(); i.hasNext();)
+ // @syllant-patch@ : patch to sort -object.xml files
+ Set<URL> sortedDeploymentKeys = new TreeSet<URL>(new URLComparator());
+ sortedDeploymentKeys.addAll(deployments.keySet());
+ for (Iterator<URL> i = sortedDeploymentKeys.iterator(); i.hasNext();)
{
URL url = (URL)i.next();
- for (Iterator j = deployments.iterator(url); j.hasNext();)
+ for (Iterator<DeploymentContext> j = deployments.iterator(url); j.hasNext();)
{
DeploymentContext ctx = (DeploymentContext)j.next();
ctx.start();
@@ -215,10 +224,13 @@
public void stop() throws DeploymentException
{
- for (Iterator i = deployments.keySet().iterator(); i.hasNext();)
+ // @syllant-patch@ : patch to sort -object.xml files
+ Set<URL> sortedDeploymentKeys = new TreeSet<URL>(new OppositeURLComparator());
+ sortedDeploymentKeys.addAll(deployments.keySet());
+ for (Iterator<URL> i = sortedDeploymentKeys.iterator(); i.hasNext();)
{
URL url = (URL)i.next();
- for (Iterator j = deployments.iterator(url); j.hasNext();)
+ for (Iterator<DeploymentContext> j = deployments.iterator(url); j.hasNext();)
{
DeploymentContext ctx = (DeploymentContext)j.next();
ctx.stop();
@@ -228,14 +240,34 @@
public void destroy() throws DeploymentException
{
- for (Iterator i = deployments.keySet().iterator(); i.hasNext();)
+ // @syllant-patch@ : patch to sort -object.xml files
+ Set<URL> sortedDeploymentKeys = new TreeSet<URL>(new OppositeURLComparator());
+ sortedDeploymentKeys.addAll(deployments.keySet());
+ for (Iterator<URL> i = sortedDeploymentKeys.iterator(); i.hasNext();)
{
URL url = (URL)i.next();
- for (Iterator j = deployments.iterator(url); j.hasNext();)
+ for (Iterator<DeploymentContext> j = deployments.iterator(url); j.hasNext();)
{
DeploymentContext ctx = (DeploymentContext)j.next();
ctx.destroy();
}
}
}
+
+ // @syllant-patch@ : patch to sort -object.xml files
+ private class URLComparator implements Comparator<URL>
+ {
+ public int compare(URL o1, URL o2)
+ {
+ return o1.getPath().compareTo(o2.getPath());
+ }
+ }
+
+ private class OppositeURLComparator implements Comparator<URL>
+ {
+ public int compare(URL o1, URL o2)
+ {
+ return - o1.getPath().compareTo(o2.getPath());
+ }
+ }
}
15 years, 11 months
JBoss Portal SVN: r11550 - in tags/JBoss_Portal_2_6_6/wsrp/src/main/org/jboss/portal: wsrp/producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-23 03:14:59 -0400 (Wed, 23 Jul 2008)
New Revision: 11550
Modified:
tags/JBoss_Portal_2_6_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
tags/JBoss_Portal_2_6_6/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
Log:
- Found an issue with V1ProducerBaseTest.configureRegistrationSettings which was not configuring registration settings properly.
This resulted in incorrect tests and not properly handling the case where registration was required to access the full service
description.
Modified: tags/JBoss_Portal_2_6_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- tags/JBoss_Portal_2_6_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-22 23:59:40 UTC (rev 11549)
+++ tags/JBoss_Portal_2_6_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-23 07:14:59 UTC (rev 11550)
@@ -168,7 +168,7 @@
{
// define expected registration infos
producer.getProducerRegistrationRequirements().setRegistrationRequired(requiresRegistration);
- producer.getProducerRegistrationRequirements().setRegistrationRequiredForFullDescription(provideUnregisteredFullDescription);
+ producer.getProducerRegistrationRequirements().setRegistrationRequiredForFullDescription(!provideUnregisteredFullDescription);
if (requiresRegistration)
{
Modified: tags/JBoss_Portal_2_6_6/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- tags/JBoss_Portal_2_6_6/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2008-07-22 23:59:40 UTC (rev 11549)
+++ tags/JBoss_Portal_2_6_6/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2008-07-23 07:14:59 UTC (rev 11550)
@@ -97,7 +97,7 @@
{
log.debug("Unregistered consumer while registration is required. Sending registration information.");
- if (requirements.isRegistrationRequiredForFullDescription())
+ if (!requirements.isRegistrationRequiredForFullDescription())
{
log.debug("Sending offered portlets description despite not being registered, per Producer configuration.");
offeredPortlets = getPortletDescriptions(gs.getDesiredLocales(), null);
15 years, 11 months
JBoss Portal SVN: r11549 - in branches/JBoss_Portal_Branch_2_7: core/src/main/org/jboss/portal/core/impl/api/node and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-22 19:59:40 -0400 (Tue, 22 Jul 2008)
New Revision: 11549
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/PageURL.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/WindowURL.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java
Log:
- rework samples to better reflect use cases (still need to redo the fallback case, but going to bed)
- initial implementation for integration with page urls
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-07-22 23:59:40 UTC (rev 11549)
@@ -351,32 +351,28 @@
}
else
{
-
String[] parameterValue = getPublicNavigationalState(parameterInfo.getName());
-
// Explicit binding
String[] explicitParameterValue = null;
// Check all bindings for this window/qname pair
Collection<String> bindings = getCoordinationManager().getBindingNames(getWindow(windowName), parameterInfo.getName());
-
// If this window/qname is binded several times with different updated params value will be unpredictable...
for (String binding : bindings)
{
explicitParameterValue = getPublicNavigationalState(new QName(PageNavigationalState.NAMESPACE_EXPLICIT, binding));
}
-
- CoordinationStrategy strategy = getCoordinationManager().resolveBindingStrategy(getWindow(windowName).getPage());
-
+ //
String parameterId = parameterInfo.getId();
+ //
+ CoordinationStrategy strategy = getCoordinationManager().resolveBindingStrategy(getWindow(windowName).getPage());
if (strategy.equals(CoordinationStrategy.EXPLICIT) ||
(strategy.equals(CoordinationStrategy.FALLBACK) && explicitParameterValue != null))
{
- //
// We clone the value here so we keep the internal state not potentially changed
if (explicitParameterValue != null)
{
@@ -384,18 +380,13 @@
}
else
{
- //If it is EXPLICIT strategy check if this is not window publishing the param
-
+ //If it is EXPLICIT strategy check if this is not window publishing the param
}
}
- else
+ else if (parameterValue != null)
{
- //
- if (parameterValue != null)
- {
- // We clone the value here so we keep the internal state not potentially changed
- publicNavigationalState.put(parameterId, parameterValue.clone());
- }
+ // We clone the value here so we keep the internal state not potentially changed
+ publicNavigationalState.put(parameterId, parameterValue.clone());
}
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java 2008-07-22 23:59:40 UTC (rev 11549)
@@ -27,7 +27,10 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.common.util.ParameterMap;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -42,7 +45,7 @@
protected ControllerContext controllerContext;
/** . */
- protected ParametersStateString parameters;
+ protected Map<String, String[]> parameters;
/** . */
protected Boolean wantSecure;
@@ -61,17 +64,20 @@
this.id = id;
this.controllerContext = controllerContext;
this.relative = true;
- this.parameters = ParametersStateString.create();
}
public void setParameter(String name, String value)
{
- parameters.setValue(name, value);
+ setParameter(name, new String[]{value});
}
public void setParameter(String name, String[] values)
{
- parameters.setValues(name, values);
+ if (parameters == null)
+ {
+ parameters = new ParameterMap();
+ }
+ parameters.put(name, values);
}
public void setAuthenticated(Boolean authenticated)
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/PageURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/PageURL.java 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/PageURL.java 2008-07-22 23:59:40 UTC (rev 11549)
@@ -28,6 +28,9 @@
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
+import java.util.Map;
+import java.util.Collections;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -35,6 +38,9 @@
public class PageURL extends AbstractPortalNodeURL
{
+ /** . */
+ private static final Map<String, String[]> EMPTY_PARAMETERS = Collections.emptyMap();
+
public PageURL(PortalObjectId id, ControllerContext controllerContext)
{
super(id, controllerContext);
@@ -42,7 +48,8 @@
public String toString()
{
- ViewPageCommand cmd = new ViewPageCommand(id);
+ Map<String, String[]> parameters = this.parameters != null ? this.parameters : EMPTY_PARAMETERS;
+ ViewPageCommand cmd = new ViewPageCommand(id, parameters);
URLContext urlContext = getURLContext();
return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/WindowURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/WindowURL.java 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/api/node/WindowURL.java 2008-07-22 23:59:40 UTC (rev 11549)
@@ -27,6 +27,7 @@
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.portlet.ParametersStateString;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -42,7 +43,8 @@
public String toString()
{
- InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(id, null, null, parameters);
+ ParametersStateString stateString = parameters != null ? ParametersStateString.create(parameters) : null;
+ InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(id, null, null, stateString);
URLContext urlContext = getURLContext();
return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2008-07-22 23:59:40 UTC (rev 11549)
@@ -88,6 +88,7 @@
PortletRequestDecoder decoder = new PortletRequestDecoder();
decoder.decode(queryParams, invocation.getServerContext().getBodyParameterMap());
+ //
if (decoder.getType() == PortletRequestDecoder.RESOURCE_TYPE)
{
cmd = new InvokePortletWindowResourceCommand(
@@ -166,7 +167,7 @@
}
else
{
- cmd = new ViewPageCommand(id);
+ cmd = new ViewPageCommand(id, queryParams);
}
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2008-07-22 23:59:40 UTC (rev 11549)
@@ -30,7 +30,6 @@
import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
import org.jboss.portal.core.model.portal.command.action.ImportPageToDashboardCommand;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
-import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.action.InvokeWindowCommand;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowCommand;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowResourceCommand;
@@ -44,6 +43,8 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -129,7 +130,9 @@
// Customize further more
if (cmd instanceof ViewPageCommand)
{
- // Nothing for now, we let the statement just to show that it handles page rendering commands
+ ViewPageCommand vpCmd = (ViewPageCommand)cmd;
+ Map<String, String[]> parameters = vpCmd.getParameters();
+ url.getParameterMap().putAll(parameters);
}
else if (cmd instanceof ViewPortalCommand)
{
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java 2008-07-22 23:59:40 UTC (rev 11549)
@@ -72,6 +72,7 @@
//
PortletWindowNavigationalState windowNS = pageNS.getPortletWindowNavigationalState(window.getName());
+ //
PortletInfo portletInfo = cpcc.getPortletInfo(window.getName());
//
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPageCommand.java 2008-07-22 23:59:40 UTC (rev 11549)
@@ -24,13 +24,22 @@
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.ControllerCommand;
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.Page;
import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.navstate.PageNavigationalState;
import org.jboss.portal.core.model.portal.command.PageCommand;
import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
+import org.jboss.portal.core.navstate.NavigationalStateContext;
+import org.jboss.portal.common.util.ParameterMap;
+import javax.xml.namespace.QName;
+import java.util.Map;
+import java.util.Collections;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -41,11 +50,31 @@
/** . */
private static final CommandInfo info = new ViewCommandInfo();
- public ViewPageCommand(PortalObjectId pageId)
+ /** . */
+ private static final Map<String,String[]> EMPTY_PARAMETERS = Collections.emptyMap();
+
+ /** . */
+ private Map<String, String[]> parameters;
+
+ public ViewPageCommand(PortalObjectId pageId, Map<String, String[]> parameters)
{
super(pageId);
+
+ //
+ if (parameters == null)
+ {
+ throw new IllegalArgumentException("No null parameters accepted");
+ }
+
+ //
+ this.parameters = parameters;
}
+ public ViewPageCommand(PortalObjectId pageId)
+ {
+ this(pageId, EMPTY_PARAMETERS);
+ }
+
protected Page initPage()
{
return (Page)getTarget();
@@ -56,8 +85,43 @@
return info;
}
+ public Map<String, String[]> getParameters()
+ {
+ return parameters;
+ }
+
public ControllerResponse execute() throws ControllerException
{
+ if (parameters.size() > 0)
+ {
+ NavigationalStateContext nsContext = (NavigationalStateContext)context.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
+
+ //
+ String pageId = getPage().getId().toString();
+
+ //
+ PageNavigationalState previousPNS = nsContext.getPageNavigationalState(pageId);
+
+ //
+ Map<QName, String[]> state = new HashMap<QName, String[]>();
+
+ // Clone the previous state if needed
+ if (previousPNS != null)
+ {
+ state.putAll(previousPNS.getParameters());
+ }
+
+ //
+ for (Map.Entry<String, String[]> entry : parameters.entrySet())
+ {
+ state.put(new QName(PageNavigationalState.NAMESPACE_EXPLICIT, entry.getKey()), entry.getValue());
+ }
+
+ //
+ nsContext.setPageNavigationalState(pageId, new PageNavigationalState(state));
+ }
+
+ //
return new UpdatePageResponse(page.getId());
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java 2008-07-22 23:59:40 UTC (rev 11549)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.model.portal.navstate;
import javax.xml.namespace.QName;
+import javax.xml.XMLConstants;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@@ -36,7 +37,8 @@
public class PageNavigationalState implements Serializable
{
- public static final String NAMESPACE_EXPLICIT = "org.jboss.portal.core.model.portal.navstate.PageNavigationalState.EXPLICIT";
+ /** . */
+ public static final String NAMESPACE_EXPLICIT = XMLConstants.NULL_NS_URI; // "urn:jboss:portal:coordination:explicit";
/** . */
private final HashMap<QName, String[]> parameters;
@@ -55,5 +57,4 @@
{
return Collections.unmodifiableMap(parameters);
}
-
}
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml 2008-07-22 23:59:40 UTC (rev 11549)
@@ -283,112 +283,86 @@
</page>
<page>
+
+ <!--
+ | In this sample we show that
+ | - no implicit coordination occur if we do not declare it
+ | - different namespace can be bound
+ -->
+
<page-name>Parameters EXPLICIT</page-name>
<window>
- <window-name>PublicParametersPortletWindowA1</window-name>
+ <window-name>PublicParametersPortletWindow1</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>
<region>left</region>
<height>0</height>
</window>
<window>
- <window-name>PublicParametersPortletWindowA2</window-name>
+ <window-name>PublicParametersPortletWindow2</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>
- <region>left</region>
- <height>1</height>
+ <region>center</region>
+ <height>0</height>
</window>
-
<window>
- <window-name>PublicParametersPortletWindowB1</window-name>
+ <window-name>PublicParametersPortletWindow3</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance2</instance-ref>
- <region>center</region>
- <height>0</height>
+ <region>left</region>
+ <height>1</height>
</window>
<window>
- <window-name>PublicParametersPortletWindowB2</window-name>
+ <window-name>PublicParametersPortletWindow4</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance2</instance-ref>
<region>center</region>
<height>1</height>
</window>
-
-
<coordination>
<parameter-strategy>EXPLICIT</parameter-strategy>
<bindings>
+
+ <!-- Same foo qname among 3 windows -->
<parameter-binding>
<name>binding1</name>
<window-coordination>
- <window-name>PublicParametersPortletWindowA1</window-name>
- <qname>foo1</qname>
+ <window-name>PublicParametersPortletWindow1</window-name>
+ <qname>foo</qname>
</window-coordination>
<window-coordination>
- <window-name>PublicParametersPortletWindowB2</window-name>
- <qname>foo2</qname>
+ <window-name>PublicParametersPortletWindow2</window-name>
+ <qname>foo</qname>
</window-coordination>
- </parameter-binding>
- <parameter-binding>
- <name>binding2</name>
<window-coordination>
- <window-name>PublicParametersPortletWindowA1</window-name>
- <qname>bar1</qname>
+ <window-name>PublicParametersPortletWindow3</window-name>
+ <qname>foo</qname>
</window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB2</window-name>
- <qname>bar2</qname>
- </window-coordination>
</parameter-binding>
- <parameter-binding>
- <name>binding3</name>
- <window-coordination>
- <window-name>PublicParametersPortletWindowA1</window-name>
- <qname>juu1</qname>
- </window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB2</window-name>
- <qname>juu2</qname>
- </window-coordination>
- </parameter-binding>
-
+ <!-- Bind different namespaces -->
<parameter-binding>
- <name>binding4</name>
+ <name>binding2</name>
<window-coordination>
- <window-name>PublicParametersPortletWindowA2</window-name>
- <qname>foo1</qname>
+ <window-name>PublicParametersPortletWindow1</window-name>
+ <qname>bar1</qname>
</window-coordination>
<window-coordination>
- <window-name>PublicParametersPortletWindowB1</window-name>
- <qname>foo2</qname>
+ <window-name>PublicParametersPortletWindow2</window-name>
+ <qname>{urn:jboss:portal:samples:daa1}daa1</qname>
</window-coordination>
- </parameter-binding>
- <parameter-binding>
- <name>binding5</name>
<window-coordination>
- <window-name>PublicParametersPortletWindowA2</window-name>
- <qname>bar1</qname>
- </window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB1</window-name>
+ <window-name>PublicParametersPortletWindow3</window-name>
<qname>bar2</qname>
</window-coordination>
- </parameter-binding>
- <parameter-binding>
- <name>binding6</name>
<window-coordination>
- <window-name>PublicParametersPortletWindowA2</window-name>
- <qname>juu1</qname>
+ <window-name>PublicParametersPortletWindow4</window-name>
+ <qname>{urn:jboss:portal:samples:daa2}daa2</qname>
</window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB1</window-name>
- <qname>juu2</qname>
- </window-coordination>
</parameter-binding>
-
-
+
</bindings>
-
</coordination>
</page>
+
+<!--
<page>
<page-name>Parameters FALLBACK</page-name>
<window>
@@ -417,8 +391,6 @@
<height>1</height>
</window>
-
-
<coordination>
<parameter-strategy>FALLBACK</parameter-strategy>
<bindings>
@@ -456,118 +428,48 @@
</window-coordination>
</parameter-binding>
</bindings>
-
</coordination>
</page>
+-->
+
<page>
+
+ <!--
+ | In this sample we show that
+ | - implicit coordination occurs if parameter matches
+ | - no other kind of coordination occurs
+ -->
+
<page-name>Parameters IMPLICIT</page-name>
<window>
- <window-name>PublicParametersPortletWindowA1</window-name>
+ <window-name>PublicParametersPortletWindow1</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>
<region>left</region>
<height>0</height>
</window>
<window>
- <window-name>PublicParametersPortletWindowA2</window-name>
+ <window-name>PublicParametersPortletWindow2</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>
- <region>left</region>
- <height>1</height>
+ <region>center</region>
+ <height>0</height>
</window>
-
<window>
- <window-name>PublicParametersPortletWindowB1</window-name>
+ <window-name>PublicParametersPortletWindow3</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance2</instance-ref>
- <region>center</region>
- <height>0</height>
+ <region>left</region>
+ <height>1</height>
</window>
<window>
- <window-name>PublicParametersPortletWindowB2</window-name>
+ <window-name>PublicParametersPortletWindow4</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance2</instance-ref>
<region>center</region>
<height>1</height>
</window>
-
-
<coordination>
<parameter-strategy>IMPLICIT</parameter-strategy>
- <bindings>
- <parameter-binding>
- <name>binding1</name>
- <window-coordination>
- <window-name>PublicParametersPortletWindowA1</window-name>
- <qname>foo1</qname>
- </window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB2</window-name>
- <qname>foo2</qname>
- </window-coordination>
- </parameter-binding>
- <parameter-binding>
- <name>binding2</name>
- <window-coordination>
- <window-name>PublicParametersPortletWindowA1</window-name>
- <qname>bar1</qname>
- </window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB2</window-name>
- <qname>bar2</qname>
- </window-coordination>
- </parameter-binding>
- <parameter-binding>
- <name>binding3</name>
- <window-coordination>
- <window-name>PublicParametersPortletWindowA1</window-name>
- <qname>juu1</qname>
- </window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB2</window-name>
- <qname>juu2</qname>
- </window-coordination>
- </parameter-binding>
-
-
- <parameter-binding>
- <name>binding4</name>
- <window-coordination>
- <window-name>PublicParametersPortletWindowA2</window-name>
- <qname>foo1</qname>
- </window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB1</window-name>
- <qname>foo2</qname>
- </window-coordination>
- </parameter-binding>
- <parameter-binding>
- <name>binding5</name>
- <window-coordination>
- <window-name>PublicParametersPortletWindowA2</window-name>
- <qname>bar1</qname>
- </window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB1</window-name>
- <qname>bar2</qname>
- </window-coordination>
- </parameter-binding>
- <parameter-binding>
- <name>binding6</name>
- <window-coordination>
- <window-name>PublicParametersPortletWindowA2</window-name>
- <qname>juu1</qname>
- </window-coordination>
- <window-coordination>
- <window-name>PublicParametersPortletWindowB1</window-name>
- <qname>juu2</qname>
- </window-coordination>
- </parameter-binding>
-
-
- </bindings>
-
</coordination>
</page>
-
-
</page>
</deployment>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet.xml 2008-07-22 23:39:47 UTC (rev 11548)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet.xml 2008-07-22 23:59:40 UTC (rev 11549)
@@ -41,7 +41,7 @@
<supported-public-render-parameter>foo1</supported-public-render-parameter>
<supported-public-render-parameter>bar1</supported-public-render-parameter>
<supported-public-render-parameter>juu1</supported-public-render-parameter>
-
+ <supported-public-render-parameter>daa1</supported-public-render-parameter>
</portlet>
<portlet>
@@ -59,9 +59,9 @@
<supported-public-render-parameter>foo2</supported-public-render-parameter>
<supported-public-render-parameter>bar2</supported-public-render-parameter>
<supported-public-render-parameter>juu2</supported-public-render-parameter>
+ <supported-public-render-parameter>daa2</supported-public-render-parameter>
</portlet>
-
<portlet>
<description>Shopping Catalog Portlet</description>
<portlet-name>CoordinationShoppingCatalog</portlet-name>
@@ -103,8 +103,10 @@
<value-type>org.jboss.portal.portlet.samples.shoppingcart.CartEvent</value-type>
</event-definition>
+ <!-- Public render parameter definitions -->
+
<public-render-parameter>
- <name>foo1</name>
+ <name>foo</name>
<identifier>foo1</identifier>
</public-render-parameter>
@@ -112,13 +114,19 @@
<name>bar1</name>
<identifier>bar1</identifier>
</public-render-parameter>
-
+
<public-render-parameter>
- <name>juu1</name>
+ <qname xmlns:juu="urn:jboss:portal:samples:juu">juu:juu</qname>
<identifier>juu1</identifier>
</public-render-parameter>
+
<public-render-parameter>
- <name>foo2</name>
+ <qname xmlns:daa1="urn:jboss:portal:samples:daa1">daa1:daa1</qname>
+ <identifier>daa1</identifier>
+ </public-render-parameter>
+
+ <public-render-parameter>
+ <name>foo</name>
<identifier>foo2</identifier>
</public-render-parameter>
@@ -128,8 +136,13 @@
</public-render-parameter>
<public-render-parameter>
- <name>juu2</name>
+ <qname xmlns:juu="urn:jboss:portal:samples:juu">juu:juu</qname>
<identifier>juu2</identifier>
</public-render-parameter>
+ <public-render-parameter>
+ <qname xmlns:daa2="urn:jboss:portal:samples:daa2">daa2:daa2</qname>
+ <identifier>daa2</identifier>
+ </public-render-parameter>
+
</portlet-app>
15 years, 11 months
JBoss Portal SVN: r11548 - in branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal: wsrp/producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-22 19:39:47 -0400 (Tue, 22 Jul 2008)
New Revision: 11548
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
Log:
- Found an issue with V1ProducerBaseTest.configureRegistrationSettings which was not configuring registration settings properly.
This resulted in incorrect tests and not properly handling the case where registration was required to access the full service
description.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-22 23:36:14 UTC (rev 11547)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-22 23:39:47 UTC (rev 11548)
@@ -168,7 +168,7 @@
{
// define expected registration infos
producer.getProducerRegistrationRequirements().setRegistrationRequired(requiresRegistration);
- producer.getProducerRegistrationRequirements().setRegistrationRequiredForFullDescription(provideUnregisteredFullDescription);
+ producer.getProducerRegistrationRequirements().setRegistrationRequiredForFullDescription(!provideUnregisteredFullDescription);
if (requiresRegistration)
{
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2008-07-22 23:36:14 UTC (rev 11547)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2008-07-22 23:39:47 UTC (rev 11548)
@@ -97,7 +97,7 @@
{
log.debug("Unregistered consumer while registration is required. Sending registration information.");
- if (requirements.isRegistrationRequiredForFullDescription())
+ if (!requirements.isRegistrationRequiredForFullDescription())
{
log.debug("Sending offered portlets description despite not being registered, per Producer configuration.");
offeredPortlets = getPortletDescriptions(gs.getDesiredLocales(), null);
15 years, 11 months
JBoss Portal SVN: r11547 - in branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal: wsrp/producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-22 19:36:14 -0400 (Tue, 22 Jul 2008)
New Revision: 11547
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
Log:
- JBPORTAL-2068:
+ Should now properly throw InvalidRegistrationFault when registration is required and none is provided.
+ Note that this doesn't affect getServiceDescription.
+ Added test cases.
- Found an issue with V1ProducerBaseTest.configureRegistrationSettings which was not configuring registration settings properly.
This resulted in incorrect tests and not properly handling the case where registration was required to access the full service
description.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2008-07-22 18:02:07 UTC (rev 11546)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2008-07-22 23:36:14 UTC (rev 11547)
@@ -32,6 +32,7 @@
import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
import org.jboss.portal.wsrp.core.CacheControl;
import org.jboss.portal.wsrp.core.GetMarkup;
+import org.jboss.portal.wsrp.core.InitCookie;
import org.jboss.portal.wsrp.core.InteractionParams;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.MarkupContext;
@@ -621,6 +622,66 @@
}
}
+ public void testGetMarkupNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ GetMarkup gm = createMarkupRequest();
+ try
+ {
+ markupService.getMarkup(gm);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault!");
+ }
+ catch (InvalidRegistrationFault invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ public void testPerformBlockingInteractionNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ PerformBlockingInteraction pbi = WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ try
+ {
+ markupService.performBlockingInteraction(pbi);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault!");
+ }
+ catch (InvalidRegistrationFault invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ public void testInitCookieNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ InitCookie initCookie = WSRPTypeFactory.createInitCookie(null);
+ try
+ {
+ markupService.initCookie(initCookie);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault!");
+ }
+ catch (InvalidRegistrationFault invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
private String checkPBIAndGetNavigationalState(String symbol) throws Exception
{
PerformBlockingInteraction performBlockingInteraction =
@@ -691,4 +752,4 @@
{
return DEFAULT_MARKUP_PORTLET_WAR;
}
-}
\ No newline at end of file
+}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java 2008-07-22 18:02:07 UTC (rev 11546)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java 2008-07-22 23:36:14 UTC (rev 11547)
@@ -56,20 +56,20 @@
public NeedPortletHandleTest(String portletWARFileName)
- throws Exception
+ throws Exception
{
this("NeedPortletHandleTest", portletWARFileName);
this.mostUsedPortletWARFileName = portletWARFileName;
}
protected NeedPortletHandleTest(String name, String portletWARFileName)
- throws Exception
+ throws Exception
{
super(name);
this.mostUsedPortletWARFileName = portletWARFileName;
}
- protected String getDefaultHandle() throws RemoteException, InvalidRegistrationFault, OperationFailedFault
+ protected String getDefaultHandle()
{
return getFirstHandleFor(mostUsedPortletWARFileName);
}
@@ -84,7 +84,7 @@
return war2Handles.get(archiveName).get(0);
}
- protected String getHandleForCurrentlyDeployedArchive() throws RemoteException, InvalidRegistrationFault, OperationFailedFault
+ protected String getHandleForCurrentlyDeployedArchive()
{
return getFirstHandleFor(currentlyDeployedArchiveName);
}
@@ -234,7 +234,7 @@
}
protected void checkSessionForCurrentlyDeployedPortlet(MarkupResponse response)
- throws RemoteException, InvalidRegistrationFault, OperationFailedFault
+ throws RemoteException, InvalidRegistrationFault, OperationFailedFault
{
// We don't send any portlet session information, just user cookies... The producer takes care of the details
// What this means, though is that we don't have access to individual portlet session ids... so we can only
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java 2008-07-22 18:02:07 UTC (rev 11546)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java 2008-07-22 23:36:14 UTC (rev 11547)
@@ -35,6 +35,7 @@
import org.jboss.portal.wsrp.core.GetPortletPropertyDescription;
import org.jboss.portal.wsrp.core.GetServiceDescription;
import org.jboss.portal.wsrp.core.InconsistentParametersFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.ModelDescription;
import org.jboss.portal.wsrp.core.PortletContext;
import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
@@ -56,8 +57,7 @@
{
private static final String TEST_BASIC_PORTLET_WAR = "test-basic-portlet.war";
- public PortletManagementTestCase()
- throws Exception
+ public PortletManagementTestCase() throws Exception
{
super("PortletManagementTestCase", TEST_BASIC_PORTLET_WAR);
}
@@ -83,6 +83,28 @@
checkServiceDescriptionWithOnlyBasicPortlet(gs);
}
+ public void testClonePortletNoRegistrationWhenRequired()
+ {
+ producer.getProducerRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ ClonePortlet clonePortlet = WSRPTypeFactory.createSimpleClonePortlet(handle);
+
+ try
+ {
+ portletManagementService.clonePortlet(clonePortlet);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (InvalidRegistrationFault invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
public void testDestroyPortlets() throws Exception
{
// first try to destroy POP, should fail
@@ -107,12 +129,26 @@
ExtendedAssert.assertNull(failures);
}
- private PortletContext clonePortlet(String handle)
- throws org.jboss.portal.wsrp.core.InvalidUserCategoryFault, org.jboss.portal.wsrp.core.AccessDeniedFault, org.jboss.portal.wsrp.core.OperationFailedFault, org.jboss.portal.wsrp.core.InvalidHandleFault, org.jboss.portal.wsrp.core.InvalidRegistrationFault, org.jboss.portal.wsrp.core.InconsistentParametersFault, org.jboss.portal.wsrp.core.MissingParametersFault, java.rmi.RemoteException
+ public void testDestroyPortletsNoRegistrationWhenRequired()
{
- ClonePortlet clonePortlet = WSRPTypeFactory.createSimpleClonePortlet(handle);
- PortletContext portletContext = portletManagementService.clonePortlet(clonePortlet);
- return portletContext;
+ producer.getProducerRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ DestroyPortlets dp = WSRPTypeFactory.createDestroyPortlets(null, new String[]{handle});
+
+ try
+ {
+ portletManagementService.destroyPortlets(dp);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (InvalidRegistrationFault invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
}
public void testGetPortletDescription() throws Exception
@@ -126,6 +162,28 @@
checkBasicPortletDescription(response.getPortletDescription(), handle);
}
+ public void testGetPortletDescriptionNoRegistrationWhenRequired()
+ {
+ producer.getProducerRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ GetPortletDescription gpd = WSRPTypeFactory.createGetPortletDescription(null, handle);
+
+ try
+ {
+ portletManagementService.getPortletDescription(gpd);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (InvalidRegistrationFault invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
public void testGetPortletPropertiesNoRegistration() throws Exception
{
String handle = getDefaultHandle();
@@ -135,8 +193,8 @@
PropertyList response = portletManagementService.getPortletProperties(getPortletProperties);
Property[] expected = new Property[]{
- WSRPTypeFactory.createProperty("prefName1", "en", "prefValue1"),
- WSRPTypeFactory.createProperty("prefName2", "en", "prefValue2")
+ WSRPTypeFactory.createProperty("prefName1", "en", "prefValue1"),
+ WSRPTypeFactory.createProperty("prefName2", "en", "prefValue2")
};
checkGetPropertiesResponse(response, expected);
@@ -173,6 +231,28 @@
checkPropertyDescriptions(expected, propertyDescriptions);
}
+ public void testGetPortletPropertiesNoRegistrationWhenRequired()
+ {
+ producer.getProducerRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ GetPortletPropertyDescription getPortletPropertyDescription = WSRPTypeFactory.createSimpleGetPortletPropertyDescription(handle);
+
+ try
+ {
+ portletManagementService.getPortletPropertyDescription(getPortletPropertyDescription);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (InvalidRegistrationFault invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
public void testSetPortletProperties() throws Exception
{
String handle = getDefaultHandle();
@@ -180,8 +260,8 @@
PortletContext portletContext = clonePortlet(handle);
PropertyList propertyList = WSRPTypeFactory.createPropertyList();
Property[] properties = new Property[]{
- WSRPTypeFactory.createProperty("prefName1", "en", "newPrefValue1"),
- WSRPTypeFactory.createProperty("prefName2", "en", "newPrefValue2")
+ WSRPTypeFactory.createProperty("prefName1", "en", "newPrefValue1"),
+ WSRPTypeFactory.createProperty("prefName2", "en", "newPrefValue2")
};
propertyList.setProperties(properties);
SetPortletProperties setPortletProperties = WSRPTypeFactory.createSetPortletProperties(null, portletContext, propertyList);
@@ -203,6 +283,42 @@
}
}
+ public void testSetPortletPropertiesNoRegistrationWhenRequired()
+ {
+ producer.getProducerRegistrationRequirements().setRegistrationRequired(true);
+
+ PropertyList propertyList = WSRPTypeFactory.createPropertyList();
+ Property[] properties = new Property[]{
+ WSRPTypeFactory.createProperty("prefName1", "en", "newPrefValue1"),
+ WSRPTypeFactory.createProperty("prefName2", "en", "newPrefValue2")
+ };
+ propertyList.setProperties(properties);
+ SetPortletProperties setPortletProperties = WSRPTypeFactory.createSetPortletProperties(null,
+ WSRPTypeFactory.createPortletContext(getDefaultHandle()), propertyList);
+
+ try
+ {
+ portletManagementService.setPortletProperties(setPortletProperties);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (InvalidRegistrationFault invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ private PortletContext clonePortlet(String handle)
+ throws org.jboss.portal.wsrp.core.InvalidUserCategoryFault, org.jboss.portal.wsrp.core.AccessDeniedFault, org.jboss.portal.wsrp.core.OperationFailedFault, org.jboss.portal.wsrp.core.InvalidHandleFault, org.jboss.portal.wsrp.core.InvalidRegistrationFault, org.jboss.portal.wsrp.core.InconsistentParametersFault, org.jboss.portal.wsrp.core.MissingParametersFault, java.rmi.RemoteException
+ {
+ ClonePortlet clonePortlet = WSRPTypeFactory.createSimpleClonePortlet(handle);
+ PortletContext portletContext = portletManagementService.clonePortlet(clonePortlet);
+ return portletContext;
+ }
+
private Property[] checkGetPropertiesResponse(PropertyList response, Property[] expected)
{
ExtendedAssert.assertNotNull(response);
@@ -286,7 +402,7 @@
public String toString()
{
return new StringBuffer().append("Property: ").append(prop.getName()).append("=")
- .append(prop.getStringValue()).append(" (").append(prop.getLang()).append(")").toString();
+ .append(prop.getStringValue()).append(" (").append(prop.getLang()).append(")").toString();
}
}
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2008-07-22 18:02:07 UTC (rev 11546)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2008-07-22 23:36:14 UTC (rev 11547)
@@ -144,7 +144,7 @@
// now modify Producer's set of required registration info
String newPropName = "New Prop";
RegistrationPropertyDescription regProp = new RegistrationPropertyDescription(newPropName,
- new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+ new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
regProp.setDefaultLabel("New Registration Property");
producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
@@ -184,7 +184,7 @@
// remove registration context, try again and check that we get new registration info
gs.setRegistrationContext(null);
PropertyDescription[] pds = serviceDescriptionService.getServiceDescription(gs)
- .getRegistrationPropertyDescription().getPropertyDescriptions();
+ .getRegistrationPropertyDescription().getPropertyDescriptions();
ExtendedAssert.assertEquals(2, pds.length);
assertEquals(WSRPUtils.convertToPropertyDescription(regProp), pds[1]);
@@ -211,7 +211,7 @@
// now modify Producer's set of required registration info
String newPropName = "New Prop";
RegistrationPropertyDescription regProp = new RegistrationPropertyDescription(newPropName,
- new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+ new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
regProp.setDefaultLabel("New Registration Property");
producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
@@ -286,4 +286,42 @@
// expected
}
}
+
+ public void testModifyRegistrationNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ try
+ {
+ registrationService.modifyRegistration(null);
+ ExtendedAssert.fail("Shouldn't be possible to modify registration if no registration is required.");
+ }
+ catch (OperationFailedFault operationFailedFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ public void testDeregisterNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ try
+ {
+ registrationService.deregister(null);
+ ExtendedAssert.fail("Shouldn't be possible to modify registration if no registration is required.");
+ }
+ catch (OperationFailedFault operationFailedFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java 2008-07-22 18:02:07 UTC (rev 11546)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java 2008-07-22 23:36:14 UTC (rev 11547)
@@ -47,13 +47,12 @@
*/
public class ServiceDescriptionTestCase extends V1ProducerBaseTest
{
- public ServiceDescriptionTestCase()
- throws Exception
+ public ServiceDescriptionTestCase() throws Exception
{
super("ServiceDescriptionTestCase");
}
- public void testGetServiceDescriptionNotRequiringRegistration() throws Throwable
+ public void testNotRequiringRegistration() throws Throwable
{
producer.getProducerRegistrationRequirements().setRegistrationRequired(false);
@@ -68,7 +67,7 @@
ExtendedAssert.assertNull(sd.getRegistrationPropertyDescription());
}
- public void testGetServiceDescriptionRequiringRegistrationNoOfferedPortlets() throws Throwable
+ public void testRequiringRegistrationNotProvidingPortlets() throws Throwable
{
RegistrationPropertyDescription regProp = configureRegistrationSettings(true, false);
@@ -87,8 +86,7 @@
ExtendedAssert.assertNull(sd.getOfferedPortlets());
}
-
- public void testGetServiceDescriptionRequiringRegistrationOfferedPortlets() throws Throwable
+ public void testRequiringRegistrationProvidingPortlets() throws Throwable
{
RegistrationPropertyDescription regProp = configureRegistrationSettings(true, true);
@@ -104,18 +102,8 @@
checkRequiredRegistrationProperties(sd, regProp);
}
- private void checkRequiredRegistrationProperties(ServiceDescription sd, RegistrationPropertyDescription regProp)
+ public void testLiveDeployment() throws Throwable
{
- ModelDescription registrationPropertyDescription = sd.getRegistrationPropertyDescription();
- ExtendedAssert.assertNotNull(registrationPropertyDescription);
- PropertyDescription[] propertyDescriptions = registrationPropertyDescription.getPropertyDescriptions();
- ExtendedAssert.assertNotNull(propertyDescriptions);
- ExtendedAssert.assertEquals(1, propertyDescriptions.length);
- assertEquals(WSRPUtils.convertToPropertyDescription(regProp), propertyDescriptions[0]);
- }
-
- public void testGetServiceDescriptionLiveDeployment() throws Throwable
- {
try
{
GetServiceDescription gsd = getNoRegistrationServiceDescriptionRequest();
@@ -150,4 +138,14 @@
undeploy("test-session-portlet.war");
}
}
+
+ private void checkRequiredRegistrationProperties(ServiceDescription sd, RegistrationPropertyDescription regProp)
+ {
+ ModelDescription registrationPropertyDescription = sd.getRegistrationPropertyDescription();
+ ExtendedAssert.assertNotNull(registrationPropertyDescription);
+ PropertyDescription[] propertyDescriptions = registrationPropertyDescription.getPropertyDescriptions();
+ ExtendedAssert.assertNotNull(propertyDescriptions);
+ ExtendedAssert.assertEquals(1, propertyDescriptions.length);
+ assertEquals(WSRPUtils.convertToPropertyDescription(regProp), propertyDescriptions[0]);
+ }
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-22 18:02:07 UTC (rev 11546)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-07-22 23:36:14 UTC (rev 11547)
@@ -89,8 +89,6 @@
public void tearDown() throws Exception
{
- producer.getProducerRegistrationRequirements().clearRegistrationProperties();
- producer.getRegistrationManager().clear();
resetRegistrationInfo();
super.tearDown();
}
@@ -128,7 +126,7 @@
{
deploy("test-basic-portlet.war");
//Invoke the Web Service
- ServiceDescription sd = serviceDescriptionService.getServiceDescription(gs);
+ ServiceDescription sd = serviceDescriptionService.getServiceDescription(gs);
ExtendedAssert.assertNotNull("sd != null", sd);
@@ -169,7 +167,7 @@
{
// define expected registration infos
producer.getProducerRegistrationRequirements().setRegistrationRequired(requiresRegistration);
- producer.getProducerRegistrationRequirements().setRegistrationRequiredForFullDescription(provideUnregisteredFullDescription);
+ producer.getProducerRegistrationRequirements().setRegistrationRequiredForFullDescription(!provideUnregisteredFullDescription);
if (requiresRegistration)
{
@@ -207,12 +205,15 @@
}
}
- protected void resetRegistrationInfo()
+ protected void resetRegistrationInfo() throws RegistrationException
{
ProducerRegistrationRequirements registrationRequirements = producer.getProducerRegistrationRequirements();
registrationRequirements.setRegistrationRequired(false);
registrationRequirements.clearRegistrationProperties();
registrationRequirements.clearRegistrationPropertyChangeListeners();
+ producer.getProducerRegistrationRequirements().clearRegistrationProperties();
+ producer.getRegistrationManager().clear();
+ producer.getProducerRegistrationRequirements().removeRegistrationPropertyChangeListener(producer.getRegistrationManager());
}
protected GetServiceDescription getNoRegistrationServiceDescriptionRequest()
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2008-07-22 18:02:07 UTC (rev 11546)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2008-07-22 23:36:14 UTC (rev 11547)
@@ -245,18 +245,21 @@
/**
* @param reg
- * @param throwExceptionIfExistsAndNotValid
- *
+ * @param throwExceptionIfInvalid
* @return
* @since 2.6.2
*/
- boolean isRegistrationValid(Registration reg, boolean throwExceptionIfExistsAndNotValid)
+ boolean isRegistrationValid(Registration reg, boolean throwExceptionIfInvalid) throws InvalidRegistrationFault
{
if (reg == null)
{
if (producer.getProducerRegistrationRequirements().isRegistrationRequired())
{
log.debug("Registration is required yet no RegistrationContext was provided: registration invalid!");
+ if(throwExceptionIfInvalid)
+ {
+ throwInvalidRegistrationFault("registration is required yet no RegistrationContext was provided!");
+ }
return false;
}
@@ -269,7 +272,7 @@
boolean isPending = RegistrationStatus.PENDING.equals(reg.getStatus());
log.debug("Registration required: registration is " + (isValid ? "valid!" : (isPending ? "pending!" : "invalid!")));
- if (throwExceptionIfExistsAndNotValid)
+ if (throwExceptionIfInvalid)
{
if (isPending)
{
@@ -280,7 +283,7 @@
{
if (!isValid)
{
- throwInvalidRegistrationFault("Registration with handle '" + reg.getRegistrationHandle() + "' is not valid!");
+ throwInvalidRegistrationFault("registration with handle '" + reg.getRegistrationHandle() + "' is not valid!");
}
}
}
@@ -300,11 +303,14 @@
{
if (registrationContext == null)
{
- return null;
+ throwInvalidRegistrationFault("registration context is missing but registration is required");
}
String regHandle = registrationContext.getRegistrationHandle();
- WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(regHandle, "registration handle");
+ if (regHandle == null)
+ {
+ throwInvalidRegistrationFault("registration handle is missing but registration is required");
+ }
try
{
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2008-07-22 18:02:07 UTC (rev 11546)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2008-07-22 23:36:14 UTC (rev 11547)
@@ -45,6 +45,7 @@
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PortletContext;
import org.jboss.portal.wsrp.core.PortletDescription;
+import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.ServiceDescription;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
@@ -74,52 +75,43 @@
}
public ServiceDescription getServiceDescription(GetServiceDescription gs)
- throws InvalidRegistrationFault, OperationFailedFault, RemoteException
+ throws InvalidRegistrationFault, OperationFailedFault, RemoteException
{
WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(gs, "GetServiceDescription");
- Registration registration = producer.getRegistrationFrom(gs.getRegistrationContext());
- boolean registrationValid = producer.isRegistrationValid(registration);
+ RegistrationContext registrationContext = gs.getRegistrationContext();
ProducerRegistrationRequirements requirements = producer.getProducerRegistrationRequirements();
-
PortletDescription[] offeredPortlets = null;
ServiceDescription serviceDescription = WSRPTypeFactory.createServiceDescription(requirements.isRegistrationRequired());
serviceDescription.setRequiresInitCookie(BEA_8_CONSUMER_FIX);
serviceDescription.setLocales(producer.getSupportedLocales());
- if (!requirements.isRegistrationRequired())
+ // if a RegistrationContext is provided, we need to validate the registration information
+ Registration registration = null;
+ if (registrationContext != null)
{
- offeredPortlets = getPortletDescriptions(gs.getDesiredLocales(), null);
+ registration = producer.getRegistrationOrFailIfInvalid(registrationContext);
}
- else
- {
- if (!registrationValid)
- {
- log.debug("Unregistered consumer while registration is required. Sending registration information.");
- if (requirements.isRegistrationRequiredForFullDescription())
- {
- log.debug("Sending offered portlets description despite not being registered, per Producer configuration.");
- offeredPortlets = getPortletDescriptions(gs.getDesiredLocales(), null);
- }
+ // get the portlet descriptions based on registration information
+ offeredPortlets = getPortletDescriptions(gs.getDesiredLocales(), registration);
+ serviceDescription.setOfferedPortlets(offeredPortlets);
- // do not create a ModelDescription if there is no registration properties
- Map info = requirements.getRegistrationProperties();
- ModelDescription description = null;
- if (info != null && !info.isEmpty())
- {
- description = WSRPUtils.convertRegistrationPropertiesToModelDescription(info);
- }
-
- serviceDescription.setRegistrationPropertyDescription(description);
- }
- else
+ // if we don't have registration information but a registration is required, send registration props information
+ if (registration == null && requirements.isRegistrationRequired())
+ {
+ log.debug("Unregistered consumer while registration is required. Sending registration information.");
+
+ // do not create a ModelDescription if there is no registration properties
+ Map info = requirements.getRegistrationProperties();
+ ModelDescription description = null;
+ if (info != null && !info.isEmpty())
{
- log.debug("Sending registered service description.");
- // should we be sending the registration properties description as well?
- offeredPortlets = getPortletDescriptions(gs.getDesiredLocales(), registration);
+ description = WSRPUtils.convertRegistrationPropertiesToModelDescription(info);
}
+
+ serviceDescription.setRegistrationPropertyDescription(description);
}
serviceDescription.setOfferedPortlets(offeredPortlets);
@@ -163,18 +155,25 @@
catch (PortletInvokerException e)
{
throw WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.OPERATION_FAILED,
- "Could not retrieve portlet '" + portletContext + "'", e);
+ "Could not retrieve portlet '" + portletContext + "'", e);
}
}
/**
- * @param desiredLocales
- * @param registration here so that we can do filtering of portlets based on registration data (not currently
- * implemented)
- * @return
+ * @param desiredLocales the locales in which the portlet descriptions must be provided (best effort)
+ * @param registration used to filter offered portlet lists
+ * @return an array of portlet descriptions offered by this producer (which could be filtered based on the
+ * registration information) or <code>null</code> if no registration is provided and the producer requires
+ * registration to access the full service description.
*/
private PortletDescription[] getPortletDescriptions(String[] desiredLocales, Registration registration)
{
+ ProducerRegistrationRequirements registrationReq = producer.getProducerRegistrationRequirements();
+ if (registration == null && registrationReq.isRegistrationRequired() && registrationReq.isRegistrationRequiredForFullDescription())
+ {
+ return null;
+ }
+
Set<PortletDescription> descriptions = getOfferedPortletDescriptions(desiredLocales);
return descriptions.toArray(new PortletDescription[descriptions.size()]);
}
@@ -201,11 +200,11 @@
{
MediaType mimeType = mediaTypes.next();
markupTypes[i] = new MarkupType(
- mimeType.getValue(),
- getModeNamesFrom(capInfo.getModes(mimeType)),
- getWindowStateNamesFrom(capInfo.getWindowStates(mimeType)),
- getLocaleNamesFrom(capInfo.getLocales(mimeType)),
- null);
+ mimeType.getValue(),
+ getModeNamesFrom(capInfo.getModes(mimeType)),
+ getWindowStateNamesFrom(capInfo.getWindowStates(mimeType)),
+ getLocaleNamesFrom(capInfo.getLocales(mimeType)),
+ null);
}
//todo generate a valid and better portlet handle
@@ -230,7 +229,7 @@
// keywords
// metaInfo contains comma-separated keywords: we need to extract them into an array
org.jboss.portal.wsrp.core.LocalizedString concatenatedKeywords =
- WSRPUtils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.KEYWORDS), desiredLocales);
+ WSRPUtils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.KEYWORDS), desiredLocales);
if (concatenatedKeywords != null)
{
String commaSeparatedKeywords = concatenatedKeywords.getValue();
@@ -239,7 +238,7 @@
String lang = concatenatedKeywords.getLang();
String[] keywordArray = commaSeparatedKeywords.split(",");
org.jboss.portal.wsrp.core.LocalizedString[] keywords =
- new org.jboss.portal.wsrp.core.LocalizedString[keywordArray.length];
+ new org.jboss.portal.wsrp.core.LocalizedString[keywordArray.length];
for (int i = 0; i < keywordArray.length; i++)
{
keywords[i] = WSRPTypeFactory.createLocalizedString(lang, null, keywordArray[i].trim()); // fix-me: resource name
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2008-07-22 18:02:07 UTC (rev 11546)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2008-07-22 23:36:14 UTC (rev 11547)
@@ -464,22 +464,20 @@
Registration getRegistrationOrFailIfInvalid(RegistrationContext registrationContext) throws InvalidRegistrationFault, OperationFailedFault
{
Registration registration = getRegistrationFrom(registrationContext);
- if (!isRegistrationValid(registration))
- {
- registrationHandler.throwInvalidRegistrationFault("Invalid registration");
- }
-
+ isRegistrationValid(registration, true);
+
return registration;
}
/**
* @param registration
+ * @param throwExceptionIfInvalid
* @return
* @since 2.6.2
*/
- boolean isRegistrationValid(Registration registration)
+ boolean isRegistrationValid(Registration registration, boolean throwExceptionIfInvalid) throws InvalidRegistrationFault
{
- return registrationHandler.isRegistrationValid(registration, true);
+ return registrationHandler.isRegistrationValid(registration, throwExceptionIfInvalid);
}
/**
15 years, 11 months
JBoss Portal SVN: r11546 - modules/identity/tags/JBP_IDENTITY_1_0_4/build.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-22 14:02:07 -0400 (Tue, 22 Jul 2008)
New Revision: 11546
Modified:
modules/identity/tags/JBP_IDENTITY_1_0_4/build/build-thirdparty.xml
Log:
Using correct test-agent
Modified: modules/identity/tags/JBP_IDENTITY_1_0_4/build/build-thirdparty.xml
===================================================================
--- modules/identity/tags/JBP_IDENTITY_1_0_4/build/build-thirdparty.xml 2008-07-22 17:44:50 UTC (rev 11545)
+++ modules/identity/tags/JBP_IDENTITY_1_0_4/build/build-thirdparty.xml 2008-07-22 18:02:07 UTC (rev 11546)
@@ -48,7 +48,7 @@
-->
<componentref name="jboss-portal/modules/common" version="1.1.0"/>
- <componentref name="jboss-portal/modules/test" version="1.0.2"/>
+ <componentref name="jboss-portal/modules/test" version="1.0.1"/>
<componentref name="apache-log4j" version="1.2.8"/>
<componentref name="apache-logging" version="1.0.5.SP1-jboss"/>
<componentref name="apache-xerces" version="2.7.1"/>
15 years, 11 months
JBoss Portal SVN: r11545 - in branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core: model/portal/navstate and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-07-22 13:44:50 -0400 (Tue, 22 Jul 2008)
New Revision: 11545
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java
Log:
- merge maps in PageNavigationalState and ControllerPageNavigationalState
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-07-22 16:57:35 UTC (rev 11544)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-07-22 17:44:50 UTC (rev 11545)
@@ -31,6 +31,7 @@
import org.jboss.portal.core.CoreConstants;
import org.jboss.portal.core.navstate.NavigationalStateContext;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.navstate.PageNavigationalState;
import org.jboss.portal.core.controller.coordination.CoordinationManager;
import org.jboss.portal.core.controller.coordination.CoordinationStrategy;
@@ -69,9 +70,6 @@
private Map<QName, String[]> pageUpdates;
/** . */
- private Map<String, String[]> explicitPageUpdates;
-
- /** . */
private Map<String, HashMap<QName, String[]>> windowPublicNavigationalStateUpdate;
public ControllerPageNavigationalState(
@@ -180,41 +178,9 @@
}
- //
+ navigationalStateContext.setPageNavigationalState(controllerContext.getPageId(), new org.jboss.portal.core.model.portal.navstate.PageNavigationalState(parameters));
- Map<String, String[]> explicitBindings;
- if (storedPNS != null)
- {
- explicitBindings = new HashMap<String, String[]>(storedPNS.getExplicitBindings());
- }
- else
- {
- explicitBindings = new HashMap<String, String[]>();
- }
- if (explicitPageUpdates != null)
- {
- for (Map.Entry<String, String[]> explicitUpdate : explicitPageUpdates.entrySet())
- {
- String[] value = explicitUpdate.getValue();
-
- //
- if (value.length == 0)
- {
- explicitBindings.remove(explicitUpdate.getKey());
- }
- else
- {
- explicitBindings.put(explicitUpdate.getKey(), value);
- }
- }
-
- //
-
- }
- navigationalStateContext.setPageNavigationalState(controllerContext.getPageId(), new org.jboss.portal.core.model.portal.navstate.PageNavigationalState(parameters, explicitBindings));
-
-
//
pageUpdates.clear();
}
@@ -399,7 +365,7 @@
// If this window/qname is binded several times with different updated params value will be unpredictable...
for (String binding : bindings)
{
- explicitParameterValue = getPublicExplicitNavigationalState(binding);
+ explicitParameterValue = getPublicNavigationalState(new QName(PageNavigationalState.NAMESPACE_EXPLICIT, binding));
}
@@ -418,7 +384,7 @@
}
else
{
- //If it is DISABLED strategy check if this is not window publishing the param
+ //If it is EXPLICIT strategy check if this is not window publishing the param
}
}
@@ -523,14 +489,9 @@
// Explicit bindings
Collection<String> bindings = manager.getBindingNames(getWindow(windowName), name);
- if (bindings.size() > 0 && explicitPageUpdates == null)
- {
- explicitPageUpdates = new HashMap<String, String[]>();
- }
-
for (String binding : bindings)
{
- explicitPageUpdates.put(binding, value);
+ setPublicNavigationalState(new QName(PageNavigationalState.NAMESPACE_EXPLICIT, binding), value);
}
}
}
@@ -582,35 +543,6 @@
}
/**
- *
- */
- public String[] getPublicExplicitNavigationalState(String name) throws IllegalArgumentException
- {
- String[] value = null;
-
- //
- if (explicitPageUpdates != null)
- {
- value = explicitPageUpdates.get(name);
- }
-
- //
- if (value == null)
- {
- org.jboss.portal.core.model.portal.navstate.PageNavigationalState storedPNS = navigationalStateContext.getPageNavigationalState(controllerContext.getPageId());
-
- //
- if (storedPNS != null)
- {
- value = storedPNS.getExplicitBinding(name);
- }
- }
-
- //
- return value != null && value.length > 0 ? value : null;
- }
-
- /**
*
*/
public void setPublicNavigationalState(QName name, String[] value) throws IllegalArgumentException, IllegalStateException
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java 2008-07-22 16:57:35 UTC (rev 11544)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java 2008-07-22 17:44:50 UTC (rev 11545)
@@ -36,23 +36,16 @@
public class PageNavigationalState implements Serializable
{
+ public static final String NAMESPACE_EXPLICIT = "org.jboss.portal.core.model.portal.navstate.PageNavigationalState.EXPLICIT";
+
/** . */
private final HashMap<QName, String[]> parameters;
- private final HashMap<String, String[]> explicitBindings;
-
public PageNavigationalState(Map<QName, String[]> parameters)
{
this.parameters = new HashMap<QName, String[]>(parameters);
- this.explicitBindings = new HashMap<String, String[]>();
}
- public PageNavigationalState(Map<QName, String[]> parameters, Map<String, String[]> explicitBindings)
- {
- this.parameters = new HashMap<QName, String[]>(parameters);
- this.explicitBindings = new HashMap<String, String[]>(explicitBindings);
- }
-
public String[] getParameter(QName name)
{
return parameters.get(name);
@@ -63,13 +56,4 @@
return Collections.unmodifiableMap(parameters);
}
- public String[] getExplicitBinding(String name)
- {
- return explicitBindings.get(name);
- }
-
- public Map<String, String[]> getExplicitBindings()
- {
- return Collections.unmodifiableMap(explicitBindings);
- }
}
15 years, 11 months
JBoss Portal SVN: r11544 - in branches/JBoss_Portal_Branch_2_7: core/src/main/org/jboss/portal/core/controller/portlet and 5 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-07-22 12:57:35 -0400 (Tue, 22 Jul 2008)
New Revision: 11544
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationStrategy.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/WindowBindingInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationAliasBindingMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationWindowBindingMetaData.java
Removed:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ImplicitStrategy.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationParameterBindingMetaData.java
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationManager.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
Log:
- Coordination refactorings and addition of alias binding
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -0,0 +1,39 @@
+/*
+* 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.coordination;
+
+import org.jboss.portal.core.model.portal.Page;
+
+import javax.xml.namespace.QName;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface AliasBindingInfo extends ParameterBindingInfo
+{
+ Page getPage();
+
+ Set<QName> getQNames();
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -29,6 +29,7 @@
import javax.xml.namespace.QName;
import java.util.Map;
import java.util.Collection;
+import java.util.Set;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -63,13 +64,13 @@
* @param strategy
* @throws IllegalCoordinationException
*/
- void setImplicitEventWiringStrategy(PageContainer pageContainer, ImplicitStrategy strategy) throws IllegalCoordinationException;
+ void setEventWiringStrategy(PageContainer pageContainer, CoordinationStrategy strategy) throws IllegalCoordinationException;
/**
* @param page
* @return implicit wiring strategy for a given page. Can return null if no strategy is set
*/
- ImplicitStrategy getImplicitEventWiringStrategy(PageContainer page) throws IllegalCoordinationException;
+ CoordinationStrategy getEventWiringStrategy(PageContainer page) throws IllegalCoordinationException;
/**
* @param page
@@ -103,7 +104,7 @@
* @param windows
* @throws IllegalCoordinationException
*/
- void setParameterBinding(String name, Map<Window, QName> windows) throws IllegalCoordinationException;
+ void setWindowBinding(String name, Map<Window, QName> windows) throws IllegalCoordinationException;
/**
* Removes given parameter binding
@@ -111,42 +112,65 @@
* @param parameterBinding
* @throws IllegalCoordinationException
*/
- void removeParameterBinding(ParameterBindingInfo parameterBinding) throws IllegalCoordinationException;
+ void removeWindowBinding(WindowBindingInfo parameterBinding) throws IllegalCoordinationException;
/**
* Set implicit strategy for a given page container
*
* @param pageContainer
- * @param implicitStrategy
+ * @param coordinationStrategy
* @throws IllegalCoordinationException
*/
- void setImplicitParameterBindingStrategy(PageContainer pageContainer, ImplicitStrategy implicitStrategy) throws IllegalCoordinationException;
+ void setParameterBindingStrategy(PageContainer pageContainer, CoordinationStrategy coordinationStrategy) throws IllegalCoordinationException;
/**
* @param pageContainer
* @return implicit strategy for a given page container. Can return null if no strategy is defined
*/
- ImplicitStrategy getImplicitParameterBindingStrategy(PageContainer pageContainer) throws IllegalCoordinationException;
+ CoordinationStrategy getParameterBindingStrategy(PageContainer pageContainer) throws IllegalCoordinationException;
+ /**
+ * Set alias binding for a given page. If alias with given name already exists it will be overwritten
+ *
+ * @param page
+ * @param aliasName
+ * @param qnames
+ * @throws IllegalCoordinationException
+ */
+ void setAliasBinding(Page page, String aliasName, Set<QName> qnames) throws IllegalCoordinationException;
/**
+ * Removes alias binding
+ *
+ * @param aliasInfo
+ * @throws IllegalCoordinationException
+ */
+ void removeAliasBinding(AliasBindingInfo aliasInfo) throws IllegalCoordinationException;
+
+ /**
* @param page
+ * @return collection of alias bindings connected to the given page
+ */
+ Collection<AliasBindingInfo> getAliasBindings(Page page);
+
+ /**
+ * @param page
* @param parameterQName
- * @return parameter bindings for a given parameter qname
+ * @return window bindings for a given parameter qname
*/
- Collection<ParameterBindingInfo> getParameterBindings(Page page, QName parameterQName);
+ Collection<WindowBindingInfo> getWindowBindings(Page page, QName parameterQName);
/**
* @param page
- * @return parameter bindings define in the scope of a given page
+ * @return window bindings define in the scope of a given page
*/
- Collection<ParameterBindingInfo> getParameterBindings(Page page);
+ Collection<WindowBindingInfo> getWindowBindings(Page page);
/**
* @param window
- * @return parameter bindings where given window is involved
+ * @return window bindings where given window is involved
*/
- Collection<ParameterBindingInfo> getParameterBindings(Window window);
+ Collection<WindowBindingInfo> getWindowBindings(Window window);
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationManager.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationManager.java 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationManager.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -58,7 +58,7 @@
* @return
* @throws IllegalCoordinationException
*/
- ImplicitStrategy resolveImplicitBindingStrategy(PageContainer page);
+ CoordinationStrategy resolveBindingStrategy(PageContainer page);
/**
* Resolves implicit wiring strategy. If there is no strategy defined for this page container method will browse
@@ -68,7 +68,7 @@
* @return
* @throws IllegalCoordinationException
*/
- ImplicitStrategy resolveImplicitEventWiringStrategy(PageContainer page);
+ CoordinationStrategy resolveEventWiringStrategy(PageContainer page);
/**
* @param window
Copied: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationStrategy.java (from rev 11539, branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ImplicitStrategy.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationStrategy.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationStrategy.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -0,0 +1,85 @@
+/*
+* 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.coordination;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+* @version : 0.1 $
+*/
+public enum CoordinationStrategy
+{
+
+ // Explicit wiring takes precedence and if none exist for a given event it will be processed with implicit wiring
+ FALLBACK,
+
+ // Only implicit wiring enabled
+ IMPLICIT,
+
+ // Implicit wiring disabled
+ EXPLICIT,
+
+ // All children nodes in the tree will inherit FALLBACK strategy
+ RECURSIVE_FALLBACK,
+
+ // All children nodes in the tree will inherit IMPLICIT strategy
+ RECURSIVE_IMPLICIT,
+
+ // All children nodes in the tree will inherit EXPLICIT strategy
+ RECURSIVE_EXPLICIT;
+
+ public static CoordinationStrategy decodeStrategy(String value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+ else if (value.equals(EXPLICIT.name()))
+ {
+ return CoordinationStrategy.EXPLICIT;
+ }
+ else if (value.equals(IMPLICIT.name()))
+ {
+ return CoordinationStrategy.IMPLICIT;
+ }
+ else if (value.equals(FALLBACK.name()))
+ {
+ return CoordinationStrategy.FALLBACK;
+ }
+ else if (value.equals(RECURSIVE_EXPLICIT.name()))
+ {
+ return CoordinationStrategy.RECURSIVE_EXPLICIT;
+ }
+ else if (value.equals(RECURSIVE_IMPLICIT.name()))
+ {
+ return CoordinationStrategy.RECURSIVE_IMPLICIT;
+ }
+ else if (value.equals(RECURSIVE_FALLBACK.name()))
+ {
+ return CoordinationStrategy.RECURSIVE_FALLBACK;
+ }
+
+ // Strategy unknown
+ return null;
+ }
+
+}
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ImplicitStrategy.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ImplicitStrategy.java 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ImplicitStrategy.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -1,85 +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.coordination;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
-* @version : 0.1 $
-*/
-public enum ImplicitStrategy
-{
-
- // Explicit wiring takes precedence and if none exist for a given event it will be processed with implicit wiring
- FALLBACK,
-
- // Only implicit wiring enabled
- EXCLUSIVE,
-
- // Implicit wiring disabled
- DISABLED,
-
- // All children nodes in the tree will inherit FALLBACK strategy
- RECURSIVE_FALLBACK,
-
- // All children nodes in the tree will inherit EXCLUSIVE strategy
- RECURSIVE_EXCLUSIVE,
-
- // All children nodes in the tree will inherit DISABLED strategy
- RECURSIVE_DISABLED;
-
- public static ImplicitStrategy decodeStrategy(String value)
- {
- if (value == null)
- {
- return null;
- }
- else if (value.equals(DISABLED.name()))
- {
- return ImplicitStrategy.DISABLED;
- }
- else if (value.equals(EXCLUSIVE.name()))
- {
- return ImplicitStrategy.EXCLUSIVE;
- }
- else if (value.equals(FALLBACK.name()))
- {
- return ImplicitStrategy.FALLBACK;
- }
- else if (value.equals(RECURSIVE_DISABLED.name()))
- {
- return ImplicitStrategy.RECURSIVE_DISABLED;
- }
- else if (value.equals(RECURSIVE_EXCLUSIVE.name()))
- {
- return ImplicitStrategy.RECURSIVE_EXCLUSIVE;
- }
- else if (value.equals(RECURSIVE_FALLBACK.name()))
- {
- return ImplicitStrategy.RECURSIVE_FALLBACK;
- }
-
- // Strategy unknown
- return null;
- }
-
-}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -35,6 +35,6 @@
{
String getName();
- Map<Window, QName> getWindows();
+
}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/WindowBindingInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/WindowBindingInfo.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/WindowBindingInfo.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -0,0 +1,38 @@
+/*
+* 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.coordination;
+
+import org.jboss.portal.core.model.portal.Window;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface WindowBindingInfo extends ParameterBindingInfo
+{
+
+ Map<Window, QName> getWindows();
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -32,7 +32,7 @@
import org.jboss.portal.core.navstate.NavigationalStateContext;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.controller.coordination.CoordinationManager;
-import org.jboss.portal.core.controller.coordination.ImplicitStrategy;
+import org.jboss.portal.core.controller.coordination.CoordinationStrategy;
import javax.xml.namespace.QName;
import java.util.Collections;
@@ -403,12 +403,12 @@
}
- ImplicitStrategy strategy = getCoordinationManager().resolveImplicitBindingStrategy(getWindow(windowName).getPage());
+ CoordinationStrategy strategy = getCoordinationManager().resolveBindingStrategy(getWindow(windowName).getPage());
String parameterId = parameterInfo.getId();
- if (strategy.equals(ImplicitStrategy.DISABLED) ||
- (strategy.equals(ImplicitStrategy.FALLBACK) && explicitParameterValue != null))
+ if (strategy.equals(CoordinationStrategy.EXPLICIT) ||
+ (strategy.equals(CoordinationStrategy.FALLBACK) && explicitParameterValue != null))
{
//
// We clone the value here so we keep the internal state not potentially changed
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -25,10 +25,11 @@
import org.jboss.portal.core.controller.coordination.CoordinationManager;
import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
import org.jboss.portal.core.controller.coordination.EventWiringInfo;
-import org.jboss.portal.core.controller.coordination.ParameterBindingInfo;
-import org.jboss.portal.core.controller.coordination.ImplicitStrategy;
+import org.jboss.portal.core.controller.coordination.CoordinationStrategy;
import org.jboss.portal.core.controller.coordination.CoordinationConfigurator;
import org.jboss.portal.core.controller.coordination.EventConverter;
+import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
+import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PageContainer;
@@ -48,6 +49,7 @@
import java.util.HashSet;
import java.util.HashMap;
import java.util.Collections;
+import java.util.Iterator;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -64,10 +66,14 @@
public static final String PREFIX = "org.jboss.portal.core.controller.coordination";
+ public static final String QNAME_SEPARATOR = ";";
+
public static final String PREFIX_EVENT = PREFIX + ".event";
- public static final String PREFIX_PARAMETER = PREFIX + ".binding";
+ public static final String PREFIX_PARAMETER = PREFIX + ".parameter";
+ public static final String PREFIX_PARAMETER_ALIAS = PREFIX_PARAMETER + ".alias";
+
public static final String PREFIX_EVENT_NAME = PREFIX_EVENT + ".name";
public static final String PREFIX_EVENT_WIRING = PREFIX_EVENT + ".wiring";
@@ -76,25 +82,27 @@
public static final String PREFIX_PARAMETER_BINDING = PREFIX_PARAMETER + ".binding";
- public static final String PREFIX_EVENT_IMPLICIT_STRATEGY = PREFIX_EVENT + ".implicit_strategy";
+ public static final String PREFIX_PARAMETER_ALIAS_NAME = PREFIX_PARAMETER_ALIAS + ".name";
- public static final String PREFIX_PARAMETER_IMPLICIT_STRATEGY = PREFIX_PARAMETER + ".implicit_strategy";
+ public static final String PREFIX_EVENT_IMPLICIT_STRATEGY = PREFIX_EVENT + ".coordination_strategy";
- public static final String STRATEGY_FALLBACK = ImplicitStrategy.FALLBACK.name();
+ public static final String PREFIX_PARAMETER_IMPLICIT_STRATEGY = PREFIX_PARAMETER + ".coordination_strategy";
- public static final String STRATEGY_EXCLUSIVE = ImplicitStrategy.EXCLUSIVE.name();
+ public static final String STRATEGY_FALLBACK = CoordinationStrategy.FALLBACK.name();
- public static final String STRATEGY_DISABLED = ImplicitStrategy.DISABLED.name();
+ public static final String STRATEGY_EXCLUSIVE = CoordinationStrategy.IMPLICIT.name();
- public static final String STRATEGY_RECURSIVE_DISABLED = ImplicitStrategy.RECURSIVE_DISABLED.name();
+ public static final String STRATEGY_DISABLED = CoordinationStrategy.EXPLICIT.name();
- public static final String STRATEGY_RECURSIVE_EXCLUSIVE = ImplicitStrategy.RECURSIVE_EXCLUSIVE.name();
+ public static final String STRATEGY_RECURSIVE_DISABLED = CoordinationStrategy.RECURSIVE_EXPLICIT.name();
- public static final String STRATEGY_RECURSIVE_FALLBACK = ImplicitStrategy.RECURSIVE_FALLBACK.name();
+ public static final String STRATEGY_RECURSIVE_EXCLUSIVE = CoordinationStrategy.RECURSIVE_IMPLICIT.name();
- public static final ImplicitStrategy DEFAULT_STRATEGY = ImplicitStrategy.FALLBACK;
+ public static final String STRATEGY_RECURSIVE_FALLBACK = CoordinationStrategy.RECURSIVE_FALLBACK.name();
+ public static final CoordinationStrategy DEFAULT_STRATEGY = CoordinationStrategy.FALLBACK;
+
protected EventConverter eventConverter = new SimpleEventConverter();
protected PortalObjectContainer portalObjectContainer;
@@ -127,27 +135,27 @@
Page page = context.getWindow(event.getWindowId()).getPage();
- ImplicitStrategy strategy = resolveImplicitEventWiringStrategy(page);
+ CoordinationStrategy strategy = resolveEventWiringStrategy(page);
Map<Window, PortletWindowEvent> windows = new HashMap<Window, PortletWindowEvent>();
// Only implicit wirings
- if (strategy.equals(ImplicitStrategy.EXCLUSIVE))
+ if (strategy.equals(CoordinationStrategy.IMPLICIT))
{
windows = getEventWindowsImplicit(page, event, context);
}
// Only explicit wirings
- else if(strategy.equals(ImplicitStrategy.DISABLED))
+ else if(strategy.equals(CoordinationStrategy.EXPLICIT))
{
windows = getEventWindowsExplicit(page, event, context);
}
// If no explicit wirings for this event fallback to implicit
- else if(strategy.equals(ImplicitStrategy.FALLBACK))
+ else if(strategy.equals(CoordinationStrategy.FALLBACK))
{
windows = getEventWindowsExplicit(page, event, context);
@@ -165,9 +173,9 @@
Set<String> names = new HashSet<String>();
- Collection<ParameterBindingInfo> infos = getParameterBindings(window);
+ Collection<WindowBindingInfo> infos = getWindowBindings(window);
- for (ParameterBindingInfo info : infos)
+ for (WindowBindingInfo info : infos)
{
for (Map.Entry<Window, QName> entry : info.getWindows().entrySet())
{
@@ -340,7 +348,7 @@
}
}
- public void setImplicitEventWiringStrategy(PageContainer pageContainer, ImplicitStrategy strategy) throws IllegalCoordinationException
+ public void setEventWiringStrategy(PageContainer pageContainer, CoordinationStrategy strategy) throws IllegalCoordinationException
{
if (pageContainer == null)
{
@@ -352,7 +360,7 @@
}
- public ImplicitStrategy getImplicitEventWiringStrategy(PageContainer page) throws IllegalCoordinationException
+ public CoordinationStrategy getEventWiringStrategy(PageContainer page) throws IllegalCoordinationException
{
if (page == null)
{
@@ -363,7 +371,7 @@
}
- public ImplicitStrategy resolveImplicitEventWiringStrategy(PageContainer page)
+ public CoordinationStrategy resolveEventWiringStrategy(PageContainer page)
{
if (page == null)
@@ -512,7 +520,7 @@
return events;
}
- public void setParameterBinding(String name, Map<Window, QName> windows) throws IllegalCoordinationException
+ public void setWindowBinding(String name, Map<Window, QName> windows) throws IllegalCoordinationException
{
if (windows == null)
{
@@ -562,7 +570,7 @@
}
- public void removeParameterBinding(ParameterBindingInfo info) throws IllegalCoordinationException
+ public void removeWindowBinding(WindowBindingInfo info) throws IllegalCoordinationException
{
if (info == null)
{
@@ -579,7 +587,7 @@
}
}
- public void setImplicitParameterBindingStrategy(PageContainer pageContainer, ImplicitStrategy strategy) throws IllegalCoordinationException
+ public void setParameterBindingStrategy(PageContainer pageContainer, CoordinationStrategy strategy) throws IllegalCoordinationException
{
if (pageContainer == null)
{
@@ -590,7 +598,7 @@
setStrategy(pageContainer, strategy, PREFIX_PARAMETER_IMPLICIT_STRATEGY);
}
- public ImplicitStrategy getImplicitParameterBindingStrategy(PageContainer pageContainer) throws IllegalCoordinationException
+ public CoordinationStrategy getParameterBindingStrategy(PageContainer pageContainer) throws IllegalCoordinationException
{
if (pageContainer == null)
@@ -602,7 +610,7 @@
}
- public ImplicitStrategy resolveImplicitBindingStrategy(PageContainer page)
+ public CoordinationStrategy resolveBindingStrategy(PageContainer page)
{
if (page == null)
{
@@ -612,24 +620,125 @@
return resolveStrategy(page, PREFIX_PARAMETER_IMPLICIT_STRATEGY);
}
- public Collection<ParameterBindingInfo> getParameterBindings(Page page, QName parameterQName)
+
+ public void setAliasBinding(Page page, String aliasName, Set<QName> qnames) throws IllegalCoordinationException
{
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+ if (aliasName == null)
+ {
+ throw new IllegalArgumentException("alias name is null");
+ }
+ if (qnames == null)
+ {
+ throw new IllegalArgumentException("qnames set is null");
+ }
+ String propName = PREFIX_PARAMETER_ALIAS_NAME + "." + aliasName;
+
+
+ // Check if qname consist separator string
+
+ for (QName qname : qnames)
+ {
+
+
+ if (qname.toString().contains(QNAME_SEPARATOR))
+ {
+ throw new IllegalCoordinationException("Qname: " + qname + " contains forbidden character: " + QNAME_SEPARATOR);
+ }
+ }
+
+ StringBuilder qnameList = new StringBuilder();
+
+ for (Iterator i = qnames.iterator(); i.hasNext(); )
+ {
+ QName qname = (QName)i.next();
+
+ qnameList.append(qname.toString());
+
+ if (i.hasNext())
+ {
+ qnameList.append(QNAME_SEPARATOR);
+ }
+ }
+
+ page.setDeclaredProperty(propName, qnameList.toString());
+
+ }
+
+ public void removeAliasBinding(AliasBindingInfo aliasInfo) throws IllegalCoordinationException
+ {
+ if (aliasInfo == null)
+ {
+ throw new IllegalArgumentException("alias info is null");
+ }
+
+ String propName = PREFIX_PARAMETER_ALIAS_NAME + "." + aliasInfo.getName();
+
+ if (aliasInfo.getPage().getProperties().keySet().contains(propName))
+ {
+ aliasInfo.getPage().setDeclaredProperty(propName,null);
+ }
+ }
+
+ public Collection<AliasBindingInfo> getAliasBindings(Page page)
+ {
if (page == null)
{
throw new IllegalArgumentException("page is null");
}
+ HashSet<AliasBindingInfo> aliases = new HashSet<AliasBindingInfo>();
+
+ for (String propertyName : page.getProperties().keySet())
+ {
+ if (propertyName.startsWith(PREFIX_PARAMETER_ALIAS_NAME))
+ {
+ String aliasName = propertyName.substring(PREFIX_PARAMETER_ALIAS_NAME.length() + 1);
+
+ AliasInfoPOJO info = new AliasInfoPOJO(aliasName, page);
+
+ String qnameList = page.getProperty(propertyName);
+
+ String[] qnames = qnameList.split(QNAME_SEPARATOR);
+
+ if (qnames != null)
+ {
+ for (String string : qnames)
+ {
+ QName qname = QName.valueOf(string);
+ info.getQNames().add(qname);
+ }
+ }
+
+ aliases.add(info.getImmutableInfo());
+ }
+ }
+
+ return aliases;
+ }
+
+ public Collection<WindowBindingInfo> getWindowBindings(Page page, QName parameterQName)
+ {
+
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
if (parameterQName == null)
{
throw new IllegalArgumentException("QName is null");
}
- Collection<ParameterBindingInfo> pageParams = getParameterBindings(page);
+ Collection<WindowBindingInfo> pageParams = getWindowBindings(page);
- Collection<ParameterBindingInfo> infos = new HashSet<ParameterBindingInfo>();
+ Collection<WindowBindingInfo> infos = new HashSet<WindowBindingInfo>();
- for (ParameterBindingInfo pageParam : pageParams)
+ for (WindowBindingInfo pageParam : pageParams)
{
if (pageParam.getWindows().containsValue(parameterQName))
{
@@ -640,7 +749,7 @@
return infos;
}
- public Collection<ParameterBindingInfo> getParameterBindings(Page page)
+ public Collection<WindowBindingInfo> getWindowBindings(Page page)
{
if (page == null)
{
@@ -651,7 +760,7 @@
Collection<Window> windows = getWindows(page);
- Map<String, ParameterInfoPOJO> params = new HashMap<String, ParameterInfoPOJO>();
+ Map<String, WindowInfoPOJO> params = new HashMap<String, WindowInfoPOJO>();
@@ -664,11 +773,11 @@
if(propName.startsWith(PREFIX_PARAMETER_BINDING))
{
String pn = propName.substring(PREFIX_PARAMETER_BINDING.length() + 1);
- ParameterInfoPOJO info = null;
+ WindowInfoPOJO info = null;
if (!params.keySet().contains(pn))
{
- info = new ParameterInfoPOJO(pn);
+ info = new WindowInfoPOJO(pn);
params.put(pn, info);
}
else
@@ -699,9 +808,9 @@
}
// Make immutable copy
- Collection<ParameterBindingInfo> immutableParams = new HashSet<ParameterBindingInfo>();
+ Collection<WindowBindingInfo> immutableParams = new HashSet<WindowBindingInfo>();
- for (ParameterInfoPOJO info : params.values())
+ for (WindowInfoPOJO info : params.values())
{
immutableParams.add(info.getImmutableInfo());
}
@@ -709,13 +818,13 @@
return immutableParams;
}
- public Collection<ParameterBindingInfo> getParameterBindings(Window window)
+ public Collection<WindowBindingInfo> getWindowBindings(Window window)
{
- Collection<ParameterBindingInfo> pageParams = getParameterBindings(window.getPage());
+ Collection<WindowBindingInfo> pageParams = getWindowBindings(window.getPage());
- Collection<ParameterBindingInfo> infos = new HashSet<ParameterBindingInfo>();
+ Collection<WindowBindingInfo> infos = new HashSet<WindowBindingInfo>();
- for (ParameterBindingInfo pageParam : pageParams)
+ for (WindowBindingInfo pageParam : pageParams)
{
if (pageParam.getWindows().keySet().contains(window))
{
@@ -750,52 +859,52 @@
// HELPER METHODS
- private void setStrategy(PageContainer pageContainer, ImplicitStrategy strategy, String prefix)
+ private void setStrategy(PageContainer pageContainer, CoordinationStrategy strategy, String prefix)
{
if (strategy == null)
{
pageContainer.setDeclaredProperty(prefix, null);
}
- else if (strategy.equals(ImplicitStrategy.DISABLED))
+ else if (strategy.equals(CoordinationStrategy.EXPLICIT))
{
pageContainer.setDeclaredProperty(prefix, STRATEGY_DISABLED);
}
- else if (strategy.equals(ImplicitStrategy.EXCLUSIVE))
+ else if (strategy.equals(CoordinationStrategy.IMPLICIT))
{
pageContainer.setDeclaredProperty(prefix, STRATEGY_EXCLUSIVE);
}
- else if (strategy.equals(ImplicitStrategy.FALLBACK))
+ else if (strategy.equals(CoordinationStrategy.FALLBACK))
{
pageContainer.setDeclaredProperty(prefix,STRATEGY_FALLBACK);
}
- else if (strategy.equals(ImplicitStrategy.RECURSIVE_DISABLED))
+ else if (strategy.equals(CoordinationStrategy.RECURSIVE_EXPLICIT))
{
pageContainer.setDeclaredProperty(prefix,STRATEGY_RECURSIVE_DISABLED);
}
- else if (strategy.equals(ImplicitStrategy.RECURSIVE_EXCLUSIVE))
+ else if (strategy.equals(CoordinationStrategy.RECURSIVE_IMPLICIT))
{
pageContainer.setDeclaredProperty(prefix,STRATEGY_RECURSIVE_EXCLUSIVE);
}
- else if (strategy.equals(ImplicitStrategy.RECURSIVE_FALLBACK))
+ else if (strategy.equals(CoordinationStrategy.RECURSIVE_FALLBACK))
{
pageContainer.setDeclaredProperty(prefix,STRATEGY_RECURSIVE_FALLBACK);
}
}
- private ImplicitStrategy decodeStrategy(PageContainer pageContainer, String prefix)
+ private CoordinationStrategy decodeStrategy(PageContainer pageContainer, String prefix)
{
String value = pageContainer.getDeclaredProperty(prefix);
- return ImplicitStrategy.decodeStrategy(value);
+ return CoordinationStrategy.decodeStrategy(value);
}
- private ImplicitStrategy resolveStrategy(PageContainer pageContainer, String prefix)
+ private CoordinationStrategy resolveStrategy(PageContainer pageContainer, String prefix)
{
String value = pageContainer.getDeclaredProperty(prefix);
- ImplicitStrategy strategy = null;
+ CoordinationStrategy strategy = null;
// Try to obtain recursive strategy from parents
@@ -806,22 +915,22 @@
}
else
{
- strategy = ImplicitStrategy.decodeStrategy(value);
+ strategy = CoordinationStrategy.decodeStrategy(value);
}
if (strategy != null)
{
- if (strategy.equals(ImplicitStrategy.RECURSIVE_DISABLED))
+ if (strategy.equals(CoordinationStrategy.RECURSIVE_EXPLICIT))
{
- return ImplicitStrategy.DISABLED;
+ return CoordinationStrategy.EXPLICIT;
}
- else if (strategy.equals(ImplicitStrategy.RECURSIVE_EXCLUSIVE))
+ else if (strategy.equals(CoordinationStrategy.RECURSIVE_IMPLICIT))
{
- return ImplicitStrategy.EXCLUSIVE;
+ return CoordinationStrategy.IMPLICIT;
}
- else if (strategy.equals(ImplicitStrategy.RECURSIVE_FALLBACK))
+ else if (strategy.equals(CoordinationStrategy.RECURSIVE_FALLBACK))
{
- return ImplicitStrategy.FALLBACK;
+ return CoordinationStrategy.FALLBACK;
}
return strategy;
@@ -834,20 +943,20 @@
}
// Search for the RECURSIVE_ type of strategy
- private ImplicitStrategy resolveRecursiveStrategy(PortalObject po, String prefix)
+ private CoordinationStrategy resolveRecursiveStrategy(PortalObject po, String prefix)
{
String value = po.getDeclaredProperty(prefix);
- ImplicitStrategy strategy = null;
+ CoordinationStrategy strategy = null;
if (value != null)
{
- strategy = ImplicitStrategy.decodeStrategy(value);
+ strategy = CoordinationStrategy.decodeStrategy(value);
}
if (strategy != null &&
- (strategy.equals(ImplicitStrategy.RECURSIVE_DISABLED) ||
- strategy.equals(ImplicitStrategy.RECURSIVE_EXCLUSIVE) ||
- strategy.equals(ImplicitStrategy.RECURSIVE_FALLBACK)))
+ (strategy.equals(CoordinationStrategy.RECURSIVE_EXPLICIT) ||
+ strategy.equals(CoordinationStrategy.RECURSIVE_IMPLICIT) ||
+ strategy.equals(CoordinationStrategy.RECURSIVE_FALLBACK)))
{
return strategy;
}
@@ -860,6 +969,8 @@
}
+
+
Collection<Window> getWindows(Page page)
{
Set<Window> windows = new HashSet<Window>();
@@ -937,19 +1048,19 @@
}
- private class ParameterInfoPOJO implements ParameterBindingInfo
+ private class WindowInfoPOJO implements WindowBindingInfo
{
private final String name;
private final Map<Window, QName> windows;
- private ParameterInfoPOJO(String name, Map<Window, QName> windows)
+ private WindowInfoPOJO(String name, Map<Window, QName> windows)
{
this.name = name;
this.windows = windows;
}
- private ParameterInfoPOJO(String name)
+ private WindowInfoPOJO(String name)
{
this.name = name;
this.windows = new HashMap<Window,QName>();
@@ -965,11 +1076,54 @@
return windows;
}
- ParameterBindingInfo getImmutableInfo()
+ WindowBindingInfo getImmutableInfo()
{
- return new ParameterInfoPOJO(name, Collections.unmodifiableMap(windows));
+ return new WindowInfoPOJO(name, Collections.unmodifiableMap(windows));
}
}
+
+ private class AliasInfoPOJO implements AliasBindingInfo
+ {
+
+ private final String name;
+ private final Page page;
+ private final Set<QName> qnames;
+
+ private AliasInfoPOJO(String name, Page page, Set<QName> qnames)
+ {
+ this.name = name;
+ this.page = page;
+ this.qnames = qnames;
+ }
+
+ private AliasInfoPOJO(String name, Page page)
+ {
+ this.name = name;
+ this.page = page;
+ this.qnames = new HashSet<QName>();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Page getPage()
+ {
+ return page;
+ }
+
+ public Set<QName> getQNames()
+ {
+ return qnames;
+ }
+
+ AliasBindingInfo getImmutableInfo()
+ {
+ return new AliasInfoPOJO(name, page, Collections.unmodifiableSet(qnames));
+ }
+
+ }
}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationAliasBindingMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationAliasBindingMetaData.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationAliasBindingMetaData.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -0,0 +1,90 @@
+/*
+* 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.metadata.coordination;
+
+import org.w3c.dom.Element;
+import org.jboss.portal.common.xml.XMLTools;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class CoordinationAliasBindingMetaData
+{
+ private String name;
+
+ private Set<String> qnames = new HashSet<String>();
+
+ public CoordinationAliasBindingMetaData(String name)
+ {
+ this.name = name;
+ }
+
+ public Set<String> getQnames()
+ {
+ return qnames;
+ }
+
+ public void setQnames(Set<String> qnames)
+ {
+ this.qnames = qnames;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void addQName(String qname)
+ {
+ qnames.add(qname);
+ }
+
+ public static CoordinationAliasBindingMetaData buildMetaData(Element bindingElement)
+ {
+ Element nameElt = XMLTools.getUniqueChild(bindingElement, "name", true);
+ CoordinationAliasBindingMetaData aliasMetaData = new CoordinationAliasBindingMetaData(XMLTools.asString(nameElt));
+
+ Iterator qnameIter = XMLTools.getChildrenIterator(bindingElement, "qname");
+
+ while (qnameIter.hasNext())
+ {
+ Element element = (Element)qnameIter.next();
+
+ aliasMetaData.addQName(XMLTools.asString(element));
+ }
+
+ return aliasMetaData;
+ }
+}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationMetaData.java 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationMetaData.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -22,7 +22,7 @@
package org.jboss.portal.core.model.portal.metadata.coordination;
-import org.jboss.portal.core.controller.coordination.ImplicitStrategy;
+import org.jboss.portal.core.controller.coordination.CoordinationStrategy;
import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
import org.jboss.portal.core.model.portal.metadata.BuildContext;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -38,6 +38,8 @@
import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -46,12 +48,14 @@
public class CoordinationMetaData
{
- private ImplicitStrategy eventStrategy;
+ private CoordinationStrategy eventStrategy;
- private ImplicitStrategy parameterStrategy;
+ private CoordinationStrategy parameterStrategy;
- List<CoordinationParameterBindingMetaData> parameterBindings = new LinkedList<CoordinationParameterBindingMetaData>();
+ List<CoordinationWindowBindingMetaData> windowBindings = new LinkedList<CoordinationWindowBindingMetaData>();
+ List<CoordinationAliasBindingMetaData> aliasBindings = new LinkedList<CoordinationAliasBindingMetaData>();
+
List<CoordinationEventWiringMetaData> wirings = new LinkedList<CoordinationEventWiringMetaData>();
public static CoordinationMetaData buildMetaData(Element coordinationElt)
@@ -59,19 +63,19 @@
CoordinationMetaData coordinationMetaData = new CoordinationMetaData();
- Element eventStrategy = XMLTools.getUniqueChild(coordinationElt, "implicit-event-strategy", false);
+ Element eventStrategy = XMLTools.getUniqueChild(coordinationElt, "event-strategy", false);
if (eventStrategy != null)
{
- coordinationMetaData.setEventStrategy(ImplicitStrategy.decodeStrategy(XMLTools.asString(eventStrategy)));
+ coordinationMetaData.setEventStrategy(CoordinationStrategy.decodeStrategy(XMLTools.asString(eventStrategy)));
}
- Element parameterStrategy = XMLTools.getUniqueChild(coordinationElt, "implicit-parameter-strategy", false);
+ Element parameterStrategy = XMLTools.getUniqueChild(coordinationElt, "parameter-strategy", false);
if (parameterStrategy != null)
{
- coordinationMetaData.setParameterStrategy(ImplicitStrategy.decodeStrategy(XMLTools.asString(parameterStrategy)));
+ coordinationMetaData.setParameterStrategy(CoordinationStrategy.decodeStrategy(XMLTools.asString(parameterStrategy)));
}
Element wiringsElement = XMLTools.getUniqueChild(coordinationElt, "wirings", false);
@@ -92,9 +96,17 @@
while (paramBindingsIter.hasNext())
{
Element bindingElement = (Element)paramBindingsIter.next();
- coordinationMetaData.addParameterBinding(CoordinationParameterBindingMetaData.buildMetaData(bindingElement));
+ coordinationMetaData.addWindowBinding(CoordinationWindowBindingMetaData.buildMetaData(bindingElement));
}
+ // Alias bindings
+ Iterator aliasBindingsIter = XMLTools.getChildrenIterator(bindingsElement, "alias-binding");
+ while (aliasBindingsIter.hasNext())
+ {
+ Element aliasElement = (Element)paramBindingsIter.next();
+ coordinationMetaData.addAliasBinding(CoordinationAliasBindingMetaData.buildMetaData(aliasElement));
+ }
+
}
@@ -121,27 +133,39 @@
{
if (getEventStrategy() != null)
{
- buildContext.getCoordinationConfigurator().setImplicitEventWiringStrategy((PageContainer)object, getEventStrategy());
+ buildContext.getCoordinationConfigurator().setEventWiringStrategy((PageContainer)object, getEventStrategy());
}
if (getParameterStrategy() != null)
{
- buildContext.getCoordinationConfigurator().setImplicitParameterBindingStrategy((PageContainer)object, getParameterStrategy());
+ buildContext.getCoordinationConfigurator().setParameterBindingStrategy((PageContainer)object, getParameterStrategy());
}
if (object instanceof Page)
{
Page page = (Page)object;
- for (CoordinationParameterBindingMetaData parameterBinding : parameterBindings)
+ for (CoordinationWindowBindingMetaData windowBinding : windowBindings)
{
Map<Window, QName> bindings = new HashMap<Window, QName>();
- populateWindows(bindings, parameterBinding.getWindows(), page);
+ populateWindows(bindings, windowBinding.getWindows(), page);
- buildContext.getCoordinationConfigurator().setParameterBinding(parameterBinding.getName(), bindings);
+ buildContext.getCoordinationConfigurator().setWindowBinding(windowBinding.getName(), bindings);
}
+ for (CoordinationAliasBindingMetaData windowBinding : aliasBindings)
+ {
+ Set<QName> qnames = new HashSet<QName>();
+
+ for (String name : windowBinding.getQnames())
+ {
+ qnames.add(QName.valueOf(name));
+ }
+
+ buildContext.getCoordinationConfigurator().setAliasBinding(page, windowBinding.getName(), qnames);
+ }
+
for (CoordinationEventWiringMetaData wiring : wirings)
{
Map<Window, QName> sources = new HashMap<Window,QName>();
@@ -175,22 +199,22 @@
}
}
- public ImplicitStrategy getEventStrategy()
+ public CoordinationStrategy getEventStrategy()
{
return eventStrategy;
}
- public void setEventStrategy(ImplicitStrategy eventStrategy)
+ public void setEventStrategy(CoordinationStrategy eventStrategy)
{
this.eventStrategy = eventStrategy;
}
- public ImplicitStrategy getParameterStrategy()
+ public CoordinationStrategy getParameterStrategy()
{
return parameterStrategy;
}
- public void setParameterStrategy(ImplicitStrategy parameterStrategy)
+ public void setParameterStrategy(CoordinationStrategy parameterStrategy)
{
this.parameterStrategy = parameterStrategy;
}
@@ -210,20 +234,33 @@
this.wirings.add(wiring);
}
- public List<CoordinationParameterBindingMetaData> getParameterBindings()
+ public List<CoordinationWindowBindingMetaData> getWindowBindings()
{
- return parameterBindings;
+ return windowBindings;
}
- public void setParameterBindings(List<CoordinationParameterBindingMetaData> parameterBindings)
+ public void setWindowBindings(List<CoordinationWindowBindingMetaData> windowBindings)
{
- this.parameterBindings = parameterBindings;
+ this.windowBindings = windowBindings;
}
- public void addParameterBinding(CoordinationParameterBindingMetaData binding)
+ public void addWindowBinding(CoordinationWindowBindingMetaData binding)
{
- this.parameterBindings.add(binding);
+ this.windowBindings.add(binding);
}
+ public List<CoordinationAliasBindingMetaData> getAliasBindings()
+ {
+ return aliasBindings;
+ }
+ public void setAliasBindings(List<CoordinationAliasBindingMetaData> aliasBindings)
+ {
+ this.aliasBindings = aliasBindings;
+ }
+
+ public void addAliasBinding(CoordinationAliasBindingMetaData aliasBinding)
+ {
+ this.aliasBindings.add(aliasBinding);
+ }
}
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationParameterBindingMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationParameterBindingMetaData.java 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationParameterBindingMetaData.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -1,88 +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.metadata.coordination;
-
-import org.w3c.dom.Element;
-import org.jboss.portal.common.xml.XMLTools;
-
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class CoordinationParameterBindingMetaData
-{
- private String name;
-
- List<CoordinationWindowMetaData> windows = new LinkedList<CoordinationWindowMetaData>();
-
- public CoordinationParameterBindingMetaData(String name)
- {
- this.name = name;
- }
-
- public List<CoordinationWindowMetaData> getWindows()
- {
- return windows;
- }
-
- public void setWindows(List<CoordinationWindowMetaData> windows)
- {
- this.windows = windows;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public void addWindow(CoordinationWindowMetaData window)
- {
- windows.add(window);
- }
-
- public static CoordinationParameterBindingMetaData buildMetaData(Element bindingElement)
- {
- Element nameElt = XMLTools.getUniqueChild(bindingElement, "name", true);
- CoordinationParameterBindingMetaData paramMetaData = new CoordinationParameterBindingMetaData(XMLTools.asString(nameElt));
-
- Iterator windowIter = XMLTools.getChildrenIterator(bindingElement, "window-coordination");
-
- while (windowIter.hasNext())
- {
- Element element = (Element)windowIter.next();
-
- paramMetaData.addWindow(CoordinationWindowMetaData.buildMetaData(element));
- }
-
- return paramMetaData;
- }
-}
Copied: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationWindowBindingMetaData.java (from rev 11539, branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationParameterBindingMetaData.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationWindowBindingMetaData.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationWindowBindingMetaData.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -0,0 +1,88 @@
+/*
+* 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.metadata.coordination;
+
+import org.w3c.dom.Element;
+import org.jboss.portal.common.xml.XMLTools;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class CoordinationWindowBindingMetaData
+{
+ private String name;
+
+ List<CoordinationWindowMetaData> windows = new LinkedList<CoordinationWindowMetaData>();
+
+ public CoordinationWindowBindingMetaData(String name)
+ {
+ this.name = name;
+ }
+
+ public List<CoordinationWindowMetaData> getWindows()
+ {
+ return windows;
+ }
+
+ public void setWindows(List<CoordinationWindowMetaData> windows)
+ {
+ this.windows = windows;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void addWindow(CoordinationWindowMetaData window)
+ {
+ windows.add(window);
+ }
+
+ public static CoordinationWindowBindingMetaData buildMetaData(Element bindingElement)
+ {
+ Element nameElt = XMLTools.getUniqueChild(bindingElement, "name", true);
+ CoordinationWindowBindingMetaData paramMetaData = new CoordinationWindowBindingMetaData(XMLTools.asString(nameElt));
+
+ Iterator windowIter = XMLTools.getChildrenIterator(bindingElement, "window-coordination");
+
+ while (windowIter.hasNext())
+ {
+ Element element = (Element)windowIter.next();
+
+ paramMetaData.addWindow(CoordinationWindowMetaData.buildMetaData(element));
+ }
+
+ return paramMetaData;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java 2008-07-22 16:57:35 UTC (rev 11544)
@@ -28,9 +28,11 @@
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.controller.coordination.ImplicitStrategy;
+import org.jboss.portal.core.controller.coordination.CoordinationStrategy;
import org.jboss.portal.core.controller.coordination.EventWiringInfo;
import org.jboss.portal.core.controller.coordination.ParameterBindingInfo;
+import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
+import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.impl.coordination.CoordinationService;
import org.apache.log4j.Appender;
@@ -44,6 +46,7 @@
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
+import java.util.HashSet;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -109,55 +112,55 @@
Page page_1 = portal_1.getPage("Page_1");
- assertNull(cos.getImplicitEventWiringStrategy(page_1));
- assertNull(cos.getImplicitParameterBindingStrategy(page_1));
+ assertNull(cos.getEventWiringStrategy(page_1));
+ assertNull(cos.getParameterBindingStrategy(page_1));
- cos.setImplicitEventWiringStrategy(page_1, ImplicitStrategy.EXCLUSIVE);
+ cos.setEventWiringStrategy(page_1, CoordinationStrategy.IMPLICIT);
- assertEquals(ImplicitStrategy.EXCLUSIVE, cos.getImplicitEventWiringStrategy(page_1));
- assertNull(cos.getImplicitParameterBindingStrategy(page_1));
+ assertEquals(CoordinationStrategy.IMPLICIT, cos.getEventWiringStrategy(page_1));
+ assertNull(cos.getParameterBindingStrategy(page_1));
- cos.setImplicitParameterBindingStrategy(page_1, ImplicitStrategy.DISABLED);
+ cos.setParameterBindingStrategy(page_1, CoordinationStrategy.EXPLICIT);
- assertEquals(ImplicitStrategy.EXCLUSIVE, cos.getImplicitEventWiringStrategy(page_1));
- assertEquals(ImplicitStrategy.DISABLED, cos.getImplicitParameterBindingStrategy(page_1));
+ assertEquals(CoordinationStrategy.IMPLICIT, cos.getEventWiringStrategy(page_1));
+ assertEquals(CoordinationStrategy.EXPLICIT, cos.getParameterBindingStrategy(page_1));
- cos.setImplicitEventWiringStrategy(page_1, null);
- cos.setImplicitParameterBindingStrategy(page_1, null);
- cos.setImplicitEventWiringStrategy(portal_1, ImplicitStrategy.RECURSIVE_EXCLUSIVE);
- cos.setImplicitParameterBindingStrategy(portal_1, ImplicitStrategy.RECURSIVE_FALLBACK);
+ cos.setEventWiringStrategy(page_1, null);
+ cos.setParameterBindingStrategy(page_1, null);
+ cos.setEventWiringStrategy(portal_1, CoordinationStrategy.RECURSIVE_IMPLICIT);
+ cos.setParameterBindingStrategy(portal_1, CoordinationStrategy.RECURSIVE_FALLBACK);
- assertEquals(null, cos.getImplicitEventWiringStrategy(page_1));
- assertEquals(null, cos.getImplicitParameterBindingStrategy(page_1));
- assertEquals(ImplicitStrategy.RECURSIVE_EXCLUSIVE, cos.getImplicitEventWiringStrategy(portal_1));
- assertEquals(ImplicitStrategy.RECURSIVE_FALLBACK, cos.getImplicitParameterBindingStrategy(portal_1));
+ assertEquals(null, cos.getEventWiringStrategy(page_1));
+ assertEquals(null, cos.getParameterBindingStrategy(page_1));
+ assertEquals(CoordinationStrategy.RECURSIVE_IMPLICIT, cos.getEventWiringStrategy(portal_1));
+ assertEquals(CoordinationStrategy.RECURSIVE_FALLBACK, cos.getParameterBindingStrategy(portal_1));
// Resolve
- assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitEventWiringStrategy(page_1));
- assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitEventWiringStrategy(portal_1));
- assertEquals(ImplicitStrategy.FALLBACK, cos.resolveImplicitBindingStrategy(page_1));
- assertEquals(ImplicitStrategy.FALLBACK, cos.resolveImplicitBindingStrategy(portal_1));
+ assertEquals(CoordinationStrategy.IMPLICIT, cos.resolveEventWiringStrategy(page_1));
+ assertEquals(CoordinationStrategy.IMPLICIT, cos.resolveEventWiringStrategy(portal_1));
+ assertEquals(CoordinationStrategy.FALLBACK, cos.resolveBindingStrategy(page_1));
+ assertEquals(CoordinationStrategy.FALLBACK, cos.resolveBindingStrategy(portal_1));
// Inheritance and overriding value in the middle of the tree
Page page_1_1 = page_1.getPage("Page_1");
- cos.setImplicitEventWiringStrategy(portal_1, ImplicitStrategy.RECURSIVE_EXCLUSIVE);
- cos.setImplicitEventWiringStrategy(page_1, ImplicitStrategy.DISABLED);
- cos.setImplicitEventWiringStrategy(page_1_1, null);
+ cos.setEventWiringStrategy(portal_1, CoordinationStrategy.RECURSIVE_IMPLICIT);
+ cos.setEventWiringStrategy(page_1, CoordinationStrategy.EXPLICIT);
+ cos.setEventWiringStrategy(page_1_1, null);
- cos.setImplicitParameterBindingStrategy(portal_1, ImplicitStrategy.RECURSIVE_FALLBACK);
- cos.setImplicitParameterBindingStrategy(page_1, ImplicitStrategy.EXCLUSIVE);
- cos.setImplicitParameterBindingStrategy(page_1_1, null);
+ cos.setParameterBindingStrategy(portal_1, CoordinationStrategy.RECURSIVE_FALLBACK);
+ cos.setParameterBindingStrategy(page_1, CoordinationStrategy.IMPLICIT);
+ cos.setParameterBindingStrategy(page_1_1, null);
- assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitEventWiringStrategy(page_1_1));
- assertEquals(ImplicitStrategy.DISABLED, cos.resolveImplicitEventWiringStrategy(page_1));
- assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitEventWiringStrategy(portal_1));
+ assertEquals(CoordinationStrategy.IMPLICIT, cos.resolveEventWiringStrategy(page_1_1));
+ assertEquals(CoordinationStrategy.EXPLICIT, cos.resolveEventWiringStrategy(page_1));
+ assertEquals(CoordinationStrategy.IMPLICIT, cos.resolveEventWiringStrategy(portal_1));
- assertEquals(ImplicitStrategy.FALLBACK, cos.resolveImplicitBindingStrategy(page_1_1));
- assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitBindingStrategy(page_1));
- assertEquals(ImplicitStrategy.FALLBACK, cos.resolveImplicitBindingStrategy(portal_1));
+ assertEquals(CoordinationStrategy.FALLBACK, cos.resolveBindingStrategy(page_1_1));
+ assertEquals(CoordinationStrategy.IMPLICIT, cos.resolveBindingStrategy(page_1));
+ assertEquals(CoordinationStrategy.FALLBACK, cos.resolveBindingStrategy(portal_1));
TransactionAssert.commitTransaction();
@@ -235,7 +238,7 @@
TransactionAssert.commitTransaction();
}
- public void testParameterBinding() throws Exception
+ public void testWindowBinding() throws Exception
{
TransactionAssert.beginTransaction();
@@ -256,9 +259,9 @@
ws.put(w2, new QName("juju", "foo1"));
ws.put(w4, new QName("juju", "foo3"));
- cos.setParameterBinding("binding1", ws);
+ cos.setWindowBinding("binding1", ws);
- Collection<ParameterBindingInfo> bindings = cos.getParameterBindings(page1);
+ Collection<WindowBindingInfo> bindings = cos.getWindowBindings(page1);
assertEquals(1, bindings.size());
@@ -270,9 +273,9 @@
assertTrue(windows.containsKey(w2));
assertTrue(windows.containsKey(w4));
- cos.removeParameterBinding(bindings.iterator().next());
+ cos.removeWindowBinding(bindings.iterator().next());
- bindings = cos.getParameterBindings(w1);
+ bindings = cos.getWindowBindings(w1);
assertEquals(0, bindings.size());
@@ -280,6 +283,101 @@
TransactionAssert.commitTransaction();
}
+ public void testAliasBinding() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+
+ Portal portal1 = container.getContext("").getPortal("Portal_1");
+ Page page1 = portal1.getPage("Page_1");
+ Page page2 = portal1.getPage("Page_2");
+
+ QName qname1 = new QName("nm1", "local1");
+ QName qname2 = new QName("nm2", "local2");
+ QName qname3 = new QName("nm3", "local3");
+ QName qname4 = new QName("nm4", "local4");
+ QName qname5 = new QName("nm5", "local5");
+ QName qname6 = new QName("nm6", "local6");
+ QName qname7 = new QName("nm7", "local7");
+ QName qname8 = new QName("nm8", "local8");
+ QName qname9 = new QName("nm9", "local9");
+
+ HashSet<QName> qnames1 = new HashSet<QName>();
+ qnames1.add(qname1);
+ qnames1.add(qname2);
+ qnames1.add(qname3);
+
+ HashSet<QName> qnames2 = new HashSet<QName>();
+ qnames2.add(qname4);
+ qnames2.add(qname5);
+ qnames2.add(qname6);
+
+ HashSet<QName> qnames3 = new HashSet<QName>();
+ qnames3.add(qname7);
+ qnames3.add(qname8);
+ qnames3.add(qname9);
+
+ cos.setAliasBinding(page1, "alias1", qnames1);
+ cos.setAliasBinding(page2, "alias2", qnames2);
+ cos.setAliasBinding(page2, "alias3", qnames3);
+
+ Collection<AliasBindingInfo> bindings1 = cos.getAliasBindings(page1);
+
+ assertTrue(bindings1.size() == 1);
+ AliasBindingInfo info = bindings1.iterator().next();
+
+ assertTrue(info.getName().equals("alias1"));
+ assertTrue(info.getPage().getId().equals(page1.getId()));
+ assertTrue(info.getQNames().size() == 3);
+ assertTrue(info.getQNames().contains(qname1));
+ assertTrue(info.getQNames().contains(qname2));
+ assertTrue(info.getQNames().contains(qname3));
+
+ cos.removeAliasBinding(info);
+ assertTrue(cos.getAliasBindings(page1).size() == 0);
+
+ AliasBindingInfo info2 = null;
+ AliasBindingInfo info3 = null;
+
+ Collection<AliasBindingInfo> bindings2 = cos.getAliasBindings(page2);
+
+ assertTrue(bindings2.size() == 2);
+
+ for (AliasBindingInfo aliasBindingInfo : bindings2)
+ {
+ if (aliasBindingInfo.getName().equals("alias2"))
+ {
+ info2 = aliasBindingInfo;
+ }
+ if (aliasBindingInfo.getName().equals("alias3"))
+ {
+ info3 = aliasBindingInfo;
+ }
+
+ }
+
+
+ assertNotNull(info2);
+ assertNotNull(info3);
+
+ assertTrue(info2.getName().equals("alias2"));
+ assertTrue(info2.getPage().getId().equals(page2.getId()));
+ assertTrue(info2.getQNames().size() == 3);
+ assertTrue(info2.getQNames().contains(qname4));
+ assertTrue(info2.getQNames().contains(qname5));
+ assertTrue(info2.getQNames().contains(qname6));
+
+ assertTrue(info3.getName().equals("alias3"));
+ assertTrue(info3.getPage().getId().equals(page2.getId()));
+ assertTrue(info3.getQNames().size() == 3);
+ assertTrue(info3.getQNames().contains(qname7));
+ assertTrue(info3.getQNames().contains(qname8));
+ assertTrue(info3.getQNames().contains(qname9));
+
+
+
+ TransactionAssert.commitTransaction();
+ }
+
public CoordinationService getCos()
{
return cos;
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2008-07-22 16:57:35 UTC (rev 11544)
@@ -332,10 +332,10 @@
<!--
Configuration of explicit event and shared render parameter coordination
-->
-<!ELEMENT coordination (implicit-event-strategy?, implicit-parameter-strategy?, wirings?, bindings?)>
+<!ELEMENT coordination (event-strategy?, parameter-strategy?, wirings?, bindings?)>
<!--
-Implicit event distribution strategy. Allowed values are:
+Event distribution strategy. Allowed values are:
FALLBACK - Explicit wiring takes precedence and if none exist for a given event it will be processed with implicit wiring
EXCLUSIVE - Only implicit wiring enabled
@@ -344,19 +344,19 @@
RECURSIVE_EXCLUSIVE - All children nodes in the tree will inherit EXCLUSIVE strategy
RECURSIVE_DISABLED - All children nodes in the tree will inherit DISABLED strategy
-->
-<!ELEMENT implicit-event-strategy (#PCDATA)>
+<!ELEMENT event-strategy (#PCDATA)>
<!--
-Implicit parameter binding strategy. Allowed values are:
+Parameter binding strategy. Allowed values are:
FALLBACK - Explicit wiring takes precedence and if none exist for a given render parameter it will be processed with implicit wiring
-EXCLUSIVE - Only implicit wiring enabled
-DISABLED, - Implicit wiring disabled
+IMPLICIT - Only implicit wiring enabled
+EXPLICIT, - Implicit wiring disabled
RECURSIVE_FALLBACK - All children nodes in the tree will inherit FALLBACK strategy
-RECURSIVE_EXCLUSIVE - All children nodes in the tree will inherit EXCLUSIVE strategy
-RECURSIVE_DISABLED - All children nodes in the tree will inherit DISABLED strategy
+RECURSIVE_IMPLICIT - All children nodes in the tree will inherit IMPLICIT strategy
+RECURSIVE_EXPLICIT - All children nodes in the tree will inherit EXPLICIT strategy
-->
-<!ELEMENT implicit-parameter-strategy (#PCDATA)>
+<!ELEMENT parameter-strategy (#PCDATA)>
<!--
Event wirings. Can be defined only for a page
@@ -366,7 +366,7 @@
<!--
Shared render parameter bindings. Can be defined only for a page
-->
-<!ELEMENT bindings (parameter-binding*)>
+<!ELEMENT bindings (parameter-binding*, alias-binding*)>
<!--
This element defines explicit event wiring
@@ -388,7 +388,13 @@
-->
<!ELEMENT parameter-binding (name, window-coordination+)>
+
<!--
+Alias binding definition
+-->
+<!ELEMENT alias-binding (name, qname+)>
+
+<!--
This element defines window for coordination. It can be either source or destination window for event distribution or
participate in parameter binding
-->
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml 2008-07-22 13:40:07 UTC (rev 11543)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml 2008-07-22 16:57:35 UTC (rev 11544)
@@ -34,7 +34,7 @@
<page-name>Coordination Samples</page-name>
<page>
- <page-name>Events DISABLED</page-name>
+ <page-name>Events EXPLICIT</page-name>
<window>
<window-name>ShoppingCatalogPortletWindow1</window-name>
@@ -78,7 +78,7 @@
<coordination>
- <implicit-event-strategy>DISABLED</implicit-event-strategy>
+ <event-strategy>EXPLICIT</event-strategy>
<wirings>
<event-wiring>
<name>wiringA</name>
@@ -167,7 +167,7 @@
<coordination>
- <implicit-event-strategy>FALLBACK</implicit-event-strategy>
+ <event-strategy>FALLBACK</event-strategy>
<wirings>
<event-wiring>
<name>wiringA</name>
@@ -193,7 +193,7 @@
</page>
<page>
- <page-name>Events EXCLUSIVE</page-name>
+ <page-name>Events IMPLICIT</page-name>
<window>
<window-name>ShoppingCatalogPortletWindow1</window-name>
@@ -237,7 +237,7 @@
<coordination>
- <implicit-event-strategy>EXCLUSIVE</implicit-event-strategy>
+ <event-strategy>IMPLICIT</event-strategy>
<wirings>
<event-wiring>
<name>wiringA</name>
@@ -283,7 +283,7 @@
</page>
<page>
- <page-name>Parameters DISABLED</page-name>
+ <page-name>Parameters EXPLICIT</page-name>
<window>
<window-name>PublicParametersPortletWindowA1</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>
@@ -313,7 +313,7 @@
<coordination>
- <implicit-parameter-strategy>DISABLED</implicit-parameter-strategy>
+ <parameter-strategy>EXPLICIT</parameter-strategy>
<bindings>
<parameter-binding>
<name>binding1</name>
@@ -420,7 +420,7 @@
<coordination>
- <implicit-parameter-strategy>FALLBACK</implicit-parameter-strategy>
+ <parameter-strategy>FALLBACK</parameter-strategy>
<bindings>
<parameter-binding>
<name>binding1</name>
@@ -460,7 +460,7 @@
</coordination>
</page>
<page>
- <page-name>Parameters EXCLUSIVE</page-name>
+ <page-name>Parameters IMPLICIT</page-name>
<window>
<window-name>PublicParametersPortletWindowA1</window-name>
<instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>
@@ -490,7 +490,7 @@
<coordination>
- <implicit-parameter-strategy>EXCLUSIVE</implicit-parameter-strategy>
+ <parameter-strategy>IMPLICIT</parameter-strategy>
<bindings>
<parameter-binding>
<name>binding1</name>
15 years, 11 months
JBoss Portal SVN: r11543 - in modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax: client/model and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-22 09:40:07 -0400 (Tue, 22 Jul 2008)
New Revision: 11543
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/ContentFragment.java
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java
Log:
retrieves full content from a window (expiration+title+markup) instead of just the markup
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java 2008-07-22 13:19:51 UTC (rev 11542)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java 2008-07-22 13:40:07 UTC (rev 11543)
@@ -24,6 +24,7 @@
import com.google.gwt.user.client.rpc.RemoteService;
import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
+import org.jboss.portal.presentation.ajax.client.model.ContentFragment;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxRequest;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxResponse;
@@ -42,12 +43,12 @@
ModelUpdate[] getRoot();
/**
- * Renders the content of a window.
+ * Renders the content of a window into a fragment
*
* @param windowId the window id
* @return the window rendition
*/
- String render(String windowId);
+ ContentFragment render(String windowId);
/**
* Process an ajax request.
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-22 13:19:51 UTC (rev 11542)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-22 13:40:07 UTC (rev 11543)
@@ -36,6 +36,7 @@
import com.google.gwt.core.client.GWT;
import org.jboss.portal.presentation.ajax.client.PresentationClientRemoteAsync;
import org.jboss.portal.presentation.ajax.client.PresentationClientRemote;
+import org.jboss.portal.presentation.ajax.client.model.ContentFragment;
import org.jboss.portal.presentation.ajax.client.dnd.Draggable;
import org.jboss.portal.presentation.ajax.client.dnd.Droppable;
import org.jboss.portal.presentation.ajax.client.protocol.OpaqueWindowAction;
@@ -323,10 +324,11 @@
public void onSuccess(Object o)
{
- String content = (String)o;
+ ContentFragment content = (ContentFragment)o;
//
- markup.setHTML(content);
+ markup.setHTML(content.getMarkup());
+ title.setText(content.getTitle());
}
};
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/ContentFragment.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/ContentFragment.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/ContentFragment.java 2008-07-22 13:40:07 UTC (rev 11543)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.presentation.ajax.client.model;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContentFragment implements IsSerializable
+{
+
+ /** . */
+ private long expirationMillis;
+
+ /** . */
+ private String title;
+
+ /** . */
+ private String markup;
+
+
+ public ContentFragment(long expirationMillis, String title, String markup)
+ {
+ this.expirationMillis = expirationMillis;
+ this.title = title;
+ this.markup = markup;
+ }
+
+ public ContentFragment()
+ {
+ }
+
+ public long getExpirationMillis()
+ {
+ return expirationMillis;
+ }
+
+ public void setExpirationMillis(long expirationMillis)
+ {
+ this.expirationMillis = expirationMillis;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public String getMarkup()
+ {
+ return markup;
+ }
+
+ public void setMarkup(String markup)
+ {
+ this.markup = markup;
+ }
+}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-07-22 13:19:51 UTC (rev 11542)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-07-22 13:40:07 UTC (rev 11543)
@@ -72,8 +72,6 @@
public class PresentationClientServlet extends RemoteServiceServlet implements PresentationClientRemote
{
-
-
public void init() throws ServletException
{
super.init();
@@ -118,7 +116,7 @@
return new PresentationClientImpl(req, dispatcher, encoder);
}
- public String render(String windowId)
+ public org.jboss.portal.presentation.ajax.client.model.ContentFragment render(String windowId)
{
PresentationClient client = createPresentationClient();
PresentationServer server = getPresentationServer();
@@ -127,11 +125,22 @@
try
{
ContentFragment fragment = server.renderWindow(client, windowId);
- return fragment.getMarkup();
+
+ //
+ return new org.jboss.portal.presentation.ajax.client.model.ContentFragment(
+ fragment.getExpirationMillis(),
+ fragment.getTitle(),
+ fragment.getMarkup()
+ );
}
catch (PresentationServerException e)
{
- return "An error occured";
+ // todo : improve that
+ return new org.jboss.portal.presentation.ajax.client.model.ContentFragment(
+ 0,
+ "Error",
+ "An error occured"
+ );
}
}
15 years, 11 months