JCLOUDS-948: Filesystem Cache-Control support

Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/82ad05e9
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/82ad05e9
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/82ad05e9

Branch: refs/heads/master
Commit: 82ad05e98eaab5e69d8a788b5a9162fdabfc78c9
Parents: 01e10bb
Author: Andrew Gaul <[email protected]>
Authored: Fri Jan 15 04:42:31 2016 -0800
Committer: Andrew Gaul <[email protected]>
Committed: Fri Jan 15 04:43:39 2016 -0800

----------------------------------------------------------------------
 .../strategy/internal/FilesystemStorageStrategyImpl.java        | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/82ad05e9/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
----------------------------------------------------------------------
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 893d944..91750d5 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
@@ -95,6 +95,7 @@ import com.google.common.primitives.Longs;
  */
 public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
 
+   private static final String XATTR_CACHE_CONTROL = "user.cache-control";
    private static final String XATTR_CONTENT_DISPOSITION = 
"user.content-disposition";
    private static final String XATTR_CONTENT_ENCODING = 
"user.content-encoding";
    private static final String XATTR_CONTENT_LANGUAGE = 
"user.content-language";
@@ -326,6 +327,7 @@ public class FilesystemStorageStrategyImpl implements 
LocalStorageStrategy {
          byteSource = Files.asByteSource(file);
       }
       try {
+         String cacheControl = null;
          String contentDisposition = null;
          String contentEncoding = null;
          String contentLanguage = null;
@@ -338,6 +340,7 @@ public class FilesystemStorageStrategyImpl implements 
LocalStorageStrategy {
          if (view != null) {
             Set<String> attributes = ImmutableSet.copyOf(view.list());
 
+            cacheControl = readStringAttributeIfPresent(view, attributes, 
XATTR_CACHE_CONTROL);
             contentDisposition = readStringAttributeIfPresent(view, 
attributes, XATTR_CONTENT_DISPOSITION);
             contentEncoding = readStringAttributeIfPresent(view, attributes, 
XATTR_CONTENT_ENCODING);
             contentLanguage = readStringAttributeIfPresent(view, attributes, 
XATTR_CONTENT_LANGUAGE);
@@ -370,6 +373,7 @@ public class FilesystemStorageStrategyImpl implements 
LocalStorageStrategy {
             }
 
             builder.payload(byteSource)
+               .cacheControl(cacheControl)
                .contentDisposition(contentDisposition)
                .contentEncoding(contentEncoding)
                .contentLanguage(contentLanguage)
@@ -397,6 +401,7 @@ public class FilesystemStorageStrategyImpl implements 
LocalStorageStrategy {
 
    private void writeCommonMetadataAttr(UserDefinedFileAttributeView view, 
Blob blob) throws IOException {
       ContentMetadata metadata = blob.getMetadata().getContentMetadata();
+      writeStringAttributeIfPresent(view, XATTR_CACHE_CONTROL, 
metadata.getCacheControl());
       writeStringAttributeIfPresent(view, XATTR_CONTENT_DISPOSITION, 
metadata.getContentDisposition());
       writeStringAttributeIfPresent(view, XATTR_CONTENT_ENCODING, 
metadata.getContentEncoding());
       writeStringAttributeIfPresent(view, XATTR_CONTENT_LANGUAGE, 
metadata.getContentLanguage());

Reply via email to