JBoss Portal SVN: r10618 - in modules/presentation/trunk: classic/src/main/java/org/jboss/portal/presentation/classic and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-17 09:21:54 -0400 (Thu, 17 Apr 2008)
New Revision: 10618
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationClient.java
Removed:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client2/
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server2/PresentationServer.java
Log:
move PresentationClient to client package now that it is available
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-17 12:48:35 UTC (rev 10617)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-17 13:21:54 UTC (rev 10618)
@@ -33,7 +33,7 @@
import org.jboss.portal.presentation.protocol.ErrorResponse;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
import org.jboss.portal.presentation.model.content.WindowContent;
-import org.jboss.portal.presentation.client2.PresentationClient;
+import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
import org.jboss.portal.presentation.impl.state.structural.StructuralNode;
import org.jboss.portal.presentation.impl.state.structural.WindowNode;
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-17 12:48:35 UTC (rev 10617)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-17 13:21:54 UTC (rev 10618)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.classic;
-import org.jboss.portal.presentation.client2.PresentationClient;
+import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.classic.model.DefaultPageViewPortScope;
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java 2008-04-17 12:48:35 UTC (rev 10617)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java 2008-04-17 13:21:54 UTC (rev 10618)
@@ -26,7 +26,7 @@
import org.jboss.portal.web.ServletContainer;
import org.jboss.portal.web.RequestDispatchCallback;
import org.jboss.portal.web.ServletContextDispatcher;
-import org.jboss.portal.presentation.client2.PresentationClient;
+import org.jboss.portal.presentation.client.PresentationClient;
import javax.servlet.ServletContext;
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationClient.java (from rev 10617, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client2/PresentationClient.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationClient.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationClient.java 2008-04-17 13:21:54 UTC (rev 10618)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.client;
+
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.web.ServletContextDispatcher;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * The contract that defines the services that the client provides to the server during a presentation server invocation.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface PresentationClient
+{
+
+ /**
+ * Renders the provided action as an hyperlink.
+ *
+ * @param action the action to render
+ * @param format the url format
+ * @return the rendered url
+ * @throws IllegalArgumentException if the action is null or cannot be rendered
+ */
+ String renderURL(ProtocolAction action, URLFormat format) throws IllegalArgumentException;
+
+ /**
+ * Renders the provided action as an hyperlink.
+ *
+ * @param writer the writer
+ * @param action the action to render
+ * @param format the url format
+ * @throws IllegalArgumentException if the action is null or cannot be rendered
+ * @throws IOException any IOException thrown by the writer
+ */
+ void renderURL(Writer writer, ProtocolAction action, URLFormat format) throws IOException;
+
+ /**
+ * Returns the navigational state context provided by the client.
+ *
+ * @return the navigational state context
+ */
+ NavigationalStateContext getNavigationalStateContext();
+
+ /**
+ * Returns the servlet context dispatcher.
+ *
+ * @return the servlet context dispatcher
+ */
+ ServletContextDispatcher getDispatcher();
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server2/PresentationServer.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server2/PresentationServer.java 2008-04-17 12:48:35 UTC (rev 10617)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server2/PresentationServer.java 2008-04-17 13:21:54 UTC (rev 10618)
@@ -24,7 +24,7 @@
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.model.content.WindowContent;
-import org.jboss.portal.presentation.client2.PresentationClient;
+import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.protocol.ProtocolAction;
/**
18 years
JBoss Portal SVN: r10617 - in modules/presentation/trunk/ajax/src: main/java/org/jboss/portal/presentation and 9 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-17 08:48:35 -0400 (Thu, 17 Apr 2008)
New Revision: 10617
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/client/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/GWTClientFilter.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/PortalEntryPoint.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/model/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxRequest.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxResponse.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/ClientController.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocation.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationContext.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationHandler.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/server/
Removed:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/client/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/model/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/server/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/GWTClientFilter.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/PortalEntryPoint.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxRequest.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxResponse.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/ClientController.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocation.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationContext.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationHandler.java
Modified:
modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/web.xml
modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.java
modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.java
Log:
move toremove stuff to a toremove package
Modified: modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/web.xml
===================================================================
--- modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/web.xml 2008-04-17 12:44:09 UTC (rev 10616)
+++ modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/web.xml 2008-04-17 12:48:35 UTC (rev 10617)
@@ -37,7 +37,7 @@
<!-- Add the GWT Client Filter to run the Portal in full Web 2.0 Ajax Mode. In turn, to run in Classic Html Mode, turn this filter off -->
<filter>
<filter-name>GWTClientFilter</filter-name>
- <filter-class>org.jboss.portal.presentation.impl.ajax.entry.GWTClientFilter</filter-class>
+ <filter-class>org.jboss.portal.presentation.toremove.impl.ajax.entry.GWTClientFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>GWTClientFilter</filter-name>
@@ -51,7 +51,7 @@
<!-- Asynchronous service request processor -->
<servlet>
<servlet-name>AjaxPortalEntryPoint</servlet-name>
- <servlet-class>org.jboss.portal.presentation.impl.ajax.entry.PortalEntryPoint</servlet-class>
+ <servlet-class>org.jboss.portal.presentation.toremove.impl.ajax.entry.PortalEntryPoint</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/client (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/client)
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry (from rev 10614, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry)
Deleted: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/GWTClientFilter.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/GWTClientFilter.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -1,211 +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.presentation.impl.ajax.entry;
-
-import java.util.Map;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.portal.presentation.protocol.GetActivation;
-import org.jboss.portal.presentation.protocol.PostActivation;
-
-/**
- * This filter is activated or deactivated depending on whether the Portal needs to runs in Ajax mode or Classic Html mode
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class GWTClientFilter implements Filter
-{
- /**
- *
- */
- public void init(FilterConfig arg0) throws ServletException
- {
- }
-
- /**
- *
- */
- public void destroy()
- {
- }
-
- /**
- *
- */
- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
- {
- HttpServletRequest request = (HttpServletRequest)servletRequest;
- HttpServletResponse response = (HttpServletResponse)servletResponse;
- String contextPath = request.getContextPath();
-
- //Extract the resource that is being accessed
- String resource = request.getRequestURI().replaceFirst(contextPath, "");
- while(resource.startsWith("/"))
- {
- if(resource.length() > 1)
- {
- resource = resource.substring(1);
- }
- else
- {
- resource = "";
- }
- }
-
- if(resource == null || resource.trim().length() == 0)
- {
- response.sendRedirect("index.html");
- return;
- }
-
- //Now make sure the resource requested is a GWT resource
- if( resource.equals("index.html") ||
- resource.equals("portal.css") ||
- resource.equals("mygwt-all.css") ||
- resource.equals("mygwt-all-gray.css") ||
- resource.equals("gwt.js") ||
- resource.equals("prototype.js") ||
- resource.contains(".cache.") ||
- resource.contains(".nocache.") ||
- resource.contains(".gwt.rpc") ||
- resource.contains("images/default") ||
- resource.contains("images/gray")
- )
- {
- byte[] gwtResource = this.readContent(resource);
- response.getOutputStream().write(gwtResource);
- response.getOutputStream().flush();
- return;
- }
-
-
- String method = request.getMethod();
- String url = request.getRequestURL().toString();
- String targetId = this.parseTargetId(url);
- Map queryParameters = new HashMap();
- Enumeration paramNames = request.getParameterNames();
- if(paramNames != null)
- {
- while(paramNames.hasMoreElements())
- {
- String name = (String)paramNames.nextElement();
- String value = (String)request.getParameter(name);
- queryParameters.put(name, new String[]{value});
- }
- }
- if(method.equalsIgnoreCase("get"))
- {
- GetActivation get = new GetActivation(targetId, null, queryParameters);
- request.getSession().setAttribute("serverAction", get);
- }
- else
- {
- PostActivation post = new PostActivation(targetId, null, queryParameters, null);
- request.getSession().setAttribute("serverAction", post);
- }
-
-
- response.sendRedirect(contextPath+"/"+"index.html");
- }
-
- /**
- *
- * @param path
- * @return
- */
- private byte[] readContent(String path)
- {
- byte[] content = null;
-
- InputStream is = null;
- ByteArrayOutputStream bos = null;
- try
- {
- bos = new ByteArrayOutputStream();
- is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
- int bytesRead = 0;
- byte[] data = new byte[1024];
- while((bytesRead=is.read(data)) != -1)
- {
- byte[] cour = new byte[bytesRead];
- System.arraycopy(data, 0, cour, 0, bytesRead);
- bos.write(cour);
- bos.flush();
- }
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- if(is != null)
- {
- try{is.close();}catch(Exception e){}
- }
- if(bos != null)
- {
- content = bos.toByteArray();
- try{bos.close();}catch(Exception e){}
- }
- }
-
- return content;
- }
-
- /**
- *
- * @param url
- * @return
- */
- private String parseTargetId(String url)
- {
- String targetId = null;
-
- int fromIndex = 0; //hard coding the portal deployment context for now
- fromIndex = url.indexOf("presentation") != -1 ? url.indexOf("presentation") + "presentation".length() : 0;
- targetId = url.indexOf('?') != -1 ? url.substring(fromIndex, url.indexOf('?')):url.substring(fromIndex);
-
- //Removes the PATH data if any found
- if(targetId.indexOf(';')!=-1)
- {
- targetId = targetId.substring(0, targetId.indexOf(';'));
- }
-
- return targetId;
- }
-}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/GWTClientFilter.java (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java)
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/GWTClientFilter.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/GWTClientFilter.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -0,0 +1,211 @@
+/******************************************************************************
+ * 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.presentation.toremove.impl.ajax.entry;
+
+import java.util.Map;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+
+/**
+ * This filter is activated or deactivated depending on whether the Portal needs to runs in Ajax mode or Classic Html mode
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class GWTClientFilter implements Filter
+{
+ /**
+ *
+ */
+ public void init(FilterConfig arg0) throws ServletException
+ {
+ }
+
+ /**
+ *
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ *
+ */
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
+ {
+ HttpServletRequest request = (HttpServletRequest)servletRequest;
+ HttpServletResponse response = (HttpServletResponse)servletResponse;
+ String contextPath = request.getContextPath();
+
+ //Extract the resource that is being accessed
+ String resource = request.getRequestURI().replaceFirst(contextPath, "");
+ while(resource.startsWith("/"))
+ {
+ if(resource.length() > 1)
+ {
+ resource = resource.substring(1);
+ }
+ else
+ {
+ resource = "";
+ }
+ }
+
+ if(resource == null || resource.trim().length() == 0)
+ {
+ response.sendRedirect("index.html");
+ return;
+ }
+
+ //Now make sure the resource requested is a GWT resource
+ if( resource.equals("index.html") ||
+ resource.equals("portal.css") ||
+ resource.equals("mygwt-all.css") ||
+ resource.equals("mygwt-all-gray.css") ||
+ resource.equals("gwt.js") ||
+ resource.equals("prototype.js") ||
+ resource.contains(".cache.") ||
+ resource.contains(".nocache.") ||
+ resource.contains(".gwt.rpc") ||
+ resource.contains("images/default") ||
+ resource.contains("images/gray")
+ )
+ {
+ byte[] gwtResource = this.readContent(resource);
+ response.getOutputStream().write(gwtResource);
+ response.getOutputStream().flush();
+ return;
+ }
+
+
+ String method = request.getMethod();
+ String url = request.getRequestURL().toString();
+ String targetId = this.parseTargetId(url);
+ Map queryParameters = new HashMap();
+ Enumeration paramNames = request.getParameterNames();
+ if(paramNames != null)
+ {
+ while(paramNames.hasMoreElements())
+ {
+ String name = (String)paramNames.nextElement();
+ String value = (String)request.getParameter(name);
+ queryParameters.put(name, new String[]{value});
+ }
+ }
+ if(method.equalsIgnoreCase("get"))
+ {
+ GetActivation get = new GetActivation(targetId, null, queryParameters);
+ request.getSession().setAttribute("serverAction", get);
+ }
+ else
+ {
+ PostActivation post = new PostActivation(targetId, null, queryParameters, null);
+ request.getSession().setAttribute("serverAction", post);
+ }
+
+
+ response.sendRedirect(contextPath+"/"+"index.html");
+ }
+
+ /**
+ *
+ * @param path
+ * @return
+ */
+ private byte[] readContent(String path)
+ {
+ byte[] content = null;
+
+ InputStream is = null;
+ ByteArrayOutputStream bos = null;
+ try
+ {
+ bos = new ByteArrayOutputStream();
+ is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
+ int bytesRead = 0;
+ byte[] data = new byte[1024];
+ while((bytesRead=is.read(data)) != -1)
+ {
+ byte[] cour = new byte[bytesRead];
+ System.arraycopy(data, 0, cour, 0, bytesRead);
+ bos.write(cour);
+ bos.flush();
+ }
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ if(is != null)
+ {
+ try{is.close();}catch(Exception e){}
+ }
+ if(bos != null)
+ {
+ content = bos.toByteArray();
+ try{bos.close();}catch(Exception e){}
+ }
+ }
+
+ return content;
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ private String parseTargetId(String url)
+ {
+ String targetId = null;
+
+ int fromIndex = 0; //hard coding the portal deployment context for now
+ fromIndex = url.indexOf("presentation") != -1 ? url.indexOf("presentation") + "presentation".length() : 0;
+ targetId = url.indexOf('?') != -1 ? url.substring(fromIndex, url.indexOf('?')):url.substring(fromIndex);
+
+ //Removes the PATH data if any found
+ if(targetId.indexOf(';')!=-1)
+ {
+ targetId = targetId.substring(0, targetId.indexOf(';'));
+ }
+
+ return targetId;
+ }
+}
Deleted: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/PortalEntryPoint.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/PortalEntryPoint.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -1,290 +0,0 @@
-package org.jboss.portal.presentation.impl.ajax.entry;
-
-
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.HashMap;
-import java.io.InputStream;
-import java.net.URLDecoder;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.log4j.Logger;
-
-import org.jboss.portal.web.WebRequest;
-import org.jboss.portal.web.WebResponse;
-
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.presentation.PresentationServerImpl;
-import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
-import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
-import org.jboss.portal.presentation.ajax.client.protocol.ClientResponse;
-import org.jboss.portal.presentation.ajax.client.protocol.AjaxShowUIObjectResponse;
-import org.jboss.portal.presentation.ajax.AjaxPresentationClient;
-import org.jboss.portal.presentation.protocol.GetActivation;
-import org.jboss.portal.presentation.protocol.PostActivation;
-import org.jboss.portal.presentation.server2.PresentationServer;
-import org.jboss.portal.presentation.impl.state.structural.ContextNode;
-import org.jboss.portal.presentation.impl.state.structural.NodeImporter;
-import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
-
-import com.google.gwt.user.client.rpc.SerializationException;
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-
-
-/**
- * This serves as the Portal Entry Point for AJAX (Asynchronous) RPC calls being made by the
- * client-side Ajax agent of the Presentation Framework
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class PortalEntryPoint extends RemoteServiceServlet implements PortalRPC
-{
- /** The logger. */
- private Logger log = Logger.getLogger(getClass());
-
- /**
- *
- */
- private PresentationServer server;
-
-
- /** Configure the as default servlet. */
- public void init() throws ServletException
- {
- StructuralStateContextImpl structuralStateContext = (StructuralStateContextImpl)this.getServletContext().getAttribute("StructuralStateContext");
-
- //
- InputStream in = getServletContext().getResourceAsStream("/WEB-INF/page-structure.xml");
- try
- {
- ContextNode root = structuralStateContext.getRoot();
- new NodeImporter(root).importDocument(in);
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
- finally
- {
- IOTools.safeClose(in);
- }
-
- //
- this.server = (PresentationServer)this.getServletContext().getAttribute("PresentationServer");
- }
- //---------------------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- *
- */
- public String processCall(String payload) throws SerializationException
- {
- //Perform the remote procedure call
- String returnVal = super.processCall(payload);
-
- //Perform any post-processing after calling the actual remote method that will perform
- //the functionality for this particular remote procedure call
-
- return returnVal;
- }
- // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * Asynchronously loads the specified object from the server
- *
- * @return The Initial Portal Page
- */
- public ClientResponse loadObject(String objectId)
- {
- try
- {
- ClientResponse clientResponse = null;
-
- HttpServletRequest request = this.getThreadLocalRequest();
-
- Object pendingServerAction = request.getSession().getAttribute("serverAction");
- if(pendingServerAction != null)
- {
- request.setAttribute("serverAction", pendingServerAction);
- request.getSession().removeAttribute("serverAction");
- }
-
- //execute the call on the Portal
- this.callPortalServer();
-
- //Setup the initial UIContext for the client session
- AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
- if(uiObject != null)
- {
- clientResponse = new AjaxShowUIObjectResponse(uiObject);
- }
-
- return clientResponse;
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- *
- * @param url
- * @return
- */
- public ClientResponse asyncGet(String url)
- {
- try
- {
- ClientResponse clientResponse = null;
-
- HttpServletRequest request = this.getThreadLocalRequest();
-
- //Parse the query parameters into a Map of name value pairs
- Map queryParams = this.parseQueryParams(url);
-
- //Parse the UIObject target id
- String targetId = this.parseTargetId(url);
-
-
- GetActivation get = new GetActivation(targetId, null, queryParams);
-
- request.setAttribute("serverAction", get);
-
- //execute the call on the Portal
- this.callPortalServer();
-
- //Setup the initial UIContext for the client session
- AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
- if(uiObject != null)
- {
- clientResponse = new AjaxShowUIObjectResponse(uiObject);
- }
-
- return clientResponse;
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- *
- * @param url
- * @param body
- * @return
- */
- public ClientResponse asyncPost(String url, String body)
- {
- try
- {
- ClientResponse clientResponse = null;
-
- HttpServletRequest request = this.getThreadLocalRequest();
-
- //Parse the query parameters into a Map of name value pairs
- Map queryParams = this.parseQueryParams(url);
-
- //Parse the UIObject target id
- String targetId = this.parseTargetId(url);
-
- //Parse the serialized post body into parameters
- StringTokenizer st = new StringTokenizer(body, "&");
- while(st.hasMoreTokens())
- {
- String token = st.nextToken();
- int equalIndex = token.indexOf('=');
- String name = token.substring(0, equalIndex);
- String value = token.substring(equalIndex+1);
-
- queryParams.put(URLDecoder.decode(name, "UTF-8"), new String[]{URLDecoder.decode(value, "UTF-8")});
- }
-
- PostActivation post = new PostActivation(targetId, null, queryParams, null);
-
- request.setAttribute("serverAction", post);
-
- //execute the call on the Portal
- this.callPortalServer();
-
- //Setup the initial UIContext for the client session
- AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
- if(uiObject != null)
- {
- clientResponse = new AjaxShowUIObjectResponse(uiObject);
- }
-
- return clientResponse;
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- *
- */
- private Map parseQueryParams(String url) throws Exception
- {
- Map queryParams = new HashMap();
-
- if(url.indexOf('?') != -1)
- {
- String queryString = url.substring(url.indexOf('?')+1);
- StringTokenizer st = new StringTokenizer(queryString, "&");
- while(st.hasMoreTokens())
- {
- String token = st.nextToken();
- int equalIndex = token.indexOf('=');
- String name = token.substring(0, equalIndex);
- String value = token.substring(equalIndex+1);
-
- queryParams.put(name, new String[]{URLDecoder.decode(value, "UTF-8")});
- }
- }
-
- return queryParams;
- }
-
- /**
- *
- * @param url
- * @return
- */
- private String parseTargetId(String url)
- {
- String targetId = null;
-
- int fromIndex = 0; //hard coding the portal deployment context for now
- fromIndex = url.indexOf("presentation") != -1 ? url.indexOf("presentation") + "presentation".length() : 0;
- targetId = url.indexOf('?') != -1 ? url.substring(fromIndex, url.indexOf('?')):url.substring(fromIndex);
-
- //Removes the PATH data if any found
- if(targetId.indexOf(';')!=-1)
- {
- targetId = targetId.substring(0, targetId.indexOf(';'));
- }
-
- return targetId;
- }
-
- /**
- *
- *
- */
- private void callPortalServer() throws Exception
- {
- HttpServletRequest req = this.getThreadLocalRequest();
- HttpServletResponse resp = this.getThreadLocalResponse();
-
- WebRequest webReq = new WebRequest(req);
- WebResponse webResp = new WebResponse(resp);
-
- AjaxPresentationClient client = new AjaxPresentationClient(webReq, webResp, this.server);
- client.process();
- }
-}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/PortalEntryPoint.java (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java)
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/PortalEntryPoint.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/ajax/entry/PortalEntryPoint.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -0,0 +1,288 @@
+package org.jboss.portal.presentation.toremove.impl.ajax.entry;
+
+
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.HashMap;
+import java.io.InputStream;
+import java.net.URLDecoder;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.presentation.toremove.invocation.AjaxRequest;
+import org.jboss.portal.presentation.toremove.invocation.AjaxResponse;
+import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.ajax.client.protocol.ClientResponse;
+import org.jboss.portal.presentation.ajax.client.protocol.AjaxShowUIObjectResponse;
+import org.jboss.portal.presentation.ajax.AjaxPresentationClient;
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+import org.jboss.portal.presentation.server2.PresentationServer;
+import org.jboss.portal.presentation.impl.state.structural.ContextNode;
+import org.jboss.portal.presentation.impl.state.structural.NodeImporter;
+import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+
+/**
+ * This serves as the Portal Entry Point for AJAX (Asynchronous) RPC calls being made by the
+ * client-side Ajax agent of the Presentation Framework
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PortalEntryPoint extends RemoteServiceServlet implements PortalRPC
+{
+ /** The logger. */
+ private Logger log = Logger.getLogger(getClass());
+
+ /**
+ *
+ */
+ private PresentationServer server;
+
+
+ /** Configure the as default servlet. */
+ public void init() throws ServletException
+ {
+ StructuralStateContextImpl structuralStateContext = (StructuralStateContextImpl)this.getServletContext().getAttribute("StructuralStateContext");
+
+ //
+ InputStream in = getServletContext().getResourceAsStream("/WEB-INF/page-structure.xml");
+ try
+ {
+ ContextNode root = structuralStateContext.getRoot();
+ new NodeImporter(root).importDocument(in);
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ }
+
+ //
+ this.server = (PresentationServer)this.getServletContext().getAttribute("PresentationServer");
+ }
+ //---------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public String processCall(String payload) throws SerializationException
+ {
+ //Perform the remote procedure call
+ String returnVal = super.processCall(payload);
+
+ //Perform any post-processing after calling the actual remote method that will perform
+ //the functionality for this particular remote procedure call
+
+ return returnVal;
+ }
+ // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Asynchronously loads the specified object from the server
+ *
+ * @return The Initial Portal Page
+ */
+ public ClientResponse loadObject(String objectId)
+ {
+ try
+ {
+ ClientResponse clientResponse = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ Object pendingServerAction = request.getSession().getAttribute("serverAction");
+ if(pendingServerAction != null)
+ {
+ request.setAttribute("serverAction", pendingServerAction);
+ request.getSession().removeAttribute("serverAction");
+ }
+
+ //execute the call on the Portal
+ this.callPortalServer();
+
+ //Setup the initial UIContext for the client session
+ AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
+ if(uiObject != null)
+ {
+ clientResponse = new AjaxShowUIObjectResponse(uiObject);
+ }
+
+ return clientResponse;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ public ClientResponse asyncGet(String url)
+ {
+ try
+ {
+ ClientResponse clientResponse = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Parse the query parameters into a Map of name value pairs
+ Map queryParams = this.parseQueryParams(url);
+
+ //Parse the UIObject target id
+ String targetId = this.parseTargetId(url);
+
+
+ GetActivation get = new GetActivation(targetId, null, queryParams);
+
+ request.setAttribute("serverAction", get);
+
+ //execute the call on the Portal
+ this.callPortalServer();
+
+ //Setup the initial UIContext for the client session
+ AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
+ if(uiObject != null)
+ {
+ clientResponse = new AjaxShowUIObjectResponse(uiObject);
+ }
+
+ return clientResponse;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ * @param url
+ * @param body
+ * @return
+ */
+ public ClientResponse asyncPost(String url, String body)
+ {
+ try
+ {
+ ClientResponse clientResponse = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Parse the query parameters into a Map of name value pairs
+ Map queryParams = this.parseQueryParams(url);
+
+ //Parse the UIObject target id
+ String targetId = this.parseTargetId(url);
+
+ //Parse the serialized post body into parameters
+ StringTokenizer st = new StringTokenizer(body, "&");
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ int equalIndex = token.indexOf('=');
+ String name = token.substring(0, equalIndex);
+ String value = token.substring(equalIndex+1);
+
+ queryParams.put(URLDecoder.decode(name, "UTF-8"), new String[]{URLDecoder.decode(value, "UTF-8")});
+ }
+
+ PostActivation post = new PostActivation(targetId, null, queryParams, null);
+
+ request.setAttribute("serverAction", post);
+
+ //execute the call on the Portal
+ this.callPortalServer();
+
+ //Setup the initial UIContext for the client session
+ AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
+ if(uiObject != null)
+ {
+ clientResponse = new AjaxShowUIObjectResponse(uiObject);
+ }
+
+ return clientResponse;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private Map parseQueryParams(String url) throws Exception
+ {
+ Map queryParams = new HashMap();
+
+ if(url.indexOf('?') != -1)
+ {
+ String queryString = url.substring(url.indexOf('?')+1);
+ StringTokenizer st = new StringTokenizer(queryString, "&");
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ int equalIndex = token.indexOf('=');
+ String name = token.substring(0, equalIndex);
+ String value = token.substring(equalIndex+1);
+
+ queryParams.put(name, new String[]{URLDecoder.decode(value, "UTF-8")});
+ }
+ }
+
+ return queryParams;
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ private String parseTargetId(String url)
+ {
+ String targetId = null;
+
+ int fromIndex = 0; //hard coding the portal deployment context for now
+ fromIndex = url.indexOf("presentation") != -1 ? url.indexOf("presentation") + "presentation".length() : 0;
+ targetId = url.indexOf('?') != -1 ? url.substring(fromIndex, url.indexOf('?')):url.substring(fromIndex);
+
+ //Removes the PATH data if any found
+ if(targetId.indexOf(';')!=-1)
+ {
+ targetId = targetId.substring(0, targetId.indexOf(';'));
+ }
+
+ return targetId;
+ }
+
+ /**
+ *
+ *
+ */
+ private void callPortalServer() throws Exception
+ {
+ HttpServletRequest req = this.getThreadLocalRequest();
+ HttpServletResponse resp = this.getThreadLocalResponse();
+
+// WebRequest webReq = new WebRequest(req);
+// WebResponse webResp = new WebResponse(resp);
+
+ AjaxPresentationClient client = new AjaxPresentationClient(new AjaxRequest(req), new AjaxResponse(resp), this.server);
+ client.process();
+ }
+}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/impl/model (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/model)
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation (from rev 10615, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation)
Deleted: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxRequest.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java 2008-04-17 12:40:29 UTC (rev 10615)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxRequest.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -1,74 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.invocation;
-
-import org.jboss.portal.web.WebRequest;
-import org.jboss.portal.web.Body;
-import org.jboss.portal.common.net.media.MediaType;
-
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletRequest;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class AjaxRequest extends HttpServletRequestWrapper implements WebRequest
-{
-
- public AjaxRequest(HttpServletRequest request)
- {
- super(request);
- }
-
- public Verb getVerb()
- {
- throw new UnsupportedOperationException();
- }
-
- public Map<String, String[]> getQueryParameterMap()
- {
- throw new UnsupportedOperationException();
- }
-
- public Body getBody()
- {
- throw new UnsupportedOperationException();
- }
-
- public MediaType getMediaType()
- {
- throw new UnsupportedOperationException();
- }
-
- public String getWebRequestPath()
- {
- throw new UnsupportedOperationException();
- }
-
- public String getWebContextPath()
- {
- throw new UnsupportedOperationException();
- }
-}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxRequest.java (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java)
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxRequest.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxRequest.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.invocation;
+
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
+import org.jboss.portal.common.net.media.MediaType;
+
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AjaxRequest extends HttpServletRequestWrapper implements WebRequest
+{
+
+ public AjaxRequest(HttpServletRequest request)
+ {
+ super(request);
+ }
+
+ public Verb getVerb()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Map<String, String[]> getQueryParameterMap()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Body getBody()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public MediaType getMediaType()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getWebRequestPath()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getWebContextPath()
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Deleted: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxResponse.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java 2008-04-17 12:40:29 UTC (rev 10615)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxResponse.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -1,54 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.invocation;
-
-import org.jboss.portal.web.WebResponse;
-import org.jboss.portal.common.servlet.URLFormat;
-
-import javax.servlet.http.HttpServletResponseWrapper;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Map;
-import java.io.Writer;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class AjaxResponse extends HttpServletResponseWrapper implements WebResponse
-{
- public AjaxResponse(HttpServletResponse response)
- {
- super(response);
- }
-
- public String renderURL(String path, Map<String, String[]> parameters, URLFormat wantedURLFormat) throws IllegalArgumentException
- {
- throw new UnsupportedOperationException();
- }
-
- public void renderURL(Writer writer, String path, Map<String, String[]> parameters, URLFormat wantedURLFormat) throws IllegalArgumentException, IOException
- {
- throw new UnsupportedOperationException();
- }
-}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxResponse.java (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java)
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxResponse.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/AjaxResponse.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.invocation;
+
+import org.jboss.portal.web.WebResponse;
+import org.jboss.portal.common.servlet.URLFormat;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+import java.io.Writer;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AjaxResponse extends HttpServletResponseWrapper implements WebResponse
+{
+ public AjaxResponse(HttpServletResponse response)
+ {
+ super(response);
+ }
+
+ public String renderURL(String path, Map<String, String[]> parameters, URLFormat wantedURLFormat) throws IllegalArgumentException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void renderURL(Writer writer, String path, Map<String, String[]> parameters, URLFormat wantedURLFormat) throws IllegalArgumentException, IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Deleted: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/ClientController.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/ClientController.java 2008-04-17 12:40:29 UTC (rev 10615)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/ClientController.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -1,39 +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.presentation.invocation;
-
-import org.jboss.portal.presentation.server.ServerException;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public interface ClientController
-{
- /**
- *
- * @param invocation
- * @throws ServerException
- */
- public void handle(PresentationInvocation invocation) throws ServerException;
-}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/ClientController.java (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/ClientController.java)
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/ClientController.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/ClientController.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.invocation;
+
+import org.jboss.portal.presentation.server.ServerException;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface ClientController
+{
+ /**
+ *
+ * @param invocation
+ * @throws ServerException
+ */
+ public void handle(PresentationInvocation invocation) throws ServerException;
+}
Deleted: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocation.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/PresentationInvocation.java 2008-04-17 12:40:29 UTC (rev 10615)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocation.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -1,117 +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.presentation.invocation;
-
-import org.jboss.portal.common.invocation.Invocation;
-import org.jboss.portal.common.invocation.InvocationContext;
-
-import org.jboss.portal.web.WebRequest;
-import org.jboss.portal.web.WebResponse;
-
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class PresentationInvocation extends Invocation
-{
- private InvocationContext context = null;
- private WebRequest request = null;
- private WebResponse response = null;
-
- /**
- *
- * @param request
- */
- public PresentationInvocation(WebRequest request, WebResponse response)
- {
- this.request = request;
- this.response = response;
- this.context = new PresentationInvocationContext();
- }
-
- /**
- *
- */
- public InvocationContext getContext() throws IllegalStateException
- {
- return this.context;
- }
-
- /**
- *
- * @return
- */
- public WebRequest getRequest()
- {
- return this.request;
- }
-
- /**
- *
- * @return
- */
- public WebResponse getResponse()
- {
- return this.response;
- }
-
- /**
- *
- * @return
- */
- public String getPortalHost()
- {
- return this.request.getServerName();
- }
-
- /**
- *
- * @return
- */
- public String getPortalRequestPath()
- {
- String portalRequestPath = null;
-
- String requestURI = request.getRequestURI();
- String contextPath = request.getContextPath();
- portalRequestPath = requestURI.substring(contextPath.length());
-
- return portalRequestPath;
- }
-
- /**
- *
- * @return
- */
- public String getPortalContextPath()
- {
- String portalContextPath = null;
-
- String requestURI = request.getRequestURI();
- String contextPath = request.getContextPath();
- portalContextPath = requestURI.substring(0, contextPath.length());
-
- return portalContextPath;
- }
-}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocation.java (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/PresentationInvocation.java)
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocation.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocation.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -0,0 +1,117 @@
+/******************************************************************************
+ * 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.presentation.invocation;
+
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationContext;
+
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.WebResponse;
+
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PresentationInvocation extends Invocation
+{
+ private InvocationContext context = null;
+ private WebRequest request = null;
+ private WebResponse response = null;
+
+ /**
+ *
+ * @param request
+ */
+ public PresentationInvocation(WebRequest request, WebResponse response)
+ {
+ this.request = request;
+ this.response = response;
+ this.context = new PresentationInvocationContext();
+ }
+
+ /**
+ *
+ */
+ public InvocationContext getContext() throws IllegalStateException
+ {
+ return this.context;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public WebRequest getRequest()
+ {
+ return this.request;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public WebResponse getResponse()
+ {
+ return this.response;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getPortalHost()
+ {
+ return this.request.getServerName();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getPortalRequestPath()
+ {
+ String portalRequestPath = null;
+
+ String requestURI = request.getRequestURI();
+ String contextPath = request.getContextPath();
+ portalRequestPath = requestURI.substring(contextPath.length());
+
+ return portalRequestPath;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getPortalContextPath()
+ {
+ String portalContextPath = null;
+
+ String requestURI = request.getRequestURI();
+ String contextPath = request.getContextPath();
+ portalContextPath = requestURI.substring(0, contextPath.length());
+
+ return portalContextPath;
+ }
+}
Deleted: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationContext.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/PresentationInvocationContext.java 2008-04-17 12:40:29 UTC (rev 10615)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationContext.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -1,34 +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.presentation.invocation;
-
-import org.jboss.portal.common.invocation.AbstractInvocationContext;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class PresentationInvocationContext extends AbstractInvocationContext
-{
-
-}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationContext.java (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/PresentationInvocationContext.java)
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationContext.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationContext.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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.presentation.invocation;
+
+import org.jboss.portal.common.invocation.AbstractInvocationContext;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PresentationInvocationContext extends AbstractInvocationContext
+{
+
+}
Deleted: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationHandler.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/PresentationInvocationHandler.java 2008-04-17 12:40:29 UTC (rev 10615)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationHandler.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -1,58 +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.presentation.invocation;
-
-import org.jboss.portal.common.invocation.Invocation;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.InvocationHandler;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class PresentationInvocationHandler implements InvocationHandler
-{
- /**
- *
- */
- private ClientController clientController = null;
-
- /**
- *
- * @param clientController
- */
- public PresentationInvocationHandler(ClientController clientController)
- {
- this.clientController = clientController;
- }
-
- /**
- *
- */
- public Object invoke(Invocation invocation) throws Exception, InvocationException
- {
- this.clientController.handle((PresentationInvocation)invocation);
-
- return null;
- }
-}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationHandler.java (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/PresentationInvocationHandler.java)
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationHandler.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/invocation/PresentationInvocationHandler.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.invocation;
+
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationHandler;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PresentationInvocationHandler implements InvocationHandler
+{
+ /**
+ *
+ */
+ private ClientController clientController = null;
+
+ /**
+ *
+ * @param clientController
+ */
+ public PresentationInvocationHandler(ClientController clientController)
+ {
+ this.clientController = clientController;
+ }
+
+ /**
+ *
+ */
+ public Object invoke(Invocation invocation) throws Exception, InvocationException
+ {
+ this.clientController.handle((PresentationInvocation)invocation);
+
+ return null;
+ }
+}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/toremove/server (from rev 10616, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/server)
Modified: modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
===================================================================
--- modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java 2008-04-17 12:44:09 UTC (rev 10616)
+++ modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -16,18 +16,15 @@
import org.apache.log4j.Logger;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.portal.web.WebRequest;
-import org.jboss.portal.web.WebResponse;
-
import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
import org.jboss.portal.presentation.ajax.client.protocol.ClientResponse;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxShowUIObjectResponse;
import org.jboss.portal.presentation.protocol.GetActivation;
import org.jboss.portal.presentation.protocol.PostActivation;
-import org.jboss.portal.presentation.invocation.PresentationInvocation;
-import org.jboss.portal.presentation.invocation.AjaxRequest;
-import org.jboss.portal.presentation.invocation.AjaxResponse;
+import org.jboss.portal.presentation.toremove.invocation.PresentationInvocation;
+import org.jboss.portal.presentation.toremove.invocation.AjaxRequest;
+import org.jboss.portal.presentation.toremove.invocation.AjaxResponse;
import com.google.gwt.user.client.rpc.SerializationException;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
Modified: modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.java
===================================================================
--- modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.java 2008-04-17 12:44:09 UTC (rev 10616)
+++ modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -29,13 +29,13 @@
import org.jboss.portal.web.Body;
-import org.jboss.portal.presentation.server.ServerException;
+import org.jboss.portal.presentation.toremove.server.ServerException;
-import org.jboss.portal.presentation.server.Processor;
-import org.jboss.portal.presentation.server.ProcessorRequest;
-import org.jboss.portal.presentation.server.ProcessorResponse;
+import org.jboss.portal.presentation.toremove.server.Processor;
+import org.jboss.portal.presentation.toremove.server.ProcessorRequest;
+import org.jboss.portal.presentation.toremove.server.ProcessorResponse;
-import org.jboss.portal.presentation.client.PresentationContext;
+import org.jboss.portal.presentation.toremove.client.PresentationContext;
import org.jboss.portal.presentation.model.StateType;
import org.jboss.portal.presentation.model.UIWindow;
Modified: modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.java 2008-04-17 12:44:09 UTC (rev 10616)
+++ modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.java 2008-04-17 12:48:35 UTC (rev 10617)
@@ -22,9 +22,9 @@
******************************************************************************/
package org.jboss.portal.presentation.test.portal.plugin;
-import org.jboss.portal.presentation.client.PresentationContext;
-import org.jboss.portal.presentation.server.Processor;
-import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.toremove.client.PresentationContext;
+import org.jboss.portal.presentation.toremove.server.Processor;
+import org.jboss.portal.presentation.toremove.server.PresentationServer;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
18 years
JBoss Portal SVN: r10616 - in modules/presentation/trunk: ajax/src/main/java/org/jboss/portal/presentation/impl and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-17 08:44:09 -0400 (Thu, 17 Apr 2008)
New Revision: 10616
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/client/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/model/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/server/
Removed:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/
Log:
move deprecated pakages to ajax module as they may still be used here but are not used anymore in the presentation and classic modules
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/client (from rev 10614, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client)
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/model (from rev 10614, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model)
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/server (from rev 10614, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server)
18 years
JBoss Portal SVN: r10615 - in modules/presentation/trunk: ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry and 9 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-17 08:40:29 -0400 (Thu, 17 Apr 2008)
New Revision: 10615
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/PresentationPortletInvoker.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/StructuralPortletControllerContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java
Removed:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/invocation/
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
modules/presentation/trunk/build/pom.xml
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
Log:
updates to PF:
- now use snapshot of web module
- moved some stuff in ajax module that will be removed later but should not be in the main presentation module anyway
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -18,6 +18,8 @@
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.presentation.PresentationServerImpl;
+import org.jboss.portal.presentation.invocation.AjaxRequest;
+import org.jboss.portal.presentation.invocation.AjaxResponse;
import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
import org.jboss.portal.presentation.ajax.client.protocol.ClientResponse;
@@ -281,10 +283,10 @@
HttpServletRequest req = this.getThreadLocalRequest();
HttpServletResponse resp = this.getThreadLocalResponse();
- WebRequest webReq = new WebRequest(req);
- WebResponse webResp = new WebResponse(resp);
+// WebRequest webReq = new WebRequest(req);
+// WebResponse webResp = new WebResponse(resp);
- AjaxPresentationClient client = new AjaxPresentationClient(webReq, webResp, this.server);
+ AjaxPresentationClient client = new AjaxPresentationClient(new AjaxRequest(req), new AjaxResponse(resp), this.server);
client.process();
}
}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation (from rev 10614, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/invocation)
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.invocation;
+
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
+import org.jboss.portal.common.net.media.MediaType;
+
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AjaxRequest extends HttpServletRequestWrapper implements WebRequest
+{
+
+ public AjaxRequest(HttpServletRequest request)
+ {
+ super(request);
+ }
+
+ public Verb getVerb()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Map<String, String[]> getQueryParameterMap()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Body getBody()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public MediaType getMediaType()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getWebRequestPath()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getWebContextPath()
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.invocation;
+
+import org.jboss.portal.web.WebResponse;
+import org.jboss.portal.common.servlet.URLFormat;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+import java.io.Writer;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AjaxResponse extends HttpServletResponseWrapper implements WebResponse
+{
+ public AjaxResponse(HttpServletResponse response)
+ {
+ super(response);
+ }
+
+ public String renderURL(String path, Map<String, String[]> parameters, URLFormat wantedURLFormat) throws IllegalArgumentException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void renderURL(Writer writer, String path, Map<String, String[]> parameters, URLFormat wantedURLFormat) throws IllegalArgumentException, IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Modified: modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
===================================================================
--- modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -26,6 +26,8 @@
import org.jboss.portal.presentation.protocol.GetActivation;
import org.jboss.portal.presentation.protocol.PostActivation;
import org.jboss.portal.presentation.invocation.PresentationInvocation;
+import org.jboss.portal.presentation.invocation.AjaxRequest;
+import org.jboss.portal.presentation.invocation.AjaxResponse;
import com.google.gwt.user.client.rpc.SerializationException;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@@ -262,9 +264,9 @@
HttpServletRequest req = this.getThreadLocalRequest();
HttpServletResponse resp = this.getThreadLocalResponse();
- WebRequest webReq = new WebRequest(req);
- WebResponse webResp = new WebResponse(resp);
- PresentationInvocation invocation = new PresentationInvocation(webReq, webResp);
+// WebRequest webReq = new WebRequest(req);
+// WebResponse webResp = new WebResponse(resp);
+ PresentationInvocation invocation = new PresentationInvocation(new AjaxRequest(req), new AjaxResponse(resp));
//TODO: set the proper invocation handler here
Modified: modules/presentation/trunk/build/pom.xml
===================================================================
--- modules/presentation/trunk/build/pom.xml 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/build/pom.xml 2008-04-17 12:40:29 UTC (rev 10615)
@@ -31,9 +31,9 @@
<version.gwt>1.4.60</version.gwt>
<version.mygwt>0.3.0</version.mygwt>
- <version.jboss.portal.common>1.2.0.Beta3</version.jboss.portal.common>
+ <version.jboss.portal.common>1.2.0-SNAPSHOT</version.jboss.portal.common>
<version.jboss.portal.portlet>2.0.0.CR2</version.jboss.portal.portlet>
- <version.jboss.portal.web>1.2.0.Beta3</version.jboss.portal.web>
+ <version.jboss.portal.web>1.2.0-SNAPSHOT</version.jboss.portal.web>
<version.jboss.unit>1.2.0.Beta2</version.jboss.unit>
<version.jboss.microcontainer>2.0.0.Beta9</version.jboss.microcontainer>
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -71,6 +71,13 @@
if (node instanceof WindowNode)
{
WindowNode window = (WindowNode)node;
+
+
+
+
+
+
+
return new WindowContent(0, "Window " + window.getName(), window.getContent());
}
else
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -105,7 +105,7 @@
}
//
- String link = encoder.encode(action);
+ String link = encoder.encode(action, resp);
//
if (link == null)
@@ -216,9 +216,9 @@
{
ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
- String url = encoder.encode(viewPage);
+ String url = encoder.encode(viewPage, resp);
- writer.print("<div>Link to page <a href=\"" + req.getContextPath() + url + "\">" + object.getName() + "</a></div>");
+ writer.print("<div>Link to page <a href=\"" + url + "\">" + object.getName() + "</a></div>");
}
}
else if (object instanceof UIWindow)
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -24,6 +24,7 @@
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.WebResponse;
+import org.jboss.portal.web.endpoint.EndPointServlet;
import org.jboss.portal.presentation.server2.PresentationServer;
import org.jboss.portal.presentation.server2.PresentationServerException;
import org.jboss.portal.presentation.PresentationServerImpl;
@@ -43,13 +44,16 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class ClassicPresentationServlet extends HttpServlet
+public class ClassicPresentationServlet extends EndPointServlet
{
private PresentationServer server;
public void init() throws ServletException
{
+ super.init();
+
+ //
StructuralStateContextImpl structuralStateContext = new StructuralStateContextImpl();
//
@@ -72,14 +76,10 @@
this.server = new PresentationServerImpl(structuralStateContext);
}
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ protected void service(WebRequest req, WebResponse resp) throws ServletException, IOException
{
+ ClassicPresentationClient client = new ClassicPresentationClient(req, resp, server);
- WebRequest webReq = new WebRequest(req);
- WebResponse webResp = new WebResponse(resp);
-
- ClassicPresentationClient client = new ClassicPresentationClient(webReq, webResp, server);
-
try
{
client.process();
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -40,43 +40,40 @@
ProtocolAction action = null;
//
- String pathInfo = request.getPathInfo();
+ String webPath = request.getWebRequestPath();
//
- if (pathInfo != null)
+ if (webPath.startsWith("/view/"))
{
- if (pathInfo.startsWith("/view/"))
+ String targetId = webPath.substring("/view/".length());
+ action = new ViewUIObjectAction(targetId);
+ }
+ else if (webPath.startsWith("/invoke/"))
+ {
+ int from = "/invoke/".length();
+
+ //
+ String path = null;
+ int to = webPath.indexOf('/', from + 1);
+ if (to == -1)
{
- String targetId = pathInfo.substring("/view/".length());
- action = new ViewUIObjectAction(targetId);
+ to = webPath.length();
}
- else if (pathInfo.startsWith("/invoke/"))
+ else
{
- int from = "/invoke/".length();
+ path = webPath.substring(to + 1);
+ }
- //
- String path = null;
- int to = pathInfo.indexOf('/', from + 1);
- if (to == -1)
- {
- to = pathInfo.length();
- }
- else
- {
- path = pathInfo.substring(to + 1);
- }
+ //
+ String targetId = webPath.substring(from, to);
- //
- String targetId = pathInfo.substring(from, to);
-
- //
- switch (request.getVerb())
- {
- case GET:
- return new GetActivation(targetId, path, request.getQueryParameterMap());
- case POST:
- return new PostActivation(targetId, path, request.getQueryParameterMap(), request.getBody());
- }
+ //
+ switch (request.getVerb())
+ {
+ case GET:
+ return new GetActivation(targetId, path, request.getQueryParameterMap());
+ case POST:
+ return new PostActivation(targetId, path, request.getQueryParameterMap(), request.getBody());
}
}
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -27,9 +27,8 @@
import org.jboss.portal.presentation.protocol.LinkActivation;
import org.jboss.portal.presentation.protocol.UIObjectAction;
import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.web.WebResponse;
-import java.util.Map;
-
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -37,7 +36,7 @@
public class ActionEncoder
{
- public String encode(ProtocolAction action)
+ public String encode(ProtocolAction action, WebResponse resp)
{
if (action instanceof UIObjectAction)
{
@@ -49,47 +48,14 @@
//
if (action instanceof ViewUIObjectAction)
{
- return "/view/" + targetId;
+ return resp.renderURL("/view/" + targetId, null, null);
}
else if (action instanceof LinkActivation)
{
LinkActivation linkActivationAction = (LinkActivation)action;
//
- StringBuilder builder = new StringBuilder("/invoke/" + targetId);
-
- //
- if (linkActivationAction.getPath() != null)
- {
- builder.append(linkActivationAction.getPath());
- }
-
- //
- boolean empty = true;
- if (linkActivationAction.getQueryParameters() != null)
- {
- for (Map.Entry<String, String[]> queryParameterEntry : linkActivationAction.getQueryParameters().entrySet())
- {
- String queryParameterName = queryParameterEntry.getKey();
-
- //
- for (String queryParameterValue : queryParameterEntry.getValue())
- {
- if (!empty)
- {
- builder.append('&');
- }
-
- //
- builder.append(FastURLEncoder.getUTF8Instance().encode(queryParameterName));
- builder.append('=');
- builder.append(FastURLEncoder.getUTF8Instance().encode(queryParameterValue));
- }
- }
- }
-
- //
- return builder.toString();
+ return resp.renderURL("/invoke/" + targetId, linkActivationAction.getQueryParameters(), null);
}
}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/PresentationPortletInvoker.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/PresentationPortletInvoker.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/PresentationPortletInvoker.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet;
+
+import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationPortletInvoker
+{
+
+ /** . */
+ private StructuralStateContextImpl structuralContext;
+
+ public PresentationPortletInvoker(StructuralStateContextImpl structuralContext)
+ {
+ this.structuralContext = structuralContext;
+ }
+
+ public void render(String windowId)
+ {
+
+ }
+
+}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/StructuralPortletControllerContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/StructuralPortletControllerContext.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/StructuralPortletControllerContext.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet;
+
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.PortletControllerContext;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.ResourceInvocation;
+import org.jboss.portal.presentation.impl.state.structural.PageNode;
+
+import javax.servlet.http.Cookie;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralPortletControllerContext implements PortletControllerContext
+{
+
+ /** . */
+ private final PageNode page;
+
+ /** . */
+ private final PortletInvoker invoker;
+
+ public StructuralPortletControllerContext(PageNode page, PortletInvoker invoker)
+ {
+ this.page = page;
+ this.invoker = invoker;
+ }
+
+ public PortletInfo getPortletInfo(String windowId)
+ {
+ return null;
+ }
+
+ public PortletInvocationContext createPortletInvocationContext(String windowId, PageNavigationalState pageNavigationalState)
+ {
+ return null;
+ }
+
+ public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
+ {
+ return null;
+ }
+
+ public PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
+ {
+ return null;
+ }
+
+ public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException
+ {
+ return null;
+ }
+
+ public EventControllerContext getEventControllerContext()
+ {
+ return null;
+ }
+
+ public StateControllerContext getStateControllerContext()
+ {
+ return null;
+ }
+}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.ClientContext;
+import org.jboss.portal.common.util.MultiValuedPropertyMap;
+import org.jboss.portal.common.util.SimpleMultiValuedPropertyMap;
+import org.jboss.portal.presentation.protocol.LinkActivation;
+import org.jboss.portal.presentation.protocol.GetActivation;
+
+import javax.servlet.http.Cookie;
+import java.util.List;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationClientContext implements ClientContext
+{
+
+ /** . */
+ private final LinkActivation linkActivation;
+
+ public PresentationClientContext(LinkActivation linkActivation)
+ {
+ this.linkActivation = linkActivation;
+ }
+
+ public String getMethod()
+ {
+ return linkActivation instanceof GetActivation ? "GET" : "POST";
+ }
+
+ public MultiValuedPropertyMap<String> getProperties()
+ {
+ return new SimpleMultiValuedPropertyMap<String>();
+ }
+
+ public List<Cookie> getCookies()
+ {
+ return Collections.emptyList();
+ }
+}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.InstanceContext;
+import org.jboss.portal.portlet.state.AccessMode;
+import org.jboss.portal.portlet.StateEvent;
+import org.jboss.portal.presentation.impl.state.structural.WindowNode;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationInstanceContext implements InstanceContext
+{
+
+ /** . */
+ private final WindowNode window;
+
+ public PresentationInstanceContext(WindowNode window)
+ {
+ this.window = window;
+ }
+
+ public String getId()
+ {
+ return window.getId();
+ }
+
+ public AccessMode getAccessMode()
+ {
+ return AccessMode.READ_ONLY;
+ }
+
+ public void onStateEvent(StateEvent event)
+ {
+ throw new IllegalStateException();
+ }
+}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.Tools;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationPortalContext implements PortalContext
+{
+ public String getInfo()
+ {
+ return "PresentationPortal";
+ }
+
+ public Set<WindowState> getWindowStates()
+ {
+ return Tools.toSet(WindowState.NORMAL);
+ }
+
+ public Set<Mode> getModes()
+ {
+ return Tools.toSet(Mode.VIEW);
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return Collections.emptyMap();
+ }
+}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.ServerContext;
+import org.jboss.portal.web.ServletContainer;
+import org.jboss.portal.web.RequestDispatchCallback;
+import org.jboss.portal.web.ServletContextDispatcher;
+import org.jboss.portal.presentation.client2.PresentationClient;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationServerContext implements ServerContext
+{
+
+ /** . */
+ private final PresentationClient presentationClient;
+
+ public PresentationServerContext(PresentationClient presentationClient)
+ {
+ this.presentationClient = presentationClient;
+ }
+
+ public String getScheme()
+ {
+ return "http";
+ }
+
+ public String getServerName()
+ {
+ return "localhost";
+ }
+
+ public int getServerPort()
+ {
+ return 8080;
+ }
+
+ public Object dispatch(ServletContainer servletContainer, ServletContext targetServletContext, RequestDispatchCallback callback, Object handback) throws Exception
+ {
+ ServletContextDispatcher dispatcher = presentationClient.getDispatcher();
+
+ //
+ return dispatcher.include(targetServletContext, callback, handback);
+ }
+}
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java 2008-04-17 12:40:29 UTC (rev 10615)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.presentation.impl.state.structural.WindowNode;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationWindowContext implements WindowContext
+{
+
+ /** . */
+ private final WindowNode window;
+
+ public PresentationWindowContext(WindowNode window)
+ {
+ this.window = window;
+ }
+
+ public String getId()
+ {
+ return window.getId();
+ }
+}
18 years
JBoss Portal SVN: r10614 - modules/presentation/trunk/ajax.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-04-17 01:58:26 -0400 (Thu, 17 Apr 2008)
New Revision: 10614
Modified:
modules/presentation/trunk/ajax/pom.xml
Log:
commenting out local war deployment
Modified: modules/presentation/trunk/ajax/pom.xml
===================================================================
--- modules/presentation/trunk/ajax/pom.xml 2008-04-17 05:54:28 UTC (rev 10613)
+++ modules/presentation/trunk/ajax/pom.xml 2008-04-17 05:58:26 UTC (rev 10614)
@@ -134,7 +134,8 @@
</dependencies>
<build>
- <plugins>
+ <plugins>
+<!--
<plugin>
<groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
<artifactId>maven-antrun-extended-plugin</artifactId>
@@ -194,6 +195,7 @@
</execution>
</executions>
</plugin>
+-->
</plugins>
</build>
</project>
18 years
JBoss Portal SVN: r10612 - in modules/common/trunk/common/src: test/java/org/jboss/portal/test/common/util and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-16 18:32:16 -0400 (Wed, 16 Apr 2008)
New Revision: 10612
Added:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MapAdapters.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/MapAdaptersTestCase.java
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapEntrySetTestCase.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapTestCase.java
Log:
- fixed bugs and added test case in typed map
- added a MapAdapters that is provides various adapters (for now a generic Map<T, T[]> to Map<T, T> and Map<String, String[]> to Map<String> which makes it easier to read parameter maps.
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java 2008-04-16 21:18:10 UTC (rev 10611)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java 2008-04-16 22:32:16 UTC (rev 10612)
@@ -64,6 +64,29 @@
public abstract static class Converter<E, I>
{
+ private static final Converter identity = new Converter()
+ {
+ protected Object getInternal(Object external) throws IllegalArgumentException, ClassCastException
+ {
+ return external;
+ }
+
+ protected Object getExternal(Object internal) throws IllegalArgumentException, ClassCastException
+ {
+ return internal;
+ }
+
+ protected boolean equals(Object left, Object right)
+ {
+ return left.equals(false);
+ }
+ };
+
+ public static <T> Converter<T, T> identityConverter()
+ {
+ return (Converter<T,T>)identity;
+ }
+
private final Transformer<I, E> keyUnwrapper = new Transformer<I, E>()
{
protected I transform(E e)
@@ -211,20 +234,17 @@
public final EV put(EK ek, EV ev)
{
+ Map<IK, IV> map = getDelegate();
IK ik = getKeyConverter().keyUnwrapper.transform(ek);
- IV iv = getValueConverter().valueUnwrapper.transform(ev);
- Map<IK, IV> map = getDelegate();
+ boolean contains = map.containsKey(ik);
//
+ IV iv = getValueConverter().valueUnwrapper.transform(ev);
iv = map.put(ik, iv);
// Do we have a result ?
- if (iv == null)
+ if (contains)
{
- ev = null;
- }
- else
- {
boolean rollback = true;
try
{
@@ -239,6 +259,10 @@
}
}
}
+ else
+ {
+ ev = null;
+ }
//
return ev;
@@ -248,9 +272,10 @@
{
EK ek = (EK)key;
IK ik = getKeyConverter().keyUnwrapper.transform(ek);
- IV iv = getDelegate().get(ik);
+ Map<IK, IV> map = getDelegate();
+ IV iv = map.get(ik);
EV ev = null;
- if (iv != null)
+ if (iv != null || map.containsKey(ik))
{
ev = getValueConverter().valueWrapper.transform(iv);
}
@@ -262,15 +287,15 @@
EK ek = (EK)key;
IK ik = getKeyConverter().keyUnwrapper.transform(ek);
Map<IK, IV> map = getDelegate();
- IV iv = map.remove(ik);
- EV ev = null;
- if (iv != null)
+ if (getDelegate().containsKey(ik))
{
+ IV iv = map.remove(ik);
boolean rollback = true;
try
{
- ev = getValueConverter().valueWrapper.transform(iv);
+ EV ev = getValueConverter().valueWrapper.transform(iv);
rollback = false;
+ return ev;
}
finally
{
@@ -280,7 +305,10 @@
}
}
}
- return ev;
+ else
+ {
+ return null;
+ }
}
public final boolean containsValue(Object value)
Added: modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MapAdapters.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MapAdapters.java (rev 0)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MapAdapters.java 2008-04-16 22:32:16 UTC (rev 10612)
@@ -0,0 +1,128 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.util;
+
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.Map;
+
+/**
+ * A collection of various map adapters.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MapAdapters
+{
+
+ /** . */
+ private final static ArrayElementConverter<String> stringArrayElementConverter = new ArrayElementConverter<String>(String.class);
+
+ /** . */
+ private final static AbstractTypedMap.Converter<String, String> stringConverter = AbstractTypedMap.Converter.identityConverter();
+
+ public static <K,V> Map<K,V> adapt(Map<K, V[]> adapted, Class<? extends V> type)
+ {
+ if (adapted == null)
+ {
+ throw new IllegalArgumentException("Cannot adapt a null map");
+ }
+ ArrayElementConverter<V> valueConverter = new ArrayElementConverter<V>(type);
+ AbstractTypedMap.Converter<K, K> keyConverter = AbstractTypedMap.Converter.identityConverter();
+ return new TypedMap<K, V, K, V[]>(adapted, keyConverter, valueConverter);
+ }
+
+ /**
+ * <p>Adapt a <code>Map<String, String[]></code> map as a <code>Map<String, String></code> map. The adapted map
+ * must not contain null string array or zero lenght string array, if the map contains such values then the
+ * map state is considered as not valid and {@link IllegalStateException} can be thrown when the adapted map</p>
+ * is used.
+ *
+ * <p>The adapted map is writable but does not accept null values for write operations. On a put operation
+ * the adapted map will receive a put operation with a string array of length one containing the provided value.</p>
+ *
+ * @param adapted the adapted map
+ * @return the adapter
+ */
+ public static Map<String, String> adapt(Map<String, String[]> adapted)
+ {
+ if (adapted == null)
+ {
+ throw new IllegalArgumentException("Cannot adapt a null map");
+ }
+ return new TypedMap<String, String, String, String[]>(adapted, stringConverter, stringArrayElementConverter);
+ }
+
+ private static class ArrayElementConverter<T> extends AbstractTypedMap.Converter<T, T[]>
+ {
+
+ /** . */
+ private final Class<? extends T> type;
+
+ private ArrayElementConverter(Class<? extends T> type)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
+ this.type = type;
+ }
+
+ protected T[] getInternal(T external) throws IllegalArgumentException, ClassCastException
+ {
+ if (external == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ T[] array = (T[])Array.newInstance(type, 1);
+ array[0] = external;
+
+ //
+ return array;
+ }
+
+ protected T getExternal(T[] internal) throws IllegalArgumentException, ClassCastException
+ {
+ if (internal == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ if (internal.length == 0)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ return internal[0];
+ }
+
+ protected boolean equals(T[] left, T[] right)
+ {
+ return Arrays.equals(left, right);
+ }
+ }
+}
Added: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/MapAdaptersTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/MapAdaptersTestCase.java (rev 0)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/MapAdaptersTestCase.java 2008-04-16 22:32:16 UTC (rev 10612)
@@ -0,0 +1,123 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.common.util;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.util.MapAdapters;
+import org.jboss.portal.common.util.MapBuilder;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MapAdaptersTestCase extends TestCase
+{
+
+ /** . */
+ Map<String, String[]> adapted;
+
+ /** . */
+ Map<String, String> adapter;
+
+ protected void setUp() throws Exception
+ {
+ adapted = new HashMap<String, String[]>();
+ adapter = MapAdapters.adapt(adapted);
+ }
+
+ public void testGet()
+ {
+ adapted.put("daa", null);
+ adapted.put("foo", new String[]{});
+ adapted.put("bar", new String[]{"bar_1"});
+ adapted.put("juu", new String[]{"juu_1","juu_2"});
+
+ //
+ try
+ {
+ adapter.get("foo");
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+ try
+ {
+ adapter.get("daa");
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+
+ //
+ assertEquals("bar_1", adapter.get("bar"));
+ assertEquals("juu_1", adapter.get("juu"));
+ }
+
+ public void testPut1()
+ {
+ try
+ {
+ adapter.put("foo", null);
+ fail();
+ }
+ catch (NullPointerException e)
+ {
+ }
+ }
+
+ public void testPut2()
+ {
+ adapted.put("foo", new String[]{"bar_1","bar_2"});
+ assertEquals("bar_1", adapter.put("foo", "foo_1"));
+ assertEquals(1, adapted.size());
+ String[] value = adapted.get("foo");
+ assertNotNull(value);
+ assertEquals(1, value.length);
+ assertEquals("foo_1", value[0]);
+ }
+
+ public void testPut3()
+ {
+ adapted.put("foo", new String[]{"bar_1","bar_2"});
+ try
+ {
+ adapter.put("foo", null);
+ fail();
+ }
+ catch (NullPointerException e)
+ {
+ assertEquals(1, adapted.size());
+ String[] value = adapted.get("foo");
+ assertNotNull(value);
+ assertEquals(2, value.length);
+ assertEquals("bar_1", value[0]);
+ assertEquals("bar_2", value[1]);
+ }
+ }
+
+}
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapEntrySetTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapEntrySetTestCase.java 2008-04-16 21:18:10 UTC (rev 10611)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapEntrySetTestCase.java 2008-04-16 22:32:16 UTC (rev 10612)
@@ -30,6 +30,7 @@
import java.util.Iterator;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.util.MapBuilder;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -441,6 +442,37 @@
}
}
+ public void testGetValueWithNullValue()
+ {
+ delegate.put(0L, null);
+ delegate.remove(1L);
+ Map.Entry<String, String> entry = entries.iterator().next();
+ try
+ {
+ entry.getValue();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ }
+
+ public void testSetValueWithPreviousNullValue()
+ {
+ delegate.put(0L, null);
+ delegate.remove(1L);
+ Map.Entry<String, String> entry = entries.iterator().next();
+ try
+ {
+ entry.setValue("1");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ assertEquals(MapBuilder.hashMap(0L, (Integer)null).get(), delegate);
+ }
+ }
+
//
public void testSize()
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapTestCase.java 2008-04-16 21:18:10 UTC (rev 10611)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapTestCase.java 2008-04-16 22:32:16 UTC (rev 10612)
@@ -561,7 +561,47 @@
}
//
+ public void testGetInternalNullValue()
+ {
+ delegate.put(0l, null);
+ try
+ {
+ map.get("zero");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ }
+ public void testRemoveInternalNullValue()
+ {
+ delegate.put(0l, null);
+ try
+ {
+ map.remove("zero");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ assertEquals(MapBuilder.hashMap(0L, null).get(), delegate);
+ }
+ }
+
+ public void testPutOldInternalNullValue()
+ {
+ delegate.put(0l, null);
+ try
+ {
+ map.put("zero", "0");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ assertEquals(MapBuilder.hashMap(0L, null).get(), delegate);
+ }
+ }
+
// blih
// public void testGetInternalValueConvertedToNull()
// {
18 years
JBoss Portal SVN: r10611 - in branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal: test/wsrp/v1/consumer and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-04-16 17:18:10 -0400 (Wed, 16 Apr 2008)
New Revision: 10611
Added:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieNotRequiredMarkupBehavior.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerGroupInitCookieMarkupBehavior.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerUserInitCookieMarkupBehavior.java
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieMarkupBehavior.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
Log:
- Added setCurrentMarkupBehaviorHandle on TestWSRPProducer to be able to access the proper behavior when calling initCookie.
- Added V1ConsumerBaseTest.setUpWith method to allow switching of ServiceDescriptionBehavior on a per-method basis in test cases.
- Fixed a problem with ProducerSessionInformation.getGroupCookieFor method: the case where no cookies were found for the given
group id was not handled properly.
- ProducerInfo.getRequiresInitCookie is now public (used by tests and could potentially be exposed to the GUI).
- Added more test cases and behaviors to better test initCookie handling.
- Removed empty MarkupTestCase.testImplicitCloning method.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java 2008-04-16 20:54:59 UTC (rev 10610)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -37,4 +37,12 @@
void reset();
BehaviorRegistry getBehaviorRegistry();
+
+ /**
+ * Sets the currently used portlet handle identifying the MarkupBehavior we're using. This is needed to be able to
+ * dispatch calls to initCookie to the proper behavior.
+ *
+ * @param handle
+ */
+ void setCurrentMarkupBehaviorHandle(String handle);
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2008-04-16 20:54:59 UTC (rev 10610)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -89,6 +89,8 @@
public static final String USER_COOKIE = "cookie";
+ private String currentMarkupBehaviorHandle;
+
public TestWSRPProducerImpl()
{
reset();
@@ -99,9 +101,15 @@
return behaviorRegistry;
}
+ public void setCurrentMarkupBehaviorHandle(String handle)
+ {
+ currentMarkupBehaviorHandle = handle;
+ }
+
public void reset()
{
requiresInitCookie = null;
+ currentMarkupBehaviorHandle = null;
behaviorRegistry.clear();
}
@@ -162,12 +170,19 @@
throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
{
// should only be called if we required cookies to be initialized
- if (requiresInitCookie == null)
+ if (requiresInitCookie == null || CookieProtocol.none.equals(requiresInitCookie))
{
throw new OperationFailedFault();
}
- return null;
+ try
+ {
+ return getMarkupBehaviorFor(currentMarkupBehaviorHandle).initCookie(initCookie);
+ }
+ catch (InvalidHandleFault invalidHandleFault)
+ {
+ throw new OperationFailedFault();
+ }
}
// Registration implementation **************************************************************************************
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2008-04-16 20:54:59 UTC (rev 10610)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -41,12 +41,17 @@
import org.jboss.portal.test.wsrp.framework.support.TestPortletInvocationContext;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.EmptyMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.GroupedPortletsServiceDescriptionBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieNotRequiredMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.NullMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerGroupInitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerUserInitCookieMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.ResourceMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.SessionMarkupBehavior;
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
import org.jboss.portal.wsrp.core.CookieProtocol;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
import javax.servlet.http.HttpSession;
@@ -71,6 +76,7 @@
}
catch (PortletInvokerException expected)
{
+ // expected
}
}
@@ -132,39 +138,48 @@
checkRenderResult(response, "portlet2:1:view:maximized");
}
- public void testInitCookie() throws Exception
+ public void testInitCookieNotCalledWhenNotNeeded() throws Exception
{
- // first test that we don't initialize cookies if we don't need it
- RenderInvocation render = createRenderInvocation(InitCookieMarkupBehavior.PORTLET_HANDLE);
- TestPortletInvocationContext invocationContext = (TestPortletInvocationContext)render.getContext();
- HttpSession session = invocationContext.getClientRequest().getSession();
+ String handle = InitCookieNotRequiredMarkupBehavior.INIT_COOKIE_NOT_REQUIRED_HANDLE;
+ InitCookieMarkupBehavior behavior = (InitCookieMarkupBehavior)producer.getBehaviorRegistry().getMarkupBehaviorFor(handle);
- ProducerSessionInformation sessionInfo = consumer.getProducerSessionInformationFrom(session);
- ExtendedAssert.assertNull(sessionInfo);
+ ProducerSessionInformation sessionInfo = commonInitCookieTest(handle, behavior, null);
- consumer.invoke(render);
-
- sessionInfo = consumer.getProducerSessionInformationFrom(session);
ExtendedAssert.assertNotNull(sessionInfo);
ExtendedAssert.assertFalse(sessionInfo.isPerGroupCookies());
ExtendedAssert.assertFalse(sessionInfo.isInitCookieDone());
- // now require cookie initialization and check that everything went well
- producer.setRequiresInitCookie(CookieProtocol.perUser);
- render = createRenderInvocation(InitCookieMarkupBehavior.PORTLET_HANDLE, invocationContext);
+ ExtendedAssert.assertEquals(0, behavior.getInitCookieCallCount());
+ }
- consumer.invoke(render);
+ public void testInitCookiePerUser() throws PortletInvokerException, InvalidHandleFault
+ {
+ String handle = PerUserInitCookieMarkupBehavior.PER_USER_INIT_COOKIE_HANDLE;
+ InitCookieMarkupBehavior behavior = (InitCookieMarkupBehavior)producer.getBehaviorRegistry().getMarkupBehaviorFor(handle);
- sessionInfo = consumer.getProducerSessionInformationFrom(session);
+ ProducerSessionInformation sessionInfo = commonInitCookieTest(handle, behavior, CookieProtocol.perUser);
+
ExtendedAssert.assertFalse(sessionInfo.isPerGroupCookies());
ExtendedAssert.assertTrue(sessionInfo.isInitCookieDone());
ExtendedAssert.assertNotNull(sessionInfo.getUserCookie());
+
+ ExtendedAssert.assertEquals(1, behavior.getInitCookieCallCount());
}
- public void testImplicitCloning() throws Exception
+ public void testInitCookiePerGroup() throws PortletInvokerException, InvalidHandleFault
{
-// ActionInvocation action = createActionInvocation()
+ // need to setup with a specific service description behavior
+ setUpWith(new GroupedPortletsServiceDescriptionBehavior());
+ String handle = PerGroupInitCookieMarkupBehavior.PER_GROUP_INIT_COOKIE_HANDLE;
+ InitCookieMarkupBehavior behavior = (InitCookieMarkupBehavior)producer.getBehaviorRegistry().getMarkupBehaviorFor(handle);
+
+ ProducerSessionInformation sessionInfo = commonInitCookieTest(handle, behavior, CookieProtocol.perGroup);
+ ExtendedAssert.assertTrue(sessionInfo.isPerGroupCookies());
+ ExtendedAssert.assertTrue(sessionInfo.isInitCookieDone());
+ ExtendedAssert.assertNull(sessionInfo.getUserCookie());
+
+ ExtendedAssert.assertEquals(3, behavior.getInitCookieCallCount());
}
public void testResource() throws PortletInvokerException
@@ -175,6 +190,30 @@
checkRenderResult(response, "<img src='http://localhost:8080/test-resource-portlet/gif/logo.gif'/>");
}
+ private ProducerSessionInformation commonInitCookieTest(String handle, InitCookieMarkupBehavior behavior, CookieProtocol cookieProtocol)
+ throws PortletInvokerException
+ {
+ RenderInvocation render = createRenderInvocation(handle);
+ TestPortletInvocationContext invocationContext = (TestPortletInvocationContext)render.getContext();
+ HttpSession session = invocationContext.getClientRequest().getSession();
+
+ // set init cookie requirement
+ producer.setRequiresInitCookie(cookieProtocol);
+
+ // tell the producer which markup behavior we want to use
+ producer.setCurrentMarkupBehaviorHandle(handle);
+
+ render = createRenderInvocation(handle, invocationContext);
+
+ ExtendedAssert.assertEquals(0, behavior.getInitCookieCallCount());
+
+ consumer.invoke(render);
+
+ ExtendedAssert.assertEquals(cookieProtocol, consumer.getProducerInfo().getRequiresInitCookie());
+
+ return consumer.getProducerSessionInformationFrom(session);
+ }
+
private FragmentResponse checkRenderResult(PortletInvocationResponse response, String markup)
{
ExtendedAssert.assertNotNull(response);
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java 2008-04-16 20:54:59 UTC (rev 10610)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -24,6 +24,7 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.test.wsrp.WSRPConsumerBaseTest;
import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
@@ -33,8 +34,10 @@
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicPortletManagementBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.EmptyMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieNotRequiredMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.NullMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerGroupInitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerUserInitCookieMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.ResourceMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.SessionMarkupBehavior;
@@ -63,17 +66,23 @@
public void setUp() throws Exception
{
super.setUp();
+ setUpWith(new ServiceDescriptionBehavior());
+ }
+ protected void setUpWith(ServiceDescriptionBehavior serviceDescriptionBehavior) throws PortletInvokerException
+ {
// reset producer state
producer.reset();
// reset the behaviors
BehaviorRegistry registry = producer.getBehaviorRegistry();
registry.setPortletManagementBehavior(new BasicPortletManagementBehavior(registry));
- registry.setServiceDescriptionBehavior(new ServiceDescriptionBehavior());
+ registry.setServiceDescriptionBehavior(serviceDescriptionBehavior);
registry.registerMarkupBehavior(new BasicMarkupBehavior(registry));
registry.registerMarkupBehavior(new EmptyMarkupBehavior(registry));
- registry.registerMarkupBehavior(new InitCookieMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new InitCookieNotRequiredMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new PerGroupInitCookieMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new PerUserInitCookieMarkupBehavior(registry));
registry.registerMarkupBehavior(new NullMarkupBehavior(registry));
registry.registerMarkupBehavior(new SessionMarkupBehavior(registry));
registry.registerMarkupBehavior(new ResourceMarkupBehavior(registry));
@@ -85,6 +94,6 @@
consumer.refreshProducerInfo();
// use cache to avoid un-necessary calls
- consumer.getProducerInfo().setExpirationCacheSeconds(new Integer(120));
+ consumer.getProducerInfo().setExpirationCacheSeconds(120);
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java 2008-04-16 20:54:59 UTC (rev 10610)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -49,6 +49,7 @@
serviceDescription.setOfferedPortlets(new PortletDescription[]{pd1, pd2});
}
+ @Override
public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription)
throws OperationFailedFault, InvalidRegistrationFault, RemoteException
{
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -0,0 +1,53 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior;
+import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PortletDescription;
+import org.jboss.portal.wsrp.core.ServiceDescription;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class GroupedPortletsServiceDescriptionBehavior extends ServiceDescriptionBehavior
+{
+ @Override
+ public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ ServiceDescription sd = super.getServiceDescription(getServiceDescription);
+ PortletDescription[] portlets = sd.getOfferedPortlets();
+
+ for (int i = 0; i < portlets.length; i++)
+ {
+ portlets[i].setGroupID("group" + i % 3);
+ }
+
+ return sd;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieMarkupBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieMarkupBehavior.java 2008-04-16 20:54:59 UTC (rev 10610)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieMarkupBehavior.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -27,45 +27,74 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
import org.jboss.portal.test.wsrp.framework.MarkupBehavior;
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.GetMarkup;
+import org.jboss.portal.wsrp.core.InitCookie;
import org.jboss.portal.wsrp.core.InvalidCookieFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.ReturnAny;
+import java.rmi.RemoteException;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
* @since 2.6
*/
-public class InitCookieMarkupBehavior extends MarkupBehavior
+public abstract class InitCookieMarkupBehavior extends MarkupBehavior
{
- public static final String PORTLET_HANDLE = "initcookiehandle";
+ protected String portletHandle;
+ protected int initCookieCallCount;
-
public InitCookieMarkupBehavior(BehaviorRegistry registry)
{
super(registry);
- registerHandle(PORTLET_HANDLE);
+ initPortletHandle();
+ registerHandle(portletHandle);
}
+ protected abstract void initPortletHandle();
+
protected String getMarkupString(Mode mode, WindowState windowState, String navigationalState, GetMarkup getMarkup) throws InvalidCookieFault, OperationFailedFault
{
- System.out.println("InitCookieMarkupBehavior getMarkupString call count: " + callCount);
- String markup = "markup";
+ String handle = getMarkup.getPortletContext().getPortletHandle();
+
+ if (portletHandle.equals(handle))
+ {
+ return getMarkupString(handle);
+ }
+
+ // shouldn't happen
+ throw new OperationFailedFault();
+ }
+
+ protected String getMarkupString(String handle) throws InvalidCookieFault, OperationFailedFault
+ {
switch (callCount++)
{
case 0:
- return markup;
-
- case 1:
// simulate change of configuration between calls: upon receiving this, the consumer should invoke initCookie
throw new InvalidCookieFault();
- case 2:
- return markup;
+ case 1:
+ return handle;
default:
- // shouldn't be called more than 3 times
+ // shouldn't be called more than twice
throw new OperationFailedFault();
}
}
+
+ @Override
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ initCookieCallCount++;
+ return null;
+ }
+
+ public int getInitCookieCallCount()
+ {
+ return initCookieCallCount;
+ }
}
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieNotRequiredMarkupBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieNotRequiredMarkupBehavior.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieNotRequiredMarkupBehavior.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -0,0 +1,65 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.InitCookie;
+import org.jboss.portal.wsrp.core.InvalidCookieFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.ReturnAny;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class InitCookieNotRequiredMarkupBehavior extends InitCookieMarkupBehavior
+{
+ public static final String INIT_COOKIE_NOT_REQUIRED_HANDLE = "InitCookieNotRequired";
+
+ public InitCookieNotRequiredMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ protected void initPortletHandle()
+ {
+ portletHandle = INIT_COOKIE_NOT_REQUIRED_HANDLE;
+ }
+
+ @Override
+ protected String getMarkupString(String handle) throws InvalidCookieFault, OperationFailedFault
+ {
+ return handle;
+ }
+
+ @Override
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ super.initCookie(initCookie);
+ throw new OperationFailedFault();
+ }
+}
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerGroupInitCookieMarkupBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerGroupInitCookieMarkupBehavior.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerGroupInitCookieMarkupBehavior.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -0,0 +1,66 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.InitCookie;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.ReturnAny;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class PerGroupInitCookieMarkupBehavior extends InitCookieMarkupBehavior
+{
+ public static final String PER_GROUP_INIT_COOKIE_HANDLE = "PerGroupInitCookie";
+
+ public PerGroupInitCookieMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ protected void initPortletHandle()
+ {
+ portletHandle = PER_GROUP_INIT_COOKIE_HANDLE;
+ }
+
+ @Override
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ ReturnAny result = super.initCookie(initCookie);
+
+ if (initCookieCallCount > 3)
+ {
+ OperationFailedFault fault = new OperationFailedFault();
+ fault.initCause(new IllegalStateException("Service description only defines 3 groups so initCookie should only be called 3 times!"));
+ throw fault;
+ }
+
+ return result;
+ }
+}
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerUserInitCookieMarkupBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerUserInitCookieMarkupBehavior.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerUserInitCookieMarkupBehavior.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -0,0 +1,44 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class PerUserInitCookieMarkupBehavior extends InitCookieMarkupBehavior
+{
+ public static final String PER_USER_INIT_COOKIE_HANDLE = "PerUserInitCookie";
+
+ public PerUserInitCookieMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ protected void initPortletHandle()
+ {
+ portletHandle = PER_USER_INIT_COOKIE_HANDLE;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-04-16 20:54:59 UTC (rev 10610)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -231,7 +231,7 @@
return isModifyRegistrationRequired || (persistentRegistrationInfo != null && persistentRegistrationInfo.isModified());
}
- CookieProtocol getRequiresInitCookie()
+ public CookieProtocol getRequiresInitCookie()
{
return requiresInitCookie;
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java 2008-04-16 20:54:59 UTC (rev 10610)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java 2008-04-16 21:18:10 UTC (rev 10611)
@@ -175,18 +175,25 @@
// purge expired cookies
Cookie[] cookies = groupCookies.get(groupId);
- cookies = purgeExpiredCookies(cookies);
+ if (cookies != null)
+ {
+ cookies = purgeExpiredCookies(cookies);
- // if there are no non-expired cookies left, we will need to re-init them
- if (cookies.length == 0)
+ // if there are no non-expired cookies left, we will need to re-init them
+ if (cookies.length == 0)
+ {
+ setInitCookieDone(false);
+ }
+
+ // update cookies for the considered group id
+ groupCookies.put(groupId, cookies);
+
+ return outputToExternalForm(cookies);
+ }
+ else
{
- setInitCookieDone(false);
+ return null;
}
-
- // update cookies for the considered group id
- groupCookies.put(groupId, cookies);
-
- return outputToExternalForm(cookies);
}
public void clearGroupCookies()
@@ -363,6 +370,8 @@
*/
private Cookie[] purgeExpiredCookies(Cookie[] cookies)
{
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(cookies, "cookies");
+
List<Cookie> cleanCookies = Tools.toList(cookies);
for (Cookie cookie : cookies)
18 years
JBoss Portal SVN: r10610 - in branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal: test/wsrp/v1/consumer and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-04-16 16:54:59 -0400 (Wed, 16 Apr 2008)
New Revision: 10610
Added:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieNotRequiredMarkupBehavior.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerGroupInitCookieMarkupBehavior.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerUserInitCookieMarkupBehavior.java
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieMarkupBehavior.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
Log:
- Added setCurrentMarkupBehaviorHandle on TestWSRPProducer to be able to access the proper behavior when calling initCookie.
- Added V1ConsumerBaseTest.setUpWith method to allow switching of ServiceDescriptionBehavior on a per-method basis in test cases.
- Fixed a problem with ProducerSessionInformation.getGroupCookieFor method: the case where no cookies were found for the given
group id was not handled properly.
- ProducerInfo.getRequiresInitCookie is now public (used by tests and could potentially be exposed to the GUI).
- Added more test cases and behaviors to better test initCookie handling.
- Removed empty MarkupTestCase.testImplicitCloning method.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java 2008-04-16 20:31:54 UTC (rev 10609)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -37,4 +37,12 @@
void reset();
BehaviorRegistry getBehaviorRegistry();
+
+ /**
+ * Sets the currently used portlet handle identifying the MarkupBehavior we're using. This is needed to be able to
+ * dispatch calls to initCookie to the proper behavior.
+ *
+ * @param handle
+ */
+ void setCurrentMarkupBehaviorHandle(String handle);
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2008-04-16 20:31:54 UTC (rev 10609)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -89,6 +89,8 @@
public static final String USER_COOKIE = "cookie";
+ private String currentMarkupBehaviorHandle;
+
public TestWSRPProducerImpl()
{
reset();
@@ -99,9 +101,15 @@
return behaviorRegistry;
}
+ public void setCurrentMarkupBehaviorHandle(String handle)
+ {
+ currentMarkupBehaviorHandle = handle;
+ }
+
public void reset()
{
requiresInitCookie = null;
+ currentMarkupBehaviorHandle = null;
behaviorRegistry.clear();
}
@@ -162,12 +170,19 @@
throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
{
// should only be called if we required cookies to be initialized
- if (requiresInitCookie == null)
+ if (requiresInitCookie == null || CookieProtocol.none.equals(requiresInitCookie))
{
throw new OperationFailedFault();
}
- return null;
+ try
+ {
+ return getMarkupBehaviorFor(currentMarkupBehaviorHandle).initCookie(initCookie);
+ }
+ catch (InvalidHandleFault invalidHandleFault)
+ {
+ throw new OperationFailedFault();
+ }
}
// Registration implementation **************************************************************************************
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2008-04-16 20:31:54 UTC (rev 10609)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -43,12 +43,17 @@
import org.jboss.portal.test.wsrp.framework.support.TestPortletInvocationContext;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.EmptyMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.GroupedPortletsServiceDescriptionBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieNotRequiredMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.NullMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerGroupInitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerUserInitCookieMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.ResourceMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.SessionMarkupBehavior;
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
import org.jboss.portal.wsrp.core.CookieProtocol;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
import javax.servlet.http.HttpSession;
@@ -73,6 +78,7 @@
}
catch (PortletInvokerException expected)
{
+ // expected
}
}
@@ -134,39 +140,48 @@
checkRenderResult(response, "portlet2:1:view:maximized");
}
- public void testInitCookie() throws Exception
+ public void testInitCookieNotCalledWhenNotNeeded() throws Exception
{
- // first test that we don't initialize cookies if we don't need it
- RenderInvocation render = createRenderInvocation(InitCookieMarkupBehavior.PORTLET_HANDLE);
- TestPortletInvocationContext invocationContext = (TestPortletInvocationContext)render.getContext();
- HttpSession session = invocationContext.getClientRequest().getSession();
+ String handle = InitCookieNotRequiredMarkupBehavior.INIT_COOKIE_NOT_REQUIRED_HANDLE;
+ InitCookieMarkupBehavior behavior = (InitCookieMarkupBehavior)producer.getBehaviorRegistry().getMarkupBehaviorFor(handle);
- ProducerSessionInformation sessionInfo = consumer.getProducerSessionInformationFrom(session);
- ExtendedAssert.assertNull(sessionInfo);
+ ProducerSessionInformation sessionInfo = commonInitCookieTest(handle, behavior, null);
- consumer.invoke(render);
-
- sessionInfo = consumer.getProducerSessionInformationFrom(session);
ExtendedAssert.assertNotNull(sessionInfo);
ExtendedAssert.assertFalse(sessionInfo.isPerGroupCookies());
ExtendedAssert.assertFalse(sessionInfo.isInitCookieDone());
- // now require cookie initialization and check that everything went well
- producer.setRequiresInitCookie(CookieProtocol.perUser);
- render = createRenderInvocation(InitCookieMarkupBehavior.PORTLET_HANDLE, invocationContext);
+ ExtendedAssert.assertEquals(0, behavior.getInitCookieCallCount());
+ }
- consumer.invoke(render);
+ public void testInitCookiePerUser() throws PortletInvokerException, InvalidHandleFault
+ {
+ String handle = PerUserInitCookieMarkupBehavior.PER_USER_INIT_COOKIE_HANDLE;
+ InitCookieMarkupBehavior behavior = (InitCookieMarkupBehavior)producer.getBehaviorRegistry().getMarkupBehaviorFor(handle);
- sessionInfo = consumer.getProducerSessionInformationFrom(session);
+ ProducerSessionInformation sessionInfo = commonInitCookieTest(handle, behavior, CookieProtocol.perUser);
+
ExtendedAssert.assertFalse(sessionInfo.isPerGroupCookies());
ExtendedAssert.assertTrue(sessionInfo.isInitCookieDone());
ExtendedAssert.assertNotNull(sessionInfo.getUserCookie());
+
+ ExtendedAssert.assertEquals(1, behavior.getInitCookieCallCount());
}
- public void testImplicitCloning() throws Exception
+ public void testInitCookiePerGroup() throws PortletInvokerException, InvalidHandleFault
{
-// ActionInvocation action = createActionInvocation()
+ // need to setup with a specific service description behavior
+ setUpWith(new GroupedPortletsServiceDescriptionBehavior());
+ String handle = PerGroupInitCookieMarkupBehavior.PER_GROUP_INIT_COOKIE_HANDLE;
+ InitCookieMarkupBehavior behavior = (InitCookieMarkupBehavior)producer.getBehaviorRegistry().getMarkupBehaviorFor(handle);
+
+ ProducerSessionInformation sessionInfo = commonInitCookieTest(handle, behavior, CookieProtocol.perGroup);
+ ExtendedAssert.assertTrue(sessionInfo.isPerGroupCookies());
+ ExtendedAssert.assertTrue(sessionInfo.isInitCookieDone());
+ ExtendedAssert.assertNull(sessionInfo.getUserCookie());
+
+ ExtendedAssert.assertEquals(3, behavior.getInitCookieCallCount());
}
public void testResource() throws PortletInvokerException
@@ -177,6 +192,30 @@
checkRenderResult(response, "<img src='http://localhost:8080/test-resource-portlet/gif/logo.gif'/>");
}
+ private ProducerSessionInformation commonInitCookieTest(String handle, InitCookieMarkupBehavior behavior, CookieProtocol cookieProtocol)
+ throws PortletInvokerException
+ {
+ RenderInvocation render = createRenderInvocation(handle);
+ TestPortletInvocationContext invocationContext = (TestPortletInvocationContext)render.getContext();
+ HttpSession session = invocationContext.getClientRequest().getSession();
+
+ // set init cookie requirement
+ producer.setRequiresInitCookie(cookieProtocol);
+
+ // tell the producer which markup behavior we want to use
+ producer.setCurrentMarkupBehaviorHandle(handle);
+
+ render = createRenderInvocation(handle, invocationContext);
+
+ ExtendedAssert.assertEquals(0, behavior.getInitCookieCallCount());
+
+ consumer.invoke(render);
+
+ ExtendedAssert.assertEquals(cookieProtocol, consumer.getProducerInfo().getRequiresInitCookie());
+
+ return consumer.getProducerSessionInformationFrom(session);
+ }
+
private FragmentResponse checkRenderResult(PortletInvocationResponse response, String markup)
{
ExtendedAssert.assertNotNull(response);
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java 2008-04-16 20:31:54 UTC (rev 10609)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -24,6 +24,7 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.test.wsrp.WSRPConsumerBaseTest;
import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
@@ -33,8 +34,10 @@
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicPortletManagementBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.EmptyMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieNotRequiredMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.NullMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerGroupInitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerUserInitCookieMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.ResourceMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.SessionMarkupBehavior;
@@ -63,17 +66,23 @@
public void setUp() throws Exception
{
super.setUp();
+ setUpWith(new ServiceDescriptionBehavior());
+ }
+ protected void setUpWith(ServiceDescriptionBehavior serviceDescriptionBehavior) throws PortletInvokerException
+ {
// reset producer state
producer.reset();
// reset the behaviors
BehaviorRegistry registry = producer.getBehaviorRegistry();
registry.setPortletManagementBehavior(new BasicPortletManagementBehavior(registry));
- registry.setServiceDescriptionBehavior(new ServiceDescriptionBehavior());
+ registry.setServiceDescriptionBehavior(serviceDescriptionBehavior);
registry.registerMarkupBehavior(new BasicMarkupBehavior(registry));
registry.registerMarkupBehavior(new EmptyMarkupBehavior(registry));
- registry.registerMarkupBehavior(new InitCookieMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new InitCookieNotRequiredMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new PerGroupInitCookieMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new PerUserInitCookieMarkupBehavior(registry));
registry.registerMarkupBehavior(new NullMarkupBehavior(registry));
registry.registerMarkupBehavior(new SessionMarkupBehavior(registry));
registry.registerMarkupBehavior(new ResourceMarkupBehavior(registry));
@@ -85,6 +94,6 @@
consumer.refreshProducerInfo();
// use cache to avoid un-necessary calls
- consumer.getProducerInfo().setExpirationCacheSeconds(new Integer(120));
+ consumer.getProducerInfo().setExpirationCacheSeconds(120);
}
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java 2008-04-16 20:31:54 UTC (rev 10609)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -49,6 +49,7 @@
serviceDescription.setOfferedPortlets(new PortletDescription[]{pd1, pd2});
}
+ @Override
public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription)
throws OperationFailedFault, InvalidRegistrationFault, RemoteException
{
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -0,0 +1,53 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior;
+import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PortletDescription;
+import org.jboss.portal.wsrp.core.ServiceDescription;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class GroupedPortletsServiceDescriptionBehavior extends ServiceDescriptionBehavior
+{
+ @Override
+ public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ ServiceDescription sd = super.getServiceDescription(getServiceDescription);
+ PortletDescription[] portlets = sd.getOfferedPortlets();
+
+ for (int i = 0; i < portlets.length; i++)
+ {
+ portlets[i].setGroupID("group" + i % 3);
+ }
+
+ return sd;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieMarkupBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieMarkupBehavior.java 2008-04-16 20:31:54 UTC (rev 10609)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieMarkupBehavior.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -27,45 +27,74 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
import org.jboss.portal.test.wsrp.framework.MarkupBehavior;
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.GetMarkup;
+import org.jboss.portal.wsrp.core.InitCookie;
import org.jboss.portal.wsrp.core.InvalidCookieFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.ReturnAny;
+import java.rmi.RemoteException;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
* @since 2.6
*/
-public class InitCookieMarkupBehavior extends MarkupBehavior
+public abstract class InitCookieMarkupBehavior extends MarkupBehavior
{
- public static final String PORTLET_HANDLE = "initcookiehandle";
+ protected String portletHandle;
+ protected int initCookieCallCount;
-
public InitCookieMarkupBehavior(BehaviorRegistry registry)
{
super(registry);
- registerHandle(PORTLET_HANDLE);
+ initPortletHandle();
+ registerHandle(portletHandle);
}
+ protected abstract void initPortletHandle();
+
protected String getMarkupString(Mode mode, WindowState windowState, String navigationalState, GetMarkup getMarkup) throws InvalidCookieFault, OperationFailedFault
{
- System.out.println("InitCookieMarkupBehavior getMarkupString call count: " + callCount);
- String markup = "markup";
+ String handle = getMarkup.getPortletContext().getPortletHandle();
+
+ if (portletHandle.equals(handle))
+ {
+ return getMarkupString(handle);
+ }
+
+ // shouldn't happen
+ throw new OperationFailedFault();
+ }
+
+ protected String getMarkupString(String handle) throws InvalidCookieFault, OperationFailedFault
+ {
switch (callCount++)
{
case 0:
- return markup;
-
- case 1:
// simulate change of configuration between calls: upon receiving this, the consumer should invoke initCookie
throw new InvalidCookieFault();
- case 2:
- return markup;
+ case 1:
+ return handle;
default:
- // shouldn't be called more than 3 times
+ // shouldn't be called more than twice
throw new OperationFailedFault();
}
}
+
+ @Override
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ initCookieCallCount++;
+ return null;
+ }
+
+ public int getInitCookieCallCount()
+ {
+ return initCookieCallCount;
+ }
}
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieNotRequiredMarkupBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieNotRequiredMarkupBehavior.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/InitCookieNotRequiredMarkupBehavior.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -0,0 +1,65 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.InitCookie;
+import org.jboss.portal.wsrp.core.InvalidCookieFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.ReturnAny;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class InitCookieNotRequiredMarkupBehavior extends InitCookieMarkupBehavior
+{
+ public static final String INIT_COOKIE_NOT_REQUIRED_HANDLE = "InitCookieNotRequired";
+
+ public InitCookieNotRequiredMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ protected void initPortletHandle()
+ {
+ portletHandle = INIT_COOKIE_NOT_REQUIRED_HANDLE;
+ }
+
+ @Override
+ protected String getMarkupString(String handle) throws InvalidCookieFault, OperationFailedFault
+ {
+ return handle;
+ }
+
+ @Override
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ super.initCookie(initCookie);
+ throw new OperationFailedFault();
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerGroupInitCookieMarkupBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerGroupInitCookieMarkupBehavior.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerGroupInitCookieMarkupBehavior.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -0,0 +1,66 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.InitCookie;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.ReturnAny;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class PerGroupInitCookieMarkupBehavior extends InitCookieMarkupBehavior
+{
+ public static final String PER_GROUP_INIT_COOKIE_HANDLE = "PerGroupInitCookie";
+
+ public PerGroupInitCookieMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ protected void initPortletHandle()
+ {
+ portletHandle = PER_GROUP_INIT_COOKIE_HANDLE;
+ }
+
+ @Override
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ ReturnAny result = super.initCookie(initCookie);
+
+ if (initCookieCallCount > 3)
+ {
+ OperationFailedFault fault = new OperationFailedFault();
+ fault.initCause(new IllegalStateException("Service description only defines 3 groups so initCookie should only be called 3 times!"));
+ throw fault;
+ }
+
+ return result;
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerUserInitCookieMarkupBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerUserInitCookieMarkupBehavior.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/PerUserInitCookieMarkupBehavior.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -0,0 +1,44 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class PerUserInitCookieMarkupBehavior extends InitCookieMarkupBehavior
+{
+ public static final String PER_USER_INIT_COOKIE_HANDLE = "PerUserInitCookie";
+
+ public PerUserInitCookieMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ protected void initPortletHandle()
+ {
+ portletHandle = PER_USER_INIT_COOKIE_HANDLE;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-04-16 20:31:54 UTC (rev 10609)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -231,7 +231,7 @@
return isModifyRegistrationRequired || (persistentRegistrationInfo != null && persistentRegistrationInfo.isModified());
}
- CookieProtocol getRequiresInitCookie()
+ public CookieProtocol getRequiresInitCookie()
{
return requiresInitCookie;
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java 2008-04-16 20:31:54 UTC (rev 10609)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java 2008-04-16 20:54:59 UTC (rev 10610)
@@ -175,18 +175,25 @@
// purge expired cookies
Cookie[] cookies = groupCookies.get(groupId);
- cookies = purgeExpiredCookies(cookies);
+ if (cookies != null)
+ {
+ cookies = purgeExpiredCookies(cookies);
- // if there are no non-expired cookies left, we will need to re-init them
- if (cookies.length == 0)
+ // if there are no non-expired cookies left, we will need to re-init them
+ if (cookies.length == 0)
+ {
+ setInitCookieDone(false);
+ }
+
+ // update cookies for the considered group id
+ groupCookies.put(groupId, cookies);
+
+ return outputToExternalForm(cookies);
+ }
+ else
{
- setInitCookieDone(false);
+ return null;
}
-
- // update cookies for the considered group id
- groupCookies.put(groupId, cookies);
-
- return outputToExternalForm(cookies);
}
public void clearGroupCookies()
@@ -363,6 +370,8 @@
*/
private Cookie[] purgeExpiredCookies(Cookie[] cookies)
{
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(cookies, "cookies");
+
List<Cookie> cleanCookies = Tools.toList(cookies);
for (Cookie cookie : cookies)
18 years
JBoss Portal SVN: r10609 - in branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar: META-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-04-16 16:31:54 -0400 (Wed, 16 Apr 2008)
New Revision: 10609
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/portal-aop.xml
Log:
- Minor reformat.
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2008-04-16 16:47:31 UTC (rev 10608)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2008-04-16 20:31:54 UTC (rev 10609)
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?><!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ JBoss, a division of Red Hat ~
~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
~ contributors as indicated by the @authors tag. See the ~
@@ -936,17 +937,31 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends optional-attribute-name="PageService" proxy-type="attribute">portal:service=PageService</depends>
- <depends optional-attribute-name="CommandFactory" proxy-type="attribute">portal:commandFactory=DefaultPortal</depends>
+ <depends optional-attribute-name="CommandFactory" proxy-type="attribute">portal:commandFactory=DefaultPortal
+ </depends>
<depends optional-attribute-name="URLFactory" proxy-type="attribute">portal:urlFactory=Delegating</depends>
- <depends optional-attribute-name="StackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=Command</depends>
- <depends optional-attribute-name="PortalObjectContainer" proxy-type="attribute">portal:container=PortalObject</depends>
+ <depends optional-attribute-name="StackFactory" proxy-type="attribute">
+ portal:service=InterceptorStackFactory,type=Command
+ </depends>
+ <depends optional-attribute-name="PortalObjectContainer" proxy-type="attribute">portal:container=PortalObject
+ </depends>
<depends optional-attribute-name="InstanceContainer" proxy-type="attribute">portal:container=Instance</depends>
- <depends optional-attribute-name="PortalAuthorizationManagerFactory" proxy-type="attribute">portal:service=PortalAuthorizationManagerFactory</depends>
- <depends optional-attribute-name="CustomizationManager" proxy-type="attribute">portal:service=CustomizationManager</depends>
- <depends optional-attribute-name="ContentRendererRegistry" proxy-type="attribute">portal:service=ContentProviderRegistry</depends>
- <depends optional-attribute-name="ResponseHandler" proxy-type="attribute">portal:service=ResponseHandler,type=Selector</depends>
- <depends optional-attribute-name="PageControlPolicy" proxy-type="attribute">portal:service=ControlPolicy,type=Page</depends>
- <depends optional-attribute-name="ContentProviderRegistry" proxy-type="attribute">portal:service=ContentProviderRegistry</depends>
+ <depends optional-attribute-name="PortalAuthorizationManagerFactory" proxy-type="attribute">
+ portal:service=PortalAuthorizationManagerFactory
+ </depends>
+ <depends optional-attribute-name="CustomizationManager" proxy-type="attribute">portal:service=CustomizationManager
+ </depends>
+ <depends optional-attribute-name="ContentRendererRegistry" proxy-type="attribute">
+ portal:service=ContentProviderRegistry
+ </depends>
+ <depends optional-attribute-name="ResponseHandler" proxy-type="attribute">
+ portal:service=ResponseHandler,type=Selector
+ </depends>
+ <depends optional-attribute-name="PageControlPolicy" proxy-type="attribute">portal:service=ControlPolicy,type=Page
+ </depends>
+ <depends optional-attribute-name="ContentProviderRegistry" proxy-type="attribute">
+ portal:service=ContentProviderRegistry
+ </depends>
</mbean>
<!-- The controller factory -->
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/portal-aop.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/portal-aop.xml 2008-04-16 16:47:31 UTC (rev 10608)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/portal-aop.xml 2008-04-16 20:31:54 UTC (rev 10609)
@@ -22,16 +22,12 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<aop>
- <metadata
- tag="transaction"
- class="org.jboss.portal.core.aspects.server.TransactionInterceptor">
+ <metadata tag="transaction" class="org.jboss.portal.core.aspects.server.TransactionInterceptor">
<method name="invoke">
<trans-attribute>RequiresNew</trans-attribute>
</method>
</metadata>
- <metadata
- tag="transaction"
- class="org.jboss.portal.core.aspects.portlet.TransactionInterceptor">
+ <metadata tag="transaction" class="org.jboss.portal.core.aspects.portlet.TransactionInterceptor">
<method name="invokeNotSupported">
<trans-attribute>NotSupported</trans-attribute>
</method>
@@ -51,16 +47,12 @@
<trans-attribute>RequiresNew</trans-attribute>
</method>
</metadata>
- <metadata
- tag="transaction"
- class="org.jboss.portal.core.aspects.server.UserInterceptor$UserFinalizer">
+ <metadata tag="transaction" class="org.jboss.portal.core.aspects.server.UserInterceptor$UserFinalizer">
<method name="finalizeUser">
<trans-attribute>Required</trans-attribute>
</method>
</metadata>
- <metadata
- tag="transaction"
- class="org.jboss.portal.jems.hibernate.SessionFactoryBinder">
+ <metadata tag="transaction" class="org.jboss.portal.jems.hibernate.SessionFactoryBinder">
<method name="createSchema">
<trans-attribute>NotSupported</trans-attribute>
</method>
@@ -71,36 +63,29 @@
<trans-attribute>NotSupported</trans-attribute>
</method>
</metadata>
- <metadata
- tag="transaction"
- class="org.jboss.portal.core.deployment.jboss.ObjectDeployment">
+ <metadata tag="transaction" class="org.jboss.portal.core.deployment.jboss.ObjectDeployment">
<method name="doStart">
<trans-attribute>Required</trans-attribute>
</method>
</metadata>
- <metadata
- tag="transaction"
- class="org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer">
+ <metadata tag="transaction" class="org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer">
<method name="createRootIfNotExist">
<trans-attribute>Required</trans-attribute>
</method>
</metadata>
- <metadata
- tag="transaction"
- class="org.jboss.portal.core.deployment.jboss.PortletAppDeployment">
+ <metadata tag="transaction" class="org.jboss.portal.core.deployment.jboss.PortletAppDeployment">
<method name="handleInstance">
<trans-attribute>RequiresNew</trans-attribute>
</method>
</metadata>
- <metadata
- tag="transaction"
- class="org.jboss.portal.core.impl.model.instance.InstanceContainerImpl">
+ <metadata tag="transaction" class="org.jboss.portal.core.impl.model.instance.InstanceContainerImpl">
<method name="getDefinition">
<trans-attribute>Required</trans-attribute>
</method>
<method name="createDefinition">
<trans-attribute>Required</trans-attribute>
- <application-exceptions>org.jboss.portal.core.model.instance.DuplicateInstanceException</application-exceptions>
+ <application-exceptions>org.jboss.portal.core.model.instance.DuplicateInstanceException
+ </application-exceptions>
</method>
<method name="destroyDefinition">
<trans-attribute>Required</trans-attribute>
@@ -113,9 +98,7 @@
<application-exceptions>org.jboss.portal.portlet.InvalidPortletIdException</application-exceptions>
</method>
</metadata>
- <metadata
- tag="transaction"
- class="org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker">
+ <metadata tag="transaction" class="org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker">
<method name="createClone">
<trans-attribute>Required</trans-attribute>
</method>
18 years
JBoss Portal SVN: r10608 - in modules/common/trunk/common/src: test/java/org/jboss/portal/test/common/util/typedmap and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-16 12:47:31 -0400 (Wed, 16 Apr 2008)
New Revision: 10608
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/StringToIntegerMap.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapEntrySetTestCase.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapTestCase.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapValuesTestCase.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/ValueConverter.java
Log:
- improved implementation of AbstractTypedMap
- AbstractTypedMap now can accept null values, depending on the value converter
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java 2008-04-16 14:12:51 UTC (rev 10607)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java 2008-04-16 16:47:31 UTC (rev 10608)
@@ -56,90 +56,71 @@
}
/**
- * A transformer that specialize the behavior upon failures.
+ * Defines a converter that converts an internal value to an external value and vice versa.
+ * Null values will not passed as arguments to the methods and if a conversion method returns
+ * a null value it will be considered as a conversion failure although the implementations should
+ * not rely and this behavior and rather rely on a adapted exception.
*/
- private abstract static class Unwrapper<Out, In> extends Transformer<Out, In>
+ public abstract static class Converter<E, I>
{
- /**
- * @throws NullPointerException if the in argument is null
- * @throws IllegalArgumentException if the converted in argument is null
- */
- protected final Out transform(In in) throws NullPointerException, IllegalArgumentException
+
+ private final Transformer<I, E> keyUnwrapper = new Transformer<I, E>()
{
- if (in == null)
+ protected I transform(E e)
{
- throw new NullPointerException("No null input accepted");
- }
+ if (e == null)
+ {
+ throw new NullPointerException("No null input accepted");
+ }
- //
- Out out = convert(in);
+ //
+ I i = getInternal(e);
- //
- if (out == null)
- {
- throw new IllegalArgumentException("The provided input " + out + " was converted to a null output");
+ //
+ if (i == null)
+ {
+ throw new IllegalArgumentException("The provided input " + i + " was converted to a null output");
+ }
+
+ //
+ return i;
}
+ };
- //
- return out;
- }
-
- protected abstract Out convert(In in);
-
- }
-
- /**
- * An transformer that specialize the behavior upon failures.
- */
- private abstract static class Wrapper<Out, In> extends Transformer<Out, In>
- {
- /**
- * @throws IllegalStateException if the in argument is null or its conversion is null
- * @throws IllegalArgumentException if the converted in argument is null
- */
- protected final Out transform(In in)
+ private final Transformer<E, I> keyWrapper = new Transformer<E, I>()
{
- if (in == null)
+ protected E transform(I i)
{
- throw new IllegalStateException("No null input accepted");
- }
+ if (i == null)
+ {
+ throw new IllegalStateException("No null input accepted");
+ }
- //
- Out out = convert(in);
+ //
+ E e = getExternal(i);
- //
- if (out == null)
- {
- throw new IllegalStateException("The provided input " + out + " was converted to a null output");
+ //
+ if (e == null)
+ {
+ throw new IllegalStateException("The provided input " + e + " was converted to a null output");
+ }
+
+ //
+ return e;
}
+ };
- //
- return out;
- }
-
- protected abstract Out convert(In in);
- }
-
- /**
- * Defines a converter that converts an internal value to an external value and vice versa.
- * Null values will not passed as arguments to the methods and if a conversion method returns
- * a null value it will be considered as a conversion failure although the implementations should
- * not rely and this behavior and rather rely on a adapted exception.
- */
- public abstract static class Converter<E, I>
- {
-
- private final Unwrapper<I, E> unwrapper = new Unwrapper<I, E>()
+ private final Transformer<I, E> valueUnwrapper = new Transformer<I, E>()
{
- protected I convert(E e)
+ protected I transform(E e)
{
return getInternal(e);
}
};
- private final Wrapper<E, I> wrapper = new Wrapper<E, I>()
+ private final Transformer<E, I> valueWrapper = new Transformer<E, I>()
{
- protected E convert(I i)
+ protected E transform(I i)
{
return getExternal(i);
}
@@ -215,7 +196,7 @@
public final boolean containsKey(Object key)
{
EK ek = (EK)key;
- IK ik = getKeyConverter().unwrapper.transform(ek);
+ IK ik = getKeyConverter().keyUnwrapper.transform(ek);
return getDelegate().containsKey(ik);
}
@@ -230,8 +211,8 @@
public final EV put(EK ek, EV ev)
{
- IK ik = getKeyConverter().unwrapper.transform(ek);
- IV iv = getValueConverter().unwrapper.transform(ev);
+ IK ik = getKeyConverter().keyUnwrapper.transform(ek);
+ IV iv = getValueConverter().valueUnwrapper.transform(ev);
Map<IK, IV> map = getDelegate();
//
@@ -247,7 +228,7 @@
boolean rollback = true;
try
{
- ev = getValueConverter().wrapper.transform(iv);
+ ev = getValueConverter().valueWrapper.transform(iv);
rollback = false;
}
finally
@@ -266,12 +247,12 @@
public final EV get(Object key)
{
EK ek = (EK)key;
- IK ik = getKeyConverter().unwrapper.transform(ek);
+ IK ik = getKeyConverter().keyUnwrapper.transform(ek);
IV iv = getDelegate().get(ik);
EV ev = null;
if (iv != null)
{
- ev = getValueConverter().wrapper.transform(iv);
+ ev = getValueConverter().valueWrapper.transform(iv);
}
return ev;
}
@@ -279,7 +260,7 @@
public final EV remove(Object key)
{
EK ek = (EK)key;
- IK ik = getKeyConverter().unwrapper.transform(ek);
+ IK ik = getKeyConverter().keyUnwrapper.transform(ek);
Map<IK, IV> map = getDelegate();
IV iv = map.remove(ik);
EV ev = null;
@@ -288,7 +269,7 @@
boolean rollback = true;
try
{
- ev = getValueConverter().wrapper.transform(iv);
+ ev = getValueConverter().valueWrapper.transform(iv);
rollback = false;
}
finally
@@ -305,7 +286,7 @@
public final boolean containsValue(Object value)
{
EV ev = (EV)value;
- IV iv = getValueConverter().unwrapper.transform(ev);
+ IV iv = getValueConverter().valueUnwrapper.transform(ev);
return getDelegate().containsValue(iv);
}
@@ -362,10 +343,10 @@
try
{
// Unwrap key, mostly for checking its type is correct
- IK ik = getKeyConverter().unwrapper.transform(thatKey);
+ IK ik = getKeyConverter().keyUnwrapper.transform(thatKey);
// Unwrap value
- IV iv = getValueConverter().unwrapper.transform(thatValue);
+ IV iv = getValueConverter().valueUnwrapper.transform(thatValue);
// Get the internal value
IV internalValue = delegate.get(ik);
@@ -415,8 +396,8 @@
Map<IK, IV> u = new HashMap<IK, IV>(t.size());
for (Entry<? extends EK, ? extends EV> entry : t.entrySet())
{
- IK ik = getKeyConverter().unwrapper.transform(entry.getKey());
- IV iv = getValueConverter().unwrapper.transform(entry.getValue());
+ IK ik = getKeyConverter().keyUnwrapper.transform(entry.getKey());
+ IV iv = getValueConverter().valueUnwrapper.transform(entry.getValue());
u.put(ik, iv);
}
return u;
@@ -442,8 +423,8 @@
{
for (Entry<IK, IV> entry : getDelegate().entrySet())
{
- getKeyConverter().wrapper.transform(entry.getKey());
- getValueConverter().wrapper.transform(entry.getValue());
+ getKeyConverter().keyWrapper.transform(entry.getKey());
+ getValueConverter().valueWrapper.transform(entry.getValue());
}
}
@@ -454,12 +435,12 @@
private final Collection<I> delegate;
/** . */
- private final Unwrapper<I, E> unwrapper;
+ private final Transformer<I, E> unwrapper;
/** . */
- private final Wrapper<E, I> wrapper;
+ private final Transformer<E, I> wrapper;
- private TypedCollection(Collection<I> delegate, Unwrapper<I, E> unwrapper, Wrapper<E, I> wrapper)
+ private TypedCollection(Collection<I> delegate, Transformer<I, E> unwrapper, Transformer<E, I> wrapper)
{
this.delegate = delegate;
this.unwrapper = unwrapper;
@@ -627,17 +608,17 @@
protected Transformer<EK, IK> getKeyWrapper()
{
- return getKeyConverter().wrapper;
+ return getKeyConverter().keyWrapper;
}
protected Transformer<EV, IV> getValueWrapper()
{
- return getValueConverter().wrapper;
+ return getValueConverter().valueWrapper;
}
protected Transformer<IV, EV> getValueUnwrapper()
{
- return getValueConverter().unwrapper;
+ return getValueConverter().valueUnwrapper;
}
}
@@ -650,31 +631,31 @@
protected Transformer<IK, EK> getKeyWrapper()
{
- return getKeyConverter().unwrapper;
+ return getKeyConverter().keyUnwrapper;
}
protected Transformer<IV, EV> getValueWrapper()
{
- return getValueConverter().unwrapper;
+ return getValueConverter().valueUnwrapper;
}
protected Transformer<EV, IV> getValueUnwrapper()
{
- return getValueConverter().wrapper;
+ return getValueConverter().valueWrapper;
}
}
- private class EntryWrapper extends Wrapper<Map.Entry<EK, EV>, Map.Entry<IK, IV>>
+ private class EntryWrapper extends Transformer<Map.Entry<EK, EV>, Map.Entry<IK, IV>>
{
- protected Entry<EK, EV> convert(Entry<IK, IV> externalEntry)
+ protected Entry<EK, EV> transform(Entry<IK, IV> externalEntry)
{
return new ExternalEntry(externalEntry);
}
}
- private class EntryUnwrapper extends Unwrapper<Map.Entry<IK, IV>, Map.Entry<EK, EV>>
+ private class EntryUnwrapper extends Transformer<Map.Entry<IK, IV>, Map.Entry<EK, EV>>
{
- protected Entry<IK, IV> convert(Entry<EK, EV> internalEntry)
+ protected Entry<IK, IV> transform(Entry<EK, EV> internalEntry)
{
return new InternalEntry(internalEntry);
}
@@ -684,7 +665,7 @@
{
public KeySet()
{
- super(getDelegate().keySet(), getKeyConverter().unwrapper, getKeyConverter().wrapper);
+ super(getDelegate().keySet(), getKeyConverter().keyUnwrapper, getKeyConverter().keyWrapper);
}
public boolean equals(Object obj)
@@ -755,7 +736,7 @@
{
public ValueCollection()
{
- super(getDelegate().values(), getValueConverter().unwrapper, getValueConverter().wrapper);
+ super(getDelegate().values(), getValueConverter().valueUnwrapper, getValueConverter().valueWrapper);
}
}
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/StringToIntegerMap.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/StringToIntegerMap.java 2008-04-16 14:12:51 UTC (rev 10607)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/StringToIntegerMap.java 2008-04-16 16:47:31 UTC (rev 10608)
@@ -37,4 +37,9 @@
{
super(map, new KeyConverter(), new ValueConverter());
}
+
+ public void setAcceptNull(boolean acceptNull)
+ {
+ ((ValueConverter)getValueConverter()).acceptNull = acceptNull;
+ }
}
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapEntrySetTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapEntrySetTestCase.java 2008-04-16 14:12:51 UTC (rev 10607)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapEntrySetTestCase.java 2008-04-16 16:47:31 UTC (rev 10608)
@@ -195,7 +195,7 @@
}
try
{
- entries.containsAll(Tools.toList(new ExternalEntry("zero", "0"), null));
+ entries.containsAll(Tools.toList((ExternalEntry)null));
fail();
}
catch (NullPointerException e)
@@ -204,7 +204,7 @@
}
try
{
- entries.containsAll(Tools.toList(new ExternalEntry(null, "0"), null));
+ entries.containsAll(Tools.toList(new ExternalEntry(null, "0")));
fail();
}
catch (NullPointerException e)
@@ -213,13 +213,18 @@
}
try
{
- entries.containsAll(Tools.toList(new ExternalEntry("zero", null), null));
+ entries.containsAll(Tools.toList(new ExternalEntry("zero", null)));
fail();
}
catch (NullPointerException e)
{
assertEquals(expected, delegate);
}
+
+ //
+ map.setAcceptNull(true);
+ delegate.put(0L, null);
+ assertTrue(entries.containsAll(Tools.toList(new ExternalEntry("zero", null))));
}
//
@@ -346,17 +351,18 @@
public void testContainsArgumentConvertedToNull()
{
+ // blih
+// try
+// {
+// entries.contains(new ExternalEntry("one", "" + ValueConverter.NULL));
+// fail();
+// }
+// catch (IllegalArgumentException e)
+// {
+// assertEquals(expected, delegate);
+// }
try
{
- entries.contains(new ExternalEntry("one", "" + ValueConverter.NULL));
- fail();
- }
- catch (IllegalArgumentException e)
- {
- assertEquals(expected, delegate);
- }
- try
- {
entries.contains(new ExternalEntry(KeyConverter.NULL, "1"));
fail();
}
@@ -377,15 +383,16 @@
{
assertEquals(expected, delegate);
}
- try
- {
- entries.containsAll(Tools.toList(new ExternalEntry("zero", "0"), new ExternalEntry("one", "" + ValueConverter.NULL)));
- fail();
- }
- catch (IllegalArgumentException e)
- {
- assertEquals(expected, delegate);
- }
+ // blih
+// try
+// {
+// entries.containsAll(Tools.toList(new ExternalEntry("zero", "0"), new ExternalEntry("one", "" + ValueConverter.NULL)));
+// fail();
+// }
+// catch (IllegalArgumentException e)
+// {
+// assertEquals(expected, delegate);
+// }
}
//
@@ -605,16 +612,16 @@
assertEquals(expected, delegate);
}
- //
- try
- {
- entry.setValue("" + ValueConverter.NULL);
- fail();
- }
- catch (IllegalArgumentException e)
- {
- assertEquals(expected, delegate);
- }
+ // blih
+// try
+// {
+// entry.setValue("" + ValueConverter.NULL);
+// fail();
+// }
+// catch (IllegalArgumentException e)
+// {
+// assertEquals(expected, delegate);
+// }
//
try
@@ -628,16 +635,24 @@
}
//
- delegate.put((long)0, ValueConverter.NULL);
- try
- {
- entry.getValue();
- fail();
- }
- catch (IllegalStateException e)
- {
- }
+ map.setAcceptNull(true);
+ assertEquals("1", entry.setValue(null));
+ Map<Long, Integer> copy = new HashMap<Long, Integer>(expected);
+ copy.put(0L, null);
+ assertEquals(copy, delegate);
+ assertEquals(null, entry.setValue("1"));
+ // blih
+// delegate.put((long)0, ValueConverter.NULL);
+// try
+// {
+// entry.getValue();
+// fail();
+// }
+// catch (IllegalStateException e)
+// {
+// }
+
//
delegate.put((long)0, ValueConverter.IAE);
try
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapTestCase.java 2008-04-16 14:12:51 UTC (rev 10607)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapTestCase.java 2008-04-16 16:47:31 UTC (rev 10608)
@@ -30,6 +30,7 @@
import java.util.Set;
import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.MapBuilder;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -157,7 +158,7 @@
}
catch (CustomRuntimeException e)
{
- assertEquals(ValueConverter.UNCHECKED, delegate.get((long)0));
+ assertEquals(ValueConverter.UNCHECKED, (int)delegate.get((long)0));
}
}
@@ -171,7 +172,7 @@
}
catch (CustomRuntimeException e)
{
- assertEquals(ValueConverter.UNCHECKED, delegate.get((long)0));
+ assertEquals(ValueConverter.UNCHECKED, (int)delegate.get((long)0));
}
}
@@ -185,7 +186,7 @@
}
catch (CustomRuntimeException e)
{
- assertEquals(ValueConverter.UNCHECKED, delegate.get((long)0));
+ assertEquals(ValueConverter.UNCHECKED, (int)delegate.get((long)0));
}
}
@@ -367,6 +368,11 @@
{
assertTrue(delegate.size() == 0);
}
+
+ //
+ map.setAcceptNull(true);
+ map.put("zero", null);
+ assertEquals(MapBuilder.hashMap(0L, (Integer)null).get(), delegate);
}
public void testContainsValueNullValueArgument()
@@ -380,6 +386,12 @@
{
assertTrue(delegate.size() == 0);
}
+
+ //
+ map.setAcceptNull(true);
+ assertFalse(map.containsValue(null));
+ delegate.put((0L), null);
+ assertTrue(map.containsValue(null));
}
//
@@ -438,31 +450,33 @@
//
- public void testPutValueArgumentConvertedToNull()
- {
- try
- {
- map.put("zero", "" + ValueConverter.NULL);
- fail();
- }
- catch (IllegalArgumentException e)
- {
- assertFalse(delegate.containsKey((long)0));
- }
- }
+ // blih
+// public void testPutValueArgumentConvertedToNull()
+// {
+// try
+// {
+// map.put("zero", "" + ValueConverter.NULL);
+// fail();
+// }
+// catch (IllegalArgumentException e)
+// {
+// assertFalse(delegate.containsKey((long)0));
+// }
+// }
- public void testContainsValueValueArgumentConvertedToNull()
- {
- try
- {
- map.containsValue("" + ValueConverter.NULL);
- fail();
- }
- catch (IllegalArgumentException e)
- {
- assertTrue(delegate.size() == 0);
- }
- }
+ // blih
+// public void testContainsValueValueArgumentConvertedToNull()
+// {
+// try
+// {
+// map.containsValue("" + ValueConverter.NULL);
+// fail();
+// }
+// catch (IllegalArgumentException e)
+// {
+// assertTrue(delegate.size() == 0);
+// }
+// }
//
@@ -548,47 +562,50 @@
//
- public void testGetInternalValueConvertedToNull()
- {
- delegate.put((long)0, ValueConverter.NULL);
- try
- {
- map.get("zero");
- fail();
- }
- catch (IllegalStateException e)
- {
- assertEquals(ValueConverter.NULL, delegate.get((long)0));
- }
- }
+ // blih
+// public void testGetInternalValueConvertedToNull()
+// {
+// delegate.put((long)0, ValueConverter.NULL);
+// try
+// {
+// map.get("zero");
+// fail();
+// }
+// catch (IllegalStateException e)
+// {
+// assertEquals(ValueConverter.NULL, delegate.get((long)0));
+// }
+// }
- public void testPutInternalValueConvertedToNull()
- {
- delegate.put((long)0, ValueConverter.NULL);
- try
- {
- map.put("zero", "0");
- fail();
- }
- catch (IllegalStateException e)
- {
- assertEquals(ValueConverter.NULL, delegate.get((long)0));
- }
- }
+ // blih
+// public void testPutInternalValueConvertedToNull()
+// {
+// delegate.put((long)0, ValueConverter.NULL);
+// try
+// {
+// map.put("zero", "0");
+// fail();
+// }
+// catch (IllegalStateException e)
+// {
+// assertEquals(ValueConverter.NULL, delegate.get((long)0));
+// }
+// }
- public void testRemoveInternalValueConvertedToNull()
- {
- delegate.put((long)0, ValueConverter.NULL);
- try
- {
- map.remove("zero");
- fail();
- }
- catch (IllegalStateException e)
- {
- assertEquals(ValueConverter.NULL, delegate.get((long)0));
- }
- }
+ // blih
+// public void testRemoveInternalValueConvertedToNull()
+// {
+// delegate.put((long)0, ValueConverter.NULL);
+// try
+// {
+// map.remove("zero");
+// fail();
+// }
+// catch (IllegalStateException e)
+// {
+// assertEquals(ValueConverter.NULL, delegate.get((long)0));
+// }
+// }
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapValuesTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapValuesTestCase.java 2008-04-16 14:12:51 UTC (rev 10607)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/TypedMapValuesTestCase.java 2008-04-16 16:47:31 UTC (rev 10608)
@@ -29,8 +29,10 @@
import java.util.Set;
import java.util.Iterator;
import java.util.Collection;
+import java.util.ArrayList;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.util.MapBuilder;
import org.jboss.portal.common.NotYetImplemented;
/**
@@ -241,6 +243,13 @@
{
assertEquals(expected, delegate);
}
+
+ //
+ map.setAcceptNull(true);
+ delegate.put(0L, null);
+ delegate.put(1L, null);
+ assertTrue(values.remove(null));
+ assertEquals(MapBuilder.hashMap(delegate.keySet().iterator().next(), (Integer)null).get(), delegate);
}
public void testContainsNullArgument()
@@ -254,6 +263,11 @@
{
assertEquals(expected, delegate);
}
+
+ //
+ map.setAcceptNull(true);
+ delegate.put(0L, null);
+ assertTrue(values.contains(null));
}
public void testRemoveAllNullArgument()
@@ -267,6 +281,8 @@
{
assertEquals(expected, delegate);
}
+
+ //
try
{
values.removeAll(Tools.toList("0", null));
@@ -276,6 +292,15 @@
{
assertEquals(expected, delegate);
}
+
+ //
+ map.setAcceptNull(true);
+ delegate.put(0L, 0);
+ delegate.put(1L, null);
+ delegate.put(2L, null);
+ delegate.put(3L, 3);
+ assertTrue(values.removeAll(Tools.toList("0", null)));
+ assertEquals(MapBuilder.hashMap(3L, 3).get(), delegate);
}
public void testRetainAllNullArgument()
@@ -289,6 +314,8 @@
{
assertEquals(expected, delegate);
}
+
+ //
try
{
values.retainAll(Tools.toList("0", null));
@@ -298,6 +325,15 @@
{
assertEquals(expected, delegate);
}
+
+ //
+ delegate.put(0L, 0);
+ delegate.put(1L, null);
+ delegate.put(2L, null);
+ delegate.put(3L, 3);
+ map.setAcceptNull(true);
+ assertTrue(values.retainAll(Tools.toList("0", null)));
+ assertEquals(MapBuilder.hashMap(0L, 0).put(1L, null).put(2L, null).get(), delegate);
}
public void testContainsAllNullArgument()
@@ -311,6 +347,8 @@
{
assertEquals(expected, delegate);
}
+
+ //
try
{
values.containsAll(Tools.toList("0", null));
@@ -320,6 +358,12 @@
{
assertEquals(expected, delegate);
}
+
+ //
+ map.setAcceptNull(true);
+ delegate.put(0L, 0);
+ delegate.put(1L, null);
+ assertTrue(values.containsAll(Tools.toList("0", null)));
}
//
@@ -525,19 +569,27 @@
//
+ // blih
+/*
public void testRemoveArgumentConvertedToNull()
{
try
{
- values.remove("" + ValueConverter.NULL);
+ values.remove(ValueConverter.NULL);
fail();
}
- catch (IllegalArgumentException e)
+ catch (NullPointerException e)
{
assertEquals(expected, delegate);
}
+
+ //
+ map.setAcceptNull(true);
}
+*/
+ // blih
+/*
public void testContainsArgumentConvertedToNull()
{
try
@@ -550,6 +602,7 @@
assertEquals(expected, delegate);
}
}
+*/
public void testRemoveAllArgumentConvertedToNull()
{
@@ -564,31 +617,33 @@
}
}
- public void testRetainAllArgumentConvertedToNull()
- {
- try
- {
- values.retainAll(Tools.toList("0", ""+ ValueConverter.NULL));
- fail();
- }
- catch (IllegalArgumentException e)
- {
- assertEquals(expected, delegate);
- }
- }
+ // blih
+// public void testRetainAllArgumentConvertedToNull()
+// {
+// try
+// {
+// values.retainAll(Tools.toList("0", ""+ ValueConverter.NULL));
+// fail();
+// }
+// catch (IllegalArgumentException e)
+// {
+// assertEquals(expected, delegate);
+// }
+// }
- public void testContainsAllArgumentConvertedToNull()
- {
- try
- {
- values.containsAll(Tools.toList("0", "" + ValueConverter.NULL));
- fail();
- }
- catch (IllegalArgumentException e)
- {
- assertEquals(expected, delegate);
- }
- }
+ // blih
+// public void testContainsAllArgumentConvertedToNull()
+// {
+// try
+// {
+// values.containsAll(Tools.toList("0", "" + ValueConverter.NULL));
+// fail();
+// }
+// catch (IllegalArgumentException e)
+// {
+// assertEquals(expected, delegate);
+// }
+// }
//
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/ValueConverter.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/ValueConverter.java 2008-04-16 14:12:51 UTC (rev 10607)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/util/typedmap/ValueConverter.java 2008-04-16 16:47:31 UTC (rev 10608)
@@ -32,18 +32,35 @@
public class ValueConverter extends AbstractTypedMap.Converter<String, Integer>
{
- public static final Integer NULL = 10;
- public static final Integer UNCHECKED = 11;
- public static final Integer IAE = 12;
- public static final Integer CCE = 13;
+ public static final Integer NULL = null;
+ public static final int UNCHECKED = 11;
+ public static final int IAE = 12;
+ public static final int CCE = 13;
+ /** . */
+ boolean acceptNull;
+ public ValueConverter()
+ {
+ this.acceptNull = false;
+ }
+
protected Integer getInternal(String external) throws IllegalArgumentException, ClassCastException
{
- Assert.assertNotNull(external);
+ if (external == null)
+ {
+ if (acceptNull)
+ {
+ return null;
+ }
+ else
+ {
+ throw new NullPointerException();
+ }
+ }
//
- int i;
+ Integer i;
try
{
i = new Integer(external);
@@ -56,10 +73,12 @@
}
//
- if (NULL == i)
+ if (i == null)
{
return null;
}
+
+ //
if (UNCHECKED == i)
{
throw new CustomRuntimeException();
@@ -79,22 +98,28 @@
protected String getExternal(Integer internal)
{
- Assert.assertNotNull(internal);
+ if (internal == null)
+ {
+ if (acceptNull)
+ {
+ return null;
+ }
+ else
+ {
+ throw new IllegalStateException();
+ }
+ }
//
- if (NULL.equals(internal))
+ if (UNCHECKED == internal)
{
- return null;
- }
- if (UNCHECKED.equals(internal))
- {
throw new CustomRuntimeException();
}
- if (IAE.equals(internal))
+ if (IAE == internal)
{
throw new IllegalArgumentException();
}
- if (CCE.equals(internal))
+ if (CCE == internal)
{
throw new ClassCastException();
}
18 years