Author: fmeschbe
Date: Sat Feb 14 15:42:14 2009
New Revision: 744508
URL: http://svn.apache.org/viewvc?rev=744508&view=rev
Log:
FELIX-940 Add capability ee of the system bundle representing the
execution environment(s) of the OSGi framework
Modified:
felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/CapabilityImpl.java
felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
Modified:
felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/CapabilityImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/CapabilityImpl.java?rev=744508&r1=744507&r2=744508&view=diff
==============================================================================
---
felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/CapabilityImpl.java
(original)
+++
felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/CapabilityImpl.java
Sat Feb 14 15:42:14 2009
@@ -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
Modified:
felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java?rev=744508&r1=744507&r2=744508&view=diff
==============================================================================
---
felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
(original)
+++
felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
Sat Feb 14 15:42:14 2009
@@ -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() {