Author: julien(a)jboss.com
Date: 2008-02-19 08:23:47 -0500 (Tue, 19 Feb 2008)
New Revision: 10029
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistrationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistryListener.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ManagedPortletApplication.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ManagedPortletContainer.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/ManagedPortletApplication.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/ManagedPortletContainer.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistry.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/CacheInfoTest.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/CapabilitiesInfoTest.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/MetaInfoTest.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/ModeInfoTest.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PortletInfoTest.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PreferenceInfoTest.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SecurityInfoTest.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SessionInfoTest.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/PortletApplicationDeployer.java
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml
Log:
consolidate the portlet application registry with the managed objects
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/ManagedPortletApplication.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/ManagedPortletApplication.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/ManagedPortletApplication.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -39,4 +39,6 @@
Collection<? extends ManagedPortletContainer> getManagedPortletContainers();
+ ManagedPortletContainer getManagedPortletContainer(String portletContainerId);
+
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/ManagedPortletContainer.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/ManagedPortletContainer.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/ManagedPortletContainer.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -33,7 +33,7 @@
String getId();
- PortletInfo getPortletInfo();
+ PortletInfo getInfo();
ManagedPortletApplication getManagedPortletApplication();
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistrationContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistrationContext.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistrationContext.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -1,49 +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.managed;
-
-import org.jboss.portal.portlet.container.PortletContainer;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface PortletApplicationRegistrationContext
-{
-
- /**
- * Register a portlet.
- *
- * @param portletContainer the portlet container
- */
- void registerPortlet(PortletContainer portletContainer);
-
- /**
- * Unregister a portlet.
- *
- * @param portletContainer the portlet container
- */
- void unregisterPortlet(PortletContainer portletContainer);
-
-
-}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistry.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistry.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistry.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.container.managed;
-import org.jboss.portal.portlet.container.PortletApplication;
-
import java.util.Collection;
/**
@@ -33,39 +31,20 @@
*/
public interface PortletApplicationRegistry
{
- /**
- * Register a portlet application.
- *
- * @param portletApplication the portlet application to register
- * @throws IllegalArgumentException if the portlet application is null or already
registered
- */
- PortletApplicationRegistrationContext registerPortletApplication(PortletApplication
portletApplication) throws IllegalArgumentException;
/**
- * Unregister a portlet application.
+ * Return an immutable list all the known portlet application in the registry.
*
- * @param portletApplication the portlet application to unregister
- * @throws IllegalArgumentException if the portlet application is null or not
registered
+ * @return the registered portlet applications
*/
- void unregisterPortletApplication(PortletApplication portletApplication) throws
IllegalArgumentException;
+ Collection<? extends ManagedPortletApplication>
getManagedPortletApplications();
- /** Return an immutable list all the known portlet application in the registry. */
- Collection<PortletApplication> getPortletApplications();
-
- /** Return a portlet app using its id or null if it does not exist. */
- PortletApplication getPortletApplication(String id);
-
/**
- * Adds a portlet container registry listener.
+ * Return a portlet app using its id or null if it does not exist.
*
- * @param listener
+ * @param id the portlet application id
+ * @return a specified registered portlet application
*/
- void addListener(PortletApplicationRegistryListener listener);
+ ManagedPortletApplication getManagedPortletApplication(String id);
- /**
- * Removes a portlet container registry listener.
- *
- * @param listener
- */
- void removeListener(PortletApplicationRegistryListener listener);
}
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistryListener.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistryListener.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/managed/PortletApplicationRegistryListener.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -1,43 +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.managed;
-
-import org.jboss.portal.portlet.container.PortletContainer;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- */
-public interface PortletApplicationRegistryListener
-{
-
- /**
- * A portlet container has been registered.
- */
- void portletContainerRegistered(PortletContainer portletContainer);
-
- /**
- * A portlet container has been unregistered.
- */
- void portletContainerUnregistered(PortletContainer portletContainer);
-
-}
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -1,249 +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.impl.container;
-
-import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
-import org.jboss.portal.portlet.container.managed.PortletApplicationRegistrationContext;
-import org.jboss.portal.portlet.container.PortletApplication;
-import org.jboss.portal.portlet.container.managed.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.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<String, PortletApplication> portletApplications = new
HashMap<String, PortletApplication>();
-
- /** . */
- private Map<ContainerKey, PortletContainer> portletContainers = new
HashMap<ContainerKey, PortletContainer>();
-
- /** . */
- private List<PortletApplicationRegistryListener> listeners = new
ArrayList<PortletApplicationRegistryListener>();
-
- public PortletApplicationRegistrationContext
registerPortletApplication(PortletApplication portletApplication)
- {
- if (portletApplication == null)
- {
- throw new IllegalArgumentException("No null portlet app accepted");
- }
- synchronized (this)
- {
- String key = portletApplication.getId();
- if (portletApplications.containsKey(key))
- {
- throw new IllegalArgumentException("This portlet app is already
registered: " + key);
- }
- PortletApplicationRegistrationContext ctx = new
PortletApplicationRegistrationContextImpl(portletApplication);
- Map<String, PortletApplication> webAppsCopy = new HashMap<String,
PortletApplication>(portletApplications);
- webAppsCopy.put(key, portletApplication);
- portletApplications = webAppsCopy;
- return ctx;
- }
- }
-
- public void unregisterPortletApplication(PortletApplication portletApplication)
- {
- if (portletApplication == null)
- {
- throw new IllegalArgumentException("No null portlet app accepted");
- }
- synchronized (this)
- {
- String key = portletApplication.getId();
- if (!portletApplications.containsKey(key))
- {
- throw new IllegalArgumentException("This portlet app does not exist
here: " + key);
- }
- Map<String, PortletApplication> webAppsCopy = new HashMap<String,
PortletApplication>(portletApplications);
- webAppsCopy.remove(key);
- portletApplications = webAppsCopy;
- }
- }
-
- public Collection<PortletApplication> getPortletApplications()
- {
- return Collections.unmodifiableCollection(portletApplications.values());
- }
-
- public PortletApplication getPortletApplication(String id)
- {
- return 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 fireRegisterPortletContainerEvent(PortletContainer portlet)
- {
- for (PortletApplicationRegistryListener listener : listeners)
- {
- listener.portletContainerRegistered(portlet);
- }
- }
-
- private void fireUnregisterPortletContainerEvent(PortletContainer portlet)
- {
- for (PortletApplicationRegistryListener listener : listeners)
- {
- 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<ContainerKey, PortletContainer> componentsCopy = new
HashMap<ContainerKey, PortletContainer>(portletContainers);
- componentsCopy.put(new ContainerKey(portletContainer), portletContainer);
- portletContainers = componentsCopy;
-
- //
- fireRegisterPortletContainerEvent(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<ContainerKey, PortletContainer> componentsCopy = new
HashMap<ContainerKey, PortletContainer>(portletContainers);
- ContainerKey key = new ContainerKey(portletContainer);
- componentsCopy.remove(key);
- portletContainers = componentsCopy;
- fireUnregisterPortletContainerEvent(portletContainer);
- }
- }
- }
-}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/CacheInfoTest.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/CacheInfoTest.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/CacheInfoTest.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.test.portlet.info;
-import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.info.CacheInfo;
import org.jboss.portal.portlet.info.PortletInfo;
@@ -42,7 +42,7 @@
public void execute()
{
- PortletContainer container =
registry.getPortletApplication("/test-info").getPortletContainer("CachePortlet");
+ ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("CachePortlet");
PortletInfo info = container.getInfo();
CacheInfo cacheInfo = info.getCache();
assertEquals(65, cacheInfo.getExpirationSecs());
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/CapabilitiesInfoTest.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/CapabilitiesInfoTest.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/CapabilitiesInfoTest.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -25,7 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.info.PortletInfo;
@@ -52,7 +52,7 @@
public void execute()
{
- PortletContainer container =
registry.getPortletApplication("/test-info").getPortletContainer("CapabilitiesPortlet");
+ ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("CapabilitiesPortlet");
PortletInfo info = container.getInfo();
CapabilitiesInfo capInfo = info.getCapabilities();
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/MetaInfoTest.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/MetaInfoTest.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/MetaInfoTest.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.portlet.info;
import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.portlet.info.PortletInfo;
@@ -45,7 +45,7 @@
public void execute()
{
- PortletContainer container =
registry.getPortletApplication("/test-info").getPortletContainer("NoBundlePortlet");
+ ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("NoBundlePortlet");
PortletInfo info = container.getInfo();
MetaInfo metaInfo = info.getMeta();
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/ModeInfoTest.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/ModeInfoTest.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/ModeInfoTest.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.portlet.info;
import org.jboss.portal.Mode;
-import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
import org.jboss.portal.portlet.info.ModeInfo;
@@ -47,8 +47,8 @@
public void execute()
{
- PortletContainer container1 =
registry.getPortletApplication("/test-info").getPortletContainer("ModePortlet1");
- PortletContainer container2 =
registry.getPortletApplication("/test-info").getPortletContainer("ModePortlet2");
+ ManagedPortletContainer container1 =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("ModePortlet1");
+ ManagedPortletContainer container2 =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("ModePortlet2");
CapabilitiesInfo capaInfo = container1.getInfo().getCapabilities();
//Portlet 1 with VIEW, EDIT, HELP
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PortletInfoTest.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PortletInfoTest.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PortletInfoTest.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.test.portlet.info;
-import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.info.PortletInfo;
import static org.jboss.unit.api.Assert.*;
@@ -42,7 +42,7 @@
public void execute()
{
//This asserts only .isRemotable() as rest is checked in other tests
- PortletContainer container =
registry.getPortletApplication("/test-info").getPortletContainer("RemotablePortlet1");
+ ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("RemotablePortlet1");
PortletInfo info = container.getInfo();
assertEquals(Boolean.TRUE, info.isRemotable());
@@ -54,11 +54,11 @@
assertNotNull(info.getSecurity());
assertNotNull(info.getSession());
- container =
registry.getPortletApplication("/test-info").getPortletContainer("RemotablePortlet2");
+ container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("RemotablePortlet2");
info = container.getInfo();
assertEquals(Boolean.FALSE, info.isRemotable());
- container =
registry.getPortletApplication("/test-info").getPortletContainer("RemotablePortlet3");
+ container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("RemotablePortlet3");
info = container.getInfo();
assertEquals(Boolean.TRUE, info.isRemotable());
}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PreferenceInfoTest.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PreferenceInfoTest.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PreferenceInfoTest.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.test.portlet.info;
-import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.impl.info.ContainerPreferenceInfo;
import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
import org.jboss.portal.portlet.info.PortletInfo;
@@ -46,7 +46,7 @@
public void execute()
{
- PortletContainer container =
registry.getPortletApplication("/test-info").getPortletContainer("PreferenceInfoPortlet");
+ ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("PreferenceInfoPortlet");
//
PortletInfo info = container.getInfo();
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SecurityInfoTest.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SecurityInfoTest.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SecurityInfoTest.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.portlet.info;
import org.jboss.portal.portlet.TransportGuarantee;
-import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.SecurityInfo;
@@ -45,7 +45,7 @@
{
//This asserts only .isRemotable() as rest is checked in other tests
- PortletContainer container =
registry.getPortletApplication("/test-info").getPortletContainer("SecuredPortlet1");
+ ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("SecuredPortlet1");
PortletInfo info = container.getInfo();
SecurityInfo secInfo = info.getSecurity();
@@ -56,7 +56,7 @@
assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.NONE));
- container =
registry.getPortletApplication("/test-info").getPortletContainer("SecuredPortlet2");
+ container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("SecuredPortlet2");
info = container.getInfo();
secInfo = info.getSecurity();
@@ -66,7 +66,7 @@
assertTrue(secInfo.containsTransportGuarantee(TransportGuarantee.NONE));
- container =
registry.getPortletApplication("/test-info").getPortletContainer("SecuredPortlet3");
+ container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("SecuredPortlet3");
info = container.getInfo();
secInfo = info.getSecurity();
assertEquals(2, secInfo.getTransportGuarantees().size());
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SessionInfoTest.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SessionInfoTest.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SessionInfoTest.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.test.portlet.info;
-import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.SessionInfo;
@@ -42,7 +42,7 @@
public void execute()
{
- PortletContainer container =
registry.getPortletApplication("/test-info").getPortletContainer("DistributedPortlet1");
+ ManagedPortletContainer container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("DistributedPortlet1");
PortletInfo info = container.getInfo();
SessionInfo sessionInfo = info.getSession();
assertNotNull(sessionInfo);
@@ -50,7 +50,7 @@
assertEquals(Boolean.TRUE, distributed);
- container =
registry.getPortletApplication("/test-info").getPortletContainer("DistributedPortlet2");
+ container =
registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("DistributedPortlet2");
info = container.getInfo();
sessionInfo = info.getSession();
assertNotNull(sessionInfo);
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
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletApplication.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -133,4 +133,9 @@
{
return kernelPortletContainers.values();
}
+
+ public ManagedPortletContainer getManagedPortletContainer(String portletContainerId)
+ {
+ return kernelPortletContainers.get(portletContainerId);
+ }
}
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
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/KernelPortletContainer.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -94,7 +94,7 @@
return kernelPortletApplication;
}
- public PortletInfo getPortletInfo()
+ public PortletInfo getInfo()
{
return portletContainer.getInfo();
}
Deleted:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ManagedPortletApplication.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ManagedPortletApplication.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ManagedPortletApplication.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -1,111 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.test;
-
-import org.jboss.portal.portlet.container.PortletApplicationContext;
-import org.jboss.portal.portlet.container.PortletApplication;
-import org.jboss.portal.web.WebApp;
-import org.jboss.portal.common.NotYetImplemented;
-
-import javax.servlet.ServletContext;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ManagedPortletApplication implements PortletApplicationContext
-{
-
- /** . */
- private final WebApp webApp;
-
- /** . */
- private PortletApplication portletApplication;
-
- /** . */
- private final Map<String, ManagedPortletContainer> managedPortletContainers;
-
- public ManagedPortletApplication(WebApp webApp)
- {
- this.webApp = webApp;
- this.portletApplication = null;
- this.managedPortletContainers = new HashMap<String,
ManagedPortletContainer>();
- }
-
- public void addManagedPortletContainer(ManagedPortletContainer
managedPortletContainer)
- {
- managedPortletContainers.put(managedPortletContainer.getPortletContainer().getId(),
managedPortletContainer);
- }
-
- public void removeManagedPortletContainer(ManagedPortletContainer
managedPortletContainer)
- {
-
managedPortletContainers.remove(managedPortletContainer.getPortletContainer().getId());
- }
-
- public PortletApplication getPortletApplication()
- {
- return portletApplication;
- }
-
- public void setPortletApplication(PortletApplication portletApplication)
- {
- this.portletApplication = portletApplication;
- }
-
- public void start() throws Exception
- {
- }
-
- public void stop()
- {
- }
-
- // PortletApplicationContext
****************************************************************************************
-
- public ServletContext getServletContext()
- {
- return webApp.getServletContext();
- }
-
- public String getContextPath()
- {
- return webApp.getContextPath();
- }
-
- public ClassLoader getClassLoader()
- {
- return webApp.getClassLoader();
- }
-
- public void invokeStart() throws Exception
- {
- throw new NotYetImplemented();
- }
-
- public void invokeStop()
- {
- throw new NotYetImplemented();
- }
-}
Deleted:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ManagedPortletContainer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ManagedPortletContainer.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ManagedPortletContainer.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -1,81 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.test;
-
-import org.jboss.portal.portlet.container.PortletContainerContext;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.common.NotYetImplemented;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ManagedPortletContainer implements PortletContainerContext
-{
-
- /** . */
- private PortletContainer portletContainer;
-
- /** . */
- private ManagedPortletApplication managedPortletApplication;
-
- public ManagedPortletApplication getManagedPortletApplication()
- {
- return managedPortletApplication;
- }
-
- public void setManagedPortletApplication(ManagedPortletApplication
managedPortletApplication)
- {
- this.managedPortletApplication = managedPortletApplication;
- }
-
- public PortletContainer getPortletContainer()
- {
- return portletContainer;
- }
-
- public void setPortletContainer(PortletContainer portletContainer)
- {
- this.portletContainer = portletContainer;
- }
-
- public void start() throws Exception
- {
- }
-
- public void stop()
- {
- }
-
- //
-
- public void invokeStart() throws Exception
- {
- throw new NotYetImplemented();
- }
-
- public void invokeStop()
- {
- throw new NotYetImplemented();
- }
-}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java 2008-02-19
13:23:47 UTC (rev 10029)
@@ -27,10 +27,8 @@
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.portlet.container.PortletApplication;
-import org.jboss.portal.portlet.container.managed.PortletApplicationRegistrationContext;
import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
-import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
import static
org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_168_NS;
import static
org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_286_NS;
@@ -54,12 +52,13 @@
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
+import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PortletApplicationDeployer implements WebAppListener,
KernelControllerContextAware
+public class PortletApplicationDeployer implements WebAppListener,
KernelControllerContextAware, PortletApplicationRegistry
{
static
@@ -100,8 +99,7 @@
private ClassLoader classLoader;
/** . */
- private final Map<KernelPortletApplication,
PortletApplicationRegistrationContext> registrationContextMap =
- new HashMap<KernelPortletApplication,
PortletApplicationRegistrationContext>();
+ private final Map<String, KernelPortletApplication> applications = new
HashMap<String, KernelPortletApplication>();
public PortletApplicationRegistry getRegistry()
{
@@ -269,36 +267,53 @@
return null;
}
- /** Called by MC to install application. */
- public void addManagedPortletApplication(KernelPortletApplication
kernelPortletApplication)
+ /**
+ * Called by MC to install application.
+ *
+ * @param kernelPortletApplication kernel portlet application
+ */
+ public void addKernelPortletApplication(KernelPortletApplication
kernelPortletApplication)
{
- PortletApplication portletApplication =
kernelPortletApplication.getPortletApplication();
- PortletApplicationRegistrationContext context =
registry.registerPortletApplication(portletApplication);
- registrationContextMap.put(kernelPortletApplication, context);
+ applications.put(kernelPortletApplication.getId(), kernelPortletApplication);
}
- /** Called by MC to install container. */
- public void addManagedPortletContainer(KernelPortletContainer kernelPortletContainer)
+ /**
+ * Called by MC to uninstall application.
+ *
+ * @param kernelPortletApplication kernel portlet application
+ */
+ public void removeKernelPortletApplication(KernelPortletApplication
kernelPortletApplication)
{
- KernelPortletApplication kernelPortletApplication =
kernelPortletContainer.getKernelPortletApplication();
- PortletApplicationRegistrationContext context =
registrationContextMap.get(kernelPortletApplication);
- PortletContainer portletContainer = kernelPortletContainer.getPortletContainer();
- context.registerPortlet(portletContainer);
+ applications.remove(kernelPortletApplication.getId());
}
- /** Called by MC to uninstall application. */
- public void removeManagedPortletApplication(KernelPortletApplication
kernelPortletApplication)
+ /**
+ * Called by MC to install application.
+ *
+ * @param kernelPortletContainer kernel portlet container
+ */
+ public void addKernelPortletContainer(KernelPortletContainer kernelPortletContainer)
{
- PortletApplication portletApplication =
kernelPortletApplication.getPortletApplication();
- registry.unregisterPortletApplication(portletApplication);
+ // To be used for life cycle events
}
- /** Called by MC to uninstall container. */
- public void removeManagedPortletContainer(KernelPortletContainer
kernelPortletContainer)
+ /**
+ * Called by MC to uninstall application.
+ *
+ * @param kernelPortletContainer kernel portlet container
+ */
+ public void removeKernelPortletContainer(KernelPortletContainer
kernelPortletContainer)
{
- KernelPortletApplication kernelPortletApplication =
kernelPortletContainer.getKernelPortletApplication();
- PortletApplicationRegistrationContext context =
registrationContextMap.get(kernelPortletApplication);
- PortletContainer portletContainer = kernelPortletContainer.getPortletContainer();
- context.unregisterPortlet(portletContainer);
+ // To be used for life cycle events
}
+
+ public Collection<? extends ManagedPortletApplication>
getManagedPortletApplications()
+ {
+ return applications.values();
+ }
+
+ public ManagedPortletApplication getManagedPortletApplication(String id)
+ {
+ return applications.get(id);
+ }
}
Modified:
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-02-19
13:23:47 UTC (rev 10029)
@@ -34,18 +34,13 @@
</constructor>
</bean>
- <!-- An application registry mainly for listeners -->
- <bean name="PortletApplicationRegistry"
-
class="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"/>
-
<bean name="PortletApplicationDeployer"
class="org.jboss.portal.portlet.test.TestPortletApplicationDeployer">
- <property name="registry"><inject
bean="PortletApplicationRegistry"/></property>
<property name="servletContainer"><inject
bean="ServletContainer"/></property>
<property name="driver"><inject
bean="TestDriverServer"/></property>
- <incallback method="addManagedPortletApplication"/>
- <uncallback method="removeManagedPortletApplication"/>
- <incallback method="addManagedPortletContainer"/>
- <uncallback method="removeManagedPortletContainer"/>
+ <incallback method="addKernelPortletApplication"/>
+ <uncallback method="removeKernelPortletApplication"/>
+ <incallback method="addKernelPortletContainer"/>
+ <uncallback method="removeKernelPortletContainer"/>
</bean>
<bean name="PortletAPIFactory"
class="org.jboss.portal.portlet.impl.jsr168.PortletAPIFactoryImpl"/>
Modified:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-19
12:14:38 UTC (rev 10028)
+++
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-19
13:23:47 UTC (rev 10029)
@@ -23,17 +23,12 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <!-- An application registry mainly for listeners -->
- <bean name="PortletApplicationRegistry"
-
class="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"/>
-
<bean name="PortletApplicationDeployer"
class="org.jboss.portal.portlet.test.PortletApplicationDeployer">
- <property name="registry"><inject
bean="PortletApplicationRegistry"/></property>
<property name="servletContainer"><inject
bean="ServletContainer"/></property>
- <incallback method="addManagedPortletApplication"/>
- <uncallback method="removeManagedPortletApplication"/>
- <incallback method="addManagedPortletContainer"/>
- <uncallback method="removeManagedPortletContainer"/>
+ <incallback method="addKernelPortletApplication"/>
+ <uncallback method="removeKernelPortletApplication"/>
+ <incallback method="addKernelPortletContainer"/>
+ <uncallback method="removeKernelPortletContainer"/>
</bean>
<bean name="PortletAPIFactory"
class="org.jboss.portal.portlet.impl.jsr168.PortletAPIFactoryImpl"/>