]> source.dussan.org Git - vaadin-framework.git/commitdiff
Much redesigned portal integration; not-quite working yet...
authorMarc Englund <marc.englund@itmill.com>
Fri, 11 Apr 2008 14:08:28 +0000 (14:08 +0000)
committerMarc Englund <marc.englund@itmill.com>
Fri, 11 Apr 2008 14:08:28 +0000 (14:08 +0000)
svn changeset:4164/svn branch:trunk

WebContent/WEB-INF/liferay-display.xml
WebContent/WEB-INF/liferay-portlet.xml
WebContent/WEB-INF/portlet.xml
portlet-src/com/itmill/tookit/demo/PortletDemo.java [new file with mode: 0644]
portlet-src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java
portlet-src/com/itmill/toolkit/terminal/gwt/server/PortletApplicationContext.java

index d92c1b4397e3a69ad3bb7bebe35b38f4cdff049c..8ba4a93f7f02d5f1d0e96d59187a933d2bff1c50 100644 (file)
@@ -3,6 +3,8 @@
 \r
 <display>\r
        <category name="IT Mill Toolkit">\r
-               <portlet id="ApplicationPortlet" />\r
+               <portlet id="PortletDemo" />\r
+               <portlet id="Calc" />\r
+               <portlet id="FeatureBrowser" />\r
        </category>\r
 </display>
\ No newline at end of file
index 5af07be367ff27036efa1f7d959fc9897d56c42e..d445af65a7f508060ad31995686285de9d4ccc1e 100644 (file)
@@ -4,7 +4,17 @@
 <liferay-portlet-app>\r
 \r
        <portlet>\r
-               <portlet-name>ApplicationPortlet</portlet-name>\r
+               <portlet-name>PortletDemo</portlet-name>\r
+               <instanceable>true</instanceable>       \r
+               <ajaxable>false</ajaxable>\r
+       </portlet>\r
+       <portlet>\r
+               <portlet-name>Calc</portlet-name>\r
+               <instanceable>true</instanceable>       \r
+               <ajaxable>false</ajaxable>\r
+       </portlet>\r
+       <portlet>\r
+               <portlet-name>FeatureBrowser</portlet-name>\r
                <instanceable>true</instanceable>       \r
                <ajaxable>false</ajaxable>\r
        </portlet>\r
index 3f414ab07b7f50ff36a0ec600ae7f8020b34ebf1..e0b00b5dae600d0e117532c27294dedf2eeaca7b 100644 (file)
@@ -5,9 +5,13 @@
        xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">\r
 \r
        <portlet>\r
-               <portlet-name>ApplicationPortlet</portlet-name>\r
-               <display-name>IT Mill Toolkit Portlet</display-name>\r
+               <portlet-name>PortletDemo</portlet-name>\r
+               <display-name>IT Mill Toolkit PortletDemo</display-name>\r
                <portlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationPortlet</portlet-class>\r
+               <init-param>\r
+                       <name>application</name>\r
+                       <value>PortletDemo</value>\r
+               </init-param>\r
                <supports>\r
                        <mime-type>text/html</mime-type>\r
                        <portlet-mode>view</portlet-mode>\r
             <portlet-mode>help</portlet-mode>\r
                </supports>\r
                <portlet-info>\r
-                       <title>IT Mill Toolkit ApplicationPortlet</title>\r
-                       <short-title>ApplicationPortlet</short-title>\r
+                       <title>IT Mill Toolkit PortletDemo</title>\r
+                       <short-title>PortletDemo</short-title>\r
+               </portlet-info>\r
+               \r
+               <security-role-ref>\r
+                       <role-name>administrator</role-name>\r
+               </security-role-ref>\r
+               <security-role-ref>\r
+                       <role-name>guest</role-name>\r
+               </security-role-ref>\r
+               <security-role-ref>\r
+                       <role-name>power-user</role-name>\r
+               </security-role-ref>\r
+               <security-role-ref>\r
+                       <role-name>user</role-name>\r
+               </security-role-ref>\r
+       </portlet>\r
+       <portlet>\r
+               <portlet-name>FeatureBrowser</portlet-name>\r
+               <display-name>IT Mill Toolkit FeatureBrowser</display-name>\r
+               <portlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationPortlet</portlet-class>\r
+               <init-param>\r
+                       <name>application</name>\r
+                       <value>FeatureBrowser</value>\r
+               </init-param>\r
+               <supports>\r
+                       <mime-type>text/html</mime-type>\r
+                       <portlet-mode>view</portlet-mode>\r
+            <portlet-mode>edit</portlet-mode>\r
+            <portlet-mode>help</portlet-mode>\r
+               </supports>\r
+               <portlet-info>\r
+                       <title>IT Mill Toolkit FeatureBrowser</title>\r
+                       <short-title>FeatureBrowser</short-title>\r
+               </portlet-info>\r
+               \r
+               <security-role-ref>\r
+                       <role-name>administrator</role-name>\r
+               </security-role-ref>\r
+               <security-role-ref>\r
+                       <role-name>guest</role-name>\r
+               </security-role-ref>\r
+               <security-role-ref>\r
+                       <role-name>power-user</role-name>\r
+               </security-role-ref>\r
+               <security-role-ref>\r
+                       <role-name>user</role-name>\r
+               </security-role-ref>\r
+       </portlet>\r
+       <portlet>\r
+               <portlet-name>Calc</portlet-name>\r
+               <display-name>IT Mill Toolkit Calc</display-name>\r
+               <portlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationPortlet</portlet-class>\r
+               <init-param>\r
+                       <name>application</name>\r
+                       <value>Calc</value>\r
+               </init-param>\r
+               <supports>\r
+                       <mime-type>text/html</mime-type>\r
+                       <portlet-mode>view</portlet-mode>\r
+            <portlet-mode>edit</portlet-mode>\r
+            <portlet-mode>help</portlet-mode>\r
+               </supports>\r
+               <portlet-info>\r
+                       <title>IT Mill Toolkit Calc</title>\r
+                       <short-title>Calc</short-title>\r
                </portlet-info>\r
                \r
                <security-role-ref>\r
diff --git a/portlet-src/com/itmill/tookit/demo/PortletDemo.java b/portlet-src/com/itmill/tookit/demo/PortletDemo.java
new file mode 100644 (file)
index 0000000..7e57132
--- /dev/null
@@ -0,0 +1,90 @@
+/**\r
+ * \r
+ */\r
+package com.itmill.tookit.demo;\r
+\r
+import javax.portlet.ActionRequest;\r
+import javax.portlet.ActionResponse;\r
+import javax.portlet.PortletMode;\r
+import javax.portlet.PortletURL;\r
+import javax.portlet.RenderRequest;\r
+import javax.portlet.RenderResponse;\r
+import javax.portlet.WindowState;\r
+\r
+import com.itmill.toolkit.Application;\r
+import com.itmill.toolkit.terminal.ExternalResource;\r
+import com.itmill.toolkit.terminal.gwt.server.PortletApplicationContext;\r
+import com.itmill.toolkit.terminal.gwt.server.PortletApplicationContext.PortletListener;\r
+import com.itmill.toolkit.ui.Link;\r
+import com.itmill.toolkit.ui.TextField;\r
+import com.itmill.toolkit.ui.Window;\r
+import com.itmill.toolkit.ui.Window.Notification;\r
+\r
+/**\r
+ * @author marc\r
+ * \r
+ */\r
+public class PortletDemo extends Application {\r
+\r
+    Window main = new Window();\r
+    TextField tf = new TextField();\r
+    Link portletEdit = new Link();\r
+    Link portletMax = new Link();\r
+\r
+    public void init() {\r
+        main = new Window();\r
+        tf.setEnabled(false);\r
+        main.addComponent(tf);\r
+\r
+        portletEdit.setCaption("Portlet edit/view");\r
+        portletEdit.setEnabled(false);\r
+        main.addComponent(portletEdit);\r
+        portletMax.setCaption("Maximize/normal portlet");\r
+        portletMax.setEnabled(false);\r
+        main.addComponent(portletMax);\r
+\r
+        PortletApplicationContext ctx = (PortletApplicationContext) getContext();\r
+\r
+        ctx.addPortletListener(this, new DemoPortletListener());\r
+    }\r
+\r
+    private class DemoPortletListener implements PortletListener {\r
+\r
+        public void handleActionRequest(ActionRequest request,\r
+                ActionResponse response) {\r
+\r
+            getMainWindow().showNotification("Action received");\r
+\r
+        }\r
+\r
+        public void handleRenderRequest(RenderRequest request,\r
+                RenderResponse response) {\r
+            getMainWindow().showNotification(\r
+                    "Portlet status",\r
+                    "mode: " + request.getPortletMode() + "<br/> state: "\r
+                            + request.getWindowState(),\r
+                    Notification.TYPE_TRAY_NOTIFICATION);\r
+\r
+            PortletURL url = response.createActionURL();\r
+            try {\r
+                url\r
+                        .setPortletMode((request.getPortletMode() == PortletMode.VIEW ? PortletMode.EDIT\r
+                                : PortletMode.VIEW));\r
+                portletEdit.setResource(new ExternalResource(url.toString()));\r
+            } catch (Exception e) {\r
+                portletEdit.setEnabled(false);\r
+            }\r
+\r
+            url = response.createActionURL();\r
+            try {\r
+                url\r
+                        .setWindowState((request.getWindowState() == WindowState.NORMAL ? WindowState.MAXIMIZED\r
+                                : WindowState.NORMAL));\r
+                portletEdit.setResource(new ExternalResource(url.toString()));\r
+            } catch (Exception e) {\r
+                portletEdit.setEnabled(false);\r
+            }\r
+\r
+        }\r
+    }\r
+}\r
index a0c31b1ecf1a41efaf358ebb8f899335f51ef2a9..bb88456059b00a827b4492b0da56fad7797fe7bf 100644 (file)
@@ -2,36 +2,26 @@ package com.itmill.toolkit.terminal.gwt.server;
 \r
 import java.io.IOException;\r
 import java.io.PrintWriter;\r
-import java.util.Map;\r
 \r
 import javax.portlet.ActionRequest;\r
 import javax.portlet.ActionResponse;\r
 import javax.portlet.Portlet;\r
 import javax.portlet.PortletConfig;\r
 import javax.portlet.PortletException;\r
-import javax.portlet.PortletMode;\r
-import javax.portlet.PortletModeException;\r
-import javax.portlet.PortletPreferences;\r
-import javax.portlet.PortletRequest;\r
 import javax.portlet.PortletRequestDispatcher;\r
 import javax.portlet.PortletSession;\r
-import javax.portlet.PortletURL;\r
 import javax.portlet.RenderRequest;\r
 import javax.portlet.RenderResponse;\r
 \r
 import com.itmill.toolkit.Application;\r
-import com.itmill.toolkit.terminal.gwt.server.PortletApplicationContext.PortletInfo;\r
-import com.itmill.toolkit.terminal.gwt.server.PortletApplicationContext.PortletInfoReceiver;\r
 \r
 public class ApplicationPortlet implements Portlet {\r
     // The application to show\r
-    protected String app = "Calc"; // empty for root\r
-    // theme to use for the application\r
-    protected String theme = "default";\r
+    protected String app = "PortletDemo";\r
     // some applications might require that the height is specified\r
     protected String height = null; // e.g "200px"\r
 \r
-    PortletConfig config;\r
+    private PortletConfig config;\r
 \r
     public void destroy() {\r
         config = null;\r
@@ -39,40 +29,27 @@ public class ApplicationPortlet implements Portlet {
 \r
     public void init(PortletConfig config) throws PortletException {\r
         this.config = config;\r
+        app = config.getInitParameter("application");\r
+        if (app == null) {\r
+            app = "PortalDemo";\r
+        }\r
+        height = config.getInitParameter("height");\r
     }\r
 \r
     public void processAction(ActionRequest request, ActionResponse response)\r
             throws PortletException, IOException {\r
-        // Update preferences (configured)\r
-        PortletPreferences prefs = request.getPreferences();\r
-        app = request.getParameter("app");\r
-        if (app != null && app.length() > 0) {\r
-            prefs.setValue("application", app);\r
-        } else {\r
-            app = null;\r
-        }\r
-        String theme = request.getParameter("theme");\r
-        if (theme != null && theme.length() > 0) {\r
-            prefs.setValue("theme", theme);\r
-        } else {\r
-            prefs.setValue("theme", null);\r
-        }\r
-        String height = request.getParameter("height");\r
-        if (height != null && height.length() > 0) {\r
-            prefs.setValue("height", height);\r
-        } else {\r
-            prefs.setValue("height", null);\r
-        }\r
-        prefs.store();\r
+        PortletApplicationContext.dispatchRequest(this, request, response);\r
     }\r
 \r
     public void render(RenderRequest request, RenderResponse response)\r
             throws PortletException, IOException {\r
 \r
+        /*-\r
         PortletPreferences prefs = request.getPreferences();\r
         app = prefs.getValue("application", app);\r
         theme = prefs.getValue("theme", "default");\r
         height = prefs.getValue("height", null);\r
+        -*/\r
 \r
         // display the IT Mill Toolkit application\r
         writeAjaxWindow(request, response);\r
@@ -84,54 +61,38 @@ public class ApplicationPortlet implements Portlet {
         response.setContentType("text/html");\r
         PrintWriter out = response.getWriter();\r
 \r
-        // TODO check user == admin\r
-        if (app == null) {\r
-            // Display the configuration UI\r
-            PortletURL submitUrl = response.createActionURL();\r
-            try {\r
-                submitUrl.setPortletMode(PortletMode.VIEW);\r
-            } catch (PortletModeException e) {\r
-                // Fine\r
-            }\r
-            out.println("<form method='POST' action='" + submitUrl + "'>");\r
-            out.println("Application:");\r
-            out.println(request.getContextPath() + "/");\r
-            out.println("<input size='40' type='text' name='app' value='"\r
-                    + (app != null ? app : "") + "'>");\r
-            out.println(" Theme:<input type='text' name='theme' value='"\r
-                    + theme + "'><br/>");\r
-            out\r
-                    .println("Force height (optional, e.g \"200px\"): <input type='text' name='height' value='"\r
-                            + (height != null ? height : "") + "'><br/>");\r
-            out.println("<input type='submit' value='Save'>");\r
-            out.println("</form>");\r
-        } else {\r
+        if (app != null) {\r
 \r
             PortletSession sess = request.getPortletSession();\r
             PortletApplicationContext ctx = PortletApplicationContext\r
                     .getApplicationContext(sess);\r
 \r
+            /*- TODO store som info somewhere?\r
             PortletInfo pi = ctx.setPortletInfo(request.getContextPath() + "/"\r
                     + app + (app.endsWith("/") ? "" : "/"), request\r
                     .getPortletMode(), request.getWindowState(), request\r
                     .getUserPrincipal(), (Map) request\r
                     .getAttribute(PortletRequest.USER_INFO), config);\r
+            -*/\r
 \r
             PortletRequestDispatcher dispatcher = sess.getPortletContext()\r
                     .getRequestDispatcher("/" + app);\r
 \r
             try {\r
+                // TODO height\r
                 dispatcher.include(request, response);\r
             } catch (PortletException e) {\r
                 out.print("<h1>Servlet include failed!</h1>");\r
                 out.print("<div>" + e + "</div>");\r
+                ctx.setPortletApplication(this, null);\r
                 return;\r
             }\r
 \r
-            Object app = request.getAttribute(Application.class.getName());\r
-            if (app instanceof PortletInfoReceiver) {\r
-                ((PortletInfoReceiver) app).receivePortletInfo(pi);\r
-            }\r
+            Application app = (Application) request\r
+                    .getAttribute(Application.class.getName());\r
+            ctx.setPortletApplication(this, app);\r
+            ctx.firePortletRenderRequest(this, request, response);\r
+\r
         }\r
     }\r
 \r
index a87ff638c24e5df304fee1306a12d0b4e9b3964e..4ddbabdb962fef9d855233f8beff33967428b11f 100644 (file)
  */\r
 package com.itmill.toolkit.terminal.gwt.server;\r
 \r
-import java.io.File;\r
-import java.security.Principal;\r
-import java.util.Collection;\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+import java.io.PrintWriter;\r
 import java.util.HashMap;\r
+import java.util.Iterator;\r
+import java.util.LinkedHashSet;\r
+import java.util.Locale;\r
 import java.util.Map;\r
+import java.util.Set;\r
 \r
-import javax.portlet.PortletConfig;\r
-import javax.portlet.PortletMode;\r
+import javax.portlet.ActionRequest;\r
+import javax.portlet.ActionResponse;\r
+import javax.portlet.Portlet;\r
 import javax.portlet.PortletSession;\r
-import javax.portlet.WindowState;\r
+import javax.portlet.PortletURL;\r
+import javax.portlet.RenderRequest;\r
+import javax.portlet.RenderResponse;\r
 import javax.servlet.http.HttpSession;\r
 \r
 import com.itmill.toolkit.Application;\r
-import com.itmill.toolkit.service.ApplicationContext;\r
 \r
 /**\r
  * @author marc\r
  * \r
  */\r
-public class PortletApplicationContext implements ApplicationContext {\r
+public class PortletApplicationContext extends WebApplicationContext {\r
 \r
-    private final PortletSession session;\r
+    protected PortletSession portletSession;\r
 \r
-    private final Map portletInfoMap;\r
+    protected Map portletListeners = new HashMap();\r
+\r
+    protected Map portletToApplication = new HashMap();\r
+\r
+    PortletApplicationContext() {\r
 \r
-    PortletApplicationContext(PortletSession session) {\r
-        this.session = session;\r
-        portletInfoMap = new HashMap();\r
     }\r
 \r
     static public PortletApplicationContext getApplicationContext(\r
             PortletSession session) {\r
-        PortletApplicationContext cx = (PortletApplicationContext) session\r
-                .getAttribute(PortletApplicationContext.class.getName());\r
+        WebApplicationContext cx = (WebApplicationContext) session\r
+                .getAttribute(WebApplicationContext.class.getName(),\r
+                        PortletSession.APPLICATION_SCOPE);\r
         if (cx == null) {\r
-            cx = new PortletApplicationContext(session);\r
-            session.setAttribute(PortletApplicationContext.class.getName(), cx,\r
-                    PortletSession.APPLICATION_SCOPE);\r
+            cx = new PortletApplicationContext();\r
         }\r
-        return cx;\r
+        if (!(cx instanceof PortletApplicationContext)) {\r
+            // TODO Should we even try this? And should we leave original as-is?\r
+            PortletApplicationContext pcx = new PortletApplicationContext();\r
+            pcx.applications.addAll(cx.applications);\r
+            cx.applications.clear();\r
+            pcx.browser = cx.browser;\r
+            cx.browser = null;\r
+            pcx.listeners = cx.listeners;\r
+            cx.listeners = null;\r
+            pcx.session = cx.session;\r
+            cx = pcx;\r
+        }\r
+        if (((PortletApplicationContext) cx).portletSession == null) {\r
+            ((PortletApplicationContext) cx).portletSession = session;\r
+        }\r
+        session.setAttribute(WebApplicationContext.class.getName(), cx,\r
+                PortletSession.APPLICATION_SCOPE);\r
+        return (PortletApplicationContext) cx;\r
     }\r
 \r
-    static public PortletApplicationContext getApplicationContext(\r
+    static public WebApplicationContext getApplicationContext(\r
             HttpSession session) {\r
-        PortletApplicationContext cx = (PortletApplicationContext) session\r
-                .getAttribute(PortletApplicationContext.class.getName());\r
+        WebApplicationContext cx = (WebApplicationContext) session\r
+                .getAttribute(WebApplicationContext.class.getName());\r
+        if (cx == null) {\r
+            cx = new PortletApplicationContext();\r
+        }\r
+        if (cx.session == null) {\r
+            cx.session = session;\r
+        }\r
+        session.setAttribute(WebApplicationContext.class.getName(), cx);\r
         return cx;\r
     }\r
 \r
+    protected void removeApplication(Application application) {\r
+        portletListeners.remove(application);\r
+        for (Iterator it = portletToApplication.keySet().iterator(); it\r
+                .hasNext();) {\r
+            Object key = it.next();\r
+            if (key == application) {\r
+                portletToApplication.remove(key);\r
+            }\r
+        }\r
+        super.removeApplication(application);\r
+    }\r
+\r
+    public boolean equals(Object obj) {\r
+        if (portletSession == null) {\r
+            return super.equals(obj);\r
+        }\r
+        return portletSession.equals(obj);\r
+    }\r
+\r
+    public int hashCode() {\r
+        if (portletSession == null) {\r
+            return super.hashCode();\r
+        }\r
+        return portletSession.hashCode();\r
+    }\r
+\r
+    public void setPortletApplication(Portlet portlet, Application app) {\r
+        portletToApplication.put(portlet, app);\r
+    }\r
+\r
+    public Application getPortletApplication(Portlet portlet) {\r
+        return (Application) portletToApplication.get(portlet);\r
+    }\r
+\r
     public PortletSession getPortletSession() {\r
-        return session;\r
+        return portletSession;\r
     }\r
 \r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see com.itmill.toolkit.service.ApplicationContext#addTransactionListener(com.itmill.toolkit.service.ApplicationContext.TransactionListener)\r
-     */\r
-    public void addTransactionListener(TransactionListener listener) {\r
-        WebApplicationContext cx = (WebApplicationContext) session\r
-                .getAttribute(WebApplicationContext.class.getName());\r
-        if (cx != null) {\r
-            cx.addTransactionListener(listener);\r
+    public void addPortletListener(Application app, PortletListener listener) {\r
+        Set l = (Set) portletListeners.get(app);\r
+        if (l == null) {\r
+            l = new LinkedHashSet();\r
+            portletListeners.put(app, l);\r
         }\r
+        l.add(listener);\r
     }\r
 \r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see com.itmill.toolkit.service.ApplicationContext#getApplications()\r
-     */\r
-    public Collection getApplications() {\r
-        WebApplicationContext cx = (WebApplicationContext) session\r
-                .getAttribute(WebApplicationContext.class.getName());\r
-        if (cx != null) {\r
-            return cx.getApplications();\r
+    public void removePortletListener(Application app, PortletListener listener) {\r
+        Set l = (Set) portletListeners.get(app);\r
+        if (l != null) {\r
+            l.remove(listener);\r
         }\r
-        return null;\r
     }\r
 \r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see com.itmill.toolkit.service.ApplicationContext#getBaseDirectory()\r
-     */\r
-    public File getBaseDirectory() {\r
-        WebApplicationContext cx = (WebApplicationContext) session\r
-                .getAttribute(WebApplicationContext.class.getName());\r
-        if (cx != null) {\r
-            return cx.getBaseDirectory();\r
+    public static void dispatchRequest(Portlet portlet, RenderRequest request,\r
+            RenderResponse response) {\r
+        PortletApplicationContext ctx = getApplicationContext(request\r
+                .getPortletSession());\r
+        if (ctx != null) {\r
+            ctx.firePortletRenderRequest(portlet, request, response);\r
         }\r
-        return null;\r
     }\r
 \r
-    /*\r
-     * (non-Javadoc)\r
-     * \r
-     * @see com.itmill.toolkit.service.ApplicationContext#removeTransactionListener(com.itmill.toolkit.service.ApplicationContext.TransactionListener)\r
-     */\r
-    public void removeTransactionListener(TransactionListener listener) {\r
-        WebApplicationContext cx = (WebApplicationContext) session\r
-                .getAttribute(WebApplicationContext.class.getName());\r
-        if (cx != null) {\r
-            cx.removeTransactionListener(listener);\r
+    public static void dispatchRequest(Portlet portlet, ActionRequest request,\r
+            ActionResponse response) {\r
+        PortletApplicationContext ctx = getApplicationContext(request\r
+                .getPortletSession());\r
+        if (ctx != null) {\r
+            ctx.firePortletActionRequest(portlet, request, response);\r
         }\r
-    }\r
+    }\r
 \r
-    PortletInfo setPortletInfo(String path, PortletMode mode,\r
-            WindowState state, Principal userPrincipal, Map userInfo,\r
-            PortletConfig config) {\r
-        System.err.println("SETTING PI: " + path);\r
-        PortletInfo pi = (PortletInfo) portletInfoMap.get(path);\r
-        if (pi == null) {\r
-            pi = new PortletInfo(mode, state, userPrincipal, userInfo, config);\r
-            portletInfoMap.put(path, pi);\r
-        } else {\r
-            pi.setInfo(mode, state, userPrincipal, userInfo, config);\r
+    public void firePortletRenderRequest(Portlet portlet,\r
+            RenderRequest request, RenderResponse response) {\r
+        Application app = getPortletApplication(portlet);\r
+        Set listeners = (Set) portletListeners.get(app);\r
+        if (listeners != null) {\r
+            for (Iterator it = listeners.iterator(); it.hasNext();) {\r
+                PortletListener l = (PortletListener) it.next();\r
+                l.handleRenderRequest(request, new RestrictedRenderResponse(\r
+                        response));\r
+            }\r
         }\r
-        return pi;\r
     }\r
 \r
-    public PortletInfo getPortletInfo(Application app) {\r
-        if (app != null && app.getURL() != null) {\r
-            // TODO remove\r
-            System.err.println("GETTING PI: " + app.getURL().getPath());\r
-            return (PortletInfo) portletInfoMap.get(app.getURL().getPath());\r
+    public void firePortletActionRequest(Portlet portlet,\r
+            ActionRequest request, ActionResponse response) {\r
+        Application app = getPortletApplication(portlet);\r
+        Set listeners = (Set) portletListeners.get(app);\r
+        if (listeners != null) {\r
+            for (Iterator it = listeners.iterator(); it.hasNext();) {\r
+                PortletListener l = (PortletListener) it.next();\r
+                l.handleActionRequest(request, response);\r
+            }\r
         }\r
-        return null;\r
     }\r
 \r
-    public class PortletInfo {\r
+    public interface PortletListener {\r
+        public void handleRenderRequest(RenderRequest request,\r
+                RenderResponse response);\r
+\r
+        public void handleActionRequest(ActionRequest request,\r
+                ActionResponse response);\r
+    }\r
+\r
+    private class RestrictedRenderResponse implements RenderResponse {\r
 \r
-        PortletMode mode;\r
-        WindowState state;\r
-        Principal userPrincipal;\r
-        Map userInfo;\r
-        PortletConfig config;\r
+        private RenderResponse response;\r
 \r
-        public PortletInfo(PortletMode mode, WindowState state,\r
-                Principal userPrincipal, Map userInfo, PortletConfig config) {\r
-            this.mode = mode;\r
-            this.state = state;\r
-            this.userPrincipal = userPrincipal;\r
-            this.userInfo = userInfo;\r
-            this.config = config;\r
+        private RestrictedRenderResponse(RenderResponse response) {\r
+            this.response = response;\r
         }\r
 \r
-        private void setInfo(PortletMode mode, WindowState state,\r
-                Principal userPrincipal, Map userInfo, PortletConfig config) {\r
-            this.mode = mode;\r
-            this.state = state;\r
-            this.userPrincipal = userPrincipal;\r
-            this.userInfo = userInfo;\r
-            this.config = config;\r
+        public void addProperty(String key, String value) {\r
+            response.addProperty(key, value);\r
         }\r
 \r
-        /**\r
-         * Gets the current portlet mode, VIEW / EDIT / HELP\r
-         * \r
-         * @return the current portlet mode\r
-         */\r
-        public PortletMode getPortletMode() {\r
-            return mode;\r
+        public PortletURL createActionURL() {\r
+            return response.createActionURL();\r
         }\r
 \r
-        /**\r
-         * Gets the current window state, NORMAL / MAXIMIZED / MINIMIZED\r
-         * \r
-         * @return the current window state\r
-         */\r
-        public WindowState getWindowState() {\r
-            return state;\r
+        public PortletURL createRenderURL() {\r
+            return response.createRenderURL();\r
         }\r
 \r
-        /**\r
-         * Gets the current UserPrincipal\r
-         * \r
-         * @return current UserPrincipal, null if not logged in\r
-         */\r
-        public Principal getUserPrincipal() {\r
-            return userPrincipal;\r
+        public String encodeURL(String path) {\r
+            return response.encodeURL(path);\r
         }\r
 \r
-        /**\r
-         * Gets the PortletConfig for this portlet\r
-         * \r
-         * @return the PortletConfig\r
-         */\r
-        public PortletConfig getConfig() {\r
-            return config;\r
+        public void flushBuffer() throws IOException {\r
+            // NOP\r
+            // TODO throw?\r
         }\r
 \r
-        /**\r
-         * Gets the user info for this portlet, as retreived from\r
-         * request.getAttribute(PortletRequest.USER_INFO);\r
-         * \r
-         * @return the user info Map\r
-         */\r
-        public Map getUserInfo() {\r
-            return userInfo;\r
+        public int getBufferSize() {\r
+            return response.getBufferSize();\r
         }\r
 \r
-        public String toString() {\r
-            return "PortletMode: " + getPortletMode() + " WindowState: "\r
-                    + getWindowState() + " UserPrincipal: "\r
-                    + getUserPrincipal() + " User info: " + getUserInfo();\r
+        public String getCharacterEncoding() {\r
+            return response.getCharacterEncoding();\r
+        }\r
+\r
+        public String getContentType() {\r
+            return response.getContentType();\r
+        }\r
+\r
+        public Locale getLocale() {\r
+            return response.getLocale();\r
+        }\r
+\r
+        public String getNamespace() {\r
+            return response.getNamespace();\r
+        }\r
+\r
+        public OutputStream getPortletOutputStream() throws IOException {\r
+            // write forbidden\r
+            return null;\r
+        }\r
+\r
+        public PrintWriter getWriter() throws IOException {\r
+            // write forbidden\r
+            return null;\r
+        }\r
+\r
+        public boolean isCommitted() {\r
+            return response.isCommitted();\r
+        }\r
+\r
+        public void reset() {\r
+            // NOP\r
+            // TODO throw?\r
+        }\r
+\r
+        public void resetBuffer() {\r
+            // NOP\r
+            // TODO throw?\r
+        }\r
+\r
+        public void setBufferSize(int size) {\r
+            // NOP\r
+            // TODO throw?\r
+        }\r
+\r
+        public void setContentType(String type) {\r
+            // NOP\r
+            // TODO throw?\r
+        }\r
+\r
+        public void setProperty(String key, String value) {\r
+            response.setProperty(key, value);\r
+        }\r
+\r
+        public void setTitle(String title) {\r
+            response.setTitle(title);\r
         }\r
-    }\r
 \r
-    public interface PortletInfoReceiver {\r
-        public void receivePortletInfo(PortletInfo info);\r
     }\r
+\r
 }\r