001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    package org.apache.geronimo.console.securitymanager;
019    
020    import java.io.IOException;
021    
022    import javax.portlet.PortletException;
023    import javax.portlet.PortletRequestDispatcher;
024    import javax.portlet.RenderRequest;
025    import javax.portlet.RenderResponse;
026    import javax.portlet.WindowState;
027    
028    import org.apache.geronimo.console.BasePortlet;
029    
030    public abstract class AbstractSecurityManagerPortlet extends BasePortlet {
031    
032        protected PortletRequestDispatcher normalView;
033    
034        protected PortletRequestDispatcher addNormalView;
035    
036        protected PortletRequestDispatcher maximizedView;
037    
038        protected PortletRequestDispatcher addMaximizedView;
039    
040        protected PortletRequestDispatcher helpView;
041    
042        protected PortletRequestDispatcher errorView;
043    
044        protected void doEdit(RenderRequest renderRequest,
045                RenderResponse renderResponse) throws PortletException, IOException {
046            if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
047                addNormalView.include(renderRequest, renderResponse);
048            } else {
049                addMaximizedView.include(renderRequest, renderResponse);
050            }
051        }
052    
053        protected void doHelp(RenderRequest renderRequest,
054                RenderResponse renderResponse) throws PortletException, IOException {
055            helpView.include(renderRequest, renderResponse);
056        }
057    
058    }