Author: julien(a)jboss.com
Date: 2007-03-18 20:38:40 -0400 (Sun, 18 Mar 2007)
New Revision: 6733
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
Removed:
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
Modified:
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/portlet-server/build.xml
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
trunk/portlet-server/src/resources/tck-sar/META-INF/jboss-service.xml
trunk/portlet-server/src/resources/test-sar/META-INF/jboss-service.xml
trunk/portlet-server/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml
trunk/portlet/build.xml
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
Log:
portlet app / container lifecycle cleanup and simplifications
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-18
23:25:36 UTC (rev 6732)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-19
00:38:40 UTC (rev 6733)
@@ -505,7 +505,7 @@
<!-- Registries -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+
code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/portlet/build.xml
===================================================================
--- trunk/portlet/build.xml 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet/build.xml 2007-03-19 00:38:40 UTC (rev 6733)
@@ -90,7 +90,6 @@
<path id="library.classpath">
<path refid="dom4j.dom4j.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
- <path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.serialization.classpath"/>
<path refid="oswego.concurrent.classpath"/>
<path refid="apache.httpclient.classpath"/>
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -26,6 +26,8 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -70,8 +72,9 @@
// This call will wait until all the current threads have exited the
component valve.
// Perhaps this should be done asynchronously as it may lead to a long delay
?
// It could be made parametrizable too, so the deployer can choose what mode
is preferable
- PortletApplicationImpl pwa =
(PortletApplicationImpl)container.getApplication();
- pwa.stop(container.getId());
+ PortletApplication application = container.getApplication();
+ PortletApplicationContext applicationContext = application.getContext();
+ applicationContext.stopPortletContainer(container.getId());
}
//
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplication.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -43,4 +43,16 @@
/** Return the porlet application context. */
PortletApplicationContext getContext();
+
+ /**
+ * Starts the application only. It does not take care of starting its components.
+ *
+ * @throws Exception any exception preventing the start
+ */
+ void start() throws Exception;
+
+ /**
+ * Stops the application only. It does not take care of stopping its components.
+ */
+ void stop();
}
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContext.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContext.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContext.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -25,7 +25,9 @@
import javax.servlet.ServletContext;
/**
- * The context for a portlet application.
+ * The context provided to a portlet application. For now it manages the application
external resources
+ * such as the servlet context and the application classloader. It manages also the life
cycle of the
+ * application and its components.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -47,18 +49,26 @@
ClassLoader getClassLoader();
/**
- * Attempt to start a portlet.
+ * Start the portlet application and its components.
+ */
+ void startPortletApplication() throws Exception;
+
+ /**
+ * Stop the portlet application and its components.
+ */
+ void stopPortletApplication();
+
+ /**
+ * Start a portlet container.
*
- * @param portletName the portlet name
- * @throws Exception any exception that prevents the portlet to start
+ * @param portletName the container name
*/
- void startPortlet(String portletName) throws Exception;
+ void startPortletContainer(String portletName) throws Exception;
/**
- * Stop the portlet.
+ * Stop a portlet container.
*
- * @param portletName the portlet name
- * @throws Exception any exception that may occur during the portlet stop
+ * @param portletName the container name
*/
- public void stopPortlet(String portletName) throws Exception;
+ void stopPortletContainer(String portletName);
}
Deleted:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -1,185 +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.portlet.container;
-
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
-import org.jboss.portal.portlet.impl.jsr168.APIFactory;
-import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
-import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
-
-import javax.servlet.ServletContext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletApplicationContextImpl implements PortletApplicationContext,
KernelControllerContextAware
-{
-
- /** . */
- private PortletApplicationRegistry registry;
-
- /** . */
- private APIFactory apiFactory;
-
- /** . */
- private PortletApplicationMetaData portletAppMD;
-
- /** . */
- private JBossApplicationMetaData jbossAppMD;
-
- /** . */
- private PortletApplicationImpl portletApp;
-
- /** . */
- private KernelControllerContext kernelControllerContext;
-
- /** . */
- private ServletContext servletContext;
-
- /** . */
- private ClassLoader classLoader;
-
- public PortletApplicationContextImpl(
- PortletApplicationRegistry registry,
- APIFactory apiFactory,
- PortletApplicationMetaData portletAppMD,
- JBossApplicationMetaData jbossAppMD,
- ServletContext servletContext,
- ClassLoader classLoader)
- {
- this.registry = registry;
- this.apiFactory = apiFactory;
- this.portletAppMD = portletAppMD;
- this.jbossAppMD = jbossAppMD;
- this.servletContext = servletContext;
- this.classLoader = classLoader;
- }
-
- public void start() throws Exception
- {
- portletApp = new PortletApplicationImpl(portletAppMD, jbossAppMD, this);
- PortletApplicationRegistrationContext registrationContext =
registry.registerPortletApplication(portletApp);
-
- //
- portletApp.setRegistrationContext(registrationContext);
- portletApp.setAPIFactory(apiFactory);
- portletApp.create();
- portletApp.start();
- }
-
- public void stop()
- {
- registry.unregisterPortletApplication(portletApp);
- portletApp.stop();
- portletApp.destroy();
-
- //
- portletApp.setRegistrationContext(null);
- portletApp = null;
- }
-
- public PortletApplicationImpl getPortletApplication()
- {
- return portletApp;
- }
-
- // PortletApplicationContext implementation
*************************************************************************
-
- public ServletContext getServletContext()
- {
- return servletContext;
- }
-
- public ClassLoader getClassLoader()
- {
- return classLoader;
- }
-
- public void startPortlet(String portletName) throws Exception
- {
- Kernel kernel = kernelControllerContext.getKernel();
- KernelController controller = kernel.getController();
- ControllerContext context =
controller.getInstalledContext("portal:container=Portlet,id=" +
portletAppMD.getId() + "." + portletName);
- if (context == null)
- {
- throw new IllegalArgumentException("Portlet container " + portletName
+ " does not exist");
- }
- try
- {
- controller.change(context, ControllerState.INSTALLED);
- }
- catch (Throwable throwable)
- {
- if (throwable instanceof Exception)
- {
- throw(Exception)throwable;
- }
- else if (throwable instanceof Error)
- {
- throw(Error)throwable;
- }
- else
- {
- throw new Error("Unexpected throwable", throwable);
- }
- }
- }
-
- public void stopPortlet(String portletName) throws Exception
- {
- Kernel kernel = kernelControllerContext.getKernel();
- KernelController controller = kernel.getController();
- ControllerContext context =
controller.getInstalledContext("portal:container=Portlet,id=" +
portletAppMD.getId() + "." + portletName);
- if (context == null)
- {
- throw new IllegalArgumentException("Portlet container " + portletName
+ " does not exist");
- }
- try
- {
- controller.change(context, ControllerState.CONFIGURED);
- }
- catch (Throwable throwable)
- {
- throwable.printStackTrace();
- }
- }
-
- // Kernel object implementation
*************************************************************************************
-
- public void setKernelControllerContext(KernelControllerContext context) throws
Exception
- {
- this.kernelControllerContext = context;
- }
-
- public void unsetKernelControllerContext(KernelControllerContext context) throws
Exception
- {
- this.kernelControllerContext = null;
- }
-}
Deleted:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -1,247 +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.portlet.container;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class PortletApplicationRegistryImpl implements PortletApplicationRegistry
-{
-
- /** . */
- private Map portletApplications = new HashMap();
-
- /** . */
- private Map portletContainers = new HashMap();
-
- /** . */
- private List listeners = new ArrayList();
-
- public PortletApplicationRegistrationContext
registerPortletApplication(PortletApplication portletApplication)
- {
- if (portletApplication == null)
- {
- throw new IllegalArgumentException("No null portlet app accepted");
- }
- synchronized (this)
- {
- if (portletApplications.containsKey(portletApplication.getId()))
- {
- throw new IllegalArgumentException("This portlet app is already
registered");
- }
- PortletApplicationRegistrationContext ctx = new
PortletApplicationRegistrationContextImpl(portletApplication);
- Map webAppsCopy = new HashMap(portletApplications);
- webAppsCopy.put(portletApplication.getId(), portletApplication);
- portletApplications = webAppsCopy;
- return ctx;
- }
- }
-
- public void unregisterPortletApplication(PortletApplication portletApplication)
- {
- if (portletApplication == null)
- {
- throw new IllegalArgumentException("No null portlet app accepted");
- }
- synchronized (this)
- {
- if (!portletApplications.containsKey(portletApplication.getId()))
- {
- throw new IllegalArgumentException("This portlet app does not exist
here");
- }
- Map webAppsCopy = new HashMap(portletApplications);
- webAppsCopy.remove(portletApplication.getId());
- portletApplications = webAppsCopy;
- }
- }
-
- public Collection getPortletApplications()
- {
- return Collections.unmodifiableCollection(portletApplications.values());
- }
-
- public PortletApplication getPortletApplication(String id)
- {
- return (PortletApplication)portletApplications.get(id);
- }
-
- public void addListener(PortletApplicationRegistryListener listener)
- {
- if (listener == null)
- {
- throw new IllegalArgumentException("No null listener accepted");
- }
- else
- {
- synchronized (this)
- {
- listeners.add(listener);
- }
- }
- }
-
- public void removeListener(PortletApplicationRegistryListener listener)
- {
- if (listener == null)
- {
- throw new IllegalArgumentException("No null listener accepted");
- }
- else
- {
- synchronized (this)
- {
- listeners.remove(listener);
- }
- }
- }
-
- private void raiseRegisterPortletContainerEvent(PortletContainer portlet)
- {
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- PortletApplicationRegistryListener listener =
(PortletApplicationRegistryListener)it.next();
- listener.portletContainerRegistered(portlet);
- }
- }
-
- private void raiseUnregisterPortletContainerEvent(PortletContainer portlet)
- {
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- PortletApplicationRegistryListener listener =
(PortletApplicationRegistryListener)it.next();
- listener.portletContainerUnregistered(portlet);
- }
- }
-
- private static class ContainerKey
- {
- /** . */
- private final String applicationId;
-
- /** . */
- private final String containerId;
-
- public ContainerKey(PortletContainer container)
- {
- this.applicationId = container.getApplication().getId();
- this.containerId = container.getId();
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof ContainerKey)
- {
- ContainerKey that = (ContainerKey)obj;
- return applicationId.equals(that.applicationId) &&
containerId.equals(containerId);
- }
- return false;
- }
-
- public int hashCode()
- {
- return applicationId.hashCode() & containerId.hashCode();
- }
- }
-
- private class PortletApplicationRegistrationContextImpl implements
PortletApplicationRegistrationContext
- {
-
- /** . */
- private PortletApplication portletApplication;
-
- /** . */
- private boolean active;
-
- public PortletApplicationRegistrationContextImpl(PortletApplication
portletApplication)
- {
- this.portletApplication = portletApplication;
- this.active = true;
- }
-
- public void registerPortlet(PortletContainer portletContainer)
- {
- if (portletContainer == null)
- {
- throw new IllegalArgumentException("No null portlet accepted");
- }
- if (portletContainer.getApplication() != portletApplication)
- {
- throw new IllegalArgumentException("The container does not belong to the
application owning the registration");
- }
- if (!active)
- {
- throw new IllegalStateException("Not anymore active");
- }
- synchronized (this)
- {
- Map componentsCopy = new HashMap(portletContainers);
- componentsCopy.put(new ContainerKey(portletContainer), portletContainer);
- portletContainers = componentsCopy;
-
- //
- raiseRegisterPortletContainerEvent(portletContainer);
- }
- }
-
- public void unregisterPortlet(PortletContainer portletContainer)
- {
- if (portletContainer == null)
- {
- throw new IllegalArgumentException("No null portlet accepted");
- }
- if (portletContainer.getApplication() != portletApplication)
- {
- throw new IllegalArgumentException("The container does not belong to the
application owning the registration");
- }
- if (!active)
- {
- throw new IllegalStateException("Not anymore active");
- }
- synchronized (this)
- {
- Map componentsCopy = new HashMap(portletContainers);
- componentsCopy.remove(portletContainer);
- portletContainers = componentsCopy;
- raiseUnregisterPortletContainerEvent(portletContainer);
- }
- }
-
- }
-
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -38,19 +38,50 @@
public interface PortletContainer
{
+ /**
+ * Return the portlet container id, unique within the context of the parent
application.
+ *
+ * @return the id
+ */
+ String getId();
+
+ /**
+ * Returns the runtime meta data of the container.
+ *
+ * @return the info
+ */
PortletInfo getInfo();
- String getId();
-
JBossPortletMetaData getJBossMetaData();
- boolean isStarted();
-
ContentTypes getContentTypes();
+ /**
+ * Return the portlet application of this container.
+ *
+ * @return the application
+ */
PortletApplication getApplication();
+ /**
+ *
+ */
Valve getValve();
+ /**
+ *
+ */
PortletInvocationResponse dispatch(PortletInvocation invocation) throws
PortletInvokerException, InvocationException;
+
+ /**
+ * Starts the portlet container.
+ *
+ * @throws Exception any exception preventing the start
+ */
+ void start() throws Exception;
+
+ /**
+ * Stops the portlet container.
+ */
+ void stop();
}
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
(rev 0)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -0,0 +1,177 @@
+/******************************************************************************
+ * 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.impl.container;
+
+import org.jboss.portal.portlet.impl.jsr168.APIFactory;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.portlet.container.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.PortletApplicationRegistrationContext;
+import org.jboss.portal.portlet.container.PortletContainer;
+
+import javax.servlet.ServletContext;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6697 $
+ */
+public class PortletApplicationContextImpl implements PortletApplicationContext
+{
+
+ /** . */
+ private PortletApplicationRegistry registry;
+
+ /** . */
+ private APIFactory apiFactory;
+
+ /** . */
+ private PortletApplicationMetaData portletAppMD;
+
+ /** . */
+ private JBossApplicationMetaData jbossAppMD;
+
+ /** . */
+ private PortletApplicationImpl portletApp;
+
+ /** . */
+ private ServletContext servletContext;
+
+ /** . */
+ private ClassLoader classLoader;
+
+ /** . */
+ private PortletApplicationRegistrationContext registrationContext;
+
+ public PortletApplicationContextImpl(
+ PortletApplicationRegistry registry,
+ APIFactory apiFactory,
+ PortletApplicationMetaData portletAppMD,
+ JBossApplicationMetaData jbossAppMD,
+ ServletContext servletContext,
+ ClassLoader classLoader)
+ {
+ this.registry = registry;
+ this.apiFactory = apiFactory;
+ this.portletAppMD = portletAppMD;
+ this.jbossAppMD = jbossAppMD;
+ this.servletContext = servletContext;
+ this.classLoader = classLoader;
+ }
+
+ public PortletApplicationImpl getPortletApplication()
+ {
+ return portletApp;
+ }
+
+ // PortletApplicationContext implementation
*************************************************************************
+
+ public void startPortletApplication() throws Exception
+ {
+ portletApp = new PortletApplicationImpl(portletAppMD, jbossAppMD, this,
apiFactory);
+ portletApp.start();
+
+ //
+ registrationContext = registry.registerPortletApplication(portletApp);
+
+ //
+ for (Iterator i = portletAppMD.getPortlets().iterator();i.hasNext();)
+ {
+ PortletMetaData portletMD = (PortletMetaData)i.next();
+ PortletContainerImpl container = new PortletContainerImpl(portletMD,
(JBossPortletMetaData)jbossAppMD.getPortlets().get(portletMD.getName()));
+
+ //
+ container.setApplication(portletApp);
+ portletApp.addContainer(container);
+
+ //
+ try
+ {
+ container.start();
+ registrationContext.registerPortlet(container);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void stopPortletApplication()
+ {
+ for (Iterator i = portletApp.getPortletContainers().iterator();i.hasNext();)
+ {
+ PortletContainerImpl container = (PortletContainerImpl)i.next();
+ try
+ {
+ registrationContext.unregisterPortlet(container);
+ container.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ portletApp.removeContainer(container);
+ container.setApplication(null);
+ }
+
+ //
+ registry.unregisterPortletApplication(portletApp);
+ portletApp.stop();
+
+ //
+ portletApp = null;
+ registrationContext = null;
+ }
+
+ public void startPortletContainer(String portletName) throws Exception
+ {
+ PortletContainer container = portletApp.getPortletContainer(portletName);
+ container.start();
+ registrationContext.registerPortlet(container);
+ }
+
+ public void stopPortletContainer(String portletName)
+ {
+ PortletContainer container = portletApp.getPortletContainer(portletName);
+ registrationContext.unregisterPortlet(container);
+ container.stop();
+ }
+
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return classLoader;
+ }
+}
Property changes on:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
(rev 0)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -0,0 +1,253 @@
+/******************************************************************************
+ * 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.impl.container;
+
+import org.jboss.portal.portlet.container.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.PortletApplicationRegistrationContext;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletApplicationRegistryListener;
+import org.jboss.portal.portlet.container.PortletContainer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 6720 $
+ */
+public class PortletApplicationRegistryImpl implements PortletApplicationRegistry
+{
+
+ /** . */
+ private Map portletApplications = new HashMap();
+
+ /** . */
+ private Map portletContainers = new HashMap();
+
+ /** . */
+ private List listeners = new ArrayList();
+
+ public PortletApplicationRegistrationContext
registerPortletApplication(PortletApplication portletApplication)
+ {
+ if (portletApplication == null)
+ {
+ throw new IllegalArgumentException("No null portlet app accepted");
+ }
+ synchronized (this)
+ {
+ if (portletApplications.containsKey(portletApplication.getId()))
+ {
+ throw new IllegalArgumentException("This portlet app is already
registered");
+ }
+ PortletApplicationRegistrationContext ctx = new
PortletApplicationRegistrationContextImpl(portletApplication);
+ Map webAppsCopy = new HashMap(portletApplications);
+ webAppsCopy.put(portletApplication.getId(), portletApplication);
+ portletApplications = webAppsCopy;
+ return ctx;
+ }
+ }
+
+ public void unregisterPortletApplication(PortletApplication portletApplication)
+ {
+ if (portletApplication == null)
+ {
+ throw new IllegalArgumentException("No null portlet app accepted");
+ }
+ synchronized (this)
+ {
+ if (!portletApplications.containsKey(portletApplication.getId()))
+ {
+ throw new IllegalArgumentException("This portlet app does not exist
here");
+ }
+ Map webAppsCopy = new HashMap(portletApplications);
+ webAppsCopy.remove(portletApplication.getId());
+ portletApplications = webAppsCopy;
+ }
+ }
+
+ public Collection getPortletApplications()
+ {
+ return Collections.unmodifiableCollection(portletApplications.values());
+ }
+
+ public PortletApplication getPortletApplication(String id)
+ {
+ return (PortletApplication)portletApplications.get(id);
+ }
+
+ public void addListener(PortletApplicationRegistryListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("No null listener accepted");
+ }
+ else
+ {
+ synchronized (this)
+ {
+ listeners.add(listener);
+ }
+ }
+ }
+
+ public void removeListener(PortletApplicationRegistryListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("No null listener accepted");
+ }
+ else
+ {
+ synchronized (this)
+ {
+ listeners.remove(listener);
+ }
+ }
+ }
+
+ private void raiseRegisterPortletContainerEvent(PortletContainer portlet)
+ {
+ Iterator it = listeners.iterator();
+ while (it.hasNext())
+ {
+ PortletApplicationRegistryListener listener =
(PortletApplicationRegistryListener)it.next();
+ listener.portletContainerRegistered(portlet);
+ }
+ }
+
+ private void raiseUnregisterPortletContainerEvent(PortletContainer portlet)
+ {
+ Iterator it = listeners.iterator();
+ while (it.hasNext())
+ {
+ PortletApplicationRegistryListener listener =
(PortletApplicationRegistryListener)it.next();
+ listener.portletContainerUnregistered(portlet);
+ }
+ }
+
+ private static class ContainerKey
+ {
+ /** . */
+ private final String applicationId;
+
+ /** . */
+ private final String containerId;
+
+ public ContainerKey(PortletContainer container)
+ {
+ this.applicationId = container.getApplication().getId();
+ this.containerId = container.getId();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof ContainerKey)
+ {
+ ContainerKey that = (ContainerKey)obj;
+ return applicationId.equals(that.applicationId) &&
containerId.equals(containerId);
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return applicationId.hashCode() & containerId.hashCode();
+ }
+ }
+
+ private class PortletApplicationRegistrationContextImpl implements
PortletApplicationRegistrationContext
+ {
+
+ /** . */
+ private PortletApplication portletApplication;
+
+ /** . */
+ private boolean active;
+
+ public PortletApplicationRegistrationContextImpl(PortletApplication
portletApplication)
+ {
+ this.portletApplication = portletApplication;
+ this.active = true;
+ }
+
+ public void registerPortlet(PortletContainer portletContainer)
+ {
+ if (portletContainer == null)
+ {
+ throw new IllegalArgumentException("No null portlet accepted");
+ }
+ if (portletContainer.getApplication() != portletApplication)
+ {
+ throw new IllegalArgumentException("The container does not belong to the
application owning the registration");
+ }
+ if (!active)
+ {
+ throw new IllegalStateException("Not anymore active");
+ }
+ synchronized (this)
+ {
+ Map componentsCopy = new HashMap(portletContainers);
+ componentsCopy.put(new ContainerKey(portletContainer), portletContainer);
+ portletContainers = componentsCopy;
+
+ //
+ raiseRegisterPortletContainerEvent(portletContainer);
+ }
+ }
+
+ public void unregisterPortlet(PortletContainer portletContainer)
+ {
+ if (portletContainer == null)
+ {
+ throw new IllegalArgumentException("No null portlet accepted");
+ }
+ if (portletContainer.getApplication() != portletApplication)
+ {
+ throw new IllegalArgumentException("The container does not belong to the
application owning the registration");
+ }
+ if (!active)
+ {
+ throw new IllegalStateException("Not anymore active");
+ }
+ synchronized (this)
+ {
+ Map componentsCopy = new HashMap(portletContainers);
+ componentsCopy.remove(portletContainer);
+ portletContainers = componentsCopy;
+ raiseUnregisterPortletContainerEvent(portletContainer);
+ }
+ }
+
+ }
+
+}
Property changes on:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -27,7 +27,6 @@
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletApplicationContext;
-import org.jboss.portal.portlet.container.PortletApplicationRegistrationContext;
import org.jboss.portal.portlet.container.PortletContainer;
import javax.portlet.PortletContext;
@@ -70,16 +69,15 @@
/** . */
protected APIFactory apiFactory;
- /** . */
- protected PortletApplicationRegistrationContext registrationContext;
-
public PortletApplicationImpl(
PortletApplicationMetaData metaData,
JBossApplicationMetaData jbossMetaData,
- PortletApplicationContext context)
+ PortletApplicationContext context,
+ APIFactory apiFactory)
{
this.metaData = metaData;
this.jbossMetaData = jbossMetaData;
+ this.apiFactory = apiFactory;
this.portlets = new LinkedHashMap();
this.context = context;
}
@@ -89,26 +87,11 @@
return metaData.getId();
}
- public PortletApplicationRegistrationContext getRegistrationContext()
- {
- return registrationContext;
- }
-
- public void setRegistrationContext(PortletApplicationRegistrationContext
registrationContext)
- {
- this.registrationContext = registrationContext;
- }
-
public APIFactory getAPIFactory()
{
return apiFactory;
}
- public void setAPIFactory(APIFactory apiFactory)
- {
- this.apiFactory = apiFactory;
- }
-
public PortletApplicationMetaData getMetaData()
{
return metaData;
@@ -122,21 +105,15 @@
public void addContainer(PortletContainer container)
{
portlets.put(container.getId(), container);
- registrationContext.registerPortlet(container);
}
public void removeContainer(PortletContainer container)
{
- registrationContext.unregisterPortlet(container);
portlets.remove(container.getId());
}
//
- public void create() throws Exception
- {
- }
-
public void start() throws Exception
{
version = metaData.getVersion();
@@ -153,10 +130,6 @@
portletContext = null;
}
- public void destroy()
- {
- }
-
public String getVersion()
{
return version;
@@ -177,16 +150,6 @@
return windowStates;
}
- public void start(String portletName) throws Exception
- {
- context.startPortlet(portletName);
- }
-
- public void stop(String portletName) throws Exception
- {
- context.stopPortlet(portletName);
- }
-
// WebApp implementation
********************************************************************************************
public Set getPortletContainers()
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -121,9 +121,8 @@
*/
protected PreferencesValidator preferencesValidator;
- public PortletContainerImpl(PortletApplicationImpl application, PortletMetaData
metaData, JBossPortletMetaData jbossMetaData)
+ public PortletContainerImpl(PortletMetaData metaData, JBossPortletMetaData
jbossMetaData)
{
- this.application = application;
this.metaData = metaData;
this.jbossMetaData = jbossMetaData;
this.valve = new Valve();
@@ -251,9 +250,6 @@
// Let invocation flow in
valve.open();
-
- // Register
- // webApp.addContainer(this);
}
catch (IllegalAccessException e)
{
@@ -283,9 +279,6 @@
public void stop()
{
- //
- // webApp.removeContainer(this);
-
// Wait at most 60 seconds before all invocations are done
log.debug("Trying to close the valve");
boolean done = valve.closing(60000);
@@ -346,6 +339,11 @@
return application;
}
+ public void setApplication(PortletApplicationImpl application)
+ {
+ this.application = application;
+ }
+
public Valve getValve()
{
return valve;
Modified: trunk/portlet-server/build.xml
===================================================================
--- trunk/portlet-server/build.xml 2007-03-18 23:25:36 UTC (rev 6732)
+++ trunk/portlet-server/build.xml 2007-03-19 00:38:40 UTC (rev 6733)
@@ -90,7 +90,6 @@
<path id="library.classpath">
<path refid="dom4j.dom4j.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
- <path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.serialization.classpath"/>
<path refid="oswego.concurrent.classpath"/>
<path refid="apache.httpclient.classpath"/>
Modified:
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
---
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -22,26 +22,15 @@
******************************************************************************/
package org.jboss.portal.portlet.deployment.jboss;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDependencyMetaData;
-import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
-import org.jboss.beans.metadata.plugins.AbstractParameterMetaData;
-import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
import org.jboss.deployment.DeploymentException;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.xml.NullEntityResolver;
-import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
-import org.jboss.portal.portlet.container.PortletApplicationRegistry;
+import org.jboss.portal.portlet.impl.container.PortletApplicationContextImpl;
import org.jboss.portal.portlet.deployment.JBossApplicationMetaDataFactory;
import org.jboss.portal.portlet.deployment.PortletApplicationMetaDataFactory;
import org.jboss.portal.portlet.deployment.ValueTrimmingFilter;
-import org.jboss.portal.portlet.impl.jsr168.APIFactory;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.deployment.jboss.PortletContainerAdapter;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
import org.jboss.portal.portlet.metadata.PolicyPermissionMetaData;
@@ -63,10 +52,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -90,11 +77,8 @@
protected PortletAppDeploymentFactory factory;
/** . */
- protected Kernel kernel;
+ protected PortletApplicationContextImpl portletApplicationContext;
- /** . */
- protected List beans;
-
public PortletAppDeployment(URL url, PortalWebApp pwa, MBeanServer mbeanServer,
PortletAppDeploymentFactory factory)
{
super(url, pwa, mbeanServer);
@@ -106,23 +90,8 @@
importTLD();
//
- beans = new ArrayList();
-
- //
try
{
- BasicBootstrap bootstrap = new BasicBootstrap();
- bootstrap.run();
- kernel = bootstrap.getKernel();
- }
- catch (Exception e)
- {
- throw new DeploymentException(e);
- }
-
- //
- try
- {
portletAppMD = buildPortletApplicationMetaData();
jbossAppMD = buildJBossApplicationMetaData();
@@ -170,62 +139,17 @@
{
try
{
- // Controller meta data
- AbstractBeanMetaData webAppBMD = new AbstractBeanMetaData(
- "portal:container=WebApp,id=" + portletAppMD.getId(),
- PortletApplicationContextImpl.class.getName());
+ portletApplicationContext = new PortletApplicationContextImpl(
+ factory.getWebAppRegistry(),
+ factory.getAPIFactory(),
+ portletAppMD,
+ jbossAppMD,
+ pwa.getServletContext(),
+ pwa.getClassLoader()
+ );
- // Constructor
- AbstractConstructorMetaData webAppCMD = new AbstractConstructorMetaData();
- List webAppParamsCMD = new ArrayList();
- webAppParamsCMD.add(new
AbstractParameterMetaData(PortletApplicationRegistry.class.getName(),
factory.getWebAppRegistry()));
- webAppParamsCMD.add(new AbstractParameterMetaData(APIFactory.class.getName(),
factory.getAPIFactory()));
- webAppParamsCMD.add(new AbstractParameterMetaData(portletAppMD));
- webAppParamsCMD.add(new
AbstractParameterMetaData(JBossApplicationMetaData.class.getName(), jbossAppMD));
- webAppParamsCMD.add(new
AbstractParameterMetaData(ServletContext.class.getName(), pwa.getServletContext()));
- webAppParamsCMD.add(new AbstractParameterMetaData(ClassLoader.class.getName(),
pwa.getClassLoader()));
- webAppCMD.setParameters(webAppParamsCMD);
- webAppBMD.setConstructor(webAppCMD);
-
- // Installation
- beans.add(webAppBMD);
- kernel.getController().install(webAppBMD);
-
// Install portlet containers
- for (Iterator i = portletAppMD.getPortlets().iterator(); i.hasNext();)
- {
- PortletMetaData portletMD = (PortletMetaData)i.next();
-
- // Get specific dd meta data
- JBossPortletMetaData jbossPortletMD =
(JBossPortletMetaData)jbossAppMD.getPortlets().get(portletMD.getName());
-
- // Controller meta data
- AbstractBeanMetaData containerBMD = new AbstractBeanMetaData(
- "portal:container=Portlet,id=" + portletAppMD.getId() +
"." + portletMD.getName(),
- PortletContainerAdapter.class.getName());
-
- // Constructor
- AbstractConstructorMetaData containerCMD = new
AbstractConstructorMetaData();
- List containerParamsCMD = new ArrayList();
- containerParamsCMD.add(new AbstractParameterMetaData(portletMD));
- containerParamsCMD.add(new
AbstractParameterMetaData(JBossPortletMetaData.class.getName(), jbossPortletMD));
- containerCMD.setParameters(containerParamsCMD);
- containerBMD.setConstructor(containerCMD);
-
- // Properties
- HashSet containerProps = new HashSet();
- containerProps.add(new
AbstractPropertyMetaData("portletWebAppAdapter", new
AbstractDependencyValueMetaData(webAppBMD.getName())));
- containerBMD.setProperties(containerProps);
-
- // Dependencies
- HashSet portletContainerDmds = new HashSet();
- portletContainerDmds.add(new
AbstractDependencyMetaData(webAppBMD.getName()));
- containerBMD.setDemands(portletContainerDmds);
-
- // Installation
- beans.add(containerBMD);
- kernel.getController().install(containerBMD);
- }
+ portletApplicationContext.startPortletApplication();
}
catch (Throwable e)
{
@@ -311,11 +235,7 @@
public void destroy() throws DeploymentException
{
- for (int i = beans.size() - 1; i >= 0; i--)
- {
- AbstractBeanMetaData bmd = (AbstractBeanMetaData)beans.get(i);
- kernel.getController().uninstall(bmd.getName());
- }
+ portletApplicationContext.stopPortletApplication();
}
/** Import the portlet jsp tag TLD in the deployed application. */
Deleted:
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java
===================================================================
---
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java 2007-03-19
00:38:40 UTC (rev 6733)
@@ -1,89 +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.portlet.deployment.jboss;
-
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
-import org.jboss.portal.portlet.container.PortletContainer;
-
-/**
- * Adapt the life cycle of micro container to the portlet container impl.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 6700 $
- */
-public class PortletContainerAdapter
-{
-
- /** . */
- private PortletMetaData portletMD;
-
- /** . */
- private JBossPortletMetaData jbossPortletMD;
-
- /** . */
- private PortletApplicationContextImpl portletApplicationContext;
-
- /** . */
- private PortletContainerImpl portletContainer;
-
- public PortletContainerAdapter(PortletMetaData portletMD, JBossPortletMetaData
jbossPortletMD)
- {
- this.portletMD = portletMD;
- this.jbossPortletMD = jbossPortletMD;
- }
-
- public PortletApplicationContextImpl getPortletApplicationContext()
- {
- return portletApplicationContext;
- }
-
- public void setPortletWebAppAdapter(PortletApplicationContextImpl
portletApplicationContext)
- {
- this.portletApplicationContext = portletApplicationContext;
- }
-
- public PortletContainer getPortletContainer()
- {
- return portletContainer;
- }
-
- public void start() throws Exception
- {
- PortletApplicationImpl portletApp =
portletApplicationContext.getPortletApplication();
- portletContainer = new PortletContainerImpl(portletApp, portletMD,
jbossPortletMD);
- portletContainer.start();
- portletApp.addContainer(portletContainer);
- }
-
- public void stop()
- {
- PortletApplicationImpl portletApp =
portletApplicationContext.getPortletApplication();
- portletApp.removeContainer(portletContainer);
- portletContainer.stop();
- portletContainer = null;
- }
-}
Modified: trunk/portlet-server/src/resources/tck-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet-server/src/resources/tck-sar/META-INF/jboss-service.xml 2007-03-18
23:25:36 UTC (rev 6732)
+++ trunk/portlet-server/src/resources/tck-sar/META-INF/jboss-service.xml 2007-03-19
00:38:40 UTC (rev 6733)
@@ -143,7 +143,7 @@
<!-- Webapp registry -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+
code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified:
trunk/portlet-server/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/portlet-server/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/portlet-server/src/resources/test/info/test-info-sar/META-INF/jboss-service.xml 2007-03-19
00:38:40 UTC (rev 6733)
@@ -84,7 +84,7 @@
<!-- Webapp registry -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+
code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/portlet-server/src/resources/test-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet-server/src/resources/test-sar/META-INF/jboss-service.xml 2007-03-18
23:25:36 UTC (rev 6732)
+++ trunk/portlet-server/src/resources/test-sar/META-INF/jboss-service.xml 2007-03-19
00:38:40 UTC (rev 6733)
@@ -190,7 +190,7 @@
<!-- Webapp registry -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+
code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified:
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2007-03-18
23:25:36 UTC (rev 6732)
+++
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2007-03-19
00:38:40 UTC (rev 6733)
@@ -55,7 +55,7 @@
<!-- Webapp registry -->
<mbean
- code="org.jboss.portal.portlet.container.PortletApplicationRegistryImpl"
+
code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">