Skip to content

Commit

Permalink
Merge branch 'feature-jcloud-store-7.6' into feature-jcloud-store-9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Buckingham committed Sep 6, 2024
2 parents 8dc6567 + 4c69f0f commit 84648bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions dspace-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>eu.openaire</groupId>
<artifactId>broker-client</artifactId>
Expand Down Expand Up @@ -839,7 +839,7 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.findify</groupId>
<artifactId>s3mock_2.13</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

Expand Down Expand Up @@ -347,34 +349,34 @@ public static String getMIMEType(final Bitstream bitstream) {
}
}

@Override
@SuppressWarnings("unchecked")
public Map about(Bitstream bitstream, Map attrs) throws IOException {
public Map<String, Object> about(Bitstream bitstream, List<String> attrs) throws IOException {
File file = getFile(bitstream);
BlobStore blobStore = blobStoreContext.getBlobStore();
BlobMetadata blobMetadata = blobStore.blobMetadata(getContainer(), file.toString());
Map<String, Object> metadata = new HashMap<>();
if (blobMetadata != null) {
ContentMetadata contentMetadata = blobMetadata.getContentMetadata();

if (contentMetadata != null) {
attrs.put("size_bytes", String.valueOf(contentMetadata.getContentLength()));
metadata.put("size_bytes", String.valueOf(contentMetadata.getContentLength()));
final HashCode hashCode = contentMetadata.getContentMD5AsHashCode();
if (hashCode != null) {
attrs.put("checksum", Utils.toHex(contentMetadata.getContentMD5AsHashCode().asBytes()));
attrs.put("checksum_algorithm", CSA);
metadata.put("checksum", Utils.toHex(contentMetadata.getContentMD5AsHashCode().asBytes()));
metadata.put("checksum_algorithm", CSA);
}
attrs.put("modified", String.valueOf(blobMetadata.getLastModified().getTime()));
metadata.put("modified", String.valueOf(blobMetadata.getLastModified().getTime()));

attrs.put("ContentDisposition", contentMetadata.getContentDisposition());
attrs.put("ContentEncoding", contentMetadata.getContentEncoding());
attrs.put("ContentLanguage", contentMetadata.getContentLanguage());
attrs.put("ContentType", contentMetadata.getContentType());
metadata.put("ContentDisposition", contentMetadata.getContentDisposition());
metadata.put("ContentEncoding", contentMetadata.getContentEncoding());
metadata.put("ContentLanguage", contentMetadata.getContentLanguage());
metadata.put("ContentType", contentMetadata.getContentType());

if (contentMetadata.getExpires() != null) {
attrs.put("Expires", contentMetadata.getExpires().getTime());
metadata.put("Expires", contentMetadata.getExpires().getTime());
}
}
return attrs;
return metadata;
}
return null;
}
Expand Down

0 comments on commit 84648bc

Please sign in to comment.