]> git.argeo.org Git - gpl/argeo-slc.git/blob - legacy/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/web/mvc/provisioning/AvailableDistributions.java
Remove SlcExecution and process packages
[gpl/argeo-slc.git] / legacy / runtime / org.argeo.slc.server / src / main / java / org / argeo / slc / web / mvc / provisioning / AvailableDistributions.java
1 /*
2 * Copyright (C) 2007-2012 Mathieu Baudier
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.slc.web.mvc.provisioning;
17
18 import java.io.IOException;
19 import java.io.Writer;
20 import java.util.Iterator;
21 import java.util.Set;
22
23 import javax.servlet.ServletException;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
26
27 import org.argeo.slc.build.ModularDistribution;
28 import org.springframework.web.HttpRequestHandler;
29
30 /** List of distributions. */
31 public class AvailableDistributions implements HttpRequestHandler {
32 private Set<ModularDistribution> modularDistributions;
33
34 public void handleRequest(HttpServletRequest request,
35 HttpServletResponse response) throws ServletException, IOException {
36 response.setContentType("text/html");
37
38 String baseUrl = "http://" + request.getServerName() + ":"
39 + request.getServerPort() + request.getContextPath()
40 + request.getServletPath() + "/";
41
42 Writer out = response.getWriter();
43
44 out.write("<h1>Distributions</h1>");
45 for (Iterator<ModularDistribution> it = modularDistributions.iterator(); it
46 .hasNext();) {
47 ModularDistribution md = it.next();
48 out.write("<h2>" + md + "</h2>");
49 out.write("Modules: ");
50 String moduleBase = baseUrl + md.getName() + "/" + md.getVersion()
51 + "/";
52
53 String modulesListHtml = moduleBase + "modules.html";
54 out.write(" <a href=\"" + modulesListHtml + "\">html</a>");
55
56 String modulesListPlain = moduleBase + "modules";
57 out.write(" <a href=\"" + modulesListPlain + "\">plain</a>");
58
59 String modulesListOsgiBoot = moduleBase + "osgiBoot";
60 out.write(" <a href=\"" + modulesListOsgiBoot + "\">osgiBoot</a>");
61
62 out.write("<br/>");
63
64 out.write("Eclipse update site: ");
65 String updateSiteUrl = baseUrl + md.getName() + "/"
66 + md.getVersion() + "/site.xml";
67 out.write("<a href=\"" + updateSiteUrl + "\">" + updateSiteUrl
68 + "</a>");
69 }
70 }
71
72 public void setModularDistributions(
73 Set<ModularDistribution> modularDistributions) {
74 this.modularDistributions = modularDistributions;
75 }
76
77 }