FELIX-4796 : Log deprecation warning if Felix whiteboard is used
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1679550 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/AbstractListenerManager.java b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/AbstractListenerManager.java
index 22687a1..558484d 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/AbstractListenerManager.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/AbstractListenerManager.java
@@ -21,11 +21,16 @@
import java.util.ArrayList;
import java.util.Iterator;
+import org.apache.felix.http.base.internal.logger.SystemLogger;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Filter;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
+/**
+ * @deprecated
+ */
+@Deprecated
public class AbstractListenerManager<ListenerType> extends ServiceTracker<ListenerType, ListenerType>
{
@@ -75,33 +80,37 @@
@Override
public ListenerType addingService(ServiceReference<ListenerType> reference)
{
+ final ListenerType result = super.addingService(reference);
+ if ( result != null ) {
+ SystemLogger.warning("Deprecation warning: " +
+ "Listener registered through Apache Felix whiteboard service: " + reference +
+ ". Please change your code to the OSGi Whiteboard Service.", null);
+ }
synchronized (lock)
{
allContextListeners = null;
}
- return super.addingService(reference);
+ return result;
}
@Override
public void modifiedService(ServiceReference<ListenerType> reference, ListenerType service)
{
+ super.modifiedService(reference, service);
synchronized (lock)
{
allContextListeners = null;
}
-
- super.modifiedService(reference, service);
}
@Override
public void removedService(ServiceReference<ListenerType> reference, ListenerType service)
{
+ super.removedService(reference, service);
synchronized (lock)
{
allContextListeners = null;
}
-
- super.removedService(reference, service);
}
}
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/HttpSessionAttributeListenerManager.java b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/HttpSessionAttributeListenerManager.java
index 74a1a1f..99c2bf8 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/HttpSessionAttributeListenerManager.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/HttpSessionAttributeListenerManager.java
@@ -31,7 +31,9 @@
* The <code>ProxyListener</code> implements the Servlet API 2.4 listener
* interfaces forwarding any event calls to registered OSGi services
* implementing the respective Servlet API 2.4 listener interface.
+ * @deprecated
*/
+@Deprecated
public class HttpSessionAttributeListenerManager extends AbstractListenerManager<HttpSessionAttributeListener>
implements HttpSessionAttributeListener
{
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/HttpSessionListenerManager.java b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/HttpSessionListenerManager.java
index b7c3b6c..fabc7ee 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/HttpSessionListenerManager.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/HttpSessionListenerManager.java
@@ -31,7 +31,10 @@
* The <code>ProxyListener</code> implements the Servlet API 2.4 listener
* interfaces forwarding any event calls to registered OSGi services
* implementing the respective Servlet API 2.4 listener interface.
+ *
+ * @deprecated
*/
+@Deprecated
public class HttpSessionListenerManager extends AbstractListenerManager<HttpSessionListener> implements
HttpSessionListener
{
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletContextAttributeListenerManager.java b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletContextAttributeListenerManager.java
index 8af09d1..976b88a 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletContextAttributeListenerManager.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletContextAttributeListenerManager.java
@@ -31,7 +31,9 @@
* The <code>ProxyListener</code> implements the Servlet API 2.4 listener
* interfaces forwarding any event calls to registered OSGi services
* implementing the respective Servlet API 2.4 listener interface.
+ * @deprecated
*/
+@Deprecated
public class ServletContextAttributeListenerManager extends AbstractListenerManager<ServletContextAttributeListener>
implements ServletContextAttributeListener
{
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletRequestAttributeListenerManager.java b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletRequestAttributeListenerManager.java
index 29d83be..e2315db 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletRequestAttributeListenerManager.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletRequestAttributeListenerManager.java
@@ -31,7 +31,9 @@
* The <code>ProxyListener</code> implements the Servlet API 2.4 listener
* interfaces forwarding any event calls to registered OSGi services
* implementing the respective Servlet API 2.4 listener interface.
+ * @deprecated
*/
+@Deprecated
public class ServletRequestAttributeListenerManager
extends AbstractListenerManager<ServletRequestAttributeListener>
implements ServletRequestAttributeListener
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletRequestListenerManager.java b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletRequestListenerManager.java
index 01a8916..94ef397 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletRequestListenerManager.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/service/listener/ServletRequestListenerManager.java
@@ -31,7 +31,9 @@
* The <code>ProxyListener</code> implements the Servlet API 2.4 listener
* interfaces forwarding any event calls to registered OSGi services
* implementing the respective Servlet API 2.4 listener interface.
+ * @deprecated
*/
+@Deprecated
public class ServletRequestListenerManager
extends AbstractListenerManager<ServletRequestListener>
implements ServletRequestListener