当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionConfigFactory类代码示例

本文整理汇总了Java中org.apache.ftpserver.ConnectionConfigFactory的典型用法代码示例。如果您正苦于以下问题:Java ConnectionConfigFactory类的具体用法?Java ConnectionConfigFactory怎么用?Java ConnectionConfigFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConnectionConfigFactory类属于org.apache.ftpserver包,在下文中一共展示了ConnectionConfigFactory类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFtpServerFactory

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
protected FtpServerFactory createFtpServerFactory() throws Exception {
    assertTrue(USERS_FILE.exists());
    assertTrue("Port number is not initialized in an expected range: " + BaseServerTestSupport.port, BaseServerTestSupport.port >= 21000);

    NativeFileSystemFactory fsf = new NativeFileSystemFactory();
    fsf.setCreateHome(true);

    PropertiesUserManagerFactory pumf = new PropertiesUserManagerFactory();
    pumf.setAdminName("admin");
    pumf.setPasswordEncryptor(new ClearTextPasswordEncryptor());
    pumf.setFile(USERS_FILE);
    UserManager userMgr = pumf.createUserManager();
    
    ListenerFactory factory = new ListenerFactory();
    factory.setPort(BaseServerTestSupport.port);
    
    FtpServerFactory serverFactory = new FtpServerFactory();
    serverFactory.setUserManager(userMgr);
    serverFactory.setFileSystem(fsf);
    serverFactory.setConnectionConfig(new ConnectionConfigFactory().createConnectionConfig());
    serverFactory.addListener(DEFAULT_LISTENER, factory.createListener());

    return serverFactory;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:25,代码来源:FtpServerTestSupport.java

示例2: createServer

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
public static FtpServer createServer(int port, int maxLoginFailures, int loginFailureDelay,
                                     boolean anonymousEnable, String anonymousHomeDirectory,
                                     FTPUser... users) {
    final ListenerFactory listener = new ListenerFactory();
    listener.setPort(port);
    listener.setDataConnectionConfiguration(
            new DataConnectionConfigurationFactory().createDataConnectionConfiguration());

    ConnectionConfigFactory connection = new ConnectionConfigFactory();
    connection.setMaxLoginFailures(maxLoginFailures);
    connection.setLoginFailureDelay(loginFailureDelay);
    connection.setAnonymousLoginEnabled(anonymousEnable);

    final FtpServerFactory server = new FtpServerFactory();
    server.setUserManager(new FTPUserManager(anonymousEnable, anonymousHomeDirectory, users));
    server.setFileSystem(FTPFileSystemFactory.getInstance());
    server.addListener("default", listener.createListener());
    server.setConnectionConfig(connection.createConnectionConfig());

    return server.createServer();
}
 
开发者ID:AlexMofer,项目名称:ProjectX,代码行数:22,代码来源:FTPHelper.java

示例3: setupFTPServer

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
@BeforeClass
public static void setupFTPServer() throws Exception
{
    FtpServerFactory serverFactory = new FtpServerFactory();

    ConnectionConfigFactory connectionConfigFactory = new ConnectionConfigFactory();
    connectionConfigFactory.setAnonymousLoginEnabled(true);

    serverFactory.setConnectionConfig(connectionConfigFactory.createConnectionConfig());

    BaseUser user = new BaseUser();
    user.setHomeDirectory(Paths.get(FSBuilder.DIR_FOR_TEST_TREE).toAbsolutePath().toString());
    user.setName("anonymous");
    serverFactory.getUserManager().save(user);

    ListenerFactory factory = new ListenerFactory();
    factory.setPort(2221);
    serverFactory.addListener("default", factory.createListener());
    server = serverFactory.createServer();
    server.start();
}
 
开发者ID:anstarovoyt,项目名称:jb-filemanager,代码行数:22,代码来源:FTPSourceTest.java

示例4: start

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
/**
 * Start.
 */
public boolean start(){

	stop();
	
	ConnectionConfigFactory configFactory = new ConnectionConfigFactory();
	configFactory.setAnonymousLoginEnabled(false);
	configFactory.setMaxAnonymousLogins(0);
	
	configFactory.setMaxLoginFailures(5);
	configFactory.setLoginFailureDelay(30);

	configFactory.setMaxThreads(10);
	configFactory.setMaxLogins(10);

	ListenerFactory factory = new ListenerFactory();	
	factory.setPort(port);
	factory.setIdleTimeout(60);

	FtpServerFactory serverFactory = new FtpServerFactory();
	serverFactory.addListener("default", factory.createListener());
	serverFactory.setUserManager(userManager);
	serverFactory.setConnectionConfig(configFactory.createConnectionConfig());

    server = serverFactory.createServer();
    
    try{
        server.start();
    } catch (FtpException ex){
    	System.err.println(ex.getMessage());
    	return false;
    }
    return true;
	
}
 
开发者ID:dubasdey,项目名称:portable-ftp-server,代码行数:38,代码来源:FTPServer.java

示例5: init

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
private void init() {
	setFileSystem(new FtpFileSystemView());
	ConnectionConfigFactory connectionConfigFactory = new ConnectionConfigFactory();
	connectionConfigFactory.setMaxThreads(10);
	connectionConfigFactory.setAnonymousLoginEnabled(true);
	setConnectionConfig(connectionConfigFactory.createConnectionConfig());
	setUserManager(new FtpUserManagerFactory().createUserManager());

	// MFMT for directories (default mina command doesn't support it)
	CommandFactoryFactory ccf = new CommandFactoryFactory();
	ccf.addCommand("MFMT", new FtpCommands.MFMT());
	setCommandFactory(ccf.createCommandFactory());
	
	// TODO: set ftplet to control all commands
	Map<String,Ftplet> ftplets = new HashMap<String,Ftplet>();
	ftplets.put("default", new FtpletController());
	setFtplets(ftplets);

	// set the port of the listener
	int port = Integer.parseInt(configuration.getProperty("port", String.valueOf(1821)));
	String serverAddress = configuration.getProperty("server", "");
	LOG.info("FTP server configured at '" + serverAddress + ":" + port + "'");
	ListenerFactory listenerFactory = new ListenerFactory();
	listenerFactory.setPort(port);
	if (!serverAddress.isEmpty()){
		listenerFactory.setServerAddress(serverAddress);
	}

	// replace the default listener
	addListener("default", listenerFactory.createListener());
}
 
开发者ID:andresoviedo,项目名称:google-drive-ftp-adapter,代码行数:32,代码来源:GFtpServerFactory.java

示例6: createServer

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
@Override
protected FtpServerFactory createServer() throws Exception {
    FtpServerFactory server = super.createServer();

    ConnectionConfigFactory ccFactory = new ConnectionConfigFactory();

    ccFactory.setMaxLoginFailures(0);

    server.setConnectionConfig(ccFactory.createConnectionConfig());
    return server;
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:12,代码来源:UnlimitedMaxLoginTest.java

示例7: startFtpServer

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
@Before
public void startFtpServer() throws Exception {
    recursiveDelete(resolvePath(FTP_ROOT_DIR).toFile());

    File usersFile = USERS_FILE.toFile();
    usersFile.createNewFile();

    NativeFileSystemFactory fsf = new NativeFileSystemFactory();
    fsf.setCreateHome(true);

    PropertiesUserManagerFactory pumf = new PropertiesUserManagerFactory();
    pumf.setAdminName("admin");
    pumf.setPasswordEncryptor(new ClearTextPasswordEncryptor());
    pumf.setFile(usersFile);

    UserManager userMgr = pumf.createUserManager();

    BaseUser user = new BaseUser();
    user.setName("admin");
    user.setPassword("admin");
    user.setHomeDirectory(FTP_ROOT_DIR.toString());

    List<Authority> authorities = new ArrayList<>();
    WritePermission writePermission = new WritePermission();
    writePermission.authorize(new WriteRequest());
    authorities.add(writePermission);
    user.setAuthorities(authorities);
    userMgr.save(user);

    ListenerFactory factory1 = new ListenerFactory();
    factory1.setPort(PORT);

    FtpServerFactory serverFactory = new FtpServerFactory();
    serverFactory.setUserManager(userMgr);
    serverFactory.setFileSystem(fsf);
    serverFactory.setConnectionConfig(new ConnectionConfigFactory().createConnectionConfig());
    serverFactory.addListener("default", factory1.createListener());

    FtpServerFactory factory = serverFactory;
    ftpServer = factory.createServer();
    ftpServer.start();
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:43,代码来源:FtpIntegrationTest.java

示例8: createConnectionConfigFactory

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
protected ConnectionConfigFactory createConnectionConfigFactory() {
    return new ConnectionConfigFactory();
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:4,代码来源:ClientTestTemplate.java

示例9: createServer

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
@Override
protected FtpServerFactory createServer() throws Exception {
    FtpServerFactory server = super.createServer();

    ConnectionConfigFactory ccFactory = new ConnectionConfigFactory();

    ccFactory.setMaxLoginFailures(2);

    server.setConnectionConfig(ccFactory.createConnectionConfig());
    
    return server;
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:13,代码来源:CustomMaxLoginTest.java

示例10: createServer

import org.apache.ftpserver.ConnectionConfigFactory; //导入依赖的package包/类
@Override
protected FtpServerFactory createServer() throws Exception {
    FtpServerFactory server = super.createServer();

    ConnectionConfigFactory ccFactory = new ConnectionConfigFactory();

    ccFactory.setAnonymousLoginEnabled(false);

    server.setConnectionConfig(ccFactory.createConnectionConfig());

    return server;
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:13,代码来源:LoginNoAnonTest.java


注:本文中的org.apache.ftpserver.ConnectionConfigFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。