Package org.apache.commons.vfs

Examples of org.apache.commons.vfs.AllFileSelector


        String fileName = destination.getName().getBaseName();
        destination = VFSUtils.resolveFile(cachef, fileName);
      }
      if (fileChanged(source, destination))
      {
        destination.copyFrom(source, new AllFileSelector());
        destination.getContent().setLastModifiedTime(source.getContent().getLastModifiedTime());
        System.out.println("file loaded " + source.getName() + " -> " + destination.getName());
      }
      return destination;
    }
View Full Code Here


        FileObject fo3 = relativeToFO.resolveFile(dummyFileDirName);
        // now delete the dir heirarchy or fail
        if (fo3.exists()) {
            // now recursive delete the dir heirarcy
            int numbDeleted = fo3.delete(new AllFileSelector());
            System.out.println("numbCreated: " + numbCreated + " numbDeleted: " + numbDeleted);
            // assert the whole dir heirarchy was actually deleted.
            assertEquals(numbCreated, numbDeleted);
        } else {
            fail("Could not create dir heirarchy");
View Full Code Here

        // not cause re-listing of server)
        //children = newFolder.getChildren();
        //System.out.println("children in folder after redo getChildren : " + children.length);

        // assert both folder and nested file were deleted ok.
        int numbDeletedAtDest = newFolder.delete(new AllFileSelector());
        assertEquals(numbDeletedAtDest, 2);
    }
View Full Code Here

        }

        // delete the src file
        assertTrue(dummyDataFileSrc.delete());
        // delete the destination dir and its contained file
        int numbDeletedAtDest = newFolder.delete(new AllFileSelector());
        assertEquals(numbDeletedAtDest, 2);
    }
View Full Code Here

        } finally {
            // delete the src file
            assertTrue(dummyDataFileSrc.delete());
            // delete the destination dir and its contained file
            int numbDeletedAtDest = newFolder.delete(new AllFileSelector());
            assertEquals(numbDeletedAtDest, 2);
        }
    }
View Full Code Here

        // copy the source data to the target
        VFSUtil.copy(dummyDataDirSrc, dummyDataDirCopy,new MarkerListenerImpl(), doThirdPartyTransferForTwoGridFtpFileObjects);

        // delete directory heirarchies at both source and target and assert
        // number of files deleted == number of files created/copied.
        int numbDeletedSrc = dummyDataDirSrc.delete(new AllFileSelector());
        int numbDeletedCopy = dummyDataDirCopy.delete(new AllFileSelector());
        System.out.println("numbCreated: " + numbCreated);
        System.out.println("numbDeleted on Src: " + numbDeletedSrc + "  numbDeleted on Copy: " + numbDeletedCopy);

        FileObject[] parentsChildren = dummyDataDirCopy.getParent().getChildren();
View Full Code Here

                System.out.println("Deleting existing file: " + fo.getName());
                fo.delete();
            } else if (fo.getType() == FileType.FOLDER) {
                System.out.println("Deleting existing directory: " + fo.getName());
                fo.delete(new AllFileSelector());
            }
            assertFalse(fo.exists());// assert that it now dont exist
        }
    }
View Full Code Here

        // create a new directory heirarchy relative to 'relativeToFO'
        FileObject fo3 = relativeToFO.resolveFile(dummyFileDirName);

        if (fo3.exists())
        {
            fo3.delete(new AllFileSelector());
        }

        if (!fo3.exists()) {
            // ok, 'dummyFileDirName' dir does not already exist so can
            // continue to create the folder and files with and without content
View Full Code Here

        String localFile = "file:///tmp/from.txt";
        FileObject from = fsManager.resolveFile(localFile);
        assertTrue(from.exists());
       
        // pass the source file to copy as arg
        to.copyFrom(from, new AllFileSelector());       
           
    }
View Full Code Here

            if (destFo.getType().equals(FileType.FOLDER)) {
                log.debug("vfs FILE into FOLDER");
                // get a handle on the new file to create at the destination.
                FileObject nestedDestFo = destFo.resolveFile(srcFo.getName().getBaseName());
                // copyFileToFile(srcFo, nestedDestFo, false); //append false here
                nestedDestFo.copyFrom(srcFo, new AllFileSelector());

            } else {
                log.debug("vfs FILE to FILE");
                // copyFileToFile(srcFo, destFo, false); //append false here
                destFo.copyFrom(srcFo, new AllFileSelector());

            }
        } else if (srcFo.getType().equals(FileType.FOLDER)) {
            // copying the children of a folder into another folder
            if (destFo.getType().equals(FileType.FOLDER)) {
                log.debug("vfs FOLDER children into FOLDER");
                destFo.copyFrom(srcFo, new AllFileSelector());

            } else {
                throw new IOException("Cannot copy a folder to a destination that is not a folder");
            }
        } else {
View Full Code Here

TOP

Related Classes of org.apache.commons.vfs.AllFileSelector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.