Package org.apache.commons.vfs

Examples of org.apache.commons.vfs.FileObject.createFolder()


  }
 
  protected FileObject setupRootFolder(BinaryPart binaryPart) throws FileSystemException {
  FileObject folder = VFSUtils.getFileSystemManager().resolveFile(imageDirPath);
    if (!folder.exists()) {
      folder.createFolder();
    }
    return folder;
  }
 
  /**
 
View Full Code Here


        FileObject folder = FileUtils.resolveFileObject((String) props.getProperty(propertyName));

        if (!folder.exists())
        {
            if (create)
                folder.createFolder();
            else
            {
                OwnSyncException ose = new OwnSyncException("Folder " + FileUtils.getAbsolutePath(folder) + " for property " + propertyName + " not found! \n EXITING!");
                OwnSyncStatus.throwingMessage("OwnSyncStarter", "getFolder(" + propertyName + ")", ose);
                throw ose;
View Full Code Here

            FileObject answer = fileSystemManager.resolveFile(path);
            if (answer == null) {
                throw new JBIException("Could not resolve file: " + path);
            }
            try {
                answer.createFolder();
            }
            catch (FileSystemException e) {
                throw new JBIException("Failed to create folder: " + e, e);
            }
            return answer;
View Full Code Here

  public void test1() {
    try {
      FileSystemManager fsManager = VFS.getManager();
      FileObject dir = fsManager.resolveFile("ram://test-dir");
      dir.createFolder();
      FileObject chapter1 = dir.resolveFile("chapter1.html", NameScope.CHILD);
      chapter1.createFile();
      IOUtils.copy(this.getClass().getResourceAsStream("/book1/chapter1.html"), chapter1.getContent().getOutputStream());
      Book bookFromDirectory = FilesetBookCreator.createBookFromDirectory(dir, Constants.CHARACTER_ENCODING);
      assertEquals(1, bookFromDirectory.getResources().size());
View Full Code Here

  }

  private FileObject createDirWithSourceFiles() throws IOException {
    FileSystemManager fsManager = VFS.getManager();
    FileObject dir = fsManager.resolveFile("ram://fileset_test_dir");
    dir.createFolder();
    String[] sourceFiles = new String[] {
        "book1.css",
        "chapter1.html",
        "chapter2_1.html",
        "chapter2.html",
View Full Code Here

 
  public void test1() {
    try {
      FileSystemManager fsManager = VFS.getManager();
      FileObject dir = fsManager.resolveFile("ram://chm_test_dir");
      dir.createFolder();
      String chm1Dir = "/chm1";
      Iterator<String> lineIter = IOUtils.lineIterator(ChmParserTest.class.getResourceAsStream(chm1Dir + "/filelist.txt"), Constants.CHARACTER_ENCODING);
      while(lineIter.hasNext()) {
        String line = lineIter.next();
        FileObject file = dir.resolveFile(line, NameScope.DESCENDENT);
View Full Code Here

        if (!StringUtils.isEmpty(startingPath)) {
            try {
                FileObject fileObject = getFilesystemManager().getFileSystem().resolveFile(startingPath);
                if (!fileObject.exists()) {
                    fileObject.createFolder();
                }
            } catch (FileSystemException e) {
                log.error("Error: ", e);
            }
        }
View Full Code Here

            FileObject currentDir = getCurrentDir();
            if (currentDir != null && currentDir.isWriteable()) {
                String folderName = request.getRequestObject().getParameter("folderName");
                FileObject fileObject = getCurrentDir().resolveFile(folderName);
                if (!fileObject.exists()) {
                    fileObject.createFolder();
                    openPaths.add(currentPath);
                    currentPath = fileObject.getName().getPath();
                    selectedFile = null;
                    return getCommonResponse(request);
                } else {
View Full Code Here

            FileObject fileRoot = root.getFileObject();
            if(fileRoot !=null){
              try {
                FileObject object = fileRoot.resolveFile(fcd.filename);
                if(object.getType().equals(FileType.IMAGINARY)){
                  object.createFolder();
                  directoryTreeViewer.refresh(obj);
                }
               
              } catch (FileSystemException e) {
                // TODO Auto-generated catch block
View Full Code Here

          else if(obj instanceof RemoteFile){
            RemoteFile rem = (RemoteFile)obj;
            try {
              FileObject object2 = rem.getFileItem().resolveFile(fcd.filename);
              if(object2.getType().equals(FileType.IMAGINARY)){
                object2.createFolder();
                directoryTreeViewer.refresh(obj);
              }
            } catch (FileSystemException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.