FileDocCategorySizeDatePackage
UserCommand.javaAPI DocAzureus 3.0.3.410408Tue Dec 19 09:26:32 GMT 2006org.gudy.azureus2.ui.console.multiuser.commands

UserCommand

public class UserCommand extends org.gudy.azureus2.ui.console.commands.IConsoleCommand
container command for commands that deal with the add/modify/delete of users
author
pauld

Fields Summary
private final org.gudy.azureus2.ui.console.commands.CommandCollection
subCommands
private final org.gudy.azureus2.ui.console.multiuser.UserManager
userManager
Constructors Summary
public UserCommand(org.gudy.azureus2.ui.console.multiuser.UserManager userManager)

param
_commandNames


	  	 
	   
		super(new String [] { "user" } );
		this.userManager = userManager;
		
		subCommands.add(new AddUserCommand());
		subCommands.add(new DeleteUserCommand());
		subCommands.add(new ModifyUserCommand());
		subCommands.add(new ListUsersCommand());
	
Methods Summary
public voidexecute(java.lang.String commandName, org.gudy.azureus2.ui.console.ConsoleInput ci, java.util.List args)
determine the correct subcommand and execute it

		if( args.isEmpty() )
		{
			printHelp(ci.out, args);
		}
		else
		{
			commandName = (String) args.remove(0);
			subCommands.execute(commandName, ci, args);
		}
	
public java.lang.StringgetCommandDescriptions()
returns the string describing how this command can be used

		return "user add|delete|list|modify <options>\tmanage users able to log in via telnet ui"; 
	
private org.gudy.azureus2.ui.console.multiuser.UserManagergetUserManager()
returns the UserManager object that is used by our subcommands

return

		return userManager;
	
public voidprintHelp(java.io.PrintStream out, java.util.List args)
prints out the help message showing the syntax for all subcommands

		out.println("> -----");
		out.println("'user' syntax:");
		if( args.size() > 0 ) {
			String command = (String) args.remove(0);
			IConsoleCommand cmd = subCommands.get(command);
			if( cmd != null )
				cmd.printHelp(out, args);
			return;
		}
		out.println("user <command> <command options>");
		out.println();
		out.println("Available <command>s:");
		for (Iterator iter = subCommands.iterator(); iter.hasNext();) {
			IConsoleCommand cmd = (IConsoleCommand) iter.next();
			out.println(cmd.getCommandDescriptions());
		}
		out.println("try 'help user <command>' for more information about a particular user command");
		out.println("> -----");
	
private voidsaveUserManagerConfig(java.io.PrintStream out)
write the user manager configuration back to the path that it was read from

param
out stream to print success/failure messages to

		try {
			userManager.save();
			out.println("> User Manager config saved");
		} catch (FileNotFoundException e) {
			out.println("> Error saving User Manager config: " + e);
			e.printStackTrace(out);
		}