aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1738985 - in /aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem: obr/internal/NamespaceTranslator.java util/felix/FelixResourceAdapter.java util/felix/OsgiWiringHostCapability.java util/felix/packageinfo
Date Wed, 13 Apr 2016 18:51:13 GMT
Author: jwross
Date: Wed Apr 13 18:51:13 2016
New Revision: 1738985

URL: http://svn.apache.org/viewvc?rev=1738985&view=rev
Log:
[ARIES-1523] Application with fragment in archive and host in OBR will fail to resolve.

The Felix OBR resource adapter now treats the osgi.wiring.host capability as a special case,
similar to osgi.identity and osgi.content.

The osgi.wiring.host <-> fragment namespace translation was removed because it is unnecessary.
In OBR, the fragment namespace is a capability added to fragments for the purpose of repository
searches. This capability would never be used as part of matching an osgi.wiring.host requirement
because the resource of the corresponding capability must be the host.

The org.apache.aries.subsystem.util.felix package version was incremented from 1.0.1 to 1.1.0
because a new support class was added.

Added:
    aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/OsgiWiringHostCapability.java
Modified:
    aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java
    aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java
    aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo

Modified: aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java?rev=1738985&r1=1738984&r2=1738985&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java
(original)
+++ aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java
Wed Apr 13 18:51:13 2016
@@ -18,7 +18,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.osgi.framework.namespace.BundleNamespace;
-import org.osgi.framework.namespace.HostNamespace;
 import org.osgi.framework.namespace.PackageNamespace;
 import org.osgi.namespace.service.ServiceNamespace;
 
@@ -30,11 +29,9 @@ public class NamespaceTranslator {
 		result.put(PackageNamespace.PACKAGE_NAMESPACE, org.apache.felix.bundlerepository.Capability.PACKAGE);
 		result.put(ServiceNamespace.SERVICE_NAMESPACE, org.apache.felix.bundlerepository.Capability.SERVICE);
 		result.put(BundleNamespace.BUNDLE_NAMESPACE, org.apache.felix.bundlerepository.Capability.BUNDLE);
-		result.put(HostNamespace.HOST_NAMESPACE, org.apache.felix.bundlerepository.Capability.FRAGMENT);
 		result.put(org.apache.felix.bundlerepository.Capability.PACKAGE, PackageNamespace.PACKAGE_NAMESPACE);
 		result.put(org.apache.felix.bundlerepository.Capability.SERVICE, ServiceNamespace.SERVICE_NAMESPACE);
 		result.put(org.apache.felix.bundlerepository.Capability.BUNDLE, BundleNamespace.BUNDLE_NAMESPACE);
-		result.put(org.apache.felix.bundlerepository.Capability.FRAGMENT, HostNamespace.HOST_NAMESPACE);
 		return Collections.unmodifiableMap(result);
 	}
 	

Modified: aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java?rev=1738985&r1=1738984&r2=1738985&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java
(original)
+++ aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java
Wed Apr 13 18:51:13 2016
@@ -22,6 +22,7 @@ import java.util.Map;
 
 import org.apache.aries.subsystem.obr.internal.NamespaceTranslator;
 import org.apache.aries.subsystem.obr.internal.ResourceHelper;
+import org.osgi.framework.namespace.HostNamespace;
 import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.resource.Capability;
 import org.osgi.resource.Requirement;
@@ -74,6 +75,13 @@ public class FelixResourceAdapter implem
 			if (namespace != null) {
 				result.trimToSize();
 			    return Collections.unmodifiableList(result);
+			}
+		}
+		if (namespace == null || namespace.equals(HostNamespace.HOST_NAMESPACE)) {
+			result.add(new OsgiWiringHostCapability(this, resource.getSymbolicName(), resource.getVersion()));
+			if (namespace != null) {
+				result.trimToSize();
+			    return Collections.unmodifiableList(result);
 			}
 		}
 		org.apache.felix.bundlerepository.Capability[] capabilities = resource.getCapabilities();

Added: aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/OsgiWiringHostCapability.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/OsgiWiringHostCapability.java?rev=1738985&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/OsgiWiringHostCapability.java
(added)
+++ aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/OsgiWiringHostCapability.java
Wed Apr 13 18:51:13 2016
@@ -0,0 +1,50 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.aries.subsystem.util.felix;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.aries.subsystem.obr.internal.AbstractCapability;
+import org.osgi.framework.Version;
+import org.osgi.framework.namespace.HostNamespace;
+import org.osgi.resource.Resource;
+
+public class OsgiWiringHostCapability extends AbstractCapability {
+	private final Map<String, Object> attributes = new HashMap<String, Object>();
+	private final Resource resource;
+	
+	public OsgiWiringHostCapability(Resource resource, String symbolicName, Version version)
{
+		attributes.put(HostNamespace.HOST_NAMESPACE, symbolicName);
+		attributes.put(HostNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, version);
+		this.resource = resource;
+	}
+
+	public Map<String, Object> getAttributes() {
+		return Collections.unmodifiableMap(attributes);
+	}
+
+	public Map<String, String> getDirectives() {
+		return Collections.emptyMap();
+	}
+
+	public String getNamespace() {
+		return HostNamespace.HOST_NAMESPACE;
+	}
+
+	public Resource getResource() {
+		return resource;
+	}
+}

Modified: aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo?rev=1738985&r1=1738984&r2=1738985&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo
(original)
+++ aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo
Wed Apr 13 18:51:13 2016
@@ -16,4 +16,4 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-version 1.0.1
+version 1.1.0



Mime
View raw message