Package com.cloud.bridge.service.exception

Examples of com.cloud.bridge.service.exception.OutOfStorageException


                if (bwResponse.getHttpStatusCode() == HTTP_PRECONDITION_FAILED)
                    s_logger.error("CAStor unable to create bucket " + bucket + " because domain " +
                                   (this._domain==null ? "(default)" : this._domain) + " does not exist");
                else
                    s_logger.error("CAStor unable to create bucket " + bucket + ": " + bwResponse.getHttpStatusCode());
                throw new OutOfStorageException("CAStor unable to create bucket " + bucket + ": " +
                                                bwResponse.getHttpStatusCode());
            }
        } catch (ScspExecutionException e) {
            s_logger.error("CAStor unable to create bucket " + bucket, e);
            throw new OutOfStorageException("CAStor unable to create bucket " + bucket + ": " + e.getMessage());
        }
    }
View Full Code Here


    public void deleteContainer(String mountedRoot, String bucket) {
        try {
            ScspResponse bwResponse = myClient(mountedRoot).delete("", bucket, domainQueryArg(), new ScspHeaders());
            if (bwResponse.getHttpStatusCode() >= HTTP_UNSUCCESSFUL) {
                s_logger.error("CAStor unable to delete bucket " + bucket + ": " + bwResponse.getHttpStatusCode());
                throw new OutOfStorageException("CAStor unable to delete bucket " + bucket + ": " +
                                                bwResponse.getHttpStatusCode());
            }
        } catch (ScspExecutionException e) {
            s_logger.error("CAStor unable to delete bucket " + bucket, e);
            throw new OutOfStorageException("CAStor unable to delete bucket " + bucket + ": " + e.getMessage());
        }
    }
View Full Code Here

                //Convert MD5 digest to (lowercase) hex String
                retVal = StringHelper.toHexString(md5.digest());

            } catch(IOException e) {
                s_logger.error("Unexpected exception " + e.getMessage(), e);
                throw new OutOfStorageException(e);
            } finally {
                try {
                    if (null != fos)
                        fos.close();
                } catch( Exception e ) {
                    s_logger.error("Can't close CAStor spool file " +
                                   spoolFile.getAbsolutePath() + ": " + e.getMessage(), e);
                    throw new OutOfStorageException("Unable to close CAStor spool file: " + e.getMessage(), e);
                }
            }

            try {
                ScspResponse bwResponse =
                    myClient(mountedRoot).write(bucket + "/" + fileName,
                                                new ResettableFileInputStream(spoolFile), streamLen,
                                                domainQueryArg(), new ScspHeaders());
                if (bwResponse.getHttpStatusCode() >= HTTP_UNSUCCESSFUL) {
                    s_logger.error("CAStor write responded with error " + bwResponse.getHttpStatusCode());
                    throw new OutOfStorageException("Unable to write object to CAStor " +
                                                    bucket + "/" + fileName + ": " + bwResponse.getHttpStatusCode());
                }
            } catch (ScspExecutionException e) {
                s_logger.error("Unable to write object to CAStor " + bucket + "/" + fileName, e);
                throw new OutOfStorageException("Unable to write object to CAStor " + bucket + "/" + fileName + ": " +
                                                e.getMessage());
            } catch (IOException ie) {
                s_logger.error("Unable to write object to CAStor " + bucket + "/" + fileName, ie);
                throw new OutOfStorageException("Unable to write object to CAStor " + bucket + "/" + fileName + ": " +
                                                ie.getMessage());
            }
            return retVal;
        } finally {
            try {
View Full Code Here

        String filePath = bucket + "/" + fileName;
        try {
            ScspResponse bwResponse = myClient(mountedRoot).delete("", filePath, domainQueryArg(), new ScspHeaders());
            if (bwResponse.getHttpStatusCode() != HTTP_OK) {
                s_logger.error("CAStor delete object responded with error " + bwResponse.getHttpStatusCode());
                throw new OutOfStorageException("CAStor unable to delete object " + filePath + ": " +
                                                bwResponse.getHttpStatusCode());
            }
        } catch (ScspExecutionException e) {
            s_logger.error("CAStor unable to delete object " + filePath, e);
            throw new OutOfStorageException("CAStor unable to delete object " + filePath + ": " + e.getMessage());
        }
    }
View Full Code Here

    String dir = getBucketFolderDir(mountedRoot, bucket);
    File container = new File(dir);
   
    if (!container.exists()) {
       if (!container.mkdirs())
         throw new OutOfStorageException("Unable to create " + dir + " for bucket " + bucket);
    }
  }
View Full Code Here

  @Override
  public void deleteContainer(String mountedRoot, String bucket) {
    String dir = getBucketFolderDir(mountedRoot, bucket);
    File path = new File(dir);
    if(!deleteDirectory(path))
      throw new OutOfStorageException("Unable to delete " + dir + " for bucket " + bucket);
  }
View Full Code Here

          return StringHelper.toHexString(md5.digest());
         
    }
    catch(IOException e) {
      logger.error("Unexpected exception " + e.getMessage(), e);
      throw new OutOfStorageException(e);
    }
    finally {
      try {
          if (null != fos) fos.close();
      }
View Full Code Here

          return new OrderedPair<String, Long>(StringHelper.toHexString(md5.digest()), new Long(totalLength));
          //Create an ordered pair whose first element is the MD4 digest as a (lowercase) hex String
    }
    catch(IOException e) {
      logger.error("concatentateObjects unexpected exception " + e.getMessage(), e);
      throw new OutOfStorageException(e);
   
  }
View Full Code Here

  public void deleteObject(String mountedRoot, String bucket, String fileName) {
    String filePath = new String( getBucketFolderDir(mountedRoot, bucket) + File.separatorChar + fileName );
    File file = new File( filePath )
    if (!file.delete()) {
      logger.error("file: " + filePath + ", f=" + file.isFile() + ", h=" + file.isHidden() + ", e=" + file.exists() + ", w=" + file.canWrite());
      throw new OutOfStorageException( "Unable to delete " + filePath + " for object deletion" );
    }
  }
View Full Code Here

            S3BucketAdapter bucketAdapter =  getStorageHostBucketAdapter(localSHost);
            bucketAdapter.createContainer(localSHost.getExportRoot(),(null != overrideName ? overrideName : bucketName));
            return new OrderedPair<SHostVO, String>(localSHost, localStorageRoot);
        }

        throw new OutOfStorageException("No storage host is available");
    }
View Full Code Here

TOP

Related Classes of com.cloud.bridge.service.exception.OutOfStorageException

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.