Package org.olat.core.util.vfs

Examples of org.olat.core.util.vfs.LocalFileImpl


   * @param zipFile    The zip file to unzip
   * @param targetDir  The directory to unzip the file to
   * @return  True if successfull, false otherwise
   */
  public static boolean unzip(File zipFile, File targetDir) {
    return unzip(new LocalFileImpl(zipFile), new LocalFolderImpl(targetDir));
  }
View Full Code Here


      String fileName = iter.next();
      VFSItem item = vfsRoot.resolve(fileName);
      if (item == null) return false;
      vfsFiles.add(item);
    }
    return zip(vfsFiles, new LocalFileImpl(target));
  } // zip
View Full Code Here

        }
      } else  if (com.equals("vc")) {
        // ------- open velocity container for editing -------
        VelocityContainer vc = (VelocityContainer) infoComponent;
        String velocityTemplatePath  = WebappHelper.getSourcePath()+"/"+vc.getPage();
        VFSLeaf vcContentFile = new LocalFileImpl(new File(velocityTemplatePath));
        boolean readOnly = Settings.isReadOnlyDebug();
        vcEditorController = new PlainTextEditorController(ureq, getWindowControl(), vcContentFile, "utf-8", true, true, null);
        vcEditorController.setReadOnly(readOnly);
        vcEditorController.addControllerListener(this);
        VelocityContainer vcWrap = createVelocityContainer("vcWrapper");
View Full Code Here

      String suffix = sdb.format(date);
      filename += "."+suffix;
    }
    File logf = new File(filename);
    if (!logf.exists()) return null;
    return new LocalFileImpl(logf);
  }
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    File lo = new File("c:/tmp/otemp.txt");
    VFSLeaf l = new LocalFileImpl(lo);
    VFSLeaf to = new LocalFileImpl(new File("c:/tmp/output.txt"));
    System.out.println(buildUsageAndTimeStats(l, to));
  }
View Full Code Here

      this.metadata = pageItem.getMetadata();
      if (metadata != null) metadata.setTitle(title);
      this.cp = cp;
      String filePath = cpMgm.getPageByItemId(cp, identifier);
      if (filePath != null && filePath != "") {
        LocalFileImpl f = (LocalFileImpl) cp.getRootDir().resolve(filePath);
        this.pageFile = f;
      }
    } else if(ele instanceof CPOrganization){
      CPOrganization orga = (CPOrganization)ele;
      this.cpRoot = true;
View Full Code Here

    //  pro intermediatecommit: not much
    //  pro increased transaction timeout: would fix OLAT-5368 but only move the problem
    //@TODO OLAT-2597: real solution is a long-running background-task concept...
    DBFactory.getInstance().intermediateCommit();

    ZipUtil.zip(sharedFolder.getItems(), new LocalFileImpl(fExportZIP));
    return new CleanupAfterDeliveryFileMediaResource(fExportZIP);
  }
View Full Code Here

  public String archive(String archivFilePath, RepositoryEntry repoEntry) {
    String exportFileName = "del_sharedfolder_" + repoEntry.getOlatResource().getResourceableId() + ".zip";
    String fullFilePath = archivFilePath + File.separator + exportFileName;
    File fExportZIP = new File(fullFilePath);
    VFSContainer sharedFolder = SharedFolderManager.getInstance().getSharedFolder(repoEntry.getOlatResource());
    ZipUtil.zip(sharedFolder.getItems(), new LocalFileImpl(fExportZIP));
    return fullFilePath;
  }
View Full Code Here

  public MediaResource getAsMediaResource(OLATResourceable res) {
    RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntry(res, false);
    String exportFileName = repoEntry.getDisplayname() + ".zip";
    File fExportZIP = new File(FolderConfig.getCanonicalTmpDir() + "/" + exportFileName);
    VFSContainer glossaryRoot = getGlossaryRootFolder(res);
    ZipUtil.zip(glossaryRoot.getItems(), new LocalFileImpl(fExportZIP));
    return new CleanupAfterDeliveryFileMediaResource(fExportZIP);
  }
View Full Code Here

  public String archive(String archivFilePath, RepositoryEntry repoEntry) {
    String exportFileName = "del_glossar_" + repoEntry.getOlatResource().getResourceableId() + ".zip";
    String fullFilePath = archivFilePath + File.separator + exportFileName;
    File fExportZIP = new File(fullFilePath);
    VFSContainer glossaryRoot = getGlossaryRootFolder(repoEntry.getOlatResource());
    ZipUtil.zip(glossaryRoot.getItems(), new LocalFileImpl(fExportZIP));
    return fullFilePath;
  }
View Full Code Here

TOP

Related Classes of org.olat.core.util.vfs.LocalFileImpl

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.