Package uk.org.microbase.filesystem.spi

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


  {
    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

      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

      FileOutputStream destStream = new FileOutputStream(destFile);
      FileUtils.copyStream(dataStream, destStream);
    }
    catch (IOException e)
    {
      throw new FSException("Failed to write stream to bucket: "
          + remoteBucket + " file: " + name, e);
    }

    //TODO store tags?
  }
View Full Code Here

    {
      bucketPath.mkdirs();
    }
    if (!bucketPath.exists() || !bucketPath.isDirectory())
    {
      throw new FSException("Failed to create bucket: " + bucketName
          + " at " + bucketPath.getAbsolutePath());
    }
    return bucketPath;
  }
View Full Code Here

      fis = new FileInputStream(dataFile);
      upload(fis, remoteBucket, remotePath, remoteName, tags);
    }
    catch (Exception e)
    {
      throw new FSException(
          "Failed to write local file: " + dataFile.getAbsolutePath()
          + " to remote bucket: " + remoteBucket
          + " path: " + remotePath
          + " with name: " + remoteName, e);
    }
View Full Code Here

TOP

Related Classes of uk.org.microbase.filesystem.spi.FSException

Copyright © 2018 www.massapicom. 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.