cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simeon Penev" <simeon_pe...@web.de>
Subject Re: Interportlet communication
Date Tue, 26 Apr 2005 17:05:03 GMT
Hi Nick,

thank you for your fast response, i appreciate that! As for your proposals, i would prefer
using events in the java code. That's because i want to be able to easily change the event
handling if some coplet's logics change. In other words - to handle the event and generate
the output in the same java class. I was looking at the basket example in the portal block,
where i saw this concept in use. But what i didn't understand was when the component (the
subscriber) is instantiated. Is it done per user session or once, after cocoon starts?

Is it possible to use this type of event handling in JSR-168 Portlets? As far as i see i must
create a pipeline per coplet ( generator ).  This is some more general question - in terms
of stability, performance and scalability, is it better to write generators or use portlets?
I read taht  the portlet integration in cocoon is still under development and is not that
stable?

Best regards,
Simeon Penev

users@cocoon.apache.org schrieb am 26.04.05 17:17:56:
> 
> Hi Simeon,
> 
> That's pretty easy to pass information (not events) between coplets. 
> There is of course default ways of doing it with cl:link stuff. Just 
> check the sample portal, image gallery coplets. I think that this is a 
> bit tedious and not particularly convenient if flow is available.
> 
> With flow, that's how info can be passed
> 
> 1) get portal service and set portal name there
> 2) get portal component manager
> 3) get profile manager
> 4) get coplet instance data
> 5) set any attributes in this coplet instance data
> 
> They can later be used in the sitemap for example by putting something 
> like that:
> <map:parameter name="textID" value="{coplet:attributes/textID}"/>
> 
> here is flow code:
> 
> var service = null;
> try {
>    // get portal service
>    service = cocoon.getComponent(
> 	org.apache.cocoon.portal.PortalService.ROLE);
>    service.setPortalName("portal");
> 
>    // get profile manager
>    var componentManager = service.getComponentManager();
>    var profileManager = componentManager.getProfileManager();
> 
>    var cid = profileManager.getCopletInstanceData(copletId);
>    // ADD OR REMOVE ANY ATTRIBUTES HERE
>    // CHECK API FOR CopletInstanceData
> } catch ( e ) {
>    cocoon.log.info("Error");
> }
> finally {
>    cocoon.releaseComponent( service );
> }
> 
> Working with events is more complicated. Coplets are not themselves 
> components so it's merely impossible to subscribe them for an event. You 
> will need a cocoon component that implements publisher or subscriber 
> interface. It will perform event processing. Here is what needs to be done:
> 
> 1) create a new portal event type (or reuse some of the existing ones). 
> it should hold all the necessary information for the step (2)
> 2) create new cocoon component that will be responsible for 
> publishing/subscribing to the events from (1)
> 3) register component from (2) with the portal event manager (can be 
> done at the run time)
> 
> Now you are ready for working with events. Please refer to the cocoon 
> web site for the details how to carry out the actual processing (i.e. 
> fire them off, publish, subscribe, etc.)
> 
> General hints are:
> 1) if you need to fire event immediately - just publish it
> 2) if you need to fire event on *any* click in the portal - use link 
> service to add event to the link
> 3) if you need to fire event only in case of a particular link click - 
> that's where it got tricky for me. I use link service to get the event 
> encoded as a string. then I pass this string to a coplet where it's 
> placed into an <a> html tag.
> 
> I worked with this stuff quite a bit of time ago (I used cocoon 2.1.5), 
> so chances are that I missed something and something changed in the 
> latest version of cocoon. I also hope that there are better ways of 
> doing the stuff I described. Some feed back is greatly appreciated.
> 
> Thank you.
> 
> Sincerely,
> Nick Goupinets.
> 
> Simeon Penev wrote:
> > Hi,
> > 
> > I've read  in the 'Event handling' section of the 'Portal engine' documentation
that there is a way to pass 
> 
> events between portlets. How can i do that? Could someone provide an 
> example?
> > 
> > I've seen they are methods in the ManagedCocoonPortlet.java processAction and render,
which are used 
> 
> to deliver content to the portal. The problem is i cannot find a way to 
> invoke them by
> 
> clicking on a link inside other portlet. What i am trying to accomplish 
> is to have
> 
> the portlets subscribed to a certain type of event, as it is done with 
> the cocoon components using
> 
> the Subscriber interface.
> > 
> > 
> > Thank you for your help in advance!
> > 
> > Best regards,
> > Simeon 
> > __________________________________________________________
> > Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
> > weltweit telefonieren! http://freephone.web.de/?mc=021201
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message