Examples of VFSResource


Examples of com.adito.vfs.VFSResource

   * @param fileSystemForm the form
   * @throws Exception if an exception is thrown.
   */
  private void deleteSingleFile(HttpServletRequest request, HttpServletResponse response, String delPath,
                  FileSystemForm fileSystemForm) throws Exception {
    VFSResource res = getResourceForPath(fileSystemForm.getLaunchSession(), request, response, delPath);
    if (log.isDebugEnabled())
      log.debug("Deleting " + res.getRelativePath());
    String name = null;
    try {
      name = res.getDisplayName();
      res.delete();
      if (res.getMount().getStore().getProvider().isFireEvents()) {
        CoreServlet.getServlet().fireCoreEvent(NetworkPlaceResourceType.getResourceAccessDeleteEvent(this,
          fileSystemForm.getLaunchSession(),
          request,
          fileSystemForm.getPath(),
          fileSystemForm.getFullURI(),
          name,
          null));
      }
    } catch (DAVException dave) {
      if (log.isErrorEnabled()) {
        log.error("Delete Error.", dave);
      }
      saveError(request, "vfs.delete.error", name);
    } catch (Exception e) {
      if (res.getMount().getStore().getProvider().isFireEvents()) {
        CoreServlet.getServlet().fireCoreEvent(NetworkPlaceResourceType.getResourceAccessDeleteEvent(this,
          fileSystemForm.getLaunchSession(),
          request,
          fileSystemForm.getPath(),
          fileSystemForm.getFullURI(),
View Full Code Here

Examples of com.adito.vfs.VFSResource

    if (log.isDebugEnabled())
      log.debug("Cut files.");
    FileSystemForm fileSystemForm = (FileSystemForm) form;

    try {
      VFSResource res = checkLaunchSession(request, response, fileSystemForm);
      ActionForward fwd = checkAccess(mapping, fileSystemForm, request);
      if (fwd != null) {
        return fwd;
      }
      fwd = checkMount(res, mapping, fileSystemForm, request);
View Full Code Here

Examples of com.adito.vfs.VFSResource

    if (log.isDebugEnabled())
      log.debug("Copy files.");
    FileSystemForm fileSystemForm = (FileSystemForm) form;

    try {
      VFSResource res = checkLaunchSession(request, response, fileSystemForm);
      ActionForward fwd = checkAccess(mapping, fileSystemForm, request);
      if (fwd != null) {
        return fwd;
      }
      fwd = checkMount(res, mapping, fileSystemForm, request);
View Full Code Here

Examples of com.adito.vfs.VFSResource

        }
    }
   
    private ActionForward validatePasteForward(ActionMapping mapping, FileSystemForm fileSystemForm, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        VFSResource vfsResource = checkLaunchSession(request, response, fileSystemForm);
        ActionForward forward = checkAccess(mapping, fileSystemForm, request);
        if (forward != null) {
            return forward;
        }
        forward = checkMount(vfsResource, mapping, fileSystemForm, request);
View Full Code Here

Examples of com.adito.vfs.VFSResource

        Clipboard clipboard = (Clipboard) request.getSession().getAttribute(Constants.CLIPBOARD);
        Map<VFSResource, VFSResource> pasteDetails = new HashMap<VFSResource, VFSResource>();
        if (clipboard != null) {
            for (ClipboardContent content : clipboard.getContent()) {
                NetworkPlaceClipboardContent element = (NetworkPlaceClipboardContent) content;
                VFSResource sourceResource = getResourceForPath(fileSystemForm.getLaunchSession(), request, response, element.getPath());
                if (log.isDebugEnabled()) {
                    log.debug("  Source. = " + sourceResource + " (display name = " + sourceResource.getDisplayName() + ", mount = " + sourceResource.isMount() + ")");
                }
                String concatenatePaths = DAVUtilities.concatenatePaths(destinationPath, sourceResource.getDisplayName());
                VFSResource destinationResource = getResourceForPath(fileSystemForm.getLaunchSession(), request, response, concatenatePaths);

                if (log.isDebugEnabled()) {
                    log.debug("  Dest. = " + destinationResource);
                }
               
                if (sourceResource.getFullPath().equals(destinationResource.getFullPath())) {
                    throw new NetworkPlacesException(NetworkPlacesException.ERR_VFS_CANNOT_PASTE_TO_SOURCE);
                }           
               
                pasteDetails.put(sourceResource, destinationResource);
            }
View Full Code Here

Examples of com.adito.vfs.VFSResource

                while (clipboardIterator.hasNext()) {
                    String divider = allFiles.equals("") ? "" : ", ";
                    NetworkPlaceClipboardContent element = (NetworkPlaceClipboardContent) clipboardIterator.next();
                    try {
                        VFSResource sourceResource = getResourceForPath(fileSystemForm.getLaunchSession(),
                            request,
                            response,
                            element.getPath());
                        if (log.isDebugEnabled())
                            log.debug("  Source. = " + sourceResource
                                + " (display name = "
                                + sourceResource.getDisplayName()
                                + ", mount = "
                                + sourceResource.isMount()
                                + ")");
                        VFSResource destinationResource = null;
                        if (log.isDebugEnabled())
                            log.debug("Paste");
                        destinationResource = getResourceForPath(fileSystemForm.getLaunchSession(),
                            request,
                            response,
                            DAVUtilities.concatenatePaths(destinationPath, sourceResource.getDisplayName()));

                        if (log.isDebugEnabled())
                            log.debug("  Dest. = " + destinationResource);                 
                       
                        if (sourceResource.getFullPath().equals(destinationResource.getFullPath())) {
                            throw new NetworkPlacesException(NetworkPlacesException.ERR_VFS_CANNOT_PASTE_TO_SOURCE);
                        }
                       
                        allFiles = allFiles + divider + sourceResource.getDisplayName();
                        sourceResource.copy(destinationResource, true, true);
View Full Code Here

Examples of com.adito.vfs.VFSResource

    ActionForward fwd = checkAccess(mapping, fileSystemForm, request);
    if (fwd != null) {
      return fwd;
    }
    String path = DAVUtilities.stripTrailingSlash(fileSystemForm.getPath() + "/" + fileSystemForm.getNewFolder()) + "/";
    VFSResource res = null;
    res = getResourceForPath(fileSystemForm.getLaunchSession(), request, response, path);
    fwd = checkMount(res, mapping, fileSystemForm, request);
    if (fwd != null) {
      return fwd;
    }
    try {
      res.makeCollection();
      fileSystemForm.setPath(path);
      if (res.getMount().getStore().getProvider().isFireEvents()) {
        CoreServlet.getServlet().fireCoreEvent(NetworkPlaceResourceType.getResourceAccessMkDirEvent(this,
          fileSystemForm.getLaunchSession(),
          request,
          fileSystemForm.getPath(),
          fileSystemForm.getFullURI(),
          null));
      }

    } catch (DAVException e) {
      if (res.getMount().getStore().getProvider().isFireEvents()) {
        CoreServlet.getServlet().fireCoreEvent(NetworkPlaceResourceType.getResourceAccessMkDirEvent(this,
          fileSystemForm.getLaunchSession(),
          request,
          fileSystemForm.getPath(),
          fileSystemForm.getFullURI(),
View Full Code Here

Examples of com.adito.vfs.VFSResource

                 *
                 * This will happen for example when listomg /fs/[store] and a
                 * network place that requires auth. is hit.
                 */

                VFSResource r = getMount().getResource(DAVUtilities.concatenatePaths(relativePath, fileName), requestCredentials/*, transaction*/);
                if (!((AbstractNetworkPlaceMount)getMount()).getNetworkPlace().isAllowRecursive() && r.isCollection())
                    continue;
                resources.add(r);
            } catch (Exception e) {
                /*
                 * NOTE - BPS - We cannot log this exception as it may have user
View Full Code Here

Examples of com.adito.vfs.VFSResource

        if (uploadFile == null || uploadFile.getFileName() == null || uploadFile.getFileName().trim().equals("")) {
            return upload.getUploadedForward();
        }

        LaunchSession launchSession = null;
        VFSResource res = null;
        try {
           
            // Get the launch session
            SessionInfo session = LogonControllerFactory.getInstance().getSessionInfo(request);
            launchSession = session == null ? null : LaunchSessionFactory.getInstance().getLaunchSession(session, upload.getExtraAttribute2());
            if(launchSession == null) {
                throw new Exception("No launch session.");
            }
            launchSession.checkAccessRights(null, session);

            res = DAVServlet.getDAVResource(launchSession, request, response, upload.getResourcePath() + "/" + uploadFile.getFileName());
           
            res.getFile().exists();
            InputStream in = uploadFile.getInputStream();
            OutputStream out = res.getOutputStream();
            try {
                byte[] buf = new byte[4096];
                int read;
                while (true) {
                    read = in.read(buf, 0, buf.length);
                    if (read == -1) {
                        break;
                    }
                    out.write(buf, 0, read);
                }
            } finally {
                in.close();
                out.close();
            }
            if (res.getMount().getStore().getProvider().isFireEvents()) {
                CoreServlet.getServlet().fireCoreEvent(
                    NetworkPlaceResourceType.getResourceAccessUploadEvent(this, launchSession, request, res.getFullPath(), res.getFile().getName().getURI(), uploadFile
                                    .getFileName(), null));
            }
            return upload.getUploadedForward();
        } catch (Exception e) {
            if (res != null && res.getMount().getStore().getProvider().isFireEvents()) {
                CoreServlet.getServlet().fireCoreEvent(
                    NetworkPlaceResourceType.getResourceAccessUploadEvent(this, launchSession, request, res.getFullPath(), res.getFile().getName().getURI(), uploadFile
                                    .getFileName(), e));
            }
            /*
             * Close the stream so the client gets an error straight away rather
             * than having to wait for the file to upload
View Full Code Here

Examples of com.adito.vfs.VFSResource

        LaunchSession launchSession = session == null ? null : LaunchSessionFactory.getInstance().getLaunchSession(session, fileUpload.getExtraAttribute2());
        if(launchSession == null) {
            throw new Exception("No launch session.");
        }

        VFSResource res = DAVServlet.getDAVResource(launchSession, request, response, fileUpload.getResourcePath() + "/" + file.getFileName());

        return res.getFile().exists();
    }
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.