Package com.amazonaws.s3.doc._2006_03_01

Examples of com.amazonaws.s3.doc._2006_03_01.PutObjectResult


                S3Object[] partialObjects = new S3Object[
                   (entries == null? 0 : entries.length)];
               
                log.debug("Found " + partialObjects.length + " objects in one batch");
                for (int i = 0; entries != null && i < entries.length; i++) {
                    ListEntry entry = entries[i];
                    S3Object object = new S3Object(entry.getKey());
                    object.setLastModifiedDate(entry.getLastModified().getTime());
                    object.setETag(entry.getETag());
                    object.setContentLength(entry.getSize());
                    object.setStorageClass(entry.getStorageClass().toString());
                    object.setOwner(convertOwner(entry.getOwner()));
                    partialObjects[i] = object;
                   
                    // This shouldn't be necessary, but result.getNextMarker() doesn't work as expected.
                    priorLastKey = object.getKey();
                }
               
                objects.addAll(Arrays.asList(partialObjects));
               
                PrefixEntry[] prefixEntries = result.getCommonPrefixes();
                if (prefixEntries != null) {
                    log.debug("Found " + prefixEntries.length + " common prefixes in one batch");                   
                }
                for (int i = 0; prefixEntries != null && i < prefixEntries.length; i++ ) {
                    PrefixEntry entry = prefixEntries[i];
                    commonPrefixes.add(entry.getPrefix());
                }
               
                incompleteListing = result.isIsTruncated();
                if (incompleteListing) {
                  if (result.getNextMarker() != null) {
View Full Code Here


            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "GetBucketLoggingStatus" + convertDateToString(timestamp));
           
            BucketLoggingStatus loggingStatus = s3SoapBinding.getBucketLoggingStatus(               
                bucketName, getAWSAccessKey(), timestamp, signature, null);           
            LoggingSettings loggingSettings = loggingStatus.getLoggingEnabled();
            if (loggingSettings != null) {
                return new S3BucketLoggingStatus(loggingSettings.getTargetBucket(), loggingSettings.getTargetPrefix());               
            } else {
                return new S3BucketLoggingStatus();
            }
        } catch (RuntimeException e) {
            throw e;
View Full Code Here

            AmazonS3SoapBindingStub s3SoapBinding = getSoapBinding();
            Calendar timestamp = getTimeStamp( System.currentTimeMillis() );
            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "SetBucketLoggingStatus" + convertDateToString(timestamp));
           
            LoggingSettings loggingSettings = null;
            if (status.isLoggingEnabled()) {
                loggingSettings = new LoggingSettings(status.getTargetBucketName(), status.getLogfilePrefix());               
            }
           
            s3SoapBinding.setBucketLoggingStatus(
                bucketName, getAWSAccessKey(), timestamp, signature, null,
                new BucketLoggingStatus(loggingSettings));
View Full Code Here

        while (metadataIter.hasNext()) {
            Map.Entry entry = (Map.Entry) metadataIter.next();
            Object metadataName = entry.getKey();
            Object metadataValue = entry.getValue();
            log.debug("Setting metadata: " + metadataName + "=" + metadataValue);
            MetadataEntry mdEntry = new MetadataEntry();
            mdEntry.setName(metadataName.toString());
            mdEntry.setValue(metadataValue.toString());
            metadata[index++] = mdEntry;
        }
        return metadata;
    }
View Full Code Here

            }
           
            // Populate object's metadata details.
            MetadataEntry[] metadata = result.getMetadata();
            for (int i = 0; i < metadata.length; i++) {
                MetadataEntry entry = metadata[i];
                object.addMetadata(entry.getName(), entry.getValue());
            }
            object.setMetadataComplete(true);
           
            return object;
        } catch (RuntimeException e) {
View Full Code Here

                grant.setGrantee(customerByEmail);
            } else {
                throw new S3ServiceException("Unrecognised jets3t grantee type: "
                    + jets3tGrantee.getClass());
            }
            Permission permission = Permission.fromString(jets3tGaP.getPermission().toString());
            grant.setPermission(permission);
            grants[index++] = grant;
        }
        return grants;
    }
View Full Code Here

                PrefixEntry[] prefixEntries = result.getCommonPrefixes();
                if (prefixEntries != null) {
                    log.debug("Found " + prefixEntries.length + " common prefixes in one batch");                   
                }
                for (int i = 0; prefixEntries != null && i < prefixEntries.length; i++ ) {
                    PrefixEntry entry = prefixEntries[i];
                    commonPrefixes.add(entry.getPrefix());
                }
               
                incompleteListing = result.isIsTruncated();
                if (incompleteListing) {
                  if (result.getNextMarker() != null) {
View Full Code Here

            }
           
            Calendar timestamp = getTimeStamp( System.currentTimeMillis() );
            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "PutObject" + convertDateToString(timestamp));
            PutObjectResult result =
                s3SoapBinding.putObject(bucketName, object.getKey(), metadata,
                    contentLength, grants, null, getAWSAccessKey(),
                    timestamp, signature, null);
           
            // Ensure no data was corrupted, if we have the MD5 hash available to check.
            String eTag = result.getETag().substring(1, result.getETag().length() - 1);
            String eTagAsBase64 = ServiceUtils.toBase64(
                ServiceUtils.fromHex(eTag));
            String md5HashAsBase64 = object.getMd5HashAsBase64();           
            if (md5HashAsBase64 != null && !eTagAsBase64.equals(md5HashAsBase64)) {
                throw new S3ServiceException(
                    "Object created but ETag returned by S3 does not match MD5 hash value of object");
            }
           
            object.setETag(result.getETag());
            object.setContentLength(contentLength);
            object.setContentType(contentType);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

            }
           
            Calendar timestamp = getTimeStamp( System.currentTimeMillis() );
            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "PutObject" + convertDateToString(timestamp));
            PutObjectResult result =
                s3SoapBinding.putObject(bucketName, object.getKey(), metadata,
                    contentLength, grants, null, getAWSAccessKey(),
                    timestamp, signature, null);
           
            // Ensure no data was corrupted, if we have the MD5 hash available to check.
            String eTag = result.getETag().substring(1, result.getETag().length() - 1);
            String eTagAsBase64 = ServiceUtils.toBase64(
                ServiceUtils.fromHex(eTag));
            String md5HashAsBase64 = object.getMd5HashAsBase64();           
            if (md5HashAsBase64 != null && !eTagAsBase64.equals(md5HashAsBase64)) {
                throw new S3ServiceException(
                    "Object created but ETag returned by S3 does not match MD5 hash value of object");
            }
           
            object.setETag(result.getETag());
            object.setContentLength(contentLength);
            object.setContentType(contentType);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

            }
           
            Calendar timestamp = getTimeStamp( System.currentTimeMillis() );
            String signature = ServiceUtils.signWithHmacSha1(getAWSSecretKey(),
                Constants.SOAP_SERVICE_NAME + "PutObject" + convertDateToString(timestamp));
            PutObjectResult result =
                s3SoapBinding.putObject(bucketName, object.getKey(), metadata,
                    contentLength, grants, null, getAWSAccessKey(),
                    timestamp, signature, null);
           
            // Ensure no data was corrupted, if we have the MD5 hash available to check.
            String eTag = result.getETag().substring(1, result.getETag().length() - 1);
            String eTagAsBase64 = ServiceUtils.toBase64(
                ServiceUtils.fromHex(eTag));
            String md5HashAsBase64 = object.getMd5HashAsBase64();           
            if (md5HashAsBase64 != null && !eTagAsBase64.equals(md5HashAsBase64)) {
                throw new S3ServiceException(
                    "Object created but ETag returned by S3 does not match MD5 hash value of object");
            }
           
            object.setETag(result.getETag());
            object.setContentLength(contentLength);
            object.setContentType(contentType);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.amazonaws.s3.doc._2006_03_01.PutObjectResult

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.