Examples of VFSLeaf


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

    } else if (create) {
      LocalFolderImpl localVersionContainer = new LocalFolderImpl(fParentVersion);
      VersionsFileImpl versions = new VersionsFileImpl();
      versions.setVersioned(isVersioned(item));
      versions.setRevisionNr(getNextRevisionNr(versions));
      VFSLeaf fVersions = localVersionContainer.createChildLeaf(fVersion.getName());
      XStreamHelper.writeObject(mystream, fVersions, versions);
      return fVersions;
    }
    return null;
  }
View Full Code Here

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

     *
     * @return InputStream
     */
    public InputStream streamContent() throws IOException {
      if (!(vfsItem instanceof VFSLeaf)) throw new IOException("Can't get stream for VFSItem.");
      VFSLeaf vfsLeaf = (VFSLeaf)vfsItem;
      return vfsLeaf.getInputStream();
    }
View Full Code Here

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

     */
    public long getContentLength() {
      if (contentLength != -1L) return contentLength;
      if (isCollection()) contentLength = 0;
      else {
        VFSLeaf leaf = (VFSLeaf)vfsItem;
        contentLength = leaf.getSize();
      }
      return contentLength;
    }
View Full Code Here

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

   *
   * @param olatResource
   * @param glossItemList
   */
  protected void saveGlossaryItemList(VFSContainer glossaryFolder, ArrayList<GlossaryItem> glossItemList) {
    VFSLeaf glossaryFile = getGlossaryFile(glossaryFolder);
    saveToFile(glossaryFile, glossItemList);
    glossItemList = removeEmptyGlossaryItems(glossItemList);
    updateCacheForGlossary(glossaryFolder, glossItemList);
  }
View Full Code Here

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

          glossItem.setGlossSynonyms(glossSynonyms);
        }
        glossaryItemArr.add(glossItem);
      }

      VFSLeaf glossaryFile = folderContainingGlossary.createChildLeaf(GLOSSARY_FILENAME);
      saveToFile(glossaryFile, glossaryItemArr);
      // keep a backup in debug mode:
      if (Settings.isDebuging()) {
        File tmFile = ((LocalFileImpl) textMarkerFile).getBasefile();
        File tmCont = ((LocalFolderImpl) folderContainingGlossary).getBasefile();
View Full Code Here

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

   *
   * @param folderContainingGlossary physical disk-path
   * @return the glossary file
   */
  public VFSLeaf getGlossaryFile(VFSContainer folderContainingGlossary) {
    VFSLeaf glossaryFile = (VFSLeaf) folderContainingGlossary.resolve(OLD_GLOSSARY_FILENAME);
    if (glossaryFile != null) {
      // old glossary
      upgradeAndDeleteOldGlossary(folderContainingGlossary, glossaryFile);
    }
    // look for new glossary, or use new after upgrading
View Full Code Here

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

  public Long getGlossaryLastModifiedTime(VFSContainer folderContainingGlossary) {
    return getGlossaryFile(folderContainingGlossary).getLastModified();
  }

  public boolean isFolderContainingGlossary(VFSContainer folderContainingGlossary) {
    VFSLeaf glossaryFileOld = (VFSLeaf) folderContainingGlossary.resolve(OLD_GLOSSARY_FILENAME);
    VFSLeaf glossaryFileNew = (VFSLeaf) folderContainingGlossary.resolve(GLOSSARY_FILENAME);
    if (glossaryFileNew == null && glossaryFileOld == null) return false;
    else return true;
  }
View Full Code Here

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

//      Configuration of a glossary in properties file
  //TODO: RH: improvement in case fileReads should slow down system
  // implement a GlossaryObject with settings and glossItemList and cache this.
  public Properties getGlossaryConfig(VFSContainer glossaryFolder){
    Properties props = new Properties();
    VFSLeaf glossProp = (VFSLeaf) glossaryFolder.resolve(GLOSSARY_CONFIG_PROPERTIES_FILE);
    if(glossProp!=null){
      try {
        props.load(glossProp.getInputStream());
      } catch (IOException e) {
        logError("Properties in " + glossProp + " could not be read.", e);
      }
    } else {
      //set default config
View Full Code Here

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

    return props;
  }
 
 
  public void setGlossaryConfig(VFSContainer glossaryFolder, Properties props){
    VFSLeaf glossProp = (VFSLeaf) glossaryFolder.resolve(GLOSSARY_CONFIG_PROPERTIES_FILE);
    if (glossProp==null){
      glossProp = glossaryFolder.createChildLeaf(GLOSSARY_CONFIG_PROPERTIES_FILE);
    }
    try {
      props.store(glossProp.getOutputStream(false), "Settings for the glossary saved in this folder.");
    } catch (IOException e) {
      logError("Properties in " + glossProp + " could not be written.", e);
    }
   
  }
View Full Code Here

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

        // and can not reuse the standard briefcase way of file delivering, some
        // very old fancy code
        // Mapper is cleaned up automatically by basic controller
        String baseUrl = registerMapper(new Mapper() {
          public MediaResource handle(String relPath, HttpServletRequest request) {
            VFSLeaf vfsfile = (VFSLeaf) folderComponent.getRootContainer().resolve(relPath);
            if (vfsfile == null) {
              return new NotFoundMediaResource(relPath);
            } else {
              return new VFSMediaResource(vfsfile);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.