Author: julien(a)jboss.com
Date: 2007-08-21 10:27:39 -0400 (Tue, 21 Aug 2007)
New Revision: 8014
Added:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/TestPortletInvocationContext.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/TestRenderContext.java
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
modules/portlet/trunk/test/build.xml
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortalServlet.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
Log:
- forgot to wire the PortletContainer to the PortletApplication
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java 2007-08-21
13:58:06 UTC (rev 8013)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java 2007-08-21
14:27:39 UTC (rev 8014)
@@ -44,6 +44,10 @@
/** Return the porlet application context. */
PortletApplicationContext getContext();
+ void addContainer(PortletContainer container);
+
+ void removeContainer(PortletContainer container);
+
/**
* Starts the application only. It does not take care of starting its components.
*
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-08-21
13:58:06 UTC (rev 8013)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-08-21
14:27:39 UTC (rev 8014)
@@ -57,6 +57,8 @@
*/
PortletApplication getApplication();
+ void setApplication(PortletApplication application);
+
/**
*
*/
Modified: modules/portlet/trunk/test/build.xml
===================================================================
--- modules/portlet/trunk/test/build.xml 2007-08-21 13:58:06 UTC (rev 8013)
+++ modules/portlet/trunk/test/build.xml 2007-08-21 14:27:39 UTC (rev 8014)
@@ -162,6 +162,8 @@
<fileset dir="${build.lib}"
includes="portlet-test-lib.jar"/>
<fileset dir="${jboss.portal/modules/common.lib}"
includes="*.jar"/>
<fileset dir="${jboss.portal-portlet.lib}"
includes="*.jar"/>
+
+ <fileset dir="${sun.jaf.lib}" includes="*.jar"/>
<fileset dir="${jboss.microcontainer.lib}"
includes="*.jar"/>
<fileset dir="${jboss/common.core.lib}"
includes="*.jar"/>
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortalServlet.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortalServlet.java 2007-08-21
13:58:06 UTC (rev 8013)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortalServlet.java 2007-08-21
14:27:39 UTC (rev 8014)
@@ -23,6 +23,12 @@
package org.jboss.portal.portlet.test;
import org.jboss.portal.portlet.container.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.MediaType;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -48,12 +54,26 @@
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
+
+
+ writer.print("<html><body>");
for (Iterator i = registry.getPortletApplications().iterator(); i.hasNext();)
{
- Object o = i.next();
- System.out.println("o = " + o);
+ PortletApplication application = (PortletApplication)i.next();
+ writer.print("<div><div>" + application.getId() +
"</div>");
+ for (Iterator j = application.getPortletContainers().iterator();j.hasNext();)
+ {
+ PortletContainer container = (PortletContainer)j.next();
+ writer.print("<div><div>" + container.getId() +
"</div>");
+ writer.print("<div>Content</div>");
+ writer.print("</div>");
+ }
+ writer.print("</div>");
}
+ TestRenderContext renderContext = new TestRenderContext(Mode.VIEW,
WindowState.NORMAL, null, new MarkupInfo(MediaType.HTML, "UTF8"), req, resp);
+ writer.print("</body></html>");
+
}
}
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2007-08-21
13:58:06 UTC (rev 8013)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2007-08-21
14:27:39 UTC (rev 8014)
@@ -111,16 +111,24 @@
bmd.setStart(new AbstractLifecycleMetaData("start"));
bmd.setStop(new AbstractLifecycleMetaData("stop"));
bmd.setProperties(Collections.singleton(new
AbstractPropertyMetaData("application", new
AbstractDependencyValueMetaData(id))));
- AbstractInstallMetaData installmd = new AbstractInstallMetaData();
- installmd.setBean("PortletApplicationDeployer");
- installmd.setParameters(Collections.singletonList(new
AbstractParameterMetaData(new ThisValueMetaData())));
- installmd.setMethodName("installPortletContainer");
- bmd.setInstalls(Collections.singletonList(installmd));
- AbstractInstallMetaData uninstallmd = new AbstractInstallMetaData();
- uninstallmd.setBean("PortletApplicationDeployer");
- uninstallmd.setParameters(Collections.singletonList(new
AbstractParameterMetaData(new ThisValueMetaData())));
- uninstallmd.setMethodName("uninstallPortletContainer");
- bmd.setUninstalls(Collections.singletonList(uninstallmd));
+ AbstractInstallMetaData deployerinstallmd = new AbstractInstallMetaData();
+ deployerinstallmd.setBean("PortletApplicationDeployer");
+ deployerinstallmd.setParameters(Collections.singletonList(new
AbstractParameterMetaData(new ThisValueMetaData())));
+ deployerinstallmd.setMethodName("installPortletContainer");
+ AbstractInstallMetaData applicationinstallmd = new AbstractInstallMetaData();
+ applicationinstallmd.setBean(id);
+ applicationinstallmd.setParameters(Collections.singletonList(new
AbstractParameterMetaData(new ThisValueMetaData())));
+ applicationinstallmd.setMethodName("addContainer");
+ bmd.setInstalls(new
CollectionBuilder().add(deployerinstallmd).add(applicationinstallmd).toArrayList());
+ AbstractInstallMetaData deployeruninstallmd = new AbstractInstallMetaData();
+ deployeruninstallmd.setBean("PortletApplicationDeployer");
+ deployeruninstallmd.setParameters(Collections.singletonList(new
AbstractParameterMetaData(new ThisValueMetaData())));
+ deployeruninstallmd.setMethodName("uninstallPortletContainer");
+ AbstractInstallMetaData applicationuninstallmd = new AbstractInstallMetaData();
+ applicationuninstallmd.setBean(id);
+ applicationuninstallmd.setParameters(Collections.singletonList(new
AbstractParameterMetaData(new ThisValueMetaData())));
+ applicationuninstallmd.setMethodName("removeContainer");
+ bmd.setUninstalls(new
CollectionBuilder().add(deployeruninstallmd).add(applicationuninstallmd).toArrayList());
try
{
KernelControllerContext portletContainerControllerContext =
kernel.getController().install(bmd);
Added:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/TestPortletInvocationContext.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/TestPortletInvocationContext.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/TestPortletInvocationContext.java 2007-08-21
14:27:39 UTC (rev 8014)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * 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.portlet.test;
+
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.MarkupInfo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestPortletInvocationContext extends AbstractPortletInvocationContext
+{
+
+ /** . */
+ private HttpServletRequest req;
+
+ /** . */
+ private HttpServletResponse resp;
+
+ public TestPortletInvocationContext(
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ MarkupInfo markupInfo,
+ HttpServletRequest req,
+ HttpServletResponse resp)
+ {
+ super(mode, windowState, navigationalState, markupInfo);
+ this.req = req;
+ this.resp = resp;
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return req;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return resp;
+ }
+
+ public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean
wantAuthenticated, boolean relative)
+ {
+ return "TODO";
+ }
+}
Added:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/TestRenderContext.java
===================================================================
---
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/TestRenderContext.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/TestRenderContext.java 2007-08-21
14:27:39 UTC (rev 8014)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.portlet.test;
+
+import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.MarkupInfo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestRenderContext extends TestPortletInvocationContext implements
RenderContext
+{
+ public TestRenderContext(Mode mode, WindowState windowState, StateString
navigationalState, MarkupInfo markupInfo, HttpServletRequest req, HttpServletResponse
resp)
+ {
+ super(mode, windowState, navigationalState, markupInfo, req, resp);
+ }
+}