Package org.apache.ftpserver.interfaces

Examples of org.apache.ftpserver.interfaces.Command


        }
        argument = argument.toUpperCase();
       
        // call appropriate command method
        String optsRequest = "OPTS_" + argument;
        Command command = (Command)COMMAND_MAP.get( optsRequest );
        try {
            if(command != null) {
                command.execute(session, context, request);
            }
            else {
                session.resetState();
                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_502_COMMAND_NOT_IMPLEMENTED, "OPTS.not.implemented", argument));
            }
View Full Code Here


    public void messageReceived( final FtpIoSession session, final FtpRequest request ) throws Exception {
        try {
            String commandName = request.getCommand();
            CommandFactory commandFactory = context.getCommandFactory();
            Command command = commandFactory.getCommand(commandName);
           
           
            if(command != null) {
              synchronized (session) {
                command.execute(session, context, request);
        }
            }
            else {
                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_502_COMMAND_NOT_IMPLEMENTED, "not.implemented", null));
            }
View Full Code Here

            return;
        }
       
        // call appropriate command method
        String siteRequest = "SITE_" + argument;
        Command command = (Command)COMMAND_MAP.get( siteRequest );
        try {
            if(command != null) {
                command.execute(session, context, request);
            }
            else {
                session.resetState();
                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_502_COMMAND_NOT_IMPLEMENTED, "SITE", argument));
            }
View Full Code Here

    public Command getCommand(final String cmdName) {
      if(cmdName == null || cmdName.equals("")) {
            return null;
        }
      String upperCaseCmdName = cmdName.toUpperCase();
      Command command = commandMap.get(upperCaseCmdName);
     
      if(command == null && useDefaultCommands) {
        command = DEFAULT_COMMAND_MAP.get(upperCaseCmdName);
      }
     
View Full Code Here

public class DefaultCommandFactoryTest extends TestCase {

  public void testReturnFromDefaultUpper() {
    DefaultCommandFactory factory = new DefaultCommandFactory();
    Command command = factory.getCommand("STOR");
   
    assertNotNull(command);
    assertTrue(command instanceof STOR);
  }
View Full Code Here

    assertTrue(command instanceof STOR);
  }

  public void testReturnFromDefaultLower() {
    DefaultCommandFactory factory = new DefaultCommandFactory();
    Command command = factory.getCommand("stor");
   
    assertNotNull(command);
    assertTrue(command instanceof STOR);
  }
View Full Code Here

    assertTrue(command instanceof STOR);
  }

  public void testReturnFromDefaultUnknown() {
    DefaultCommandFactory factory = new DefaultCommandFactory();
    Command command = factory.getCommand("dummy");
   
    assertNull(command);
  }
View Full Code Here

    DefaultCommandFactory factory = new DefaultCommandFactory();
    Map<String, Command> commands = new HashMap<String, Command>();
    commands.put("stor", new NOOP());
    factory.setCommandMap(commands);
   
    Command command = factory.getCommand("Stor");
   
    assertTrue(command instanceof NOOP);
  }
View Full Code Here

*/
public class DefaultCommandFactoryTest extends TestCase {

    public void testReturnFromDefaultUpper() {
        DefaultCommandFactory factory = new DefaultCommandFactory();
        Command command = factory.getCommand("STOR");

        assertNotNull(command);
        assertTrue(command instanceof STOR);
    }
View Full Code Here

        assertTrue(command instanceof STOR);
    }

    public void testReturnFromDefaultLower() {
        DefaultCommandFactory factory = new DefaultCommandFactory();
        Command command = factory.getCommand("stor");

        assertNotNull(command);
        assertTrue(command instanceof STOR);
    }
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.interfaces.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.