Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBJ Hargrave2011-10-31 18:51:48 +0000
committerBJ Hargrave2011-10-31 18:51:48 +0000
commit22ea986465e11d51890d7775b746c41794f4a141 (patch)
treea7893746ee22bcd451d2d4b339f76af49c4e679a /bundles/org.eclipse.osgi/resolver
parent7e1d35c04d1f6559b7dc584e8d91adfc5ea0adac (diff)
downloadrt.equinox.framework-22ea986465e11d51890d7775b746c41794f4a141.tar.gz
rt.equinox.framework-22ea986465e11d51890d7775b746c41794f4a141.tar.xz
rt.equinox.framework-22ea986465e11d51890d7775b746c41794f4a141.zip
Bug 354191: Update OSGi framework API
Diffstat (limited to 'bundles/org.eclipse.osgi/resolver')
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java63
1 files changed, 56 insertions, 7 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
index e88293c9b..233688919 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
@@ -12,9 +12,6 @@
*******************************************************************************/
package org.eclipse.osgi.internal.resolver;
-import org.osgi.framework.resource.Capability;
-import org.osgi.framework.resource.Requirement;
-
import java.io.IOException;
import java.net.URL;
import java.util.*;
@@ -25,6 +22,7 @@ import org.eclipse.osgi.framework.util.KeyedElement;
import org.eclipse.osgi.internal.loader.BundleLoaderProxy;
import org.eclipse.osgi.service.resolver.*;
import org.osgi.framework.*;
+import org.osgi.framework.resource.*;
import org.osgi.framework.wiring.*;
public final class BundleDescriptionImpl extends BaseDescriptionImpl implements BundleDescription, KeyedElement {
@@ -1035,6 +1033,39 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
}
}
+ /**
+ * Coerce the generic type of a list from List<BundleWire>
+ * to List<Wire>
+ * @param l List to be coerced.
+ * @return l coerced to List<Wire>
+ */
+ @SuppressWarnings("unchecked")
+ static List<Wire> asListWire(List<? extends Wire> l) {
+ return (List<Wire>) l;
+ }
+
+ /**
+ * Coerce the generic type of a list from List<BundleCapability>
+ * to List<Capability>
+ * @param l List to be coerced.
+ * @return l coerced to List<Capability>
+ */
+ @SuppressWarnings("unchecked")
+ static List<Capability> asListCapability(List<? extends Capability> l) {
+ return (List<Capability>) l;
+ }
+
+ /**
+ * Coerce the generic type of a list from List<BundleRequirement>
+ * to List<Requirement>
+ * @param l List to be coerced.
+ * @return l coerced to List<Requirement>
+ */
+ @SuppressWarnings("unchecked")
+ static List<Requirement> asListRequirement(List<? extends Requirement> l) {
+ return (List<Requirement>) l;
+ }
+
// Note that description wiring are identity equality based
class DescriptionWiring implements BundleWiring {
private volatile boolean valid = true;
@@ -1082,6 +1113,10 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
return result;
}
+ public List<Capability> getResourceCapabilities(String namespace) {
+ return asListCapability(getCapabilities(namespace));
+ }
+
public List<BundleRequirement> getRequirements(String namespace) {
List<BundleWire> requiredWires = getRequiredWires(namespace);
if (requiredWires == null)
@@ -1115,6 +1150,10 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
return requirements;
}
+ public List<Requirement> getResourceRequirements(String namespace) {
+ return asListRequirement(getRequirements(namespace));
+ }
+
public List<BundleWire> getProvidedWires(String namespace) {
if (!isInUse())
return null;
@@ -1142,6 +1181,10 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
return orderedResult;
}
+ public List<Wire> getProvidedResourceWires(String namespace) {
+ return asListWire(getProvidedWires(namespace));
+ }
+
public List<BundleWire> getRequiredWires(String namespace) {
if (!isInUse())
return null;
@@ -1167,10 +1210,18 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
return result;
}
+ public List<Wire> getRequiredResourceWires(String namespace) {
+ return asListWire(getRequiredWires(namespace));
+ }
+
public BundleRevision getRevision() {
return BundleDescriptionImpl.this;
}
+ public BundleRevision getResource() {
+ return getRevision();
+ }
+
public ClassLoader getClassLoader() {
SecurityManager sm = System.getSecurityManager();
if (sm != null)
@@ -1232,13 +1283,11 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
}
}
- @SuppressWarnings({"cast", "unchecked", "rawtypes"})
public List<Capability> getCapabilities(String namespace) {
- return (List<Capability>) (List) getDeclaredCapabilities(namespace);
+ return asListCapability(getDeclaredCapabilities(namespace));
}
- @SuppressWarnings({"cast", "unchecked", "rawtypes"})
public List<Requirement> getRequirements(String namespace) {
- return (List<Requirement>) (List) getDeclaredRequirements(namespace);
+ return asListRequirement(getDeclaredRequirements(namespace));
}
}

Back to the top