FELIX-940 Add capability ee of the system bundle representing the
execution environment(s) of the OSGi framework
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@744508 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/CapabilityImpl.java b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/CapabilityImpl.java
index c214ac9..43c719a 100644
--- a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/CapabilityImpl.java
+++ b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/CapabilityImpl.java
@@ -56,4 +56,9 @@
{
m_map.put(prop.getN(), prop.getV());
}
+
+ protected void addP(String name, Object value)
+ {
+ m_map.put(name, value);
+ }
}
\ No newline at end of file
diff --git a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
index 78cd147..6c3eee3 100644
--- a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
+++ b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
@@ -19,13 +19,16 @@
package org.apache.felix.bundlerepository;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.StringTokenizer;
import org.osgi.framework.AllServiceListener;
import org.osgi.framework.Bundle;
@@ -214,6 +217,27 @@
// For the system bundle, add a special platform capability.
if (m_bundle.getBundleId() == 0)
{
+ // set the execution environment(s) as Capability ee of the
+ // system bundle to resolve bundles with specifc requirements
+ String ee = m_bundle.getBundleContext().getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT);
+ if (ee != null)
+ {
+ StringTokenizer tokener = new StringTokenizer(ee, ",");
+ List eeList = new ArrayList();
+ while (tokener.hasMoreTokens())
+ {
+ String eeName = tokener.nextToken().trim();
+ if (eeName.length() > 0)
+ {
+ eeList.add(eeName);
+ }
+ }
+ CapabilityImpl cap = new CapabilityImpl();
+ cap.setName("ee");
+ cap.addP("ee", eeList);
+ addCapability(cap);
+ }
+
/* TODO: OBR - Fix system capabilities.
// Create a case-insensitive map.
Map map = new TreeMap(new Comparator() {