Package org.olat.core.util.vfs

Examples of org.olat.core.util.vfs.VFSContainer.resolve()


  }


  private void saveWikiPageProperties(OLATResourceable ores, WikiPage page) {
    VFSContainer wikiContentContainer = getWikiContainer(ores, WIKI_RESOURCE_FOLDER_NAME);
    VFSLeaf leaf = (VFSLeaf) wikiContentContainer.resolve(page.getPageId() + "." + WIKI_PROPERTIES_SUFFIX);
    if (leaf == null) leaf = wikiContentContainer.createChildLeaf(page.getPageId() + "." + WIKI_PROPERTIES_SUFFIX);
    Properties p = getPageProperties(page);
    try {
      p.store(leaf.getOutputStream(false), "wiki page meta properties");
    } catch (IOException e) {
View Full Code Here


   * @param folderName
   * @return the Vfs container or null if not found
   */
  public VFSContainer getWikiContainer(OLATResourceable ores, String folderName) {
    VFSContainer wikiRootContainer = getWikiRootContainer(ores);
    return (VFSContainer) wikiRootContainer.resolve(folderName);
  }
 
  /**
   * Returns the root-container for certain OLAT-resourceable.
   * @param ores
View Full Code Here

/**
* Return the SCORM Root folder
*/
  public static VFSContainer getScormRootFolder() {
    VFSContainer canonicalRoot = new LocalFolderImpl(new File(FolderConfig.getCanonicalRoot()));
    return (VFSContainer)canonicalRoot.resolve("scorm");
  }
 
  /**
   * Return the container where the LMS save the datas for a user.
   * @param username
View Full Code Here

      Date tmp = new Date(System.currentTimeMillis());
      java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss_SSS");
      forumName += "_"+formatter.format(tmp);
     
      VFSContainer container = new LocalFolderImpl(exportDirectory);
      VFSItem vfsItem = container.resolve(forumName);
     
      if (vfsItem == null || !(vfsItem instanceof VFSContainer)){
        vfsItem = container.createChildContainer(forumName);
      }
      container = (VFSContainer)vfsItem;
View Full Code Here

    if (RegistrationModule.isDisclaimerAdditionaLinkText()) {
      File disclaimerDir = new File(WebappHelper.getUserDataRoot() + "/customizing/disclaimer/");
      disclaimerDir.mkdirs();
      VFSContainer disclaimerContainer = new LocalFolderImpl(disclaimerDir);
      String i18nIfiedFilename = translate("disclaimer.filedownloadurl");
      this.downloadFile = (VFSLeaf)disclaimerContainer.resolve(i18nIfiedFilename);
      if (this.downloadFile != null) {
        this.downloadLink = LinkFactory.createLink("disclaimer.additionallinktext", main, this);
        this.downloadLink.setTarget("_blank");
       
        if (i18nIfiedFilename.toLowerCase().endsWith(".pdf")) {
View Full Code Here

   * @return True if is of type.
   */
  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;
    List metas = doc.selectNodes("questestinterop/assessment/qtimetadata/qtimetadatafield");
View Full Code Here


  private void createMediaMetadataFile(String filename, Long author) {
    VFSContainer mediaFolder = WikiManager.getInstance().getMediaFolder(ores);
    //only create metadatafile if base file exists
    if ((VFSLeaf)mediaFolder.resolve(filename) != null) {
      //metafile may exists when files get overwritten
      VFSLeaf metaFile = (VFSLeaf)mediaFolder.resolve(filename+METADATA_SUFFIX);
      if (metaFile == null) {
          // metafile does not exist => create one
        metaFile = mediaFolder.createChildLeaf(filename+METADATA_SUFFIX);
View Full Code Here

  private void createMediaMetadataFile(String filename, Long author) {
    VFSContainer mediaFolder = WikiManager.getInstance().getMediaFolder(ores);
    //only create metadatafile if base file exists
    if ((VFSLeaf)mediaFolder.resolve(filename) != null) {
      //metafile may exists when files get overwritten
      VFSLeaf metaFile = (VFSLeaf)mediaFolder.resolve(filename+METADATA_SUFFIX);
      if (metaFile == null) {
          // metafile does not exist => create one
        metaFile = mediaFolder.createChildLeaf(filename+METADATA_SUFFIX);
      }
      Properties p = new Properties();
View Full Code Here

    for (Iterator iter = toDelete.iterator(); iter.hasNext();) {
      VFSContainer mediaFolder = WikiManager.getInstance().getMediaFolder(ores);
      MediaFileElement element = (MediaFileElement) iter.next();
      if(log.isDebug()) log.debug("deleting media file: "+element.getFilename());
      if(!element.getFilename().endsWith(METADATA_SUFFIX)) {
        VFSLeaf file = (VFSLeaf)mediaFolder.resolve(element.getFilename());
        if (file != null) {
          file.delete();
          VFSLeaf metadata = (VFSLeaf)mediaFolder.resolve(element.getFilename()+METADATA_SUFFIX);
          if(metadata != null) {
            Properties p = new Properties();
View Full Code Here

      if(log.isDebug()) log.debug("deleting media file: "+element.getFilename());
      if(!element.getFilename().endsWith(METADATA_SUFFIX)) {
        VFSLeaf file = (VFSLeaf)mediaFolder.resolve(element.getFilename());
        if (file != null) {
          file.delete();
          VFSLeaf metadata = (VFSLeaf)mediaFolder.resolve(element.getFilename()+METADATA_SUFFIX);
          if(metadata != null) {
            Properties p = new Properties();
            try {
              p.load(metadata.getInputStream());
              p.setProperty(MEDIA_FILE_DELETIONDATE, String.valueOf(System.currentTimeMillis()));
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.