Package org.olat.core.util.vfs

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


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


        // 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

  public void updateModuleConfigFromQTIFile(OLATResource res) {
    FileResourceManager frm = FileResourceManager.getInstance();
    File unzippedRoot = frm.unzipFileResource(res);
    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(unzippedRoot);
    VFSItem vfsQTI = vfsUnzippedRoot.resolve("qti.xml");
    if (vfsQTI==null){
      throw new AssertException("qti file did not exist even it should be guaranteed by repositor check-in "
          + ((LocalFileImpl)vfsQTI).getBasefile().getAbsolutePath());
    }
    //ensures that InputStream is closed in every case.
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, String type) {
    VFSContainer exportContainer = new LocalFolderImpl(exportDirectory);
    VFSContainer exportDir = (VFSContainer) exportContainer.resolve(type);
    if (exportDir == null) {
      exportDir = exportContainer.createChildContainer(type);
    }
    String exportDirName = getShortTitle() + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
    VFSContainer destination = exportDir.createChildContainer(exportDirName);
View Full Code Here

    LocalFolderImpl locFolder = new LocalFolderImpl(demoFile);
    // FIXME:RH:Gloss Will not work, as glossaryID later on is built from
    // repository-path-id. Gloss could work with other folders, but termMapper
    // and definitionMapper are failing, because they use the glossaryID
    // Workaround: disable this GuiDemo
    VFSContainer demoGlossFolder = (VFSContainer) locFolder.resolve(GlossaryManager.INTERNAL_FOLDER_NAME);
    String glossaryId = "guiDemoTestGlossary";
    glossCtr = new GlossaryMarkupItemController(ureq, getWindowControl(), vcMain, demoGlossFolder, glossaryId);
    glossCtr.setTextMarkingEnabled(false);
    showInfo("GuiDemoTextMarkerController.notWorking");
    this.putInitialPanel(glossCtr.getInitialComponent());
View Full Code Here

    // resource. We know that the resource folder is valid.

    // Let's now copy the resource folder to the root folder.
    VFSContainer rootContainer = new LocalFolderImpl(root);
    String folderName = FeedManager.getInstance().getFeedKind(this);
    if (rootContainer.resolve(folderName) == null) {
      // If the podcast directory doesn't exist yet, create it and copy content
      // from uploaded folder
      rootContainer = rootContainer.createChildContainer(folderName);
      VFSContainer resourceContainer = new LocalFolderImpl(resourceFolder);
      for (VFSItem item : resourceContainer.getItems()) {
View Full Code Here

        Feed feed = FeedManagerImpl.readFeedFile(root);
        if (feed != null) {
          // The feed is valid, let's check the items
          if (feed.isInternal()) {
            List<String> itemIds = feed.getItemIds();
            VFSContainer itemsContainer = (VFSContainer) root.resolve(FeedManagerImpl.ITEMS_DIR);
            if (itemsContainer == null) {
              valid = itemIds.isEmpty(); //empty podcast
            } else {
              int validItemsCount = 0;
              for (String itemId : itemIds) {
View Full Code Here

   */
  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;
    // check if this is marked as test
View Full Code Here

    File unzippedRoot = frm.unzipFileResource(res);
   

    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(unzippedRoot);
    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 (IOException, qti.xml does not exist)
    if (doc == null) return;
   
View Full Code Here

   * @see org.olat.ims.qti.process.Resolver#getObjectBank(java.lang.String)
   */
  public Element getObjectBank(String ident) { 
    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(fUnzippedDirRoot);
    VFSItem vfsQTI = vfsUnzippedRoot.resolve(ident + ".xml");
    //getDocument(..) ensures that InputStream is closed in every case.
    Document theDoc = QTIHelper.getDocument((LocalFileImpl) vfsQTI);
    //if doc is null an error loading the document occured (IOException, qti.xml does not exist)
    if (theDoc == null) return null;
    Element objectBank = (Element) theDoc.selectSingleNode("questestinterop/objectbank");
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.