From b95809046adc899f786ba03f9217758100d821ca Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sun, 29 Oct 2017 17:26:34 -0700 Subject: [PATCH] Add mtime support to Atmos directory listing --- ...DirectoryEntryListToResourceMetadataList.java | 2 +- .../org/jclouds/atmos/domain/DirectoryEntry.java | 15 +++++++++++++++ .../atmos/xml/ListDirectoryResponseHandler.java | 16 +++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/functions/DirectoryEntryListToResourceMetadataList.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/functions/DirectoryEntryListToResourceMetadataList.java index f04100f1cb..b14dd8503b 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/functions/DirectoryEntryListToResourceMetadataList.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/functions/DirectoryEntryListToResourceMetadataList.java @@ -59,7 +59,7 @@ public class DirectoryEntryListToResourceMetadataList implements .get(), null, null, null, null, ImmutableMap.of()); else { BlobMetadataImpl metadata = new BlobMetadataImpl(from.getObjectID(), from.getObjectName(), defaultLocation.get(), - null, null, null, null, ImmutableMap.of(), null, + null, null, null, from.getModifiedTime(), ImmutableMap.of(), null, null, new BaseMutableContentMetadata()); MutableBlobMetadataImpl mutable = new MutableBlobMetadataImpl(metadata); mutable.setSize(from.getSize()); diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/domain/DirectoryEntry.java b/apis/atmos/src/main/java/org/jclouds/atmos/domain/DirectoryEntry.java index b6579732dd..40c2cdbb16 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/domain/DirectoryEntry.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/domain/DirectoryEntry.java @@ -16,6 +16,10 @@ */ package org.jclouds.atmos.domain; +import java.util.Date; + +import org.jclouds.javax.annotation.Nullable; + import com.google.common.base.Objects; /** @@ -26,12 +30,19 @@ public class DirectoryEntry implements Comparable { private final FileType type; private final String objname; private final long size; + @Nullable private final Date modifiedTime; + @Deprecated public DirectoryEntry(String objectid, FileType type, String objname, long size) { + this(objectid, type, objname, size, null); + } + + public DirectoryEntry(String objectid, FileType type, String objname, long size, Date modifiedTime) { this.objectid = objectid; this.objname = objname; this.type = type; this.size = size; + this.modifiedTime = modifiedTime != null ? (Date) modifiedTime.clone() : null; } public String getObjectID() { @@ -50,6 +61,10 @@ public class DirectoryEntry implements Comparable { return size; } + public Date getModifiedTime() { + return modifiedTime != null ? (Date) modifiedTime.clone() : null; + } + public int compareTo(DirectoryEntry o) { if (getObjectName() == null) return -1; diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/xml/ListDirectoryResponseHandler.java b/apis/atmos/src/main/java/org/jclouds/atmos/xml/ListDirectoryResponseHandler.java index ffe1a4a599..3109708cf9 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/xml/ListDirectoryResponseHandler.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/xml/ListDirectoryResponseHandler.java @@ -16,10 +16,14 @@ */ package org.jclouds.atmos.xml; +import java.util.Date; import java.util.Set; +import javax.inject.Inject; + import org.jclouds.atmos.domain.DirectoryEntry; import org.jclouds.atmos.domain.FileType; +import org.jclouds.date.DateService; import org.jclouds.http.functions.ParseSax; import com.google.common.collect.Sets; @@ -37,12 +41,20 @@ public class ListDirectoryResponseHandler extends ParseSax.HandlerWithResult getResult() { return entries; } @@ -61,9 +73,11 @@ public class ListDirectoryResponseHandler extends ParseSax.HandlerWithResult