FileDocCategorySizeDatePackage
MultiUserConsoleInput.javaAPI DocAzureus 3.0.3.43757Tue Sep 06 06:44:54 BST 2005org.gudy.azureus2.ui.console.multiuser

MultiUserConsoleInput

public class MultiUserConsoleInput extends org.gudy.azureus2.ui.console.ConsoleInput
subclass of the ConsoleInput object that is used for multi users. in this particular subclass, we replace some commands with our own versions and disable some commands.
author
pauld

Fields Summary
private List
adminCommands
private List
userCommands
Constructors Summary
public MultiUserConsoleInput(String con, com.aelitis.azureus.core.AzureusCore _azureus_core, Reader _in, PrintStream _out, Boolean _controlling, org.gudy.azureus2.ui.console.UserProfile profile)
set up the lists of commands that we prohibit, based upon the user type.

param
con
param
_azureus_core
param
_in
param
_out
param
_controlling
param
profile

		super(con, _azureus_core, _in, _out, _controlling, profile);
	
Methods Summary
protected voidinitialise()
initialize our list of commands that need specific roles

		
		adminCommands = new ArrayList();
		adminCommands.add("quit");
		adminCommands.add("share");
		adminCommands.add("user");
		// move command is admin only so that standard users cannot
		// prioritise their torrents
		adminCommands.add("move");
		adminCommands.add("log");
		adminCommands.add("ui");
		
		userCommands = new ArrayList();
		userCommands.add("set");
		userCommands.add("alias");
		userCommands.add("add");
		
		super.initialise();
	
public voidregisterCommand(org.gudy.azureus2.ui.console.commands.IConsoleCommand command)
check whether the specified command is one of our banned commands for this particular user type. some commands are able to handle different user types, others are not relevant to anybody but admin

		if( ! UserProfile.ADMIN.equals( getUserProfile().getUserType() ) )
		{
			Set commandNames = command.getCommandNames();
			for (Iterator iter = commandNames.iterator(); iter.hasNext();) {
				String cmdName = (String) iter.next();
				if( adminCommands.contains(cmdName) )
					return;
				if( ! UserProfile.USER.equals( getUserProfile().getUserType() ) )
				{
					if( userCommands.contains(cmdName))
						return;
				}
			}
		}	
		super.registerCommand(command);
	
protected voidregisterCommands()
add some multi-user specific commands

		super.registerCommands();
		// this will override the original Show command
		registerCommand(new Show());