Author: gnodet
Date: Thu Mar 27 10:12:05 2008
New Revision: 641904
URL: http://svn.apache.org/viewvc?rev=641904&view=rev
Log:
Allow the features:refreshUrl to reload everything
Modified:
servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/gshell/features/internal/commands/RefreshUrlCommand.java
Modified:
servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/gshell/features/internal/commands/RefreshUrlCommand.java
URL:
http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/gshell/features/internal/commands/RefreshUrlCommand.java?rev=641904&r1=641903&r2=641904&view=diff
==============================================================================
---
servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/gshell/features/internal/commands/RefreshUrlCommand.java
(original)
+++
servicemix/smx4/kernel/trunk/gshell/gshell-features/src/main/java/org/apache/servicemix/gshell/features/internal/commands/RefreshUrlCommand.java
Thu Mar 27 10:12:05 2008
@@ -16,20 +16,28 @@
*/
package org.apache.servicemix.gshell.features.internal.commands;
-import java.util.List;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.geronimo.gshell.clp.Argument;
import org.apache.geronimo.gshell.command.annotation.CommandComponent;
import org.apache.servicemix.gshell.features.FeaturesService;
+import org.apache.servicemix.gshell.features.Repository;
@CommandComponent(id="features:refreshUrl", description="Reload the
repositories to obtain a fresh list of features")
public class RefreshUrlCommand extends FeaturesCommandSupport {
- @Argument(required = true, multiValued = true, description = "Repository
URLs")
+ @Argument(required = false, multiValued = true, description = "Repository
URLs (leave empty for all)")
List<String> urls;
protected void doExecute(FeaturesService admin) throws Exception {
+ if (urls == null || urls.isEmpty()) {
+ urls = new ArrayList<String>();
+ for (Repository repo : admin.listRepositories()) {
+ urls.add(repo.getURL().toString());
+ }
+ }
for (String strUrl : urls) {
URL url = new URL(strUrl);
admin.removeRepository(url);