Examples of FsException


Examples of org.elfinder.servlets.FsException

    if (os == null) {
      os = new ByteArrayOutputStream();
    }
    try {
      if (!newFile.createNewFile()) {
        throw new FsException("unable to create file");
      }
      try {
        FileOutputStream fs = new FileOutputStream(newFile);
        fs.write(os.toByteArray());
        fs.flush();
        fs.close();
      } catch (Exception ee) {
        newFile.delete();
        throw new FsException("unable to write file");
      }
    } catch (Exception e) {
      throw new FsException("unable to create file");
    }
  }
View Full Code Here

Examples of org.elfinder.servlets.FsException

  }

  public void createFolder(File folder) throws FsException {
    boolean ok = folder.mkdir();
    if (!ok) {
      throw new FsException("Unable to create folder");
    }
  }
View Full Code Here

Examples of org.elfinder.servlets.FsException

  }

  public void renameFileOrDirectory(File targetFile, File futureFile) throws FsException {
    boolean ok = targetFile.renameTo(futureFile);
    if (!ok) {
      throw new FsException("Unable to rename file from " + targetFile.getPath() + " to " + futureFile.getPath());
    }
  }
View Full Code Here

Examples of org.elfinder.servlets.FsException

      }
    } catch (IOException e) {
      ok = false;
    }
    if (!ok) {
      throw new FsException("Unable to copy file from " + targetFile.getPath() + " to " + futureFile.getPath());
    }
  }
View Full Code Here

Examples of org.elfinder.servlets.FsException

      FileUtils.copyFile(file, futureFile);
      if (!file.delete()) {
        throw new Exception();
      }
    } catch (Exception e) {
      throw new FsException("Unable to move file");
    }
  }
View Full Code Here

Examples of org.elfinder.servlets.FsException

    }
  }

  public void removeFile(File path) throws FsException {
    if (!path.delete()) {
      throw new FsException("Unable to remove file");
    }
  }
View Full Code Here

Examples of org.elfinder.servlets.FsException

    }
  }

  public void removeEmptyDirectory(File path) throws FsException {
    if (!path.delete()) {
      throw new FsException("Unable to remove directory");
    }
  }
View Full Code Here

Examples of uk.org.microbase.filesystem.spi.FSException

    {
      InputStream configStream =
          LocalDirFS.class.getResourceAsStream(CONFIG_ENTRY);
      if (configStream == null)
      {
        throw new FSException("Configuration file: " + CONFIG_ENTRY
            + " could not be found on the CLASSPATH");
      }

      logger.log(Level.INFO,
          "Loading filesystem provider config from "
          + "CLASSPATH entry {0}", CONFIG_ENTRY);
      Properties config = new Properties();
      config.load(configStream);


      String rootDirProperty = config.getProperty(PROP_DIR_ROOT);
      if (rootDirProperty == null)
      {
        throw new FSException("Config file "+CONFIG_ENTRY
            + " had no value for property: " + PROP_DIR_ROOT);
      }
      rootDir = new File(rootDirProperty);
      logger.log(Level.INFO, "Using local directory: {0}",
                              rootDir.getAbsolutePath());
      if (!rootDir.exists())
      {
        logger.log(Level.INFO,
            "Attempting to create directory: {0}",
            rootDir.getAbsolutePath());
        rootDir.mkdirs();
      }
    }
    catch (IOException e)
    {
      throw new FSException(
          "Failed to load configuration from classpath entity: "
          + CONFIG_ENTRY, e);
    }

    setEnabled(true);
View Full Code Here

Examples of uk.org.microbase.filesystem.spi.FSException

  {
    File bucket = getBucketPath(remoteBucket, remotePath);
    if (bucket == null || !bucket.exists())
    {
      //return null;
      throw new FSException("No such bucket: " + remoteBucket);
    }
    File file = new File(bucket, remoteName);
    if (!file.exists())
    {
      //return null;
      throw new FSException("No such file: " + remoteName
          + " in bucket: " + remoteBucket);
    }
    try
    {
      FileInputStream fis = new FileInputStream(file);
      return fis;
    }
    catch (IOException e)
    {
      throw new FSException("Failed to retreive bucket: "
          + remoteBucket + ", name: " + remoteName, e);
    }
  }
View Full Code Here

Examples of uk.org.microbase.filesystem.spi.FSException

      throws FSOperationNotSupportedException, FSException
  {
    File bucket = getBucketPath(remoteBucket, remotePath);
    if (bucket == null)
    {
      throw new FSException("No such bucket: " + remoteBucket);
    }
    File file = new File(bucket, remoteName);
    if (!file.exists())
    {
      throw new FSException("No such file: " + remoteName
          + " in bucket: " + remoteBucket);
    }
    try
    {
      logger.info("Copying " + file.getAbsolutePath() + " ---> "
          + destinationFile.getAbsolutePath());
      FileUtils.copyFile(file, destinationFile);
    }
    catch (IOException e)
    {
      throw new FSException("Failed to retreive bucket: "
          + remoteBucket + ", name: " + remoteName, 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.