Author: jfelfouly
Date: 2007-02-19 07:35:32-0800
New Revision: 10423
Added:
trunk/src/java/org/tigris/scarab/tools/install/web/
trunk/src/java/org/tigris/scarab/tools/install/web/Build1Servlet.java
trunk/src/java/org/tigris/scarab/tools/install/web/Build2Servlet.java
trunk/src/java/org/tigris/scarab/tools/install/web/BuildDatabaseServlet.java
trunk/src/java/org/tigris/scarab/tools/install/web/BuildScarabServlet.java
trunk/src/java/org/tigris/scarab/tools/install/web/InitServlet.java
trunk/src/java/org/tigris/scarab/tools/install/web/SaveSettingsServlet.java
trunk/src/java/org/tigris/scarab/tools/install/web/package.html
Log:
Source code for the experimental web installer.
Added: trunk/src/java/org/tigris/scarab/tools/install/web/Build1Servlet.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/tools/install/web/Build1Servlet.java?view=auto&rev=10423
==============================================================================
--- (empty file)
+++ trunk/src/java/org/tigris/scarab/tools/install/web/Build1Servlet.java 2007-02-19 07:35:32-0800
@@ -0,0 +1,82 @@
+package org.tigris.scarab.tools.install.web;
+
+/* ================================================================
+ * Copyright (c) 2000-2005 CollabNet. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement: "This product includes
+ * software developed by Collab.Net <http://www.Collab.Net/>."
+ * Alternately, this acknowlegement may appear in the software itself, if
+ * and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The hosted project names must not be used to endorse or promote
+ * products derived from this software without prior written
+ * permission. For written permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not use the "Tigris" or
+ * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
+ * prior written permission of Collab.Net.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of Collab.Net.
+ */
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class Build1Servlet extends HttpServlet {
+ /**
+ * The doGet method of the servlet. <br>
+ *
+ * This method is called when a form has its tag value method equals to get.
+ *
+ * @param request the request send by the client to the server
+ * @param response the response send by the server to the client
+ * @throws ServletException if an error occurred
+ * @throws IOException if an error occurred
+ */
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ Properties properties = (Properties) request.getSession().getAttribute("properties");
+ System.out.println("Now writing the build.properties file.");
+ properties.store(new FileOutputStream("../../build.properties"), "Generated by ScarabWebInstaller");
+ System.out.println("Done.");
+
+ response.setContentType("text/html");
+ response.sendRedirect(response.encodeRedirectURL("Build1.jsp"));
+
+ }
+
+}
Added: trunk/src/java/org/tigris/scarab/tools/install/web/Build2Servlet.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/tools/install/web/Build2Servlet.java?view=auto&rev=10423
==============================================================================
--- (empty file)
+++ trunk/src/java/org/tigris/scarab/tools/install/web/Build2Servlet.java 2007-02-19 07:35:32-0800
@@ -0,0 +1,75 @@
+package org.tigris.scarab.tools.install.web;
+
+/* ================================================================
+ * Copyright (c) 2000-2005 CollabNet. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement: "This product includes
+ * software developed by Collab.Net <http://www.Collab.Net/>."
+ * Alternately, this acknowlegement may appear in the software itself, if
+ * and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The hosted project names must not be used to endorse or promote
+ * products derived from this software without prior written
+ * permission. For written permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not use the "Tigris" or
+ * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
+ * prior written permission of Collab.Net.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of Collab.Net.
+ */
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class Build2Servlet extends HttpServlet {
+ /**
+ * The doGet method of the servlet. <br>
+ *
+ * This method is called when a form has its tag value method equals to get.
+ *
+ * @param request the request send by the client to the server
+ * @param response the response send by the server to the client
+ * @throws ServletException if an error occurred
+ * @throws IOException if an error occurred
+ */
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ response.setContentType("text/html");
+ response.sendRedirect(response.encodeRedirectURL("Build2.jsp"));
+
+ }
+
+}
Added: trunk/src/java/org/tigris/scarab/tools/install/web/BuildDatabaseServlet.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/tools/install/web/BuildDatabaseServlet.java?view=auto&rev=10423
==============================================================================
--- (empty file)
+++ trunk/src/java/org/tigris/scarab/tools/install/web/BuildDatabaseServlet.java 2007-02-19 07:35:32-0800
@@ -0,0 +1,141 @@
+package org.tigris.scarab.tools.install.web;
+
+/* ================================================================
+ * Copyright (c) 2000-2005 CollabNet. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement: "This product includes
+ * software developed by Collab.Net <http://www.Collab.Net/>."
+ * Alternately, this acknowlegement may appear in the software itself, if
+ * and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The hosted project names must not be used to endorse or promote
+ * products derived from this software without prior written
+ * permission. For written permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not use the "Tigris" or
+ * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
+ * prior written permission of Collab.Net.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of Collab.Net.
+ */
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class BuildDatabaseServlet extends HttpServlet {
+
+ /**
+ * The doGet method of the servlet. <br>
+ *
+ * This method is called when a form has its tag value method equals to get.
+ *
+ * @param request the request send by the client to the server
+ * @param response the response send by the server to the client
+ * @throws ServletException if an error occurred
+ * @throws IOException if an error occurred
+ */
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ PrintWriter out = response.getWriter();
+
+
+ try {
+ ResourceBundle rb = ResourceBundle.getBundle("InstallBundle");
+
+ File currentDirectory = new File(System.getProperty("user.dir"));
+ String buildDirectoryName = currentDirectory.getParentFile().getParentFile().getAbsolutePath() + File.separatorChar + "build";
+ String commandLine2 = null;
+
+ // Write a couple of batch (command) file
+ // I could not find another way to launch ant in another directory
+ if ("Windows".equals(System.getProperty("os.name").substring(0, 7))) {
+ BufferedWriter batch2 = new BufferedWriter(new FileWriter("build-scarab-db.cmd"));
+ batch2.write("cd " + buildDirectoryName + "\r\n");
+ batch2.write("ant create-db\r\n");
+ batch2.close();
+
+ commandLine2 = "cmd /c build-scarab-db.cmd";
+ } else {
+ BufferedWriter batch2 = new BufferedWriter(new FileWriter("build-scarab-db"));
+ batch2.write("#! /bin/sh\n");
+ batch2.write("cd " + buildDirectoryName + "\n");
+ batch2.write("ant\n");
+ batch2.close();
+
+ commandLine2 = "sh ./build-scarab-db";
+ }
+
+ // Launch second batch to build the Scarab database
+ out.println("<div class=\"infomessage\">");
+ out.println("<strong>Phase 2</strong> : " + rb.getString("building.scarab.database"));
+ out.println("</div>");
+
+ Process child = Runtime.getRuntime().exec(commandLine2);
+
+ out.println("<pre>");
+ InputStream in = child.getInputStream();
+ int c;
+ while ((c = in.read()) != -1) {
+ out.print((char) c);
+ }
+ out.println("</pre>");
+ in.close();
+
+ if (child.exitValue() == 0) {
+ out.println("<p class=\"infomark\">" + rb.getString("success") + "</p>");
+ } else {
+ out.println("<p class=\"errormark\">" + rb.getString("failure") + "</p>");
+ }
+ } catch (MissingResourceException mre) {
+ System.out.println("Something is wrong with the installation, I could not find the InstallBundle*.properties resource bundles");
+ } catch (Exception e) {
+ out.println("<div class=\"errormessage\">");
+ out.println("An error occured, stack trace follows: ");
+ out.println("</div>");
+ out.println("<pre>");
+ e.printStackTrace(out);
+ out.println("</pre>");
+ }
+
+ }
+
+}
Added: trunk/src/java/org/tigris/scarab/tools/install/web/BuildScarabServlet.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/tools/install/web/BuildScarabServlet.java?view=auto&rev=10423
==============================================================================
--- (empty file)
+++ trunk/src/java/org/tigris/scarab/tools/install/web/BuildScarabServlet.java 2007-02-19 07:35:32-0800
@@ -0,0 +1,141 @@
+package org.tigris.scarab.tools.install.web;
+
+/* ================================================================
+ * Copyright (c) 2000-2005 CollabNet. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement: "This product includes
+ * software developed by Collab.Net <http://www.Collab.Net/>."
+ * Alternately, this acknowlegement may appear in the software itself, if
+ * and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The hosted project names must not be used to endorse or promote
+ * products derived from this software without prior written
+ * permission. For written permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not use the "Tigris" or
+ * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
+ * prior written permission of Collab.Net.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of Collab.Net.
+ */
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class BuildScarabServlet extends HttpServlet {
+
+ /**
+ * The doGet method of the servlet. <br>
+ *
+ * This method is called when a form has its tag value method equals to get.
+ *
+ * @param request the request send by the client to the server
+ * @param response the response send by the server to the client
+ * @throws ServletException if an error occurred
+ * @throws IOException if an error occurred
+ */
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ PrintWriter out = response.getWriter();
+
+ try {
+ ResourceBundle rb = ResourceBundle.getBundle("InstallBundle");
+
+ File currentDirectory = new File(System.getProperty("user.dir"));
+ String buildDirectoryName = currentDirectory.getParentFile().getParentFile().getAbsolutePath() + File.separatorChar + "build";
+ String commandLine1 = null;
+
+ // Write a couple of batch (command) file
+ // I could not find another way to launch ant in another directory
+ if ("Windows".equals(System.getProperty("os.name").substring(0, 7))) {
+ BufferedWriter batch1 = new BufferedWriter(new FileWriter("build-scarab.cmd"));
+ batch1.write("cd " + buildDirectoryName + "\r\n");
+ batch1.write("ant\r\n");
+ batch1.close();
+
+ commandLine1 = "cmd /c build-scarab.cmd";
+ } else {
+ BufferedWriter batch1 = new BufferedWriter(new FileWriter("build-scarab"));
+ batch1.write("#! /bin/sh\n");
+ batch1.write("cd " + buildDirectoryName + "\n");
+ batch1.write("ant\n");
+ batch1.close();
+
+ commandLine1 = "sh ./build-scarab";
+ }
+
+ // Launch first batch to build Scarab
+ out.println("<div class=\"infomessage\">");
+ out.println("<strong>Phase 1</strong> : " + rb.getString("building.scarab.application"));
+ out.println("</div>");
+
+ Process child = Runtime.getRuntime().exec(commandLine1);
+
+ out.println("<pre>");
+ InputStream in = child.getInputStream();
+ int c;
+ while ((c = in.read()) != -1) {
+ out.print((char) c);
+ }
+ out.println("</pre>");
+ in.close();
+
+ if (child.exitValue() == 0) {
+ out.println("<p class=\"infomark\">" + rb.getString("success") + "</p>");
+ } else {
+ out.println("<p class=\"errormark\">" + rb.getString("failure") + "</p>");
+ }
+ } catch (MissingResourceException mre) {
+ System.out.println("Something is wrong with the installation, I could not find the InstallBundle*.properties resource bundles");
+ } catch (Exception e) {
+ out.println("<div class=\"errormessage\">");
+ out.println("An error occured, stack trace follows: ");
+ out.println("</div>");
+ out.println("<pre>");
+ e.printStackTrace(out);
+ out.println("</pre>");
+
+ }
+
+ }
+
+}
Added: trunk/src/java/org/tigris/scarab/tools/install/web/InitServlet.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/tools/install/web/InitServlet.java?view=auto&rev=10423
==============================================================================
--- (empty file)
+++ trunk/src/java/org/tigris/scarab/tools/install/web/InitServlet.java 2007-02-19 07:35:32-0800
@@ -0,0 +1,119 @@
+package org.tigris.scarab.tools.install.web;
+
+/* ================================================================
+ * Copyright (c) 2000-2005 CollabNet. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement: "This product includes
+ * software developed by Collab.Net <http://www.Collab.Net/>."
+ * Alternately, this acknowlegement may appear in the software itself, if
+ * and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The hosted project names must not be used to endorse or promote
+ * products derived from this software without prior written
+ * permission. For written permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not use the "Tigris" or
+ * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
+ * prior written permission of Collab.Net.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of Collab.Net.
+ */
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Properties;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class InitServlet extends HttpServlet {
+
+ /**
+ * Constructor of the object.
+ */
+ public InitServlet() {
+ super();
+ }
+
+ /**
+ * Destruction of the servlet. <br>
+ */
+ public void destroy() {
+ super.destroy(); // Just puts "destroy" string in log
+ }
+
+ /**
+ * The doGet method of the servlet. <br>
+ *
+ * This method is called when a form has its tag value method equals to get.
+ *
+ * @param request the request send by the client to the server
+ * @param response the response send by the server to the client
+ * @throws ServletException if an error occurred
+ * @throws IOException if an error occurred
+ */
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ System.out.println("User dir:" + System.getProperty("user.dir"));
+ System.out.println("Now reading project.properties");
+ Properties properties = new Properties();
+ try {
+ properties.load(new FileInputStream("../../project.properties"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ properties.load(new FileInputStream("../../build.properties"));
+ } catch (IOException e) {
+ System.out.println("There is probably no build.properties file.");
+ }
+
+ // Init HTTP scheme information
+ // Since the installer runs in the same container as the Scarab to
+ // be built, getting these informations from the request probably
+ // makes more sense than the default values.
+ properties.setProperty("scarab.http.scheme", request.getScheme());
+ properties.setProperty("scarab.http.domain", request.getServerName());
+ properties.setProperty("scarab.http.port", new Integer(request.getServerPort()).toString());
+
+ // Init additional properties for the database generation.
+ properties.setProperty("skip.seed.data", "false");
+ properties.setProperty("skip.jira.templates.data", "false");
+
+ request.getSession().setAttribute("properties", properties);
+
+ response.sendRedirect(response.encodeRedirectURL("BasicSettings.jsp"));
+ }
+}
Added: trunk/src/java/org/tigris/scarab/tools/install/web/SaveSettingsServlet.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/tools/install/web/SaveSettingsServlet.java?view=auto&rev=10423
==============================================================================
--- (empty file)
+++ trunk/src/java/org/tigris/scarab/tools/install/web/SaveSettingsServlet.java 2007-02-19 07:35:32-0800
@@ -0,0 +1,104 @@
+package org.tigris.scarab.tools.install.web;
+
+/* ================================================================
+ * Copyright (c) 2000-2005 CollabNet. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement: "This product includes
+ * software developed by Collab.Net <http://www.Collab.Net/>."
+ * Alternately, this acknowlegement may appear in the software itself, if
+ * and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The hosted project names must not be used to endorse or promote
+ * products derived from this software without prior written
+ * permission. For written permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not use the "Tigris" or
+ * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
+ * prior written permission of Collab.Net.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of Collab.Net.
+ */
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class SaveSettingsServlet extends HttpServlet {
+
+ /**
+ * The doPost method of the servlet. <br>
+ *
+ * This method is called when a form has its tag value method equals to post.
+ *
+ * @param request the request send by the client to the server
+ * @param response the response send by the server to the client
+ * @throws ServletException if an error occurred
+ * @throws IOException if an error occurred
+ */
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ String redirect = null;
+ Properties properties = (Properties) request.getSession().getAttribute("properties");
+
+ Map parameterMap = request.getParameterMap( );
+ if (parameterMap == null)
+ throw new ServletException("getParameterMap returned null in: " + getClass( ).getName( ));
+
+ Iterator iterator = parameterMap.entrySet( ).iterator( );
+ while(iterator.hasNext( )){
+ Map.Entry me = (Map.Entry)iterator.next( );
+ String key = (String) me.getKey();
+ String[] arr = (String[]) me.getValue( );
+ String value = arr[0];
+ System.out.println("Key: [" + key + "] Value: [" + value + "]");
+
+ if ("redirect".equals(me.getKey())) {
+ redirect = value;
+ }
+
+ if (key.indexOf('.') != -1) {
+ properties.setProperty(key, value);
+ }
+ }
+
+ if (redirect == null) {
+ System.out.println("ERROR: no redirect specified, redirect to BasicSettings.jsp");
+ }
+ response.setContentType("text/html");
+ response.sendRedirect(response.encodeRedirectURL(redirect));
+ }
+
+}
Added: trunk/src/java/org/tigris/scarab/tools/install/web/package.html
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/tools/install/web/package.html?view=auto&rev=10423
==============================================================================
--- (empty file)
+++ trunk/src/java/org/tigris/scarab/tools/install/web/package.html 2007-02-19 07:35:32-0800
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <title>Web installer servlets</title>
+ </head>
+ <body>
+ <p>These classes are used in coordination with a set of JavaServer Pages to make the web installer work.</p>
+ <p>They have no role in the Scarab application itself but have been included here for reference.</p>
+ </body>
+</html>
\ No newline at end of file
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.