import org.opendaylight.netconf.util.osgi.NetconfConfiguration;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private SshProxyServer server;
@Override
- public void start(final BundleContext bundleContext) throws IOException {
+ public void start(final BundleContext bundleContext) throws IOException, InvalidSyntaxException {
minaTimerExecutor = Executors.newScheduledThreadPool(POOL_SIZE, new ThreadFactory() {
@Override
- public Thread newThread(final Runnable r) {
- return new Thread(r, "netconf-ssh-server-mina-timers");
+ public Thread newThread(final Runnable runnable) {
+ return new Thread(runnable, "netconf-ssh-server-mina-timers");
}
});
clientGroup = new NioEventLoopGroup();
server.close();
}
- if(authProviderTracker != null) {
+ if (authProviderTracker != null) {
authProviderTracker.stop();
}
- if(nioExecutor!=null) {
+ if (nioExecutor != null) {
nioExecutor.shutdownNow();
}
- if(clientGroup != null) {
+ if (clientGroup != null) {
clientGroup.shutdownGracefully();
}
- if(minaTimerExecutor != null) {
+ if (minaTimerExecutor != null) {
minaTimerExecutor.shutdownNow();
}
}
- private SshProxyServer startSSHServer(final BundleContext bundleContext) throws IOException {
- final NetconfConfiguration netconfConfiguration = NetconfConfigUtil.getNetconfConfigurationService(bundleContext).
- orElseThrow(() -> new IllegalStateException("Configuration for SSH not found."));
+ private SshProxyServer startSSHServer(final BundleContext bundleContext)
+ throws IOException, InvalidSyntaxException {
+ final NetconfConfiguration netconfConfiguration =
+ NetconfConfigUtil.getNetconfConfigurationService(bundleContext);
final InetSocketAddress sshSocketAddress = netconfConfiguration.getSshServerAddress();
LOG.info("Starting netconf SSH server at {}", sshSocketAddress);