karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject karaf git commit: [KARAF-2104] Allow multiple URLs refresh by regex in feature:repo-refresh command
Date Wed, 10 Dec 2014 16:29:30 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x b1724b4a8 -> b0a0fa8cc


[KARAF-2104] Allow multiple URLs refresh by regex in feature:repo-refresh command


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/b0a0fa8c
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/b0a0fa8c
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/b0a0fa8c

Branch: refs/heads/karaf-3.0.x
Commit: b0a0fa8cc4f2408f204fb5b78c212ddd1dc66804
Parents: b1724b4
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
Authored: Wed Dec 10 17:28:45 2014 +0100
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Wed Dec 10 17:28:45 2014 +0100

----------------------------------------------------------------------
 .../karaf/features/command/RepoRefreshCommand.java | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/b0a0fa8c/features/command/src/main/java/org/apache/karaf/features/command/RepoRefreshCommand.java
----------------------------------------------------------------------
diff --git a/features/command/src/main/java/org/apache/karaf/features/command/RepoRefreshCommand.java
b/features/command/src/main/java/org/apache/karaf/features/command/RepoRefreshCommand.java
index 2f908f8..5a59254 100644
--- a/features/command/src/main/java/org/apache/karaf/features/command/RepoRefreshCommand.java
+++ b/features/command/src/main/java/org/apache/karaf/features/command/RepoRefreshCommand.java
@@ -17,6 +17,8 @@
 package org.apache.karaf.features.command;
 
 import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -52,18 +54,23 @@ public class RepoRefreshCommand extends AbstractAction {
         	URI uri = featureFinder.getUriFor(nameOrUrl, effectiveVersion);
         	if (uri == null) {
 				// regex on the URL
+				List<URI> uris = new ArrayList<URI>();
 				Pattern pattern = Pattern.compile(nameOrUrl);
 				for (Repository r : featuresService.listRepositories()) {
 					URI u = r.getURI();
 					Matcher matcher = pattern.matcher(u.toString());
 					if (matcher.matches()) {
-						uri = u;
-						break;
+						uris.add(u);
 					}
 				}
-        	}
-        	System.out.println("Refreshing feature url " + uri);
-        	featuresService.refreshRepository(uri);
+				for (URI u : uris) {
+					System.out.println("Refreshing feature url " + u);
+					featuresService.refreshRepository(u);
+				}
+        	} else {
+				System.out.println("Refreshing feature url " + uri);
+				featuresService.refreshRepository(uri);
+			}
     	} else {
     		refreshAll();
     	}


Mime
View raw message