Package org.apache.ftpserver

Examples of org.apache.ftpserver.DataConnectionConfigurationFactory


    ListenerFactory listenerFactory = new ListenerFactory();

    listenerFactory.setPort(PORT);

    listenerFactory
        .setDataConnectionConfiguration(new DataConnectionConfigurationFactory()
            .createDataConnectionConfiguration());

    serverFactory.addListener("default", listenerFactory.createListener());

    PropertiesUserManagerFactory umFactory = new PropertiesUserManagerFactory();
View Full Code Here


    }

    private DataConnectionConfiguration parseDataConnection(
            final Element element,
            final SslConfiguration listenerSslConfiguration) {
        DataConnectionConfigurationFactory dc = new DataConnectionConfigurationFactory();

        if (element != null) {
           
            dc.setImplicitSsl(SpringUtil.parseBoolean(element, "implicit-ssl", false));
           
            // data con config element available
            SslConfiguration ssl = parseSsl(element);

            if (ssl != null) {
                LOG.debug("SSL configuration found for the data connection");
                dc.setSslConfiguration(ssl);
            }

            dc.setIdleTime(SpringUtil.parseInt(element, "idle-timeout", dc.getIdleTime()));

            Element activeElm = SpringUtil.getChildElement(element,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "active");
            if (activeElm != null) {
                dc.setActiveEnabled(SpringUtil.parseBoolean(activeElm, "enabled",
                        true));
                dc.setActiveIpCheck(SpringUtil.parseBoolean(activeElm,
                        "ip-check", false));
                dc.setActiveLocalPort(SpringUtil.parseInt(activeElm,
                        "local-port", 0));
               
                String localAddress = SpringUtil.parseStringFromInetAddress(
                        activeElm, "local-address");
                if (localAddress != null) {
                  dc.setActiveLocalAddress(localAddress);
                }
            }

            Element passiveElm = SpringUtil.getChildElement(element,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "passive");
            if (passiveElm != null) {
                String address = SpringUtil.parseStringFromInetAddress(passiveElm,
                        "address");
                if (address != null) {
                  dc.setPassiveAddress(address);
                }

                String externalAddress = SpringUtil.parseStringFromInetAddress(
                        passiveElm, "external-address");
                if (externalAddress != null) {
                    dc.setPassiveExternalAddress(externalAddress);
                }

                String ports = SpringUtil.parseString(passiveElm, "ports");
                if (ports != null) {
                    dc.setPassivePorts(ports);
                }
            }
        } else {
            // no data conn config element, do we still have SSL config from the
            // parent?
            if (listenerSslConfiguration != null) {
                LOG
                        .debug("SSL configuration found for the listener, falling back for that for the data connection");
                dc.setSslConfiguration(listenerSslConfiguration);
            }
        }

        return dc.createDataConnectionConfiguration();
    }
View Full Code Here

        FtpServerFactory server = super.createServer();

        ListenerFactory listenerFactory = new ListenerFactory(server
                .getListener("default"));

        DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();

        passivePort = TestUtil.findFreePort(12444);

        dccFactory.setPassivePorts(passivePort + "-" + (passivePort + 1));

        listenerFactory.setDataConnectionConfiguration(dccFactory
                .createDataConnectionConfiguration());

        server.addListener("default", listenerFactory.createListener());

        return server;
View Full Code Here

    protected ConnectionConfigFactory createConnectionConfigFactory() {
        return new ConnectionConfigFactory();
    }

    protected DataConnectionConfigurationFactory createDataConnectionConfigurationFactory() {
        return new DataConnectionConfigurationFactory();
    }
View Full Code Here

    }

    private DataConnectionConfiguration parseDataConnection(
            final Element element,
            final SslConfiguration listenerSslConfiguration) {
        DataConnectionConfigurationFactory dc = new DataConnectionConfigurationFactory();

        if (element != null) {
            // data con config element available
            SslConfiguration ssl = parseSsl(element);
            if (ssl != null) {
                LOG.debug("SSL configuration found for the data connection");
                dc.setSslConfiguration(ssl);
            } else {
                // go look for the parent element SSL config
                // find the listener element
                if (listenerSslConfiguration != null) {
                    LOG
                            .debug("SSL configuration found for the listener, falling back for that for the data connection");
                    dc.setSslConfiguration(listenerSslConfiguration);
                }
            }

            Element activeElm = SpringUtil.getChildElement(element,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "active");
            if (activeElm != null) {
                dc.setActiveEnabled(SpringUtil.parseBoolean(activeElm, "enabled",
                        true));
                dc.setActiveIpCheck(SpringUtil.parseBoolean(activeElm,
                        "ip-check", false));
                dc.setActiveLocalPort(SpringUtil.parseInt(activeElm,
                        "local-port", 0));
               
                String localAddress = SpringUtil.parseStringFromInetAddress(
                        activeElm, "local-address");
                if (localAddress != null) {
                  dc.setActiveLocalAddress(localAddress);
                }
            }

            Element passiveElm = SpringUtil.getChildElement(element,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "passive");
            if (passiveElm != null) {
                String address = SpringUtil.parseStringFromInetAddress(passiveElm,
                        "address");
                if (address != null) {
                  dc.setPassiveAddress(address);
                }

                String externalAddress = SpringUtil.parseStringFromInetAddress(
                        passiveElm, "external-address");
                if (externalAddress != null) {
                    dc.setPassiveExernalAddress(externalAddress);
                }

                String ports = SpringUtil.parseString(passiveElm, "ports");
                if (ports != null) {
                    dc.setPassivePorts(ports);
                }
            }
        } else {
            // no data conn config element, do we still have SSL config from the
            // parent?
            if (listenerSslConfiguration != null) {
                LOG
                        .debug("SSL configuration found for the listener, falling back for that for the data connection");
                dc.setSslConfiguration(listenerSslConfiguration);
            }
        }

        return dc.createDataConnectionConfiguration();
    }
View Full Code Here

       
        factory.setImplicitSsl(useImplicit());

        factory.setSslConfiguration(createSslConfiguration().createSslConfiguration());

        DataConnectionConfigurationFactory dataConfig = new DataConnectionConfigurationFactory();
        dataConfig.setSslConfiguration(createSslConfiguration().createSslConfiguration());

        factory.setDataConnectionConfiguration(dataConfig.createDataConnectionConfiguration());

        server.addListener("default", factory.createListener());
       
        return server;
    }
View Full Code Here

    protected FtpServerFactory createServer() throws Exception {
        FtpServerFactory server = super.createServer();

        ListenerFactory listenerFactory = new ListenerFactory(server.getListener("default"));
       
        DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();

        dccFactory.setPassiveExernalAddress("127.0.0.1");

        listenerFactory.setDataConnectionConfiguration(dccFactory.createDataConnectionConfiguration());

        server.addListener("default", listenerFactory.createListener());

        return server;
    }
View Full Code Here

     * for instances of the {@link FTPCallback} extension point.
     */
    private void configureServer() {
        FtpServerFactory serverFactory = new FtpServerFactory();
        ListenerFactory listenerFactory = new ListenerFactory();
        DataConnectionConfigurationFactory dataConnConfigFac = new DataConnectionConfigurationFactory();

        DataConnectionConfiguration connectionConfiguration = dataConnConfigFac
                .createDataConnectionConfiguration();

        LOGGER.info("Configuring GeoServer's FTP Server...");
        String passivePorts = config.getPassivePorts();
        if (passivePorts != null && passivePorts.trim().length() > 0) {
            try {
                LOGGER.info("Setting FTP passive ports: " + passivePorts
                        + ". May take a few seconds while checking if they're already bound.");
                dataConnConfigFac.setPassivePorts(passivePorts);
            } catch (Exception e) {
                LOGGER.log(Level.SEVERE, "Error setting the FTP server passive ports, "
                        + "check the ftp.xml config file. Format is '\"\"|<minPort[-maxPort]>  ", e);
            }
        }
        String passiveAddress = config.getPassiveAddress();
        if (passiveAddress == null || passiveAddress.trim().length() == 0
                || FTPConfig.DEFAULT_PASSIVE_ADDRESS.equals(passiveAddress)) {
            LOGGER.info("Passive address is the default server address");
        } else {
            LOGGER.info("Passive address: " + passiveAddress);
            dataConnConfigFac.setPassiveAddress(passiveAddress);
        }
        String pasvExternalAddress = config.getPassiveExternalAddress();
        if (pasvExternalAddress == null || pasvExternalAddress.trim().length() == 0
                || FTPConfig.DEFAULT_PASSIVE_ADDRESS.equals(pasvExternalAddress)) {
            LOGGER.info("Passive external address is the default server address");
        } else {
            LOGGER.info("Passive external address: " + pasvExternalAddress);
            dataConnConfigFac.setPassiveExternalAddress(pasvExternalAddress);
        }

        // configure a listener on port 8021
        LOGGER.info("FTP port: " + config.getFtpPort());
        listenerFactory.setPort(config.getFtpPort());
View Full Code Here

     * for instances of the {@link FTPCallback} extension point.
     */
    private void configureServer() {
        FtpServerFactory serverFactory = new FtpServerFactory();
        ListenerFactory listenerFactory = new ListenerFactory();
        DataConnectionConfigurationFactory dataConnConfigFac = new DataConnectionConfigurationFactory();

        DataConnectionConfiguration connectionConfiguration = dataConnConfigFac
                .createDataConnectionConfiguration();

        LOGGER.info("Configuring GeoServer's FTP Server...");
        String passivePorts = config.getPassivePorts();
        if (passivePorts != null && passivePorts.trim().length() > 0) {
            try {
                LOGGER.info("Setting FTP passive ports: " + passivePorts
                        + ". May take a few seconds while checking if they're already bound.");
                dataConnConfigFac.setPassivePorts(passivePorts);
            } catch (Exception e) {
                LOGGER.log(Level.SEVERE, "Error setting the FTP server passive ports, "
                        + "check the ftp.xml config file. Format is '\"\"|<minPort[-maxPort]>  ", e);
            }
        }
        String passiveAddress = config.getPassiveAddress();
        if (passiveAddress == null || passiveAddress.trim().length() == 0
                || FTPConfig.DEFAULT_PASSIVE_ADDRESS.equals(passiveAddress)) {
            LOGGER.info("Passive address is the default server address");
        } else {
            LOGGER.info("Passive address: " + passiveAddress);
            dataConnConfigFac.setPassiveAddress(passiveAddress);
        }
        String pasvExternalAddress = config.getPassiveExternalAddress();
        if (pasvExternalAddress == null || pasvExternalAddress.trim().length() == 0
                || FTPConfig.DEFAULT_PASSIVE_ADDRESS.equals(pasvExternalAddress)) {
            LOGGER.info("Passive external address is the default server address");
        } else {
            LOGGER.info("Passive external address: " + pasvExternalAddress);
            dataConnConfigFac.setPassiveExternalAddress(pasvExternalAddress);
        }

        // configure a listener on port 8021
        LOGGER.info("FTP port: " + config.getFtpPort());
        listenerFactory.setPort(config.getFtpPort());
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.DataConnectionConfigurationFactory

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.