Skip to content

Commit 8191258

Browse files
committed
---
yaml --- r: 5939 b: refs/heads/tswast-patch-1 c: 3b8f4e3 h: refs/heads/master i: 5937: f007542 5935: fc0a976
1 parent 5db62ad commit 8191258

2 files changed

Lines changed: 109 additions & 34 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: 9dbd7c957205b26c6b601be8f812898e33745ec4
60+
refs/heads/tswast-patch-1: 3b8f4e36c1aae0293f4277d26fb62f36e7c45b39
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/src/main/java/com/google/gcloud/storage/ObjectInfo.java

Lines changed: 108 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ public class ObjectInfo implements Serializable {
3434
private static final long serialVersionUID = 2228487739943277159L;
3535

3636
private final String bucket;
37+
private final String id;
3738
private final String name;
38-
private final String contentType;
39+
private final String selfLink;
3940
private final String cacheControl;
4041
private final ImmutableList<Acl> acl;
41-
private final String owner;
42+
private final Acl.Entity owner;
4243
private final long size;
43-
private final String contentEncoding;
44+
private final String etag;
4445
private final String md5;
4546
private final String crc32c;
4647
private final String mediaLink;
@@ -49,17 +50,28 @@ public class ObjectInfo implements Serializable {
4950
private final long metageneration;
5051
private final long deleteTime;
5152
private final long updateTime;
53+
private final String contentType;
54+
private final String contentEncoding;
55+
private final String contentDisposition;
56+
private final String contentLanguage;
57+
private final int componentCount;
5258

5359
public static final class Builder {
5460

5561
private String bucket;
62+
private String id;
5663
private String name;
5764
private String contentType;
65+
private String contentEncoding;
66+
private String contentDisposition;
67+
private String contentLanguage;
68+
private int componentCount;
5869
private String cacheControl;
5970
private ImmutableList<Acl> acl;
60-
private String owner;
71+
private Acl.Entity owner;
6172
private long size;
62-
private String contentEncoding;
73+
private String etag;
74+
private String selfLink;
6375
private String md5;
6476
private String crc32c;
6577
private String mediaLink;
@@ -77,6 +89,11 @@ public Builder bucket(String bucket) {
7789
return this;
7890
}
7991

92+
Builder id(String id) {
93+
this.id = id;
94+
return this;
95+
}
96+
8097
public Builder name(String name) {
8198
this.name = name;
8299
return this;
@@ -87,6 +104,26 @@ public Builder contentType(String contentType) {
87104
return this;
88105
}
89106

107+
Builder contentDisposition(String contentDisposition) {
108+
this.contentDisposition = contentDisposition;
109+
return this;
110+
}
111+
112+
Builder contentLanguage(String contentLanguage) {
113+
this.contentLanguage = contentLanguage;
114+
return this;
115+
}
116+
117+
public Builder contentEncoding(String contentEncoding) {
118+
this.contentEncoding = contentEncoding;
119+
return this;
120+
}
121+
122+
Builder componentCount(int componentCount) {
123+
this.componentCount = componentCount;
124+
return this;
125+
}
126+
90127
public Builder cacheControl(String cacheControl) {
91128
this.cacheControl = cacheControl;
92129
return this;
@@ -97,7 +134,7 @@ public Builder acl(List<Acl> acl) {
97134
return this;
98135
}
99136

100-
public Builder owner(String owner) {
137+
public Builder owner(Acl.Entity owner) {
101138
this.owner = owner;
102139
return this;
103140
}
@@ -107,8 +144,13 @@ public Builder size(long size) {
107144
return this;
108145
}
109146

110-
public Builder contentEncoding(String contentEncoding) {
111-
this.contentEncoding = contentEncoding;
147+
Builder etag(String etag) {
148+
this.etag = etag;
149+
return this;
150+
}
151+
152+
Builder selfLink(String selfLink) {
153+
this.selfLink = selfLink;
112154
return this;
113155
}
114156

@@ -159,13 +201,19 @@ public ObjectInfo build() {
159201

160202
private ObjectInfo(Builder builder) {
161203
bucket = builder.bucket;
204+
id = builder.id;
162205
name = builder.name;
163-
contentType = builder.contentType;
164206
cacheControl = builder.cacheControl;
207+
contentEncoding = builder.contentEncoding;
208+
contentType = builder.contentType;
209+
contentDisposition = builder.contentDisposition;
210+
contentLanguage = builder.contentLanguage;
211+
componentCount = builder.componentCount;
165212
acl = builder.acl;
166213
owner = builder.owner;
167214
size = builder.size;
168-
contentEncoding = builder.contentEncoding;
215+
etag = builder.etag;
216+
selfLink = builder.selfLink;
169217
md5 = builder.md5;
170218
crc32c = builder.crc32c;
171219
mediaLink = builder.mediaLink;
@@ -180,12 +228,12 @@ public String bucket() {
180228
return bucket;
181229
}
182230

183-
public String name() {
184-
return name;
231+
public String id() {
232+
return id;
185233
}
186234

187-
public String contentType() {
188-
return contentType;
235+
public String name() {
236+
return name;
189237
}
190238

191239
public String cacheControl() {
@@ -196,18 +244,42 @@ public List<Acl> acl() {
196244
return acl;
197245
}
198246

199-
public String owner() {
247+
public Acl.Entity owner() {
200248
return owner;
201249
}
202250

203251
public long size() {
204252
return size;
205253
}
206254

255+
public String contentType() {
256+
return contentType;
257+
}
258+
207259
public String contentEncoding() {
208260
return contentEncoding;
209261
}
210262

263+
public String contentDisposition() {
264+
return contentDisposition;
265+
}
266+
267+
public String contentLanguage() {
268+
return contentEncoding;
269+
}
270+
271+
public int componentCount() {
272+
return componentCount;
273+
}
274+
275+
public String etag() {
276+
return etag;
277+
}
278+
279+
public String selfLink() {
280+
return selfLink;
281+
}
282+
211283
public String md5() {
212284
return md5;
213285
}
@@ -257,8 +329,13 @@ public Builder toBuilder() {
257329
.name(name)
258330
.owner(owner)
259331
.updateTime(updateTime)
260-
.size(size);
261-
332+
.size(size)
333+
.contentDisposition(contentDisposition)
334+
.componentCount(componentCount)
335+
.contentLanguage(contentLanguage)
336+
.etag(etag)
337+
.id(id)
338+
.selfLink(selfLink);
262339
}
263340

264341
public static Builder builder() {
@@ -286,16 +363,15 @@ public ObjectAccessControl apply(Acl acl) {
286363
storageObject.setMetadata(metadata);
287364
storageObject.setMetageneration(metageneration);
288365
storageObject.setName(name);
289-
storageObject.setOwner(owner);
366+
storageObject.setOwner(new StorageObject.Owner().setEntity(owner.toPb()));
290367
storageObject.setUpdated(new DateTime(updateTime));
291368
storageObject.setSize(BigInteger.valueOf(size));
292-
storageObject.setContentDisposition();
293-
storageObject.setComponentCount();
294-
storageObject.setContentLanguage();
295-
storageObject.setEtag();
296-
storageObject.setId();
297-
storageObject.setSelfLink();
298-
storageObject.setStorageClass();
369+
storageObject.setContentDisposition(contentDisposition);
370+
storageObject.setComponentCount(componentCount);
371+
storageObject.setContentLanguage(contentLanguage);
372+
storageObject.setEtag(etag);
373+
storageObject.setId(id);
374+
storageObject.setSelfLink(selfLink);
299375
return storageObject;
300376
}
301377

@@ -319,16 +395,15 @@ static ObjectInfo fromPb(StorageObject storageObject) {
319395
.metadata(storageObject.getMetadata())
320396
.metageneration(storageObject.getMetageneration())
321397
.name(storageObject.getName())
322-
.owner(storageObject.getName())
398+
.owner(Acl.Entity.fromPb(storageObject.getOwner().getEntity()))
323399
.updateTime(storageObject.getUpdated().getValue())
324400
.size(storageObject.getSize().longValue())
401+
.contentDisposition(storageObject.getContentDisposition())
402+
.componentCount(storageObject.getComponentCount())
403+
.contentLanguage(storageObject.getContentLanguage())
404+
.etag(storageObject.getEtag())
405+
.id(storageObject.getId())
406+
.selfLink(storageObject.getSelfLink())
325407
.build();
326-
storageObject.setContentDisposition();
327-
storageObject.setComponentCount();
328-
storageObject.setContentLanguage();
329-
storageObject.setEtag();
330-
storageObject.setId();
331-
storageObject.setSelfLink();
332-
storageObject.setStorageClass();
333408
}
334409
}

0 commit comments

Comments
 (0)