List of usage examples for org.apache.commons.vfs FileSystemManager getBaseFile
public FileObject getBaseFile() throws FileSystemException;
From source file:com.newatlanta.appengine.junit.vfs.provider.GaeProviderTestCase.java
/** * Returns the base folder for tests. Copies test files from the local file * system to GaeVFS. Note that SVN (.svn) folders are not copied; if the are, * then the size of the LRUFilesCache created within GaeFileSystemManager.prepare() * must be increased to avoid testcase failures. *//* w w w .j av a2s. c om*/ @Override public FileObject getBaseTestFolder(FileSystemManager manager) throws Exception { FileObject gaeTestBaseDir = manager.getBaseFile().resolveFile("test-data"); if (!gaeTestBaseDir.exists()) { FileObject localTestBaseDir = manager .resolveFile("file://" + GaeFileNameParser.getRootPath(manager.getBaseFile().getName()) + gaeTestBaseDir.getName().getPath()); gaeTestBaseDir.copyFrom(localTestBaseDir, new TestFileSelector()); // confirm that the correct number of files were copied FileObject[] testFiles = localTestBaseDir.findFiles(new TestFileSelector()); FileObject[] gaeFiles = gaeTestBaseDir.findFiles(Selectors.SELECT_FILES); assertEquals(testFiles.length, gaeFiles.length); } return gaeTestBaseDir; }
From source file:com.newatlanta.appengine.vfs.provider.GaeFileObject.java
/** * Override the superclass implementation to make sure GaeVFS "shadows" * exist for local directories./*from w w w .j ava2 s.com*/ */ @Override public FileObject getParent() throws FileSystemException { FileObject parent = super.getParent(); if ((parent != null) && !parent.exists()) { // check for existing local directory FileSystemManager manager = getFileSystem().getFileSystemManager(); FileObject localDir = manager.resolveFile("file://" + GaeFileNameParser.getRootPath(manager.getBaseFile().getName()) + parent.getName().getPath()); if (localDir.exists() && localDir.getType().hasChildren()) { parent.createFolder(); // make sure GaeVFS "shadow" folder exists } } return parent; }