taylor 2003/08/08 13:39:20
Modified: container/src/java/org/apache/jetspeed/cache
PortletCache.java
container/src/java/org/apache/jetspeed/factory
JetspeedPortletFactory.java
Log:
Fixed bug in portlet cache, now looks up portlet java instances by unique portlet
name
Revision Changes Path
1.2 +13 -9
jakarta-jetspeed-2/container/src/java/org/apache/jetspeed/cache/PortletCache.java
Index: PortletCache.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/container/src/java/org/apache/jetspeed/cache/PortletCache.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PortletCache.java 28 Jul 2003 23:46:42 -0000 1.1
+++ PortletCache.java 8 Aug 2003 20:39:20 -0000 1.2
@@ -59,7 +59,11 @@
/**
* Very Simple Portlet Cache to manage portlets in container
- * Keeps only one object instance of a portlet per class
+ * Keeps only one object instance of a portlet
+ * The uniqueness of the portlet is determined by the portlet name
+ * There can be multiple java instances of the same portlet class
+ * when the portlet name (from the deployment descriptor/registry)
+ * differs per portlet description
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id$
@@ -73,23 +77,23 @@
*
* @param portlet The portlet object to add to the cache
*/
- static public void add(Portlet portlet)
+ static public void add(String name, Portlet portlet)
{
synchronized(portlets)
{
- portlets.put(portlet.getClass().getName(), portlet);
+ portlets.put(name, portlet);
}
}
/*
* Gets a portlet from the portlet cache.
*
- * @param portletClassName The full Java name of the portlet class
+ * @param portletName The name of the portlet from the registry
* @return The found portlet from the cache or null if not found
*/
- static public Portlet get(String portletClassName)
+ static public Portlet get(String portletName)
{
- return (Portlet)portlets.get(portletClassName);
+ return (Portlet)portlets.get(portletName);
}
/*
@@ -97,11 +101,11 @@
*
* @param portletClassName The full Java name of the portlet class
*/
- static public void remove(String portletClassName)
+ static public void remove(String portletName)
{
synchronized(portlets)
{
- portlets.remove(portletClassName);
+ portlets.remove(portletName);
}
}
1.2 +5 -4
jakarta-jetspeed-2/container/src/java/org/apache/jetspeed/factory/JetspeedPortletFactory.java
Index: JetspeedPortletFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/container/src/java/org/apache/jetspeed/factory/JetspeedPortletFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JetspeedPortletFactory.java 28 Jul 2003 23:46:42 -0000 1.1
+++ JetspeedPortletFactory.java 8 Aug 2003 20:39:20 -0000 1.2
@@ -88,11 +88,12 @@
Portlet portlet = null;
Class portletClass = null;
String handle = null;
- String className = portletDefinition.getClassName();
+ String portletName = portletDefinition.getName();
+ String className = portletDefinition.getClassName();
try
{
- portlet = PortletCache.get(className);
+ portlet = PortletCache.get(portletName);
if (null != portlet)
{
return portlet;
@@ -106,7 +107,7 @@
PortletConfig portletConfig =
PortalAccessor.createPortletConfig(servletConfig, portletContext, portletDefinition);
portlet.init(portletConfig);
- PortletCache.add(portlet);
+ PortletCache.add(portletName, portlet);
}
catch (Throwable e)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]