Package com.netfever.web.storage.api

Examples of com.netfever.web.storage.api.StorageException


  public void setRoot(String root) throws StorageException {
    this.root = new File(root);
   
    if (!this.root.isDirectory()) {
      if (!this.root.exists()) {
        throw new StorageException("Setting root to {" + root + "} but folder does not exists");       
      } else {
        throw new StorageException("Setting root to {" + root + "} - it exists but is not a folder");               
      }
    } else {
      log.info("Setting root to {" + root + "}");
    }
  }
View Full Code Here


 
  protected File getFile(String path, boolean checkExists) throws StorageException {
    File res;
   
    if (this.root == null) {
      throw new StorageException("The root has not been set so couldn't get a handle to {" + path + "}");
    }

    res = new File(this.root, path);
   
    if (checkExists) {
      if (!res.exists()) {
        throw new StorageException("File {" + res.getAbsolutePath() + "} does not exists.");
      }
     
      if (!res.isFile()) {
        throw new StorageException("File {" + res.getAbsolutePath() + "} exists but it's not a file.");
      }   
    } else {
      if (!res.isDirectory()) {
        throw new StorageException("File {" + res.getAbsolutePath() + "} is a folder not a file.");
      }         
    }
   
    return res;
  }
View Full Code Here

        return new String(out.toByteArray());
      } else {
        return null;
      }
    } catch (Exception e) {
      throw new StorageException(e.getMessage(), e);
    }   
  }
View Full Code Here

    try {
      fmime = new File(f.getAbsolutePath() + ".mime");

      FileUtils.write(fmime, mime.getBytes());
    } catch (Exception e) {
      throw new StorageException(e.getMessage(), e);
    }   
  }
View Full Code Here

  @Override
  public FileChannel openChannel() throws StorageException {
    try {
      return new FileInputStream(this.file).getChannel();
    } catch (Exception e) {
      throw new StorageException(e.getMessage(), e);
    }
  }
View Full Code Here

        return res;
      } else {
        return null;
      }
    } catch (NetfeverException e) {
      throw new StorageException(e.getDetails(), e);
    } catch (IOException e) {
      UUID uuid = UUID.randomUUID();
     
      throw new StorageException(
          new FaultDetails(
              uuid.toString(),
              0,
              "Streaming error. Contact administrator with id " + uuid,
              "Error reading stream " +
View Full Code Here

        }
      } finally {
        in.close();
      }
    } catch (NetfeverException e) {
      throw new StorageException(e.getDetails(), e);
    } catch (IOException e) {
      UUID uuid = UUID.randomUUID();
     
      throw new StorageException(
          new FaultDetails(
              uuid.toString(),
              0,
              "Streaming error. Contact administrator with id " + uuid,
              "Error reading stream " +
View Full Code Here

TOP

Related Classes of com.netfever.web.storage.api.StorageException

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.