geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmcma...@apache.org
Subject svn commit: r584221 - in /geronimo/server/trunk: modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/ plugins/console/console-base-portlets/src/m...
Date Fri, 12 Oct 2007 18:12:19 GMT
Author: pmcmahan
Date: Fri Oct 12 11:11:32 2007
New Revision: 584221

URL: http://svn.apache.org/viewvc?rev=584221&view=rev
Log:
GERONIMO-3496 reenable prerequisite check for plugin installation, but make the check optional
via
a separate method.

Modified:
    geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ListHandler.java
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/car/viewForDownload.jsp

Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java?rev=584221&r1=584220&r2=584221&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
(original)
+++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
Fri Oct 12 11:11:32 2007
@@ -55,6 +55,7 @@
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.system.jmx.KernelDelegate;
 import org.apache.geronimo.system.plugin.DownloadPoller;
@@ -179,6 +180,16 @@
             kernel.getProxyManager().destroyProxy(installer);
         }
     }
+
+    public Dependency[] checkPrerequisites(PluginType plugin) {
+        PluginInstaller installer = getPluginInstaller();
+        try {
+            return installer.checkPrerequisites(plugin);
+        } finally {
+            kernel.getProxyManager().destroyProxy(installer);
+        }
+    }
+
 
     public DownloadResults install(PluginListType configsToInstall, String username, String
password) {
         PluginInstaller installer = getPluginInstaller();

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java?rev=584221&r1=584220&r2=584221&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
Fri Oct 12 11:11:32 2007
@@ -22,6 +22,7 @@
 import java.util.Map;
 import javax.security.auth.login.FailedLoginException;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
@@ -160,13 +161,22 @@
     public DownloadResults checkOnInstall(Object key);
 
     /**
-     * Ensures that a plugin artifact is installable.
+     * Ensures that a plugin artifact is installable. Checks the Geronimo version,
+     * JVM version, and whether or not the plugin is already installed.
      *
      * @param plugin plugin artifact to check
      * @throws org.apache.geronimo.kernel.repository.MissingDependencyException
-     *          if plugin requires a dependency that is not present
+     *          if a dependency is not satisfied
      */
     public void validatePlugin(PluginType plugin) throws MissingDependencyException;
+
+    /**
+     * Ensures that a plugin's prerequisites are installed
+     *
+     * @param plugin plugin artifact to check
+     * @return array of missing depedencies
+     */
+    public Dependency[] checkPrerequisites(PluginType plugin);
 
     PluginListType createPluginListForRepositories(ConfigurationManager mgr, String repo)
throws NoSuchStoreException;
 }

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=584221&r1=584220&r2=584221&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Fri Oct 12 11:11:32 2007
@@ -655,19 +655,8 @@
                 }
             }
         }
-        // 2. Check that we meet the prerequisites
-/*
-        List<PrerequisiteType> prereqs = metadata.getPrerequisite();
-        for (PrerequisiteType prereq : prereqs) {
-            Artifact artifact = toArtifact(prereq.getId());
-            if (artifactResolver.queryArtifacts(artifact).length == 0) {
-                log.error("Configuration '" + artifact + "' required for plugin '" + toArtifact(metadata.getModuleId())
+ "' is not installed.");
-                throw new MissingDependencyException(
-                        "Configuration '" + artifact + "' required for plugin '" + toArtifact(metadata.getModuleId())
+ "' is not installed.");
-            }
-        }
-*/
-        // 3. Check that we meet the Geronimo, JVM versions
+        
+        // 2. Check that we meet the Geronimo, JVM versions
         if (metadata.getGeronimoVersion().size() > 0 && !checkGeronimoVersions(metadata.getGeronimoVersion()))
{
             log.error("Cannot install plugin " + toArtifact(metadata.getModuleId()) + " on
Geronimo " + serverInfo.getVersion());
             throw new MissingDependencyException(
@@ -679,6 +668,31 @@
             throw new MissingDependencyException(
                     "Cannot install plugin on JVM " + System.getProperty("java.version"),
toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
         }
+    }
+
+
+    /**
+     * Ensures that a plugin's prerequisites are installed
+     *
+     * @param plugin plugin artifact to check
+     * @return array of missing depedencies
+     */
+    public Dependency[] checkPrerequisites(PluginType plugin) {
+        if (plugin.getPluginArtifact().size() != 1) {
+            throw new IllegalArgumentException("A plugin configuration must include one plugin
artifact, not " + plugin.getPluginArtifact().size());
+        }
+        
+        PluginArtifactType metadata = plugin.getPluginArtifact().get(0);
+        List<PrerequisiteType> prereqs = metadata.getPrerequisite();
+        
+        ArrayList<Dependency> missingPrereqs = new ArrayList<Dependency>();
+        for (PrerequisiteType prereq : prereqs) {
+            Artifact artifact = toArtifact(prereq.getId());
+            if (artifactResolver.queryArtifacts(artifact).length == 0) {
+                missingPrereqs.add(new Dependency(artifact,ImportType.ALL));
+            }
+        }
+        return missingPrereqs.toArray(new Dependency[missingPrereqs.size()]);
     }
 
     /**

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ListHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ListHandler.java?rev=584221&r1=584220&r2=584221&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ListHandler.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ListHandler.java
Fri Oct 12 11:11:32 2007
@@ -32,6 +32,7 @@
 
 import org.apache.geronimo.console.MultiPageModel;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.system.plugin.PluginInstaller;
 import org.apache.geronimo.system.plugin.PluginInstallerGBean;
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
@@ -119,10 +120,14 @@
                 plugin.setPluginArtifact(artifact);
                 
                 // determine if the plugin is installable
+                PluginType holder = PluginInstallerGBean.copy(metadata, artifact);
                 try {
-                    PluginType holder = PluginInstallerGBean.copy(metadata, artifact);
                     pluginInstaller.validatePlugin(holder);
                 } catch (Exception e) {
+                    plugin.setInstallable(false);
+                }
+                Dependency[] missingPrereqs = pluginInstaller.checkPrerequisites(holder);
+                if (missingPrereqs.length > 0) {
                     plugin.setInstallable(false);
                 }
                 plugins.add(plugin);

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java?rev=584221&r1=584220&r2=584221&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
Fri Oct 12 11:11:32 2007
@@ -30,6 +30,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.MultiPageModel;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.system.plugin.PluginInstaller;
 import org.apache.geronimo.system.plugin.PluginInstallerGBean;
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
@@ -92,17 +93,28 @@
         }
         
         // see if the plugin is installable.  if not then provide the details
-        String validation = "All requirements for this plugin have been met.";
+        String validationOk = "All requirements for this plugin have been met.";
+        StringBuffer validationNotOk = new StringBuffer();
         PluginInstaller pluginInstaller = PortletManager.getCurrentServer(request).getPluginInstaller();
         PluginType holder = PluginInstallerGBean.copy(plugin.getPlugin(), plugin.getPluginArtifact());
         try {
             pluginInstaller.validatePlugin(holder);
         } catch (Exception e) {
             plugin.setInstallable(false);
-            validation = e.getMessage();
+            validationNotOk.append(e.getMessage());
+            validationNotOk.append("<BR>\n");
+        }
+        Dependency[] missingPrereqs = pluginInstaller.checkPrerequisites(holder);
+        if (missingPrereqs.length > 0) {
+            plugin.setInstallable(false);
+            for (Dependency dep : missingPrereqs) {
+                validationNotOk.append(" Missing prerequisite ");
+                validationNotOk.append(dep.getArtifact().toString());
+                validationNotOk.append("<BR>\n");
+            }
         }
         
-        request.setAttribute("validation", validation);
+        request.setAttribute("validation", plugin.isInstallable() ? validationOk : validationNotOk.toString());
         request.setAttribute("configId", configId);
         request.setAttribute("plugin", plugin);
         request.setAttribute("repository", repo);

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/car/viewForDownload.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/car/viewForDownload.jsp?rev=584221&r1=584220&r2=584221&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/car/viewForDownload.jsp
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/car/viewForDownload.jsp
Fri Oct 12 11:11:32 2007
@@ -128,7 +128,7 @@
   <tr>
     <th align="right" valign="top">Installable:</th>
     <td>
-    ${plugin.installable ? "<img alt='check' src='/console/images/checkmark._16_green.png'
/>" : "<strong><font color='red'>X</font></strong>"}
+    ${plugin.installable ? "<img alt='check' src='/console/images/checkmark._16_green.png'
/> " : "<strong><font color='red'>X</font></strong> "}
     ${validation}
     </td>
   </tr>



Mime
View raw message