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();
}
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;
}
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);
}
}
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;
}
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;
}
Aggregations