Package org.apache.ftpserver.command

Examples of org.apache.ftpserver.command.CommandFactory


    public void testOverride() {
        CommandFactoryFactory factoryFactory = new CommandFactoryFactory();
        factoryFactory.addCommand("stor", new NOOP());

        CommandFactory factory = factoryFactory.createCommandFactory();

        Command command = factory.getCommand("Stor");

        assertTrue(command instanceof NOOP);
    }
View Full Code Here


    public void testAppend() {
        CommandFactoryFactory factoryFactory = new CommandFactoryFactory();
        factoryFactory.addCommand("foo", new NOOP());

        CommandFactory factory = factoryFactory.createCommandFactory();

        assertTrue(factory.getCommand("FOO") instanceof NOOP);
        assertTrue(factory.getCommand("stor") instanceof STOR);
    }
View Full Code Here

    public void testAppendWithoutDefault() {
        CommandFactoryFactory factoryFactory = new CommandFactoryFactory();
        factoryFactory.addCommand("foo", new NOOP());
        factoryFactory.setUseDefaultCommands(false);

        CommandFactory factory = factoryFactory.createCommandFactory();
       
        assertTrue(factory.getCommand("FOO") instanceof NOOP);
        assertNull(factory.getCommand("stor"));
    }
View Full Code Here

        listener = listeners.get("listener2");
        assertNotNull(listener);
        assertTrue(listener instanceof MyCustomListener);
        assertEquals(2224, listener.getPort());

        CommandFactory cf = server.getCommandFactory();
        assertTrue(cf.getCommand("FOO") instanceof HELP);
        assertTrue(cf.getCommand("FOO2") instanceof STAT);

        List<String> languages = server.getServerContext().getMessageResource()
                .getAvailableLanguages();

        assertEquals(2, languages.size());
View Full Code Here

        listener = listeners.get("listener2");
        assertNotNull(listener);
        assertTrue(listener instanceof MyCustomListener);
        assertEquals(2224, listener.getPort());

        CommandFactory cf = server.getCommandFactory();
        assertTrue(cf.getCommand("FOO") instanceof HELP);
        assertTrue(cf.getCommand("FOO2") instanceof STAT);

        List<String> languages = server.getServerContext().getMessageResource()
                .getAvailableLanguages();

        assertEquals(2, languages.size());
View Full Code Here

            final FtpRequest request) throws Exception {
        try {
            session.updateLastAccessTime();
           
            String commandName = request.getCommand();
            CommandFactory commandFactory = context.getCommandFactory();
            Command command = commandFactory.getCommand(commandName);

            // make sure the user is authenticated before he issues commands
            if (!session.isLoggedIn()
                    && !isCommandOkWithoutAuthentication(commandName)) {
                session.write(LocalizedFtpReply.translate(session, request,
View Full Code Here

            final FtpRequest request) throws Exception {
        try {
            session.updateLastAccessTime();
           
            String commandName = request.getCommand();
            CommandFactory commandFactory = context.getCommandFactory();
            Command command = commandFactory.getCommand(commandName);

            // make sure the user is authenticated before he issues commands
            if (!session.isLoggedIn()
                    && !isCommandOkWithoutAuthentication(commandName)) {
                session.write(LocalizedFtpReply.translate(session, request,
View Full Code Here

        listener = listeners.get("listener2");
        assertNotNull(listener);
        assertTrue(listener instanceof MyCustomListener);
        assertEquals(2224, listener.getPort());

        CommandFactory cf = server.getCommandFactory();
        assertTrue(cf.getCommand("FOO") instanceof HELP);
        assertTrue(cf.getCommand("FOO2") instanceof STAT);

        List<String> languages = server.getServerContext().getMessageResource()
                .getAvailableLanguages();

        assertEquals(2, languages.size());
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);

            // make sure the user is authenticated before he issues commands
            if (!session.isLoggedIn()
                    && !isCommandOkWithoutAuthentication(commandName)) {
                session.write(LocalizedFtpReply.translate(session, request, context,
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.command.CommandFactory

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.