portals-jetspeed-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetsp...@theunderground.net
Subject Re: Retrieving a portlet's unique instance ID..
Date Mon, 23 Jan 2006 21:02:35 GMT
Thanks for the reply.  But I had a question about one of your points..

> A portlet isn't really supposed to know about its 'unique id' as that is
> an implementation detail of the portal.

Perhaps the reason I encountered this problem is because I'm not thinking
about the design in the correct way.  What are thoughts on the following
situation:

A generic Content Display Portlet (CDP) is to be created.  The requirement
are that, whenever the CDP is added to a page, it will automatically
create a new 'block' of content in the content management system that's
associated to this individual CDP.

The only way I can think of tackling that requirement would be for the
portlet to be aware of some unique ID.  Then, in the render method (the
first method to be executed), the portlet tries accessing the content
repository with it's unique ID.  If the request fails, the portlet knows
to create a new content object.  If the request succeeds, the portlet
knows to display the content.  This 'unique key' could be done via portlet
preferences, but then there would be an extra customizing step that would
need to be performed after the portlet was added to a page (by the user
clicking the Edit mode and then manually typing a unique string).

Anyone out there have thoughts on this?  Am I thinking about this
incorrectly, or is this a time when a portlet has a legitimate reason for
fetching a unique identifier?

-Ben


>> Wiadomosc od jetspeed@theunderground.net z 2006-01-22 05:19 brzmiala:
>>
>>> Is there a way to get a portlet instance's unique ID without using the
>>> request object (namely, from the portlet init() method)?
>>
>> As far as I know, init() is common for the whole portlet lifecycle (all
>> instances) and is called at the webapp initialization (once for a
>> restart/deployment), while the unique fragmend ID appears at each
>> rendering the portlet (and it it constant as long as it is not changed
>> in PSML).
>>
>> In order to get access to all fragments use ContentPage and
>> ContentFragment implementations (getType() method to identify portlets)
>> and recurse through your portal structure parsing each .psml file.
>>
> A portlet isn't really supposed to know about its 'unique id' as that is
> an implementation detail of the portal.
>
> If you want to write portlets specific to Jetspeed-2, have a look at the
> j2-admin app which accesses portal services in the jetspeed-portlet.xml
>
> <js:services>
>          <js:service name='PageManager'/>
>          <js:service name='PermissionManager'/>
>          <js:service name='PortalAdministration'/>
> ...
> </js:services>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>


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


Mime
View raw message