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


Java ListenerFactory类代码示例

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


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

示例1: start

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
@BeforeClass
public static void start() throws Exception {
    final FtpServerFactory serverFactory = new FtpServerFactory();
    final PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
    userManagerFactory.setUrl(ConcurrentTransferWorkerTest.class.getResource("/ftpserver-user.properties"));
    final UserManager userManager = userManagerFactory.createUserManager();
    BaseUser user = new BaseUser();
    user.setName("test");
    user.setPassword("test");
    user.setHomeDirectory(new TemporaryApplicationResourcesFinder().find().getAbsolute());
    List<Authority> authorities = new ArrayList<Authority>();
    authorities.add(new WritePermission());
    authorities.add(new ConcurrentLoginPermission(2, Integer.MAX_VALUE));
    user.setAuthorities(authorities);
    userManager.save(user);
    serverFactory.setUserManager(userManager);
    final ListenerFactory factory = new ListenerFactory();
    factory.setPort(PORT_NUMBER);
    serverFactory.addListener("default", factory.createListener());
    server = serverFactory.createServer();
    server.start();
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:23,代码来源:ConcurrentTransferWorkerTest.java

示例2: startFtpServer

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
/**
 * ����FTP������
 * @param hostip ����ip
 */
private void startFtpServer(String hostip) {
	FtpServerFactory serverFactory = new FtpServerFactory();

	PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
	File files = new File(filename);
	//���������ļ�
	userManagerFactory.setFile(files);
	serverFactory.setUserManager(userManagerFactory.createUserManager());
	// ���ü���IP�Ͷ˿ں�
	ListenerFactory factory = new ListenerFactory();
	factory.setPort(PORT);
	factory.setServerAddress(hostip);

	// replace the default listener
	serverFactory.addListener("default", factory.createListener());

	// start the server
	mFtpServer = serverFactory.createServer();
	try {
		mFtpServer.start();
		Log.d(TAG, "������FTP������  ip = " + hostip);
	} catch (FtpException e) {
		System.out.println(e);
	}
}
 
开发者ID:lucky-code,项目名称:Practice,代码行数:30,代码来源:MainActivity.java

示例3: start

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
public void start() {
    FtpServerFactory serverFactory = new FtpServerFactory();
    ListenerFactory factory = new ListenerFactory();
    factory.setPort(mPort);

    // replace the default listener
    serverFactory.addListener("default", factory.createListener());
    serverFactory.setUserManager(um);

    Map ftpLets = new HashMap<>();
    ftpLets.put("ftpLet", new CallbackFTP(mCallback));


    serverFactory.setFtplets(ftpLets);

    // start the server
    try {
        server = serverFactory.createServer();
        server.start();
        MLog.d(TAG, "server started");
    } catch (FtpException e) {
        e.printStackTrace();
        MLog.d(TAG, "server not started");
    }
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:26,代码来源:PFtpServer.java

示例4: initFtpServer

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
protected void initFtpServer() throws Exception {
    FtpServerFactory serverFactory = new FtpServerFactory();

    // setup user management to read our users.properties and use clear text passwords
    File file = new File("src/test/resources/users.properties");
    UserManager uman = new PropertiesUserManager(new ClearTextPasswordEncryptor(), file, "admin");
    serverFactory.setUserManager(uman);

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

    ListenerFactory factory = new ListenerFactory();
    factory.setPort(ftpPort);
    serverFactory.addListener("default", factory.createListener());

    ftpServer = serverFactory.createServer();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:FtpAndHttpRecipientListInterceptSendToEndpointIssueTest.java

示例5: initFtpServer

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
protected void initFtpServer() throws Exception {
    FtpServerFactory serverFactory = new FtpServerFactory();

    // setup user management to read our users.properties and use clear text passwords
    File file = new File("src/test/resources/users.properties");
    UserManager uman = new PropertiesUserManager(new ClearTextPasswordEncryptor(), file, "admin");
    serverFactory.setUserManager(uman);

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

    ListenerFactory factory = new ListenerFactory();
    factory.setPort(20128);
    serverFactory.addListener("default", factory.createListener());

    ftpServer = serverFactory.createServer();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:FtpCronScheduledRoutePolicyTest.java

示例6: createFtpServerFactory

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的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

示例7: initFtpServer

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
public static void initFtpServer() throws Exception {
    FtpServerFactory serverFactory = new FtpServerFactory();

    // setup user management to read our users.properties and use clear text passwords
    URL url = ObjectHelper.loadResourceAsURL("users.properties");
    UserManager uman = new PropertiesUserManager(new ClearTextPasswordEncryptor(), url, "admin");

    serverFactory.setUserManager(uman);

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

    ListenerFactory factory = new ListenerFactory();
    factory.setPort(port);
    serverFactory.addListener("default", factory.createListener());

    ftpServer = serverFactory.createServer();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:20,代码来源:FtpServerBean.java

示例8: initFtpServer

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
public void initFtpServer() throws Exception {
    FtpServerFactory serverFactory = new FtpServerFactory();

    // setup user management to read our users.properties and use clear text passwords
    URL url = ObjectHelper.loadResourceAsURL("users.properties");
    UserManager uman = new PropertiesUserManager(new ClearTextPasswordEncryptor(), url, "admin");

    serverFactory.setUserManager(uman);

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

    ListenerFactory factory = new ListenerFactory();
    factory.setPort(port);
    serverFactory.addListener("default", factory.createListener());

    ftpServer = serverFactory.createServer();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:20,代码来源:FtpServerBean.java

示例9: setUp

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
/**
 * Sets up Apache FTP server.
 *
 * @throws Exception When it fails.
 */
@Before
public void setUp() throws Exception {
    final UserManager manager = new PropertiesUserManagerFactory()
        .createUserManager();
    final BaseUser user = new BaseUser();
    final ListenerFactory listener = new ListenerFactory();
    final FtpServerFactory factory = new FtpServerFactory();
    user.setName(NAME);
    user.setPassword(PASS);
    user.setHomeDirectory(TEMP_DIR);
    manager.save(user);
    listener.setPort(PORT);
    factory.setUserManager(manager);
    factory.addListener("default", listener.createListener());
    this.server = factory.createServer();
    this.server.start();
    Files.deleteIfExists(TEMP);
}
 
开发者ID:piotrkot,项目名称:ftp-wrapper,代码行数:24,代码来源:FTPIntegrationTest.java

示例10: before

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
@Before
public void before() throws Exception {
	directory = new File(folder.newFolder(), "test-1");
	directory.mkdir();
	
	FtpServerFactory serverFactory = new FtpServerFactory();
	ListenerFactory listenerFactory = new ListenerFactory();
	listenerFactory.setServerAddress("127.0.0.1");
	listenerFactory.setPort(21000);
	serverFactory.addListener("default", listenerFactory.createListener());
	serverFactory.setUserManager(new AdminUserManagerFactory(directory.getParentFile().getAbsolutePath()));
	
	try {
		ftpServer = serverFactory.createServer();
		ftpServer.start();
	} catch (FtpException ex) {
		throw new RuntimeException(ex);
	}
	
	FtpStorageProviderFactory factory = new FtpStorageProviderFactory();
	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(FtpStorage.URL_PROPERTY, "ftp://admin:[email protected]:21000/" + directory.getName());
	properties.put(FtpStorage.CREATE_DIRECTORY_PROPERTY, "false");
	storageProvider = factory.createStorageProvider(properties);
}
 
开发者ID:Blazebit,项目名称:blaze-storage,代码行数:26,代码来源:FtpStorageProviderTest.java

示例11: before

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
@Before
public void before() throws Exception {
	directory = folder.newFolder();
	FtpServerFactory serverFactory = new FtpServerFactory();
	ListenerFactory listenerFactory = new ListenerFactory();
	listenerFactory.setServerAddress("127.0.0.1");
	listenerFactory.setPort(21000);
	serverFactory.addListener("default", listenerFactory.createListener());
	serverFactory.setUserManager(new AdminUserManagerFactory(directory.getAbsolutePath()));
	
	try {
		ftpServer = serverFactory.createServer();
		ftpServer.start();
	} catch (FtpException ex) {
		throw new RuntimeException(ex);
	}
	
	factory = new FtpStorageProviderFactory();
}
 
开发者ID:Blazebit,项目名称:blaze-storage,代码行数:20,代码来源:FtpStorageProviderFactoryTest.java

示例12: createServer

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的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

示例13: setupFTPServer

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的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

示例14: Ftp

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
public Ftp(int port, UserManager userManager, Ftplet ftplet) {
LOG.info("Starting up internal FTP server on port :" + port + "...");

ListenerFactory listenerFactory = new ListenerFactory();
listenerFactory.setPort(port);
FtpServerFactory serverFactory = new FtpServerFactory();
serverFactory.addListener("default", listenerFactory.createListener());
serverFactory.setFtplets(Collections.singletonMap("security", ftplet));

serverFactory.setUserManager(userManager);
server = serverFactory.createServer();
try {
    server.start();
    LOG.info("Internal FTP server started OK...");
} catch (FtpException e) {
    LOG.error("FTP server failed to start, snapshots from cameras won't be processed.", e);
}
   }
 
开发者ID:PoJD,项目名称:hawa,代码行数:19,代码来源:Ftp.java

示例15: prepareTestCase

import org.apache.ftpserver.listener.ListenerFactory; //导入依赖的package包/类
@Override
public void prepareTestCase() {
    super.prepareTestCase();
    FtpServerFactory serverFactory = new FtpServerFactory();
    ListenerFactory factory = new ListenerFactory();
    // set the port of the listener
    factory.setPort(4921);
    // replace the default listener
    serverFactory.addListener("default", listener = factory.createListener());
    // set test user manager
    serverFactory.setUserManager(new TestUserManager());
    // set config
    ConnectionConfig config = new DefaultConnectionConfig(false, 0, 100, 0, 100, 2);
    serverFactory.setConnectionConfig(config);
    // start the server
    server = serverFactory.createServer();
    try {
        server.start();
    }
    catch (FtpException e) {
        Assert.fail("Unexpected FTP exception: " + e.getMessage());
    }
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:24,代码来源:FtpFileServiceTest.java


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