Package org.apache.ftpserver

Examples of org.apache.ftpserver.FtpServerConfigurationException


                SslConfiguration ssl = getSslConfiguration();
                SslFilter sslFilter;
                try {
                    sslFilter = new SslFilter(ssl.getSSLContext());
                } catch (GeneralSecurityException e) {
                    throw new FtpServerConfigurationException("SSL could not be initialized, check configuration");
                }

                if (ssl.getClientAuth() == ClientAuth.NEED) {
                    sslFilter.setNeedClientAuth(true);
                } else if (ssl.getClientAuth() == ClientAuth.WANT) {
                    sslFilter.setWantClientAuth(true);
                }

                if (ssl.getEnabledCipherSuites() != null) {
                    sslFilter.setEnabledCipherSuites(ssl.getEnabledCipherSuites());
                }

                acceptor.getFilterChain().addFirst("sslFilter", sslFilter);
            }

            handler.init(context, this);

            //////////////////////////////////////////

            // Here's the hack. Instead of instantiating a defaultftphandler
            // we use the one supplied in the constructor

            //////////////////////////////////////////
            acceptor.setHandler(new FtpHandlerAdapter(context, handler));

            try {
                acceptor.bind(address);
            } catch (IOException e) {
                throw new FtpServerConfigurationException("Failed to bind to address " + address + ", check configuration", e);
            }

            updatePort();

        } catch(RuntimeException e) {
View Full Code Here


    @Override
    public Listener createListener() {
      try{
        InetAddress.getByName(this.getServerAddress());
      }catch(UnknownHostException e){
        throw new FtpServerConfigurationException("Unknown host",e);
      }
        log.debug( "Creating milton listener");
        return new MiltonListener(getServerAddress(), getPort(), isImplicitSsl(), getSslConfiguration(),
                getDataConnectionConfiguration(), getIdleTimeout(), getBlockedAddresses(),
                getBlockedSubnets(), ftpHandler);
View Full Code Here

                    springElm, builder.getBeanDefinition());
        } else if ("ref".equals(ln)) {
            return parserContext.getDelegate().parsePropertySubElement(
                    springElm, builder.getBeanDefinition());
        } else {
            throw new FtpServerConfigurationException("Unknown spring element "
                    + ln);
        }
    }
View Full Code Here

            final String attrName) {
        if (StringUtils.hasText(parent.getAttribute(attrName))) {
            try {
                return InetAddress.getByName(parent.getAttribute(attrName));
            } catch (UnknownHostException e) {
                throw new FtpServerConfigurationException("Unknown host", e);
            }
        }
        return null;
    }
View Full Code Here

        }
       
        Element ipFilterElement = SpringUtil.getChildElement(element, FtpServerNamespaceHandler.FTPSERVER_NS, "ip-filter");
        if(ipFilterElement != null) {
          if(blacklistElm != null) {
            throw new FtpServerConfigurationException("Element 'ipFilter' may not be used when 'blacklist' element is specified. ");
          }
          String filterType = ipFilterElement.getAttribute("type");
          try {
        DefaultIpFilter ipFilter = new DefaultIpFilter(IpFilterType.parse(filterType), ipFilterElement.getTextContent());
              factoryBuilder.addPropertyValue("ipFilter", ipFilter);
View Full Code Here

     */
    public Listener createListener() {
      try{
        InetAddress.getByName(serverAddress);
      }catch(UnknownHostException e){
        throw new FtpServerConfigurationException("Unknown host",e);
      }
      //Deal with the old style black list and new IP Filter here.
      if(ipFilter != null) {
         if(blockedAddresses != null || blockedSubnets != null) {
           throw new IllegalStateException("Usage of IPFilter in combination with blockedAddesses/subnets is not supported. ");
View Full Code Here

                SslConfiguration ssl = getSslConfiguration();
                SslFilter sslFilter;
                try {
                    sslFilter = new SslFilter(ssl.getSSLContext());
                } catch (GeneralSecurityException e) {
                    throw new FtpServerConfigurationException("SSL could not be initialized, check configuration");
                }
   
                if (ssl.getClientAuth() == ClientAuth.NEED) {
                    sslFilter.setNeedClientAuth(true);
                } else if (ssl.getClientAuth() == ClientAuth.WANT) {
                    sslFilter.setWantClientAuth(true);
                }
   
                if (ssl.getEnabledCipherSuites() != null) {
                    sslFilter.setEnabledCipherSuites(ssl.getEnabledCipherSuites());
                }
   
                acceptor.getFilterChain().addFirst("sslFilter", sslFilter);
            }
   
            handler.init(context, this);
            acceptor.setHandler(new FtpHandlerAdapter(context, handler));
   
            try {
                acceptor.bind(address);
            } catch (IOException e) {
                throw new FtpServerConfigurationException("Failed to bind to address " + address + ", check configuration", e);
            }
           
            updatePort();
   
        } catch(RuntimeException e) {
View Full Code Here

    private PasswordEncryptor passwordEncryptor = new Md5PasswordEncryptor();
   
    public UserManager createUserManager() {
        if (dataSource == null) {
            throw new FtpServerConfigurationException(
                    "Required data source not provided");
        }
        if (insertUserStmt == null) {
            throw new FtpServerConfigurationException(
                    "Required insert user SQL statement not provided");
        }
        if (updateUserStmt == null) {
            throw new FtpServerConfigurationException(
                    "Required update user SQL statement not provided");
        }
        if (deleteUserStmt == null) {
            throw new FtpServerConfigurationException(
                    "Required delete user SQL statement not provided");
        }
        if (selectUserStmt == null) {
            throw new FtpServerConfigurationException(
                    "Required select user SQL statement not provided");
        }
        if (selectAllStmt == null) {
            throw new FtpServerConfigurationException(
                    "Required select all users SQL statement not provided");
        }
        if (isAdminStmt == null) {
            throw new FtpServerConfigurationException(
                    "Required is admin user SQL statement not provided");
        }
        if (authenticateStmt == null) {
            throw new FtpServerConfigurationException(
                    "Required authenticate user SQL statement not provided");
        }
       
        return new DbUserManager(dataSource, selectAllStmt, selectUserStmt,
                insertUserStmt, updateUserStmt, deleteUserStmt, authenticateStmt,
View Full Code Here

                            userDataProp.load(is);
                        } finally {
                            IoUtils.close(is);
                        }
                    } else {
                        throw new FtpServerConfigurationException(
                                "User data file specified but could not be located, "
                                        + "neither on the file system or in the classpath: "
                                        + userDataFile.getPath());
                    }
                }
            }
        } catch (IOException e) {
            throw new FtpServerConfigurationException(
                    "Error loading user data file : " + userDataFile, e);
        }
    }
View Full Code Here

                } finally {
                    IoUtils.close(is);
                }
            }
        } catch (IOException e) {
            throw new FtpServerConfigurationException(
                    "Error loading user data resource : " + userDataPath, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.FtpServerConfigurationException

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.