Skip to content
Snippets Groups Projects
Commit 299de6fb authored by kaloyane's avatar kaloyane
Browse files

[LMS-2267] added "ftp.server.passivemode.port.range" configuration property

SVN: 21617
parent e4bfde75
No related branches found
No related tags found
No related merge requests found
...@@ -85,14 +85,15 @@ public class FtpServer implements FileSystemFactory ...@@ -85,14 +85,15 @@ public class FtpServer implements FileSystemFactory
factory.setImplicitSsl(true); factory.setImplicitSsl(true);
} }
DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();
dccFactory.setPassivePorts(config.getPassivePortsRange());
if (config.isActiveModeEnabled()) if (config.isActiveModeEnabled())
{ {
DataConnectionConfigurationFactory dccFactory =
new DataConnectionConfigurationFactory();
dccFactory.setActiveEnabled(true); dccFactory.setActiveEnabled(true);
dccFactory.setActiveLocalPort(config.getActiveLocalPort()); dccFactory.setActiveLocalPort(config.getActiveLocalPort());
factory.setDataConnectionConfiguration(dccFactory.createDataConnectionConfiguration());
} }
factory.setDataConnectionConfiguration(dccFactory.createDataConnectionConfiguration());
serverFactory.addListener("default", factory.createListener()); serverFactory.addListener("default", factory.createListener());
ConnectionConfigFactory connectionConfigFactory = new ConnectionConfigFactory(); ConnectionConfigFactory connectionConfigFactory = new ConnectionConfigFactory();
......
...@@ -59,6 +59,8 @@ public class FtpServerConfig ...@@ -59,6 +59,8 @@ public class FtpServerConfig
final static String ACTIVE_PORT_KEY = PREFIX + "activemode.port"; final static String ACTIVE_PORT_KEY = PREFIX + "activemode.port";
final static String PASSIVE_MODE_PORT_RANGE_KEY = PREFIX + "passivemode.port.range";
private static final int DEFAULT_PORT = 2121; private static final int DEFAULT_PORT = 2121;
private static final int DEFAULT_ACTIVE_PORT = 2122; private static final int DEFAULT_ACTIVE_PORT = 2122;
...@@ -69,6 +71,8 @@ public class FtpServerConfig ...@@ -69,6 +71,8 @@ public class FtpServerConfig
private static final String DEFAULT_DATASET_TEMPLATE = "${dataSetCode}"; private static final String DEFAULT_DATASET_TEMPLATE = "${dataSetCode}";
private static final String DEFAULT_PASSIVE_PORTS = "2130-2140";
private boolean startServer; private boolean startServer;
private int port; private int port;
...@@ -77,6 +81,8 @@ public class FtpServerConfig ...@@ -77,6 +81,8 @@ public class FtpServerConfig
private int activePort; private int activePort;
private String passivePortsRange;
private boolean useSSL; private boolean useSSL;
private File keyStore; private File keyStore;
...@@ -113,6 +119,9 @@ public class FtpServerConfig ...@@ -113,6 +119,9 @@ public class FtpServerConfig
} }
activeModeEnabled = PropertyUtils.getBoolean(props, ACTIVE_MODE_ENABLE_KEY, false); activeModeEnabled = PropertyUtils.getBoolean(props, ACTIVE_MODE_ENABLE_KEY, false);
activePort = PropertyUtils.getPosInt(props, ACTIVE_PORT_KEY, DEFAULT_ACTIVE_PORT); activePort = PropertyUtils.getPosInt(props, ACTIVE_PORT_KEY, DEFAULT_ACTIVE_PORT);
passivePortsRange =
PropertyUtils
.getProperty(props, PASSIVE_MODE_PORT_RANGE_KEY, DEFAULT_PASSIVE_PORTS);
maxThreads = PropertyUtils.getPosInt(props, MAX_THREADS_KEY, DEFAULT_MAX_THREADS); maxThreads = PropertyUtils.getPosInt(props, MAX_THREADS_KEY, DEFAULT_MAX_THREADS);
dataSetDisplayTemplate = dataSetDisplayTemplate =
PropertyUtils.getProperty(props, DATASET_DISPLAY_TEMPLATE_KEY, DEFAULT_DATASET_TEMPLATE); PropertyUtils.getProperty(props, DATASET_DISPLAY_TEMPLATE_KEY, DEFAULT_DATASET_TEMPLATE);
...@@ -208,6 +217,7 @@ public class FtpServerConfig ...@@ -208,6 +217,7 @@ public class FtpServerConfig
operationLog.info("Ftp Server port: " + port); operationLog.info("Ftp Server port: " + port);
operationLog.info("Ftp Server using SSL: " + useSSL); operationLog.info("Ftp Server using SSL: " + useSSL);
operationLog.info("Ftp Server data set display template : " + dataSetDisplayTemplate); operationLog.info("Ftp Server data set display template : " + dataSetDisplayTemplate);
operationLog.info("Ftp Server passive ports: " + passivePortsRange);
operationLog.info("Ftp Server enable active mode: " + activeModeEnabled); operationLog.info("Ftp Server enable active mode: " + activeModeEnabled);
if (activeModeEnabled) if (activeModeEnabled)
{ {
...@@ -241,4 +251,9 @@ public class FtpServerConfig ...@@ -241,4 +251,9 @@ public class FtpServerConfig
return activePort; return activePort;
} }
public String getPassivePortsRange()
{
return passivePortsRange;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment