Skip to content

Commit

Permalink
JCLOUDS-1337: jdbc putBlob portable storage tiers
Browse files Browse the repository at this point in the history
  • Loading branch information
gaul committed Oct 23, 2017
1 parent 32e7a65 commit adb4087
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Expand Up @@ -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;
}

Expand Down
21 changes: 19 additions & 2 deletions jdbc/src/main/java/org/jclouds/jdbc/entity/BlobEntity.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
}

Expand Down
Expand Up @@ -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()));
Expand Down

0 comments on commit adb4087

Please sign in to comment.