portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject svn commit: r220155 - in /portals/jetspeed-2/trunk: components/registry/src/java/org/apache/jetspeed/components/portletentity/ jetspeed-api/src/java/org/apache/jetspeed/om/common/portlet/
Date Thu, 21 Jul 2005 18:07:50 GMT
Author: weaver
Date: Thu Jul 21 11:07:49 2005
New Revision: 220155

URL: http://svn.apache.org/viewcvs?rev=220155&view=rev
Log:
see JS2-315: http://issues.apache.org/jira/browse/JS2-315

Modified:
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/portlet/MutablePortletEntity.java

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java?rev=220155&r1=220154&r2=220155&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
Thu Jul 21 11:07:49 2005
@@ -66,6 +66,7 @@
         super();
         this.registry = registry;
         PortletEntityImpl.pac = this;
+        PortletEntityImpl.registry = registry;
     }
 
     /**
@@ -101,7 +102,7 @@
         {
             String msg = "Failed to retrieve Portlet Definition for " + fragment.getName();
             logger.warn(msg);
-            portletEntity = new PortletEntityImpl();
+            portletEntity = new PortletEntityImpl(fragment);
             fragment.overrideRenderedContent(msg);
         }
 

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java?rev=220155&r1=220154&r2=220155&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
Thu Jul 21 11:07:49 2005
@@ -31,11 +31,13 @@
 import org.apache.jetspeed.components.persistence.store.PersistenceStore;
 import org.apache.jetspeed.components.persistence.store.PersistenceStoreRuntimeExcpetion;
 import org.apache.jetspeed.components.persistence.store.RemovalAware;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
 import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
 import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
 import org.apache.jetspeed.om.common.portlet.PrincipalAware;
 import org.apache.jetspeed.om.common.preference.PreferenceSetComposite;
+import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.preference.impl.PrefsPreference;
 import org.apache.jetspeed.om.preference.impl.PrefsPreferenceSetImpl;
 import org.apache.jetspeed.om.window.impl.PortletWindowListImpl;
@@ -66,6 +68,8 @@
     private JetspeedObjectID id;
 
     protected static PortletEntityAccessComponent pac;
+    
+    protected static PortletRegistry registry;
 
     private static final Log log = LogFactory.getLog(PortletEntityImpl.class);
 
@@ -90,6 +94,18 @@
     protected String appName;
 
     private boolean dirty = false;
+    
+    private Fragment fragment;
+    
+    public PortletEntityImpl(Fragment fragment)
+    {
+        this.fragment = fragment;
+    }
+
+    public PortletEntityImpl()
+    {
+        super();
+    }
 
     // protected Principal principal;
     protected ThreadLocal principalRef = new ThreadLocal();
@@ -188,6 +204,15 @@
 
     public PortletDefinition getPortletDefinition()
     {
+        // there are cases when jetspeed gets initialized before
+        // all of the portlet web apps have.  In this event, premature
+        // access to the portal would cause portlet entities to be cached
+        // with their associated window without there corresponding PortletDefinition
+        // (becuase the PortletApplication has yet to be registered).
+        if(this.portletDefinition == null)
+        {
+            setPortletDefinition(registry.getPortletDefinitionByIdentifier(getPortletUniqueName()));
+        }
         return this.portletDefinition;
     }
 
@@ -495,6 +520,24 @@
     }
     public String getPortletUniqueName()
     {
-        return this.appName+"::"+this.portletName;
+        if(this.appName != null && this.portletName != null)
+        {
+            return this.appName+"::"+this.portletName;
+        }
+        else if(fragment != null)
+        {
+            return fragment.getName();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void setFragment(Fragment fragment)
+    {
+        this.fragment = fragment;
     }
+    
+    
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/portlet/MutablePortletEntity.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/portlet/MutablePortletEntity.java?rev=220155&r1=220154&r2=220155&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/portlet/MutablePortletEntity.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/portlet/MutablePortletEntity.java
Thu Jul 21 11:07:49 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.jetspeed.om.common.portlet;
 
+import org.apache.jetspeed.om.page.Fragment;
 import org.apache.pluto.om.entity.PortletEntity;
 import org.apache.pluto.om.entity.PortletEntityCtrl;
 
@@ -34,4 +35,6 @@
     public static final String PORTLET_ENTITY_ROOT = "portlet_entity";
     
     String getPortletUniqueName();
+    
+    void setFragment(Fragment fragment);
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message