Author: julien(a)jboss.com
Date: 2008-02-19 17:17:41 -0500 (Tue, 19 Feb 2008)
New Revision: 10035
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplication.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ClientDataRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceRequestImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletApplication.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletContainer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
Log:
reduce the number of kernel beans
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -267,7 +267,12 @@
}
//
- ParameterMap publicNS =
pageState.getPublicNavigationalState(portletRequest.getWindowId());
+ ParameterMap publicNS = null;
+ if (pageState != null)
+ {
+ publicNS =
pageState.getPublicNavigationalState(portletRequest.getWindowId());
+ }
+
PortletInvocationContext portletInvocationContext =
context.createPortletInvocationContext(portletRequest.getWindowId(), pageState);
ActionInvocation actionInvocation = new
ActionInvocation(portletInvocationContext);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplication.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplication.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletApplication.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -45,7 +45,7 @@
*
* @return the portlet containers
*/
- Collection<PortletContainer> getPortletContainers();
+ Collection<? extends PortletContainer> getPortletContainers();
/**
* Returns a specific container or null if it does not exist
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -44,7 +44,7 @@
{
public ActionRequestImpl createActionRequest(ActionInvocation invocation)
{
- return new ActionRequestImpl(invocation);
+ return new ActionRequestImpl(null, invocation);
}
public ActionResponseImpl createActionResponse(ActionInvocation invocation,
ActionRequestImpl actionRequest)
@@ -54,7 +54,7 @@
public EventRequestImpl createEventRequest(EventInvocation invocation)
{
- return new EventRequestImpl(invocation);
+ return new EventRequestImpl(null, invocation);
}
public EventResponseImpl createEventResponse(EventInvocation invocation,
EventRequestImpl eventRequest)
@@ -64,7 +64,7 @@
public RenderRequestImpl createRenderRequest(RenderInvocation invocation)
{
- return new RenderRequestImpl(invocation);
+ return new RenderRequestImpl(null, invocation);
}
public RenderResponseImpl createRenderResponse(RenderInvocation invocation,
RenderRequestImpl renderRequest)
@@ -74,7 +74,7 @@
public ResourceRequestImpl createResourceRequest(ResourceInvocation invocation)
{
- return new ResourceRequestImpl(invocation);
+ return new ResourceRequestImpl(null, invocation);
}
public ResourceResponseImpl createResourceResponse(ResourceInvocation invocation,
ResourceRequestImpl renderRequest)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -463,28 +463,28 @@
FilterChainImpl<?> chain;
if (invocation instanceof ActionInvocation)
{
- req = new ActionRequestImpl((ActionInvocation)invocation);
+ req = new ActionRequestImpl(this, (ActionInvocation)invocation);
resp = new ActionResponseImpl((ActionInvocation)invocation, req);
phase = "ACTION_PHASE";
chain = new FilterChainImpl<ActionFilter>(actionFilterList,
ActionFilter.class);
}
else if (invocation instanceof RenderInvocation)
{
- req = new RenderRequestImpl((RenderInvocation)invocation);
+ req = new RenderRequestImpl(this, (RenderInvocation)invocation);
resp = new RenderResponseImpl((RenderInvocation)invocation, req);
phase = "RENDER_PHASE";
chain = new FilterChainImpl<RenderFilter>(renderFilterList,
RenderFilter.class);
}
else if (invocation instanceof EventInvocation)
{
- req = new EventRequestImpl((EventInvocation)invocation);
+ req = new EventRequestImpl(this, (EventInvocation)invocation);
resp = new EventResponseImpl((EventInvocation)invocation, req);
phase = "EVENT_PHASE";
chain = new FilterChainImpl<EventFilter>(eventFilterList,
EventFilter.class);
}
else if (invocation instanceof ResourceInvocation)
{
- req = new ResourceRequestImpl((ResourceInvocation)invocation);
+ req = new ResourceRequestImpl(this, (ResourceInvocation)invocation);
resp = new ResourceResponseImpl((ResourceInvocation)invocation, req);
phase = "RESOURCE_SERVING_PHASE";
chain = new FilterChainImpl<ResourceFilter>(resourceFilterList,
ResourceFilter.class);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
import javax.portlet.ActionRequest;
@@ -32,8 +33,8 @@
*/
public class ActionRequestImpl extends ClientDataRequestImpl implements ActionRequest
{
- public ActionRequestImpl(ActionInvocation invocation)
+ public ActionRequestImpl(PortletContainerImpl container, ActionInvocation invocation)
{
- super(invocation);
+ super(container, invocation);
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ClientDataRequestImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ClientDataRequestImpl.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ClientDataRequestImpl.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -25,6 +25,7 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
import javax.portlet.ClientDataRequest;
import java.io.InputStream;
@@ -42,17 +43,17 @@
/** . */
protected final RequestContext requestContext;
- public ClientDataRequestImpl(ActionInvocation invocation)
+ public ClientDataRequestImpl(PortletContainerImpl container, ActionInvocation
invocation)
{
- super(invocation);
+ super(container, invocation);
//
this.requestContext = invocation.getRequestContext();
}
- public ClientDataRequestImpl(ResourceInvocation invocation)
+ public ClientDataRequestImpl(PortletContainerImpl container, ResourceInvocation
invocation)
{
- super(invocation);
+ super(container, invocation);
//
this.requestContext = invocation.getRequestContext();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
import javax.portlet.EventRequest;
import javax.portlet.Event;
@@ -40,9 +41,9 @@
/** . */
private EventInvocation eventInvocation;
- public EventRequestImpl(EventInvocation invocation)
+ public EventRequestImpl(PortletContainerImpl container, EventInvocation invocation)
{
- super(invocation);
+ super(container, invocation);
//
this.eventInvocation = invocation;
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -138,9 +138,8 @@
/** . */
private final String contextPath;
- public PortletRequestImpl(PortletInvocation invocation)
+ public PortletRequestImpl(PortletContainerImpl container, PortletInvocation
invocation)
{
- PortletContainerImpl container =
(PortletContainerImpl)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
int mode = this instanceof RenderRequest ? PortletPreferencesImpl.RENDER :
PortletPreferencesImpl.ACTION;
PropertyContext prefs =
(PropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PropertyContext.PREFERENCES_ATTRIBUTE);
PreferencesValidator validator = container.getPreferencesValidator();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.util.MultiValuedPropertyMap;
@@ -39,9 +40,9 @@
/** . */
private final String validationToken;
- public RenderRequestImpl(RenderInvocation invocation)
+ public RenderRequestImpl(PortletContainerImpl container, RenderInvocation invocation)
{
- super(invocation);
+ super(container, invocation);
//
this.validationToken = invocation.getValidationToken();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceRequestImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceRequestImpl.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceRequestImpl.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -24,6 +24,7 @@
import org.jboss.portal.portlet.invocation.ResourceInvocation;
import org.jboss.portal.portlet.impl.jsr168.ResourceRequestParameterMap;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
import org.jboss.portal.common.util.MultiValuedPropertyMap;
import org.jboss.portal.common.util.ParameterMap;
@@ -41,9 +42,9 @@
/** . */
private final ResourceInvocation resourceInvocation;
- public ResourceRequestImpl(ResourceInvocation invocation)
+ public ResourceRequestImpl(PortletContainerImpl container, ResourceInvocation
invocation)
{
- super(invocation);
+ super(container, invocation);
//
this.resourceInvocation = invocation;
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -30,6 +30,9 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletURL;
import java.io.IOException;
import java.io.PrintWriter;
@@ -40,6 +43,58 @@
public class AdminPortlet extends GenericPortlet
{
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, IOException
+ {
+
+ String lifeCycle = req.getParameter("lifecycle");
+
+ //
+ String applicationId = req.getParameter("application");
+
+ //
+ if (applicationId != null)
+ {
+ // Use an alias
+ PortletApplicationRegistry registry =
(PortletApplicationRegistry)getPortletContext().getAttribute("PortletApplicationDeployer");
+
+ //
+ ManagedPortletApplication application =
registry.getManagedPortletApplication(applicationId);
+
+ //
+ String containerId = req.getParameter("container");
+
+ //
+ if (containerId != null)
+ {
+ final ManagedPortletContainer container =
application.getManagedPortletContainer(containerId);
+
+ //
+ if ("start".equals(lifeCycle))
+ {
+ try
+ {
+ container.managedStart();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else if ("stop".equals(lifeCycle))
+ {
+ // Async stop otherwise it is not possible to stop the admin portlet (self
deadlock)
+ new Thread()
+ {
+ public void run()
+ {
+ container.managedStop();
+ }
+ }.start();
+ }
+ }
+ }
+ }
+
protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
IOException
{
@@ -52,10 +107,26 @@
for (ManagedPortletApplication application :
registry.getManagedPortletApplications())
{
+ PortletURL url = resp.createActionURL();
+ url.setParameter("application", application.getId());
+
+ //
writer.print("<ul><li>Application " + application.getId()
+ " " + application.getStatus() + "</li><ul>");
+
+ //
for (ManagedPortletContainer container :
application.getManagedPortletContainers())
{
- writer.print("<li>Container " + container.getId() + "
" + container.getStatus() + "</li>");
+
+ url.setParameter("container", container.getId());
+
+ url.setParameter("lifecycle", "stop");
+ String stopURL = url.toString();
+
+ url.setParameter("lifecycle", "start");
+ String startURL = url.toString();
+
+ writer.print("<li>Container " + container.getId() + "
" + container.getStatus() + "<a href=\"" +
+ startURL + "\">Start</a> <a href=\"" +
stopURL + "\">Stop</a>" + "</li>");
}
writer.print("</ul></ul>");
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletApplication.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletApplication.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletApplication.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -24,8 +24,15 @@
import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.object.PortletApplicationObject;
import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
+import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.web.WebApp;
import javax.servlet.ServletContext;
@@ -37,32 +44,46 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class KernelPortletApplication extends KernelObject implements
PortletApplicationContext, ManagedPortletApplication
+public class KernelPortletApplication extends KernelObject implements
PortletApplicationContext, ManagedPortletApplication, PortletApplication
{
/** . */
private final WebApp webApp;
/** . */
- private PortletApplication portletApplication;
+ final PortletApplicationObject portletApplication;
/** . */
private final Map<String, KernelPortletContainer> kernelPortletContainers;
- public KernelPortletApplication(WebApp webApp)
+ public KernelPortletApplication(
+ ContainerPortletApplicationInfo info,
+ PortletApplication10MetaData metaData,
+ JBossApplicationMetaData jbossMetaData,
+ PortletAPIFactory portletAPIFactory,
+ WebApp webApp)
{
this.webApp = webApp;
- this.portletApplication = null;
+ this.portletApplication = new PortletApplicationImpl(info, metaData, jbossMetaData,
portletAPIFactory);
this.kernelPortletContainers = new HashMap<String,
KernelPortletContainer>();
+
+ //
+ portletApplication.setContext(this);
}
public void addKernelPortletContainer(KernelPortletContainer kernelPortletContainer)
{
kernelPortletContainers.put(kernelPortletContainer.getPortletContainer().getId(),
kernelPortletContainer);
+
+ //
+ portletApplication.addContainer(kernelPortletContainer.portletContainer);
}
public void removeKernelPortletContainer(KernelPortletContainer
kernelPortletContainer)
{
+ portletApplication.removeContainer(kernelPortletContainer.portletContainer);
+
+ //
kernelPortletContainers.remove(kernelPortletContainer.getPortletContainer().getId());
}
@@ -71,17 +92,14 @@
return portletApplication;
}
- public void setPortletApplication(PortletApplication portletApplication)
- {
- this.portletApplication = portletApplication;
- }
-
public void start() throws Exception
{
+ portletApplication.start();
}
public void stop()
{
+ portletApplication.stop();
}
// PortletApplicationContext
****************************************************************************************
@@ -127,4 +145,21 @@
{
return kernelPortletContainers.get(portletContainerId);
}
+
+ // PortletApplication
***********************************************************************************************
+
+ public Collection<? extends PortletContainer> getPortletContainers()
+ {
+ return kernelPortletContainers.values();
+ }
+
+ public PortletContainer getPortletContainer(String containerId)
+ {
+ return kernelPortletContainers.get(containerId);
+ }
+
+ public PortletApplicationContext getContext()
+ {
+ return this;
+ }
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletContainer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletContainer.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletContainer.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -24,23 +24,39 @@
import org.jboss.portal.portlet.container.PortletContainerContext;
import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.object.PortletContainerObject;
import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.common.invocation.InvocationException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class KernelPortletContainer extends KernelObject implements
PortletContainerContext, ManagedPortletContainer
+public class KernelPortletContainer extends KernelObject implements
PortletContainerContext, ManagedPortletContainer, PortletContainer
{
/** . */
- private PortletContainer portletContainer;
+ final PortletContainerObject portletContainer;
/** . */
private KernelPortletApplication kernelPortletApplication;
+ public KernelPortletContainer(ContainerPortletInfo info)
+ {
+ portletContainer = new PortletContainerImpl(info);
+
+ //
+ portletContainer.setContext(this);
+ }
+
public KernelPortletApplication getKernelPortletApplication()
{
return kernelPortletApplication;
@@ -49,6 +65,16 @@
public void setKernelPortletApplication(KernelPortletApplication
kernelPortletApplication)
{
this.kernelPortletApplication = kernelPortletApplication;
+
+ //
+ if (kernelPortletApplication != null)
+ {
+ portletContainer.setApplication(kernelPortletApplication.portletApplication);
+ }
+ else
+ {
+ portletContainer.setApplication(null);
+ }
}
public PortletContainer getPortletContainer()
@@ -56,17 +82,14 @@
return portletContainer;
}
- public void setPortletContainer(PortletContainer portletContainer)
- {
- this.portletContainer = portletContainer;
- }
-
public void start() throws Exception
{
+ portletContainer.start();
}
public void stop()
{
+ portletContainer.stop();
}
//
@@ -88,6 +111,8 @@
return portletContainer.getId();
}
+ //
+
public ManagedPortletApplication getManagedPortletApplication()
{
return kernelPortletApplication;
@@ -97,4 +122,21 @@
{
return portletContainer.getInfo();
}
+
+ // PortletContainer implementation
**********************************************************************************
+
+ public PortletInvocationResponse dispatch(PortletInvocation invocation) throws
PortletInvokerException, InvocationException
+ {
+ return portletContainer.dispatch(invocation);
+ }
+
+ public PortletApplication getApplication()
+ {
+ return kernelPortletApplication;
+ }
+
+ public PortletContainerContext getContext()
+ {
+ return this;
+ }
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2008-02-19
21:16:51 UTC (rev 10034)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2008-02-19
22:17:41 UTC (rev 10035)
@@ -44,8 +44,6 @@
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.jsr168.ContainerInfoBuilderContextImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
@@ -88,13 +86,13 @@
this.installed = new LinkedHashMap<String, KernelControllerContext>();
}
- public AbstractBeanMetaData createKernelPortletContainerMetaData(String
kernelPortletContainerId)
+ public AbstractBeanMetaData createKernelPortletContainerMetaData(String
kernelPortletContainerId, ContainerPortletInfo portletInfo)
{
AbstractBeanMetaData beanMD = new AbstractBeanMetaData(kernelPortletContainerId,
KernelPortletContainer.class.getName());
//
AbstractConstructorMetaData ctorMD = new AbstractConstructorMetaData();
- ctorMD.setParameters(new ArrayList<ParameterMetaData>());
+ ctorMD.setParameters(Tools.toList((ParameterMetaData)new
AbstractParameterMetaData(ContainerPortletInfo.class.getName(), portletInfo)));
beanMD.setConstructor(ctorMD);
//
@@ -110,61 +108,18 @@
return beanMD;
}
- public AbstractBeanMetaData createKernelPortletApplicationMetaData(String
kernelPortletApplicationId)
+ public AbstractBeanMetaData
createKernelPortletApplicationMetaData(ContainerPortletApplicationInfo
portletApplicationInfo, String kernelPortletApplicationId)
{
AbstractBeanMetaData beanMD = new AbstractBeanMetaData(kernelPortletApplicationId,
KernelPortletApplication.class.getName());
//
AbstractConstructorMetaData ctorMD = new AbstractConstructorMetaData();
- ctorMD.setParameters(Tools.toList((ParameterMetaData)new
AbstractParameterMetaData(WebApp.class.getName(), webApp)));
- beanMD.setConstructor(ctorMD);
-
- //
- beanMD.setProperties(new HashSet<PropertyMetaData>());
- beanMD.setInstalls(new ArrayList<InstallMetaData>());
- beanMD.setUninstalls(new ArrayList<InstallMetaData>());
-
- //
- beanMD.setStart(new AbstractLifecycleMetaData("start"));
- beanMD.setStop(new AbstractLifecycleMetaData("stop"));
-
- //
- return beanMD;
- }
-
- public AbstractBeanMetaData createPortletContainerMetaData(String portletContainerId,
ContainerPortletInfo portletInfo)
- {
- AbstractBeanMetaData beanMD = new AbstractBeanMetaData(portletContainerId,
PortletContainerImpl.class.getName());
-
- //
- AbstractConstructorMetaData ctorMD = new AbstractConstructorMetaData();
- ctorMD.setParameters(Tools.toList((ParameterMetaData)new
AbstractParameterMetaData(ContainerPortletInfo.class.getName(), portletInfo)));
- beanMD.setConstructor(ctorMD);
-
- //
- beanMD.setProperties(new HashSet<PropertyMetaData>());
- beanMD.setInstalls(new ArrayList<InstallMetaData>());
- beanMD.setUninstalls(new ArrayList<InstallMetaData>());
-
- //
- beanMD.setStart(new AbstractLifecycleMetaData("start"));
- beanMD.setStop(new AbstractLifecycleMetaData("stop"));
-
- //
- return beanMD;
- }
-
- public AbstractBeanMetaData
createPortletApplicationMetaData(ContainerPortletApplicationInfo portletApplicationInfo,
String portletApplicationId)
- {
- AbstractBeanMetaData beanMD = new AbstractBeanMetaData(portletApplicationId,
PortletApplicationImpl.class.getName());
-
- //
- AbstractConstructorMetaData ctorMD = new AbstractConstructorMetaData();
ctorMD.setParameters(Tools.toList(
(ParameterMetaData)new
AbstractParameterMetaData(ContainerPortletApplicationInfo.class.getName(),
portletApplicationInfo),
new AbstractParameterMetaData(PortletApplication10MetaData.class.getName(),
metaData),
new AbstractParameterMetaData(JBossApplicationMetaData.class.getName(),
(Object)null),
- new AbstractParameterMetaData(PortletAPIFactory.class.getName(), new
AbstractDependencyValueMetaData("PortletAPIFactory"))));
+ new AbstractParameterMetaData(PortletAPIFactory.class.getName(), new
AbstractDependencyValueMetaData("PortletAPIFactory")),
+ new AbstractParameterMetaData(WebApp.class.getName(), webApp)));
beanMD.setConstructor(ctorMD);
//
@@ -189,12 +144,9 @@
KernelController controller = kernel.getController();
//
- String portletApplicationId = "PortletApplication[" +
webApp.getContextPath() + "]";
+ String kernelPortletApplicationId = "PortletApplication[" +
webApp.getContextPath() + "]";
//
- String kernelPortletApplicationId = "KernelPortletApplication[" +
webApp.getContextPath() + "]";
-
- //
ContainerInfoBuilderContext builderContext = new
ContainerInfoBuilderContextImpl(metaData, webApp);
ContainerInfoBuilder builder = new ContainerInfoBuilder(metaData, builderContext);
builder.build();
@@ -206,44 +158,11 @@
for (ContainerPortletInfo containerInfo : builder.getPortlets())
{
//
- String portletContainerId = "PortletContainer[" +
webApp.getContextPath() + "," + containerInfo.getName() + "]";
- String kernelPortletContainerId = "KernelPortletContainer[" +
webApp.getContextPath() + "," + containerInfo.getName() + "]";
+ String kernelPortletContainerId = "PortletContainer[" +
webApp.getContextPath() + "," + containerInfo.getName() + "]";
//
- AbstractBeanMetaData portletContainerMD =
createPortletContainerMetaData(portletContainerId, containerInfo);
- AbstractBeanMetaData kernelPortletContainerMD =
createKernelPortletContainerMetaData(kernelPortletContainerId);
+ AbstractBeanMetaData kernelPortletContainerMD =
createKernelPortletContainerMetaData(kernelPortletContainerId, containerInfo);
- //
- AbstractDependencyValueMetaData portletContainerContextDependencyMD = new
AbstractDependencyValueMetaData(kernelPortletContainerId);
-
portletContainerContextDependencyMD.setDependentState(ControllerState.INSTANTIATED);
- portletContainerMD.getProperties().add(new
AbstractPropertyMetaData("context", portletContainerContextDependencyMD));
-
- //
- AbstractDependencyValueMetaData portletContainerDependencyMD = new
AbstractDependencyValueMetaData(portletContainerId);
- portletContainerDependencyMD.setDependentState(ControllerState.START);
- kernelPortletContainerMD.getProperties().add(new
AbstractPropertyMetaData("portletContainer", portletContainerDependencyMD));
-
- //
- AbstractDependencyValueMetaData portletApplicationDependencyMD = new
AbstractDependencyValueMetaData(portletApplicationId);
- portletApplicationDependencyMD.setDependentState(ControllerState.START);
- portletContainerMD.getProperties().add(new
AbstractPropertyMetaData("application", portletApplicationDependencyMD));
-
- // Install the portlet container on the portlet application
- AbstractInstallMetaData installPortletContainerMD = new
AbstractInstallMetaData();
- installPortletContainerMD.setBean(portletApplicationId);
-
installPortletContainerMD.setParameters(Collections.singletonList((ParameterMetaData)new
AbstractParameterMetaData(new ThisValueMetaData())));
- installPortletContainerMD.setMethodName("addContainer");
- installPortletContainerMD.setDependentState(ControllerState.START);
- portletContainerMD.getInstalls().add(installPortletContainerMD);
-
- // Uninstall the portlet container from the portlet application
- AbstractInstallMetaData uninstallPortletContainerMD = new
AbstractInstallMetaData();
- uninstallPortletContainerMD.setBean(portletApplicationId);
-
uninstallPortletContainerMD.setParameters(Collections.singletonList((ParameterMetaData)new
AbstractParameterMetaData(new ThisValueMetaData())));
- uninstallPortletContainerMD.setMethodName("removeContainer");
- uninstallPortletContainerMD.setDependentState(ControllerState.START);
- kernelPortletContainerMD.getUninstalls().add(uninstallPortletContainerMD);
-
// Inject the kernel portlet application in the kernel portlet container
AbstractDependencyValueMetaData kernelPortletApplicationDependencyMD = new
AbstractDependencyValueMetaData(kernelPortletApplicationId);
kernelPortletApplicationDependencyMD.setDependentState(ControllerState.START);
@@ -266,26 +185,13 @@
kernelPortletContainerMD.getUninstalls().add(uninstallKernelPortletContainerMD);
//
- toInstall.add(portletContainerMD);
toInstall.add(kernelPortletContainerMD);
}
//
- AbstractBeanMetaData portletApplicationMD =
createPortletApplicationMetaData(builder.getApplication(), portletApplicationId);
- AbstractBeanMetaData kernelPortletApplicationMD =
createKernelPortletApplicationMetaData(kernelPortletApplicationId);
+ AbstractBeanMetaData kernelPortletApplicationMD =
createKernelPortletApplicationMetaData(builder.getApplication(),
kernelPortletApplicationId);
//
- AbstractDependencyValueMetaData portletApplicationContextDependencyMD = new
AbstractDependencyValueMetaData(kernelPortletApplicationId);
-
portletApplicationContextDependencyMD.setDependentState(ControllerState.INSTANTIATED);
- portletApplicationMD.getProperties().add(new
AbstractPropertyMetaData("context", portletApplicationContextDependencyMD));
-
- //
- AbstractDependencyValueMetaData portletApplicationDependencyMD = new
AbstractDependencyValueMetaData(portletApplicationId);
- portletApplicationDependencyMD.setDependentState(ControllerState.START);
- kernelPortletApplicationMD.getProperties().add(new
AbstractPropertyMetaData("portletApplication",
portletApplicationDependencyMD));
-
- //
- toInstall.add(portletApplicationMD);
toInstall.add(kernelPortletApplicationMD);
// Install beans
@@ -356,10 +262,6 @@
//
log.debug("Uninstalled");
-
- //
-// portletApplicationControllerContext = null;
-// portletContainerControllerContexts = null;
}
private void logBeanFailure(KernelControllerContext context)