From: Jakub Morvay Date: Thu, 17 Jan 2019 14:11:46 +0000 (+0000) Subject: Merge "Eliminate XmlUtil.createElement(Document, String)" X-Git-Tag: release/neon~29 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=04467f3b89c536d611c54c1ecd6a8da24eb6beef;hp=cb1444d196e8231a7b1ab445bb001d72c1360cce;p=netconf.git Merge "Eliminate XmlUtil.createElement(Document, String)" --- diff --git a/netconf/netconf-console/pom.xml b/netconf/netconf-console/pom.xml index 2678901c28..225afa55d5 100644 --- a/netconf/netconf-console/pom.xml +++ b/netconf/netconf-console/pom.xml @@ -55,4 +55,19 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL test + + + + + org.apache.felix + maven-bundle-plugin + true + + + * + + + + + diff --git a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfConnectDeviceCommand.java b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfConnectDeviceCommand.java index cedb5db576..578b49a4d3 100644 --- a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfConnectDeviceCommand.java +++ b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfConnectDeviceCommand.java @@ -16,6 +16,8 @@ import java.util.Arrays; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Option; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; import org.opendaylight.netconf.console.api.NetconfCommands; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; @@ -30,20 +32,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev15 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.Credentials; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPasswordBuilder; -@Command(name = "netconf:connect-device", scope = "netconf", description = "Connect to a netconf device.") +@Service +@Command(name = "connect-device", scope = "netconf", description = "Connect to a netconf device.") public class NetconfConnectDeviceCommand implements Action { - protected final NetconfCommands service; + @Reference + private NetconfCommands service; + + public NetconfConnectDeviceCommand() { - public NetconfConnectDeviceCommand(final NetconfCommands service) { - this.service = service; } @VisibleForTesting - NetconfConnectDeviceCommand(final NetconfCommands service, final String deviceIp, final String devicePort) { + NetconfConnectDeviceCommand(final NetconfCommands service) { this.service = service; - this.deviceIp = deviceIp; - this.devicePort = devicePort; } @VisibleForTesting diff --git a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfDisconnectDeviceCommand.java b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfDisconnectDeviceCommand.java index b9bf10bb6d..1ad975245f 100644 --- a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfDisconnectDeviceCommand.java +++ b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfDisconnectDeviceCommand.java @@ -13,14 +13,23 @@ import com.google.common.base.Strings; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Option; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; import org.opendaylight.netconf.console.api.NetconfCommands; -@Command(name = "netconf:disconnect-device", scope = "netconf", description = "Disconnect netconf device.") +@Service +@Command(name = "disconnect-device", scope = "netconf", description = "Disconnect netconf device.") public class NetconfDisconnectDeviceCommand implements Action { - protected final NetconfCommands service; + @Reference + private NetconfCommands service; - public NetconfDisconnectDeviceCommand(final NetconfCommands service) { + public NetconfDisconnectDeviceCommand() { + + } + + @VisibleForTesting + NetconfDisconnectDeviceCommand(final NetconfCommands service) { this.service = service; } diff --git a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfListDevicesCommand.java b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfListDevicesCommand.java index 0db091f926..c4d5302878 100644 --- a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfListDevicesCommand.java +++ b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfListDevicesCommand.java @@ -8,20 +8,30 @@ package org.opendaylight.netconf.console.commands; +import com.google.common.annotations.VisibleForTesting; import java.util.Map; import javax.annotation.Nonnull; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.support.table.ShellTable; import org.opendaylight.netconf.console.api.NetconfCommands; import org.opendaylight.netconf.console.utils.NetconfConsoleConstants; -@Command(name = "netconf:list-devices", scope = "netconf", description = "List all netconf devices in the topology.") +@Service +@Command(name = "list-devices", scope = "netconf", description = "List all netconf devices in the topology.") public class NetconfListDevicesCommand implements Action { - protected final NetconfCommands service; + @Reference + private NetconfCommands service; - public NetconfListDevicesCommand(final NetconfCommands service) { + public NetconfListDevicesCommand() { + + } + + @VisibleForTesting + NetconfListDevicesCommand(final NetconfCommands service) { this.service = service; } diff --git a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfShowDeviceCommand.java b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfShowDeviceCommand.java index 273d9b2208..3245d6b5ef 100644 --- a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfShowDeviceCommand.java +++ b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfShowDeviceCommand.java @@ -17,16 +17,25 @@ import javax.annotation.Nonnull; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Option; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; import org.apache.karaf.shell.support.table.ShellTable; import org.opendaylight.netconf.console.api.NetconfCommands; import org.opendaylight.netconf.console.utils.NetconfConsoleConstants; -@Command(name = "netconf:show-device", scope = "netconf", description = "Shows netconf device attributes.") +@Service +@Command(name = "show-device", scope = "netconf", description = "Shows netconf device attributes.") public class NetconfShowDeviceCommand implements Action { - protected final NetconfCommands service; + @Reference + private NetconfCommands service; - public NetconfShowDeviceCommand(final NetconfCommands service) { + public NetconfShowDeviceCommand() { + + } + + @VisibleForTesting + NetconfShowDeviceCommand(final NetconfCommands service) { this.service = service; } diff --git a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfUpdateDeviceCommand.java b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfUpdateDeviceCommand.java index 054d115411..62978e2088 100644 --- a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfUpdateDeviceCommand.java +++ b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfUpdateDeviceCommand.java @@ -14,16 +14,20 @@ import java.util.Map; import org.apache.karaf.shell.api.action.Action; import org.apache.karaf.shell.api.action.Command; import org.apache.karaf.shell.api.action.Option; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; import org.opendaylight.netconf.console.api.NetconfCommands; import org.opendaylight.netconf.console.utils.NetconfConsoleConstants; -@Command(name = "netconf:update-device", scope = "netconf", description = "Update netconf device attributes.") +@Service +@Command(name = "update-device", scope = "netconf", description = "Update netconf device attributes.") public class NetconfUpdateDeviceCommand implements Action { - protected final NetconfCommands service; + @Reference + private NetconfCommands service; + + public NetconfUpdateDeviceCommand() { - public NetconfUpdateDeviceCommand(final NetconfCommands service) { - this.service = service; } @VisibleForTesting @@ -96,8 +100,7 @@ public class NetconfUpdateDeviceCommand implements Action { private String newSchemaless = "false"; @Override - public Object execute() { - + public Object execute() { Map updated = new HashMap<>(); updated.put(NetconfConsoleConstants.NETCONF_IP, newIp); updated.put(NetconfConsoleConstants.NETCONF_PORT, newPort); diff --git a/netconf/netconf-console/src/main/resources/org/opendaylight/blueprint/netconf-command.xml b/netconf/netconf-console/src/main/resources/org/opendaylight/blueprint/netconf-command.xml index 65b1a35e0f..ada935fd25 100755 --- a/netconf/netconf-console/src/main/resources/org/opendaylight/blueprint/netconf-command.xml +++ b/netconf/netconf-console/src/main/resources/org/opendaylight/blueprint/netconf-command.xml @@ -19,34 +19,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -