use of org.olat.core.util.vfs.LocalFileImpl in project openolat by klemens.
the class PdfExternalExtractor method extract.
@Override
public void extract(VFSLeaf document, File bufferFile) throws IOException, DocumentAccessException {
if (!(document instanceof LocalFileImpl)) {
log.warn("Can only index local file");
return;
}
List<String> cmds = new ArrayList<String>();
cmds.add(searchModule.getPdfExternalIndexerCmd());
cmds.add(((LocalFileImpl) document).getBasefile().getAbsolutePath());
cmds.add(bufferFile.getAbsolutePath());
CountDownLatch doneSignal = new CountDownLatch(1);
ProcessWorker worker = new ProcessWorker(cmds, doneSignal);
worker.start();
try {
doneSignal.await(3000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
log.error("", e);
}
worker.destroyProcess();
}
use of org.olat.core.util.vfs.LocalFileImpl in project openolat by klemens.
the class ScormAssessmentManager method getSequencerModel.
/**
* Load the SequencerModel
* @param username
* @param courseEnv
* @param node
* @return can be null if the user hasn't visited the course
*/
public SequencerModel getSequencerModel(String username, CourseEnvironment courseEnv, ScormCourseNode node) {
VFSContainer scoDirectory = ScormDirectoryHelper.getScoDirectory(username, courseEnv, node);
if (scoDirectory == null)
return null;
VFSItem reloadSettingsFile = scoDirectory.resolve(RELOAD_SETTINGS_FILE);
if (reloadSettingsFile instanceof LocalFileImpl) {
LocalFileImpl fileImpl = (LocalFileImpl) reloadSettingsFile;
return new SequencerModel(fileImpl.getBasefile(), null);
} else if (reloadSettingsFile != null) {
throw new OLATRuntimeException(this.getClass(), "Programming error, SCORM results must be file based", null);
}
return null;
}
use of org.olat.core.util.vfs.LocalFileImpl in project openolat by klemens.
the class ScormExportManager method collectData.
private void collectData(String username, VFSContainer scoFolder, ScormExportVisitor visitor) {
List<VFSItem> contents = scoFolder.getItems(new XMLFilter());
for (VFSItem file : contents) {
ScoDocument document = new ScoDocument(null);
try {
if (file instanceof LocalFileImpl) {
document.loadDocument(((LocalFileImpl) file).getBasefile());
} else {
logger.warn("Cannot use this type of VSFItem to load a SCO Datamodel: " + file.getClass().getName(), null);
continue;
}
String[][] scoModel = document.getScoModel();
ScoDatas parsedDatas = parseScoModel(file.getName(), username, scoModel);
visitor.visit(parsedDatas);
} catch (Exception e) {
logger.error("Cannot load a SCO Datamodel", e);
}
}
}
use of org.olat.core.util.vfs.LocalFileImpl in project openolat by klemens.
the class VideoManagerImpl method hasVideoFile.
@Override
public boolean hasVideoFile(OLATResource videoResource) {
VFSContainer masterContainer = getMasterContainer(videoResource);
LocalFileImpl videoFile = (LocalFileImpl) masterContainer.resolve(FILENAME_VIDEO_MP4);
return videoFile != null && videoFile.exists();
}
use of org.olat.core.util.vfs.LocalFileImpl in project openolat by klemens.
the class VideoManagerImpl method getVideoFile.
/**
* get the File of the videoresource
*/
@Override
public File getVideoFile(OLATResource videoResource) {
VFSContainer masterContainer = getMasterContainer(videoResource);
LocalFileImpl videoFile = (LocalFileImpl) masterContainer.resolve(FILENAME_VIDEO_MP4);
return videoFile.getBasefile();
}
Aggregations