Package org.olat.core.util.vfs

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


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


      if (zipName != null && zipName.endsWith(".zip")) {
        zipFileName = zipName;
      }
    }
    // delete old archive and create new one
    VFSItem oldArchive = oresRoot.resolve(zipFileName);
    if (oldArchive != null) {
      oldArchive.delete();
    }
    ZipUtil.zip(cpRoot.getItems(), oresRoot.createChildLeaf(zipFileName));
    VFSLeaf zip = (VFSLeaf) oresRoot.resolve(zipFileName);
    return zip;
  }
View Full Code Here

  protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == chooserCtr) {
      // catch the events from the file chooser controller here
      if (event instanceof FileChoosenEvent) {
        // User pressed select button, get selected item from controller
        VFSItem selectedItem = FileChooserUIFactory.getSelectedItem((FileChoosenEvent)event);
        // for this demo just get file path and display an info message
        LocalImpl localFile = (LocalImpl) selectedItem;
        String absPath = localFile.getBasefile().getAbsolutePath();
        String relPath = absPath.substring(WebappHelper.getContextRoot().length());
        getWindowControl().setInfo("user selected " + relPath);
View Full Code Here

   * @param allMedia
   */
  public static void removeUnusedMedia(Set<String> deleteableSet, List<VFSItem> allMedia) {
    Iterator<VFSItem> itemIterator = allMedia.iterator();
    while(itemIterator.hasNext()) {
      VFSItem item = itemIterator.next();
      if(deleteableSet.contains(item.getName())) {
        //System.out.println("Delete unused media file: " + item.getName());
        item.delete();
      }
    }
  }
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

   * @see org.olat.ims.qti.process.Resolver#getQTIDocument()
   */
  public Document getQTIDocument() {
    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(fUnzippedDirRoot);
    VFSItem vfsQTI = vfsUnzippedRoot.resolve(QTI_FILE);
    //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)
    return theDoc;
  }
View Full Code Here

  /**
   * @see org.olat.ims.qti.process.Resolver#hasAutocompleteFiles()
   */
  public boolean hasAutocompleteFiles() {
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(fUnzippedDirRoot);
    VFSItem vfsAutocompleteJsItem = vfsUnzippedRoot.resolve(QTI_FIB_AUTOCOMPLETE_JS_FILE);
    if (vfsAutocompleteJsItem != null) {
      VFSItem vfsAutocompleteCssItem = vfsUnzippedRoot.resolve(QTI_FIB_AUTOCOMPLETE_CSS_FILE);
      if (vfsAutocompleteCssItem != null) {
        return true;
      }
    }
    return false;
View Full Code Here

TOP

Related Classes of org.olat.core.util.vfs.VFSItem

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.