Package org.olat.core.util.vfs

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


       
        relPath = targetDir.substring(personalFolderDir.length()).replace("\\", "/");
        targetDir = targetDir.substring(0, personalFolderDir.length());
      }
     
      VFSContainer targetFolder = new LocalFolderImpl(new File(targetDir));
      FolderRunController bcrun = new FolderRunController(targetFolder, true, ureq, getWindowControl());
      Component folderComponent = bcrun.getInitialComponent();
      if (relPath.length()!=0) {
        if (!relPath.endsWith("/")) {
          relPath = relPath + "/";
View Full Code Here


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

   * @param ident
   * @return
   */
  public List<Identity> getIdentitiesWithQtiSerEntry(Long resourceableId, String ident) {   
    List<Identity> identities = new ArrayList<Identity>();
    LocalFolderImpl item = new LocalFolderImpl(new File(FilePersister.getFullPathToCourseNodeDirectory(Long.toString(resourceableId), ident)));
    if (VFSManager.exists(item)) {
      Manager secMgr = ManagerFactory.getManager();
      for (VFSItem identityFolder : item.getItems()) {
        Identity identity = secMgr.findIdentityByName(identityFolder.getName());
        if (identity != null) identities.add(identity);
      }
    }
   
View Full Code Here

   * @param ident
   * @return
   */
  public VFSStatus removeQtiSerFiles(Long resourceableId, String ident) {
    if (resourceableId == null || ident == null || ident.length() == 0) return VFSConstants.NO;
    LocalFolderImpl item = new LocalFolderImpl(new File(FilePersister.getFullPathToCourseNodeDirectory(Long.toString(resourceableId), ident)));
    if(item.canDelete().equals(VFSConstants.YES)) return item.delete();
    return VFSConstants.NO;
  }
View Full Code Here

    File cpRoot = FileResourceManager.getInstance().unzipFileResource(repositoryEntry.getOlatResource());
    if (cpRoot == null) throw new AssertException("file of repository entry " + repositoryEntry.getKey() + "was missing");

    resourceContext.setParentContextType(TYPE);
    resourceContext.setParentContextName(repositoryEntry.getDisplayname());
    VFSContainer rootContainer = new LocalFolderImpl(cpRoot);
    doIndexVFSContainer(resourceContext,rootContainer,indexWriter,"", FolderIndexerAccess.FULL_ACCESS);

  }
View Full Code Here

    foldersButton = LinkFactory.createButton("folders", main, this);
    uploadButton = LinkFactory.createButton("upload", main, this);
    cancelButton = LinkFactory.createButton("cancel", main, this);
    // tmp upload container
    uploadDir = new File(FolderConfig.getCanonicalTmpDir() + "/" + CodeHelper.getGlobalForeverUniqueID());
    uploadContainer = new LocalFolderImpl(uploadDir);
   
    folderNames = new ArrayList<String>(3);
    containerRefs = new ArrayList<VFSContainer>(3);
    //folderNames.add("groupFolder1");
    //containerRefs.add(new Path("/groups/gr1"));
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()));
    LocalFolderImpl exportDir =  new OlatRootFolderImpl(FolderConfig.getUserHomes() +"/"+ ident.getName() +"/private/archive/wiki-export-"+dateStamp+".zip", null);
   
    //create the ims manifest
    StringBuilder sb = createIMSManifest(wiki, ident);
    VFSLeaf manifest = tempFolder.createChildLeaf("imsmanifest.xml");
    copyMediaFiles(WikiManager.getInstance().getMediaFolder(ores), tempFolder);
    FileUtils.save(manifest.getOutputStream(false), sb.toString(), "utf-8");
   
    //create the javascript mapping file
    StringBuilder jsContent = createJsMappingContent(wiki);
    VFSLeaf jsFile = tempFolder.createChildLeaf("mapping.js");
    FileUtils.save(jsFile.getOutputStream(false), jsContent.toString(), "utf-8");
   
    renderWikiToHtmlFiles(ores, tempFolder);
    CPOfflineReadableManager.getInstance().makeCPOfflineReadable(tempFolder.getBasefile(), exportDir.getBasefile(), null);
    tempFolder.delete();
  }
View Full Code Here

      if (whenTheFeedWasLastModified != null && entry.getLastModified().before(whenTheFeedWasLastModified)) {
        // feed is newer than repository entry, update repository entry
        entry.setDisplayname(feed.getTitle());
        entry.setDescription(feed.getDescription());
        // Update the image
        VFSContainer repoHome = new LocalFolderImpl(new File(FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome()));
        String imageFilename = RepositoryEntryImageController.getImageFilename(entry);
        VFSItem oldEntryImage = repoHome.resolve(imageFilename);
        if (oldEntryImage != null) {
          // Delete the old File
          oldEntryImage.delete();
        }
        // Copy the feed image to the repository home folder unless it was
        // deleted.
        String feedImage = feed.getImageName();
        if (feedImage != null) {
          VFSItem newImage = getFeedMediaContainer(feed).resolve(feedImage);
          repoHome.copyFrom(newImage);
          VFSItem newEntryImage = repoHome.resolve(feed.getImageName());
          newEntryImage.rename(imageFilename);
        }
      }
    }
  }
View Full Code Here

    RepositoryEntry re = CPEditController.getCPReference(courseNode.getModuleConfiguration(), true);
    if (re == null) throw new AssertException("configurationkey 'CONFIG_KEY_REPOSITORY_SOFTKEY' of BB CP was missing");
    File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
    if (cpRoot == null) throw new AssertException("file of repository entry " + re.getKey() + "was missing");

    VFSContainer rootContainer = new LocalFolderImpl(cpRoot);
    doIndexVFSContainer(courseNodeResourceContext,rootContainer,indexWriter,"", FolderIndexerAccess.FULL_ACCESS);
   
    // go further, index my child nodes
    courseNodeIndexer.doIndexCourse(repositoryResourceContext, course, courseNode, indexWriter);
  }
View Full Code Here

      } else {
        File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
        Boolean showMenuB = config.getBooleanEntry(NodeEditController.CONFIG_COMPONENT_MENU);
        // pre: showMenuB != null
        if (previewCtr != null) previewCtr.dispose();
        previewCtr = CPUIFactory.getInstance().createMainLayoutPreviewController(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), showMenuB.booleanValue());
        previewCtr.activate();
      }
    } else if (source == cpMenuForm) {
      if (event == Form.EVNT_VALIDATION_OK) {
        config.setBooleanEntry(NodeEditController.CONFIG_COMPONENT_MENU, cpMenuForm.cpMenu.isChecked());
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.