Examples of FileResourceManager

Caution:
The txId passed to many methods as an identifier for the transaction concerned will function as a key in a HashMap. Thus assure that equals and hashCode are both properly implemented and match each other. Caution: You will have to guarantee that no other process will access neither the store or the working dir concurrently to this FileResourceManager. Special Caution: Be very careful not to have two instances of FileResourceManager working in the same store and/or working dir. @version $Revision: 1.2 $
  • org.apache.slide.store.txfile.rm.impl.FileResourceManager
    .
  • As there are no active processes inside this RM and it shares its threads with the application, control over transactions is limited to points where the application calls the RM. In particular, this disables active terminmation of transactions upon timeout.
  • There is no notion of a connection to this file manager. This means you can not connect from hosts other than local and you will get problems when plugging this store into a J2EE store using connectors.
  • Methods should throw more specific exceptions Caution:
    The txId passed to many methods as an identifier for the transaction concerned will function as a key in a HashMap. Thus assure that equals and hashCode are both properly implemented and match each other. Caution: You will have to guarantee that no other process will access neither the store or the working dir concurrently to this FileResourceManager. Special Caution: Be very careful not to have two instances of FileResourceManager working in the same store and/or working dir. @author Oliver Zeigermann
  • org.olat.fileresource.FileResourceManager
    Initial Date: Apr 8, 2004 @author Mike Stock

  • Examples of org.apache.slide.store.txfile.rm.impl.FileResourceManager

            if (urlEncodePathString != null) {
                urlEncodePath = "true".equals(urlEncodePathString);
            }
           
            rm =
                new FileResourceManager(
                    storeDir,
                    workDir,
                    urlEncodePath,
                    new StoreLogger(getLogger(), FileResourceManager.class.getName()));
    View Full Code Here

    Examples of org.apache.slide.store.txfile.rm.impl.FileResourceManager

            if (urlEncodePathString != null) {
                urlEncodePath = "true".equals(urlEncodePathString);
            }
           
            rm =
                new FileResourceManager(
                    storeDir,
                    workDir,
                    urlEncodePath,
                    new StoreLogger(getLogger(), FileResourceManager.class.getName()));
    View Full Code Here

    Examples of org.olat.fileresource.FileResourceManager

       * @param res
       * @param ureq
       * @return the copy
       */
      public OLATResourceable createCopy(OLATResourceable res, UserRequest ureq) {
        FileResourceManager frm = FileResourceManager.getInstance();
        OLATResourceable copy = frm.createCopy(res, INTERNAL_FOLDER_NAME);
        return copy;
      }
    View Full Code Here

    Examples of org.olat.fileresource.FileResourceManager

       * @param ores
       * @param zipName
       */
      public void makeCPOfflineReadable(OLATResourceable ores, String zipName) {
        String repositoryHome = FolderConfig.getCanonicalRepositoryHome();
        FileResourceManager fm = FileResourceManager.getInstance();
        String relPath = fm.getUnzippedDirRel(ores);
        String resId = ores.getResourceableId().toString();

        File unzippedDir = new File(repositoryHome + "/" + relPath);
        File targetZip = new File(repositoryHome + "/" + resId + "/" + zipName);
        File cpOfflineMat = new File(WebappHelper.getContextRoot() + "/static/" + CPOFFLINEMENUMAT);
    View Full Code Here

    Examples of org.olat.fileresource.FileResourceManager

      /**
       * @see org.olat.modules.webFeed.managers.FeedManager#copy(org.olat.core.id.OLATResourceable)
       */
      @Override
      public OLATResourceable copy(OLATResourceable feed) {
        FileResourceManager manager = FileResourceManager.getInstance();
        return manager.createCopy(feed, getFeedKind(feed));
      }
    View Full Code Here

    Examples of org.olat.fileresource.FileResourceManager

      /**
       * @see org.olat.repository.handlers.RepositoryHandler#createCopy(org.olat.resource.OLATResourceable,
       *      org.olat.core.gui.UserRequest)
       */
      public OLATResourceable createCopy(OLATResourceable res, UserRequest ureq) {
        FileResourceManager frm = FileResourceManager.getInstance();
        VFSContainer wikiContainer = WikiManager.getInstance().getWikiContainer(res, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
        if(wikiContainer==null) {
          //if the wiki container is null, let the WikiManager to create one
          WikiManager.getInstance().getOrLoadWiki(res);
        }
        OLATResourceable copy = frm.createCopy(res, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
        VFSContainer rootContainer = frm.getFileResourceRootImpl(copy);
        //reset properties files to default values
        VFSContainer wikiCont = (VFSContainer)rootContainer.resolve(WikiManager.WIKI_RESOURCE_FOLDER_NAME);
        List leafs = wikiCont.getItems(new VFSItemSuffixFilter(new String[]{WikiManager.WIKI_PROPERTIES_SUFFIX}));
        for (Iterator iter = leafs.iterator(); iter.hasNext();) {
          VFSLeaf leaf = (VFSLeaf) iter.next();
          WikiPage page = Wiki.assignPropertiesToPage(leaf);
          //reset the copied pages to a the default values
          page.resetCopiedPage();
          WikiManager.getInstance().updateWikiPageProperties(copy, page);
        }
       
        //create folders
        VFSContainer newMediaCont = rootContainer.createChildContainer(WikiContainer.MEDIA_FOLDER_NAME);
        rootContainer.createChildContainer(WikiManager.VERSION_FOLDER_NAME);
        //copy media files to folders
        VFSContainer origRootContainer = frm.getFileResourceRootImpl(res);
        VFSContainer origMediaCont = (VFSContainer)origRootContainer.resolve(WikiContainer.MEDIA_FOLDER_NAME);
        List mediaFiles = origMediaCont.getItems();
        for (Iterator iter = mediaFiles.iterator(); iter.hasNext();) {
          VFSLeaf element = (VFSLeaf) iter.next();
          newMediaCont.copyFrom(element);
    View Full Code Here

    Examples of org.olat.fileresource.FileResourceManager

              fName = f.getName();
            } else {
              f = cfc.getUploadedFile();
              fName = cfc.getUploadedFileName();
            }
            FileResourceManager frm = FileResourceManager.getInstance();
            if (f!=null && !f.exists()) {
              // if f does not exist at this point then something went wrong with the upload
              // inform the user rather than issuing a log.error in FileUtils (OLAT-5383/OLAT-5384)
              getWindowControl().setError(translator.translate("Failed"));
              addCallback.failed(urequest);
              return;
            }
            try {       
              newFileResource = frm.addFileResource(f, fName);
            } catch (AddingResourceException e) {
              getWindowControl().setError(translator.translate(e.getErrorKey()));
              addCallback.failed(urequest);
              return;
            }
            if (newFileResource == null) {
              getWindowControl().setError(translator.translate("add.failed"));
              addCallback.failed(urequest);
              return;
            }

            if (limitTypes != null && limitTypes.size() > 0) { // check for type
              boolean validType = false;
              for (Iterator iter = limitTypes.iterator(); iter.hasNext();) {
                String limitType = (String) iter.next();
                if (newFileResource.getResourceableTypeName().equals(limitType)) validType = true;
              }
              if (!validType) { // rollback
                frm.deleteFileResource(newFileResource);
                getWindowControl().setError(translator.translate("add.wrongtype"));
                addCallback.failed(urequest);
                return;
              }
            }
    View Full Code Here

    Examples of org.olat.fileresource.FileResourceManager

      /**
       * Update the module configuration from the qti file: read min/max/cut values
       * @param res
       */
      public void updateModuleConfigFromQTIFile(OLATResource res) {
        FileResourceManager frm = FileResourceManager.getInstance();
        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");
        if (vfsQTI==null){
          throw new AssertException("qti file did not exist even it should be guaranteed by repositor check-in "
    View Full Code Here

    Examples of org.olat.fileresource.FileResourceManager

      /**
       * Unzip package into temporary directory.
       * @return true if successfull, false otherwise
       */
      private boolean unzipPackage() {
        FileResourceManager frm = FileResourceManager.getInstance();
        File fPackageZIP = frm.getFileResource(fileResource);
        return ZipUtil.unzip(fPackageZIP, packageDir);
      }
    View Full Code Here

    Examples of org.olat.fileresource.FileResourceManager

     
      /**
       * @return True upon success, false otherwise.
       */
      public boolean savePackageToRepository() {
        FileResourceManager frm = FileResourceManager.getInstance();
        File tmpZipFile = new File(FolderConfig.getCanonicalTmpDir() + "/" + CodeHelper.getRAMUniqueID() + ".zip");
        // first save complete ZIP package to repository
        if (!savePackageTo(tmpZipFile)) return false;
        // move file from temp to repository root and rename
        File fRepositoryZip = frm.getFileResource(fileResource);
        if (!FileUtils.moveFileToDir(tmpZipFile, frm.getFileResourceRoot(fileResource))) {
          tmpZipFile.delete();
          return false;
        }
        fRepositoryZip.delete();
        new File(frm.getFileResourceRoot(fileResource), tmpZipFile.getName()).renameTo(fRepositoryZip);
        // delete old unzip content. If the repository entry gets called in the meantime,
        // the package will get unzipped again.
        tmpZipFile.delete();
        frm.deleteUnzipContent(fileResource);
        // to be prepared for the next start, unzip right now.
        return (frm.unzipFileResource(fileResource) != null);
      }
    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.