Home » geronimo-2.2-source-release » org.apache.geronimo.console.dependencyview » [javadoc | source]

    1   /**
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   package org.apache.geronimo.console.dependencyview;
   18   
   19   import java.io.IOException;
   20   
   21   import javax.portlet.ActionRequest;
   22   import javax.portlet.ActionResponse;
   23   import javax.portlet.PortletConfig;
   24   import javax.portlet.PortletException;
   25   import javax.portlet.PortletRequestDispatcher;
   26   import javax.portlet.PortletSession;
   27   import javax.portlet.RenderRequest;
   28   import javax.portlet.RenderResponse;
   29   import javax.portlet.WindowState;
   30   
   31   import org.apache.geronimo.console.BasePortlet;
   32   import org.apache.geronimo.console.util.PortletManager;
   33   
   34   public class DependencyViewPortlet extends BasePortlet {
   35   
   36       private static final String NORMALVIEW_JSP = "/WEB-INF/view/dependencyview/view.jsp";
   37   
   38       private static final String MAXIMIZEDVIEW_JSP = "/WEB-INF/view/dependencyview/view.jsp";
   39   
   40       private static final String HELPVIEW_JSP = "/WEB-INF/view/dependencyview/help.jsp";
   41   
   42       static final String Server_Key = "org.apache.geronimo.console.dependencyview.J2EESever";
   43       
   44       private PortletRequestDispatcher normalView;
   45   
   46       private PortletRequestDispatcher maximizedView;
   47   
   48       private PortletRequestDispatcher helpView;
   49       
   50       public void processAction(ActionRequest actionRequest,
   51               ActionResponse actionResponse) throws PortletException, IOException {
   52       }
   53   
   54       protected void doView(RenderRequest renderRequest,
   55               RenderResponse renderResponse) throws IOException, PortletException {
   56           if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
   57               return;
   58           }
   59           //a little workaround
   60           renderRequest.getPortletSession(true)
   61               .setAttribute(Server_Key, PortletManager.getCurrentServer(renderRequest), PortletSession.APPLICATION_SCOPE);
   62           if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
   63               normalView.include(renderRequest, renderResponse);
   64           } else {
   65               maximizedView.include(renderRequest, renderResponse);
   66           }
   67       }
   68   
   69       protected void doHelp(RenderRequest renderRequest,
   70               RenderResponse renderResponse) throws PortletException, IOException {
   71           helpView.include(renderRequest, renderResponse);
   72       }
   73   
   74       public void init(PortletConfig portletConfig) throws PortletException {
   75           super.init(portletConfig);
   76           normalView = portletConfig.getPortletContext().getRequestDispatcher(
   77                   NORMALVIEW_JSP);
   78           maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
   79                   MAXIMIZEDVIEW_JSP);
   80           helpView = portletConfig.getPortletContext().getRequestDispatcher(
   81                   HELPVIEW_JSP);
   82   
   83       }
   84   
   85       public void destroy() {
   86           normalView = null;
   87           maximizedView = null;
   88           helpView = null;
   89           super.destroy();
   90       }
   91   }

Home » geronimo-2.2-source-release » org.apache.geronimo.console.dependencyview » [javadoc | source]