1 2 3 Previous Next 33 Replies Latest reply on May 17, 2005 9:02 AM by dajevtic

    Portlet intercommunication

    sven.schulz

      Is there any facility or mechanism to implement interportlet communication in JBoss Portal RC. If not is there any best practice available. If neither the first nor the second holds, how can it be implemented?

        • 1. Re: Portlet intercommunication

          you mean have a portlet linking to another portlet ?

          • 2. Re: Portlet intercommunication
            kevs3d

            Hi,

            There isn't any way as part of the JSR-168 portlet spec, which the JBoss Portal is implemented against. However, it's so useful that the JBoss guys may have implemented an extension specific to their APIs - but I don't know what.

            The way we did it (back in the days of the Alpha version) was to construct JBoss portal specific URLs. E.g. the way JBoss portal references portlets is through a defined URL format, so if you construct the URLs appropriately you can get other portlets to maximise:

            http://localhost:8080/portal/index.html?ctrl:id=window.default.CMSPortletWindow&ctrl:type=nav&ctrl:windowstate=maximized

            So if you know the window ID of your portlet (from your XML config) then you can construct a URL to bring it to the front.

            You can call portlet actions directly using URLs also. So if you code up a URL with an action request in it, e.g.
            http://localhost:8080/portal/index.html?ctrl:id=window.default.UserPortletWindow1&ctrl:type=render&ctrl:windowstate=maximized&op=showRegister

            Add that as the HREF of a link within one portlet, and when clicked it will call an action within another, in this case calling the "showRegister" portlet action event handler on the UserPortlet.

            Obviously this requires specific knowledge of the JBoss portal and also knowledge of what portlet Window IDs you have - but it works.

            Hope this helps,

            Cheers,

            Kev

            • 3. Re: Portlet intercommunication
              sven.schulz

              What I mean is to notify a portlet of changes in another portlet. Suppose you have a portlet that presents a tree of elements. When a user selects one of the elements by clicking on it, a view in another portlet should be updated containing the details of the selected element (Master/Detail).

              • 4. Re: Portlet intercommunication

                I think we are going to do something for 2.0.1 or 2.2.

                • 5. Re: Portlet intercommunication

                  ok, I am asking because portlet communication means a lot of different things for people and the one I said is the most requested.

                  what is the scope of event delivery ? per user ? could you describe it ?

                  • 6. Re: Portlet intercommunication
                    sven.schulz

                    Think of the Windows Explorer. There is a tree showing the directory structure and a detail view showing the contents of the selected folder. Now imagine that you would implement such an explorer within a portal (not necessarily for file systems). One way is to provide a portal for the tree structure and one for the detail view. When a user (so, yes the scope is per user) selects an element in the tree portal, the detail portal view is updated to show the details (e.g. files) of the element.

                    What I think of is some kind of messaging. I think a phased approach would be beneficial. In one of the phases portals may emit messages to channels. In a subsequent phase those messages may be received by polling the channels.

                    • 7. Re: Portlet intercommunication
                      paulhh

                      For reference, here's a response from the end of last year with respect to JSR-168:

                      http://mail-archives.apache.org/mod_mbox/portals-pluto-dev/200411.mbox/%3c4194D221.3090604@apache.org%3ehe.org/mod_mbox/portals-pluto-dev/200411.mbox/%3c4194D221.3090604@apache.org%3e

                      I think what you're looking for could be addressed in the next version of the standard. Meanwhile, most portals have their own different ways of doing this.

                      Cheers
                      Phh.

                      • 8. Re: Portlet intercommunication

                        I ran into this same limitation in the JSR-168 spec. the functionality was important enough to me that i found a workaround for it, and one that is not specific to JBP. If you have two portlets in a portlet-app then they share application scope session attributes. I have a navigation portlet in the left column, and a view portlet as the main content. My navigation consists of ActionURL links, sending a param for which page to view. The processAction stores the page to view in the session attribute. When each of the portlets go thru their doView rendering, the session attribute is set and they display based on that. So the navigation portlet can show which page the user is on, and the main content portlet can display the page that was chosen.

                        It's not the most elegant approach, but it's working so far. I would also like for the spec to expand to impliment some form of interportlet communication, but for now i'll just use session attributes. ... .joe

                        • 9. Re: Portlet intercommunication
                          sven.schulz

                          I consider to implement a Interportlet communication (IPC) service, that is event based. Any input is much appreciated.

                          I will post a little architecture description tomorrow.

                          • 10. Re: Portlet intercommunication
                            fernir

                            There is a another specification that defines a contract between portal consumer and portlet consumer for remote portlets utilizing soap - WSRP (http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsrp). Second version of this specification that have been discussed now introduces event handling mechanism that will allow consumer to distribute events to any portlet and any portlet to generate events as a result of perform action or event distribution call. My suggestion would be to use this specification as a guide line for even support architecture.

                            • 11. Re: Portlet intercommunication
                              sven.schulz

                              Hi fernir,

                              is there a spec. draft available already. Where can I find it? Hope this spec. is not to complex, since implementing a complex system would be not that beneficial in the face of an emerging JSR-168 successor.

                              • 12. Re: Portlet intercommunication

                                WSRP 2.0 will be implemented in JBoss Portal in the next version - 2.2. Our Novell team will be handling the ins and outs, since I stubbornly refuse to read the WSRP spec. ;-)

                                • 13. Re: Portlet intercommunication
                                  fernir

                                  There is no public draft of WSRP 2.0 specification. You will have to join WSRP TC group.

                                  • 14. Re: Portlet intercommunication
                                    dajevtic

                                    Hi. There may be no standard, but this code works just fine for us. Define a class to which all portlets have access and change it according to your needs:


                                    import java.util.Hashtable;

                                    public class InterPortletCommManager {

                                    private static InterPortletCommManager thisMgr = null;
                                    private Hashtable something;

                                    private InterPortletCommManager() {
                                    try {
                                    something = new Hashtable();
                                    // do any initialization of local variables here
                                    }
                                    catch (Exception ex) {

                                    }
                                    }

                                    public static InterPortletCommManager getInstance() {
                                    if (thisMgr == null) {
                                    thisMgr = new InterPortletCommManager();
                                    }
                                    return thisMgr;
                                    }

                                    public Object getObject(String portletId) {
                                    // retrieve an Object by using a portlet ID
                                    return something.get(portletId);
                                    }

                                    public void setObject(String portletId, Object someObject) {
                                    // use the ID of a portlet as a key for the object to be stored
                                    something.put(portletId, someObject);
                                    }

                                    }

                                    with InterPortletCommManager.getInstance() all portlets have access to the Vector "something". Of course you can create other methods and other objects to use amongst all portlets.

                                    Hope it helps. Regards, dj

                                    1 2 3 Previous Next