001/*
002 * File   : $Source$
003 * Date   : $Date$
004 * Version: $Revision$
005 *
006 * This library is part of OpenCms -
007 * the Open Source Content Management System
008 *
009 * Copyright (C) 2002 - 2009 Alkacon Software (http://www.alkacon.com)
010 *
011 * This library is free software; you can redistribute it and/or
012 * modify it under the terms of the GNU Lesser General Public
013 * License as published by the Free Software Foundation; either
014 * version 2.1 of the License, or (at your option) any later version.
015 *
016 * This library is distributed in the hope that it will be useful,
017 * but WITHOUT ANY WARRANTY; without even the implied warranty of
018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019 * Lesser General Public License for more details.
020 *
021 * For further information about Alkacon Software, please see the
022 * company website: http://www.alkacon.com
023 *
024 * For further information about OpenCms, please see the
025 * project website: http://www.opencms.org
026 *
027 * You should have received a copy of the GNU Lesser General Public
028 * License along with this library; if not, write to the Free Software
029 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
030 */
031
032package org.opencms.workplace.tools.sites;
033
034import org.opencms.jsp.CmsJspActionElement;
035import org.opencms.report.I_CmsReportThread;
036import org.opencms.ui.apps.sitemanager.CmsSitesWebserverThread;
037import org.opencms.workplace.list.A_CmsListReport;
038import org.opencms.workplace.tools.CmsToolManager;
039
040import java.util.HashMap;
041
042import javax.servlet.http.HttpServletRequest;
043import javax.servlet.http.HttpServletResponse;
044import javax.servlet.jsp.PageContext;
045
046/**
047 * The write to web server report.<p>
048 *
049 * @since 9.0.0
050 */
051public class CmsSitesWebserverReport extends A_CmsListReport {
052
053    /** The source file used as template for creating a web server's configuration files. */
054    private String m_paramConfigtemplate;
055
056    /** The prefix used for created web server's configuration files, created by this tool. */
057    private String m_paramFilenameprefix;
058
059    /** The directory used for log files created by the web server. */
060    private String m_paramLoggingdir;
061
062    /** The source file used as template for creating a web server's configuration files. */
063    private String m_paramSecuretemplate;
064
065    /** The target path to store the web server's configuration files. */
066    private String m_paramTargetpath;
067
068    /** The script to be executed after updating the web server configurations. */
069    private String m_paramWebserverscript;
070
071    /**
072     * Public constructor with JSP action element.<p>
073     *
074     * @param jsp an initialized JSP action element
075     */
076    public CmsSitesWebserverReport(CmsJspActionElement jsp) {
077
078        super(jsp);
079    }
080
081    /**
082     * Public constructor with JSP variables.<p>
083     *
084     * @param context the JSP page context
085     * @param req the JSP request
086     * @param res the JSP response
087     */
088    public CmsSitesWebserverReport(PageContext context, HttpServletRequest req, HttpServletResponse res) {
089
090        this(new CmsJspActionElement(context, req, res));
091    }
092
093    /**
094     * Returns the configuration template parameter.<p>
095     *
096     * @return the configuration template parameter
097     */
098    public String getParamConfigtemplate() {
099
100        return m_paramConfigtemplate;
101    }
102
103    /**
104     * Returns the file name prefix parameter.<p>
105     *
106     * @return the file name prefix parameter
107     */
108    public String getParamFilenameprefix() {
109
110        return m_paramFilenameprefix;
111    }
112
113    /**
114     * Returns the paramLoggingdir.<p>
115     *
116     * @return the paramLoggingdir
117     */
118    public String getParamLoggingdir() {
119
120        return m_paramLoggingdir;
121    }
122
123    /**
124     * Returns the paramSecuretemplate.<p>
125     *
126     * @return the paramSecuretemplate
127     */
128    public String getParamSecuretemplate() {
129
130        return m_paramSecuretemplate;
131    }
132
133    /**
134     * Returns the paramTargetpath.<p>
135     *
136     * @return the paramTargetpath
137     */
138    public String getParamTargetpath() {
139
140        return m_paramTargetpath;
141    }
142
143    /**
144     * Returns the web server script parameter.<p>
145     *
146     * @return the web server script parameter
147     */
148    public String getParamWebserverscript() {
149
150        return m_paramWebserverscript;
151    }
152
153    /**
154     * @see org.opencms.workplace.list.A_CmsListReport#initializeThread()
155     */
156    @Override
157    public I_CmsReportThread initializeThread() {
158
159        setParamCloseLink(CmsToolManager.linkForToolPath(getJsp(), "/sites/", new HashMap<String, String[]>()));
160        return new CmsSitesWebserverThread(
161            getCms(),
162            getParamTargetpath(),
163            getParamConfigtemplate(),
164            getParamWebserverscript(),
165            getParamFilenameprefix(),
166            getParamLoggingdir(),
167            getParamSecuretemplate());
168    }
169
170    /**
171     * Sets the configuration template parameter.<p>
172     *
173     * @param paramConfigtemplate the configuration template parameter to set
174     */
175    public void setParamConfigtemplate(String paramConfigtemplate) {
176
177        m_paramConfigtemplate = paramConfigtemplate;
178    }
179
180    /**
181     * Sets the file name prefix parameter.<p>
182     *
183     * @param paramFilenameprefix the file name prefix parameter to set
184     */
185    public void setParamFilenameprefix(String paramFilenameprefix) {
186
187        m_paramFilenameprefix = paramFilenameprefix;
188    }
189
190    /**
191     * Sets the paramLoggingdir.<p>
192     *
193     * @param paramLoggingdir the paramLoggingdir to set
194     */
195    public void setParamLoggingdir(String paramLoggingdir) {
196
197        m_paramLoggingdir = paramLoggingdir;
198    }
199
200    /**
201     * Sets the paramSecuretemplate.<p>
202     *
203     * @param paramSecuretemplate the paramSecuretemplate to set
204     */
205    public void setParamSecuretemplate(String paramSecuretemplate) {
206
207        m_paramSecuretemplate = paramSecuretemplate;
208    }
209
210    /**
211     * Sets the paramTargetpath.<p>
212     *
213     * @param paramTargetpath the paramTargetpath to set
214     */
215    public void setParamTargetpath(String paramTargetpath) {
216
217        m_paramTargetpath = paramTargetpath;
218    }
219
220    /**
221     * Sets the web server script parameter.<p>
222     *
223     * @param paramWebserverscript the web server script parameter to set
224     */
225    public void setParamWebserverscript(String paramWebserverscript) {
226
227        m_paramWebserverscript = paramWebserverscript;
228    }
229
230}