Examples of AjxpDriverException


Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

  public AjxpAnswer execute(SvnDriver driver, HttpServletRequest request) {
    String fileStr = request.getParameter("file");
    log.debug("Log file " + fileStr);
    if (fileStr == null) {
      throw new AjxpDriverException("A  file needs to be provided.");
    }
    File file = new File(driver.getBasePath() + fileStr);
    return new SvnLogAnswer(driver, file);
  }
View Full Code Here

Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

        }

        writer.append("</log>");
        writer.append("</tree>");
      } catch (Exception e) {
        throw new AjxpDriverException(
            "Cannot retrieve log for " + file, e);
      } finally {
        IOUtils.closeQuietly(writer);
      }
    }
View Full Code Here

Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

      driver.getManager().getWCClient().doDelete(file, true, false);

      driver.commitAll("Commit delete of " + file.getName());
      driver.completeWriteAction(file.getParentFile());
    } catch (SVNException e) {
      throw new AjxpDriverException("Cannot delete file " + file, e);
    } finally {
      driver.rollbackWriteAction(file.getParentFile());
    }
  }
View Full Code Here

Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

          file.isDirectory(), true, true);

      driver.commitAll("Commit file " + file.getName());
      driver.completeWriteAction(file.getParentFile());
    } catch (SVNException e) {
      throw new AjxpDriverException("Cannot commit file " + file, e);
    } finally {
      driver.rollbackWriteAction(file.getParentFile());
    }
  }
View Full Code Here

Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

        }
        writer.write("</tree>");
        writer.flush();

      } catch (Exception e) {
        throw new AjxpDriverException("Could not write response.", e);
      } finally {
        IOUtils.closeQuietly(writer);
        IOUtils.closeQuietly(out);
      }
    }
View Full Code Here

Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

public class FileUploadAction<T extends FileDriver> extends FileAction {

  public AjxpAnswer execute(FileDriver driver, HttpServletRequest request) {
    if (!(request instanceof MultipartHttpServletRequest)) {
      throw new AjxpDriverException(
          "Cann only deal with MultipartHttpServletRequest");
    }
    MultipartHttpServletRequest mpr = (MultipartHttpServletRequest) request;
    String dir = mpr.getParameter("dir");
    String fileName = mpr.getParameter("Filename");

    InputStream in = null;
    OutputStream out = null;
    File file = null;
    try {
      MultipartFile mpfile = mpr.getFile("Filedata");
      in = mpfile.getInputStream();
      file = driver.getFile(dir, fileName);
      out = new FileOutputStream(file);
      IOUtils.copy(in, out);
    } catch (IOException e) {
      throw new AjxpDriverException("Cannot upload file.", e);
    } finally {
      IOUtils.closeQuietly(in);
      IOUtils.closeQuietly(out);
    }
    postProcess((T)driver, file);
View Full Code Here

Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

  /** Builds a SVN URL. */
  public SVNURL getSVNURL(String relativePath) {
    try {
      return baseUrl.appendPath(relativePath, false);
    } catch (SVNException e) {
      throw new AjxpDriverException(
          "Cannot build URL from relative path " + relativePath
              + " and base url " + baseUrl);
    }
  }
View Full Code Here

Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

  public SVNRepository getRepository() {
    try {
      return manager.createRepository(baseUrl, true);
    } catch (SVNException e) {
      throw new AjxpDriverException("Cannot create repository for "
          + baseUrl, e);
    }
  }
View Full Code Here

Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

   *
   * @return whether one should check out.
   */
  protected boolean baseDirChecks(File baseDir) {
    if (!baseDir.isDirectory()) {
      throw new AjxpDriverException("Base path " + baseDir
          + " is not a directory.");
    }

    try {// retrieves SVN infos
      SVNInfo info = manager.getWCClient().doInfo(baseDir,
          SVNRevision.WORKING);
      SVNURL baseUrlTemp = info.getURL();
      if (baseUrl != null) {
        if (!baseUrl.equals(baseUrlTemp)) {
          throw new AjxpDriverException(
              "SVN URL of the working copy "
                  + baseUrlTemp
                  + " is not compatible with provided baseUrl "
                  + baseUrl);
        }
      } else {
        this.baseUrl = baseUrlTemp;
      }
      return false;
    } catch (SVNException e) {// no info retrieved
      log
          .warn("Could not retrieve SVN info from "
              + baseDir
              + "("
              + e.getMessage()
              + "). Guess that it is and empty dir and try to check out from provided URL.");
      if (baseDir.listFiles().length != 0) {
        throw new AjxpDriverException("Base dir " + baseDir
            + " is not a working copy and not an empty dir.");
      }
      return true;
    }
  }
View Full Code Here

Examples of org.argeo.ajaxplorer.jdrivers.AjxpDriverException

    }
  }

  protected void checkOut(File baseDir) {
    if (getBaseUrl() == null) {
      throw new AjxpDriverException(
          "No SVN URL provided, cannot check out.");
    }

    // Make sure directory exists
    baseDir.mkdirs();

    try {
      long revision = manager.getUpdateClient().doCheckout(getBaseUrl(),
          baseDir, SVNRevision.UNDEFINED, SVNRevision.HEAD, true);
      log.info("Checked out from " + baseUrl + " to " + baseDir
          + " at revision " + revision);
    } catch (SVNException e) {
      throw new AjxpDriverException("Cannot check out from " + baseUrl
          + " to " + baseDir, e);
    }
  }
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.