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


Java VFS.getManager方法代码示例

本文整理汇总了Java中org.apache.commons.vfs.VFS.getManager方法的典型用法代码示例。如果您正苦于以下问题:Java VFS.getManager方法的具体用法?Java VFS.getManager怎么用?Java VFS.getManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.vfs.VFS的用法示例。


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

示例1: setUp

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
protected void setUp() throws Exception
{
    String tempDir = System.getProperty("java.io.tmpdir");
    FileSystemManager fsm = VFS.getManager();

    rootDir = fsm.resolveFile(tempDir + "/testfsr");
    rootDir.createFolder();
    tempFile = createFile(rootDir, "fsp.html");

    subdir1 = fsm.resolveFile(rootDir, "SubDir1");
    subdir1.createFolder();

    createFile(subdir1, "toto.html");
    createFile(subdir1, "titi.HTML");
    subdir2 = fsm.resolveFile(rootDir, "SubDir2");
    subdir2.createFolder();

    createFile(subdir2, "toto.html");
    subsubdir = fsm.resolveFile(subdir2, "subsubdir");
    subsubdir.createFolder();

    createFile(subsubdir, "momo.html");
    createFile(subsubdir, "mimi.html");
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:25,代码来源:VFSRepositoryTest.java

示例2: getInitialBaseDir

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
@Override
public FileObject getInitialBaseDir(FtpSession session)
{
	String expr = "/ftpd/user[@name=\""+session.getUsername()+"\"]/basedir/text()";
	String dirStr = evalXPath(expr);
	if(StringUtils.isEmpty(dirStr))
	{
		dirStr = evalXPath("/ftpd/default/basedir/text()");
	}
	if(StringUtils.isEmpty(dirStr) )
		throw new IncorrectConfigurationException("Basedir is not set");
	try
	{			
		FileSystemManager fsManager = VFS.getManager();
		return fsManager.resolveFile(dirStr);
	} 
	catch (FileSystemException e)
	{
		throw new IncorrectConfigurationException(e);
	}
}
 
开发者ID:PhantomYdn,项目名称:jvfsftpd,代码行数:22,代码来源:FileFtpConfiguration.java

示例3: getInitialCurrentDir

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
@Override
public FileObject getInitialCurrentDir(FtpSession session)
{
	String expr = "/ftpd/user[@name=\""+session.getUsername()+"\"]/initialdir/text()";
	String dirStr = evalXPath(expr);
	if(StringUtils.isEmpty(dirStr))
	{
		dirStr = evalXPath("/ftpd/default/initialdir/text()");
	}
	if(StringUtils.isEmpty(dirStr))
		return getInitialBaseDir(session);
	try
	{			
		FileSystemManager fsManager = VFS.getManager();
		return fsManager.resolveFile(dirStr);
	} 
	catch (FileSystemException e)
	{
		throw new IncorrectConfigurationException(e);
	}
}
 
开发者ID:PhantomYdn,项目名称:jvfsftpd,代码行数:22,代码来源:FileFtpConfiguration.java

示例4: KettleVFS

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
private KettleVFS()
{
	// Install a shutdown hook to make sure that the file system manager is closed
	// This will clean up temporary files in vfs_cache
	//
    Thread thread = new Thread(new Runnable(){
    	public void run() {
      try
      {
          FileSystemManager mgr = VFS.getManager();
          if (mgr instanceof DefaultFileSystemManager)
          {
              ((DefaultFileSystemManager)mgr).close();
          }
      }
      catch (FileSystemException e)
      {
          e.printStackTrace();
      }
     }
    });
    Runtime.getRuntime().addShutdownHook(thread); 
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:24,代码来源:KettleVFS.java

示例5: testDefaultInstance

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
/**
 * Sanity test.
 */
public void testDefaultInstance() throws Exception
{
    // Locate the default manager
    final FileSystemManager manager = VFS.getManager();

    // Lookup a test jar file
    final File jarFile = getTestResource("test.jar");
    FileObject file = manager.toFileObject(jarFile);
    assertNotNull(file);
    assertTrue(file.exists());
    assertSame(FileType.FILE, file.getType());

    // Expand it
    file = manager.createFileSystem(file);
    assertNotNull(file);
    assertTrue(file.exists());
    assertSame(FileType.FOLDER, file.getType());
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:22,代码来源:FileSystemManagerFactoryTestCase.java

示例6: testCeateFile

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
/**
 * 특정 위치에 파일을 생성하고 필요에 따라 생성한 파일을 캐싱한다.
 * @throws Exception
 */
@Test
public void testCeateFile() throws Exception {
	FileSystemManager manager = VFS.getManager();
	
	FileObject baseDir = manager.resolveFile(System.getProperty("user.dir"));
	final FileObject file = manager.resolveFile(baseDir, "testfolder/file1.txt");
	
	// 모든 파일 삭제
	file.delete(Selectors.SELECT_FILES);
	assertFalse(file.exists());

	// 파일 생성
	file.createFile();    	
	assertTrue(file.exists());
}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:20,代码来源:FilehandlingServiceTest.java

示例7: testCaching3

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
@Test
public void testCaching3() throws Exception {
	FileSystemManager manager = VFS.getManager();
	String testFolder = "d:/workspace/java/e-gov/eGovFramework/RTE/DEV/trunk/Foundation/egovframework.rte.fdl.filehandling/test";
	FileObject scratchFolder = manager.resolveFile(testFolder);
	
	// releaseable
    FileObject dir1 = scratchFolder.resolveFile("file1.txt");

    // avoid cache removal
    FileObject dir2 = scratchFolder.resolveFile("file2.txt");
    dir2.getContent();

    // check if the cache still holds the right instance
    FileObject dir2_2 = scratchFolder.resolveFile("file2.txt");
    assertTrue(dir2 == dir2_2);

    // check if the cache still holds the right instance
   /* FileObject dir1_2 = scratchFolder.resolveFile("file1.txt");
    assertFalse(dir1 == dir1_2);*/
}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:22,代码来源:FilehandlingServiceTest.java

示例8: VFSRepository

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
/**
 * <p>Constructor for VFSRepository.</p>
 */
public VFSRepository()
{
    try
    {
        fileSystemManager = VFS.getManager();
    }
    catch (FileSystemException ex)
    {
        throw ExceptionImposter.imposterize( ex );
    }
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:15,代码来源:VFSRepository.java

示例9: getFileSystemManager

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
/** Get the FileSystemManager.

    @return The FileSystemManager
    @throws FileSystemException
*/

public synchronized FileSystemManager getFileSystemManager() 
throws FileSystemException{
    if(fileSystemManager == null){
        fileSystemManager = VFS.getManager();
    }
    return fileSystemManager;
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:14,代码来源:VFSResourceLoader.java

示例10: JavaFileIO

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
public JavaFileIO(ServletConfig config) throws ServletException{
	
	
	try {
		fsManager = VFS.getManager();
		((StandardFileSystemManager)fsManager).addProvider( "s3", new com.intridea.io.vfs.provider.s3.S3FileProvider() );
		((StandardFileSystemManager)fsManager).addOperationProvider("s3", new com.intridea.io.vfs.provider.s3.acl.AclOperationsProvider() );
	} catch (Exception e1) {
		cfEngine.log("Failed to register the s3:// name space: " + e1.getMessage());
	}
	
	
	// Set the working directory
	try {
		if (!setWorkingDirectory(config.getInitParameter("BLUEDRAGON_WORKING_DIRECTORY"))) {
			throw new Exception(config.getInitParameter("BLUEDRAGON_WORKING_DIRECTORY") + " could not be created");
		}
	} catch (Exception E) {
		System.out.println( cfEngine.PRODUCT_NAME + ": Init Parameter BLUEDRAGON_WORKING_DIRECTORY Error: " + E);
		throw new ServletException( cfEngine.PRODUCT_NAME + ": Init Parameter BLUEDRAGON_WORKING_DIRECTORY Error: " + E);
	}

	
	// Setup the logging
	com.nary.Debug.SystemOff();
	File logFile = new File( getWorkingDirectory(), "bluedragon.log");
	rolloverLogFile(logFile);
	com.nary.Debug.setFilename(logFile.toString());

	setTempDirectory();
	setupRuntimeLogging();
	
	cfEngine.log(cfEngine.PRODUCT_NAME + " WorkingDirectory=[" + getWorkingDirectory() + "]");
	cfEngine.log(cfEngine.PRODUCT_NAME + " TempDirectory=[" + getTempDirectory() + "]");
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:36,代码来源:JavaFileIO.java

示例11: getInitialBaseDir

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
@Override
public FileObject getInitialBaseDir(FtpSession session)
{
	String baseDirStr = System.getProperty(BASE_DIR_PROPERTY);
	if(baseDirStr==null) throw new IncorrectConfigurationException("Base dir is not specified");
	try
	{			
		FileSystemManager fsManager = VFS.getManager();
		return fsManager.resolveFile(baseDirStr);
	} 
	catch (FileSystemException e)
	{
		throw new IncorrectConfigurationException(e);
	}
}
 
开发者ID:PhantomYdn,项目名称:jvfsftpd,代码行数:16,代码来源:CLFtpConfiguration.java

示例12: setUp

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
protected void setUp() throws Exception {
  super.setUp();
  FileSystemManager fsm = VFS.getManager();
  FileObject fsRoot = fsm.createVirtualFileSystem(fsm.resolveFile("ram:/"));
  aFile = fsRoot.resolveFile("/file.txt");
  aFile.delete();
  aFile.createFile();
  aDirectory = fsRoot.resolveFile("/folder");
  aDirectory.delete();
  aDirectory.createFolder();
}
 
开发者ID:thinkberg,项目名称:moxo,代码行数:12,代码来源:DavTestCase.java

示例13: main

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
public static void main(String[] args) throws FileSystemException
{
	FileSystemManager mgr = VFS.getManager();

	FileObject root = mgr
			.resolveFile("smb://HOME\\vfsusr:vfs%2f%25\\te:[email protected]/vfsusr");
	FileName rootName = root.getName();

	testNames(mgr, rootName);

	testChildren(root);

	testFiles(mgr);
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:15,代码来源:FileNamePerformance.java

示例14: setUp

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
public void setUp() throws Exception
{
    super.setUp();
    fsManager = VFS.getManager();
    testDir = AbstractVfsTestCase.getTestDirectoryFile();
    changeStatus = 0;
    testFile = new File(testDir, "testReload.properties");

    if (testFile.exists())
    {
        testFile.delete();
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:14,代码来源:DefaultFileMonitorTests.java

示例15: testUserAuthentication

import org.apache.commons.vfs.VFS; //导入方法依赖的package包/类
@Test
public void testUserAuthentication() throws Exception {
	StaticUserAuthenticator auth = new StaticUserAuthenticator(null, "username", "password");
	FileSystemOptions opts = new FileSystemOptions();
	DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
	
	FileSystemManager manager = VFS.getManager();

	FileObject baseDir = manager.resolveFile(System.getProperty("user.dir"));
	FileObject file = manager.resolveFile(baseDir, "testfolder/file1.txt");
	FileObject fo = manager.resolveFile("d:" + file.getName().getPath(), opts);
	
	fo.createFile();
	
}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:16,代码来源:FilehandlingServiceTest.java


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