SslConfiguration ssl = parseSsl(element);
if (ssl != null) {
factoryBuilder.addPropertyValue("sslConfiguration", ssl);
}
Element dataConElm = SpringUtil.getChildElement(element,
FtpServerNamespaceHandler.FTPSERVER_NS, "data-connection");
DataConnectionConfiguration dc = parseDataConnection(dataConElm, ssl);
factoryBuilder.addPropertyValue("dataConnectionConfiguration", dc);
if (StringUtils.hasText(element.getAttribute("idle-timeout"))) {
factoryBuilder.addPropertyValue("idleTimeout", SpringUtil.parseInt(
element, "idle-timeout", 300));
}
String localAddress = SpringUtil.parseStringFromInetAddress(element,
"local-address");
if (localAddress != null) {
factoryBuilder.addPropertyValue("serverAddress", localAddress);
}
factoryBuilder.addPropertyValue("implicitSsl", SpringUtil.parseBoolean(
element, "implicit-ssl", false));
Element blacklistElm = SpringUtil.getChildElement(element,
FtpServerNamespaceHandler.FTPSERVER_NS, "blacklist");
if (blacklistElm != null) {
LOG
.warn("Element 'blacklist' is deprecated, and may be removed in a future release. Please use 'remote-ip-filter' instead. ");
try {
RemoteIpFilter remoteIpFilter = new RemoteIpFilter(IpFilterType.DENY,
blacklistElm.getTextContent());
factoryBuilder.addPropertyValue("sessionFilter", remoteIpFilter);
} catch (UnknownHostException e) {
throw new IllegalArgumentException(
"Invalid IP address or subnet in the 'blacklist' element",
e);
}
}
Element remoteIpFilterElement = SpringUtil.getChildElement(element,
FtpServerNamespaceHandler.FTPSERVER_NS, "remote-ip-filter");
if (remoteIpFilterElement != null) {
if (blacklistElm != null) {
throw new FtpServerConfigurationException(
"Element 'remote-ip-filter' may not be used when 'blacklist' element is specified. ");
}
String filterType = remoteIpFilterElement.getAttribute("type");
try {
RemoteIpFilter remoteIpFilter = new RemoteIpFilter(IpFilterType
.parse(filterType), remoteIpFilterElement
.getTextContent());
factoryBuilder
.addPropertyValue("sessionFilter", remoteIpFilter);
} catch (UnknownHostException e) {
throw new IllegalArgumentException(