geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r428816 - in /geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src: ./ java/org/apache/geronimo/console/car/ webapp/WEB-INF/view/car/
Date Fri, 04 Aug 2006 18:24:58 GMT
Author: jdillon
Date: Fri Aug  4 11:24:57 2006
New Revision: 428816

URL: http://svn.apache.org/viewvc?rev=428816&view=rev
Log:
 r628@jason-dillons-computer (orig r427997):  jdillon | 2006-08-02 07:15:03 -0700
  r613@dyn456093 (orig r427687):  ammulder | 2006-08-01 12:32:40 -0700
  Merge GERONIMO-2076 to trunk
  
 

Added:
    geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
  (with props)
    geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/addRepository.jsp
  (with props)
Modified:
    geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/   (props
changed)
    geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
    geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java
    geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/index.jsp

Propchange: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Aug  4 11:24:57 2006
@@ -1 +1 @@
-13f79535-47bb-0310-9956-ffa450edef68:/geronimo/sandbox/svkmerge/trunk/applications/console/console-standard/src:427996
+13f79535-47bb-0310-9956-ffa450edef68:/geronimo/sandbox/svkmerge/trunk/applications/console/console-standard/src:427997

Added: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java?rev=428816&view=auto
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
(added)
+++ geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
Fri Aug  4 11:24:57 2006
@@ -0,0 +1,149 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.console.car;
+
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.util.ConfigurationData;
+import org.apache.geronimo.system.plugin.PluginRepositoryList;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.FileNotFoundException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.net.URL;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URLConnection;
+
+/**
+ * Handler for the import export main screen.
+ *
+ * @version $Rev: 409817 $ $Date: 2006-05-27 03:56:38 -0400 (Sat, 27 May 2006) $
+ */
+public class AddRepositoryHandler extends BaseImportExportHandler {
+    private final static Log log = LogFactory.getLog(AddRepositoryHandler.class);
+
+    public AddRepositoryHandler() {
+        super(ADD_REPO_MODE, "/WEB-INF/view/car/addRepository.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        PluginRepositoryList[] lists = PortletManager.getCurrentServer(request).getPluginRepositoryLists();
+        List list = new ArrayList();
+        for (int i = 0; i < lists.length; i++) {
+            PluginRepositoryList repo = lists[i];
+            list.addAll(Arrays.asList(repo.getRepositories()));
+        }
+        String error = request.getParameter("repoError");
+        if(error != null && !error.equals("")) {
+            request.setAttribute("repoError", error);
+        }
+        request.setAttribute("repositories", list);
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        String repo = request.getParameter("newRepository");
+        if(repo != null && !repo.equals("")) {
+            if(!addRepository(repo, request, response)) {
+                return getMode();
+            }
+        }
+        return INDEX_MODE+BEFORE_ACTION;
+    }
+
+
+    private boolean addRepository(String repo, ActionRequest request, ActionResponse response)
throws IOException {
+        if(!repo.endsWith("/")) {
+            repo = repo+"/";
+        }
+        PluginRepositoryList[] lists = PortletManager.getCurrentServer(request).getPluginRepositoryLists();
+
+        // Check for duplicates
+        for (int i = 0; i < lists.length; i++) {
+            PluginRepositoryList test = lists[i];
+            URL[] all = test.getRepositories();
+            for (int j = 0; j < all.length; j++) {
+                String existing = all[j].toString();
+                if(!existing.endsWith("/")) {
+                    existing = existing + "/";
+                }
+                if(repo.equals(existing)) {
+                    response.setRenderParameter("repoError", "Already have an entry for repository
"+repo);
+                    return false;
+                }
+            }
+        }
+
+        // Verify the repository and add it if valid
+        if(lists.length > 0) {
+            URL url;
+            try {
+                url = new URL(repo);
+            } catch (MalformedURLException e) {
+                response.setRenderParameter("repoError", "Invalid repository URL "+repo);
+                return false;
+            }
+            URL test = new URL(repo+"geronimo-plugins.xml");
+            log.debug("Checking repository "+test);
+            URLConnection urlConnection = test.openConnection();
+            if(urlConnection instanceof HttpURLConnection) {
+                HttpURLConnection con = (HttpURLConnection) urlConnection;
+                con.connect();
+                int result = con.getResponseCode();
+                log.debug("Repository check response: "+result);
+                if(result == 404) {
+                    response.setRenderParameter("repoError", "Not a valid repository; no
plugin list found at "+test);
+                    return false;
+                } else if(result == 401) {
+                    log.warn("Unable to validate repository -- it requires authentication.
 Assuming you know what you're doing.");
+                } else if(result != 200) {
+                    log.warn("Unexpected response code while validating repository ("+result+"
"+con.getResponseMessage()+").  Assuming you know what you're doing.");
+                }
+                con.disconnect();
+            } else {
+                try {
+                    urlConnection.connect();
+                    InputStream in = urlConnection.getInputStream();
+                    in.read();
+                    in.close();
+                } catch (IOException e) {
+                    response.setRenderParameter("repoError", "Not a valid repository; no
plugin list found at "+test);
+                    return false;
+                }
+            }
+            lists[0].addUserRepository(url);
+            request.setAttribute("repository", repo);
+            return true;
+        }
+        response.setRenderParameter("repoError", "No repository list found; unable to store
new repository");
+        return false;
+    }
+}

Propchange: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/AddRepositoryHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java?rev=428816&r1=428815&r2=428816&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
(original)
+++ geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
Fri Aug  4 11:24:57 2006
@@ -27,6 +27,7 @@
     protected static final String CONFIG_LIST_SESSION_KEY = "console.plugins.ConfigurationList";
     protected static final String DOWNLOAD_RESULTS_SESSION_KEY = "console.plugins.DownloadResults";
     protected static final String INDEX_MODE = "index";
+    protected static final String ADD_REPO_MODE = "addRepository";
     protected static final String LIST_MODE = "list";
     protected static final String DOWNLOAD_MODE = "download";
     protected static final String VIEW_FOR_DOWNLOAD_MODE = "viewForDownload";

Modified: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java?rev=428816&r1=428815&r2=428816&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java
(original)
+++ geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java
Fri Aug  4 11:24:57 2006
@@ -39,6 +39,7 @@
         addHelper(new ExportHandler(), config);
         addHelper(new DownloadStatusHandler(), config);
         addHelper(new UpdateListHandler(), config);
+        addHelper(new AddRepositoryHandler(), config);
         addHelper(new ViewPluginDownloadHandler(), config);
     }
 

Added: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/addRepository.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/addRepository.jsp?rev=428816&view=auto
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/addRepository.jsp
(added)
+++ geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/addRepository.jsp
Fri Aug  4 11:24:57 2006
@@ -0,0 +1,38 @@
+<%@ page import="org.apache.geronimo.console.util.PortletManager"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+
+<h2>Add Plugin Repository</h2>
+
+<c:if test="${!empty repositories}">
+<p>The currently available plugin repositories are:</p>
+<ul>
+  <c:forEach var="repo" items="${repositories}">
+    <li><tt>${repo}</tt></li>
+  </c:forEach>
+</ul>
+</c:if>
+
+<p>To add a new plugin repository to this list, enter the URL to the repository.  The
+repository must have a <tt>geronimo-plugins.xml</tt> file in the root directory
+listing the available plugins in the repository.</p>
+
+<p>You can also download running configurations from another Geronimo server
+just as if you're browsing and installing third-party plugins.
+ If you want to point to a remote Geronimo server, enter a URL such as
+<tt>http://geronimo-server:8080/console-standard/maven-repo/</tt></p>
+
+<form name="<portlet:namespace/>PluginForm" action="<portlet:actionURL/>">
+    <input type="hidden" name="mode" value="addRepository-after" />
+    <b>New Repository:</b> <input type="text" name="newRepository" size="40"
maxlength="200" />
+    <br />
+    <c:if test="${!empty repoError}">
+      <p><font color="red">${repoError}</font></p>
+    </c:if>
+    <br />
+    <input type="submit" value="Add Repository" />
+</form>
+
+<p><a href="<portlet:actionURL portletMode="view"><portlet:param name="mode"
value="index-before" /></portlet:actionURL>">Cancel</a></p>

Propchange: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/addRepository.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/index.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/index.jsp?rev=428816&r1=428815&r2=428816&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/index.jsp
(original)
+++ geronimo/sandbox/svkmerge/m2migration/applications/console/console-standard/src/webapp/WEB-INF/view/car/index.jsp
Fri Aug  4 11:24:57 2006
@@ -27,7 +27,8 @@
         </c:forEach>
     </select>
     <c:if test="${!empty repositories}"><br /></c:if>
-    <i>(<a href="<portlet:actionURL portletMode="view"><portlet:param name="mode"
value="updateList-before" /><portlet:param name="repository" value="${repository}" /></portlet:actionURL>">Update
Repository List</a>)</i>
+    <i>(<a href="<portlet:actionURL portletMode="view"><portlet:param name="mode"
value="updateList-before" /><portlet:param name="repository" value="${repository}" /></portlet:actionURL>">Update
Repository List</a>
+     or <a href="<portlet:actionURL portletMode="view"><portlet:param name="mode"
value="addRepository-before" /><portlet:param name="repository" value="${repository}"
/></portlet:actionURL>">Add Repository</a>)</i>
     <%--<input type="text" name="repository" value="${repository}" size="30" maxlength="200"
/>--%>
     <c:if test="${!empty repositories}">
       <input type="submit" value="Search for Plugins" />



Mime
View raw message