Package org.olat.core.util.vfs

Examples of org.olat.core.util.vfs.LocalFolderImpl.resolve()


    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


    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

      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));
View Full Code Here

  }
   
  protected void doIndex(SearchResourceContext resourceContext, OlatFullIndexer indexWriter, File cpRoot)
  throws IOException,InterruptedException  {
    VFSContainer container = new LocalFolderImpl(cpRoot);
    VFSLeaf fManifest = (VFSLeaf)container.resolve("imsmanifest.xml");
    if(fManifest != null) {
      Element rootElement =  IMSLoader.loadIMSDocument(fManifest).getRootElement();
      Document manfiestDoc = createManifestDocument(fManifest, rootElement, resourceContext);
      indexWriter.addDocument(manfiestDoc);
     
View Full Code Here

/**
* Return the SCORM Root folder
*/
  public static VFSContainer getScormRootFolder() {
    VFSContainer canonicalRoot = new LocalFolderImpl(new File(FolderConfig.getCanonicalRoot()));
    return (VFSContainer)canonicalRoot.resolve("scorm");
  }
 
  /**
   * Return the container where the LMS save the datas for a user.
   * @param username
View Full Code Here

      Date tmp = new Date(System.currentTimeMillis());
      java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss_SSS");
      forumName += "_"+formatter.format(tmp);
     
      VFSContainer container = new LocalFolderImpl(exportDirectory);
      VFSItem vfsItem = container.resolve(forumName);
     
      if (vfsItem == null || !(vfsItem instanceof VFSContainer)){
        vfsItem = container.createChildContainer(forumName);
      }
      container = (VFSContainer)vfsItem;
View Full Code Here

  /**
   * @see org.olat.course.nodes.GenericCourseNode#archiveNodeData(java.util.Locale, org.olat.course.ICourse, java.io.File, java.lang.String)
   */
  public void archiveNodeData(Locale locale, ICourse course, File exportDirectory, String charset) {
    VFSContainer exportContainer = new LocalFolderImpl(exportDirectory);
    VFSContainer wikiExportContainer = (VFSContainer)exportContainer.resolve(WikiManager.WIKI_RESOURCE_FOLDER_NAME);
    if(wikiExportContainer == null){
      wikiExportContainer = exportContainer.createChildContainer(WikiManager.WIKI_RESOURCE_FOLDER_NAME);
    }
    String exportDirName = getShortTitle()+"_"+Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
    VFSContainer destination = wikiExportContainer.createChildContainer(exportDirName);
View Full Code Here

    if (RegistrationModule.isDisclaimerAdditionaLinkText()) {
      File disclaimerDir = new File(WebappHelper.getUserDataRoot() + "/customizing/disclaimer/");
      disclaimerDir.mkdirs();
      VFSContainer disclaimerContainer = new LocalFolderImpl(disclaimerDir);
      String i18nIfiedFilename = translate("disclaimer.filedownloadurl");
      this.downloadFile = (VFSLeaf)disclaimerContainer.resolve(i18nIfiedFilename);
      if (this.downloadFile != null) {
        this.downloadLink = LinkFactory.createLink("disclaimer.additionallinktext", main, this);
        this.downloadLink.setTarget("_blank");
       
        if (i18nIfiedFilename.toLowerCase().endsWith(".pdf")) {
View Full Code Here

   * @return True if is of type.
   */
  public static boolean validate(File unzippedDir) {
    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(unzippedDir);
    VFSItem vfsQTI = vfsUnzippedRoot.resolve("qti.xml");
    //getDocument(..) ensures that InputStream is closed in every case.
    Document doc = QTIHelper.getDocument((LocalFileImpl) vfsQTI);
    //if doc is null an error loading the document occured
    if (doc == null) return false;
    List metas = doc.selectNodes("questestinterop/assessment/qtimetadata/qtimetadatafield");
View Full Code Here

   *
   *
   */
  public void archiveWikiToCP() {
    LocalFolderImpl tempFolder =  new OlatRootFolderImpl("/tmp/"+ident.getKey()+"-"+ores.getResourceableId(), null);
    if (tempFolder.resolve("imsmanifest.xml") != null) {
      tempFolder.delete(); //delete all content if already exists...
      tempFolder =  new OlatRootFolderImpl("/tmp/"+ident.getKey()+"-"+ores.getResourceableId(), null);
    }
    Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
    String dateStamp = Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
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.