aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1558067 - /aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemUri.java
Date Tue, 14 Jan 2014 15:04:56 GMT
Author: davidb
Date: Tue Jan 14 15:04:56 2014
New Revision: 1558067

URL: http://svn.apache.org/r1558067
Log:
Attempt to fix ARIES-1147


Modified:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemUri.java

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemUri.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemUri.java?rev=1558067&r1=1558066&r2=1558067&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemUri.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemUri.java
Tue Jan 14 15:04:56 2014
@@ -30,11 +30,11 @@ import org.osgi.service.subsystem.Subsys
 public class SubsystemUri {
 	private static final String REGEXP = "([^=]*)=([^&]*)&?";
 	private static final Pattern PATTERN = Pattern.compile(REGEXP);
-	
+
 	private final String symbolicName;
 	private final URL url;
 	private final Version version;
-	
+
 	public SubsystemUri(String location) throws URISyntaxException, MalformedURLException {
 		if (!location.startsWith("subsystem://"))
 			throw new IllegalArgumentException(location);
@@ -48,17 +48,32 @@ public class SubsystemUri {
 		Version version = Version.emptyVersion;
 		while (matcher.find()) {
 			String name = matcher.group(1);
-			if (SubsystemSymbolicNameHeader.NAME.equals(name))
-				symbolicName = new SubsystemSymbolicNameHeader(matcher.group(2)).getValue();
-			else if (SubsystemVersionHeader.NAME.equals(name))
-				version = Version.parseVersion(matcher.group(2));
-			else
+			if (SubsystemSymbolicNameHeader.NAME.equals(name)) {
+			    int idx = location.indexOf("!/");
+                if (idx > 0) {
+			        symbolicName = location.substring(idx + 2);
+			        int idx2 = symbolicName.indexOf('@');
+			        if (idx2 > 0) {
+			            symbolicName = symbolicName.substring(0, idx2);
+			        }
+			    } else {
+			        symbolicName = new SubsystemSymbolicNameHeader(matcher.group(2)).getValue();
+			    }
+			} else if (SubsystemVersionHeader.NAME.equals(name)) {
+			    String group = matcher.group(2);
+			    if (group.contains("!/") && group.contains("@")) {
+			        int idx = group.lastIndexOf('@');
+			        version = Version.parseVersion(group.substring(idx + 1));
+			    } else {
+			        version = Version.parseVersion(group);
+			    }
+			} else
 				throw new IllegalArgumentException("Unsupported subsystem URI parameter: " + name);
 		}
 		this.symbolicName = symbolicName;
 		this.version = version;
 	}
-	
+
 	public SubsystemUri(String symbolicName, Version version, URL url) {
 		// TODO symbolicName should conform to OSGi grammar.
 		if (symbolicName == null || symbolicName.length() == 0)
@@ -68,19 +83,19 @@ public class SubsystemUri {
 		this.version = version;
 		this.url = url;
 	}
-	
+
 	public String getSymbolicName() {
 		return symbolicName;
 	}
-	
+
 	public URL getURL() {
 		return url;
 	}
-	
+
 	public Version getVersion() {
 		return version;
 	}
-	
+
 	public String toString() {
 		StringBuilder builder = new StringBuilder("subsystem://");
 		if (url != null) {



Mime
View raw message