You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/08/01 02:43:47 UTC
svn commit: r427388 - in /geronimo/trunk:
applications/console/console-standard/src/java/org/apache/geronimo/console/car/
applications/console/console-standard/src/webapp/WEB-INF/view/car/
modules/system/src/java/org/apache/geronimo/system/plugin/
Author: ammulder
Date: Mon Jul 31 17:43:46 2006
New Revision: 427388
URL: http://svn.apache.org/viewvc?rev=427388&view=rev
Log:
Merge GERONIMO-2253 to trunk
Added:
geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java (with props)
geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/viewForDownload.jsp (with props)
Modified:
geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java
geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/download.jsp
geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/list.jsp
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginMetadata.java
Modified: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java?rev=427388&r1=427387&r2=427388&view=diff
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java (original)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java Mon Jul 31 17:43:46 2006
@@ -29,6 +29,7 @@
protected static final String INDEX_MODE = "index";
protected static final String LIST_MODE = "list";
protected static final String DOWNLOAD_MODE = "download";
+ protected static final String VIEW_FOR_DOWNLOAD_MODE = "viewForDownload";
protected static final String DOWNLOAD_STATUS_MODE = "downloadStatus";
protected static final String RESULTS_MODE = "results";
protected static final String CONFIGURE_EXPORT_MODE = "configure";
Modified: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java?rev=427388&r1=427387&r2=427388&view=diff
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java (original)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java Mon Jul 31 17:43:46 2006
@@ -39,6 +39,7 @@
addHelper(new ExportHandler(), config);
addHelper(new DownloadStatusHandler(), config);
addHelper(new UpdateListHandler(), config);
+ addHelper(new ViewPluginDownloadHandler(), config);
}
protected String getModelJSPVariableName() {
Added: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java?rev=427388&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java (added)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java Mon Jul 31 17:43:46 2006
@@ -0,0 +1,95 @@
+/**
+ *
+ * Copyright 2006 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 java.io.IOException;
+import java.net.URL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.security.auth.login.FailedLoginException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.system.plugin.PluginMetadata;
+import org.apache.geronimo.system.plugin.PluginList;
+
+/**
+ * Handler for the screen that shows you plugin details before you go on and
+ * install it.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ViewPluginDownloadHandler extends BaseImportExportHandler {
+ private final static Log log = LogFactory.getLog(ViewPluginDownloadHandler.class);
+
+ public ViewPluginDownloadHandler() {
+ super(VIEW_FOR_DOWNLOAD_MODE, "/WEB-INF/view/car/viewForDownload.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String configId = request.getParameter("configId");
+ String repo = request.getParameter("repository");
+ String user = request.getParameter("repo-user");
+ String pass = request.getParameter("repo-pass");
+ response.setRenderParameter("configId", configId);
+ response.setRenderParameter("repository", repo);
+ if(!isEmpty(user)) response.setRenderParameter("repo-user", user);
+ if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);
+
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+ String configId = request.getParameter("configId");
+ String repo = request.getParameter("repository");
+ String user = request.getParameter("repo-user");
+ String pass = request.getParameter("repo-pass");
+ PluginMetadata config = null;
+ try {
+ PluginList list = (PluginList) request.getPortletSession(true).getAttribute(CONFIG_LIST_SESSION_KEY);
+ if(list == null) {
+ list = PortletManager.getCurrentServer(request).getPluginInstaller().listPlugins(new URL(repo), user, pass);
+ request.getPortletSession(true).setAttribute(CONFIG_LIST_SESSION_KEY, list);
+ }
+ for (int i = 0; i < list.getPlugins().length; i++) {
+ PluginMetadata metadata = list.getPlugins()[i];
+ if(metadata.getModuleId().toString().equals(configId)) {
+ config = metadata;
+ break;
+ }
+ }
+ } catch (FailedLoginException e) {
+ throw new PortletException("Invalid login for Maven repository '"+repo+"'", e);
+ }
+ if(config == null) {
+ throw new PortletException("No configuration found for '"+configId+"'");
+ }
+ request.setAttribute("configId", configId);
+ request.setAttribute("plugin", config);
+ request.setAttribute("repository", repo);
+ request.setAttribute("repouser", user);
+ request.setAttribute("repopass", pass);
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ return DOWNLOAD_MODE+BEFORE_ACTION;
+ }
+}
Propchange: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/download.jsp
URL: http://svn.apache.org/viewvc/geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/download.jsp?rev=427388&r1=427387&r2=427388&view=diff
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/download.jsp (original)
+++ geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/download.jsp Mon Jul 31 17:43:46 2006
@@ -1,4 +1,3 @@
-<%@ 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"%>
Modified: geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/list.jsp
URL: http://svn.apache.org/viewvc/geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/list.jsp?rev=427388&r1=427387&r2=427388&view=diff
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/list.jsp (original)
+++ geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/list.jsp Mon Jul 31 17:43:46 2006
@@ -1,4 +1,3 @@
-<%@ 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"%>
@@ -21,19 +20,20 @@
(already installed)
</c:when>
<c:otherwise>
- <c:if test="${!entry.eligible}">
+<%-- <c:if test="${!entry.eligible}">
<c:forEach var="prereq" items="${entry.prerequisites}">
<c:if test="${!prereq.present}">
(${prereq.moduleIdWithStars} is not installed)
</c:if>
</c:forEach>
- </c:if>
+ </c:if>--%>
+ (Not available; <a href="<portlet:actionURL><portlet:param name="configId" value="${entry.moduleId}"/><portlet:param name="repository" value="${repository}"/><portlet:param name="repo-user" value="${repouser}"/><portlet:param name="repo-pass" value="${repopass}"/><portlet:param name="mode" value="viewForDownload-before"/></portlet:actionURL>">View Details</a>)
</c:otherwise>
</c:choose>
</li>
</c:when>
<c:otherwise>
- <li><a href="<portlet:actionURL><portlet:param name="configId" value="${entry.moduleId}"/><portlet:param name="repository" value="${repository}"/><portlet:param name="repo-user" value="${repouser}"/><portlet:param name="repo-pass" value="${repopass}"/><portlet:param name="mode" value="download-before"/></portlet:actionURL>">${entry.name}<c:if test="${entry.name ne entry.moduleId}"> (${entry.version})</c:if></a></li>
+ <li><a href="<portlet:actionURL><portlet:param name="configId" value="${entry.moduleId}"/><portlet:param name="repository" value="${repository}"/><portlet:param name="repo-user" value="${repouser}"/><portlet:param name="repo-pass" value="${repopass}"/><portlet:param name="mode" value="viewForDownload-before"/></portlet:actionURL>">${entry.name}<c:if test="${entry.name ne entry.moduleId}"> (${entry.version})</c:if></a></li>
</c:otherwise>
</c:choose>
</c:forEach>
Added: geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/viewForDownload.jsp
URL: http://svn.apache.org/viewvc/geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/viewForDownload.jsp?rev=427388&view=auto
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/viewForDownload.jsp (added)
+++ geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/viewForDownload.jsp Mon Jul 31 17:43:46 2006
@@ -0,0 +1,121 @@
+<%@ 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/>
+
+<h1>${plugin.name}</h1>
+
+<p>Here is the available information on this plugin:</p>
+
+<table border="0">
+ <tr>
+ <th align="right" valign="top">Name:</th>
+ <td>${plugin.name}</td>
+ </tr>
+ <tr>
+ <th align="right" valign="top">Module ID:</th>
+ <td>${plugin.moduleId}</td>
+ </tr>
+ <tr>
+ <th align="right" valign="top">Group:</th>
+ <td>${plugin.category}</td>
+ </tr>
+ <tr>
+ <th align="right" valign="top">Description:</th>
+ <td>${plugin.HTMLDescription}</td>
+ </tr>
+ <tr>
+ <th align="right" valign="top">Author:</th>
+ <td>${plugin.author}</td>
+ </tr>
+ <tr>
+ <th align="right" valign="top">Web Site:</th>
+ <td><a href="${plugin.pluginURL}">${plugin.pluginURL}</a></td>
+ </tr>
+ <c:forEach var="license" items="${plugin.licenses}">
+ <tr>
+ <th align="right" valign="top">License:</th>
+ <td>${license.name}
+ <c:choose>
+ <c:when test="${license.osiApproved}">(Open Source)</c:when>
+ <c:otherwise>(Proprietary)</c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+ </c:forEach>
+ <tr>
+ <th align="right" valign="top">Ger Versions:</th>
+ <td>
+ ${fn:join(plugin.geronimoVersions, ", ")}
+ </td>
+ </tr>
+ <tr>
+ <th align="right" valign="top">JVM Versions:</th>
+ <td>
+ <c:choose>
+ <c:when test="${empty plugin.jvmVersions}">
+ <i>Any</i>
+ </c:when>
+ <c:otherwise>
+ ${fn:join(plugin.jvmVersions, ", ")}
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+ <tr>
+ <th align="right" valign="top">Dependencies:</th>
+ <td>
+ <c:forEach var="dependency" items="${plugin.dependencies}">
+ ${fn:replace(dependency, "//", "/*/")}<br />
+ </c:forEach>
+ </td>
+ </tr>
+ <tr>
+ <th align="right" valign="top">Prerequisites:</th>
+ <td>
+ <c:choose>
+ <c:when test="${empty plugin.prerequisites}">
+ <i>None</i>
+ </c:when>
+ <c:otherwise>
+ <c:forEach var="prereq" items="${plugin.prerequisites}">
+ <b>${prereq.moduleIdWithStars}</b> (${prereq.resourceType})<br/>
+ ${prereq.description}
+ <c:if test="${!prereq.present}">
+ <br /><b><font color="red">NOT AVAILABLE</font></b>
+ </c:if>
+ </c:forEach>
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+ <tr>
+ <th align="right" valign="top">Obsoletes:</th>
+ <td>
+ <c:choose>
+ <c:when test="${empty plugin.obsoletes}">
+ <i>None</i>
+ </c:when>
+ <c:otherwise>
+ <c:forEach var="module" items="${plugin.obsoletes}">
+ ${fn:replace(module, "//", "/*/")}<br />
+ </c:forEach>
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+
+</table>
+
+<c:if test="${plugin.eligible}">
+<form name="<portlet:namespace/>PluginForm" action="<portlet:actionURL/>">
+ <input type="hidden" name="configId" value="${configId}" />
+ <input type="hidden" name="mode" value="viewForDownload-after" />
+ <input type="hidden" name="repository" value="${repository}" />
+ <input type="hidden" name="repo-user" value="${repouser}" />
+ <input type="hidden" name="repo-pass" value="${repopass}" />
+ <input type="submit" value="Continue" />
+</form>
+</c:if>
+
+<p><a href="<portlet:actionURL portletMode="view"><portlet:param name="mode" value="index-before" /></portlet:actionURL>">Cancel</a></p>
Propchange: geronimo/trunk/applications/console/console-standard/src/webapp/WEB-INF/view/car/viewForDownload.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginMetadata.java?rev=427388&r1=427387&r2=427388&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginMetadata.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginMetadata.java Mon Jul 31 17:43:46 2006
@@ -18,6 +18,8 @@
import java.io.Serializable;
import java.net.URL;
+import java.util.List;
+import java.util.ArrayList;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.system.configuration.GBeanOverride;
@@ -96,6 +98,20 @@
}
/**
+ * Gets a description of this module in HTML format (with paragraph
+ * markers).
+ */
+ public String getHTMLDescription() {
+ String[] paras = splitParas(description);
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < paras.length; i++) {
+ String para = paras[i];
+ buf.append("<p>").append(para).append("</p>\n");
+ }
+ return buf.toString();
+ }
+
+ /**
* Gets a category name for this configuration. In a list, configurations
* in the same category will be listed together. There are no specific
* allowed values, though each repository may have standards for that.
@@ -348,5 +364,53 @@
}
return buf.toString();
}
+ }
+
+ private static String[] splitParas(String desc) {
+ int start = 0, last=0;
+ List list = new ArrayList();
+ boolean inSpace = false, multiple = false;
+ for(int i=0; i<desc.length(); i++) {
+ char c = desc.charAt(i);
+ if(inSpace) {
+ if(Character.isWhitespace(c)) {
+ if(c == '\r' || c == '\n') {
+ multiple = true;
+ for(int j=i+1; j<desc.length(); j++) {
+ char d = desc.charAt(j);
+ if(d != c && (d == '\r' || d == '\n')) {
+ i = j;
+ } else {
+ break;
+ }
+ }
+ }
+ } else {
+ if(multiple) {
+ list.add(desc.substring(last, start).trim());
+ last = i;
+ }
+ inSpace = false;
+ }
+ } else {
+ if(c == '\r' || c == '\n') {
+ inSpace = true;
+ multiple = false;
+ start = i;
+ for(int j=i+1; j<desc.length(); j++) {
+ char d = desc.charAt(j);
+ if(d != c && (d == '\r' || d == '\n')) {
+ i = j;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ if(last < desc.length()) {
+ list.add(desc.substring(last).trim());
+ }
+ return (String[]) list.toArray(new String[list.size()]);
}
}