You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2008/01/14 06:42:20 UTC

svn commit: r611714 - in /geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin: PluginInstallerGBean.java SourceRepositoryFactory.java

Author: djencks
Date: Sun Jan 13 21:42:12 2008
New Revision: 611714

URL: http://svn.apache.org/viewvc?rev=611714&view=rev
Log:
GERONIMO-3741 Make install-plugin work, using solution from YunFeng Ma

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

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=611714&r1=611713&r2=611714&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Sun Jan 13 21:42:12 2008
@@ -540,7 +540,7 @@
      * DownloadPoller.
      *
      * @param pluginsToInstall            The list of configurations to install
-     * @param defaultRepository           Default repo to look for plugins in
+     * @param defaultRepository           Default repo to look for plugins in (not required)
      * @param restrictToDefaultRepository Whether to follow hints to other plugin repos.
      * @param username                    Optional username, if the maven repo uses HTTP Basic authentication.
      *                                    Set this to null if no authentication is required.
@@ -549,7 +549,10 @@
      * @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) {
-        SourceRepository defaultSourceRepository = SourceRepositoryFactory.getSourceRepository(defaultRepository);
+        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);
         install(pluginsToInstall, defaultSourceRepository, restrictToDefaultRepository, username, password, poller);
     }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/SourceRepositoryFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/SourceRepositoryFactory.java?rev=611714&r1=611713&r2=611714&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/SourceRepositoryFactory.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/SourceRepositoryFactory.java Sun Jan 13 21:42:12 2008
@@ -32,6 +32,9 @@
     }
 
     public static SourceRepository getSourceRepository(String repo) {
+        if (repo == null) {
+            throw new IllegalArgumentException("No repo supplied");
+        }
         URI repoURI = PluginRepositoryDownloader.resolveRepository(repo);
         if (repoURI == null) {
             throw new IllegalStateException("Can't locate repo " + repo);