Package org.olat.core.util.vfs

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


   * @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


   */
  public static boolean zip(Set<String> files, File root, File target) {
    //  Create a buffer for reading the files
    if (target.exists()) return false;
    List<VFSItem> vfsFiles = new ArrayList<VFSItem>();
    LocalFolderImpl vfsRoot = new LocalFolderImpl(root);
    for (Iterator<String> iter = files.iterator(); iter.hasNext();) {
      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

    File fParentVersion = fVersion.getParentFile();
    if (!fParentVersion.exists()) return; //already deleted

    VFSLeaf versionLeaf = null;
    if (fVersion.exists()) {
      LocalFolderImpl localVersionContainer = new LocalFolderImpl(fParentVersion);
      versionLeaf = (VFSLeaf) localVersionContainer.resolve(fVersion.getName());
    }
   
    if (versionLeaf == null) return; //already deleted
    Versions versions = readVersions(leaf, versionLeaf);
    for (VFSRevision versionToDelete : versions.getRevisions()) {
View Full Code Here

    if (!fParentVersion.exists() && create) {
      fParentVersion.mkdirs();
    }

    if (fVersion.exists()) {
      LocalFolderImpl localVersionContainer = new LocalFolderImpl(fParentVersion);
      return (VFSLeaf) localVersionContainer.resolve(fVersion.getName());
    } else if (create) {
      LocalFolderImpl localVersionContainer = new LocalFolderImpl(fParentVersion);
      VersionsFileImpl versions = new VersionsFileImpl();
      versions.setVersioned(isVersioned(item));
      versions.setRevisionNr(getNextRevisionNr(versions));
      VFSLeaf fVersions = localVersionContainer.createChildLeaf(fVersion.getName());
      XStreamHelper.writeObject(mystream, fVersions, versions);
      return fVersions;
    }
    return null;
  }
View Full Code Here

  }

  private VFSContainer getCanonicalVersionFolder(VFSContainer container, boolean create) {
    String relPath = getRelPath(container);
    File fVersion = new File(getRootVersionsFile(), relPath);
    if (fVersion.exists()) { return new LocalFolderImpl(fVersion); }
    if (create) {
      fVersion.mkdirs();
      return new LocalFolderImpl(fVersion);
    }
    return null;
  }
View Full Code Here

    if (rootVersionsContainer == null) {
      rootVersionFolder = new File(FolderConfig.getCanonicalVersionRoot());
      if(!rootVersionFolder.exists()) {
        rootVersionFolder.mkdirs();
      }
      rootVersionsContainer = new LocalFolderImpl(rootVersionFolder);
    }
    return rootVersionFolder;
  }
View Full Code Here

    if (rootVersionsContainer == null) {
      rootVersionFolder = new File(FolderConfig.getCanonicalVersionRoot());
      if(!rootVersionFolder.exists()) {
        rootVersionFolder.mkdirs();
      }
      rootVersionsContainer = new LocalFolderImpl(rootVersionFolder);
    }
    return rootVersionsContainer;
  }
View Full Code Here

      container = ((MergeSource)container).getRootWriteContainer();
    }
   
    if (container instanceof LocalFolderImpl) {
      try {
        LocalFolderImpl folderImpl = (LocalFolderImpl)container;
        String path = folderImpl.getBasefile().getCanonicalPath();
        String root = getCourseRoot();
        if (path.startsWith(root)) {
          for(String exclusion:EXCLUSIONS_IN_COURSE_PATH) {
            if(path.indexOf(exclusion) > 0) {
              return false;
View Full Code Here

   * @param ureq
   * @param wControl
   * @param fileRoot File that points to the root directory of the resource
   */
  public IFrameDisplayController(UserRequest ureq, WindowControl wControl, File fileRoot) {
    this(ureq, wControl, new LocalFolderImpl(fileRoot), null);
  }
View Full Code Here

   * @param wControl
   * @param fileRoot
   * @param ores - send an OLATresourcable of the context (e.g. course) where the iframe runs and it will be checked if the user has textmarking (glossar) enabled in this course
   */
  public IFrameDisplayController(UserRequest ureq, WindowControl wControl, File fileRoot, OLATResourceable ores) {
    this(ureq, wControl, new LocalFolderImpl(fileRoot), null, ores);
  }
View Full Code Here

TOP

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

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.