You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Chuck Johnson <cd...@viviport.com> on 2001/06/14 17:53:21 UTC

Multiple portlets of the same type

Hello all,

I am in the process of learning the latest Jetspeed and I have a question
about placing multiple portlets on the same pane.

I was looking at the "HelloVelocity" Portlet example and trying to
understand how the actions worked and it struck me as odd that the target
URL for the form it generates appeared to submit to the overall "portal"
target (instead of to a specific Portlet).  In addition, the action
specified in the form was not specific to a given Portlet instance.

As a test, I placed 2 instances of the HelloVelocity Portlet on the same
pane.  I see what I would consider "odd" behavior.

First, when I submit a change to the text, both portlets are updated with
the text on the screen.

Second, when I minimize one of the Portlet instances, both instances
minimize.

I realize that HelloVelocity is probably a simple example and probably is
intended as a naive implementation, but it raises a question.

Is it possible in the Jetspeed architecture to implement a Portlet such that
if more than 1 of the same Portlet type are placed on the same pane, they
naturally act independently of each other?

I also noticed that the first time I changed the text in the Portlet, it
updated the psml file with the new text (by adding a parameter entry for the
"text" parameter).  From then on, any new text entered never made it to the
psml file.  In fact, on subsequent submissions of new text, the psml file
WAS updated, however, the "text" parameter was set to the first value that I
had entered (not the latest value).

I am hoping that the architecture supports this capability.  If it does, it
may be a good idea for the simple HelloVelocity example to provide an
implemenation that supports more than 1 being placed on the same pane.

Any explanation or guidance would be appreciated.

Thanks,
Chuck

--
Charles D. Johnson

Vice President of Engineering
ViviPort, Inc., North Andover, Massachusetts USA
978.686.0096 | cdjohns@viviport.com | www.viviport.com


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


Re: Multiple portlets of the same type

Posted by Raphaël Luta <ra...@networks.groupvu.com>.
Chuck Johnson wrote:

> So, I'm not crazy!  ;-)
> 
> To me, it makes sense that the "Portlet Name" really represents the "type"
> of the Portlet.  A particular Portlet defined with it's parameters has a
> particular set of behaviors that represent that Portlet type.
> 
> 
> 
>>This issue is twofold:
>>- the first issue is Portlet-Action interaction:
>>   Currently Jetspeed does not implement at the 'engine' level a portlet
>>   parameter recognition that allows to uniformly identify the requested
>>   portlet. Each code that wishes to identify a portlet uses a parameter
>>   convention on its own (usually 'portlet').
>>
>>   This is easy to change (and is on my small tasks list): now
>>that Jetspeed
>>   has its own RunData interface, I'll add a new method to the
>>JetspeedRunData
>>
>>
>>   public String getPortlet()
>>   public void setPortlet(String portletName)
>>
>>   and update the sesion validator to detect if any portlet is required by
>>   the portlet parameter and put it into the RunData.
>>   This will provide uniform requested portlet info for all the
>>Jetspeed code
>>   (customizer, portlet, control, etc...) so that we won't need to bother
>>   about parameter parsing and will allow the JetspeedLink
>>utility class to
>>   automatically create portlet-specific URL to include in forms.
>>
>>
>>
> 
> If I place more than one of a given Portlet Type in the same Portlet Set,
> these should be considered different Portlet instances of the same Portlet
> Type.  It seems that the "engine" needs the ability to identify a particular
> Portlet instance, perhaps by an InstanceID, in order to provide the ability
> to route actions to a particular Portlet instance.
> 
> 


yes, but it's related to the second issue


> 
>>- the second issue is much trickier:
>>
>>   historically the PortletFactory assigned to the Portlet the name of its
>>   parent registry entry (and in fact did not keep a 'Parent'
>>reference field),
>>   thus whenever you use portlet.getName() you actually retrieve
>>the parent
>>   name.
>>   This means that if you include 2 portlets with the same parent
>>in a PSML
>>   page you get some weird behaviors because the system thinks
>>they have the
>>   same name.
>>   I've already prepared the work to fix this since I've added a
>>new PSML field
>>   in entry for storing the local portlet name but I've not yet
>>modified the
>>   PortletFactory and PortalToolkit to take advantage of this. Why ?
>>
>>   Because, throughout Jetspeed there are some portlet.getName()
>>calls which some
>>   times mean <get local instance portlet name> but some times
>><get portlet
>>   parent registry name>, thus activating this feature would
>>require to audit all
>>   the portlet.getName() calls and determine whether they belong
>>to the first or
>>   second category.
>>
> 
> Perhaps if "name" was left alone to represent the "type" of the Portlet, the
> PortletFactory could assign a dynamic, unique ID to each Portlet instance in
> the factory.  Portlet specific URLs could include this unique ID.  Another
> approach would be to simply allow the specification of the ID in the PSML
> file.  In other words, keep it as a separate concept from the Portlet Name
> and avoid the potential conflicts in the code.
> 
> 


We would still have to go other all the getName() calls to check whether they
should be kept or changed to getId(). Whatever the method (using getName() and
getParent() or getName() and getId()), there's the same amount of work required
to implement it...


> 
> Obviously, all bets are off with this configuration, but here is what
> happened in case it's faulty behavior:
> 
> I have 2 entries in default.psml for the same HelloVelocity portlet.
> 
> When I render the page, I see the 2 instances.
> 
> I make a change to the text in Portlet 1 (on the left) and it updates the
> .psml file (the first entry in the psml file)
> 
> I make a change to the text using Portlet 2 (on the right) and it updates
> the .psml file (again, the first entry in the psml file)
> 
> Now, making a change to Portlet 1 will no longer properly update the psml
> file.  In fact, it will always produce the value that was first set in
> Portlet 2 in the psml file.
> 
> No other changes to either Portlet will take effect in the psml file.



Which platform/container/etc... ?


> 
> This is probably just bizarre behavior based on the fact that the current
> implementation is confused by the 2 Portlets of the same type.
> 


It's not that the engine is confused, it's just that the search algorithm 

for PSML entries will always use the first entry found in a given name.

--
Raphael Luta - raphael.luta@networks.groupvu.com
Vivendi Universal Networks - Paris


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


RE: Multiple portlets of the same type

Posted by Chuck Johnson <cd...@viviport.com>.
So, I'm not crazy!  ;-)

To me, it makes sense that the "Portlet Name" really represents the "type"
of the Portlet.  A particular Portlet defined with it's parameters has a
particular set of behaviors that represent that Portlet type.


>
> This issue is twofold:
> - the first issue is Portlet-Action interaction:
>    Currently Jetspeed does not implement at the 'engine' level a portlet
>    parameter recognition that allows to uniformly identify the requested
>    portlet. Each code that wishes to identify a portlet uses a parameter
>    convention on its own (usually 'portlet').
>
>    This is easy to change (and is on my small tasks list): now
> that Jetspeed
>    has its own RunData interface, I'll add a new method to the
> JetspeedRunData
>
>
>    public String getPortlet()
>    public void setPortlet(String portletName)
>
>    and update the sesion validator to detect if any portlet is required by
>    the portlet parameter and put it into the RunData.
>    This will provide uniform requested portlet info for all the
> Jetspeed code
>    (customizer, portlet, control, etc...) so that we won't need to bother
>    about parameter parsing and will allow the JetspeedLink
> utility class to
>    automatically create portlet-specific URL to include in forms.
>
>

If I place more than one of a given Portlet Type in the same Portlet Set,
these should be considered different Portlet instances of the same Portlet
Type.  It seems that the "engine" needs the ability to identify a particular
Portlet instance, perhaps by an InstanceID, in order to provide the ability
to route actions to a particular Portlet instance.


> - the second issue is much trickier:
>
>    historically the PortletFactory assigned to the Portlet the name of its
>    parent registry entry (and in fact did not keep a 'Parent'
> reference field),
>    thus whenever you use portlet.getName() you actually retrieve
> the parent
>    name.
>    This means that if you include 2 portlets with the same parent
> in a PSML
>    page you get some weird behaviors because the system thinks
> they have the
>    same name.
>    I've already prepared the work to fix this since I've added a
> new PSML field
>    in entry for storing the local portlet name but I've not yet
> modified the
>    PortletFactory and PortalToolkit to take advantage of this. Why ?
>
>    Because, throughout Jetspeed there are some portlet.getName()
> calls which some
>    times mean <get local instance portlet name> but some times
> <get portlet
>    parent registry name>, thus activating this feature would
> require to audit all
>    the portlet.getName() calls and determine whether they belong
> to the first or
>    second category.

Perhaps if "name" was left alone to represent the "type" of the Portlet, the
PortletFactory could assign a dynamic, unique ID to each Portlet instance in
the factory.  Portlet specific URLs could include this unique ID.  Another
approach would be to simply allow the specification of the ID in the PSML
file.  In other words, keep it as a separate concept from the Portlet Name
and avoid the potential conflicts in the code.

>
>    I don't have currently the time to do this on my own, so
> unless someone is
>    willing to give an hand on the issue, it'll wait and I'll put in the
>    release notes of 1.3a2 that it does not allow multiple instances of a
>    specific portlet registry entry within the same PSML file.
>
>
> > I also noticed that the first time I changed the text in the Portlet, it
> > updated the psml file with the new text (by adding a parameter
> entry for the
> > "text" parameter).  From then on, any new text entered never
> made it to the
> > psml file.  In fact, on subsequent submissions of new text, the
> psml file
> > WAS updated, however, the "text" parameter was set to the first
> value that I
> > had entered (not the latest value).
> >
>
>
> I can't reproduce this behavior, can you give me some more information on
> your setup ?

Obviously, all bets are off with this configuration, but here is what
happened in case it's faulty behavior:

I have 2 entries in default.psml for the same HelloVelocity portlet.

When I render the page, I see the 2 instances.

I make a change to the text in Portlet 1 (on the left) and it updates the
.psml file (the first entry in the psml file)

I make a change to the text using Portlet 2 (on the right) and it updates
the .psml file (again, the first entry in the psml file)

Now, making a change to Portlet 1 will no longer properly update the psml
file.  In fact, it will always produce the value that was first set in
Portlet 2 in the psml file.

No other changes to either Portlet will take effect in the psml file.

This is probably just bizarre behavior based on the fact that the current
implementation is confused by the 2 Portlets of the same type.

Thanks,
Chuck

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


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


Re: Multiple portlets of the same type

Posted by Raphaël Luta <ra...@networks.groupvu.com>.
Chuck Johnson wrote:

> Hello all,
> 
> I am in the process of learning the latest Jetspeed and I have a question
> about placing multiple portlets on the same pane.
> 


Ouch... :(


> I was looking at the "HelloVelocity" Portlet example and trying to
> understand how the actions worked and it struck me as odd that the target
> URL for the form it generates appeared to submit to the overall "portal"
> target (instead of to a specific Portlet).  In addition, the action
> specified in the form was not specific to a given Portlet instance.
> 
> As a test, I placed 2 instances of the HelloVelocity Portlet on the same
> pane.  I see what I would consider "odd" behavior.
> 
> First, when I submit a change to the text, both portlets are updated with
> the text on the screen.
> 
> Second, when I minimize one of the Portlet instances, both instances
> minimize.
> 


This issue is twofold:
- the first issue is Portlet-Action interaction:
   Currently Jetspeed does not implement at the 'engine' level a portlet
   parameter recognition that allows to uniformly identify the requested
   portlet. Each code that wishes to identify a portlet uses a parameter
   convention on its own (usually 'portlet').

   This is easy to change (and is on my small tasks list): now that Jetspeed
   has its own RunData interface, I'll add a new method to the JetspeedRunData


   public String getPortlet()
   public void setPortlet(String portletName)

   and update the sesion validator to detect if any portlet is required by
   the portlet parameter and put it into the RunData.
   This will provide uniform requested portlet info for all the Jetspeed code
   (customizer, portlet, control, etc...) so that we won't need to bother
   about parameter parsing and will allow the JetspeedLink utility class to
   automatically create portlet-specific URL to include in forms.


- the second issue is much trickier:

   historically the PortletFactory assigned to the Portlet the name of its
   parent registry entry (and in fact did not keep a 'Parent' reference field),
   thus whenever you use portlet.getName() you actually retrieve the parent
   name.
   This means that if you include 2 portlets with the same parent in a PSML
   page you get some weird behaviors because the system thinks they have the
   same name.
   I've already prepared the work to fix this since I've added a new PSML field
   in entry for storing the local portlet name but I've not yet modified the
   PortletFactory and PortalToolkit to take advantage of this. Why ?

   Because, throughout Jetspeed there are some portlet.getName() calls which some
   times mean <get local instance portlet name> but some times <get portlet
   parent registry name>, thus activating this feature would require to audit all
   the portlet.getName() calls and determine whether they belong to the first or
   second category.

   I don't have currently the time to do this on my own, so unless someone is
   willing to give an hand on the issue, it'll wait and I'll put in the
   release notes of 1.3a2 that it does not allow multiple instances of a
   specific portlet registry entry within the same PSML file.


> I realize that HelloVelocity is probably a simple example and probably is
> intended as a naive implementation, but it raises a question.
> 
> Is it possible in the Jetspeed architecture to implement a Portlet such that
> if more than 1 of the same Portlet type are placed on the same pane, they
> naturally act independently of each other?
> 
> I also noticed that the first time I changed the text in the Portlet, it
> updated the psml file with the new text (by adding a parameter entry for the
> "text" parameter).  From then on, any new text entered never made it to the
> psml file.  In fact, on subsequent submissions of new text, the psml file
> WAS updated, however, the "text" parameter was set to the first value that I
> had entered (not the latest value).
> 


I can't reproduce this behavior, can you give me some more information on
your setup ?

--
Raphael Luta - raphael.luta@networks.groupvu.com
Vivendi Universal Networks - Paris


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