Search in sources :

Example 61 with LocalFolderImpl

use of org.olat.core.util.vfs.LocalFolderImpl in project openolat by klemens.

the class TestFileResource method validate.

/**
 * @param unzippedDir
 * @return True if is of type.
 */
public static boolean validate(File unzippedDir) {
    // 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);
    return validateQti(doc, new ResourceEvaluation(false)).isValid();
}
Also used : ResourceEvaluation(org.olat.fileresource.types.ResourceEvaluation) VFSContainer(org.olat.core.util.vfs.VFSContainer) VFSItem(org.olat.core.util.vfs.VFSItem) Document(org.dom4j.Document) QTIDocument(org.olat.ims.qti.editor.beecom.objects.QTIDocument) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 62 with LocalFolderImpl

use of org.olat.core.util.vfs.LocalFolderImpl in project openolat by klemens.

the class MailModule method getRootForAttachments.

public VFSContainer getRootForAttachments() {
    String root = folderModule.getCanonicalRoot() + attachmentsRoot;
    File rootFile = new File(root);
    if (!rootFile.exists()) {
        rootFile.mkdirs();
    }
    VFSContainer rootContainer = new LocalFolderImpl(rootFile);
    return rootContainer;
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) File(java.io.File) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 63 with LocalFolderImpl

use of org.olat.core.util.vfs.LocalFolderImpl in project openolat by klemens.

the class CollaborationTools method archiveForum.

private void archiveForum(String archivFilePath) {
    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, I18nModule.getDefaultLocale());
        ForumArchiveManager.getInstance().applyFormatter(ff, forumKeyProperty.getLongValue(), null);
    }
}
Also used : ForumFormatter(org.olat.modules.fo.archiver.formatters.ForumFormatter) ForumRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumRTFFormatter) VFSContainer(org.olat.core.util.vfs.VFSContainer) Property(org.olat.properties.Property) File(java.io.File) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 64 with LocalFolderImpl

use of org.olat.core.util.vfs.LocalFolderImpl in project OpenOLAT by OpenOLAT.

the class VideoManagerImpl method getVideoExportMediaResource.

@Override
public VideoExportMediaResource getVideoExportMediaResource(RepositoryEntry repoEntry) {
    OLATResource videoResource = repoEntry.getOlatResource();
    OlatRootFolderImpl baseContainer = FileResourceManager.getInstance().getFileResourceRootImpl(videoResource);
    // 1) dump repo entry metadata to resource folder
    LocalFolderImpl repoentryContainer = (LocalFolderImpl) VFSManager.resolveOrCreateContainerFromPath(baseContainer, DIRNAME_REPOENTRY);
    RepositoryEntryImportExport importExport = new RepositoryEntryImportExport(repoEntry, repoentryContainer.getBasefile());
    importExport.exportDoExportProperties();
    // 2) package everything in resource folder to streaming zip resource
    VideoExportMediaResource exportResource = new VideoExportMediaResource(baseContainer, repoEntry.getDisplayname());
    return exportResource;
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) RepositoryEntryImportExport(org.olat.repository.RepositoryEntryImportExport) OLATResource(org.olat.resource.OLATResource) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 65 with LocalFolderImpl

use of org.olat.core.util.vfs.LocalFolderImpl in project OpenOLAT by OpenOLAT.

the class VideoManagerImpl method importFromExportArchive.

@Override
public boolean importFromExportArchive(RepositoryEntry repoEntry, VFSLeaf exportArchive) {
    OLATResource videoResource = repoEntry.getOlatResource();
    // 1) unzip archive
    VFSContainer baseContainer = FileResourceManager.getInstance().getFileResourceRootImpl(videoResource);
    ZipUtil.unzip(exportArchive, baseContainer);
    exportArchive.delete();
    // 2) update metadata from the repo entry export
    LocalFolderImpl repoentryContainer = (LocalFolderImpl) baseContainer.resolve(DIRNAME_REPOENTRY);
    if (repoentryContainer != null) {
        RepositoryEntryImportExport importExport = new RepositoryEntryImportExport(repoentryContainer.getBasefile());
        importExport.setRepoEntryPropertiesFromImport(repoEntry);
        // now delete the import folder, not used anymore
        repoentryContainer.delete();
    }
    // 3) Set poster image for repo entry
    VFSContainer masterContainer = getMasterContainer(videoResource);
    VFSLeaf posterImage = (VFSLeaf) masterContainer.resolve(FILENAME_POSTER_JPG);
    if (posterImage != null) {
        repositoryManager.setImage(posterImage, repoEntry);
    }
    return true;
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) RepositoryEntryImportExport(org.olat.repository.RepositoryEntryImportExport) VFSContainer(org.olat.core.util.vfs.VFSContainer) OLATResource(org.olat.resource.OLATResource) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Aggregations

LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)122 File (java.io.File)82 VFSContainer (org.olat.core.util.vfs.VFSContainer)76 VFSItem (org.olat.core.util.vfs.VFSItem)38 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)30 ArrayList (java.util.ArrayList)14 IOException (java.io.IOException)10 Document (org.dom4j.Document)10 RepositoryEntry (org.olat.repository.RepositoryEntry)10 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 DeliveryOptions (org.olat.core.gui.control.generic.iframe.DeliveryOptions)8 OLATResource (org.olat.resource.OLATResource)8 Date (java.util.Date)6 Document (org.apache.lucene.document.Document)6 Element (org.dom4j.Element)6 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)6 LocalFileImpl (org.olat.core.util.vfs.LocalFileImpl)6 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)6 CPPackageConfig (org.olat.ims.cp.ui.CPPackageConfig)6 SearchResourceContext (org.olat.search.service.SearchResourceContext)6