From d1bd551edf48b971bdcad24677e4bb7cca1f8fa0 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Mon, 21 Jul 2014 12:24:44 -0700 Subject: [PATCH] Add support for filesystem last modified --- .../internal/FilesystemStorageStrategyImpl.java | 5 ++++- .../integration/FilesystemBlobIntegrationTest.java | 10 ---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java index cbbb02763d..86fd381fba 100644 --- a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java +++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java @@ -22,6 +22,7 @@ import static com.google.common.io.BaseEncoding.base16; import java.io.File; import java.io.IOException; +import java.util.Date; import java.util.Set; import javax.annotation.Resource; @@ -178,7 +179,8 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy { public Blob getBlob(final String container, final String key) { BlobBuilder builder = blobBuilders.get(); builder.name(key); - ByteSource byteSource = Files.asByteSource(getFileForBlobKey(container, key)); + File file = getFileForBlobKey(container, key); + ByteSource byteSource = Files.asByteSource(file); try { builder.payload(byteSource) .contentLength(byteSource.size()) @@ -189,6 +191,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy { } Blob blob = builder.build(); blob.getMetadata().setContainer(container); + blob.getMetadata().setLastModified(new Date(file.lastModified())); if (blob.getPayload().getContentMetadata().getContentMD5() != null) blob.getMetadata().setETag(base16().lowerCase().encode(blob.getPayload().getContentMetadata().getContentMD5())); return blob; diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemBlobIntegrationTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemBlobIntegrationTest.java index ef31fc4878..de8516c64a 100644 --- a/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemBlobIntegrationTest.java +++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemBlobIntegrationTest.java @@ -62,14 +62,4 @@ public class FilesystemBlobIntegrationTest extends BaseBlobIntegrationTest { public void testCreateBlobWithExpiry() throws InterruptedException { throw new SkipException("requires Java 7 xattr support"); } - - @Override - public void testGetIfModifiedSince() throws InterruptedException { - throw new SkipException("requires Java 7 xattr support"); - } - - @Override - public void testGetIfUnmodifiedSince() throws InterruptedException { - throw new SkipException("requires Java 7 xattr support"); - } }