Description: Add some delegator for OSGi R4.3 support (related to generics)
Author: Damien Raude-Morvan <drazzib@debian.org>
Last-Update: 2011-11-20
Forwarded: no
Index: b/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundle.java
===================================================================
--- a/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundle.java
+++ b/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundle.java
@@ -21,6 +21,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.File;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -195,5 +196,19 @@
     public String toString() {
         return "[DelegatingBundle: " + bundles + "]";
     }
-           
+    
+    // OSGI 4.3
+    public File getDataFile(String filename) {
+        return bundle.getDataFile(filename);
+    }
+    
+    // OSGI 4.3
+    public <A> A adapt(Class<A> type) {
+        return bundle.<A>adapt(type);
+    }
+
+    // OSGI 4.3
+    public int compareTo(Bundle bundle) {
+        return bundle.compareTo(bundle);
+    }
 }
Index: b/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java
===================================================================
--- a/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java
+++ b/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java
@@ -22,6 +22,7 @@
 import java.io.File;
 import java.io.InputStream;
 import java.util.Dictionary;
+import java.util.Collection;
 
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -139,4 +140,28 @@
         return bundleContext.ungetService(arg0);
     }
     
+    // OSGI 4.3
+    public <S> ServiceRegistration<S> registerService(Class<S> clazz,
+                                           S service,
+                                           Dictionary<String,?> properties) {
+        return bundleContext.registerService(clazz, service, properties);
+    }
+    
+    // OSGI 4.3
+    public <S> ServiceReference<S> getServiceReference(Class<S> clazz) {
+        return bundleContext.getServiceReference(clazz);
+    }
+    
+    // OSGI 4.3
+    public <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz,
+                                                                   String filter)
+                                                               throws InvalidSyntaxException {
+        return bundleContext.getServiceReferences(clazz, filter);
+    }
+    
+    // OSGI 4.3
+    public Bundle getBundle(String location) {
+        return bundleContext.getBundle(location);
+    }
+
 }
