<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>config-api</artifactId>
</compilerArgs>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin</artifactId>
+ </plugin>
</plugins>
</build>
<scm>
import java.util.Collection;
import java.util.Map;
import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronHostconfigOvsListener implements ClusteredDataTreeChangeListener<Node>, AutoCloseable {
+@Singleton
+public class NeutronHostconfigOvsListener implements ClusteredDataTreeChangeListener<Node> {
private static final Logger LOG = LoggerFactory.getLogger(NeutronHostconfigOvsListener.class);
private final DataBroker dataBroker;
private final SouthboundUtils southboundUtils;
private static final String OS_HOST_CONFIG_CONFIG_KEY_PREFIX = "odl_os_hostconfig_config_odl_";
private static int HOST_TYPE_STR_LEN = 8;
+ @Inject
public NeutronHostconfigOvsListener(final DataBroker dataBroker) {
this.dataBroker = dataBroker;
MdsalUtils mdsalUtils = new MdsalUtils(dataBroker);
.child(Node.class);
}
+ @PostConstruct
public void init() {
LOG.info("{} start", getClass().getSimpleName());
DataTreeIdentifier<Node> dataTreeIdentifier =
listenerRegistration = dataBroker.registerDataTreeChangeListener(dataTreeIdentifier, this);
}
+ @PreDestroy
public void close() throws Exception {
if (listenerRegistration != null) {
listenerRegistration.close();
interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
odl:type="default" />
- <bean id="neutronHostconfigOvs"
- class="org.opendaylight.neutron.hostconfig.ovs.NeutronHostconfigOvsListener"
- init-method="init"
- destroy-method="close">
- <argument ref="dataBroker"/>
- </bean>
-
</blueprint>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>config-api</artifactId>
</compilerArgs>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin</artifactId>
+ </plugin>
</plugins>
</build>
<scm>
import java.util.Collection;
import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public final class NeutronLogger implements AutoCloseable {
+@Singleton
+public final class NeutronLogger {
private static final Logger LOG = LoggerFactory.getLogger(NeutronLogger.class);
private DataBroker db;
private ClusteredDataTreeChangeListener<Neutron> operationalDataTreeChangeListener;
private ListenerRegistration<? extends ClusteredDataTreeChangeListener<Neutron>> operationalRegisteredListener;
+ @Inject
public NeutronLogger(@Nonnull DataBroker db) {
LOG.info("Creating NeutronLogger {}", db);
this.db = Preconditions.checkNotNull(db, "null db");
LOG.info(messageBuilder.toString());
}
+ @PostConstruct
public void init() {
LOG.info("Register listener for Neutron model data changes");
InstanceIdentifier<Neutron> instanceId = Preconditions.checkNotNull(InstanceIdentifier.create(Neutron.class));
operationalDataTreeChangeListener);
}
- @Override
+ @PreDestroy
public void close() throws Exception {
configurationRegisteredListener.close();
configurationRegisteredListener = null;
interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
odl:type="default" />
- <bean id="neutronLogger"
- class="org.opendaylight.neutron.logger.NeutronLogger"
- init-method="init"
- destroy-method="close">
- <argument ref="dataBroker"/>
- </bean>
-
</blueprint>
</compilerArgs>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin</artifactId>
+ </plugin>
</plugins>
</build>
<dependencies>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
</dependencies>
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/neutron.git</connection>
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.neutron.spi.INeutronBgpvpnCRUD;
import org.opendaylight.neutron.spi.INeutronCRUD;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public final class NeutronTranscriberProvider implements AutoCloseable, NeutronTranscriber {
+@Singleton
+public final class NeutronTranscriberProvider implements NeutronTranscriber {
private static final Logger LOG = LoggerFactory.getLogger(NeutronTranscriberProvider.class);
private BundleContext context;
private final List<ServiceRegistration<? extends INeutronCRUD<?>>> registrations = new ArrayList<>();
private final List<AutoCloseable> neutronInterfaces = new ArrayList<>();
+ @Inject
public NeutronTranscriberProvider(BundleContext context, DataBroker db) {
LOG.debug("DataBroker set to: {}", db);
this.context = Preconditions.checkNotNull(context);
registrations.add(crudInterfaceRegistration);
}
+ @PostConstruct
public void init() {
registerCRUDInterface(INeutronBgpvpnCRUD.class, new NeutronBgpvpnInterface(db));
registerCRUDInterface(INeutronFirewallCRUD.class, new NeutronFirewallInterface(db));
this.context = null;
}
- @Override
+ @PreDestroy
public void close() throws Exception {
for (final ServiceRegistration registration : registrations) {
registration.unregister();
interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
odl:type="default" />
- <bean id="neutronTranscriberImpl"
- class="org.opendaylight.neutron.transcriber.NeutronTranscriberProvider"
- init-method="init"
- destroy-method="close">
- <argument ref="blueprintBundleContext"/>
- <argument ref="dataBroker"/>
- </bean>
-
- <service ref="neutronTranscriberImpl"
+ <service ref="neutronTranscriberProvider"
interface="org.opendaylight.neutron.transcriber.NeutronTranscriber"
odl:type="default"/>