X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Ftools%2Fnetconf-cli%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fcli%2FNetconfDeviceConnectionManager.java;h=99e25bb0c3877aea2b452e6a75233cf196c41ddd;hb=4788b31c2c898c442309f9323580852e0752eae4;hp=4bbbc11dfcdf62b2fcbc69e40718e9583c41565a;hpb=6b635f217e47a005d94bdabeb52d98491d20dd32;p=netconf.git diff --git a/netconf/tools/netconf-cli/src/main/java/org/opendaylight/netconf/cli/NetconfDeviceConnectionManager.java b/netconf/tools/netconf-cli/src/main/java/org/opendaylight/netconf/cli/NetconfDeviceConnectionManager.java index 4bbbc11dfc..99e25bb0c3 100644 --- a/netconf/tools/netconf-cli/src/main/java/org/opendaylight/netconf/cli/NetconfDeviceConnectionManager.java +++ b/netconf/tools/netconf-cli/src/main/java/org/opendaylight/netconf/cli/NetconfDeviceConnectionManager.java @@ -24,7 +24,7 @@ import org.opendaylight.netconf.client.conf.NetconfClientConfigurationBuilder; import org.opendaylight.netconf.sal.connect.netconf.NetconfDevice; import org.opendaylight.netconf.sal.connect.netconf.NetconfDevice.SchemaResourcesDTO; import org.opendaylight.netconf.sal.connect.netconf.NetconfDeviceBuilder; -import org.opendaylight.netconf.sal.connect.netconf.NetconfStateSchemas.NetconfStateSchemasResolverImpl; +import org.opendaylight.netconf.sal.connect.netconf.NetconfStateSchemasResolverImpl; import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCommunicator; import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId; import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory; @@ -35,7 +35,7 @@ import org.opendaylight.yangtools.yang.parser.repo.SharedSchemaRepository; import org.opendaylight.yangtools.yang.parser.util.TextToASTTransformer; /** - * Manages connect/disconnect to 1 remote device + * Manages connect/disconnect to 1 remote device. */ public class NetconfDeviceConnectionManager implements Closeable { @@ -70,7 +70,8 @@ public class NetconfDeviceConnectionManager implements Closeable { // TODO we receive configBuilder in order to add SessionListener, Session // Listener should not be part of config - public synchronized void connect(final String name, final InetSocketAddress address, final NetconfClientConfigurationBuilder configBuilder) { + public synchronized void connect(final String name, final InetSocketAddress address, + final NetconfClientConfigurationBuilder configBuilder) { // TODO change IllegalState exceptions to custom ConnectionException Preconditions.checkState(listener == null, "Already connected"); @@ -80,11 +81,14 @@ public class NetconfDeviceConnectionManager implements Closeable { console, name); final SharedSchemaRepository repository = new SharedSchemaRepository("repo"); - final SchemaContextFactory schemaContextFactory = repository.createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT); - final FilesystemSchemaSourceCache cache = new FilesystemSchemaSourceCache<>(repository, YangTextSchemaSource.class, new File(CACHE)); + final SchemaContextFactory schemaContextFactory = repository + .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT); + final FilesystemSchemaSourceCache cache = new FilesystemSchemaSourceCache<>( + repository, YangTextSchemaSource.class, new File(CACHE)); repository.registerSchemaSourceListener(cache); repository.registerSchemaSourceListener(TextToASTTransformer.create(repository, repository)); - final SchemaResourcesDTO schemaResourcesDTO = new SchemaResourcesDTO(repository, schemaContextFactory, new NetconfStateSchemasResolverImpl()); + final SchemaResourcesDTO schemaResourcesDTO = new SchemaResourcesDTO( + repository, repository, schemaContextFactory, new NetconfStateSchemasResolverImpl()); device = new NetconfDeviceBuilder() .setReconnectOnSchemasChange(true) @@ -100,12 +104,13 @@ public class NetconfDeviceConnectionManager implements Closeable { } /** - * Blocks thread until connection is fully established + * Blocks thread until connection is fully established. */ - public synchronized Set connectBlocking(final String name, final InetSocketAddress address, final NetconfClientConfigurationBuilder configBuilder) { + public synchronized Set connectBlocking(final String name, final InetSocketAddress address, + final NetconfClientConfigurationBuilder configBuilder) { this.connect(name, address, configBuilder); synchronized (handler) { - while (handler.isUp() == false) { + while (!handler.isUp()) { try { // TODO implement Timeout for unsuccessful connection handler.wait();