geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r665873 - /geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Date Mon, 09 Jun 2008 20:20:54 GMT
Author: gawor
Date: Mon Jun  9 13:20:54 2008
New Revision: 665873

URL: http://svn.apache.org/viewvc?rev=665873&view=rev
Log:
ensure plugin validation is done once (GERONIMO-4111)

Modified:
    geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java

Modified: geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=665873&r1=665872&r2=665873&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
(original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Mon Jun  9 13:20:54 2008
@@ -546,6 +546,15 @@
         }
     }
 
+    private SourceRepository getDefaultSourceRepository(String defaultRepository,
+                                                        boolean restrictToDefaultRepository)
{
+        if (restrictToDefaultRepository && defaultRepository == null) {
+            throw new IllegalArgumentException("You must supply a default repository if you
want to restrict to it");
+        }
+        SourceRepository defaultSourceRepository = defaultRepository == null ? null : SourceRepositoryFactory.getSourceRepository(defaultRepository);
+        return defaultSourceRepository;
+    }
+    
     /**
      * Installs a configuration from a remote repository into the local Geronimo server,
      * including all its dependencies.  The caller will get the results when the
@@ -585,14 +594,15 @@
      * @param poller                      Will be notified with status updates as the download
proceeds
      */
     public void install(PluginListType pluginsToInstall, String defaultRepository, boolean
restrictToDefaultRepository, String username, String password, DownloadPoller poller) {
-        if (restrictToDefaultRepository && defaultRepository == null) {
-            throw new IllegalArgumentException("You must supply a default repository if you
want to restrict to it");
-        }
-        SourceRepository defaultSourceRepository = defaultRepository == null ? null : SourceRepositoryFactory.getSourceRepository(defaultRepository);
+        SourceRepository defaultSourceRepository = getDefaultSourceRepository(defaultRepository,
restrictToDefaultRepository);
         install(pluginsToInstall, defaultSourceRepository, restrictToDefaultRepository, username,
password, poller);
     }
 
     public void install(PluginListType pluginsToInstall, SourceRepository defaultRepository,
boolean restrictToDefaultRepository, String username, String password, DownloadPoller poller)
{
+        install(pluginsToInstall, defaultRepository, restrictToDefaultRepository, username,
password, poller, true);
+    }
+    
+    public void install(PluginListType pluginsToInstall, SourceRepository defaultRepository,
boolean restrictToDefaultRepository, String username, String password, DownloadPoller poller,
boolean validatePlugins) {
         List<Artifact> downloadedArtifacts = new ArrayList<Artifact>();
         try {
             Map<Artifact, PluginType> metaMap = new HashMap<Artifact, PluginType>();
@@ -600,8 +610,10 @@
             List<PluginType> toInstall = new ArrayList<PluginType>();
             for (PluginType metadata : pluginsToInstall.getPlugin()) {
                 try {
-                    validatePlugin(metadata);
-                    verifyPrerequisites(metadata);
+                    if (validatePlugins) {
+                        validatePlugin(metadata);
+                        verifyPrerequisites(metadata);
+                    }
 
                     PluginArtifactType instance = metadata.getPluginArtifact().get(0);
 
@@ -841,6 +853,8 @@
 
             // 2. Validate that we can install this
             validatePlugin(data);
+            verifyPrerequisites(data);
+            
             PluginArtifactType instance = data.getPluginArtifact().get(0);
             // 3. Install the CAR into the repository (it shouldn't be re-downloaded)
             if (instance.getModuleId() != null) {
@@ -854,11 +868,13 @@
             }
 
             // 4. Use the standard logic to remove obsoletes, install dependencies, etc.
-            //    This will validate all over again (oh, well)
             PluginListType pluginList = new PluginListType();
             pluginList.getPlugin().add(data);
             pluginList.getDefaultRepository().addAll(instance.getSourceRepository());
-            install(pluginList, defaultRepository, restrictToDefaultRepository, username,
password, poller);
+            
+            SourceRepository defaultSourceRepository = getDefaultSourceRepository(defaultRepository,
restrictToDefaultRepository);
+            
+            install(pluginList, defaultSourceRepository, restrictToDefaultRepository, username,
password, poller, false);
         } catch (Exception e) {
             poller.setFailure(e);
         } finally {



Mime
View raw message