JBoss Portal SVN: r5736 - in trunk/core/src: main/org/jboss/portal/core/portlet/dashboard resources/portal-core-war/WEB-INF/jsp/dashboard
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-11-28 12:21:10 -0500 (Tue, 28 Nov 2006)
New Revision: 5736
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
Log:
JBPORTAL-1143
- Added dynamic region handling for window assignment
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-28 14:10:12 UTC (rev 5735)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-28 17:21:10 UTC (rev 5736)
@@ -115,45 +115,24 @@
}
List available_instances = (List)instanceContainer.getInstances();
- List left_instances = new ArrayList();
- List center_instances = new ArrayList();
- List right_instances = new ArrayList();
+ resp.setContentType("text/html");
try
{
Map windowMap = getWindows(page);
+
List regions = new ArrayList(windowMap.keySet());
Collections.sort(regions);
- for (Iterator i = regions.iterator(); i.hasNext();)
- {
- String region = (String)i.next();
-
- TreeSet windows = (TreeSet)windowMap.get(region);
- for (Iterator j = windows.iterator(); j.hasNext();)
- {
- Window window = (Window)j.next();
- if (region.equals("left"))
- {
- left_instances.add(window);
- //System.out.println(window.getInstanceRef() + ":" + window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER));
- }
- else if (region.equals("center"))
- {
- center_instances.add(window);
- }
- else if (region.equals("right"))
- {
- right_instances.add(window);
- }
- }
- }
+ req.setAttribute("windowMap", windowMap);
+ req.setAttribute("regions", regions);
}
catch (Exception e)
{
e.printStackTrace();
}
+ // page select box
List pages = new ArrayList();
for (Iterator j = page.getPortal().getChildren().iterator(); j.hasNext();)
{
@@ -164,13 +143,10 @@
}
}
- resp.setContentType("text/html");
req.setAttribute("available_instances", available_instances);
- req.setAttribute("left_instances", left_instances);
- req.setAttribute("center_instances", center_instances);
- req.setAttribute("right_instances", right_instances);
req.setAttribute("pages", pages);
req.setAttribute("currentPage", page.getName());
+
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/dashboard/editpage.jsp");
rd.include(req, resp);
}
@@ -215,20 +191,26 @@
{
String fromRegion = actionRequest.getParameter("fromRegion");
String[] removeWindows = null;
- if ("left".equals(fromRegion))
+
+ Page page = portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
+ try
{
- removeWindows = actionRequest.getParameterValues("left_instances");
+ Map windowMap = getWindows(page);
+ List regions = new ArrayList(windowMap.keySet());
+ for (int i = 0; i < regions.size(); i++)
+ {
+ String region = (String)regions.get(i);
+ if (region.equalsIgnoreCase(fromRegion))
+ {
+ removeWindows = actionRequest.getParameterValues(region + "_instances");
+ }
+ }
}
- else if ("center".equals(fromRegion))
+ catch (Exception e)
{
- removeWindows = actionRequest.getParameterValues("center_instances");
+ // todo
}
- else if ("right".equals(fromRegion))
- {
- removeWindows = actionRequest.getParameterValues("right_instances");
- }
- Page page = portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
try
{
for (int i = 0; i < removeWindows.length; i++)
@@ -246,20 +228,26 @@
{
String sortRegion = actionRequest.getParameter("sortRegion");
String[] moveWindows = null;
- if ("left".equals(sortRegion))
+
+ Page page = portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
+ try
{
- moveWindows = actionRequest.getParameterValues("left_instances");
+ Map windowMap = getWindows(page);
+ List regions = new ArrayList(windowMap.keySet());
+ for (int i = 0; i < regions.size(); i++)
+ {
+ String region = (String)regions.get(i);
+ if (region.equalsIgnoreCase(sortRegion))
+ {
+ moveWindows = actionRequest.getParameterValues(region + "_instances");
+ }
+ }
}
- else if ("center".equals(sortRegion))
+ catch (Exception e)
{
- moveWindows = actionRequest.getParameterValues("center_instances");
+ // todo
}
- else if ("right".equals(sortRegion))
- {
- moveWindows = actionRequest.getParameterValues("right_instances");
- }
- Page page = portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
for (int i = 0; i < moveWindows.length; i++)
{
Window window = page.getWindow(moveWindows[i]);
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2006-11-28 14:10:12 UTC (rev 5735)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2006-11-28 17:21:10 UTC (rev 5736)
@@ -1,7 +1,12 @@
<%@ page import="org.jboss.portal.core.model.instance.Instance" %>
<%@ page import="org.jboss.portal.core.model.portal.Page" %>
<%@ page import="org.jboss.portal.core.model.portal.Window" %>
+<%@ page import="java.util.ArrayList" %>
+<%@ page import="java.util.Collections" %>
+<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="java.util.TreeSet" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
@@ -15,6 +20,10 @@
List center_instances = (List)request.getAttribute("center_instances");
List right_instances = (List)request.getAttribute("right_instances");
List pages = (List)request.getAttribute("pages");
+
+ //List regions = (List)request.getAttribute("regions");
+ Map windowMap = (Map)request.getAttribute("windowMap");
+
String currentPage = (String)request.getAttribute("currentPage");
%>
@@ -87,133 +96,95 @@
</td>
</tr>
<tr>
-<td>
-<form action="<portlet:actionURL>
+ <td>
+ <form action="<portlet:actionURL>
</portlet:actionURL>" name="instancesForm" method="POST" onsubmit="debug();">
-<input type="hidden" name="op"/>
-<input type="hidden" name="toRegion"/>
-<input type="hidden" name="fromRegion"/>
-<input type="hidden" name="sortRegion"/>
-<input type="hidden" name="editPageSelect" value="<%= currentPage %>"/>
-<table width="100%">
-<tr>
-<td valign="top" class="portlet-section-alternate" width="250">
- <table>
- <tr>
- <td valign="top">
- <b>Title and Layout</b>
- <br/>
- Title the page and select the number of columns for the layout
- <hr/>
- <b>Page Title:</b><br/>
- <input type="text" class="portlet-form-input-field" name="pagename">
- <br/>
- <input type="submit" name="save" value="Save" class="portlet-form-button" onclick="newPage('newpage');"/>
- </td>
- </tr>
- </table>
-</td>
-<td class="portlet-section-body" valign="top" align="right"><b>Available Content</b><br/>
- <select name="available_instances" multiple="true" size="20">
- <%
- for (int i = 0; i < available_instances.size(); i++)
- {
- Instance instance = (Instance)available_instances.get(i);
- %>
- <option value="<%= instance.getId() %>"><%= instance.getId()%>
- </option>
- <%
- }
- %>
- </select>
-</td>
-<td>
-<table>
- <tr>
- <td>
- <input type="submit" class="portlet-form-button" name=">" value=">"
- onclick="assignPortlet('copy','left');"/><br/><input
- type="submit" class="portlet-form-button" name="<" value="<"
- onclick="unassignPortlet('remove','left');"/></td>
- <td class="portlet-section-body" valign="top">
- <b>Left Column</b><br/>
- <select name="left_instances" multiple="true" size="6">
- <%
- for (int i = 0; i < left_instances.size(); i++)
- {
- Window window = (Window)left_instances.get(i);
- %>
- <option value="<%= window.getName() %>"><%= window.getInstanceRef() %>
- </option>
- <%
- }
- %>
- </select>
- </td>
- <td>
- <input type="submit" class="portlet-form-button" name="Up" value="Up"
- onclick="sortPortlet('up','left');"/><br/><input
- type="submit" class="portlet-form-button" name="Down" value="Down"
- onclick="sortPortlet('down','left');"/>
- </td>
- </tr>
- <tr>
- <td>
- <input type="submit" class="portlet-form-button" name=">" value=">"
- onclick="assignPortlet('copy','center');"/><br/><input
- type="submit" class="portlet-form-button" name="<" value="<"
- onclick="unassignPortlet('remove','center');"/></td>
- <td class="portlet-section-body" valign="top"><b>Middle Column</b><br/>
- <select name="center_instances" multiple="true" size="6">
- <%
- for (int i = 0; i < center_instances.size(); i++)
- {
- Window window = (Window)center_instances.get(i);
- %>
- <option value="<%= window.getName() %>"><%= window.getInstanceRef() %>
- </option>
- <%
- }
- %>
- </select></td>
- <td>
- <input type="submit" class="portlet-form-button" name="Up" value="Up"
- onclick="sortPortlet('up','center');"/><br/><input
- type="submit" class="portlet-form-button" name="Down" value="Down"
- onclick="sortPortlet('down','center');"/></td>
- </tr>
- <tr>
- <td>
- <input type="submit" class="portlet-form-button" name=">" value=">"
- onclick="assignPortlet('copy','right');"/><br/><input
- type="submit" class="portlet-form-button" name="<" value="<"
- onclick="unassignPortlet('remove','right');"/></td>
- <td class="portlet-section-body" valign="top"><b>Right Column</b><br/>
- <select name="right_instances" multiple="true" size="6">
- <%
- for (int i = 0; i < right_instances.size(); i++)
- {
- Window window = (Window)right_instances.get(i);
- %>
- <option value="<%= window.getName() %>"><%= window.getInstanceRef() %>
- </option>
- <%
- }
- %>
- </select></td>
- <td>
- <input type="submit" class="portlet-form-button" name="Up" value="Up"
- onclick="sortPortlet('up','right');"/><br/><input
- type="submit" class="portlet-form-button" name="Down" value="Down"
- onclick="sortPortlet('down','right');"/></td>
- </tr>
-</table>
+ <input type="hidden" name="op"/>
+ <input type="hidden" name="toRegion"/>
+ <input type="hidden" name="fromRegion"/>
+ <input type="hidden" name="sortRegion"/>
+ <input type="hidden" name="editPageSelect" value="<%= currentPage %>"/>
+ <table width="100%">
+ <tr>
+ <td valign="top" class="portlet-section-alternate" width="250">
+ <table>
+ <tr>
+ <td valign="top">
+ <b>Title and Layout</b>
+ <br/>
+ Title the page and select the number of columns for the layout
+ <hr/>
+ <b>Page Title:</b><br/>
+ <input type="text" class="portlet-form-input-field" name="pagename">
+ <br/>
+ <input type="submit" name="save" value="Save" class="portlet-form-button"
+ onclick="newPage('newpage');"/>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td class="portlet-section-body" valign="top" align="right"><b>Available Content</b><br/>
+ <select name="available_instances" multiple="true" size="20">
+ <%
+ for (int i = 0; i < available_instances.size(); i++)
+ {
+ Instance instance = (Instance)available_instances.get(i);
+ %>
+ <option value="<%= instance.getId() %>"><%= instance.getId()%>
+ </option>
+ <%
+ }
+ %>
+ </select>
+ </td>
+ <td>
+ <table>
+ <%
+ List regions = new ArrayList(windowMap.keySet());
+ Collections.sort(regions);
+ for (Iterator i = regions.iterator(); i.hasNext();)
+ {
+ String region = (String)i.next();
+ TreeSet windows = (TreeSet)windowMap.get(region);
+ %>
+ <tr>
+ <td>
+ <input type="submit" class="portlet-form-button" name=">" value=">"
+ onclick="assignPortlet('copy','<%= region %>');"/><br/><input
+ type="submit" class="portlet-form-button" name="<" value="<"
+ onclick="unassignPortlet('remove','<%= region %>');"/></td>
+ <td class="portlet-section-body" valign="top">
+ <b><%= region %> Column</b><br/>
+ <select name="<%= region %>_instances" multiple="true" size="6">
+ <%
+ for (Iterator j = windows.iterator(); j.hasNext();)
+ {
+ Window window = (Window)j.next();
+ %>
+ <option value="<%= window.getName() %>"><%= window.getInstanceRef() %>
+ </option>
+ <%
+ }
+ %>
+ </select>
+ </td>
+ <td>
+ <input type="submit" class="portlet-form-button" name="Up" value="Up"
+ onclick="sortPortlet('up','<%= region %>');"/><br/><input
+ type="submit" class="portlet-form-button" name="Down" value="Down"
+ onclick="sortPortlet('down','<%= region %>');"/>
+ </td>
+ </tr>
+ <%
+ }
+ %>
+ </table>
+ </tr>
+ </table>
+ </form>
+ </td>
</tr>
</table>
-</form>
</td>
</tr>
-</table>
-</td>
-</tr>
</table>
\ No newline at end of file
17 years, 5 months
JBoss Portal SVN: r5735 - in trunk/core/src/main/org/jboss/portal/core: controller/ajax controller/classic controller/command/info model/portal/command
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-28 09:10:12 -0500 (Tue, 28 Nov 2006)
New Revision: 5735
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
Log:
- fixed redirect on https when a portlet declares transport garantees that mandates it
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2006-11-28 11:54:55 UTC (rev 5734)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2006-11-28 14:10:12 UTC (rev 5735)
@@ -48,34 +48,29 @@
if (response instanceof PageRendition && cmd instanceof RenderPageCommand)
{
RenderPageCommand rpc = (RenderPageCommand)cmd;
- PageRendition rendition = (PageRendition)response;
- Map pageProps = rendition.getPageResult().getPageProperties();
-
- //
- pageProps.put(ThemeConstants.PORTAL_AJAX_JAVASCRIPT_BASE, "/portal-ajax");
-
// If user is logged in and is on dashboard we enable ajax
- if (cmd.getControllerContext().getServerInvocation().getServerContext().getClientRequest().getRemoteUser() != null)
+ if (rpc.getControllerContext().getServerInvocation().getServerContext().getClientRequest().getRemoteUser() != null &&
+ rpc.isDashboard())
{
- if (rpc.isDashboard())
+ // Compute the url for the ajax servlet
+ HttpServletRequest req = cmd.getControllerContext().getServerInvocation().getServerContext().getClientRequest();
+ StringBuffer url = new StringBuffer();
+ url.append(req.getScheme()).append("://");
+ url.append(req.getServerName());
+ if (("http".equals(req.getScheme()) && req.getServerPort() != 80) || ("https".equals(req.getScheme()) && req.getServerPort() != 443))
{
- pageProps.put(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED, "true");
+ url.append(':').append(req.getServerPort());
}
- }
+ url.append(req.getContextPath()).append("/ajax");
- // Compute the url for the ajax servlet
- HttpServletRequest req = cmd.getControllerContext().getServerInvocation().getServerContext().getClientRequest();
- StringBuffer url = new StringBuffer();
- url.append(req.getScheme()).append("://");
- url.append(req.getServerName());
- if (("http".equals(req.getScheme()) && req.getServerPort() != 80) || ("https".equals(req.getScheme()) && req.getServerPort() != 443))
- {
- url.append(':').append(req.getServerPort());
+ //
+ PageRendition rendition = (PageRendition)response;
+ Map pageProps = rendition.getPageResult().getPageProperties();
+ pageProps.put(ThemeConstants.PORTAL_AJAX_JAVASCRIPT_BASE, "/portal-ajax");
+ pageProps.put(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED, "true");
+ pageProps.put(ThemeConstants.PORTAL_AJAX_REMOTE_URL, url.toString());
}
- url.append(req.getContextPath()).append("/ajax");
-
- pageProps.put(ThemeConstants.PORTAL_AJAX_REMOTE_URL, url.toString());
}
//
Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2006-11-28 11:54:55 UTC (rev 5734)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2006-11-28 14:10:12 UTC (rev 5735)
@@ -103,7 +103,7 @@
}
// Find out if we can execute in the same server invocation
- if (requiresRedirect(urlContext, cmd, invocation))
+ if (requiresRedirect(urlContext, forward))
{
String url = ctx.renderURL(forward.getCommand(), forward.getURLContext(), null);
if (url == null)
@@ -172,24 +172,25 @@
return null;
}
- public boolean requiresRedirect(URLContext urlCtx, ControllerCommand cmd, ServerInvocation invocation)
+ public boolean requiresRedirect(URLContext currentURLCtx, CommandForward forward)
{
- CommandInfo cmdInfo = cmd.getInfo();
+ CommandInfo cmdInfo = forward.getCommand().getInfo();
+ URLContext nextURLCtx = forward.getURLContext();
if (cmdInfo instanceof ActionCommandInfo && !((ActionCommandInfo)cmdInfo).isIdempotent())
{
return true;
}
else
{
- boolean currentAuthenticated = invocation.getServerContext().getURLContext().isAuthenticated();
- if (urlCtx != null && currentAuthenticated != urlCtx.isAuthenticated())
+ boolean currentAuthenticated = currentURLCtx.isAuthenticated();
+ if (nextURLCtx != null && currentAuthenticated != nextURLCtx.isAuthenticated())
{
return true;
}
else
{
- boolean currentSecure = invocation.getServerContext().getURLContext().getSecure();
- if (urlCtx != null && urlCtx.getSecure() && !currentSecure)
+ boolean currentSecure = currentURLCtx.getSecure();
+ if (nextURLCtx != null && nextURLCtx.getSecure() && !currentSecure)
{
return true;
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java 2006-11-28 11:54:55 UTC (rev 5734)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/info/CommandInfo.java 2006-11-28 14:10:12 UTC (rev 5735)
@@ -55,7 +55,7 @@
return secured;
}
- /** @return the associated action of this command for security checks (is the user allowed to call this action...) */
+ /** @return the associated action of this command for security checks (is the user allowed to call this action...). */
public String getAction()
{
return action;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-11-28 11:54:55 UTC (rev 5734)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-11-28 14:10:12 UTC (rev 5735)
@@ -424,7 +424,6 @@
String contentChars = "";
String headerChars = null;
Map actionMap = new HashMap();
- Properties responseProps;
Map windowProps = window.getDeclaredProperties();
String navStateKey = window.getId() + "_window";
@@ -438,18 +437,10 @@
try
{
RenderPortletWindowCommand renderCmd = new RenderPortletWindowCommand(windowRef);
-
- //
PortletResponse portletResponse = (PortletResponse)context.execute(renderCmd);
PortletInvocationResponse response = portletResponse.getResult();
//
- if (response instanceof InsufficientTransportGuaranteeResponse)
- {
- return response;
- }
-
- //
if (response instanceof FragmentResponse)
{
FragmentResponse fragment = (FragmentResponse)response;
@@ -459,8 +450,6 @@
windowTitle = window.getName();
}
headerChars = fragment.getHeader();
-// responseProps = fragment.getProperties();
- responseProps = new Properties(); // remove me
//
Instance instance = renderCmd.getInstance();
@@ -505,7 +494,15 @@
contentChars = fragment.getContent();
//
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(
+ windowTitle,
+ contentChars,
+ actionMap,
+ windowProps,
+ new Properties(),
+ headerChars,
+ windowNavState.getWindowState(),
+ windowNavState.getMode());
}
else if (response instanceof ErrorResponse)
{
@@ -516,14 +513,13 @@
if (!HIDE.equals(property))
{
windowTitle = "An error occured while rendering window '" + windowRef + "'";
- responseProps = new Properties();
contentChars = errorResult.getMessage();
Throwable t = errorResult.getThrowable();
if (t != null && SHOW.equals(property))
{
contentChars = Exceptions.toHTML(t, true);
}
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, new Properties(), headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
else if (response instanceof UnavailableResponse)
@@ -535,8 +531,7 @@
actionMap = new HashMap();
actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
- responseProps = new Properties();
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, new Properties(), headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
else if (response instanceof InsufficientPrivilegesResponse)
@@ -546,7 +541,7 @@
}
else
{
- throw new NotYetImplemented("Unexpected result from a portlet invocation " + response);
+ return portletResponse;
}
}
catch (ResourceAccessDeniedException e)
@@ -561,8 +556,7 @@
actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
windowTitle = "Access denied";
contentChars = "Access denied";
- responseProps = new Properties();
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, new Properties(), headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
catch (ResourceNotFoundException e)
@@ -577,8 +571,7 @@
actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
windowTitle = "Cannot render";
contentChars = "Object not found " + e.getRef();
- responseProps = new Properties();
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, new Properties(), headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
catch (ControllerException e)
@@ -593,12 +586,12 @@
if (SHOW.equals(property))
{
windowTitle = "An internal error occured while rendering window '" + window + "'";
- responseProps = new Properties();
contentChars = Exceptions.toHTML(e, true);
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, new Properties(), headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
+ //
return null;
}
17 years, 5 months
JBoss Portal SVN: r5734 - trunk/core/src/resources/portal-core-sar/META-INF
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2006-11-28 06:54:55 -0500 (Tue, 28 Nov 2006)
New Revision: 5734
Modified:
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
Schedule portlet discovery every 30 seconds
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-11-28 07:53:40 UTC (rev 5733)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-11-28 11:54:55 UTC (rev 5734)
@@ -23,7 +23,18 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<server>
- <!-- Management MBean -->
+ <!-- Management -->
+
+ <!-- Portlet discovery executed every 30 seconds -->
+ <mbean code="org.jboss.varia.scheduler.Scheduler"
+ name="portal:service=Management,type=Scheduler">
+ <attribute name="TargetName">portal:service=Management,type=PortletDiscoveryManagement,name=Default</attribute>
+ <attribute name="TargetMethod">processPortletDiscovery()</attribute>
+ <attribute name="StartDate">NOW</attribute>
+ <attribute name="Period">30000</attribute>
+ <attribute name="Repetitions">-1</attribute>
+ </mbean>
+
<mbean
code="org.jboss.portal.core.management.PortalImpl"
name="portal.management:service=Management,type=Portal,name=Default"
17 years, 5 months
JBoss Portal SVN: r5733 - trunk/core/src/main/org/jboss/portal/core/controller/ajax
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-28 02:53:40 -0500 (Tue, 28 Nov 2006)
New Revision: 5733
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
Log:
- fixed CCE when the response from a render page command was not a PageRendition object
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2006-11-28 07:51:34 UTC (rev 5732)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2006-11-28 07:53:40 UTC (rev 5733)
@@ -45,7 +45,7 @@
Object response = cmd.invokeNext();
// Configure ajax if needed
- if (response != null && cmd instanceof RenderPageCommand)
+ if (response instanceof PageRendition && cmd instanceof RenderPageCommand)
{
RenderPageCommand rpc = (RenderPageCommand)cmd;
PageRendition rendition = (PageRendition)response;
17 years, 5 months
JBoss Portal SVN: r5732 - in trunk: core/src/main/org/jboss/portal/core/aspects/controller core/src/main/org/jboss/portal/core/controller/ajax core/src/main/org/jboss/portal/core/model/instance/command theme/src/main/org/jboss/portal/theme theme/src/main/org/jboss/portal/theme/impl/render/dynamic
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-28 02:51:34 -0500 (Tue, 28 Nov 2006)
New Revision: 5732
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
Log:
- disabled ajax by default
- enable ajax only on dashboard
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-11-28 06:43:48 UTC (rev 5731)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-11-28 07:51:34 UTC (rev 5732)
@@ -96,6 +96,8 @@
if (cmd instanceof RenderPageCommand)
{
RenderPageCommand rpc = (RenderPageCommand)cmd;
+
+ //
StringBuffer tabbedNav = injectTabbedNav(rpc);
if (tabbedNav != null)
{
@@ -110,7 +112,7 @@
//
Region region = rendition.getPageResult().getRegion("navigation");
- region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED, "true");
+ region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED, "false");
}
}
@@ -129,7 +131,7 @@
//
Region region = rendition.getPageResult().getRegion("dashboardnav");
- region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED, "true");
+ region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED, "false");
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2006-11-28 06:43:48 UTC (rev 5731)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInterceptor.java 2006-11-28 07:51:34 UTC (rev 5732)
@@ -26,6 +26,7 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerInterceptor;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.ViewDashboardCommand;
import org.jboss.portal.theme.PageRendition;
import org.jboss.portal.theme.ThemeConstants;
@@ -43,42 +44,38 @@
{
Object response = cmd.invokeNext();
- //
- if (cmd instanceof RenderPageCommand)
+ // Configure ajax if needed
+ if (response != null && cmd instanceof RenderPageCommand)
{
RenderPageCommand rpc = (RenderPageCommand)cmd;
PageRendition rendition = (PageRendition)response;
- // Configure ajax
- if (rendition != null)
- {
- Map pageProps = rendition.getPageResult().getPageProperties();
+ Map pageProps = rendition.getPageResult().getPageProperties();
- //
- pageProps.put(ThemeConstants.PORTAL_AJAX_JAVASCRIPT_BASE, "/portal-ajax");
+ //
+ pageProps.put(ThemeConstants.PORTAL_AJAX_JAVASCRIPT_BASE, "/portal-ajax");
- // If user is logged in and is not on dashboard we disable ajax
- if (cmd.getControllerContext().getServerInvocation().getServerContext().getClientRequest().getRemoteUser() != null)
+ // If user is logged in and is on dashboard we enable ajax
+ if (cmd.getControllerContext().getServerInvocation().getServerContext().getClientRequest().getRemoteUser() != null)
+ {
+ if (rpc.isDashboard())
{
- if (rpc.isDashboard() == false)
- {
- pageProps.put(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED, "true");
- }
+ pageProps.put(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED, "true");
}
+ }
- // Compute the url for the ajax servlet
- HttpServletRequest req = cmd.getControllerContext().getServerInvocation().getServerContext().getClientRequest();
- StringBuffer url = new StringBuffer();
- url.append(req.getScheme()).append("://");
- url.append(req.getServerName());
- if (("http".equals(req.getScheme()) && req.getServerPort() != 80) || ("https".equals(req.getScheme()) && req.getServerPort() != 443))
- {
- url.append(':').append(req.getServerPort());
- }
- url.append(req.getContextPath()).append("/ajax");
-
- pageProps.put(ThemeConstants.PORTAL_AJAX_REMOTE_URL, url.toString());
+ // Compute the url for the ajax servlet
+ HttpServletRequest req = cmd.getControllerContext().getServerInvocation().getServerContext().getClientRequest();
+ StringBuffer url = new StringBuffer();
+ url.append(req.getScheme()).append("://");
+ url.append(req.getServerName());
+ if (("http".equals(req.getScheme()) && req.getServerPort() != 80) || ("https".equals(req.getScheme()) && req.getServerPort() != 443))
+ {
+ url.append(':').append(req.getServerPort());
}
+ url.append(req.getContextPath()).append("/ajax");
+
+ pageProps.put(ThemeConstants.PORTAL_AJAX_REMOTE_URL, url.toString());
}
//
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2006-11-28 06:43:48 UTC (rev 5731)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2006-11-28 07:51:34 UTC (rev 5732)
@@ -96,7 +96,6 @@
LayoutService ls = ps.getLayoutService();
PortalLayout layout = ls.getLayout("generic", true);
Map pageProperties = new HashMap();
- pageProperties.put(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED, "true");
Map portalProperties = new HashMap();
portalProperties.put("theme.renderSetId", "divRenderer");
portalProperties.put("theme.id", "renaissance");
Modified: trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java 2006-11-28 06:43:48 UTC (rev 5731)
+++ trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java 2006-11-28 07:51:34 UTC (rev 5732)
@@ -99,5 +99,5 @@
/**
*
*/
- public static final String PORTAL_AJAX_OBJECT_DISABLED = "theme.ajax.object_disabled";
+ public static final String PORTAL_AJAX_OBJECT_ENABLED = "theme.ajax.object_enabled";
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2006-11-28 06:43:48 UTC (rev 5731)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2006-11-28 07:51:34 UTC (rev 5732)
@@ -50,11 +50,11 @@
private RegionRenderer delegate;
- private static final ThreadLocal disabledLocal = new ThreadLocal();
+ private static final ThreadLocal enabledLocal = new ThreadLocal();
public static boolean isEnabled()
{
- return Boolean.TRUE.equals(disabledLocal.get()) == false;
+ return Boolean.TRUE == enabledLocal.get();
}
public DynaRegionRenderer(RegionRenderer regionRenderer) throws InstantiationException,
@@ -76,163 +76,167 @@
String remoteURL = (String)pageProps.get(ThemeConstants.PORTAL_AJAX_REMOTE_URL);
//
- Boolean disabled = null;
- if ("true".equals(region.getProperty(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED)))
- {
- disabled = Boolean.TRUE;
- }
- else if ("true".equals(renderContext.getPageProperties().get(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED)))
- {
- disabled = Boolean.TRUE;
- }
+ Object onPage = renderContext.getPageProperties().get(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED);
+ boolean pageEnabled = onPage != null && "true".equals(onPage);
- // Handle special ajax region here
- if ("AJAXFooter".equals(region.getId()))
+ //
+ boolean regionEnabled = false;
+ if (pageEnabled)
{
- disabled = Boolean.TRUE;
+ // Handle special ajax region here
+ if ("AJAXFooter".equals(region.getId()))
+ {
+ markup.append("<script>\n");
+ markup.append(
+ "\n" +
+ "var toto = new Array();\n" +
+ "for(region in regions_on_page) {\n" +
+ " toto.push(region);\n" +
+ "}\n" +
+ "for(region in regions_on_page) {\n" +
+ "Sortable.create(region, {dropOnEmpty:true,handle:'handle',tag:'div',containment:toto,constraint:false, ghosting: false,\n" +
+ " onChange: function(el)\n" +
+ " {\n" +
+ " },\n" +
+ " onUpdate: function (el)\n" +
+ " {\n" +
+ " }\n" +
+ "});\n" +
+ "}\n");
- markup.append("<script>\n");
- markup.append(
- "\n" +
- "var toto = new Array();\n" +
- "for(region in regions_on_page) {\n" +
- " toto.push(region);\n" +
- "}\n" +
- "for(region in regions_on_page) {\n" +
- "Sortable.create(region, {dropOnEmpty:true,handle:'handle',tag:'div',containment:toto,constraint:false, ghosting: false,\n" +
- " onChange: function(el)\n" +
- " {\n" +
- " },\n" +
- " onUpdate: function (el)\n" +
- " {\n" +
- " }\n" +
- "});\n" +
- "}\n");
+ //
+ markup.append("Draggables.addObserver(new WindowMoveObserver());\n");
- //
- markup.append("Draggables.addObserver(new WindowMoveObserver());\n");
+ //
+ markup.append("snapshot();\n");
- //
- markup.append("snapshot();\n");
+ //
+ markup.append("</script>\n");
+ }
+ else if ("AJAXScripts".equals(region.getId()))
+ {
+ markup.append("\n\n\n");
+ markup.append("<script type='text/javascript' src='").append(jsBase).append("/js/portal/prototype.js'></script>\n");
+ markup.append("<script type='text/javascript' src='").append(jsBase).append("/js/portal/scriptaculous.js'></script>\n");
+ markup.append("<script type='text/javascript' src='").append(jsBase).append("/js/portal/effects.js'></script>\n");
+ markup.append("<script type='text/javascript' src='").append(jsBase).append("/js/portal/dragdrop.js'></script>\n");
+ markup.append("<script type='text/javascript'>\n");
+ markup.append("remote_server_url=\"").append(remoteURL).append(";\"\n");
- markup.append("</script>\n");
- }
- else if ("AJAXScripts".equals(region.getId()))
- {
- disabled = Boolean.TRUE;
+ markup.append("regions_on_page = new Object();\n");
- markup.append("\n\n\n");
- markup.append("<script type='text/javascript' src='").append(jsBase).append("/js/portal/prototype.js'></script>\n");
- markup.append("<script type='text/javascript' src='").append(jsBase).append("/js/portal/scriptaculous.js'></script>\n");
- markup.append("<script type='text/javascript' src='").append(jsBase).append("/js/portal/effects.js'></script>\n");
- markup.append("<script type='text/javascript' src='").append(jsBase).append("/js/portal/dragdrop.js'></script>\n");
- markup.append("<script type='text/javascript'>\n");
- markup.append("remote_server_url=\"").append(remoteURL).append(";\"\n");
+ String sendData =
+ "function sendData(action, windowId, fromPos, fromRegionId, toPos, toRegionId)\n" +
+ "{\n" +
+ " var options = {\n" +
+ " method: 'post',\n" +
+ " postBody: 'action=' + action + '&windowId=' + windowId + '&fromPos=' + fromPos + '&fromRegion=' + fromRegionId + '&toPos=' + toPos + '&toRegion=' + toRegionId,\n" +
+ " onSuccess: function(t)\n" +
+ " {\n" +
+ " },\n" +
+ " onSuccess: function(t)\n" +
+ " {\n" +
+ " },\n" +
+ " on404: function(t)\n" +
+ " {\n" +
+ " alert('Error 404: location \"' + t.statusText + '\" was not found.');\n" +
+ " },\n" +
+ " onFailure: function(t)\n" +
+ " {\n" +
+ " alert('Error ' + t.status + ' -- ' + t.statusText);\n" +
+ " },\n" +
+ " onLoading: function(t)\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
+ " new Ajax.Request(remote_server_url, options);\n" +
+ "}";
+ markup.append(sendData);
- markup.append("regions_on_page = new Object();\n");
+ //
+ String t =
+ "function snapshot() {\n" +
+ "for(region in regions_on_page) {\n" +
+ "var regionId = regions_on_page[region];\n" +
+ "var regionDiv = $(region);\n" +
+ "for (var i = 0;i < regionDiv.childNodes.length;i++) {\n" +
+ "var child = regionDiv.childNodes[i];\n" +
+ "child['regionId'] = regionId;\n" +
+ "child['pos'] = i;\n" +
+ "}\n" +
+ "}\n" +
+ "\n}";
- String sendData =
- "function sendData(action, windowId, fromPos, fromRegionId, toPos, toRegionId)\n" +
+ markup.append(t);
+
+ String s =
+ " var WindowMoveObserver = Class.create();\n" +
+ " WindowMoveObserver.prototype =\n" +
+ " {\n" +
+ " initialize: function(element)\n" +
+ " {\n" +
+ " this.element = $(element);\n" +
+ " },\n" +
+ " onStart: function()\n" +
+ " {\n" +
+ " },\n" +
+ " onEnd: function()\n" +
+ " {\n" +
+ " var elt = Draggables.activeDraggable.element;\n" +
+ " var fromRegionId = elt['regionId'];\n" +
+ " var fromPos = elt['pos'];\n" +
+ " snapshot();\n" +
+ " var toRegionId = elt['regionId'];\n" +
+ " var toPos = elt['pos'];\n" +
+ " sendData('windowmove', elt.id, fromPos, fromRegionId, toPos, toRegionId);\n" +
+ " }\n" +
+ " };\n";
+ markup.append(s);
+
+ String u = "function removeWindow(elementId)\n" +
"{\n" +
- " var options = {\n" +
- " method: 'post',\n" +
- " postBody: 'action=' + action + '&windowId=' + windowId + '&fromPos=' + fromPos + '&fromRegion=' + fromRegionId + '&toPos=' + toPos + '&toRegion=' + toRegionId,\n" +
- " onSuccess: function(t)\n" +
- " {\n" +
- " },\n" +
- " onSuccess: function(t)\n" +
- " {\n" +
- " },\n" +
- " on404: function(t)\n" +
- " {\n" +
- " alert('Error 404: location \"' + t.statusText + '\" was not found.');\n" +
- " },\n" +
- " onFailure: function(t)\n" +
- " {\n" +
- " alert('Error ' + t.status + ' -- ' + t.statusText);\n" +
- " },\n" +
- " onLoading: function(t)\n" +
- " {\n" +
- " }\n" +
- " }\n" +
- " new Ajax.Request(remote_server_url, options);\n" +
+ " var effectElement = document.getElementById(elementId)\n" +
+ " new Effect.BlindUp(effectElement);\n" +
+ "\n" +
+ " //removeElement(effectElement);\n" +
+ "\n" +
+ " sendData('windowremove', elementId);\n" +
"}";
- markup.append(sendData);
+ markup.append(u);
- //
- String t =
- "function snapshot() {\n" +
- "for(region in regions_on_page) {\n" +
- "var regionId = regions_on_page[region];\n" +
- "var regionDiv = $(region);\n" +
- "for (var i = 0;i < regionDiv.childNodes.length;i++) {\n" +
- "var child = regionDiv.childNodes[i];\n" +
- "child['regionId'] = regionId;\n" +
- "child['pos'] = i;\n" +
- "}\n" +
- "}\n" +
- "\n}";
-
- markup.append(t);
-
- String s =
- " var WindowMoveObserver = Class.create();\n" +
- " WindowMoveObserver.prototype =\n" +
- " {\n" +
- " initialize: function(element)\n" +
- " {\n" +
- " this.element = $(element);\n" +
- " },\n" +
- " onStart: function()\n" +
- " {\n" +
- " },\n" +
- " onEnd: function()\n" +
- " {\n" +
- " var elt = Draggables.activeDraggable.element;\n" +
- " var fromRegionId = elt['regionId'];\n" +
- " var fromPos = elt['pos'];\n" +
- " snapshot();\n" +
- " var toRegionId = elt['regionId'];\n" +
- " var toPos = elt['pos'];\n" +
- " sendData('windowmove', elt.id, fromPos, fromRegionId, toPos, toRegionId);\n" +
- " }\n" +
- " };\n";
- markup.append(s);
-
- String u = "function removeWindow(elementId)\n" +
- "{\n" +
- " var effectElement = document.getElementById(elementId)\n" +
- " new Effect.BlindUp(effectElement);\n" +
- "\n" +
- " //removeElement(effectElement);\n" +
- "\n" +
- " sendData('windowremove', elementId);\n" +
- "}";
- markup.append(u);
-
- markup.append("</script>\n");
- markup.append("\n\n\n");
+ markup.append("</script>\n");
+ markup.append("\n\n\n");
+ }
+ else
+ {
+ String onRegion = region.getProperty(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED);
+ regionEnabled = onRegion == null || "true".equals(onRegion);
+ }
}
- if (Boolean.TRUE.equals(disabled) == false)
+ //
+ if (regionEnabled)
{
- markup.append(
- "<script>" +
- "regions_on_page[\"" + renderContext.getRegionID() + "\"]=\"" + region.getId() + "\";" +
- "</script>");
+ markup.append("<script>").
+ append("regions_on_page[\"").
+ append(renderContext.getRegionID()).
+ append("\"]=\"").
+ append(region.getId()).
+ append("\";").
+ append("</script>");
}
//
try
{
- disabledLocal.set(disabled);
+ enabledLocal.set(Boolean.valueOf(regionEnabled));
//
delegate.render(renderContext, region, portletContexts, windowResults);
}
finally
{
- disabledLocal.set(null);
+ enabledLocal.set(null);
}
//
17 years, 5 months
JBoss Portal SVN: r5731 - in trunk/wsrp/src/main/org/jboss/portal: test/wsrp/registration test/wsrp/v1/producer wsrp wsrp/producer wsrp/producer/registration/api wsrp/producer/registration/impl
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-11-28 01:43:48 -0500 (Tue, 28 Nov 2006)
New Revision: 5731
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java
Log:
- Can now modify consumer agent on Consumer. Dunno why I didn't allow it in the first place...
- Added remove/get property and updateProperties(Map) on Registration and associated test cases.
- Implemented modifyRegistration and activated test case. With this first implementation of Registration is finished! ^_^
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java 2006-11-28 06:43:48 UTC (rev 5731)
@@ -114,6 +114,34 @@
}
}
+ public void testProperties()
+ {
+ QName name = new QName("prop1");
+ assertEquals("value1", registration.getProperties().get(name));
+ assertEquals("value2", registration.getProperties().get(new QName("prop2")));
+
+ String newValue = "new value";
+ registration.setPropertyValueFor("prop1", newValue);
+ assertEquals(newValue, registration.getProperties().get(name));
+
+ registration.removeProperty(name);
+ assertNull(registration.getPropertyValueFor(name));
+ }
+
+ public void testUpdateProperties()
+ {
+ registrationProperties.remove(new QName("prop1"));
+
+ registration.updateProperties(registrationProperties);
+ assertNull(registration.getPropertyValueFor("prop1"));
+
+ QName name = new QName("prop3");
+ String value = "value3";
+ registrationProperties.put(name, value);
+ registration.updateProperties(registrationProperties);
+ assertEquals(value, registration.getPropertyValueFor(name));
+ }
+
public void testHasEqualProperties()
{
assertTrue(registration.hasEqualProperties(registration));
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2006-11-28 06:43:48 UTC (rev 5731)
@@ -26,13 +26,19 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.GetMarkup;
import org.jboss.portal.wsrp.core.GetServiceDescription;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.ModifyRegistration;
import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.RegistrationData;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
+import javax.xml.namespace.QName;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -109,25 +115,57 @@
// expected
}
- // Get description should still work?
+ // Get description with old registration context should fail
GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
gs.setRegistrationContext(rc);
+ try
+ {
+ serviceDescriptionService.getServiceDescription(gs);
+ ExtendedAssert.fail("Required registration info has been modified: operations should fail until registration is modified.");
+ }
+ catch (InvalidRegistrationFault invalidRegistrationFault)
+ {
+ // expected
+ }
+
+ // Get description should still work without registration context
+ gs = getNoRegistrationServiceDescriptionRequest();
+
ExtendedAssert.assertNotNull(serviceDescriptionService.getServiceDescription(gs));
}
- /*public void testModifyRegistration() throws Exception
+ public void testModifyRegistration() throws Exception
{
// initiate registration
configureRegistrationSettings(false);
RegistrationContext rc = registerConsumer();
// now modify Producer's set of required registration info
- RegistrationPropertyDescription regProp = new RegistrationPropertyDescription("new prop", new QName("xsd:string"));
+ String newPropName = "New Prop";
+ RegistrationPropertyDescription regProp = new RegistrationPropertyDescription(newPropName,
+ new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
regProp.setDefaultLabel("New Registration Property");
producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
- // Try to get service description
+ // try to get markup, portlet handle doesn't matter since it should fail before trying to retrieve the portlet
+ GetMarkup getMarkup = WSRPTypeFactory.createDefaultMarkupRequest("foo");
+ getMarkup.getMarkupParams().setMarkupCharacterSets(new String[]{WSRPConstants.DEFAULT_CHARACTER_SET});
+ getMarkup.setRegistrationContext(rc);
+
+ try
+ {
+ markupService.getMarkup(getMarkup);
+ ExtendedAssert.fail("Required registration info has been modified: operations should fail until registration is modified.");
+ }
+ catch (InvalidRegistrationFault expected)
+ {
+ // expected
+ // WSRP primer recommends returning OperationFailedFault and NOT InvalidRegistrationFault
+ // kinda weird... will be replaced by ModifyRegistrationRequiredFault in WSRP 2.0
+ }
+
+ // Get description should return information just as if consumer wasn't registered
GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
gs.setRegistrationContext(rc);
@@ -136,7 +174,7 @@
serviceDescriptionService.getServiceDescription(gs);
ExtendedAssert.fail("Required registration info has been modified: operations should fail until registration is modified.");
}
- catch (OperationFailedFault operationFailedFault)
+ catch (InvalidRegistrationFault expected)
{
// expected
// WSRP primer recommends returning OperationFailedFault and NOT InvalidRegistrationFault
@@ -155,13 +193,13 @@
org.jboss.portal.wsrp.core.Property[] props = regData.getRegistrationProperties();
org.jboss.portal.wsrp.core.Property[] newProps = new org.jboss.portal.wsrp.core.Property[props.length + 1];
System.arraycopy(props, 0, newProps, 0, props.length);
- newProps[props.length] = new org.jboss.portal.wsrp.core.Property("new prop", "en", "blah", null);
+ newProps[props.length] = new org.jboss.portal.wsrp.core.Property(newPropName, "en", "blah", null);
// Modify registration and get service description
registrationService.modifyRegistration(new ModifyRegistration(rc, regData));
gs.setRegistrationContext(rc);
checkServiceDescriptionWithOnlyBasicPortlet(gs);
- }*/
+ }
public void testRegister() throws Exception
{
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-11-28 06:43:48 UTC (rev 5731)
@@ -339,6 +339,7 @@
public static void validateConsumerAgent(String consumerAgent) throws IllegalArgumentException
{
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerAgent, "consumer agent", null);
char periodChar = '.';
int period = consumerAgent.indexOf(periodChar);
if (period != -1)
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-11-28 06:43:48 UTC (rev 5731)
@@ -86,15 +86,7 @@
WSRPUtils.validateConsumerAgent(consumerAgent);
registration = producer.getRegistrationManager().addRegistrationTo(consumerName, createRegistrationProperties(registrationData), true);
- registration.setStatus(RegistrationStatus.VALID);
- Consumer consumer = registration.getConsumer();
- consumer.setConsumerAgent(consumerAgent);
- ConsumerCapabilities capabilities = consumer.getCapabilities();
- capabilities.setSupportedModes(getListFromArray(registrationData.getConsumerModes(), false));
- capabilities.setSupportedWindowStates(getListFromArray(registrationData.getConsumerWindowStates(), false));
- capabilities.setSupportedUserProfileData(getListFromArray(registrationData.getCustomUserProfileData(), false));
- capabilities.setSupportedUserScopes(getListFromArray(registrationData.getConsumerUserScopes(), false));
- capabilities.setSupportsGetMethod(registrationData.isMethodGetSupported());
+ updateRegistrationInformation(registration, registrationData);
}
catch (Exception e)
{
@@ -107,6 +99,19 @@
return registrationContext;
}
+ private void updateRegistrationInformation(Registration registration, RegistrationData registrationData)
+ {
+ registration.setStatus(RegistrationStatus.VALID);
+ Consumer consumer = registration.getConsumer();
+ consumer.setConsumerAgent(registrationData.getConsumerAgent());
+ ConsumerCapabilities capabilities = consumer.getCapabilities();
+ capabilities.setSupportedModes(getListFromArray(registrationData.getConsumerModes(), false));
+ capabilities.setSupportedWindowStates(getListFromArray(registrationData.getConsumerWindowStates(), false));
+ capabilities.setSupportedUserProfileData(getListFromArray(registrationData.getCustomUserProfileData(), false));
+ capabilities.setSupportedUserScopes(getListFromArray(registrationData.getConsumerUserScopes(), false));
+ capabilities.setSupportsGetMethod(registrationData.isMethodGetSupported());
+ }
+
public ReturnAny deregister(RegistrationContext deregister) throws OperationFailedFault, InvalidRegistrationFault,
RemoteException
{
@@ -141,7 +146,45 @@
public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration) throws MissingParametersFault,
OperationFailedFault, InvalidRegistrationFault, RemoteException
{
- return null; // todo: implement
+ WSRPUtils.throwOperationFailedFaultIfValueIsMissing(modifyRegistration, "ModifyRegistration");
+
+ RegistrationContext registrationContext = modifyRegistration.getRegistrationContext();
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(registrationContext, "RegistrationContext", "ModifyRegistration");
+ String registrationHandle = registrationContext.getRegistrationHandle();
+ if (ParameterValidation.isNullOrEmpty(registrationHandle))
+ {
+ throwInvalidRegistrationFault("Null or empty registration handle");
+ }
+
+ RegistrationData registrationData = modifyRegistration.getRegistrationData();
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(registrationData, "RegistrationData", "ModifyRegistration");
+
+ String consumerName = registrationData.getConsumerName();
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerName, "consumer name", "RegistrationData");
+
+ String consumerAgent = registrationData.getConsumerAgent();
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerAgent, "consumer agent", "RegistrationData");
+
+ log.debug("Attempting to modify registration with handle '" + registrationHandle + "'");
+ try
+ {
+ Registration registration = producer.getRegistrationManager().getRegistration(registrationHandle);
+ registration.updateProperties(createRegistrationProperties(registrationData));
+ updateRegistrationInformation(registration, registrationData);
+ }
+ catch (NoSuchRegistrationException e)
+ {
+ log.debug(e);
+ throwInvalidRegistrationFault(e.getLocalizedMessage());
+ }
+ catch (RegistrationException e)
+ {
+ log.debug(e);
+ throw WSRPUtils.createOperationFailedFault(e);
+ }
+
+
+ return null;
}
public boolean isRegistrationValid(RegistrationContext registrationContext) throws InvalidRegistrationFault, OperationFailedFault
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java 2006-11-28 06:43:48 UTC (rev 5731)
@@ -96,4 +96,14 @@
/** Clears any state (cloned portlet information, session, etc) associated with this Registration */
void clearAssociatedState();
+
+ void updateProperties(Map registrationProperties);
+
+ void removeProperty(QName propertyName);
+
+ void removeProperty(String propertyName);
+
+ Object getPropertyValueFor(QName propertyName);
+
+ Object getPropertyValueFor(String propertyName);
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java 2006-11-28 06:43:48 UTC (rev 5731)
@@ -52,7 +52,6 @@
private RegistrationStatus status;
private ConsumerGroup group;
private ConsumerCapabilities capabilities;
- private boolean agentSet = false;
private ConsumerImpl()
@@ -117,14 +116,11 @@
public void setConsumerAgent(String consumerAgent) throws IllegalArgumentException, IllegalStateException
{
- if (agentSet)
+ if (consumerAgent != null && !consumerAgent.equals(this.consumerAgent))
{
- throw new IllegalStateException("Cannot modify the agent of a Consumer!");
+ WSRPUtils.validateConsumerAgent(consumerAgent);
+ this.consumerAgent = consumerAgent;
}
-
- WSRPUtils.validateConsumerAgent(consumerAgent);
- this.consumerAgent = consumerAgent;
- agentSet = true;
}
public ConsumerCapabilities getCapabilities()
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java 2006-11-28 06:43:48 UTC (rev 5731)
@@ -86,14 +86,46 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
ParameterValidation.throwIllegalArgExceptionIfNull(value, "Property value");
- properties.put(propertyName, value);
+
+ // avoid modifying the properties if new value is the same as old one
+ Object oldValue = properties.get(propertyName);
+ if (!value.equals(oldValue))
+ {
+ properties.put(propertyName, value);
+ }
}
public void setPropertyValueFor(String propertyName, Object value)
{
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
setPropertyValueFor(new QName(propertyName), value);
}
+ public Object getPropertyValueFor(QName propertyName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
+ return properties.get(propertyName);
+ }
+
+ public Object getPropertyValueFor(String propertyName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
+ return getPropertyValueFor(new QName(propertyName));
+ }
+
+
+ public void removeProperty(QName propertyName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
+ properties.remove(propertyName);
+ }
+
+ public void removeProperty(String propertyName)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
+ removeProperty(new QName(propertyName));
+ }
+
public boolean hasEqualProperties(Registration registration)
{
if (registration == null)
@@ -154,4 +186,9 @@
//todo: implement
}
+ public void updateProperties(Map registrationProperties)
+ {
+ properties = new HashMap(registrationProperties);
+ }
+
}
17 years, 5 months
JBoss Portal SVN: r5730 - in trunk/wsrp/src: main/org/jboss/portal/wsrp/producer main/org/jboss/portal/wsrp/producer/registration/api main/org/jboss/portal/wsrp/producer/registration/config main/org/jboss/portal/wsrp/producer/registration/impl resources/portal-wsrp-sar/META-INF
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-11-28 00:41:09 -0500 (Tue, 28 Nov 2006)
New Revision: 5730
Added:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfiguration.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfigurationService.java
Removed:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/LocalizedString.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPropertyDescription.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ProducerRegistrationRequirementsImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java
trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
Log:
- Renamed RegistrationConfiguration to ProducerConfiguration since it will include more than just registration configuration.
- ProducerRegistrationRequirements now is able to notify listeners of changes to registration properties.
- RegistrationPropertyDescription now knows about its parent ProducerRegistrationRequirements so that changes can be propagated.
- RegistrationManager now listens for changes to registration configuration so that registrations can be invalidated.
- Fixed incorrect behavior of RegistrationHandler.isRegistrationValid.
- Simplified RegistrationManager handling of registrations.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -156,20 +156,31 @@
}
String regHandle = registrationContext.getRegistrationHandle();
- if (regHandle == null)
- {
- throwInvalidRegistrationFault("missing required registration handle!");
- }
+ WSRPUtils.throwOperationFailedFaultIfValueIsMissing(regHandle, "registration handle");
+ Registration reg;
try
{
- Registration reg = producer.getRegistrationManager().getRegistration(regHandle);
- return reg != null && RegistrationStatus.VALID.equals(reg.getStatus());
+ reg = producer.getRegistrationManager().getRegistration(regHandle);
}
catch (RegistrationException e)
{
throw WSRPUtils.createOperationFailedFault(e);
}
+
+ if (reg == null)
+ {
+ throwInvalidRegistrationFault("provided registration handle '" + regHandle +
+ "' is not registered with this producer");
+ }
+
+ if (!RegistrationStatus.VALID.equals(reg.getStatus()))
+ {
+ throwInvalidRegistrationFault("provided registration is no longer valid");
+ }
+
+ log.debug("registration is valid!");
+ return true;
}
else
{
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -75,7 +75,7 @@
import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
-import org.jboss.portal.wsrp.producer.registration.config.RegistrationConfiguration;
+import org.jboss.portal.wsrp.producer.registration.config.ProducerConfiguration;
import org.jboss.portal.wsrp.producer.registration.impl.ProducerRegistrationRequirementsImpl;
import org.jboss.portal.wsrp.servlet.ServletAccess;
@@ -113,7 +113,7 @@
private PortletManagementHandler portletManagementHandler;
/** Registration configuration service */
- private RegistrationConfiguration registrationConfiguration;
+ private ProducerConfiguration producerConfiguration;
/** Registration Manager */
private RegistrationManager registrationManager;
@@ -143,9 +143,9 @@
public ProducerRegistrationRequirements getProducerRegistrationRequirements()
{
ProducerRegistrationRequirements registrationRequirements = DEFAULT_REGISTRATION_REQUIREMENTS;
- if (registrationConfiguration != null)
+ if (producerConfiguration != null)
{
- registrationRequirements = registrationConfiguration.getRegistrationRequirements();
+ registrationRequirements = producerConfiguration.getRegistrationRequirements();
}
// still need to check for null, in case there wasn't any registration info in the descriptor
@@ -252,14 +252,14 @@
return registrationState;
}
- public RegistrationConfiguration getRegistrationConfiguration()
+ public ProducerConfiguration getProducerConfiguration()
{
- return registrationConfiguration;
+ return producerConfiguration;
}
- public void setRegistrationConfiguration(RegistrationConfiguration registrationConfiguration)
+ public void setProducerConfiguration(ProducerConfiguration producerConfiguration)
{
- this.registrationConfiguration = registrationConfiguration;
+ this.producerConfiguration = producerConfiguration;
}
public RegistrationManager getRegistrationManager()
@@ -272,6 +272,18 @@
this.registrationManager = registrationManager;
}
+ protected void startService() throws Exception
+ {
+ super.startService();
+ getProducerRegistrationRequirements().addRegistrationPropertyChangeListeners(registrationManager);
+ }
+
+ protected void stopService() throws Exception
+ {
+ getProducerRegistrationRequirements().removeRegistrationPropertyChangeListener(registrationManager);
+ super.stopService();
+ }
+
// PortletManagement implementation *********************************************************************************
public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription)
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/LocalizedString.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/LocalizedString.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/LocalizedString.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -56,7 +56,14 @@
{
}
+ public LocalizedString(LocalizedString other)
+ {
+ this.value = other.value;
+ this.locale = other.locale;
+ this.resourceName = other.resourceName;
+ }
+
public String toString()
{
return "LocalizedString{" +
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -33,7 +33,6 @@
*/
public interface ProducerRegistrationRequirements
{
-
boolean requiresRegistration();
void setRequiresRegistration(boolean requiresRegistration);
@@ -52,11 +51,24 @@
void clearRegistrationProperties();
- boolean acceptValueFor(Object value, QName propertyName);
+ boolean acceptValueFor(QName propertyName, Object value);
- boolean acceptValueFor(Object value, String propertyName);
+ boolean acceptValueFor(String propertyName, Object value);
RegistrationPropertyDescription getRegistrationPropertyWith(String name);
RegistrationPropertyDescription getRegistrationPropertyWith(QName name);
+
+ void notifyRegistrationPropertyChangeListeners();
+
+ void addRegistrationPropertyChangeListeners(RegistrationPropertyChangeListener listener);
+
+ void clearRegistrationPropertyChangeListeners();
+
+ void removeRegistrationPropertyChangeListener(RegistrationPropertyChangeListener listener);
+
+ interface RegistrationPropertyChangeListener
+ {
+ void propertiesHaveChanged();
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -31,7 +31,7 @@
* @version $Revision$
* @since 2.6
*/
-public interface RegistrationManager
+public interface RegistrationManager extends ProducerRegistrationRequirements.RegistrationPropertyChangeListener
{
RegistrationPolicy getPolicy();
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPropertyDescription.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPropertyDescription.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPropertyDescription.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -31,7 +31,7 @@
* @version $Revision$
* @since 2.6
*/
-public class RegistrationPropertyDescription
+public class RegistrationPropertyDescription implements Cloneable
{
private QName name;
private QName type;
@@ -41,6 +41,7 @@
private LocalizedString label;
private String[] usages;
private QName[] aliases;
+ private transient ProducerRegistrationRequirements parent;
public RegistrationPropertyDescription(QName name, QName type)
@@ -58,6 +59,25 @@
{
}
+ public RegistrationPropertyDescription(RegistrationPropertyDescription other)
+ {
+ setName(new QName(other.name.toString()));
+ setType(new QName(other.type.toString()));
+
+ aliases = new QName[other.aliases.length];
+ System.arraycopy(other.aliases, 0, aliases, 0, other.aliases.length);
+
+ setDescription(new LocalizedString(other.description));
+ setHint(new LocalizedString(other.hint));
+ setLabel(new LocalizedString(other.label));
+ setSchemaLocation(other.schemaLocation);
+
+ usages = new String[other.usages.length];
+ System.arraycopy(other.usages, 0, usages, 0, other.usages.length);
+
+ parent = other.parent;
+ }
+
public QName getName()
{
return name;
@@ -66,6 +86,7 @@
public void setName(QName name)
{
this.name = name;
+ notifyParentOfChangeIfNeeded();
}
public QName getType()
@@ -76,6 +97,7 @@
public void setType(QName type)
{
this.type = type;
+ notifyParentOfChangeIfNeeded();
}
public URI getSchemaLocation()
@@ -86,6 +108,7 @@
public void setSchemaLocation(URI schemaLocation)
{
this.schemaLocation = schemaLocation;
+ notifyParentOfChangeIfNeeded();
}
public LocalizedString getDescription()
@@ -96,6 +119,7 @@
public void setDescription(LocalizedString description)
{
this.description = description;
+ notifyParentOfChangeIfNeeded();
}
public void setDefaultDescription(String value)
@@ -111,6 +135,7 @@
public void setHint(LocalizedString hint)
{
this.hint = hint;
+ notifyParentOfChangeIfNeeded();
}
public void setDefaultHint(String value)
@@ -126,6 +151,7 @@
public void setLabel(LocalizedString label)
{
this.label = label;
+ notifyParentOfChangeIfNeeded();
}
public void setDefaultLabel(String value)
@@ -140,7 +166,9 @@
public void setUsages(String[] usages)
{
- this.usages = usages;
+ this.usages = new String[usages.length];
+ System.arraycopy(usages, 0, this.usages, 0, usages.length);
+ notifyParentOfChangeIfNeeded();
}
public QName[] getAliases()
@@ -150,6 +178,21 @@
public void setAliases(QName[] aliases)
{
- this.aliases = aliases;
+ this.aliases = new QName[aliases.length];
+ System.arraycopy(aliases, 0, this.aliases, 0, aliases.length);
+ notifyParentOfChangeIfNeeded();
}
+
+ public void setParent(ProducerRegistrationRequirements requirements)
+ {
+ this.parent = requirements;
+ }
+
+ private void notifyParentOfChangeIfNeeded()
+ {
+ if (parent != null)
+ {
+ parent.notifyRegistrationPropertyChangeListeners();
+ }
+ }
}
Copied: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfiguration.java (from rev 5722, trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java 2006-11-27 17:06:21 UTC (rev 5722)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfiguration.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * 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.wsrp.producer.registration.config;
+
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface ProducerConfiguration
+{
+ ProducerRegistrationRequirements getRegistrationRequirements();
+}
Copied: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfigurationService.java (from rev 5722, trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java 2006-11-27 17:06:21 UTC (rev 5722)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/ProducerConfigurationService.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * 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.wsrp.producer.registration.config;
+
+import org.jboss.portal.common.util.URLTools;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ProducerConfigurationService extends AbstractJBossService implements ProducerConfiguration
+{
+ private ProducerRegistrationRequirements requirements;
+ private String configLocation;
+
+ public ProducerRegistrationRequirements getRegistrationRequirements()
+ {
+ return requirements;
+ }
+
+ public String getConfigLocation()
+ {
+ return configLocation;
+ }
+
+ public void setConfigLocation(String configLocation)
+ {
+ this.configLocation = configLocation;
+ }
+
+
+ protected void createService() throws Exception
+ {
+ // Setup URLs
+ if (configLocation == null)
+ {
+ throw new Exception("The config location is null");
+ }
+ URL configURL = Thread.currentThread().getContextClassLoader().getResource(configLocation);
+ if (configURL == null)
+ {
+ throw new Exception("The config " + configLocation + " does not exist");
+ }
+ if (!URLTools.exists(configURL))
+ {
+ throw new Exception("The config " + configURL + " does not exist");
+ }
+
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new RegistrationConfigurationFactory();
+ requirements = (ProducerRegistrationRequirements)unmarshaller.unmarshal(configURL.openStream(), factory, null);
+ }
+}
Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfiguration.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -1,36 +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.wsrp.producer.registration.config;
-
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public interface RegistrationConfiguration
-{
- ProducerRegistrationRequirements getRegistrationRequirements();
-}
Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/config/RegistrationConfigurationService.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -1,82 +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.wsrp.producer.registration.config;
-
-import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-import java.net.URL;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class RegistrationConfigurationService extends AbstractJBossService implements RegistrationConfiguration
-{
- private ProducerRegistrationRequirements requirements;
- private String configLocation;
-
- public ProducerRegistrationRequirements getRegistrationRequirements()
- {
- return requirements;
- }
-
- public String getConfigLocation()
- {
- return configLocation;
- }
-
- public void setConfigLocation(String configLocation)
- {
- this.configLocation = configLocation;
- }
-
-
- protected void createService() throws Exception
- {
- // Setup URLs
- if (configLocation == null)
- {
- throw new Exception("The config location is null");
- }
- URL configURL = Thread.currentThread().getContextClassLoader().getResource(configLocation);
- if (configURL == null)
- {
- throw new Exception("The config " + configLocation + " does not exist");
- }
- if (!URLTools.exists(configURL))
- {
- throw new Exception("The config " + configURL + " does not exist");
- }
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new RegistrationConfigurationFactory();
- requirements = (ProducerRegistrationRequirements)unmarshaller.unmarshal(configURL.openStream(), factory, null);
- }
-}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ProducerRegistrationRequirementsImpl.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ProducerRegistrationRequirementsImpl.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -30,7 +30,10 @@
import javax.xml.namespace.QName;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -41,6 +44,7 @@
{
private boolean requiresRegistration;
private boolean fullServiceDescriptionRequiresRegistration;
+ private transient Set listeners = new HashSet(3);
/** property name (QName) -> PropertyDescription */
private Map registrationProperties;
@@ -85,19 +89,26 @@
public void addRegistrationProperty(RegistrationPropertyDescription propertyDescription)
{
ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription, "PropertyDescription");
- registrationProperties.put(propertyDescription.getName(), propertyDescription);
+ QName name = propertyDescription.getName();
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "Property name");
+
+ registrationProperties.put(name, propertyDescription);
+ propertyDescription.setParent(this);
+ notifyRegistrationPropertyChangeListeners();
}
- public boolean acceptValueFor(Object value, QName propertyName)
+ public boolean acceptValueFor(QName propertyName, Object value)
{
+ ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
+
QName type = getPropertyDescription(propertyName).getType();
// todo: decide if type is actually compatible with value...
return true;
}
- public boolean acceptValueFor(Object value, String propertyName)
+ public boolean acceptValueFor(String propertyName, Object value)
{
- return acceptValueFor(value, new QName(propertyName));
+ return acceptValueFor(new QName(propertyName), value);
}
public RegistrationPropertyDescription getRegistrationPropertyWith(String name)
@@ -115,22 +126,51 @@
private RegistrationPropertyDescription getPropertyDescription(QName propertyName)
{
- return (RegistrationPropertyDescription)registrationProperties.get(propertyName);
+ // copy to ensure immutability
+ return new RegistrationPropertyDescription((RegistrationPropertyDescription)registrationProperties.get(propertyName));
}
public void removeRegistrationProperty(QName propertyName)
{
ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
registrationProperties.remove(propertyName);
+ notifyRegistrationPropertyChangeListeners();
}
public void clearRegistrationProperties()
{
registrationProperties.clear();
+ notifyRegistrationPropertyChangeListeners();
}
public void removeRegistrationProperty(String propertyName)
{
removeRegistrationProperty(new QName(propertyName));
}
+
+ public void notifyRegistrationPropertyChangeListeners()
+ {
+ for (Iterator iterator = listeners.iterator(); iterator.hasNext();)
+ {
+ RegistrationPropertyChangeListener listener = (RegistrationPropertyChangeListener)iterator.next();
+ listener.propertiesHaveChanged();
+ }
+ }
+
+ public void clearRegistrationPropertyChangeListeners()
+ {
+ listeners.clear();
+ }
+
+ public void addRegistrationPropertyChangeListeners(RegistrationPropertyChangeListener listener)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(listener, "RegistrationPropertyChangeListener");
+ listeners.add(listener);
+ }
+
+ public void removeRegistrationPropertyChangeListener(RegistrationPropertyChangeListener listener)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(listener, "RegistrationPropertyChangeListener");
+ listeners.remove(listener);
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java 2006-11-28 05:41:09 UTC (rev 5730)
@@ -24,6 +24,7 @@
package org.jboss.portal.wsrp.producer.registration.impl;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.wsrp.producer.registration.api.Consumer;
@@ -50,6 +51,8 @@
*/
public class RegistrationManagerImpl extends AbstractJBossService implements RegistrationManager
{
+ private static final Logger log = Logger.getLogger(RegistrationManager.class);
+
private RegistrationPolicy policy;
private RegistrationPersistenceManager persistenceManager;
private Map registrations;
@@ -113,7 +116,7 @@
registration.setRegistrationHandle(handle);
// associate the handle to the consumer for easy retrieval
- registrations.put(handle, new ConsumerRegistration(registration, consumer));
+ registrations.put(handle, registration);
return registration;
}
@@ -283,15 +286,15 @@
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationHandle, "registration handle", null);
// this particular implementations uses a map though it could delegate to the registry and make a DB query to retrieve the info
- ConsumerRegistration cr = (ConsumerRegistration)registrations.get(registrationHandle);
+ Registration registration = (Registration)registrations.get(registrationHandle);
- if (cr != null)
+ if (registration == null)
{
- return (getConsumer ? (Object)cr.consumer : cr.registration);
+ return null;
}
else
{
- return null;
+ return getConsumer ? (Object)registration.getConsumer() : registration;
}
}
@@ -338,16 +341,19 @@
}
}
- private static class ConsumerRegistration
+ /**
+ * We listened to registration property changes on the producer configuration so that we can invalidate the current
+ * registrations. Consumers will need to call modifyRegistration since properties have changed...
+ */
+ public void propertiesHaveChanged()
{
- private Registration registration;
- private Consumer consumer;
-
-
- public ConsumerRegistration(Registration registration, Consumer consumer)
+ log.debug("Registration properties have changed, existing registrations will be invalidated...");
+ for (Iterator regs = registrations.values().iterator(); regs.hasNext();)
{
- this.registration = registration;
- this.consumer = consumer;
+ Registration reg = (Registration)regs.next();
+ reg.setStatus(RegistrationStatus.INVALID);
+ reg.clearAssociatedState(); //todo: or should we wait until current operations are done?
}
}
+
}
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2006-11-28 01:46:21 UTC (rev 5729)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2006-11-28 05:41:09 UTC (rev 5730)
@@ -79,7 +79,7 @@
<xmbean/>
<depends optional-attribute-name="Invoker"
proxy-type="attribute">portal:service=PortletInvoker,type=WSRPProducer</depends>
- <depends optional-attribute-name="RegistrationConfiguration" proxy-type="attribute">portal.wsrp:service=RegistrationConfiguration</depends>
+ <depends optional-attribute-name="ProducerConfiguration" proxy-type="attribute">portal.wsrp:service=ProducerConfiguration</depends>
<depends optional-attribute-name="RegistrationManager" proxy-type="attribute">portal.wsrp:service=RegistrationManager</depends>
</mbean>
@@ -107,8 +107,8 @@
</mbean>
<!-- Registration configuration service -->
- <mbean code="org.jboss.portal.wsrp.producer.registration.config.RegistrationConfigurationService"
- name="portal.wsrp:service=RegistrationConfiguration" xmbean-dd=""
+ <mbean code="org.jboss.portal.wsrp.producer.registration.config.ProducerConfigurationService"
+ name="portal.wsrp:service=ProducerConfiguration" xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<attribute name="ConfigLocation">conf/config.xml</attribute>
17 years, 5 months
JBoss Portal SVN: r5729 - in trunk: core/src/main/org/jboss/portal/core/aspects/controller core/src/main/org/jboss/portal/core/model/instance/command core/src/main/org/jboss/portal/core/model/portal/command theme/src/main/org/jboss/portal/test/theme theme/src/main/org/jboss/portal/test/theme/render theme/src/main/org/jboss/portal/test/theme/servlet theme/src/main/org/jboss/portal/theme theme/src/main/org/jboss/portal/theme/impl theme/src/main/org/jboss/portal/theme/impl/strategy theme/src/m
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-27 20:46:21 -0500 (Mon, 27 Nov 2006)
New Revision: 5729
Removed:
trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/navigation/PageNavigationalState.java
trunk/theme/src/main/org/jboss/portal/theme/page/ModifiablePageResult.java
trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableRegionResult.java
trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableWindowResult.java
trunk/theme/src/main/org/jboss/portal/theme/page/RegionResult.java
trunk/theme/src/main/org/jboss/portal/theme/render/FragmentAssembler.java
trunk/theme/src/main/org/jboss/portal/theme/render/MarkupResult.java
trunk/theme/src/main/org/jboss/portal/theme/render/ModifiableMarkupResult.java
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java
trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java
trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java
trunk/theme/src/main/org/jboss/portal/theme/LayoutDispatcher.java
trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
trunk/theme/src/main/org/jboss/portal/theme/PageRendition.java
trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
trunk/theme/src/main/org/jboss/portal/theme/ServerRegistrationID.java
trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java
trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
trunk/theme/src/main/org/jboss/portal/theme/impl/strategy/MaximizingStrategyImpl.java
trunk/theme/src/main/org/jboss/portal/theme/navigation/WindowNavigationalState.java
trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java
trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java
trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyResponse.java
Log:
removing usage of window nav state + simplify
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -43,7 +43,6 @@
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.theme.PageRendition;
import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
import org.jboss.portal.theme.page.Region;
import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.theme.page.WindowResult;
@@ -104,7 +103,7 @@
windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
- WindowResult res = new ModifiableWindowResult("", tabbedNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+ WindowResult res = new WindowResult("", tabbedNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
WindowContext blah = new WindowContext("BLAH", "BLAH", "navigation", 0);
rendition.getPageResult().addWindowContext(blah);
rendition.getPageResult().addWindowResult("BLAH", res);
@@ -123,7 +122,7 @@
windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
- WindowResult res = new ModifiableWindowResult("", dashboardNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+ WindowResult res = new WindowResult("", dashboardNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
WindowContext bluh = new WindowContext("BLUH", "BLUH", "dashboardnav", 0);
rendition.getPageResult().addWindowContext(bluh);
rendition.getPageResult().addWindowResult("BLUH", res);
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -24,44 +24,10 @@
package org.jboss.portal.core.aspects.controller;
import org.apache.log4j.Logger;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerInterceptor;
-import org.jboss.portal.core.model.portal.command.PageCommand;
-import org.jboss.portal.core.model.portal.command.PortalObjectCommand;
-import org.jboss.portal.core.model.portal.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.command.WindowCommand;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.theme.LayoutInfo;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.strategy.LayoutStrategy;
-import org.jboss.portal.theme.strategy.NavigationalStateChangedEvent;
-import org.jboss.portal.theme.strategy.StrategyContext;
-import org.jboss.portal.theme.strategy.StrategyException;
-import org.jboss.portal.theme.strategy.StrategyResponse;
-import javax.servlet.http.HttpServletRequest;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
/**
* Ensure that the page navigational state holder is present.
*
@@ -75,380 +41,21 @@
public Object invoke(ControllerCommand cmd) throws Exception, InvocationException
{
- if (cmd instanceof WindowCommand || cmd instanceof PageCommand)
- {
- //
- PortalObject target = ((PortalObjectCommand)cmd).getTarget();
- while (target != null && PortalObject.TYPE_PAGE != target.getType() && target.getParent() != null)
- {
- target = target.getParent();
- }
-
- if (target == null || target.getType() != PortalObject.TYPE_PAGE)
- {
- throw new InvocationException("Could not determine the page of this request");
- }
-
- Page page = (Page)target;
-
- try
- {
- ServerInvocation sinv = ((ControllerContext)cmd.getContext()).getServerInvocation();
- LayoutService layoutService = ((ControllerContext)cmd.getContext()).getController().getPageService().getLayoutService();
- AttributeResolver navCtx = cmd.getContext().getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
- ensurePageNavigationalState(layoutService, navCtx, sinv, page);
- }
- catch (StrategyException e)
- {
- throw new InvocationException(e);
- }
- }
-
- return cmd.invokeNext();
- }
-
- public static void updatePageNavigationalState(LayoutService layoutService, ControllerContext cmdContext,
- ServerInvocation sinv, Portal portal, Page page, Window window,
- Mode mode, WindowState windowState) throws StrategyException
- {
- if (window != null)
- {
- // First update the window navigational state
- AttributeResolver navCtx = sinv.getContext().getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
-
- // now take care of the page navigational state (i.e. fire the layout strategy with the window navigational state change,
- // and honor what the strategy has to say to the change (if anything)
- PageNavigationalState pageNavState = ensurePageNavigationalState(layoutService, navCtx, sinv, page);
-
- // get the position of the portlet on the page, and other window location related state
- WindowContext windowContext = pageNavState.getWindowContext(window.getId());
-
- PortalLayout layout = getLayout(layoutService, page);
-
- LayoutStrategy strategy = getLayoutStrategy(page, layout, sinv);
-
- HTTPStreamInfo streamInfo = sinv.getResponse().getStreamInfo();
- Set windowStates = portal.getSupportedWindowStates();
- Set portletModes = portal.getSupportedModes();
- HttpServletRequest httpRequest = sinv.getServerContext().getClientRequest();
- StrategyContext strategyContext = new StrategyContext(navCtx, pageNavState, httpRequest, streamInfo, windowStates, portletModes, layout.getLayoutInfo().getRegionNames());
-
- NavigationalStateChangedEvent event = new NavigationalStateChangedEvent(windowContext, mode, windowState);
-
- StrategyResponse strategyResponse = strategy.stateChanged(event, strategyContext);
-
- // and update the navigational state with the strategy response
- processResponse(navCtx, pageNavState, strategyResponse, layout);
- }
- }
-
- private static LayoutStrategy getLayoutStrategy(Page page, PortalLayout layout, ServerInvocation sinv)
- {
- if (layout == null)
- {
- return null;
- }
-// LayoutStrategy strategy = layout.getLayoutInfo().getStrategy(sinv.getResponse().getStreamInfo().getContentType());
- LayoutStrategy strategy = null;
-
- if (strategy == null)
- {
- String defaultStrategyName = "default";
- Portal portal = page.getPortal();
- Map portalProperties = portal.getDeclaredProperties();
- Map pageProperties = page.getDeclaredProperties();
-
- // not specified for this layout -> get it from portal
- String strategyName = getStrategyNameFromProperties(pageProperties);
-
- if (strategyName == null)
- {
- strategyName = getStrategyNameFromProperties(portalProperties);
- }
-
- if (strategyName == null)
- {
- log.warn("No strategy name found in portal and page properties. Using '" + defaultStrategyName + "'");
- // default to the 'default' strategy
- strategyName = defaultStrategyName;
- }
- log.debug("looking for strategy with name: " + strategyName);
- strategy = layout.getServiceInfo().getStrategy(strategyName, sinv.getResponse().getStreamInfo().getContentType());
- }
-
- return strategy;
- }
-
- private static PortalLayout getLayout(LayoutService layoutService, Page page)
- {
- return RenderPageCommand.getLayout(layoutService, page);
- }
-
- private static void processResponse(AttributeResolver navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse, PortalLayout layout)
- {
- // handle excluded portlets
- handleExcludedPortlets(pageNavState, strategyResponse);
- // handle changes in window state of one or more portlets
- handleWindowStateChanges(navCtx, pageNavState, strategyResponse);
- // handle changes of the portlet mode of one or more portlets
- handlePortletModeChanges(navCtx, pageNavState, strategyResponse);
- // handle changes in the region and order
-
-// transferPortletContexts(request, response);
-// // handle changes in the layout
- handleLayoutAndState(navCtx, pageNavState, strategyResponse, layout);
- }
-
- private static PageNavigationalState ensurePageNavigationalState(LayoutService layoutService, AttributeResolver navCtx, ServerInvocation sinv, Page page) throws StrategyException
- {
- PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(page.getId());
-
- if (pageNavState != null)
- {
- return pageNavState;
- }
-
- // Create the page nav state
- Map windowContexts = createWindowContextMap(page);
-
- pageNavState = (PageNavigationalState)navCtx.getAttribute(page.getId());
- if (pageNavState == null)
- {
- //
- pageNavState = new PageNavigationalState();
- navCtx.setAttribute(page.getId(), pageNavState);
-
- // Initialize the window missing NS
-// for (Iterator i = windowContexts.values().iterator(); i.hasNext();)
+// if (cmd instanceof WindowCommand || cmd instanceof PageCommand)
+// {
+// //
+// PortalObject target = ((PortalObjectCommand)cmd).getTarget();
+// while (target != null && PortalObject.TYPE_PAGE != target.getType() && target.getParent() != null)
// {
-// WindowContext windowContext = (WindowContext)i.next();
-// if (navCtx.getNavigationalState(windowContext.getId()) == null)
-// {
-// navCtx.setNavigationalState(windowContext.getId(), new JBossPortletNavigationalState());
-// }
+// target = target.getParent();
// }
- }
-
- //
- pageNavState.initialize(windowContexts);
-
- // evaluate the layout strategy
-
- // get the layout to use
- PortalLayout layout = getLayout(layoutService, page);
-
- if (layout == null)
- {
- throw new IllegalStateException("layout is null");
- }
-
- // get the strategy to use
- LayoutStrategy strategy = getLayoutStrategy(page, layout, sinv);
-
- // build the strategy context
- Portal portal = page.getPortal();
- HTTPStreamInfo streamInfo = sinv.getResponse().getStreamInfo();
- Set windowStates = portal.getSupportedWindowStates();
- Set portletModes = portal.getSupportedModes();
- HttpServletRequest httpRequest = sinv.getServerContext().getClientRequest();
- StrategyContext strategyContext = new StrategyContext(navCtx, pageNavState, httpRequest, streamInfo, windowStates, portletModes, layout.getLayoutInfo().getRegionNames());
-
- // call the strategy
- StrategyResponse strategyResponse = strategy.initialize(strategyContext);
-
- // update the navigational state from the strategy response (if requested therein)
- processResponse(navCtx, pageNavState, strategyResponse, layout);
-
- navCtx.setAttribute(page.getId(), pageNavState);
-
- return pageNavState;
- }
-
- /**
- * Create a Map of WindowContext instances, keyed by window id , of all portlet windows on the requested page
- *
- * @param page the requested page
- * @return a Map of WindowID to WindowContext
- */
- private static Map createWindowContextMap(Page page)
- {
- Map windows = new HashMap();
- for (Iterator i = page.getChildren().iterator(); i.hasNext();)
- {
- PortalObject o = (PortalObject)i.next();
- if (o instanceof Window)
- {
- Window window = (Window)o;
- windows.put(window.getId(), createWindowContext(window));
- }
- }
- return windows;
- }
-
- /**
- * Create a window context for the given window
- *
- * @param window the window to create the context for
- * @return a new WindowContext
- * @see org.jboss.portal.theme.page.WindowContext
- */
- private static WindowContext createWindowContext(Window window)
- {
- String region;
- Integer order;
-// UserContext userCtx = context.getServerInvocation().getRequest().getUser();
-// if (userCtx != null)
-// {
-// PreferenceStore store = userCtx.getPreferences();
-// String handle = registry.getHandle(window);
-// PreferenceSet prefs = store.get(handle, false);
//
-// //
-// if (prefs != null)
-// {
-// Value regionValue = prefs.getValue("region");
-// if (regionValue != null && !regionValue.isNull())
-// {
-// region = regionValue.asString();
-// }
-// }
-//
-// //
-//// Value orderValue = prefs.getValue("order");
-//// if (orderValue != null && !orderValue.isNull() && orderValue.isInstanceOf(Float.class))
-//// {
-//// order = new Integer(((Float)orderValue.asObject()).intValue());
-//// }
-// }
+// if (target == null || target.getType() != PortalObject.TYPE_PAGE)
+// {
+// throw new InvocationException("Could not determine the page of this request");
+// }
+// }
- region = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
- try
- {
- order = new Integer(window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER));
- }
- catch (NumberFormatException e)
- {
- log.error("Cannot get window " + window.getId() + " coordinate", e);
- order = new Integer(99);
- }
-
- return new WindowContext(window.getName(), window.getId(), region, order.intValue());
+ return cmd.invokeNext();
}
-
- private static String getStrategyNameFromProperties(Map properties)
- {
- if (properties != null)
- {
- return (String)properties.get(ThemeConstants.PORTAL_PROP_STRATEGY);
- }
- return null;
- }
-
- private static void handleLayoutAndState(AttributeResolver navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse, PortalLayout layout)
- {
- pageNavState.setLayoutState(strategyResponse.getLayoutState());
-
- if (strategyResponse.getLayoutURI() == null)
- {
- LayoutInfo info = layout.getLayoutInfo();
- if (strategyResponse.getLayoutState() != null)
- {
- pageNavState.setLayoutURI(info.getURI(strategyResponse.getLayoutState()));
- }
- else
- {
- pageNavState.setLayoutURI(info.getURI());
- }
- }
- else
- {
- pageNavState.setLayoutURI(strategyResponse.getLayoutURI());
- }
-
- Map regionChangeMap = strategyResponse.getWindowRegionChangeMap();
- // move windows to other regions
- for (Iterator i = regionChangeMap.keySet().iterator(); i.hasNext();)
- {
- String windowID = (String)i.next();
- pageNavState.setWindowRegion(windowID, (String)regionChangeMap.get(windowID), true);
- }
-
- // restore previous window context region and order
- Map idsToRestore = strategyResponse.getWindowIDsToRestore();
- for (Iterator i = idsToRestore.keySet().iterator(); i.hasNext();)
- {
- String windowId = (String)i.next();
- WindowContext ctx = pageNavState.getPreviousWindowContext(windowId, true);
- if (ctx != null)
- {
- pageNavState.setWindowRegion(windowId, ctx.getRegionName(), false);
- pageNavState.setWindowOrder(windowId, ctx.getOrder(), false);
- WindowNavigationalState windowNavState = (WindowNavigationalState)navCtx.getAttribute(windowId + "_window");
- windowNavState.setWindowState((WindowState)idsToRestore.get(windowId));
- }
- }
- }
-
- /**
- * look for changed window states and portlet modes, and update the navigational state of the portlet instance
- *
- * @param strategyResponse
- */
- private static void handleWindowStateChanges(AttributeResolver navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse)
- {
-
- Map changeMap = strategyResponse.getWindowStateChangeMap();
- Collection windowContexts = pageNavState.getWindowContexts();
- for (Iterator i = changeMap.keySet().iterator(); i.hasNext();)
- {
- WindowContext windowContext = (WindowContext)i.next();
-
- // only if the portlet is part of this request (and the portlet is still registered) do we allow for the change
- if (windowContexts.contains(windowContext))
- {
- WindowNavigationalState state = (WindowNavigationalState)navCtx.getAttribute(windowContext.getId() + "_window");
- state.setWindowState((WindowState)changeMap.get(windowContext));
- }
- else
- {
- log.warn("changed portlet context not in list of portlet windows");
- }
- }
- }
-
- private static void handlePortletModeChanges(AttributeResolver navCtx, PageNavigationalState pageNavState, StrategyResponse strategyResponse)
- {
- Map changeMap = strategyResponse.getPortletModeChangeMap();
- Collection windowContexts = pageNavState.getWindowContexts();
- for (Iterator i = changeMap.keySet().iterator(); i.hasNext();)
- {
- WindowContext windowContext = (WindowContext)i.next();
-
- // only if the portlet is part of this request do we allow for the change
- if (windowContexts.contains(windowContext))
- {
- WindowNavigationalState state = (WindowNavigationalState)navCtx.getAttribute(windowContext.getId() + "_window");
- state.setMode((Mode)changeMap.get(windowContext));
- }
- else
- {
- log.warn("changed portlet context not in list of portlet getWindows");
- }
- }
- }
-
- /**
- * look for excluded portlets for this request, and only propagate the allowed ones to the page response
- *
- * @param strategyResponse
- */
- private static void handleExcludedPortlets(PageNavigationalState pageNavState, StrategyResponse strategyResponse)
- {
- List excludedList = strategyResponse.getNoRenderList();
- for (Iterator i = pageNavState.getWindowContexts().iterator(); i.hasNext();)
- {
- WindowContext windowContext = (WindowContext)i.next();
- pageNavState.setWindowVisible(windowContext.getId(), !excludedList.contains(windowContext));
- }
- }
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -38,11 +38,9 @@
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
import org.jboss.portal.theme.page.PageService;
-import org.jboss.portal.theme.page.ModifiablePageResult;
+import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
@@ -103,7 +101,7 @@
portalProperties.put("theme.renderSetId", "divRenderer");
portalProperties.put("theme.id", "renaissance");
portalProperties.put("layout.strategyId", "maximizedRegion");
- ModifiablePageResult result = new ModifiablePageResult("BILTO", pageProperties, portalProperties);
+ PageResult result = new PageResult("BILTO", pageProperties, portalProperties);
//
Map windowProps = new HashMap();
@@ -112,21 +110,17 @@
windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
//
- WindowResult res = new ModifiableWindowResult("", content, Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+ WindowResult res = new WindowResult("", content, Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
WindowContext blah = new WindowContext("BILTO", "BILTO", "maximized", 0);
result.addWindowContext(blah);
result.addWindowResult("BILTO", res);
//
- PageNavigationalState pns = new PageNavigationalState();
- HashMap tmp = new HashMap();
- tmp.put("BILTO", blah);
- pns.initialize(tmp);
- pns.setLayoutURI("/layouts/generic/maximized.jsp");
- pns.setLayoutState("maximized");
+ result.setLayoutState("maximized");
+ result.setLayoutURI(layout.getLayoutInfo().getURI("maximized"));
//
- return new PageRendition(layout, pns, result, ps);
+ return new PageRendition(layout, result, ps);
}
catch (PortletInvokerException e)
{
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -26,16 +26,11 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.InvocationContext;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.aspects.controller.PageNavigationInterceptor;
-import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.strategy.StrategyException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -106,18 +101,6 @@
windowNavState.setWindowState(windowState);
}
- // Udpate the page nav state
- try
- {
- ServerInvocation sinv = ((ControllerContext)getContext()).getServerInvocation();
- LayoutService layoutService = ((ControllerContext)getContext()).getController().getPageService().getLayoutService();
- PageNavigationInterceptor.updatePageNavigationalState(layoutService, context, sinv, portal, page, window, getMode(), getWindowState());
- }
- catch (StrategyException e)
- {
- throw new InvocationException(e);
- }
-
//
return new UpdateWindowMarkupResponse(window.getId());
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -27,10 +27,7 @@
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
-import org.jboss.portal.theme.page.WindowContext;
import java.util.Iterator;
@@ -75,9 +72,10 @@
{
// For now just update the navigational state of the page
- PageNavigationalState pns = (PageNavigationalState)getContext().getAttribute(NAVIGATIONAL_STATE_SCOPE, page.getId());
+// PageNavigationalState pns = (PageNavigationalState)getContext().getAttribute(NAVIGATIONAL_STATE_SCOPE, page.getId());
//
+/*
for (Iterator i = pns.getWindowContexts().iterator(); i.hasNext();)
{
WindowContext windowCtx = (WindowContext)i.next();
@@ -96,6 +94,7 @@
windowCtx.setOrder(windowCtx.getOrder() + 1);
}
}
+*/
//
if (isDashboard())
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -24,7 +24,6 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.util.Exceptions;
import org.jboss.portal.common.NotYetImplemented;
@@ -41,7 +40,6 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.identity.User;
import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.info.ModeInfo;
@@ -67,13 +65,11 @@
import org.jboss.portal.theme.ThemeConstants;
import org.jboss.portal.theme.ThemeResult;
import org.jboss.portal.theme.ThemeService;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
+import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.page.PageService;
import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.render.MarkupResult;
+import org.jboss.portal.theme.page.WindowContext;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
@@ -223,15 +219,6 @@
HttpServletRequest request = sinv.getServerContext().getClientRequest();
try
{
- // Ensure that the page nav state is in place
- AttributeResolver navCtx = sinv.getContext().getAttributeResolver(NAVIGATIONAL_STATE_SCOPE);
- PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(page.getId());
-
- if (pageNavState == null)
- {
- throw new InvocationException("PageNavigationalState not available in NavigationalStateContext");
- }
-
//
PageService pageService = context.getController().getPageService();
PortalTheme theme = null;
@@ -259,8 +246,11 @@
// Call the portlet container to create the markup fragment(s) for each portlet that needs to render itself
ServerConfig cfg = sinv.getRequest().getServer().getConfig();
- ModifiablePageResult renderResult = new ModifiablePageResult(getPage().getName(), new HashMap(getPage().getDeclaredProperties()), new HashMap(getPage().getPortal().getDeclaredProperties()));
+ PageResult pageResult = new PageResult(getPage().getName(), new HashMap(getPage().getDeclaredProperties()), new HashMap(getPage().getPortal().getDeclaredProperties()));
+ // Set the layout uri
+ pageResult.setLayoutURI(layout.getLayoutInfo().getURI());
+
// Render
for (Iterator i = windows.iterator(); i.hasNext();)
{
@@ -268,18 +258,22 @@
if (o instanceof Window)
{
Window window = (Window)o;
- if (pageNavState.isWindowVisible(window.getId()))
+ boolean visible = true;
+ if (visible)
{
Object res = renderPortletWindow(cfg, window);
if (res == null)
{
// Skip
}
- else if (res instanceof MarkupResult)
+ else if (res instanceof WindowResult)
{
- MarkupResult result = (MarkupResult)res;
- renderResult.addWindowContext(pageNavState.getWindowContext(window.getId()));
- renderResult.addWindowResult(window.getId(), (WindowResult)result);
+ WindowResult result = (WindowResult)res;
+ String region = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
+ String order = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER);
+ WindowContext wc = new WindowContext(window.getName(), window.getId(), region, Integer.parseInt(order));
+ pageResult.addWindowContext(wc);
+ pageResult.addWindowResult(window.getId(), result);
}
else
{
@@ -289,16 +283,51 @@
}
}
+ // Take care of maximized window HERE
+ for (Iterator i = pageResult.getWindowIds().iterator();i.hasNext();)
+ {
+ String windowId = (String)i.next();
+ WindowResult res = pageResult.getWindowResult(windowId);
+ if (WindowState.MAXIMIZED.equals(res.getWindowState()))
+ {
+ PageResult newRes = new PageResult(
+ pageResult.getPageName(),
+ pageResult.getPageProperties(),
+ pageResult.getPortalProperties());
+
+ //
+ WindowContext ctx = pageResult.getWindowContext(windowId);
+
+ //
+ newRes.setLayoutState("maximized");
+ newRes.setLayoutURI(layout.getLayoutInfo().getURI("maximized"));
+
+ //
+ ctx.setRegionName("maximized");
+ ctx.setOrder(0);
+
+ //
+ newRes.addWindowContext(ctx);
+ newRes.addWindowResult(windowId, res);
+
+ //
+ pageResult = newRes;
+
+ break;
+ }
+ }
+
+
// Make the theme available as servlet request attribute (needed for CM)
if (theme != null)
{
- // render the theme markup and place it into the request so that the markup assembler (theme tag) can pick it up there
+ // Render the theme markup and place it into the request so that the markup assembler (theme tag) can pick it up there
ThemeResult themeResult = theme.assembleResponse(sinv.getRequest(), sinv.getResponse());
- renderResult.setTheme(theme);
- renderResult.setThemeResult(themeResult);
+ pageResult.setTheme(theme);
+ pageResult.setThemeResult(themeResult);
//
- return new PageRendition(layout, pageNavState, renderResult, pageService);
+ return new PageRendition(layout, pageResult, pageService);
}
}
catch (Exception e)
@@ -397,8 +426,15 @@
Map actionMap = new HashMap();
Properties responseProps;
Map windowProps = window.getDeclaredProperties();
- WindowNavigationalState windowNavState = (WindowNavigationalState)this.context.getAttribute(NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window");
+ String navStateKey = window.getId() + "_window";
+ WindowNavigationalState windowNavState = (WindowNavigationalState)context.getAttribute(NAVIGATIONAL_STATE_SCOPE, navStateKey);
+ if (windowNavState == null)
+ {
+ windowNavState = new WindowNavigationalState();
+ context.setAttribute(NAVIGATIONAL_STATE_SCOPE, navStateKey, windowNavState);
+ }
+
try
{
RenderPortletWindowCommand renderCmd = new RenderPortletWindowCommand(windowRef);
@@ -469,7 +505,7 @@
contentChars = fragment.getContent();
//
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
else if (response instanceof ErrorResponse)
{
@@ -487,7 +523,7 @@
{
contentChars = Exceptions.toHTML(t, true);
}
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
else if (response instanceof UnavailableResponse)
@@ -500,7 +536,7 @@
actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
responseProps = new Properties();
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
else if (response instanceof InsufficientPrivilegesResponse)
@@ -526,7 +562,7 @@
windowTitle = "Access denied";
contentChars = "Access denied";
responseProps = new Properties();
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
catch (ResourceNotFoundException e)
@@ -542,7 +578,7 @@
windowTitle = "Cannot render";
contentChars = "Object not found " + e.getRef();
responseProps = new Properties();
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
catch (ControllerException e)
@@ -559,7 +595,7 @@
windowTitle = "An internal error occured while rendering window '" + window + "'";
responseProps = new Properties();
contentChars = Exceptions.toHTML(e, true);
- return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars, windowNavState.getWindowState(), windowNavState.getMode());
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -64,11 +64,12 @@
StateString navigationalState = (StateString)getAttribute(NAVIGATIONAL_STATE_SCOPE, window.getInstanceRef());
//
- WindowNavigationalState windowNavState = (WindowNavigationalState)getAttribute(NAVIGATIONAL_STATE_SCOPE, targetId + "_window");
+ String navStateKey = window.getId() + "_window";
+ WindowNavigationalState windowNavState = (WindowNavigationalState)getAttribute(NAVIGATIONAL_STATE_SCOPE, navStateKey);
if (windowNavState == null)
{
windowNavState = new WindowNavigationalState();
- setAttribute(NAVIGATIONAL_STATE_SCOPE, window.getId() + "_window", windowNavState);
+ setAttribute(NAVIGATIONAL_STATE_SCOPE, navStateKey, windowNavState);
}
// Get the mode
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -38,11 +38,10 @@
import org.jboss.portal.theme.metadata.PortalLayoutMetaData;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.page.PageService;
import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.theme.page.WindowResult;
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.xml.sax.SAXException;
@@ -118,19 +117,19 @@
return new RuntimeContext("TestAppId", new TestContext(), "TestContextPath", loader);
}
- public static ModifiableWindowResult createWindowResult(String windowTitle, String content)
+ public static WindowResult createWindowResult(String windowTitle, String content)
{
// setup the window result
return createWindowResult(windowTitle, content, Collections.EMPTY_MAP);
}
- public static ModifiableWindowResult createWindowResult(String title, String content, Map windowProps)
+ public static WindowResult createWindowResult(String title, String content, Map windowProps)
{
// setup the window result
Map actionsMap = Collections.EMPTY_MAP;
Properties responseProps = null;
String headerChars = null;
- return new ModifiableWindowResult(title, content, actionsMap, windowProps, responseProps, headerChars, null, null);
+ return new WindowResult(title, content, actionsMap, windowProps, responseProps, headerChars, null, null);
}
public static WindowNavigationalState createWindowNavigationalState()
@@ -201,7 +200,7 @@
public static PageResult createPageResult(AttributeResolver navCtx, String pageName,
Map pageProperties, Map portalProperties, WindowContext[] windows)
{
- ModifiablePageResult pageResult = new ModifiablePageResult(pageName, pageProperties, portalProperties);
+ PageResult pageResult = new PageResult(pageName, pageProperties, portalProperties);
for (int i = 0; i < windows.length; i++)
{
pageResult.addWindowContext(windows[i]);
Deleted: trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -1,289 +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.test.theme.render;
-
-import junit.framework.TestCase;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.invocation.AttributeResolver;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.test.theme.TestHelper;
-import org.jboss.portal.theme.LayoutService;
-import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.RuntimeContext;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.metadata.PortalLayoutMetaData;
-import org.jboss.portal.theme.metadata.RenderSetMetaData;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
-import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.page.PageService;
-import org.jboss.portal.theme.page.Region;
-import org.jboss.portal.theme.page.RegionOrientation;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.render.PortalRenderSet;
-import org.jboss.portal.theme.render.RenderContext;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public class TestRenderContext extends TestCase
-{
- private ModifiableWindowResult markupResult;
- private RuntimeContext runtimeContext;
- private PortalRenderSet renderSet;
- private PortalLayout layout;
- private WindowContext windowContext;
- private int order = 0;
- private LayoutService layoutService;
- private PageService pageService;
- private HTTPStreamInfo streamInfo;
- private ServerRequest serverRequest;
- private AttributeResolver navCtx;
- private Map portalProps = new HashMap();
- private Map pageProps = new HashMap();
-// private ServerRequest request;
-
- protected void setUp() throws Exception
- {
- String regionName = "windowRegionID";
- pageService = TestHelper.createPageService();
- layoutService = pageService.getLayoutService();
- String windowID = "windowId";
- String windowName = "windowName";
- WindowNavigationalState windowNavigationalState = TestHelper.createWindowNavigationalState();
- windowContext = new WindowContext(windowName, windowID, regionName, order);
- markupResult = TestHelper.createWindowResult("title", "content");
-
-/*
- navCtx = new AttributeResolver()
- {
- public Set getKeys()
- {
- throw new UnsupportedOperationException();
- }
- public Object getAttribute(Object attrKey) throws IllegalArgumentException
- {
- throw new UnsupportedOperationException();
- }
- public void setAttribute(Object attrKey, Object attrValue) throws IllegalArgumentException
- {
- throw new UnsupportedOperationException();
- }
- };
-
- navCtx.setAttribute(windowID + "_window", windowNavigationalState);
-*/
- markupResult.addWindowContext(windowContext);
- streamInfo = new HTTPStreamInfo(MediaType.HTML, "utf-8");
-// markupResult.setStreamInfo(streamInfo);
- portalProps.put(ThemeConstants.PORTAL_PROP_RENDERSET, "emptyRenderer");
- markupResult.setPortalProperties(portalProps);
- runtimeContext = TestHelper.createRuntimeContext();
- try
- {
- RenderSetMetaData renderSetMD = TestHelper.createRenderSetMD();
- layoutService.addRenderSet(runtimeContext, renderSetMD);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- renderSet = layoutService.getRenderSet("emptyRenderer", MediaType.HTML);
-
- PortalLayoutMetaData layoutMD = TestHelper.createLayoutMD();
- layout = (PortalLayout)runtimeContext.getClassLoader().loadClass(layoutMD.getClassName()).newInstance();
- layoutService.addLayout(runtimeContext, layoutMD);
- layout = layoutService.getLayout("TestLayout", false);
-
- serverRequest = TestHelper.createServerRequest();
- }
-
- protected void tearDown() throws Exception
- {
- TestHelper.destroyPageService(pageService);
- }
-
- public void testConstructor()
- {
- try
- {
- RenderContext ctx = new RenderContext(layout, streamInfo, markupResult, serverRequest);
- assertNotNull(ctx);
-// assertEquals(ctx.getContentType(), markupResult.getStreamInfo().getContentType());
- assertNull(ctx.getRegionOrientation());
- assertNull(ctx.getRegionID());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- assertFalse("unexpected exception occured", true);
- }
- }
-
- public void testConstructor2()
- {
- try
- {
- Region region1 = new Region("region1", "region1CSSID", RegionOrientation.HORIZONTAL);
- Region region2 = new Region("region2", "region2CSSID", RegionOrientation.VERTICAL);
-
- WindowContext wCtx1 = new WindowContext("window1", "window1id", region1.getId(), 0);
- WindowContext wCtx2 = new WindowContext("window2", "window2id", region1.getId(), 1);
- WindowContext wCtx3 = new WindowContext("window3", "window3id", region2.getId(), 0);
-
- PageResult result = TestHelper.createPageResult(navCtx, "pageName", pageProps, portalProps, new WindowContext[]{wCtx1, wCtx2, wCtx3});
- RenderContext ctx = new RenderContext(layout, streamInfo, result, serverRequest);
- assertNotNull(ctx);
- RenderContext ctx2 = ctx.getContext(region1, "cssID", RegionOrientation.VERTICAL);
- assertNotNull(ctx2);
- assertEquals("cssID", ctx2.getRegionID());
- assertEquals(ctx2.getRegionOrientation(), RegionOrientation.VERTICAL);
- assertEquals(ctx.getContentType(), ctx2.getContentType());
-
- ctx2 = ctx.getContext(wCtx3);
- assertNotNull(ctx2);
- assertEquals(ctx2.getCharset(), ctx.getCharset());
-
- ctx2 = ctx.getContext(region2, null, null);
- assertNotNull(ctx2);
- assertEquals("region2CSSID", ctx2.getRegionID());
- assertEquals(RegionOrientation.VERTICAL, ctx2.getRegionOrientation());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- assertFalse("unexpected exception occured", true);
- }
- }
-
- public void testRenderContext()
- {
- RenderContext ctx = new RenderContext(layout, streamInfo, markupResult, serverRequest);
- assertNotNull(ctx.getMarkupFragment());
- assertNotNull(ctx.getPageProperties());
- assertTrue(ctx.getPageProperties().isEmpty());
-// Mode portletMode = ctx.getPortletMode(windowContext);
-// assertNotNull(portletMode);
- assertNull(ctx.getRegionID());
-// assertEquals(WindowState.NORMAL, ctx.getWindowState(windowContext));
- assertEquals(ctx.getWindowRenderer(), ctx.getWindowRenderer(markupResult));
- assertEquals(ctx.getPortletRenderer(), ctx.getPortletRenderer(markupResult));
- assertEquals(ctx.getDecorationRenderer(), ctx.getDecorationRenderer(markupResult));
- assertNotNull(ctx.getRegionRenderer());
- }
-
- public void testRenderContext2()
- {
- RenderContext ctx = new RenderContext(layout, streamInfo, markupResult, serverRequest);
- String renderSetName = renderSet.getName();
- assertEquals(ctx.getRegionRenderer(), ctx.getRegionRenderer(renderSetName));
- assertEquals(ctx.getLayoutRegionNames(), layout.getLayoutInfo().getRegionNames());
- assertNull(ctx.getRegionOrientation());
- assertNull(ctx.getRegionID());
-
- assertNotNull(ctx.getRegionRenderer());
- assertNotNull(ctx.getWindowRenderer());
- assertNotNull(ctx.getDecorationRenderer());
- assertNotNull(ctx.getPortletRenderer());
- }
-
- /**
- * Test the overwrite behaviour of window properties Window Properties can
- */
- public void testRenderContext3()
- {
- Map windowProperties = new HashMap();
- //overwrite the decoration renderer with that from another render set
- try
- {
- // prepare a second renderSet and add it to the layout service so that the render context can get the details about it from there
- List renderSetMDList = TestHelper.createRenderSetMDList();
- assertTrue(renderSetMDList.size() == 2);
- RenderSetMetaData renderSetMD = (RenderSetMetaData)renderSetMDList.get(1);
- layoutService.addRenderSet(runtimeContext, renderSetMD);
- PortalRenderSet renderSet2 = layoutService.getRenderSet("divRenderer", MediaType.HTML);
- String renderSetName = renderSet2.getName();
- windowProperties.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, renderSetName);
-
- ModifiableWindowResult markupResult = TestHelper.createWindowResult("title", "content", windowProperties);
- Map portalProps = new HashMap();
- portalProps.put(ThemeConstants.PORTAL_PROP_RENDERSET, "emptyRenderer");
- markupResult.setPortalProperties(portalProps);
-
- RenderContext ctx = new RenderContext(layout, streamInfo, markupResult, serverRequest);
- assertNotNull(ctx.getProperty(markupResult, ThemeConstants.PORTAL_PROP_DECORATION_RENDERER));
- assertFalse(ctx.getRegionRenderer().equals(ctx.getRegionRenderer(renderSetName)));
- assertEquals(renderSet2.getDecorationRenderer(), ctx.getDecorationRenderer(markupResult));
- assertEquals(renderSet.getPortletRenderer(), ctx.getPortletRenderer());
- assertEquals(renderSet.getPortletRenderer(), ctx.getPortletRenderer(markupResult));
- assertFalse(renderSet2.getPortletRenderer().equals(ctx.getPortletRenderer(markupResult)));
- }
- catch (Exception e)
- {
- e.printStackTrace();
- assertFalse("unexpected exception occured", true);
- }
- }
-
- public void testRenderContext4()
- {
- ModifiableWindowResult markupResult = TestHelper.createWindowResult("title", "content", new HashMap());
-
- try
- {
- new RenderContext(layout, streamInfo, markupResult, serverRequest);
- assertFalse("expected exception did not occur", true);
- }
- catch (IllegalStateException e)
- {
- // expected : No render set can be determined
- // the result has no page or portal properties set, and the layout doesn't define a render set either
- }
- }
-
- public void testRenderContext5()
- {
- ModifiablePageResult pageResult = new ModifiablePageResult("testPage", pageProps, new HashMap());
- ModifiableWindowResult markupResult = TestHelper.createWindowResult(windowContext.getWindowName(), "content", new HashMap());
- pageResult.addWindowContext(windowContext);
- pageResult.addWindowResult(windowContext.getId(), markupResult);
- try
- {
- new RenderContext(layout, streamInfo, pageResult, serverRequest);
- assertFalse("expected exception did not occur", true);
- }
- catch (IllegalStateException e)
- {
- // expected : No render set can be determined
- // the result has no portal properties set, and the layout doesn't define a render set either
- }
- }
-}
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -39,22 +39,13 @@
import org.jboss.portal.theme.deployment.jboss.RenderSetMetaDataFactory;
import org.jboss.portal.theme.impl.LayoutServiceImpl;
import org.jboss.portal.theme.impl.ThemeServiceImpl;
-import org.jboss.portal.theme.impl.render.div.DivDecorationRenderer;
-import org.jboss.portal.theme.impl.render.div.DivPortletRenderer;
-import org.jboss.portal.theme.impl.render.div.DivRegionRenderer;
-import org.jboss.portal.theme.impl.render.div.DivWindowRenderer;
-import org.jboss.portal.theme.impl.render.dynamic.DynaDecorationRenderer;
-import org.jboss.portal.theme.impl.render.dynamic.DynaPortletRenderer;
-import org.jboss.portal.theme.impl.render.dynamic.DynaRegionRenderer;
-import org.jboss.portal.theme.impl.render.dynamic.DynaWindowRenderer;
import org.jboss.portal.theme.metadata.PortalLayoutMetaData;
import org.jboss.portal.theme.metadata.PortalThemeMetaData;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.render.PortalRenderSet;
-import org.jboss.portal.theme.render.RenderContext;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -79,7 +70,7 @@
private PortalTheme theme;
- private ModifiableWindowResult markupResult;
+ private WindowResult markupResult;
private static final String TEST_PAGE_NAME = "TestPage";
@@ -148,7 +139,7 @@
ServerRequest serverRequest = TestHelper.createServerRequest();
// pageresult obj
- ModifiablePageResult pageResult = new ModifiablePageResult(TEST_PAGE_NAME, pageProps, portalProps);
+ PageResult pageResult = new PageResult(TEST_PAGE_NAME, pageProps, portalProps);
pageResult.setLayoutURI(layout.getLayoutInfo().getURI());
pageResult.setTheme(theme);
@@ -163,7 +154,6 @@
pageResult.addWindowResult(wCtx.getId(), createWindowMarkup(title, content, wCtx, portalProps, pageProps));
markupResult = createWindowMarkup(title, content, wCtx, portalProps, pageProps);
- markupResult.addWindowContext(wCtx);
assertEquals(markupResult.getContent(), content);
assertEquals(markupResult.getTitle(), title);
@@ -178,35 +168,33 @@
pageResult.addWindowResult(wCtx.getId(), createWindowMarkup(title, content, wCtx, portalProps, pageProps));
markupResult = createWindowMarkup(title, content, wCtx, portalProps, pageProps);
- markupResult.addWindowContext(wCtx);
assertEquals(markupResult.getContent(), content);
assertEquals(markupResult.getTitle(), title);
}
- markupResult.setPortalProperties(portalProps);
- RenderContext renderCtx = new RenderContext(layout, streamInfo, markupResult, serverRequest);
-
- // test renderer
- assertEquals(renderCtx.getRegionRenderer(), renderCtx.getRegionRenderer(renderSet.getName()));
- assertEquals(renderCtx.getLayoutRegionNames(), layout.getLayoutInfo().getRegionNames());
- assertNull(renderCtx.getRegionOrientation());
- assertNull(renderCtx.getRegionID());
- assertTrue(renderSet.isAjaxEnabled());
- assertEquals(renderCtx.getDecorationRenderer().getClass(), new DynaDecorationRenderer(new DivDecorationRenderer()).getClass());
- assertEquals(renderCtx.getPortletRenderer().getClass(), new DynaPortletRenderer(new DivPortletRenderer()).getClass());
- assertEquals(renderCtx.getRegionRenderer().getClass(), new DynaRegionRenderer(new DivRegionRenderer()).getClass());
- assertEquals(renderCtx.getWindowRenderer().getClass(), new DynaWindowRenderer(new DivWindowRenderer()).getClass());
-
- // test fragment + page props
- assertNotNull(renderCtx.getMarkupFragment());
- assertNotNull(renderCtx.getPageProperties());
-
- // test window renderers
- assertEquals(renderCtx.getWindowRenderer(), renderCtx.getWindowRenderer(markupResult));
- assertEquals(renderCtx.getPortletRenderer(), renderCtx.getPortletRenderer(markupResult));
- assertEquals(renderCtx.getDecorationRenderer(), renderCtx.getDecorationRenderer(markupResult));
- assertNotNull(renderCtx.getRegionRenderer());
+// RenderContext renderCtx = new RenderContext(layout, streamInfo, markupResult, serverRequest);
+//
+// // test renderer
+// assertEquals(renderCtx.getRegionRenderer(), renderCtx.getRegionRenderer(renderSet.getName()));
+// assertEquals(renderCtx.getLayoutRegionNames(), layout.getLayoutInfo().getRegionNames());
+// assertNull(renderCtx.getRegionOrientation());
+// assertNull(renderCtx.getRegionID());
+// assertTrue(renderSet.isAjaxEnabled());
+// assertEquals(renderCtx.getDecorationRenderer().getClass(), new DynaDecorationRenderer(new DivDecorationRenderer()).getClass());
+// assertEquals(renderCtx.getPortletRenderer().getClass(), new DynaPortletRenderer(new DivPortletRenderer()).getClass());
+// assertEquals(renderCtx.getRegionRenderer().getClass(), new DynaRegionRenderer(new DivRegionRenderer()).getClass());
+// assertEquals(renderCtx.getWindowRenderer().getClass(), new DynaWindowRenderer(new DivWindowRenderer()).getClass());
+//
+// // test fragment + page props
+// assertNotNull(renderCtx.getMarkupFragment());
+// assertNotNull(renderCtx.getPageProperties());
+//
+// // test window renderers
+// assertEquals(renderCtx.getWindowRenderer(), renderCtx.getWindowRenderer(markupResult));
+// assertEquals(renderCtx.getPortletRenderer(), renderCtx.getPortletRenderer(markupResult));
+// assertEquals(renderCtx.getDecorationRenderer(), renderCtx.getDecorationRenderer(markupResult));
+// assertNotNull(renderCtx.getRegionRenderer());
}
/**
@@ -217,15 +205,8 @@
* @param wCtx
* @return window markup result
*/
- private ModifiableWindowResult createWindowMarkup(String sTitle, String sContent, WindowContext wCtx, Map portalProps, Map pageProps)
+ private WindowResult createWindowMarkup(String sTitle, String sContent, WindowContext wCtx, Map portalProps, Map pageProps)
{
- ModifiableWindowResult markupResult = new ModifiableWindowResult(sTitle, sContent, Collections.EMPTY_MAP, new HashMap(), null, null, null, null);
- markupResult.addWindowContext(wCtx);
- markupResult.setLayoutURI(layout.getLayoutInfo().getURI());
- markupResult.setTheme(theme);
- markupResult.setPortalProperties(portalProps);
- markupResult.setPageProperties(pageProps);
- markupResult.setPageName(TEST_PAGE_NAME);
- return markupResult;
+ return new WindowResult(sTitle, sContent, Collections.EMPTY_MAP, new HashMap(), null, null, null, null);
}
}
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -42,10 +42,10 @@
import org.jboss.portal.theme.metadata.PortalLayoutMetaData;
import org.jboss.portal.theme.metadata.PortalThemeMetaData;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
-import org.jboss.portal.theme.page.ModifiablePageResult;
-import org.jboss.portal.theme.page.ModifiableWindowResult;
import org.jboss.portal.theme.page.PageService;
import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.render.PortalRenderSet;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.xb.binding.Unmarshaller;
@@ -158,7 +158,7 @@
ServerRequest serverRequest = new ServerRequest();
// pageresult obj
- ModifiablePageResult pageResult = new ModifiablePageResult(TEST_PAGE_NAME, pageProps, portalProps);
+ PageResult pageResult = new PageResult(TEST_PAGE_NAME, pageProps, portalProps);
pageResult.setLayoutURI(layout.getLayoutInfo().getURI());
pageResult.setTheme(theme);
@@ -208,15 +208,8 @@
* @param wCtx
* @return window markup result
*/
- private ModifiableWindowResult createWindowMarkup(String sTitle, String sContent, WindowContext wCtx, Map portalProps, Map pageProps)
+ private WindowResult createWindowMarkup(String sTitle, String sContent, WindowContext wCtx, Map portalProps, Map pageProps)
{
- ModifiableWindowResult markupResult = new ModifiableWindowResult(sTitle, sContent, Collections.EMPTY_MAP, new HashMap(), null, null, null, null);
- markupResult.addWindowContext(wCtx);
- markupResult.setLayoutURI(layout.getLayoutInfo().getURI());
- markupResult.setTheme(theme);
- markupResult.setPortalProperties(portalProps);
- markupResult.setPageProperties(pageProps);
- markupResult.setPageName(TEST_PAGE_NAME);
- return markupResult;
+ return new WindowResult(sTitle, sContent, Collections.EMPTY_MAP, new HashMap(), null, null, null, null);
}
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/LayoutDispatcher.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/LayoutDispatcher.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/LayoutDispatcher.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.server.servlet.FilterCommand;
import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.render.MarkupResult;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
@@ -55,14 +54,14 @@
/** The layout */
private final HttpServletRequest request;
private final HttpServletResponse response;
- private final MarkupResult markupResult;
+ private final PageResult markupResult;
private final RenderContext renderContext;
/**
* @param renderContext
* @throws IllegalArgumentException if the layout is null
*/
- public LayoutDispatcher(RenderContext renderContext, HttpServletRequest request, HttpServletResponse response, MarkupResult result)
+ public LayoutDispatcher(RenderContext renderContext, HttpServletRequest request, HttpServletResponse response, PageResult result)
throws IllegalArgumentException
{
if (request == null)
Modified: trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -25,9 +25,9 @@
import org.jboss.portal.common.MediaType;
import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.theme.render.MarkupResult;
import org.jboss.portal.theme.render.PortalRenderSet;
import org.jboss.portal.theme.strategy.LayoutStrategy;
+import org.jboss.portal.theme.page.PageResult;
import java.util.Collection;
@@ -119,5 +119,5 @@
*/
Collection getRenderSets();
- PortalRenderSet getRenderSet(LayoutInfo info, HTTPStreamInfo streamInfo, MarkupResult result);
+ PortalRenderSet getRenderSet(LayoutInfo info, HTTPStreamInfo streamInfo, PageResult result);
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/PageRendition.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/PageRendition.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/PageRendition.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -23,9 +23,8 @@
package org.jboss.portal.theme;
import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
-import org.jboss.portal.theme.page.ModifiablePageResult;
import org.jboss.portal.theme.page.PageService;
+import org.jboss.portal.theme.page.PageResult;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -42,18 +41,14 @@
private PortalLayout layout;
/** . */
- private PageNavigationalState pageNavState;
+ private PageResult pageResult;
/** . */
- private ModifiablePageResult pageResult;
-
- /** . */
private PageService pageService;
- public PageRendition(PortalLayout layout, PageNavigationalState pageNavState, ModifiablePageResult markupResult, PageService pageService)
+ public PageRendition(PortalLayout layout, PageResult markupResult, PageService pageService)
{
this.layout = layout;
- this.pageNavState = pageNavState;
this.pageResult = markupResult;
this.pageService = pageService;
}
@@ -61,10 +56,6 @@
/** Performs the page rendition. */
public void render(ServerInvocation invocation) throws IOException, ServletException
{
- // If possible and needed, propagate the navigational state of the page into the result
- pageResult.setLayoutURI(pageNavState.getLayoutURI());
- pageResult.setLayoutState(pageNavState.getLayoutState());
-
//
HttpServletRequest clientRequest = invocation.getServerContext().getClientRequest();
@@ -85,7 +76,7 @@
}
}
- public ModifiablePageResult getPageResult()
+ public PageResult getPageResult()
{
return pageResult;
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -25,8 +25,8 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerRequest;
import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.theme.render.MarkupResult;
import org.jboss.portal.theme.render.RenderContext;
+import org.jboss.portal.theme.page.PageResult;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -58,7 +58,7 @@
* @throws ServletException
* @throws IOException
*/
- public abstract void assembleResponse(ServerInvocation invocation, MarkupResult markupResult)
+ public abstract void assembleResponse(ServerInvocation invocation, PageResult markupResult)
throws ServletException, IOException;
/**
@@ -100,7 +100,7 @@
* @param markupResult the result of the portlet render process
* @return a new render context
*/
- public RenderContext getRenderContext(HTTPStreamInfo streamInfo, ServerRequest request, MarkupResult markupResult)
+ public RenderContext getRenderContext(HTTPStreamInfo streamInfo, ServerRequest request, PageResult markupResult)
{
return new RenderContext(this, streamInfo, markupResult, request);
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/ServerRegistrationID.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/ServerRegistrationID.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/ServerRegistrationID.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -50,19 +50,12 @@
{
return true;
}
- if (!(o instanceof Type))
+ if (o instanceof Type)
{
- return false;
+ Type that = (Type)o;
+ return this.type.equals(that.type);
}
-
- final Type type1 = (Type)o;
-
- if (!type.equals(type1.type))
- {
- return false;
- }
-
- return true;
+ return false;
}
public int hashCode()
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -26,7 +26,7 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.theme.LayoutDispatcher;
import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.render.MarkupResult;
+import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.render.RenderContext;
import javax.servlet.ServletException;
@@ -43,8 +43,8 @@
*/
public final class JSPLayout extends PortalLayout
{
- /** @see PortalLayout#assembleResponse(org.jboss.portal.server.ServerInvocation,org.jboss.portal.theme.render.MarkupResult) */
- public void assembleResponse(ServerInvocation invocation, MarkupResult markupResult)
+
+ public void assembleResponse(ServerInvocation invocation, PageResult markupResult)
throws ServletException, IOException
{
HttpServletRequest httpRequest = invocation.getServerContext().getClientRequest();
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -33,11 +33,11 @@
import org.jboss.portal.theme.RuntimeContext;
import org.jboss.portal.theme.ServerRegistrationID;
import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
import org.jboss.portal.theme.metadata.PortalLayoutMetaData;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
import org.jboss.portal.theme.metadata.RendererSetMetaData;
-import org.jboss.portal.theme.render.MarkupResult;
import org.jboss.portal.theme.render.PortalRenderSet;
import org.jboss.portal.theme.strategy.LayoutStrategy;
import org.jboss.system.Service;
@@ -499,7 +499,7 @@
* @param result
* @return a renderSet to decorate the markup fragments on the page with
*/
- public PortalRenderSet getRenderSet(LayoutInfo info, HTTPStreamInfo streamInfo, MarkupResult result)
+ public PortalRenderSet getRenderSet(LayoutInfo info, HTTPStreamInfo streamInfo, PageResult result)
{
if (info == null || result == null || streamInfo == null)
{
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/strategy/MaximizingStrategyImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/strategy/MaximizingStrategyImpl.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/strategy/MaximizingStrategyImpl.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -24,6 +24,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.FixMe;
import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.theme.strategy.LayoutStrategy;
import org.jboss.portal.theme.strategy.NavigationalStateChangedEvent;
@@ -133,7 +134,8 @@
{
newState = WindowState.NORMAL;
}
- response.restoreWindowLocation(targetWindowId, newState);
+// response.restoreWindowLocation(targetWindowId, newState);
+ throw new FixMe();
}
}
@@ -158,13 +160,17 @@
maximizedWindowId + " will be the only maximized one]");
// change the window state back to normal, and make sure the
// window is not rendered
- response.restoreWindowLocation(windowLocation.getWindowId(), WindowState.NORMAL);
- response.addNoRender(windowLocation);
+
+ throw new FixMe();
+// response.addWindowStateChange(windowLocation.get);
+// response.restoreWindowLocation(windowLocation.getWindowId(), WindowState.NORMAL);
+// response.addNoRender(windowLocation);
}
else
{
// move the maximized window to the maximized region
- response.changeRegion(windowLocation.getWindowId(), WindowState.MAXIMIZED.toString());
+ throw new FixMe();
+// response.changeRegion(windowLocation.getWindowId(), WindowState.MAXIMIZED.toString());
}
}
}
Deleted: trunk/theme/src/main/org/jboss/portal/theme/navigation/PageNavigationalState.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/navigation/PageNavigationalState.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/navigation/PageNavigationalState.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -1,157 +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.theme.navigation;
-
-import org.jboss.portal.theme.page.WindowContext;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * A state provider for all the navigational state of the windows of one page.
- *
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public final class PageNavigationalState implements Serializable
-{
- private final Map windowContexts = new HashMap();
- private final Map previousWindowContexts = new HashMap();
- private String layoutState;
- private String uri;
-
- public PageNavigationalState()
- {
- }
-
- /**
- * Initialize the navigational state of all the windows on this page. <p>The page navigational state also carries a
- * list of all the available regions on the page (as defined in the layout of the page</p>
- *
- * @param windowContexts a Map (keyed by windowId) of WindowContext instances, one for each window on the page
- */
-// public void initialize(Map windowContexts, PageInitialStateProvider initialStateProvider)
- public void initialize(Map windowContexts)
- {
- this.layoutState = null;
- this.uri = null;
- this.windowContexts.clear();
- this.previousWindowContexts.clear();
- this.windowContexts.putAll(windowContexts);
- }
-
- public WindowContext getWindowContext(String windowId)
- {
- return (WindowContext)windowContexts.get(windowId);
- }
-
- public Collection getWindowContexts()
- {
- return windowContexts.values();
- }
-
- public Map getWindowContextMap()
- {
- return windowContexts;
- }
-
- public WindowContext getPreviousWindowContext(String windowID, boolean remove)
- {
- WindowContext ctx = (WindowContext)previousWindowContexts.get(windowID);
- if (ctx != null && remove)
- {
- previousWindowContexts.remove(windowID);
- }
- return ctx;
- }
-
- public void setWindowVisible(String windowId, boolean visible)
- {
- WindowContext windowCtx = (WindowContext)windowContexts.get(windowId);
- windowCtx.setVisible(visible);
- }
-
- public boolean isWindowVisible(String windowId)
- {
- WindowContext windowCtx = (WindowContext)windowContexts.get(windowId);
- if (windowCtx == null)
- {
- return false;
- }
- return windowCtx.isVisible();
- }
-
- public void setWindowRegion(String windowId, String regionName, boolean rememberPrevious)
- {
- WindowContext windowCtx = (WindowContext)windowContexts.get(windowId);
- if (rememberPrevious)
- {
- WindowContext previous = (WindowContext)previousWindowContexts.get(windowId);
- if (previous == null)
- {
- previous = WindowContext.copy(windowCtx);
- previousWindowContexts.put(windowId, previous);
- }
- }
- windowCtx.setRegionName(regionName);
- }
-
- public void setWindowOrder(String windowId, int order, boolean rememberPrevious)
- {
- WindowContext windowCtx = (WindowContext)windowContexts.get(windowId);
- if (rememberPrevious)
- {
- WindowContext previous = (WindowContext)previousWindowContexts.get(windowId);
- if (previous == null)
- {
- previous = WindowContext.copy(windowCtx);
- previousWindowContexts.put(windowId, previous);
- }
- }
- windowCtx.setOrder(order);
- }
-
- public void setLayoutState(String state)
- {
- layoutState = state;
- }
-
- public void setLayoutURI(String uri)
- {
- this.uri = uri;
- }
-
- public String getLayoutState()
- {
- return layoutState;
- }
-
- public String getLayoutURI()
- {
- return uri;
- }
-}
Modified: trunk/theme/src/main/org/jboss/portal/theme/navigation/WindowNavigationalState.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/navigation/WindowNavigationalState.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/navigation/WindowNavigationalState.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -33,14 +33,11 @@
*/
public class WindowNavigationalState implements Serializable
{
- /**
- *
- */
+
+ /** . */
private WindowState windowState;
- /**
- *
- */
+ /** . */
private Mode mode;
public WindowNavigationalState()
Deleted: trunk/theme/src/main/org/jboss/portal/theme/page/ModifiablePageResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/ModifiablePageResult.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/ModifiablePageResult.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -1,73 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.theme.page;
-
-import org.jboss.portal.theme.render.ModifiableMarkupResult;
-
-import java.util.Map;
-
-
-/**
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public final class ModifiablePageResult extends PageResult implements ModifiableMarkupResult
-{
- public ModifiablePageResult(String pageName, Map pageProperties, Map portalProperties)
- {
- super(pageName, pageProperties, portalProperties);
- }
-
- public void setLayoutURI(String uri)
- {
- layoutURI = uri;
- }
-
- public void setLayoutState(String layoutState)
- {
- this.layoutState = layoutState;
- }
-
- public void addWindowResult(String windowID, WindowResult result)
- {
- if (!portlets.keySet().contains(windowID))
- {
- throw new IllegalArgumentException("there was no window added for this window:" + windowID);
- }
- results.put(windowID, result);
- }
-
- public void addWindowContext(WindowContext windowContext)
- {
- portlets.put(windowContext.getId(), windowContext);
-
- Region region = (Region)portletRegions.get(windowContext.getRegionName());
- if (region == null)
- {
- region = new Region(windowContext.getRegionName());
- }
- region.addWindowContext(windowContext);
-
- portletRegions.put(region.getId(), region);
- }
-}
Deleted: trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableRegionResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableRegionResult.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableRegionResult.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -1,66 +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.theme.page;
-
-import org.jboss.portal.common.invocation.AttributeResolver;
-import org.jboss.portal.theme.render.ModifiableMarkupResult;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public class ModifiableRegionResult extends RegionResult implements ModifiableMarkupResult
-{
- public ModifiableRegionResult(AttributeResolver navCtx, String pageName,
- Region region, Map pageProperties, Map portalProperties)
- {
- super(pageName, region, pageProperties, portalProperties);
- }
-
- public void setLayoutURI(String uri)
- {
- layoutURI = uri;
- }
-
- public void setLayoutState(String layoutState)
- {
- this.layoutState = layoutState;
- }
-
- public void addWindowResult(String windowID, WindowResult result)
- {
- if (!portlets.keySet().contains(windowID))
- {
- throw new IllegalArgumentException("this window Id is not part of this result: " + windowID);
- }
- results.put(windowID, result);
- }
-
- public void addWindowContext(WindowContext windowContext)
- {
- portlets.put(windowContext.getId(), windowContext);
- region.addWindowContext(windowContext);
- }
-}
Deleted: trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableWindowResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableWindowResult.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/ModifiableWindowResult.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -1,91 +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.theme.page;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.Properties;
-import org.jboss.portal.theme.render.ModifiableMarkupResult;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public final class ModifiableWindowResult extends WindowResult implements ModifiableMarkupResult
-{
- /**
- * Create a new WindowResult with the information about the renderered portlet. <p>A window result contains the the
- * rendered markup fragment of the portlet, the title, a map of action urls to trigger mode and state changes, and
- * the properties that were set as portlet response properties.</p>
- *
- * @param title the title to be displayed for this portlet in the rendered page
- * @param content the rendered markup fragment of the portlet
- * @param actions a map of actions possible for this portlet
- * @param windowProperties the properties for this window
- * @param responseProperties the properties that were set as response properties during the portlet's render or
- * action
- * @param headerChars content that needs to be injected into the header
- * @see org.jboss.portal.theme.page.WindowResult.Action
- */
- public ModifiableWindowResult(String title, String content, Map actions, Map windowProperties, Properties responseProperties, String headerChars, WindowState windowState, Mode mode)
- {
- super(title, content, actions, windowProperties, responseProperties, headerChars, windowState, mode);
- }
-
- public void setLayoutURI(String uri)
- {
- layoutURI = uri;
- }
-
- public void setLayoutState(String layoutState)
- {
- this.layoutState = layoutState;
- }
-
- public void addWindowContext(WindowContext windowContext)
- {
- portlets.put(windowContext.getId(), windowContext);
- }
-
- public void addWindowResult(String windowID, WindowResult result)
- {
- throw new UnsupportedOperationException();
- }
-
- public void setPageName(String pageName)
- {
- this.pageName = pageName;
- }
-
- public void setPageProperties(Map pageProperties)
- {
- this.pageProperties = pageProperties;
- }
-
- public void setPortalProperties(Map portalProperties)
- {
- this.portalProperties = portalProperties;
- }
-}
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -22,10 +22,13 @@
******************************************************************************/
package org.jboss.portal.theme.page;
-import org.jboss.portal.theme.render.MarkupResult;
+import org.jboss.portal.theme.render.PortalRenderSet;
+import org.jboss.portal.theme.ThemeResult;
+import org.jboss.portal.theme.PortalTheme;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
/**
* Interface to represent the read only information of a rendered portal page. <p>The page result allows access to all
@@ -34,17 +37,53 @@
* @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
* @version $Revision$
*/
-public class PageResult extends MarkupResult
+public class PageResult
{
+
/** . */
- protected final Map portletRegions;
+ protected final Map results;
+ protected final Map windowContexts;
+ protected String pageName;
+ protected Map portalProperties;
+ protected Map pageProperties;
+ protected String layoutURI;
+ protected String layoutState;
+ protected PortalRenderSet renderSet;
+ protected ThemeResult themeResult;
+ protected PortalTheme theme;
+ protected final Map regions;
public PageResult(String pageName, Map pageProperties, Map portalProperties)
{
- super(pageName, pageProperties, portalProperties);
- portletRegions = new HashMap(5);
+ this.pageName = pageName;
+ this.pageProperties = pageProperties == null ? new HashMap() : pageProperties;
+ this.portalProperties = portalProperties == null ? new HashMap() : portalProperties;
+
+ results = new HashMap(5);
+ windowContexts = new HashMap(5);
+ regions = new HashMap(5);
}
+ public ThemeResult getThemeResult()
+ {
+ return themeResult;
+ }
+
+ public void setThemeResult(ThemeResult themeResult)
+ {
+ this.themeResult = themeResult;
+ }
+
+ public PortalTheme getTheme()
+ {
+ return theme;
+ }
+
+ public void setTheme(PortalTheme theme)
+ {
+ this.theme = theme;
+ }
+
/**
* Get a reference to the region object for the provided region name.
*
@@ -53,6 +92,144 @@
*/
public Region getRegion(String regionName)
{
- return (Region)portletRegions.get(regionName);
+ return (Region)regions.get(regionName);
}
+
+ /**
+ * Get the name of the requested page.
+ *
+ * @return the name of the page that is being rendered
+ */
+ public String getPageName()
+ {
+ return pageName;
+ }
+
+ /**
+ * Get the properties that were set for this page.
+ *
+ * @return a <code>java.util.Map</code> of the properties of this page
+ */
+ public Map getPageProperties()
+ {
+ return pageProperties;
+ }
+
+ /**
+ * Get the properties that were set for this page.
+ *
+ * @return a <code>java.util.Map</code> of the properties of this page
+ */
+ public Map getPortalProperties()
+ {
+ return portalProperties;
+ }
+
+ /**
+ * Get the uri of the layout that is used. <p>The uri is relative to the application context that hosts the
+ * layout.</p>
+ *
+ * @return the uri of the used layout
+ */
+ public String getLayoutURI()
+ {
+ return layoutURI;
+ }
+
+ /**
+ * Get the state string of the layout. <p>The state is used to further sub select a layout uri. One layout can
+ * contain a separate layout uri per state. The state has to match to string version of one of the allowed window
+ * states.<p>
+ *
+ * @return a string representing the current window state to potentially further select a more specific layout uri
+ */
+ public String getLayoutState()
+ {
+ return layoutState;
+ }
+
+ /**
+ * Get a Set of all window ids that are contained in this page.
+ *
+ * @return a set of all window ids on this page
+ */
+ public Set getWindowIds()
+ {
+ return windowContexts.keySet();
+ }
+
+ /**
+ * Get the <code>WindowResult</code> for a specific portlet window.
+ *
+ * @param windowId the window id identifying the portlet window to get the window result for
+ * @return the window result for the provided window id
+ */
+ public WindowResult getWindowResult(String windowId)
+ {
+ return (WindowResult)results.get(windowId);
+ }
+
+ /**
+ * Get a map of <code>WindowResult</code>s keyed by window id
+ *
+ * @return a map of window results
+ */
+ public Map getWindowResultMap()
+ {
+ return results;
+ }
+
+ /**
+ * Get the <code>WindowContext</code> for the provided window id.
+ *
+ * @param windowId the window id identifying the portlet to get the context for
+ * @return the window context for the provided window id
+ */
+ public WindowContext getWindowContext(String windowId)
+ {
+ return (WindowContext)windowContexts.get(windowId);
+ }
+
+ /**
+ * Get a map of all <code>PortletContext</code>s on the page keyed by window id
+ *
+ * @return a map of all portlet on the page
+ */
+ public Map getWindowContextMap()
+ {
+ return windowContexts;
+ }
+
+ public void setLayoutURI(String uri)
+ {
+ layoutURI = uri;
+ }
+
+ public void setLayoutState(String layoutState)
+ {
+ this.layoutState = layoutState;
+ }
+
+ public void addWindowResult(String windowId, WindowResult result)
+ {
+ if (!windowContexts.keySet().contains(windowId))
+ {
+ throw new IllegalArgumentException("there was no window added for this window:" + windowId);
+ }
+ results.put(windowId, result);
+ }
+
+ public void addWindowContext(WindowContext windowContext)
+ {
+ windowContexts.put(windowContext.getId(), windowContext);
+
+ Region region = (Region)regions.get(windowContext.getRegionName());
+ if (region == null)
+ {
+ region = new Region(windowContext.getRegionName());
+ }
+ region.addWindowContext(windowContext);
+
+ regions.put(region.getId(), region);
+ }
}
Deleted: trunk/theme/src/main/org/jboss/portal/theme/page/RegionResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/RegionResult.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/RegionResult.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -1,47 +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.theme.page;
-
-import org.jboss.portal.theme.render.MarkupResult;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public class RegionResult extends MarkupResult
-{
- protected final Region region;
-
- public RegionResult(String pageName, Region region, Map pageProperties, Map portalProperties)
- {
- super(pageName, pageProperties, portalProperties);
- this.region = region;
- }
-
- public Region getRegion()
- {
- return region;
- }
-}
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -25,7 +25,6 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.Properties;
-import org.jboss.portal.theme.render.MarkupResult;
import java.util.Collection;
import java.util.Map;
@@ -37,8 +36,12 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class WindowResult extends MarkupResult
+public class WindowResult
{
+
+ public static final String MODES_KEY = "mode";
+ public static final String WINDOWSTATES_KEY = "windowstate";
+
private String title;
private String content;
private Map actions;
@@ -47,8 +50,6 @@
private final Map windowProperties;
private final WindowState windowState;
private final Mode mode;
- public static final String MODES_KEY = "mode";
- public static final String WINDOWSTATES_KEY = "windowstate";
/**
* Create a new WindowResult with the information about the renderered portlet. <p>A window result contains the the
@@ -64,7 +65,15 @@
* @param headerChars content that needs to be injected into the header
* @see WindowResult.Action
*/
- public WindowResult(String title, String content, Map actions, Map windowProperties, Properties responseProperties, String headerChars, WindowState windowState, Mode mode)
+ public WindowResult(
+ String title,
+ String content,
+ Map actions,
+ Map windowProperties,
+ Properties responseProperties,
+ String headerChars,
+ WindowState windowState,
+ Mode mode)
{
this.properties = responseProperties;
this.title = title;
@@ -123,24 +132,6 @@
return windowProperties;
}
- public WindowContext getWindowContext()
- {
- if (portlets.keySet().isEmpty())
- {
- return null;
- }
- return (WindowContext)portlets.get(portlets.keySet().iterator().next());
- }
-
- public WindowResult getWindowResult(String windowHandle)
- {
- if (portlets.keySet().isEmpty() || !(portlets.keySet().contains(windowHandle)))
- {
- return null;
- }
- return this;
- }
-
/**
* Represents an action that can be triggered.
* <p/>
Deleted: trunk/theme/src/main/org/jboss/portal/theme/render/FragmentAssembler.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/FragmentAssembler.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/FragmentAssembler.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -1,63 +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.theme.render;
-
-import org.jboss.portal.theme.page.PageService;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * Express the capability to assemble the fragments presented by a markup result into a markup response. <p>The markup
- * result is an abstraction ontop of page, window, portlet , etc. results, and contains the markup fragments that were
- * produced by the portlet container. The fragment assemblers responsibility is to take these fragments, and assemble
- * them into a markup response that can be sent back to the displaying device. </p>
- *
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public interface FragmentAssembler
-{
- /**
- * Assemble the markup fragments from the individual component invocations into a response, and write it out.
- *
- * @param request the client request
- * @param response the client response
- * @param markupResult the result (page, region, window) containing the markup fragment(s) to assemble
- * @throws IOException
- * @throws ServletException
- */
- void assemble(HttpServletRequest request, HttpServletResponse response, MarkupResult markupResult)
- throws IOException, ServletException;
-
- /**
- * provide a page service reference that can be used during the assembly to access the page, layout, and theme
- * service
- *
- * @param pageService the page service to allow access to themes and layouts
- */
- void setPageService(PageService pageService);
-}
Deleted: trunk/theme/src/main/org/jboss/portal/theme/render/MarkupResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/MarkupResult.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/MarkupResult.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -1,194 +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.theme.render;
-
-import org.jboss.portal.theme.PortalTheme;
-import org.jboss.portal.theme.ThemeResult;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * The resulting markup fragment from a render process.
- *
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public abstract class MarkupResult
-{
- protected final Map results;
- protected final Map portlets;
- protected String pageName;
- protected Map portalProperties;
- protected Map pageProperties;
- protected String layoutURI;
- protected String layoutState;
- protected PortalRenderSet renderSet;
- protected ThemeResult themeResult;
- protected PortalTheme theme;
-
- public ThemeResult getThemeResult()
- {
- return themeResult;
- }
-
- public void setThemeResult(ThemeResult themeResult)
- {
- this.themeResult = themeResult;
- }
-
- public PortalTheme getTheme()
- {
- return theme;
- }
-
- public void setTheme(PortalTheme theme)
- {
- this.theme = theme;
- }
-
-
- public MarkupResult()
- {
- this(null, null, null);
- }
-
- public MarkupResult(String pageName, Map pageProperties, Map portalProperties)
- {
- this.pageName = pageName;
- this.pageProperties = pageProperties == null ? new HashMap() : pageProperties;
- this.portalProperties = portalProperties == null ? new HashMap() : portalProperties;
-
- results = new HashMap(5);
- portlets = new HashMap(5);
- }
-
- /**
- * Get the name of the requested page.
- *
- * @return the name of the page that is being rendered
- */
- public String getPageName()
- {
- return pageName;
- }
-
- /**
- * Get the properties that were set for this page.
- *
- * @return a <code>java.util.Map</code> of the properties of this page
- */
- public Map getPageProperties()
- {
- return pageProperties;
- }
-
- /**
- * Get the properties that were set for this page.
- *
- * @return a <code>java.util.Map</code> of the properties of this page
- */
- public Map getPortalProperties()
- {
- return portalProperties;
- }
-
- /**
- * Get the uri of the layout that is used. <p>The uri is relative to the application context that hosts the
- * layout.</p>
- *
- * @return the uri of the used layout
- */
- public String getLayoutURI()
- {
- return layoutURI;
- }
-
- /**
- * Get the state string of the layout. <p>The state is used to further sub select a layout uri. One layout can
- * contain a separate layout uri per state. The state has to match to string version of one of the allowed window
- * states.<p>
- *
- * @return a string representing the current window state to potentially further select a more specific layout uri
- */
- public String getLayoutState()
- {
- return layoutState;
- }
-
- /**
- * Get a Set of all window ids that are contained in this page.
- *
- * @return a set of all window ids on this page
- */
- public Set getWindowIDs()
- {
- return Collections.unmodifiableSet(portlets.keySet());
- }
-
- /**
- * Get the <code>WindowResult</code> for a specific portlet window.
- *
- * @param windowHandle the window id identifying the portlet window to get the window result for
- * @return the window result for the provided window id
- */
- public WindowResult getWindowResult(String windowHandle)
- {
- return (WindowResult)results.get(windowHandle);
- }
-
- /**
- * Get a map of <code>WindowResult</code>s keyed by window id
- *
- * @return a map of window results
- */
- public Map getWindowResultMap()
- {
- return Collections.unmodifiableMap(results);
- }
-
- /**
- * Get the <code>WindowContext</code> for the provided window id.
- *
- * @param windowId the window id identifying the portlet to get the context for
- * @return the window context for the provided window id
- */
- public WindowContext getWindowContext(String windowId)
- {
- return (WindowContext)portlets.get(windowId);
- }
-
- /**
- * Get a map of all <code>PortletContext</code>s on the page keyed by window id
- *
- * @return a map of all portlet on the page
- */
- public Map getWindowContextMap()
- {
- return Collections.unmodifiableMap(portlets);
- }
-}
Deleted: trunk/theme/src/main/org/jboss/portal/theme/render/ModifiableMarkupResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/ModifiableMarkupResult.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/ModifiableMarkupResult.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -1,41 +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.theme.render;
-
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
-
-/**
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public interface ModifiableMarkupResult
-{
- void setLayoutURI(String layoutURI);
-
- void setLayoutState(String layoutState);
-
- void addWindowContext(WindowContext windowContext);
-
- void addWindowResult(String windowID, WindowResult result);
-}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -30,9 +30,9 @@
import org.jboss.portal.theme.ThemeConstants;
import org.jboss.portal.theme.page.Region;
import org.jboss.portal.theme.page.RegionOrientation;
-import org.jboss.portal.theme.page.RegionResult;
import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.PageResult;
import java.util.List;
import java.util.Locale;
@@ -48,9 +48,10 @@
*/
public final class RenderContext
{
+
private PortalRenderSet renderSet;
private ServerRequest request;
- private MarkupResult result;
+ private PageResult pageResult;
private PortalLayout layout;
private String regionCssId;
@@ -61,7 +62,7 @@
private HTTPStreamInfo streamInfo;
// initialize
- private void init(PortalLayout layout, Object fragment, HTTPStreamInfo streamInfo, MarkupResult result, ServerRequest request)
+ private void init(PortalLayout layout, Object fragment, HTTPStreamInfo streamInfo, PageResult result, ServerRequest request)
{
this.renderSet = layout.getServiceInfo().getRenderSet(layout.getLayoutInfo(), streamInfo, result);
if (renderSet == null)
@@ -72,7 +73,7 @@
markup = new StringBuffer();
this.layout = layout;
- this.result = result;
+ this.pageResult = result;
this.request = request;
this.fragment = fragment;
this.streamInfo = streamInfo;
@@ -89,7 +90,7 @@
}
}
- private RenderContext(PortalLayout layout, Object markupContainer, HTTPStreamInfo streamInfo, MarkupResult result, ServerRequest request)
+ private RenderContext(PortalLayout layout, Object markupContainer, HTTPStreamInfo streamInfo, PageResult result, ServerRequest request)
{
init(layout, markupContainer, streamInfo, result, request);
}
@@ -103,7 +104,7 @@
* @param result the rendered result(s) from the portlet container (PageResult, RegionResult, WindowResult)
* @param request the current server request
*/
- public RenderContext(PortalLayout layout, HTTPStreamInfo streamInfo, MarkupResult result, ServerRequest request)
+ public RenderContext(PortalLayout layout, HTTPStreamInfo streamInfo, PageResult result, ServerRequest request)
{
if (layout == null)
{
@@ -122,23 +123,8 @@
throw new IllegalArgumentException("no request provided");
}
- if (result instanceof RegionResult)
- {
- // create the context for this region
- Region region = ((RegionResult)result).getRegion();
- init(layout, region, streamInfo, result, request);
- }
- else if (result instanceof WindowResult)
- {
- // create the context for this window only
- WindowContext windowContext = ((WindowResult)result).getWindowContext();
- init(layout, windowContext, streamInfo, result, request);
- }
- else
- {
- // context for the entire page
- init(layout, null, streamInfo, result, request);
- }
+ // context for the entire page
+ init(layout, null, streamInfo, result, request);
}
/**
@@ -153,7 +139,7 @@
*/
public RenderContext getContext(Region region, String cssId, RegionOrientation orientation)
{
- RenderContext context = new RenderContext(this.layout, region, this.streamInfo, this.result, this.request);
+ RenderContext context = new RenderContext(this.layout, region, this.streamInfo, this.pageResult, this.request);
if (cssId != null)
{
context.regionCssId = cssId;
@@ -174,7 +160,7 @@
*/
public RenderContext getContext(WindowContext windowContext)
{
- return new RenderContext(layout, windowContext, streamInfo, result, request);
+ return new RenderContext(layout, windowContext, streamInfo, pageResult, request);
}
/** @return a markup fragment */
@@ -262,7 +248,7 @@
if (result != null && renderSetName == null)
{
- renderSetName = (String)result.getPageProperties().get(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER);
+ renderSetName = (String)pageResult.getPageProperties().get(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER);
}
if (renderSetName != null)
@@ -304,7 +290,7 @@
if (result != null && renderSetName == null)
{
- renderSetName = (String)result.getPageProperties().get(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER);
+ renderSetName = (String)pageResult.getPageProperties().get(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER);
}
if (renderSetName != null)
@@ -350,7 +336,7 @@
if (result != null && renderSetName == null)
{
- renderSetName = (String)result.getPageProperties().get(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER);
+ renderSetName = (String)pageResult.getPageProperties().get(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER);
}
if (renderSetName != null)
@@ -375,7 +361,7 @@
/** @return the page properties */
public Map getPageProperties()
{
- return result.getPageProperties();
+ return pageResult.getPageProperties();
}
/** @return the names of all the regions as defined in the layout */
@@ -401,19 +387,17 @@
if (result != null && value == null)
{
- value = (String)result.getPageProperties().get(key);
+ value = (String)pageResult.getPageProperties().get(key);
}
return value;
}
- /** @return the prefered locale */
public Locale getLocale()
{
return request.getLocale();
}
- /** @return all locales allowed in the current request */
public Locale[] getLocales()
{
return request.getLocales();
@@ -435,13 +419,13 @@
{
// render the window
WindowContext wc = (WindowContext)fragment;
- WindowResult windowResult = result.getWindowResult(wc.getId());
+ WindowResult windowResult = pageResult.getWindowResult(wc.getId());
getWindowRenderer(windowResult).render(this, (WindowContext)fragment, windowResult);
}
else if (fragment instanceof Region)
{
// render the region
- getRegionRenderer().render(this, (Region)fragment, result.getWindowContextMap(), result.getWindowResultMap());
+ getRegionRenderer().render(this, (Region)fragment, pageResult.getWindowContextMap(), pageResult.getWindowResultMap());
}
else
{
Modified: trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -28,7 +28,6 @@
import org.jboss.portal.common.MediaType;
import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.theme.navigation.PageNavigationalState;
import org.jboss.portal.theme.navigation.WindowNavigationalState;
import org.jboss.portal.theme.page.WindowContext;
@@ -55,7 +54,6 @@
/** . */
private static Logger log = Logger.getLogger(StrategyContext.class);
- private final String[] regionNames;
private final HttpServletRequest httpRequest;
private final Set supportedWindowStates;
private final Set supportedPortletModes;
@@ -63,7 +61,7 @@
private final List localWindowContexts;
private final AttributeResolver navigationalStateContext;
- public StrategyContext(AttributeResolver navCtx, PageNavigationalState pageNavState,
+ public StrategyContext(AttributeResolver navCtx,
HttpServletRequest httpRequest, HTTPStreamInfo streamInfo,
Set windowStates, Set portletModes, List regionNames)
{
@@ -72,54 +70,34 @@
this.supportedPortletModes = portletModes;
this.streamInfo = streamInfo;
this.navigationalStateContext = navCtx;
- this.regionNames = new String[regionNames.size()];
- regionNames.toArray(this.regionNames);
-
-
- localWindowContexts = new ArrayList();
- for (Iterator i = pageNavState.getWindowContexts().iterator(); i.hasNext();)
- {
- localWindowContexts.add(new WindowLocation((WindowContext)i.next()));
- }
+ this.localWindowContexts = new ArrayList();
}
- /** @see org.jboss.portal.theme.strategy.StrategyContext#getLayoutRegions() */
- public String[] getLayoutRegions()
- {
- return regionNames;
- }
-
- /** @see org.jboss.portal.theme.strategy.StrategyContext#createResponse() */
public StrategyResponse createResponse()
{
return new StrategyResponse();
}
- /** @see org.jboss.portal.theme.strategy.StrategyContext#getHttpServletRequest() */
public HttpServletRequest getHttpServletRequest()
{
return httpRequest;
}
- /** @see org.jboss.portal.theme.strategy.StrategyContext#getMediaType() */
public MediaType getMediaType()
{
return streamInfo.getContentType();
}
- /** @see org.jboss.portal.theme.strategy.StrategyContext#getCharSet() */
public String getCharSet()
{
return streamInfo.getCharset();
}
- /** @see org.jboss.portal.theme.strategy.StrategyContext#isSupportedWindowState(WindowState) */
public boolean isSupportedWindowState(WindowState state)
{
return supportedWindowStates.contains(state);
}
- /** @see org.jboss.portal.theme.strategy.StrategyContext#isSupportedPortletMode(Mode) */
public boolean isSupportedPortletMode(Mode mode)
{
return supportedPortletModes.contains(mode);
Modified: trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyResponse.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyResponse.java 2006-11-27 21:36:52 UTC (rev 5728)
+++ trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyResponse.java 2006-11-28 01:46:21 UTC (rev 5729)
@@ -43,53 +43,40 @@
*/
public final class StrategyResponse
{
+
+ /** . */
private String state;
+
+ /** . */
private String layoutURI;
+
+ /** . */
private Map stateChangeMap;
+
+ /** . */
private Map modeChangeMap;
- private List noRenderList;
- private Map windowContextsToRestore;
- private Map windowRegionChangeMap;
- /** Create a new instance of a response. */
StrategyResponse()
{
this.stateChangeMap = new HashMap(5);
this.modeChangeMap = new HashMap(5);
- this.noRenderList = new ArrayList(5);
- this.windowContextsToRestore = new HashMap(5);
- this.windowRegionChangeMap = new HashMap(2);
}
- /** @see org.jboss.portal.theme.strategy.StrategyResponse#getLayoutURI() */
- public String getLayoutURI()
- {
- return layoutURI;
- }
-
- /** @see org.jboss.portal.theme.strategy.StrategyResponse#getWindowStateChangeMap() */
public Map getWindowStateChangeMap()
{
return Collections.unmodifiableMap(stateChangeMap);
}
- /** @see org.jboss.portal.theme.strategy.StrategyResponse#getNoRenderList() */
- public List getNoRenderList()
+ public void addPortletModeChange(WindowContext portlet, Mode mode)
{
- return Collections.unmodifiableList(noRenderList);
- }
-
- public void addNoRender(WindowLocation portlet)
- {
if (portlet == null)
{
- throw new NullPointerException("portlet reference is null");
+ throw new IllegalArgumentException("portlet reference is null");
}
- noRenderList.add(portlet);
- }
-
- public void addPortletModeChange(WindowContext portlet, Mode mode)
- {
+ if (mode == null)
+ {
+ throw new IllegalArgumentException("mode is null");
+ }
modeChangeMap.put(portlet, mode);
}
@@ -98,74 +85,36 @@
return Collections.unmodifiableMap(modeChangeMap);
}
- /** @see org.jboss.portal.theme.strategy.StrategyResponse#addWindowStateChange */
public void addWindowStateChange(WindowContext portlet, WindowState state)
{
- if (portlet == null || state == null)
+ if (portlet == null)
{
- throw new NullPointerException("portlet reference and/or state is null");
+ throw new IllegalArgumentException("portlet reference is null");
}
+ if (state == null)
+ {
+ throw new IllegalArgumentException("state is null");
+ }
stateChangeMap.put(portlet, state);
}
- /** @see org.jboss.portal.theme.strategy.StrategyResponse#reset */
- public void reset()
+ public String getLayoutURI()
{
- stateChangeMap.clear();
- modeChangeMap.clear();
- noRenderList.clear();
- windowContextsToRestore.clear();
- windowRegionChangeMap.clear();
- layoutURI = null;
- state = null;
+ return layoutURI;
}
- /** @see org.jboss.portal.theme.strategy.StrategyResponse#setLayoutURI */
public void setLayoutURI(String layoutURI)
{
this.layoutURI = layoutURI;
}
- /** @see org.jboss.portal.theme.strategy.StrategyResponse#setLayoutState */
- public void setLayoutState(String state)
- {
- this.state = state;
- }
-
- /** @see org.jboss.portal.theme.strategy.StrategyResponse#getLayoutState */
public String getLayoutState()
{
return state;
}
- /**
- * Restore the previous (original?) state of this window context <p>This is a cnvenience method for cases like the
- * maximized portlet that temporarily moves to another region while it is maximized. Once the maximized state is
- * changed back, the portlet needs to move back to its original region and order</p>
- *
- * @param windowID
- */
- public void restoreWindowLocation(String windowID, WindowState newState)
+ public void setLayoutState(String state)
{
- if (newState == null)
- {
- newState = WindowState.NORMAL;
- }
- windowContextsToRestore.put(windowID, newState);
+ this.state = state;
}
-
- public Map getWindowIDsToRestore()
- {
- return Collections.unmodifiableMap(windowContextsToRestore);
- }
-
- public void changeRegion(String windowID, String regionName)
- {
- windowRegionChangeMap.put(windowID, regionName);
- }
-
- public Map getWindowRegionChangeMap()
- {
- return Collections.unmodifiableMap(windowRegionChangeMap);
- }
}
17 years, 5 months
JBoss Portal SVN: r5728 - in trunk/wsrp/src/main/org/jboss/portal: test/wsrp/registration wsrp/producer/registration/impl
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-11-27 16:36:52 -0500 (Mon, 27 Nov 2006)
New Revision: 5728
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java
Log:
- Added more tests to cover removal of Registrations.
- Consumer now become pending when they don't own any registrations.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-11-27 21:33:14 UTC (rev 5727)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-11-27 21:36:52 UTC (rev 5728)
@@ -32,6 +32,7 @@
import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
import org.jboss.portal.wsrp.producer.registration.impl.RegistrationManagerImpl;
import org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl;
import org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy;
@@ -55,10 +56,13 @@
protected void setUp() throws Exception
{
manager = new RegistrationManagerImpl();
+ // todo: policy will need access to registration configuration information to validate properties
RegistrationPolicy policy = new DefaultRegistrationPolicy();
manager.setPolicy(policy);
manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
policy.setManager(manager);
+
+ //todo: registration properties setup will need to be updated when property validation is implemented
registrationProperties = new HashMap();
registrationProperties.put(new QName("prop1"), "value1");
registrationProperties.put(new QName("prop2"), "value2");
@@ -315,7 +319,7 @@
assertNull(manager.getRegistration(handle));
}
- public void testRemoveRegistration() throws Exception
+ public void testRemoveSingleRegistration() throws Exception
{
String consumerName = "consumer";
Consumer consumer = manager.createConsumer(consumerName);
@@ -325,11 +329,51 @@
assertTrue(consumer.getRegistrations().contains(reg));
+ // set the consumer status to valid
+ consumer.setStatus(RegistrationStatus.VALID);
+
manager.removeRegistration(handle);
assertTrue(!consumer.getRegistrations().contains(reg));
assertNull(manager.getRegistration(handle));
+
+ // since the consumer doesn't have any registration anymore, its status should become pending
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // shouldn't be possible anymore to retrieve the consumer from the registration handle
+ assertNull(manager.getConsumerFor(handle));
}
+ public void testRemoveRegistrationOnConsumerWithOtherRegistrations() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties, false);
+ String handle = reg.getRegistrationHandle();
+
+ // todo: this won't work anymore when properties validation is implemented
+ registrationProperties.put(new QName("prop3"), "value3");
+ Registration r2 = manager.addRegistrationTo(consumerName, registrationProperties, false);
+
+ RegistrationStatus status = consumer.getStatus();
+
+ manager.removeRegistration(handle);
+
+ // consumer status shouldn't have changed
+ assertEquals(status, consumer.getStatus());
+
+ // should still be able to retrieve consumer from r2 handle
+ assertEquals(consumer, manager.getConsumerFor(r2.getRegistrationHandle()));
+
+ // ... but not from handle
+ assertNull(manager.getConsumerFor(handle));
+ }
+
+ public void testAddRegistrationWithInvalidRegistrationProperties() throws Exception
+ {
+ // todo: implement
+ }
+
public void testRemoveInexistentRegistration() throws RegistrationException
{
try
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java 2006-11-27 21:33:14 UTC (rev 5727)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java 2006-11-27 21:36:52 UTC (rev 5728)
@@ -170,6 +170,12 @@
ParameterValidation.throwIllegalArgExceptionIfNull(registration, "Registration");
registrations.remove(registration);
+
+ // status should become pending if there are no registrations
+ if (registrations.isEmpty())
+ {
+ setStatus(RegistrationStatus.PENDING);
+ }
}
public void setGroup(ConsumerGroup group) throws RegistrationException
17 years, 5 months
JBoss Portal SVN: r5727 - in trunk/wsrp: . src/main/org/jboss/portal/test/wsrp/registration src/main/org/jboss/portal/wsrp/producer/registration/impl
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-11-27 16:33:14 -0500 (Mon, 27 Nov 2006)
New Revision: 5727
Added:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java
Log:
- Fixed a problem with Registration where the given registration properties where "live" (i.e. it was possible to modify outside of the registration).
- Added RegistrationTestCase to cover Registration.
- Added ConsumerGroupTestCase and RegistrationTestCase to test suite.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2006-11-27 20:33:29 UTC (rev 5726)
+++ trunk/wsrp/build.xml 2006-11-27 21:33:14 UTC (rev 5727)
@@ -700,7 +700,9 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.registration.RegistrationPersistenceManagerTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.registration.ConsumerTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.registration.ConsumerGroupTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.registration.RegistrationManagerTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.registration.RegistrationTestCase"/>
</x-test>
<x-sysproperty>
<!--<jvmarg value="-Xdebug"/>
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java 2006-11-27 20:33:29 UTC (rev 5726)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationTestCase.java 2006-11-27 21:33:14 UTC (rev 5727)
@@ -0,0 +1,132 @@
+/******************************************************************************
+ * 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.test.wsrp.registration;
+
+import junit.framework.TestCase;
+import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.Registration;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
+import org.jboss.portal.wsrp.producer.registration.impl.RegistrationManagerImpl;
+import org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl;
+import org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationTestCase extends TestCase
+{
+ private Registration registration;
+ private Map registrationProperties;
+
+ protected void setUp() throws Exception
+ {
+ RegistrationManager manager = new RegistrationManagerImpl();
+ RegistrationPolicy policy = new DefaultRegistrationPolicy()
+ {
+ public void validateRegistrationDataFor(Map registrationProperties, String consumerIdentity) throws IllegalArgumentException, RegistrationException, DuplicateRegistrationException
+ {
+ // accept any registration data here
+ }
+ };
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ policy.setManager(manager);
+
+ registrationProperties = new HashMap();
+ registrationProperties.put(new QName("prop1"), "value1");
+ registrationProperties.put(new QName("prop2"), "value2");
+
+ registration = manager.addRegistrationTo("name", registrationProperties, true);
+ }
+
+ public void testGetPropertiesIsUnmodifiable()
+ {
+ Map properties = registration.getProperties();
+
+ try
+ {
+ properties.remove("foo");
+ fail("Properties shouldn't be directly modifiable");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testPropertiesAreClonedNotLive()
+ {
+ QName prop = new QName("prop3");
+ registrationProperties.put(prop, "value3");
+
+ assertNull(registration.getProperties().get(prop));
+ }
+
+ public void testSetNullPropertyValueThrowsIAE()
+ {
+ try
+ {
+ registration.setPropertyValueFor("foo", null);
+ fail("Shouldn't accept null values for properties");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testSetNullPropertyNameThrowsIAE()
+ {
+ try
+ {
+ registration.setPropertyValueFor((QName)null, null);
+ fail("Shouldn't accept null names for properties");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testHasEqualProperties()
+ {
+ assertTrue(registration.hasEqualProperties(registration));
+
+ assertTrue(registration.hasEqualProperties(registrationProperties));
+
+ registrationProperties.put(new QName("prop3"), "value3");
+ assertTrue(!registration.hasEqualProperties(registrationProperties));
+ }
+
+ public void testClearAssociatedState()
+ {
+ //todo: implement
+ }
+
+}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java 2006-11-27 20:33:29 UTC (rev 5726)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java 2006-11-27 21:33:14 UTC (rev 5727)
@@ -30,6 +30,7 @@
import javax.xml.namespace.QName;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -53,7 +54,7 @@
this.id = id;
this.consumer = consumer;
this.status = status;
- this.properties = properties;
+ this.properties = new HashMap(properties);
}
public String getId()
17 years, 5 months