[ 
https://issues.apache.org/jira/browse/JCLOUDS-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14064933#comment-14064933
 ] 

Chris Graybeal commented on JCLOUDS-630:
----------------------------------------

That is exactly what I tried to do (edited for visibility)


//App.java
Main(...)
{ 

Date expDate = new Date(114, 7, 16, 14, 50, 0); 
jcloudsSwift.uploadObjectFromFile(toUpload, "testFileObject12", 
"testContainer", expDate); 
SwiftObject so = jcloudsSwift.getSwiftObject("testFileObject12", 
"testContainer"); System.out.println("last modified: " + so.getLastModified()); 
System.out.println("metadata: " + so.getMetadata().toString()); 
System.out.println("payload metadata: " + 
so.getPayload().getContentMetadata()); System.out.println("expires at: " + 
so.getPayload().getContentMetadata().getExpires()); 

}


//JCloudsSwift.java
public void uploadObjectFromFile(File objectFile, String objectName, String 
containerName, Date expirationDate)
{ 

ObjectApi objectApi = swiftApi.getObjectApiForRegionAndContainer( "RegionOne", 
containerName); 
Payload payload = new FilePayload(objectFile); 
payload.getContentMetadata().setExpires(expirationDate); 
Map<String, String> metadataMap = new HashMap<String, String>(); 
metadataMap.put("X-Delete-At", Long.toString(expirationDate.getTime())); 
objectApi.put(objectName, payload,PutOptions.Builder.metadata(metadataMap)); 

}


I tried setting "X-Delete-At" in the object metadata and "Expires" in the 
payload metadata. When debugging I found that both were set all the way to the 
line objectApi.put(.....). However when I read the object back and printed 
their metadata, the object's "X-Delete-At" is set, but the payloads "expires" 
is null. In addition, none of the objects I create this way are deleting upon 
expiration date.


//Console
last modified: Thu Jul 17 09:50:06 EDT 2014
metadata:
{x-delete-at=1408283520000}
payload metadata: [contentDisposition=null, contentEncoding=null, 
contentLanguage=null, contentLength=5348, contentMD5=null, 
contentType=application/unknown, expires=null]

> ObjectAPI
> ---------
>
>                 Key: JCLOUDS-630
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-630
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-labs-openstack
>    Affects Versions: 1.7.3
>         Environment: Windows 7
>            Reporter: Chris Graybeal
>            Assignee: Jeremy Daggett
>
> The payload content metadata, specifically "expires", does not seem to be 
> passed along to the swift object created when ObjectAPI runs put(....)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to