001    /*----------------------------------------------------------------------------
002     This file is part of deegree, http://deegree.org/
003     Copyright (C) 2001-2009 by:
004       Department of Geography, University of Bonn
005     and
006       lat/lon GmbH
007    
008     This library is free software; you can redistribute it and/or modify it under
009     the terms of the GNU Lesser General Public License as published by the Free
010     Software Foundation; either version 2.1 of the License, or (at your option)
011     any later version.
012     This library is distributed in the hope that it will be useful, but WITHOUT
013     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
014     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
015     details.
016     You should have received a copy of the GNU Lesser General Public License
017     along with this library; if not, write to the Free Software Foundation, Inc.,
018     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019    
020     Contact information:
021    
022     lat/lon GmbH
023     Aennchenstr. 19, 53177 Bonn
024     Germany
025     http://lat-lon.de/
026    
027     Department of Geography, University of Bonn
028     Prof. Dr. Klaus Greve
029     Postfach 1147, 53001 Bonn
030     Germany
031     http://www.geographie.uni-bonn.de/deegree/
032    
033     e-mail: info@deegree.org
034    ----------------------------------------------------------------------------*/
035    
036    package org.deegree.portal.portlet.modules.map.actions.portlets;
037    
038    import org.apache.jetspeed.modules.actions.portlets.JspPortletAction;
039    import org.apache.jetspeed.portal.Portlet;
040    import org.apache.turbine.util.RunData;
041    
042    /**
043     * General action for managing WMC (saving, loading sharing). Currently saving to user's directory,
044     * saving to a shared diractory and loading from shared are implemented.
045     *
046     * @author <a href="mailto:taddei@lat-lon.de">Ugo Taddei</a>
047     * @author last edited by: $Author: taddei $
048     *
049     * @version $Revision: 1.5 $, $Date: 2007/01/04 11:18:33 $
050     */
051    
052    public class WMCManagementPortletAction extends JspPortletAction {
053    
054        @Override
055        protected void buildNormalContext( Portlet portlet, RunData rundata )
056                                throws Exception {
057    
058            WMCManagementPortletPerfom perform = new WMCManagementPortletPerfom( rundata.getRequest(), portlet,
059                                                                                 rundata.getServletContext() );
060            perform.buildNormalContext();
061        }
062    
063        /**
064         * Saved the context into the "WEB_INF/wmc/shared" directory
065         *
066         * @param rundata
067         * @param portlet
068         * @throws Exception
069         */
070        public void doSaveshared( RunData rundata, Portlet portlet )
071                                throws Exception {
072    
073            WMCManagementPortletPerfom perform = new WMCManagementPortletPerfom( rundata.getRequest(), portlet,
074                                                                                 rundata.getServletContext() );
075    
076            try {
077                perform.doSaveshared( rundata.getUser().getUserName() );
078            } catch ( Exception e ) {
079                e.printStackTrace();
080            }
081    
082        }
083    
084        /**
085         * Saved the context into the "WEB_INF/wmc/$USER_HOME" directory
086         *
087         * @param rundata
088         * @param portlet
089         * @throws Exception
090         */
091        public void doSavecontext( RunData rundata, Portlet portlet )
092                                throws Exception {
093    
094            WMCManagementPortletPerfom perform = new WMCManagementPortletPerfom( rundata.getRequest(), portlet,
095                                                                                 rundata.getServletContext() );
096    
097            try {
098                perform.doSavecontext( rundata.getUser().getUserName() );
099            } catch ( Exception e ) {
100                e.printStackTrace();
101            }
102        }
103    
104        /**
105         * Saved the context with user defined name into the "WEB_INF/wmc/$USER_HOME" directory
106         *
107         * @param rundata
108         * @param portlet
109         * @throws Exception
110         */
111        public void doSavenamedcontext( RunData rundata, Portlet portlet )
112                                throws Exception {
113    
114            WMCManagementPortletPerfom perform = new WMCManagementPortletPerfom( rundata.getRequest(), portlet,
115                                                                                 rundata.getServletContext() );
116    
117            try {
118                perform.doSavenamedcontext( rundata.getUser().getUserName() );
119            } catch ( Exception e ) {
120                e.printStackTrace();
121            }
122        }
123    
124        /**
125         * Loads a context from the "WEB_INF/wmc/shared"
126         *
127         * @param rundata
128         * @param portlet
129         * @throws Exception
130         */
131        public void doLoadcontext( RunData rundata, Portlet portlet )
132                                throws Exception {
133    
134            WMCManagementPortletPerfom perform = new WMCManagementPortletPerfom( rundata.getRequest(), portlet,
135                                                                                 rundata.getServletContext() );
136    
137            try {
138                perform.doLoadcontext();
139            } catch ( Exception e ) {
140                e.printStackTrace();
141            }
142    
143        }
144    }