001: package org.gridsphere.portletcontainer;
002:
003: import org.gridsphere.layout.event.PortletWindowEvent;
004:
005: import javax.servlet.http.HttpServletRequest;
006: import javax.servlet.http.HttpServletResponse;
007:
008: /**
009: * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a>
010: * @version $Id: PortletDispatcher.java 6408 2008-01-25 13:38:39Z docentt $
011: */
012: public interface PortletDispatcher {
013:
014: /**
015: * Called by the portlet container to indicate to this portlet that it is put into service.
016: * <p/>
017: * The portlet container calls the init() method for the whole life-cycle of the portlet.
018: * The init() method must complete successfully before concrete portlets are created through
019: * the initConcrete() method.
020: * <p/>
021: * The portlet container cannot place the portlet into service if the init() method
022: * <p/>
023: * 1. throws UnavailableException
024: * 2. does not return within a time period defined by the portlet container.
025: *
026: * @param req the servlet request
027: * @param res the servlet response
028: * @throws PortletDispatcherException if an exception has occurrred during dispatching
029: */
030: public void init(HttpServletRequest req, HttpServletResponse res)
031: throws PortletDispatcherException;
032:
033: /**
034: * Called by the portlet container to indicate to this portlet that it is to be loaded.
035: *
036: * @param req the servlet request
037: * @param res the servlet response
038: * @throws PortletDispatcherException if an exception has occurrred during dispatching
039: */
040: public void load(HttpServletRequest req, HttpServletResponse res)
041: throws PortletDispatcherException;
042:
043: /**
044: * Called by the portlet container to indicate to this portlet that it is taken out of service.
045: * This method is only called once all threads within the portlet's service() method have exited
046: * or after a timeout period has passed. After the portlet container calls this method,
047: * it will not call the service() method again on this portlet.
048: * <p/>
049: * This method gives the portlet an opportunity to clean up any resources that are
050: * being held (for example, memory, file handles, threads).
051: *
052: * @param req the servlet request
053: * @param res the servlet response
054: * @throws PortletDispatcherException if an exception has occurrred during dispatching
055: */
056: public void destroy(HttpServletRequest req, HttpServletResponse res)
057: throws PortletDispatcherException;
058:
059: /**
060: * Called by the portlet container to ask this portlet to generate its markup using the given
061: * request/response pair. Depending on the mode of the portlet and the requesting client device,
062: * the markup will be different. Also, the portlet can take language preferences and/or
063: * personalized settings into account.
064: *
065: * @param render the default portlet render
066: * @param req the servlet request
067: * @param res the servlet response
068: * @throws PortletDispatcherException if an exception has occurrred during dispatching
069: */
070: public void service(DefaultPortletRender render,
071: HttpServletRequest req, HttpServletResponse res)
072: throws PortletDispatcherException;
073:
074: /**
075: * Performs a portlet login dispatch request.
076: *
077: * @param req the servlet request
078: * @param res the servlet response
079: * @throws PortletDispatcherException if an exception has occurrred during dispatching
080: */
081: public void login(HttpServletRequest req, HttpServletResponse res)
082: throws PortletDispatcherException;
083:
084: /**
085: * Performs a portlet logout dispatch request.
086: *
087: * @param req the servlet request
088: * @param res the servlet response
089: * @throws PortletDispatcherException if an exception has occurrred during dispatching
090: */
091: public void logout(HttpServletRequest req, HttpServletResponse res)
092: throws PortletDispatcherException;
093:
094: /**
095: * Called by the portlet container to ask this portlet to perform the required operational logic
096: * using the given portlet request.
097: * Notifies this listener that the action which the listener is watching for has been performed.
098: *
099: * @param action the default portlet action
100: * @param req the servlet request
101: * @param res the servlet response
102: * @throws PortletDispatcherException if an exception has occurrred during dispatching
103: */
104: public void actionPerformed(DefaultPortletAction action,
105: HttpServletRequest req, HttpServletResponse res)
106: throws PortletDispatcherException;
107:
108: /**
109: * Called by the portlet container to render the portlet title.
110: * The information in the portlet request (like locale, client, and session information) can
111: * but doesn't have to be considered to render dynamic titles.. Examples are
112: * <p/>
113: * language-dependant titles for multi-lingual portals
114: * shorter titles for WAP phones
115: * the number of messages in a mailbox portlet
116: * The session may be null, if the user is not logged in.
117: *
118: * @param req the servlet request
119: * @param res the servlet response
120: * @throws PortletDispatcherException if an exception has occurrred during dispatching
121: */
122: public void doTitle(HttpServletRequest req, HttpServletResponse res)
123: throws PortletDispatcherException;
124:
125: /**
126: * Notifies this listener that a portlet window has been maximized.
127: *
128: * @param event the window event
129: * @param req the servlet request
130: * @param res the servlet response
131: * @throws PortletDispatcherException if an exception has occurrred during dispatching
132: */
133: public void windowEvent(PortletWindowEvent event,
134: HttpServletRequest req, HttpServletResponse res)
135: throws PortletDispatcherException;
136:
137: }
|