Package org.apache.ftpserver.listener

Examples of org.apache.ftpserver.listener.ListenerFactory


    protected FtpServerFactory doCreateFtpServerFactory() throws Exception {
        assertTrue(FTPSERVER_KEYSTORE.exists());
       
        FtpServerFactory serverFactory = super.createFtpServerFactory();
       
        ListenerFactory listenerFactory = new ListenerFactory(serverFactory.getListener(DEFAULT_LISTENER));
        listenerFactory.setImplicitSsl(useImplicit());
        listenerFactory.setSslConfiguration(createSslConfiguration().createSslConfiguration());
       
        serverFactory.addListener(DEFAULT_LISTENER, listenerFactory.createListener());

        return serverFactory;
    }
View Full Code Here


        if (server == null)
        {
            FtpServerFactory serverFactory = new FtpServerFactory();

            ListenerFactory factory = new ListenerFactory();

            // set the port of the listener
            factory.setPort(getTestRepositoryPort());

            // replace the default listener
            serverFactory.addListener("default", factory.createListener());

            PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
            UserManager um = userManagerFactory.createUserManager();

            BaseUser user = new BaseUser();
View Full Code Here

        NativeFileSystemFactory fsf = new NativeFileSystemFactory();
        fsf.setCreateHome(true);
        serverFactory.setFileSystem(fsf);

        ListenerFactory factory = new ListenerFactory();
        factory.setPort(20126);
        serverFactory.addListener("default", factory.createListener());

        ftpServer = serverFactory.createServer();
    }
View Full Code Here

        server.start();
    }

    private void setupListenerFactory(FtpServerFactory serverFactory, int port)
    {
        ListenerFactory listenerFactory = new ListenerFactory();
        // set the port of the listener
        listenerFactory.setPort(port);
        listenerFactory.setIdleTimeout(60000);
        // replace the default listener
        serverFactory.addListener("default", listenerFactory.createListener());
    }
View Full Code Here

        server.start();
    }

    private void setupListenerFactory(FtpServerFactory serverFactory, int port)
    {
        ListenerFactory listenerFactory = new ListenerFactory();
        // set the port of the listener
        listenerFactory.setPort(port);
        listenerFactory.setIdleTimeout(60000);
        // replace the default listener
        serverFactory.addListener("default", listenerFactory.createListener());
    }
View Full Code Here

        NativeFileSystemFactory fsf = new NativeFileSystemFactory();
        fsf.setCreateHome(true);
        serverFactory.setFileSystem(fsf);

        ListenerFactory factory = new ListenerFactory();
        factory.setPort(20123);
        serverFactory.addListener("default", factory.createListener());

        ftpServer = serverFactory.createServer();
    }
View Full Code Here

        final File ftpHomeDirFile = new File("target/FTPBlobTest/ftptest");
        ftpHomeDirFile.mkdirs();
        ftpHomeDirFile.getParentFile().deleteOnExit();

        FtpServerFactory serverFactory = new FtpServerFactory();
        ListenerFactory factory = new ListenerFactory();

        // mock up a user manager to validate user activemq:activemq and provide
        // home dir options
        context = new Mockery();
        final UserManager userManager = context.mock(UserManager.class);
        final User user = context.mock(User.class);
        context.checking(new Expectations() {{
                atLeast(1).of(userManager).authenticate(
                        with(any(UsernamePasswordAuthentication.class))); will(returnValue(user));
                atLeast(1).of(userManager).getUserByName(userNamePass); will(returnValue(user));
                atLeast(1).of(user).getHomeDirectory(); will(returnValue(ftpHomeDirFile.getParent()));
                atLeast(1).of(user).getMaxIdleTime(); will(returnValue(20000));
                atLeast(1).of(user).getName(); will(returnValue(userNamePass));
                atLeast(1).of(user).authorize( with(any(AuthorizationRequest.class))); will(new CustomAction("return first passed in param") {
                    public Object invoke(Invocation invocation)
                            throws Throwable {
                        return invocation.getParameter(0);
                    }
                });
            }
        });

        serverFactory.setUserManager(userManager);
        factory.setPort(0);
        serverFactory.addListener(ftpServerListenerName, factory
                .createListener());
        server = serverFactory.createServer();
        server.start();
        int ftpPort = serverFactory.getListener(ftpServerListenerName)
                .getPort();
View Full Code Here

        final File ftpHomeDirFile = new File("target/FTPBlobTest/ftptest");
        ftpHomeDirFile.mkdirs();
        ftpHomeDirFile.getParentFile().deleteOnExit();

        FtpServerFactory serverFactory = new FtpServerFactory();
        ListenerFactory factory = new ListenerFactory();

    PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
    UserManager userManager = userManagerFactory.createUserManager();

    BaseUser user = new BaseUser();
        user.setName("activemq");
        user.setPassword("activemq");
        user.setHomeDirectory(ftpHomeDirFile.getParent());
       
        userManager.save(user);

        serverFactory.setUserManager(userManager);
        factory.setPort(0);
        serverFactory.addListener(ftpServerListenerName, factory
                .createListener());
        server = serverFactory.createServer();
        server.start();
        int ftpPort = serverFactory.getListener(ftpServerListenerName)
                .getPort();
View Full Code Here

        final File ftpHomeDirFile = new File("target/FTPBlobTest/ftptest");
        ftpHomeDirFile.mkdirs();
        ftpHomeDirFile.getParentFile().deleteOnExit();

        FtpServerFactory serverFactory = new FtpServerFactory();
        ListenerFactory factory = new ListenerFactory();

        PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
        UserManager userManager = userManagerFactory.createUserManager();

        BaseUser user = new BaseUser();
        user.setName("activemq");
        user.setPassword("activemq");
        user.setHomeDirectory(ftpHomeDirFile.getParent());

        userManager.save(user);

        serverFactory.setUserManager(userManager);
        factory.setPort(0);
        serverFactory.addListener(ftpServerListenerName, factory
                .createListener());
        server = serverFactory.createServer();
        server.start();
        ftpPort = serverFactory.getListener(ftpServerListenerName)
                .getPort();
View Full Code Here

        NativeFileSystemFactory fsf = new NativeFileSystemFactory();
        fsf.setCreateHome(true);
        serverFactory.setFileSystem(fsf);

        ListenerFactory factory = new ListenerFactory();
        factory.setPort(port);
        serverFactory.addListener("default", factory.createListener());

        ftpServer = serverFactory.createServer();
    }
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.listener.ListenerFactory

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.