protected void putAclImpl(String bucketName, String objectKey, AccessControlList acl, String versionId) throws ServiceException { if(log.isDebugEnabled()) { log.debug("Setting Access Control List for bucketName=" + bucketName + ", objectKey=" + objectKey); } Map<String, String> requestParameters = new HashMap<String, String>(); requestParameters.put("acl", ""); if(versionId != null) { requestParameters.put("versionId", versionId); } Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("Content-Type", "text/plain"); String aclAsXml = acl.toXml(); metadata.put("Content-Length", String.valueOf(aclAsXml.length())); performRestPut(bucketName, objectKey, metadata, requestParameters, new StringEntity(aclAsXml, ContentType.create("text/plain", Constants.DEFAULT_ENCODING)), true); }
protected void putAclImpl(String bucketName, String objectKey, AccessControlList acl, String versionId) throws ServiceException { if(log.isDebugEnabled()) { log.debug("Setting Access Control List for bucketName=" + bucketName + ", objectKey=" + objectKey); } Map<String, String> requestParameters = new HashMap<String, String>(); requestParameters.put("acl", ""); if(versionId != null) { requestParameters.put("versionId", versionId); } Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("Content-Type", "text/plain"); String aclAsXml = acl.toXml(); metadata.put("Content-Length", String.valueOf(aclAsXml.length())); performRestPut(bucketName, objectKey, metadata, requestParameters, new StringEntity(aclAsXml, ContentType.create("text/plain", Constants.DEFAULT_ENCODING)), true); }
protected HttpResponseAndByteCount performRestPutWithXmlBuilder(String bucketName, String objectKey, Map<String, Object> metadata, Map<String, String> requestParameters, XMLBuilder builder) throws ServiceException { try { if(metadata == null) { metadata = new HashMap<String, Object>(); } if(!metadata.containsKey("content-type")) { metadata.put("Content-Type", "text/plain"); } String xml = builder.asString(null); return performRestPut(bucketName, objectKey, metadata, requestParameters, new StringEntity(xml, ContentType.create("text/plain", Constants.DEFAULT_ENCODING)), true); } catch(TransformerException e) { throw new ServiceException("Failed to PUT request containing an XML document", e); } }
protected void setWebsiteConfigImpl(String bucketName, WebsiteConfig config) throws ServiceException { Map<String, String> requestParameters = new HashMap<String, String>(); requestParameters.put(this.isTargettingGoogleStorageService() ? "websiteConfig" : "website", ""); Map<String, Object> metadata = new HashMap<String, Object>(); String xml; try { xml = config.toXml(); } catch(Exception e) { throw new ServiceException("Unable to build WebsiteConfig XML document", e); } performRestPut(bucketName, null, metadata, requestParameters, new StringEntity(xml, ContentType.create("text/plain", Constants.DEFAULT_ENCODING)), true); }
protected HttpResponseAndByteCount performRestPutWithXmlBuilder(String bucketName, String objectKey, Map<String, Object> metadata, Map<String, String> requestParameters, XMLBuilder builder) throws ServiceException { try { if(metadata == null) { metadata = new HashMap<String, Object>(); } if(!metadata.containsKey("content-type")) { metadata.put("Content-Type", "text/plain"); } String xml = builder.asString(null); return performRestPut(bucketName, objectKey, metadata, requestParameters, new StringEntity(xml, ContentType.create("text/plain", Constants.DEFAULT_ENCODING)), true); } catch(TransformerException e) { throw new ServiceException("Failed to PUT request containing an XML document", e); } }
protected void setWebsiteConfigImpl(String bucketName, WebsiteConfig config) throws ServiceException { Map<String, String> requestParameters = new HashMap<String, String>(); requestParameters.put(this.isTargettingGoogleStorageService() ? "websiteConfig" : "website", ""); Map<String, Object> metadata = new HashMap<String, Object>(); String xml; try { xml = config.toXml(); } catch(Exception e) { throw new ServiceException("Unable to build WebsiteConfig XML document", e); } performRestPut(bucketName, null, metadata, requestParameters, new StringEntity(xml, ContentType.create("text/plain", Constants.DEFAULT_ENCODING)), true); }
protected void setBucketLoggingStatusImpl(String bucketName, StorageBucketLoggingStatus status) throws ServiceException { if(log.isDebugEnabled()) { log.debug("Setting Logging Status for bucket: " + bucketName); } Map<String, String> requestParameters = new HashMap<String, String>(); requestParameters.put("logging", ""); Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("Content-Type", "text/plain"); String statusAsXml; try { statusAsXml = status.toXml(); } catch(Exception e) { throw new ServiceException("Unable to generate LoggingStatus XML document", e); } try { performRestPut(bucketName, null, metadata, requestParameters, new StringEntity(statusAsXml, ContentType.create("text/plain", Constants.DEFAULT_ENCODING)), true); } catch(ServiceException se) { throw new ServiceException(se); } }
protected void setBucketLoggingStatusImpl(String bucketName, StorageBucketLoggingStatus status) throws ServiceException { if(log.isDebugEnabled()) { log.debug("Setting Logging Status for bucket: " + bucketName); } Map<String, String> requestParameters = new HashMap<String, String>(); requestParameters.put("logging", ""); Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("Content-Type", "text/plain"); String statusAsXml; try { statusAsXml = status.toXml(); } catch(Exception e) { throw new ServiceException("Unable to generate LoggingStatus XML document", e); } try { performRestPut(bucketName, null, metadata, requestParameters, new StringEntity(statusAsXml, ContentType.create("text/plain", Constants.DEFAULT_ENCODING)), true); } catch(ServiceException se) { throw new ServiceException(se); } }
HttpResponseAndByteCount methodAndByteCount = performRestPut( bucketName, objectKey, metadata, requestParams, requestEntity, true);
HttpResponseAndByteCount methodAndByteCount = performRestPut( bucketName, objectKey, metadata, requestParams, requestEntity, true);
HttpResponseAndByteCount methodAndByteCount = performRestPut( destinationBucketName, destinationObjectKey, metadata, null, null, false);
HttpResponseAndByteCount methodAndByteCount = performRestPut( destinationBucketName, destinationObjectKey, metadata, null, null, false);