Package org.olat.core.util.vfs

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


  /**
   * @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);
    String repoRef = (String) getModuleConfiguration().get(CONFIG_KEY_REPOSITORY_SOFTKEY);
    if (repoRef != null) {
View Full Code Here


  public File getMediaBaseDir() {
    return new File(packageDir, "/media");
  }
 
  public VFSContainer getBaseDir() {
    NamedContainerImpl namedBaseDir = new NamedContainerImpl(translator.translate("qti.basedir.displayname"), new LocalFolderImpl(packageDir));
    return namedBaseDir;
  }
View Full Code Here

  /**
   * Remove the media files specified in the input set (removable contains filenames)
   * @param removable
   */
  public void removeMediaFiles(Set<String> removable) {
    LocalFolderImpl mediaFolder = new LocalFolderImpl(new File(packageDir,"media"));
    List<VFSItem> allMedia = mediaFolder.getItems();   
    QTIEditHelper.removeUnusedMedia(removable, allMedia);
  }
View Full Code Here

    super(ureq, wControl);

    vcMain = this.createVelocityContainer("guidemo-textmarker");

    File demoFile = new File(WebappHelper.getSourcePath() + "/org/olat/test/_static");
    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

    // Main view is a velocity container
    contentVC = createVelocityContainer("guidemo-filechooser");

    // Create File chooser for the web app root directory
    File webappRootFile = new File(WebappHelper.getContextRoot());
    VFSContainer webappRoot = new LocalFolderImpl(webappRootFile)
    // don't show cvs and hidden files meta files
    VFSItemFilter filter = new VFSItemExcludePrefixFilter(new String[]{"CVS","cvs", "."});
    // create file chooser with the filter and the web app root
    chooserCtr = FileChooserUIFactory.createFileChooserController(ureq, getWindowControl(), webappRoot, filter, false);
    listenTo(chooserCtr);   
View Full Code Here

    // appropriate location right away (and not on the next read). So, I put the
    // code here. Note that this constructor is also called on copying a
    // 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()) {
        rootContainer.copyFrom(item);
        // Delete the item if it is located in the _unzipped_ dir.
        // Remember that the resource folder could be a valid folder of a
        // different resource (when copying the resource).
        if (resourceContainer.getName().equals(FileResourceManager.ZIPDIR)) {
          item.delete();
        }
      }
    }
  }
View Full Code Here

      // ______item.xml
      // ______/media.xml
      // ________...
      // ____/item
      // ______...
      VFSContainer root = new LocalFolderImpl(directory);
      // try to read podcast
      try {
        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

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

   */
  public ContentPackage createNewCP(OLATResourceable ores, String initalPageTitle) {
    // copy template cp to new repo-location
    if (copyTemplCP(ores)) {
      File cpRoot = FileResourceManager.getInstance().unzipFileResource(ores);
      LocalFolderImpl vfsWrapper = new LocalFolderImpl(cpRoot);
      ContentPackage cp = load(vfsWrapper, ores);

      // Modify the copy of the template to get a unique identifier
      CPOrganization orga = setUniqueOrgaIdentifier(cp);
      setOrgaTitleToRepoEntryTitle(ores, orga);
View Full Code Here

  private void archiveForum(OLATResourceable ores, String archivFilePath) {
    ForumManager fom = ForumManager.getInstance();
    Property forumKeyProperty = NarrowedPropertyManager.getInstance(ores).findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
    if (forumKeyProperty != null) {
      VFSContainer archiveContainer = new LocalFolderImpl(new File(archivFilePath));
      String archiveForumName = "del_forum_" + forumKeyProperty.getLongValue();
      VFSContainer archiveForumContainer = archiveContainer.createChildContainer(archiveForumName);
      ForumFormatter ff = new ForumRTFFormatter(archiveForumContainer, false);
      ForumArchiveManager.getInstance().applyFormatter(ff, forumKeyProperty.getLongValue(), null);
    }
  }
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.