|
From: <ls...@us...> - 2006-12-22 07:44:00
|
Revision: 2952
http://jnode.svn.sourceforge.net/jnode/?rev=2952&view=rev
Author: lsantha
Date: 2006-12-21 23:43:57 -0800 (Thu, 21 Dec 2006)
Log Message:
-----------
Method execute() reverted to previous state for fixing build failure.
Modified Paths:
--------------
trunk/net/src/net/org/jnode/net/command/ResolverCommand.java
Modified: trunk/net/src/net/org/jnode/net/command/ResolverCommand.java
===================================================================
--- trunk/net/src/net/org/jnode/net/command/ResolverCommand.java 2006-12-22 02:01:10 UTC (rev 2951)
+++ trunk/net/src/net/org/jnode/net/command/ResolverCommand.java 2006-12-22 07:43:57 UTC (rev 2952)
@@ -23,7 +23,6 @@
import java.io.InputStream;
import java.io.PrintStream;
-import java.util.Collection;
import org.jnode.net.help.argument.HostArgument;
import org.jnode.net.ipv4.IPv4Address;
@@ -76,16 +75,9 @@
if (cmdLine.size() == 0)
{
- Collection<String> resolvers = ResolverImpl.getDnsServers();
- if( resolvers == null )
- System.out.println("No DNS servers found.");
- else {
System.out.println("DNS servers");
- for (String dnsServer : resolvers) {
- System.out.println(dnsServer);
+ ResolverImpl.printDnsServers();
}
- }
- }
else
{
String func = ARG_FUNCTION.getValue(cmdLine);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-05-12 09:46:17
|
Revision: 4086
http://jnode.svn.sourceforge.net/jnode/?rev=4086&view=rev
Author: crawley
Date: 2008-05-12 02:46:13 -0700 (Mon, 12 May 2008)
Log Message:
-----------
Fix indentation etc in prep for real changes
Modified Paths:
--------------
trunk/net/src/net/org/jnode/net/command/ResolverCommand.java
Modified: trunk/net/src/net/org/jnode/net/command/ResolverCommand.java
===================================================================
--- trunk/net/src/net/org/jnode/net/command/ResolverCommand.java 2008-05-11 14:18:18 UTC (rev 4085)
+++ trunk/net/src/net/org/jnode/net/command/ResolverCommand.java 2008-05-12 09:46:13 UTC (rev 4086)
@@ -36,71 +36,76 @@
import org.jnode.shell.help.Syntax;
import org.jnode.shell.help.argument.OptionArgument;
-
+/**
+ * This command class manages the DNS resolver.
+ *
+ * @author hagar-wize
+ */
public class ResolverCommand extends AbstractCommand
{
- private static final String FUNC_ADD = "add";
- private static final String FUNC_DEL = "del";
+ private static final String FUNC_ADD = "add";
+ private static final String FUNC_DEL = "del";
- private static final OptionArgument ARG_FUNCTION =
- new OptionArgument(
- "function",
- "the function to perform",
- new OptionArgument.Option[] { new OptionArgument.Option(FUNC_ADD, "add a dns server"), new OptionArgument.Option(FUNC_DEL, "delete a dns server")});
+ private static final OptionArgument ARG_FUNCTION =
+ new OptionArgument(
+ "function",
+ "the function to perform",
+ new OptionArgument.Option[] {
+ new OptionArgument.Option(FUNC_ADD, "add a dns server"),
+ new OptionArgument.Option(FUNC_DEL, "delete a dns server")});
- private static final HostArgument ARG_DNSSERVER = new HostArgument("dns server", "the dns server IP address");
+ private static final HostArgument ARG_DNSSERVER =
+ new HostArgument("dns server", "the dns server IP address");
- public static Help.Info HELP_INFO =
- new Help.Info(
- "resolver",
- new Syntax[] {
- new Syntax("Print the dns servers"),
- new Syntax(
- "Add or remove a dns server",
- new Parameter[] {
- new Parameter(ARG_FUNCTION, Parameter.MANDATORY),
- new Parameter(ARG_DNSSERVER, Parameter.MANDATORY)
- })
- });
+ public static Help.Info HELP_INFO =
+ new Help.Info(
+ "resolver",
+ new Syntax[] {
+ new Syntax("Print the dns servers"),
+ new Syntax(
+ "Add or remove a dns server",
+ new Parameter[] {
+ new Parameter(ARG_FUNCTION, Parameter.MANDATORY),
+ new Parameter(ARG_DNSSERVER, Parameter.MANDATORY)
+ })
+ });
- public static void main(String[] args) throws Exception {
- new ResolverCommand().execute(args);
- }
+ public static void main(String[] args) throws Exception {
+ new ResolverCommand().execute(args);
+ }
- public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception {
- ParsedArguments cmdLine = HELP_INFO.parse(commandLine);
-
- if (cmdLine.size() == 0)
- {
- Collection<String> resolvers = ResolverImpl.getDnsServers();
- if( resolvers == null )
- out.println("No DNS servers found.");
- else {
- out.println("DNS servers");
- for (String dnsServer : resolvers) {
- out.println(dnsServer);
- }
- }
- }
- else
- {
- String func = ARG_FUNCTION.getValue(cmdLine);
- IPv4Address server = ARG_DNSSERVER.getAddress(cmdLine);
-
- if (FUNC_ADD.equals(func))
- {
- ResolverImpl.addDnsServer(server);
- }
- else if (FUNC_DEL.equals(func))
- {
- ResolverImpl.removeDnsServer(server);
- }
- }
-
- out.println();
- }
+ public void execute(CommandLine commandLine, InputStream in,
+ PrintStream out, PrintStream err) throws Exception {
+ ParsedArguments cmdLine = HELP_INFO.parse(commandLine);
+
+ if (cmdLine.size() == 0) {
+ Collection<String> resolvers = ResolverImpl.getDnsServers();
+ if (resolvers == null) {
+ out.println("No DNS servers found.");
+ }
+ else {
+ out.println("DNS servers");
+ for (String dnsServer : resolvers) {
+ out.println(dnsServer);
+ }
+ }
+ }
+ else {
+ String func = ARG_FUNCTION.getValue(cmdLine);
+ IPv4Address server = ARG_DNSSERVER.getAddress(cmdLine);
+
+ if (FUNC_ADD.equals(func)) {
+ ResolverImpl.addDnsServer(server);
+ }
+ else if (FUNC_DEL.equals(func)) {
+ ResolverImpl.removeDnsServer(server);
+ }
+ }
+
+ out.println();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|