- add the mdsal-notification-mapper blueprint xml file in mdsal-netconf-notification,
as this bundle is pulled in by the odl-netconf-mdsal feature, loading the config system
file responsible to create the modules.
Change-Id: I67fb0be3e9765177bb34f81461978954b4632a53
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
<artifactId>mockito-configuration</artifactId>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Embed-Dependency>netconf-notifications-impl</Embed-Dependency>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies Inc. and others. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:restart-dependents-on-updates="true">
+
+ <!--This is the MD-SAL netconf server notification mapper blueprint xml file-->
+
+ <bean id="netconfNotificationManager"
+ class="org.opendaylight.netconf.notifications.impl.NetconfNotificationManager"
+ destroy-method="close">
+ </bean>
+ <service ref="netconfNotificationManager"
+ interface="org.opendaylight.netconf.notifications.NetconfNotificationRegistry"
+ odl:type="netconf-notification-manager">
+ <service-properties>
+ <entry key="config-module-namespace" value="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification"/>
+ <entry key="config-module-name" value="netconf-notification-registry"/>
+ <entry key="config-instance-name" value="netconf-notification-manager"/>
+ </service-properties>
+ </service>
+ <service ref="netconfNotificationManager"
+ interface="org.opendaylight.netconf.notifications.NetconfNotificationCollector"
+ odl:type="netconf-notification-manager">
+ <service-properties>
+ <entry key="config-module-namespace" value="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification"/>
+ <entry key="config-module-name" value="netconf-notification-collector"/>
+ <entry key="config-instance-name" value="netconf-notification-manager"/>
+ </service-properties>
+ </service>
+</blueprint>
</data>
</configuration>
<required-capabilities>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification?module=netconf-northbound-notification&revision=2015-08-06</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper?module=netconf-mdsal-mapper&revision=2015-01-14</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring?module=netconf-mdsal-monitoring&revision=2015-02-18</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp?module=netconf-northbound-tcp&revision=2015-04-23</capability>
identity netconf-notification-collector {
base "config:service-type";
config:java-class "org.opendaylight.netconf.notifications.NetconfNotificationCollector";
+ config:disable-osgi-service-registration;
+ status deprecated;
}
identity netconf-notification-registry {
base "config:service-type";
config:java-class "org.opendaylight.netconf.notifications.NetconfNotificationRegistry";
+ config:disable-osgi-service-registration;
+ status deprecated;
}
}
\ No newline at end of file
package org.opendaylight.controller.config.yang.netconf.northbound.notification.impl;
-import org.opendaylight.netconf.notifications.impl.NetconfNotificationManager;
+import com.google.common.reflect.AbstractInvocationHandler;
+import com.google.common.reflect.Reflection;
+import java.lang.reflect.Method;
+import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
+import org.opendaylight.netconf.notifications.NetconfNotificationCollector;
+import org.opendaylight.netconf.notifications.NetconfNotificationRegistry;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class NetconfNotificationManagerModule extends AbstractNetconfNotificationManagerModule {
+
+ private BundleContext bundleContext;
-public class NetconfNotificationManagerModule extends org.opendaylight.controller.config.yang.netconf.northbound.notification.impl.AbstractNetconfNotificationManagerModule {
public NetconfNotificationManagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
@Override
public java.lang.AutoCloseable createInstance() {
- return new NetconfNotificationManager();
+
+ final WaitingServiceTracker<NetconfNotificationCollector> tracker =
+ WaitingServiceTracker.create(NetconfNotificationCollector.class, bundleContext, "(type=netconf-notification-manager)");
+ final NetconfNotificationCollector service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+ return Reflection.newProxy(AutoCloseableNetconfNotification.class, new AbstractInvocationHandler() {
+ @Override
+ protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
+ if (method.getName().equals("close")) {
+ tracker.close();
+ return null;
+ } else {
+ return method.invoke(service, args);
+ }
+ }
+ });
+ }
+
+ void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
+ private static interface AutoCloseableNetconfNotification extends NetconfNotificationCollector, NetconfNotificationRegistry, AutoCloseable {
}
}
* Do not modify this file unless it is present under src/main directory
*/
package org.opendaylight.controller.config.yang.netconf.northbound.notification.impl;
-public class NetconfNotificationManagerModuleFactory extends org.opendaylight.controller.config.yang.netconf.northbound.notification.impl.AbstractNetconfNotificationManagerModuleFactory {
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class NetconfNotificationManagerModuleFactory extends AbstractNetconfNotificationManagerModuleFactory {
+
+ @Override
+ public NetconfNotificationManagerModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ NetconfNotificationManagerModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+ NetconfNotificationManagerModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
+ oldInstance, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+
+ @Override
+ public NetconfNotificationManagerModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ BundleContext bundleContext) {
+ NetconfNotificationManagerModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
}