Do not use the OSGi API using generics, KF does not support it.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1478019 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ConfigurationTracker.java b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ConfigurationTracker.java
index df3b34b..8853dc0 100644
--- a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ConfigurationTracker.java
+++ b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ConfigurationTracker.java
@@ -45,7 +45,7 @@
* The tracker instance.
*/
private static ConfigurationTracker m_singleton;
- private final ServiceRegistration<ConfigurationListener> m_registration;
+ private final ServiceRegistration m_registration;
private final BundleContext m_context;
private final Logger m_logger;
private Map<String, IPojoFactory> m_factories = new HashMap<String, IPojoFactory>();
@@ -57,7 +57,7 @@
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(Constants.SERVICE_DESCRIPTION, "iPOJO Configuration Admin Listener");
props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
- m_registration = m_context.registerService(ConfigurationListener.class, this, props);
+ m_registration = m_context.registerService(ConfigurationListener.class.getName(), this, props);
}
public static void initialize() {
diff --git a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/ServiceLocator.java b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/ServiceLocator.java
index bd970d4..98bc4fb 100644
--- a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/ServiceLocator.java
+++ b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/ServiceLocator.java
@@ -29,7 +29,7 @@
private final BundleContext m_context;
private final Class<T> m_clazz;
- private ServiceReference<T> m_reference;
+ private ServiceReference m_reference;
private T m_service;
public ServiceLocator(Class<T> clazz, BundleContext context) {
@@ -42,11 +42,13 @@
return m_service;
}
- m_reference = m_context.getServiceReference(m_clazz);
+ // We can't use the generic version, as KF does not support it yet.
+ m_reference = m_context.getServiceReference(m_clazz.getName());
if (m_reference == null) {
return null;
}
- m_service = m_context.getService(m_reference);
+
+ m_service = (T) m_context.getService(m_reference);
return m_service;
}