--- /dev/null
+/*
+ * 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.restconf.nb.rfc8040;
+
+import com.google.common.annotations.Beta;
+import javax.servlet.ServletException;
+import org.opendaylight.aaa.filterchain.configuration.CustomFilterAdapterConfiguration;
+import org.opendaylight.aaa.web.WebContextSecurer;
+import org.opendaylight.aaa.web.WebServer;
+import org.opendaylight.aaa.web.servlet.ServletSupport;
+import org.opendaylight.controller.config.threadpool.util.NamingThreadPoolFactory;
+import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper;
+import org.opendaylight.mdsal.dom.api.DOMActionService;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMMountPointService;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.restconf.nb.rfc8040.databind.DatabindProvider;
+import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfDataStreamServiceImpl;
+import org.opendaylight.restconf.nb.rfc8040.streams.Configuration;
+import org.opendaylight.restconf.nb.rfc8040.streams.WebSocketInitializer;
+import org.opendaylight.restconf.nb.rfc8040.web.WebInitializer;
+
+/**
+ * Main entrypoint into RFC8040 northbound. Take care of wiring up all applications activating them through JAX-RS.
+ */
+@Beta
+public final class JaxRsNorthbound implements AutoCloseable {
+ private final WebInitializer webInitializer;
+
+ public JaxRsNorthbound(final WebServer webServer, final WebContextSecurer webContextSecurer,
+ final ServletSupport servletSupport, final CustomFilterAdapterConfiguration filterAdapterConfiguration,
+ final DOMActionService actionService, final DOMDataBroker dataBroker,
+ final DOMMountPointService mountPointService, final DOMNotificationService notificationService,
+ final DOMRpcService rpcService, final DOMSchemaService schemaService,
+ final DatabindProvider databindProvider,
+ final String pingNamePrefix, final int pingMaxThreadCount, final int maximumFragmentLength,
+ final int heartbeatInterval, final int idleTimeout, final boolean useSSE) throws ServletException {
+ final var configuration = new Configuration(maximumFragmentLength, idleTimeout, heartbeatInterval, useSSE);
+ final var scheduledThreadPool = new ScheduledThreadPoolWrapper(pingMaxThreadCount,
+ new NamingThreadPoolFactory(pingNamePrefix));
+
+ webInitializer = new WebInitializer(webServer, webContextSecurer, servletSupport,
+ new RestconfApplication(databindProvider, mountPointService, dataBroker, rpcService, actionService,
+ notificationService, schemaService, configuration),
+ new DataStreamApplication(databindProvider, mountPointService,
+ new RestconfDataStreamServiceImpl(scheduledThreadPool, configuration)),
+ filterAdapterConfiguration,
+ new WebSocketInitializer(scheduledThreadPool, configuration));
+ }
+
+ @Override
+ public void close() {
+ webInitializer.close();
+ }
+}
<reference id="dOMRpcService" interface="org.opendaylight.mdsal.dom.api.DOMRpcService"/>
<reference id="dOMSchemaService" interface="org.opendaylight.mdsal.dom.api.DOMSchemaService"/>
- <bean id="scheduledThreadPool"
- class="org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper">
- <argument value="${max-thread-count}"/>
- <argument>
- <bean class="org.opendaylight.controller.config.threadpool.util.NamingThreadPoolFactory">
- <argument value="${ping-executor-name-prefix}"/>
- </bean>
- </argument>
- </bean>
-
- <bean id="configuration"
- class="org.opendaylight.restconf.nb.rfc8040.streams.Configuration">
- <argument value="${maximum-fragment-length}"/>
- <argument value="${idle-timeout}"/>
- <argument value="${heartbeat-interval}"/>
- <argument value="${use-sse}" />
- </bean>
-
- <bean id="webInitializer" class="org.opendaylight.restconf.nb.rfc8040.web.WebInitializer" destroy-method="close">
+ <bean id="restconfNorthbound" class="org.opendaylight.restconf.nb.rfc8040.JaxRsNorthbound" destroy-method="close">
<argument ref="webServer"/>
<argument ref="webContextSecurer"/>
<argument ref="servletSupport"/>
- <argument>
- <bean class="org.opendaylight.restconf.nb.rfc8040.RestconfApplication">
- <argument ref="databindProvider"/>
- <argument ref="dOMMountPointService"/>
- <argument ref="dOMDataBroker"/>
- <argument ref="dOMRpcService"/>
- <argument ref="dOMActionService"/>
- <argument ref="dOMNotificationService"/>
- <argument ref="dOMSchemaService"/>
- <argument ref="configuration"/>
- </bean>
- </argument>
- <argument>
- <bean class="org.opendaylight.restconf.nb.rfc8040.DataStreamApplication">
- <argument ref="databindProvider"/>
- <argument ref="dOMMountPointService"/>
- <argument>
- <bean class="org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfDataStreamServiceImpl">
- <argument ref="scheduledThreadPool"/>
- <argument ref="configuration"/>
- </bean>
- </argument>
- </bean>
- </argument>
<argument ref="customFilterAdapterConfiguration"/>
- <argument>
- <bean class="org.opendaylight.restconf.nb.rfc8040.streams.WebSocketInitializer">
- <argument ref="scheduledThreadPool"/>
- <argument ref="configuration"/>
- </bean>
- </argument>
+ <argument ref="dOMActionService"/>
+ <argument ref="dOMDataBroker"/>
+ <argument ref="dOMMountPointService"/>
+ <argument ref="dOMNotificationService"/>
+ <argument ref="dOMRpcService"/>
+ <argument ref="dOMSchemaService"/>
+ <argument ref="databindProvider"/>
+ <argument value="${ping-executor-name-prefix}"/>
+ <argument value="${max-thread-count}"/>
+ <argument value="${maximum-fragment-length}"/>
+ <argument value="${heartbeat-interval}"/>
+ <argument value="${idle-timeout}"/>
+ <argument value="${use-sse}"/>
</bean>
</blueprint>