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


Java PropertiesUserManagerFactory类代码示例

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


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

示例1: start

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的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.usermanager.PropertiesUserManagerFactory; //导入依赖的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: createFtpServerFactory

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

示例4: setUp

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

示例5: createServer

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
private FtpServer createServer() {
    FtpServerFactory serverFactory = new FtpServerFactory();
    ListenerFactory listenerFactory = new ListenerFactory();
    listenerFactory.setPort(FTP_PORT);
    serverFactory.addListener("default", listenerFactory.createListener());
    PropertiesUserManagerFactory managerFactory = new PropertiesUserManagerFactory();
    managerFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());
    managerFactory.setFile(new File("src/test/resources/users.properties"));
    UserManager createUserManager = managerFactory.createUserManager();
    serverFactory.setUserManager(createUserManager);

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

    return serverFactory.createServer();
}
 
开发者ID:tadayosi,项目名称:samples-switchyard,代码行数:18,代码来源:FTPServer.java

示例6: startServer

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
/**
 * Start the FTP server.
 */
public void startServer() {
    //Set the user factory
    PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
    String filename = mContext.getExternalCacheDir().getAbsolutePath() + "/users.properties";
    File files = new File(filename);
    userManagerFactory.setFile(files);

    //Set the server factory
    FtpServerFactory serverFactory = new FtpServerFactory();
    serverFactory.setUserManager(userManagerFactory.createUserManager());

    //Set the port number
    ListenerFactory factory = new ListenerFactory();
    factory.setPort(PORT_NUMBER);
    try {
        serverFactory.addListener("default", factory.createListener());
        FtpServer server = serverFactory.createServer();
        mFtpServer = server;

        //Start the server
        server.start();
    } catch (FtpException e) {
        e.printStackTrace();
    }

    Log.d(TAG, "onCreate: FTP server started. IP address: " + getLocalIpAddress() + " and Port:" + PORT_NUMBER);
}
 
开发者ID:kevalpatel2106,项目名称:remote-storage-android-things,代码行数:31,代码来源:FTPManager.java

示例7: PFtpServer

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
public PFtpServer(int port, FtpServerCb callback) {
    mCallback = callback;
    mPort = port;
    //mUserName = userName;
    //mPassword = password;

    userManagerFactory = new PropertiesUserManagerFactory();
    //userManagerFactory.setAdminName(mUserName);
    userManagerFactory.setPasswordEncryptor(new SaltedPasswordEncryptor());

    um = userManagerFactory.createUserManager();
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:13,代码来源:PFtpServer.java

示例8: Config2

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
void Config2() {
//		Now, let's make it possible for a client to use FTPS (FTP over SSL) for the default listener.


        FtpServerFactory serverFactory = new FtpServerFactory();

        ListenerFactory factory = new ListenerFactory();

        // set the port of the listener
        factory.setPort(2221);

        // define SSL configuration
        SslConfigurationFactory ssl = new SslConfigurationFactory();
        ssl.setKeystoreFile(new File(ftpConfigDir + "ftpserver.jks"));
        ssl.setKeystorePassword("password");

        // set the SSL configuration for the listener
        factory.setSslConfiguration(ssl.createSslConfiguration());
        factory.setImplicitSsl(true);

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

        PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
        userManagerFactory.setFile(new File(ftpConfigDir + "users.properties"));

        serverFactory.setUserManager(userManagerFactory.createUserManager());

        // start the server
        FtpServer server = serverFactory.createServer();
        this.mFtpServer = server;
        try {
            server.start();
        } catch (FtpException e) {
            e.printStackTrace();
        }
    }
 
开发者ID:lucky-code,项目名称:Practice,代码行数:38,代码来源:FtpActivity.java

示例9: configureFtpServerFactory

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
/**
  * @param args
* @throws IOException 
  */
 public FtpServerFactory configureFtpServerFactory() throws IOException{
 FtpServerFactory fsf = new FtpServerFactory();		
 log.info("Configuring an on-the-fly FTP server.");

  String ftpUsersFilePath = null;
  File fFTPServerUserFile = null;
  ftpUsersFilePath = RepositoryManager.getRepositoryLocation() + File.separator + "conf" + File.separator + FTP_USERS_FILE;
  log.debug("Creating FTP users file at " + ftpUsersFilePath);
     fFTPServerUserFile = new File(ftpUsersFilePath);
     fFTPServerUserFile.mkdirs();
  fFTPServerUserFile.delete();
  
  fFTPServerUserFile.createNewFile();
  			 		  		      
     final Map<String, Ftplet> ftpletMap = new HashMap<String, Ftplet>();
  
     Ftplet ftplet = new ConfFtplet(this);
     ftpletMap.put("default",ftplet);		      
     fsf.setFtplets(ftpletMap);
   
     userManagerFactory = new PropertiesUserManagerFactory();
     userManagerFactory.setFile(new File(ftpUsersFilePath));
     userManagerFactory.setPasswordEncryptor(new Md5PasswordEncryptor());	    
     userManager = userManagerFactory.createUserManager();
     
    

     
     ListenerFactory listenerFactory = new ListenerFactory();
     listenerFactory.setPort(DEFAULT_FTP_PORT);
     fsf.addListener("default", listenerFactory.createListener());
     fsf.setUserManager(userManager);
  
     // Inicializar host ip.
     this.host = VMRCServerUtils.getPublicIP();
     return fsf;
 }
 
开发者ID:grycap,项目名称:vmrc,代码行数:42,代码来源:FTPServer.java

示例10: ftpUserManager

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
@Bean
   public UserManager ftpUserManager() throws FtpException {
PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
userManagerFactory.setFile(new File("ftp-users.properties"));
userManagerFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());
return userManagerFactory.createUserManager();
   }
 
开发者ID:PoJD,项目名称:hawa,代码行数:8,代码来源:SecurityConfig.java

示例11: PeerlessFtpServerSupport

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
public PeerlessFtpServerSupport(int port) {
	super();
	this.port = port;
	user = new BaseUser();

	userManagerFactory = new PropertiesUserManagerFactory();
	userManagerFactory.setFile(new File("users.properties"));

	userManagerFactory.setPasswordEncryptor(new SaltedPasswordEncryptor());
	um = userManagerFactory.createUserManager();
}
 
开发者ID:knowpd,项目名称:p2p-file-sharing-system,代码行数:12,代码来源:PeerlessFtpServerSupport.java

示例12: SetupPassword

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
private static UserManager SetupPassword(final String pass, final int fieldCount) throws FtpException {
    logger.info("Creating FTP Users with password '{}'..", pass);
    final PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
    final UserManager um = userManagerFactory.createUserManager();
    for (int i = 1; i != fieldCount + 1; i++) {
        logger.info("FTP User field{} created!", i);
        um.save(MakeUser("field" + i, pass));
    }
    return um;
}
 
开发者ID:VirginiaFIRST,项目名称:FTC-FieldMgmt,代码行数:11,代码来源:Main.java

示例13: createServer

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
private FtpServer createServer( int port, String username, String password, boolean implicitSsl ) throws Exception {
  ListenerFactory factory = new ListenerFactory();
  factory.setPort( port );

  if ( implicitSsl ) {
    SslConfigurationFactory ssl = new SslConfigurationFactory();
    ssl.setKeystoreFile( new File( SERVER_KEYSTORE ) );
    ssl.setKeystorePassword( PASSWORD );
    // set the SSL configuration for the listener
    factory.setSslConfiguration( ssl.createSslConfiguration() );
    factory.setImplicitSsl( true );
  }

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

  PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();

  userManagerFactory.setFile( new File( SERVER_USERS ) );
  UserManager userManager = userManagerFactory.createUserManager();
  if ( !userManager.doesExist( username ) ) {
    BaseUser user = new BaseUser();
    user.setName( username );
    user.setPassword( password );
    user.setEnabled( true );
    user.setHomeDirectory( USER_HOME_DIR );
    user.setAuthorities( Collections.<Authority>singletonList( new WritePermission() ) );
    userManager.save( user );
  }

  serverFactory.setUserManager( userManager );
  return serverFactory.createServer();
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:35,代码来源:FtpsServer.java

示例14: main

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
    userManagerFactory.setFile(new File("myusers.properties"));
    userManagerFactory.setPasswordEncryptor(new SaltedPasswordEncryptor());
    UserManager um = userManagerFactory.createUserManager();

    UserFactory userFact = new UserFactory();
    userFact.setName("myNewUser");
    userFact.setPassword("secret");
    userFact.setHomeDirectory("ftproot");
    User user = userFact.createUser();
    um.save(user);
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:14,代码来源:ManagingUsers.java

示例15: main

import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    FtpServerFactory serverFactory = new FtpServerFactory();
    
    ListenerFactory factory = new ListenerFactory();
    
    // set the port of the listener
    factory.setPort(2221);

    // define SSL configuration
    SslConfigurationFactory ssl = new SslConfigurationFactory();
    ssl.setKeystoreFile(new File("src/test/resources/ftpserver.jks"));
    ssl.setKeystorePassword("password");

    // set the SSL configuration for the listener
    factory.setSslConfiguration(ssl.createSslConfiguration());
    factory.setImplicitSsl(true);

    // replace the default listener
    serverFactory.addListener("default", factory.createListener());
    
    PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
    userManagerFactory.setFile(new File("myusers.properties"));
    
    serverFactory.setUserManager(userManagerFactory.createUserManager());
    
    // start the server
    FtpServer server = serverFactory.createServer(); 
    
    server.start();
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:31,代码来源:EmbeddingFtpServer.java


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