Skip to content
Permalink
Browse files
JCLOUDS-1337: jdbc putBlob portable storage tiers
  • Loading branch information
gaul committed Oct 23, 2017
1 parent 32e7a65 commit adb4087ab1c37bf8435b293778767e312d89e18b
Showing 3 changed files with 21 additions and 2 deletions.
@@ -76,6 +76,7 @@ public Blob apply(BlobEntity blobEntity) {
HashCode.fromBytes(payload.getContentMD5()));
blob.getMetadata().setETag(blobEntity.getEtag());
blob.getMetadata().getContentMetadata().setExpires(payload.getExpires());
blob.getMetadata().setTier(blobEntity.getTier());
return blob;
}

@@ -17,6 +17,7 @@
package org.jclouds.jdbc.entity;

import org.jclouds.blobstore.domain.BlobAccess;
import org.jclouds.blobstore.domain.Tier;

import javax.persistence.CascadeType;
import javax.persistence.ElementCollection;
@@ -54,6 +55,7 @@ public class BlobEntity {
private Date creationDate;
private Date lastModified;
private BlobAccess blobAccess;
private Tier tier;
private Long size;
private String etag;
private boolean directory;
@@ -73,13 +75,14 @@ public BlobEntity() {
}

public BlobEntity(ContainerEntity containerEntity, String key, PayloadEntity payload, Date creationDate, Date lastModified,
BlobAccess blobAccess, Map<String, String> userMetadata, Long size, String etag, boolean directory) {
BlobAccess blobAccess, Tier tier, Map<String, String> userMetadata, Long size, String etag, boolean directory) {
this.containerEntity = containerEntity;
this.key = key;
this.creationDate = creationDate;
this.lastModified = lastModified;
this.payload = payload;
this.blobAccess = blobAccess;
this.tier = tier;
this.userMetadata = userMetadata;
this.size = size;
this.etag = etag;
@@ -142,6 +145,14 @@ public void setBlobAccess(BlobAccess blobAccess) {
this.blobAccess = blobAccess;
}

public Tier getTier() {
return tier;
}

public void setTier(Tier tier) {
this.tier = tier;
}

public Map<String, String> getUserMetadata() {
return userMetadata;
}
@@ -175,6 +186,7 @@ public static class Builder {
private String key;
private PayloadEntity payload;
private BlobAccess blobAccess;
private Tier tier;
private Long size;
private String etag;
private Map<String, String> userMetadata;
@@ -191,6 +203,11 @@ public Builder blobAccess(BlobAccess blobAccess) {
return this;
}

public Builder tier(Tier tier) {
this.tier = tier;
return this;
}

public Builder payload(PayloadEntity payload) {
this.payload = payload;
return this;
@@ -217,7 +234,7 @@ public Builder directory(boolean directory) {
}

public BlobEntity build() {
return new BlobEntity(containerEntity, key, payload, null, null, blobAccess, userMetadata, size, etag, directory);
return new BlobEntity(containerEntity, key, payload, null, null, blobAccess, tier, userMetadata, size, etag, directory);
}
}

@@ -130,6 +130,7 @@ public BlobEntity createOrModifyBlob(String containerName, Blob blob, BlobAccess
blobEntity.setContainerEntity(containerRepository.findContainerByName(containerName));
blobEntity.setKey(key);
blobEntity.setBlobAccess(blobAccess);
blobEntity.setTier(blob.getMetadata().getTier());
blobEntity.setCreationDate(creationDate);
blobEntity.setLastModified(new Date());
blobEntity.setEtag(base16().lowerCase().encode(actualHashCode.asBytes()));

0 comments on commit adb4087

Please sign in to comment.