// Path: src/main/java/octopus/OctopusEnvironment.java
// public class OctopusEnvironment {
// 
// 	private static final String OCTOPUS_HOME_STR;
// 	private static final String DATA_STR = "data";
// 	private static final String PROJECTS_STR = "projects";
// 	private static final String PLUGINS_STR = "plugins";
// 	private static final String LANGUAGES_STR = "languages";
// 
// 	public static final Path PROJECTS_DIR;
// 	public static final Path PLUGINS_DIR;
// 	public static final Path LANGUAGES_DIR;
// 
// 	static {
// 
// 		OCTOPUS_HOME_STR = System.getProperty("OCTOPUS_HOME");
// 
//         if (OCTOPUS_HOME_STR == null)
//         {
//             throw new RuntimeException("System property OCTOPUS_HOME not defined.");
//         }
// 
//         PROJECTS_DIR = Paths.get(OCTOPUS_HOME_STR, DATA_STR, PROJECTS_STR);
//         PLUGINS_DIR = Paths.get(OCTOPUS_HOME_STR, PLUGINS_STR);
//         LANGUAGES_DIR = Paths.get(OCTOPUS_HOME_STR, LANGUAGES_STR);
// 
// 	}
// 
// }


import java.util.ArrayList;
import java.util.List;
import org.apache.ftpserver.ConnectionConfigFactory;
import org.apache.ftpserver.FtpServer;
import org.apache.ftpserver.FtpServerFactory;
import org.apache.ftpserver.ftplet.Authority;
import org.apache.ftpserver.ftplet.FtpException;
import org.apache.ftpserver.listener.ListenerFactory;
import org.apache.ftpserver.usermanager.impl.BaseUser;
import org.apache.ftpserver.usermanager.impl.WritePermission;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import octopus.OctopusEnvironment;
package octopus.server.ftpserver;




public class OctopusFTPServer {

	private static final Logger logger = LoggerFactory
			.getLogger(OctopusFTPServer.class);

	private static final String FTP_SERVER_HOST = "localhost";
	private static final int FTP_SERVER_PORT = 23231;

	FtpServer server;
	FtpServerFactory serverFactory = new FtpServerFactory();
	ListenerFactory factory = new ListenerFactory();
	ConnectionConfigFactory connectionConfigFactory = new ConnectionConfigFactory();

	public void start() throws FtpException
	{
		factory.setPort(FTP_SERVER_PORT);
		factory.setServerAddress(FTP_SERVER_HOST);

		configureAnonymousLogin();

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

		server = serverFactory.createServer();
		server.start();
	}

	private void configureAnonymousLogin() throws FtpException
	{
// Path: src/main/java/octopus/OctopusEnvironment.java
// public class OctopusEnvironment {
// 
// 	private static final String OCTOPUS_HOME_STR;
// 	private static final String DATA_STR = "data";
// 	private static final String PROJECTS_STR = "projects";
// 	private static final String PLUGINS_STR = "plugins";
// 	private static final String LANGUAGES_STR = "languages";
// 
// 	public static final Path PROJECTS_DIR;
// 	public static final Path PLUGINS_DIR;
// 	public static final Path LANGUAGES_DIR;
// 
// 	static {
// 
// 		OCTOPUS_HOME_STR = System.getProperty("OCTOPUS_HOME");
// 
//         if (OCTOPUS_HOME_STR == null)
//         {
//             throw new RuntimeException("System property OCTOPUS_HOME not defined.");
//         }
// 
//         PROJECTS_DIR = Paths.get(OCTOPUS_HOME_STR, DATA_STR, PROJECTS_STR);
//         PLUGINS_DIR = Paths.get(OCTOPUS_HOME_STR, PLUGINS_STR);
//         LANGUAGES_DIR = Paths.get(OCTOPUS_HOME_STR, LANGUAGES_STR);
// 
// 	}
// 
// }


// Path: src/main/java/octopus/server/ftpserver/OctopusFTPServer.java
import java.util.ArrayList;
import java.util.List;
import org.apache.ftpserver.ConnectionConfigFactory;
import org.apache.ftpserver.FtpServer;
import org.apache.ftpserver.FtpServerFactory;
import org.apache.ftpserver.ftplet.Authority;
import org.apache.ftpserver.ftplet.FtpException;
import org.apache.ftpserver.listener.ListenerFactory;
import org.apache.ftpserver.usermanager.impl.BaseUser;
import org.apache.ftpserver.usermanager.impl.WritePermission;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import octopus.OctopusEnvironment;

package octopus.server.ftpserver;




public class OctopusFTPServer {

	private static final Logger logger = LoggerFactory
			.getLogger(OctopusFTPServer.class);

	private static final String FTP_SERVER_HOST = "localhost";
	private static final int FTP_SERVER_PORT = 23231;

	FtpServer server;
	FtpServerFactory serverFactory = new FtpServerFactory();
	ListenerFactory factory = new ListenerFactory();
	ConnectionConfigFactory connectionConfigFactory = new ConnectionConfigFactory();

	public void start() throws FtpException
	{
		factory.setPort(FTP_SERVER_PORT);
		factory.setServerAddress(FTP_SERVER_HOST);

		configureAnonymousLogin();

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

		server = serverFactory.createServer();
		server.start();
	}

	private void configureAnonymousLogin() throws FtpException
	{
		connectionConfigFactory.setAnonymousLoginEnabled(true);