Package org.jets3t.service

Examples of org.jets3t.service.S3ServiceException


            System.setProperty("org.xml.sax.driver", "org.apache.crimson.parser.XMLReaderImpl");
            try {
                // Try once more...
                xr = XMLReaderFactory.createXMLReader();
            } catch (SAXException e2) {
                throw new S3ServiceException("Couldn't initialize a sax driver for the XMLReader");
            }
        }
    }
View Full Code Here


            } catch (IOException e) {
              if (log.isErrorEnabled()) {
                log.error("Unable to close response InputStream up after XML parse failure", e);
              }
            }
            throw new S3ServiceException("Failed to parse XML document with handler "
                + handler.getClass(), t);
        }
    }
View Full Code Here

                } catch (IOException e) {
                  if (log.isErrorEnabled()) {
                    log.error("Unable to close response InputStream after failure sanitizing XML document", e);
                  }
                }
                throw new S3ServiceException("Failed to sanitize XML document destined for handler "
                    + handler.getClass(), t);           
            }  
            return sanitizedInputStream;
        }
    }
View Full Code Here

        SecretKeySpec signingKey = null;
        try {
            signingKey = new SecretKeySpec(awsSecretKey.getBytes(Constants.DEFAULT_ENCODING),
                Constants.HMAC_SHA1_ALGORITHM);
        } catch (UnsupportedEncodingException e) {
            throw new S3ServiceException("Unable to get bytes from secret string", e);
        }

        // Acquire the MAC instance and initialize with the signing key.
        Mac mac = null;
        try {
            mac = Mac.getInstance(Constants.HMAC_SHA1_ALGORITHM);
        } catch (NoSuchAlgorithmException e) {
            // should not happen
            throw new RuntimeException("Could not find sha1 algorithm", e);
        }
        try {
            mac.init(signingKey);
        } catch (InvalidKeyException e) {
            // also should not happen
            throw new RuntimeException("Could not initialize the MAC algorithm", e);
        }

        // Compute the HMAC on the digest, and set it.
        try {
            byte[] b64 = Base64.encodeBase64(mac.doFinal(
                canonicalString.getBytes(Constants.DEFAULT_ENCODING)));
            return new String(b64);
        } catch (UnsupportedEncodingException e) {
            throw new S3ServiceException("Unable to get bytes from canonical string", e);
        }
    }
View Full Code Here

                // For signed URL downloads, we create a surrogate S3Object purely for monitoring purposes.
                try {
                    URL url = new URL(downloadPackages[i].getSignedUrl());           
                    objects[i] = ServiceUtils.buildObjectFromUrl(url.getHost(), url.getPath());
                } catch (Exception e) {
                    throw new S3ServiceException("Unable to determine S3 Object key name from signed URL: " +
                        downloadPackages[i].getSignedUrl());
                }
            } else {
                objects[i] = downloadPackages[i].getObject();               
            }
View Full Code Here

        throws S3ServiceException
    {
        // Sanity check to ensure all packages are based on signed URLs
        for (int i = 0; i < downloadPackages.length; i++) {
            if (!downloadPackages[i].isSignedDownload()) {
                throw new S3ServiceException(
                    "The downloadObjects(DownloadPackage[]) method may only be used with " +
                    "download packages based on signed URLs. Download package " + (i + 1) +
                    " of " + downloadPackages.length + " is not based on a signed URL");               
            }
        }
View Full Code Here

        if (adaptor.wasErrorThrown()) {
            Throwable thrown = adaptor.getErrorThrown();
            if (thrown instanceof S3ServiceException) {
                throw (S3ServiceException) thrown;
            } else {
                throw new S3ServiceException(thrown);
            }
        }       
    }
View Full Code Here

                tempFile.deleteOnExit();
               
                downloadPackages[i] = new DownloadPackage(objects[i], tempFile);
            }
        } catch (IOException e) {
            throw new S3ServiceException("Unable to create temporary file to store object data", e);
        }
       
        final List objectList = new ArrayList();
        S3ServiceEventAdaptor adaptor = new S3ServiceEventAdaptor() {
            public void s3ServiceEventPerformed(DownloadObjectsEvent event) {
View Full Code Here

                                + chunk.getPrefix() + "'");
                           
                            allObjects.addAll(Arrays.asList(chunk.getObjects()));                           
                        }
                    } else if (ListObjectsEvent.EVENT_ERROR == event.getEventCode()) {
                        s3ServiceExceptions[0] = new S3ServiceException(
                            "Failed to list all objects in S3 bucket",
                            event.getErrorCause());                   
                    }
                }
            });
View Full Code Here

        BufferedInputStream fileIS = null;
        try {
            fileIS = new BufferedInputStream(new FileInputStream(file));
            return load(password, fileIS);
        } catch (Throwable t) {
            throw new S3ServiceException("Failed to load AWS credentials", t);
        } finally {
            if (fileIS != null) {
                try {
                    fileIS.close();
                } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.jets3t.service.S3ServiceException

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.