X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=apps%2Fnetconf-nb%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnorthbound%2FDefaultNetconfMonitoringService.java;fp=apps%2Fnetconf-nb%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnorthbound%2FDefaultNetconfMonitoringService.java;h=4f353b11fec88c913395efe40673b2c6a29073ac;hb=f5dd226d85bfeaadd900c02e442d4db9b0000c99;hp=0000000000000000000000000000000000000000;hpb=0f396984b49e67ebe8693d6ed82ff1b98dc3a8bd;p=netconf.git diff --git a/apps/netconf-nb/src/main/java/org/opendaylight/netconf/northbound/DefaultNetconfMonitoringService.java b/apps/netconf-nb/src/main/java/org/opendaylight/netconf/northbound/DefaultNetconfMonitoringService.java new file mode 100644 index 0000000000..4f353b11fe --- /dev/null +++ b/apps/netconf-nb/src/main/java/org/opendaylight/netconf/northbound/DefaultNetconfMonitoringService.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023 PANTHEON.tech, s.r.o. 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 + */ +package org.opendaylight.netconf.northbound; + +import static java.util.Objects.requireNonNull; + +import java.util.Map; +import org.opendaylight.controller.config.threadpool.ScheduledThreadPool; +import org.opendaylight.netconf.server.api.monitoring.NetconfMonitoringService; +import org.opendaylight.netconf.server.api.operations.NetconfOperationServiceFactory; +import org.opendaylight.netconf.server.osgi.NetconfMonitoringServiceImpl; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; + +@Component(factory = DefaultNetconfMonitoringService.FACTORY_NAME, service = NetconfMonitoringService.class) +public final class DefaultNetconfMonitoringService extends NetconfMonitoringServiceImpl { + static final String FACTORY_NAME = "org.opendaylight.netconf.impl.mdsal.DefaultNetconfMonitoringService"; + + private static final String OP_PROVIDER_PROP = ".opProvider"; + private static final String THREAD_POOL_PROP = ".threadPool"; + private static final String UPDATE_INTERVAL_PROP = ".updateInterval"; + + @Activate + public DefaultNetconfMonitoringService(final Map properties) { + super(OSGiNetconfServer.extractProp(properties, OP_PROVIDER_PROP, NetconfOperationServiceFactory.class), + OSGiNetconfServer.extractProp(properties, THREAD_POOL_PROP, ScheduledThreadPool.class), + OSGiNetconfServer.extractProp(properties, UPDATE_INTERVAL_PROP, Long.class)); + } + + @Override + @Deactivate + public void close() { + super.close(); + } + + static Map props(final NetconfOperationServiceFactory opProvider, final ScheduledThreadPool threadPool, + final long updateInterval) { + return Map.of( + "type", "netconf-server-monitoring", + OP_PROVIDER_PROP, requireNonNull(opProvider), + THREAD_POOL_PROP, requireNonNull(threadPool), + UPDATE_INTERVAL_PROP, updateInterval); + } +}