Can anyone explain why the cache key creation is a static member?  Looking
at the code, I can see that it was originally an instance method and was
later changed.  This doesn't make a lot of sense to me to be honest.  This
would be like defining static equals() and hashcode() methods.  There are at
least a couple of things that seems wrong with the current approach:

1) As Glenn has stated, the static method does not have access to all of the
state information of the cacheable and cannot necessarily generate the best
cache key to match.

2) Static methods cannot be required to be implemented.  An abstract
instance method would force an implementation (with a possible generic
implementation in the superclass).  

In my mind, it seems that we should be switching back to an instance method
for cache key generation, with the possibility that some instances delegate
to an appropriate static method.  

Am I missing something here?
Craig

-----Original Message-----
From: Glenn Golden [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 8:03 AM
To: 'Jetspeed Developers List'
Subject: RE: A brief report on Jetspeed Portlet Caching


David -

I'm unsure what Java does when calling a static member of a class if the
class hierarchy defines two or more implementations of that member, each at
different levels - does it take the most specific?

If you duplicate your page to another page, and leave the portlet id's the
same in each page, and have them both updating at the same time, it may fail
to distinguish them.

If a page is duplicated within jetspeed, for example, when a new user is
created and the "turbine" page is copied, are the id's re-generated?  I
think that portlet Id is not defined to be system wide unique, just unique
within the page.

We may want to add the portal page id as well as the portlet id to make the
full instance id in the cache.

I considered doing something like this, but balked at the idea of further
extending PortletConfig.  In this case, though, adding the id doesn't make
it any worse than it already is!

- Glenn

> -----Original Message-----
> From: David Sean Taylor [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, May 13, 2002 12:32 AM
> To: 'Jetspeed Developers List'
> Subject: RE: A brief report on Jetspeed Portlet Caching
> 
> 
> Glenn,
> 
> I ran a little test, seems like I've got a patch, but haven't 
> tested it much. Added the id from the psml-entry into the 
> PortletConfig, and then use it in getHandle. Here is summary 
> of the most important changes:
> 
> JetspeedPortletFactoryService:
> 
>     public static Portlet getPortlet( String name, String id 
> ) throws PortletException
>                                                          ^ 
>     protected PortletConfig getPortletConfig( PortletEntry 
> entry, String
> id)
>     {
>       ....
>         pc.setId(id);        
>         
>         return pc;
>     }
> ^
> 
> PortletConfig, BasePortletConfig, added:
> 
>     public void setId(String id);
>     public String getId();
> 
> 
> 
> 
> Here is the test portlet:
> I put two of these on the same page and the portlet config 
> returned different ids (so did the 'portlet id')
> 
> public class BogusPortlet extends AbstractPortlet 
> {
>     
>     public org.apache.ecs.ConcreteElement 
> getContent(org.apache.turbine.util.RunData data) 
>     {
>         String s1 = "Config ID: " + getPortletConfig().getId();
>         String s2 = ", Portlet ID: " + getID();
>         return new org.apache.ecs.ClearElement( s1 + s2 );
>     }
> 
>     public static Object getHandle(Object config)
>     {
>         //this implementation expects a PortletConfig object as its
>         // configuration 
>         PortletConfig pc = null;
> 
>         if (!(config instanceof PortletConfig))
>         {
>             return null;
>             
>         }
> 
>         // By default, only take into account the init parameters 
>         pc = (PortletConfig)config;
> 
>         return pc.getId();
>         
>     }
> 
> If you're interestd I can send you the rest of the code (or 
> just check it in),
> 
> David
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:jetspeed-dev-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to