~ubuntu-branches/ubuntu/natty/eucalyptus/natty-updates

« back to all changes in this revision

Viewing changes to clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/Walrus.groovy

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2009-12-17 18:22:02 UTC
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: james.westby@ubuntu.com-20091217182202-0v2v09ry3cxrvh84
Tags: upstream-1.6.2~bzr1103
ImportĀ upstreamĀ versionĀ 1.6.2~bzr1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package edu.ucsb.eucalyptus.msgs
1
2
/*******************************************************************************
2
3
*Copyright (c) 2009  Eucalyptus Systems, Inc.
3
4
58
59
*    WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT NEEDED TO COMPLY WITH
59
60
*    ANY SUCH LICENSES OR RIGHTS.
60
61
*******************************************************************************/
61
 
package edu.ucsb.eucalyptus.msgs
 
62
import java.util.Date;
62
63
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
63
64
import org.jboss.netty.channel.Channel;
 
65
import edu.ucsb.eucalyptus.cloud.BucketLogData;
64
66
 
65
67
/*
66
68
 *
67
 
 * Author: Sunil Soman sunils@cs.ucsb.edu
 
69
 * Author: Neil Soman <neil@eucalyptus.com>
68
70
 */
69
71
public class WalrusResponseType extends EucalyptusMessage {
 
72
        BucketLogData logData;
70
73
        def WalrusResponseType() {}
71
74
}
72
75
 
75
78
        protected Date timeStamp;
76
79
        protected String signature;
77
80
        protected String credential;
 
81
        BucketLogData logData;
 
82
        protected String bucket;
 
83
        protected String key;
 
84
 
78
85
        def WalrusRequestType() {}
79
 
        
80
 
        def WalrusRequestType(String accessKeyID, Date timeStamp, String signature, String credential) {
 
86
 
 
87
  def WalrusRequestType( String bucket, String key ) {
 
88
    this.bucket = bucket;
 
89
    this.key = key;
 
90
  }
 
91
 
 
92
  def WalrusRequestType(String accessKeyID, Date timeStamp, String signature, String credential) {
81
93
                this.accessKeyID = accessKeyID;
82
94
                this.timeStamp = timeStamp;
83
95
                this.signature = signature;
84
96
                this.credential = credential;
85
97
        }
86
 
        
 
98
 
87
99
        public String getAccessKeyID() {
88
100
                return accessKeyID;
89
101
        }
90
 
        
 
102
 
91
103
        public void setAccessKeyID(String accessKeyID) {
92
104
                this.accessKeyID = accessKeyID;
93
105
        }
94
 
        
 
106
 
95
107
        public String getCredential() {
96
108
                return credential;
97
109
        }
98
 
        
 
110
 
99
111
        public void setCredential(String credential) {
100
112
                this.credential = credential;
101
113
        }
 
114
 
 
115
        public String getBucket() {
 
116
                return bucket;
 
117
        }
 
118
 
 
119
        public void setBucket(String bucket) {
 
120
                this.bucket = bucket;
 
121
        }
 
122
        
 
123
        public String getKey() {
 
124
                return key;
 
125
        }
 
126
 
 
127
        public void setKey(String key) {
 
128
                this.key = key;
 
129
        }
102
130
}
103
131
 
104
132
public class WalrusDeleteType extends WalrusRequestType {
110
138
public class CanonicalUserType extends EucalyptusData {
111
139
        String ID;
112
140
        String DisplayName;
113
 
        
 
141
 
114
142
        public CanonicalUserType() {}
115
 
        
 
143
 
116
144
        public CanonicalUserType (String ID, String DisplayName) {
117
145
                this.ID = ID;
118
146
                this.DisplayName = DisplayName;
121
149
 
122
150
public class Group extends EucalyptusData {
123
151
        String uri;
124
 
        
 
152
 
125
153
        public Group() {}
126
 
        
 
154
 
127
155
        public Group(String uri) {
128
156
                this.uri = uri;
129
157
        }
134
162
        AccessControlPolicyType(CanonicalUserType owner, AccessControlListType acl) {
135
163
                this.owner = owner; this.accessControlList = acl;
136
164
        }
137
 
        
 
165
 
138
166
        CanonicalUserType owner;
139
167
        AccessControlListType accessControlList;
140
168
}
143
171
        CanonicalUserType canonicalUser;
144
172
        Group group;
145
173
        String type;
146
 
        
 
174
 
147
175
        public Grantee() {}
148
 
        
 
176
 
149
177
        public Grantee(CanonicalUserType canonicalUser) {
150
178
                this.canonicalUser = canonicalUser;
151
179
                type = "CanonicalUser";
152
180
        }
153
 
        
 
181
 
154
182
        public Grantee(Group group) {
155
183
                this.group = group;
156
184
                type = "Group";
160
188
public class Grant extends EucalyptusData {
161
189
        Grantee grantee;
162
190
        String permission;
163
 
        
 
191
 
164
192
        public Grant() {}
165
 
        
 
193
 
166
194
        public Grant(Grantee grantee, String permission) {
167
195
                this.grantee = grantee;
168
196
                this.permission = permission;
173
201
        ArrayList<Grant> grants = new ArrayList<Grant>();
174
202
}
175
203
 
176
 
public class GetBucketAccessControlPolicyResponseType extends EucalyptusMessage {
 
204
public class GetBucketAccessControlPolicyResponseType extends WalrusResponseType {
177
205
        AccessControlPolicyType accessControlPolicy;
178
206
}
179
207
 
180
208
public class GetBucketAccessControlPolicyType extends WalrusRequestType {
181
 
        String bucket;
182
209
}
183
210
 
184
 
public class GetObjectAccessControlPolicyResponseType extends EucalyptusMessage {
 
211
public class GetObjectAccessControlPolicyResponseType extends WalrusResponseType {
185
212
        AccessControlPolicyType accessControlPolicy;
186
213
}
187
214
 
188
215
public class GetObjectAccessControlPolicyType extends WalrusRequestType {
189
 
        String bucket;
190
 
        String key;
191
216
}
192
217
 
193
218
public class WalrusErrorMessageType extends EucalyptusMessage {
198
223
        protected String resource;
199
224
        protected String requestId;
200
225
        protected String hostId;
201
 
 
 
226
        BucketLogData logData;
 
227
        
202
228
        def WalrusErrorMessageType() {}
203
229
 
204
230
        def WalrusErrorMessageType(String message,
207
233
                        String resourceType,
208
234
                        String resource,
209
235
                        String requestId,
210
 
                        String hostId) {
 
236
                        String hostId,
 
237
                        BucketLogData logData) {
211
238
                this.message = message;
212
239
                this.code = code;
213
240
                this.status = status;
215
242
                this.resource = resource;
216
243
                this.requestId = requestId;
217
244
                this.hostId = hostId;
 
245
                this.logData = logData;
218
246
        }
219
 
        
 
247
 
220
248
        public HttpResponseStatus getStatus() {
221
249
                return status;
222
250
        }
240
268
 
241
269
public class WalrusRedirectMessageType extends WalrusErrorMessageType {
242
270
        private String redirectUrl;
243
 
        
 
271
 
244
272
        def WalrusRedirectMessageType() {
245
273
                this.code = 301;
246
274
        }
247
 
        
 
275
 
248
276
        def WalrusRedirectMessageType(String redirectUrl) {
249
277
                this.redirectUrl = redirectUrl;
250
278
                this.code = 301;
251
279
        }
252
 
        
 
280
 
253
281
        public String toString() {
254
282
                return "WalrusRedirectMessage:" +  redirectUrl;
255
283
        }
256
 
        
 
284
 
257
285
        public String getRedirectUrl() {
258
286
                return redirectUrl;
259
287
        }
271
299
public class BucketListEntry extends EucalyptusData {
272
300
        String name;
273
301
        String creationDate;
274
 
        
 
302
 
275
303
        public BucketListEntry() {
276
304
        }
277
 
        
 
305
 
278
306
        public BucketListEntry(String name, String creationDate) {
279
307
                this.name = name;
280
308
                this.creationDate = creationDate;
286
314
}
287
315
 
288
316
public class CreateBucketType extends WalrusRequestType {
289
 
        String bucket;
290
317
        AccessControlListType accessControlList;
291
318
        String locationConstraint;
292
 
        
 
319
 
293
320
        //For unit testing
294
321
        public CreateBucketType() {
295
322
        }
296
 
        
 
323
 
297
324
        public CreateBucketType(String bucket) {
298
325
                this.bucket = bucket;
299
326
        }
304
331
}
305
332
 
306
333
public class DeleteBucketType extends WalrusDeleteType {
307
 
        String bucket;
308
334
}
309
335
 
310
336
public class DeleteBucketResponseType extends WalrusDeleteResponseType {
317
343
}
318
344
 
319
345
public class WalrusDataRequestType extends WalrusRequestType {
320
 
        String bucket;
321
 
        String key;
322
346
        String randomKey;
323
347
        Boolean isCompressed;
324
 
        
 
348
 
325
349
        def WalrusDataRequestType() {
326
350
        }
327
 
        
328
 
        def WalrusDataRequestType(String bucket, String key) {
329
 
                this.bucket = bucket;
330
 
                this.key = key;
331
 
        }
 
351
 
 
352
  def WalrusDataRequestType( String bucket, String key ) {
 
353
    super( bucket, key );
 
354
  }  
 
355
  
332
356
}
333
357
 
334
358
public class WalrusDataResponseType extends WalrusResponseType {
347
371
        public Channel getChannel() {
348
372
                return channel;
349
373
        }
350
 
        
 
374
 
351
375
        public void setChannel(Channel channel) {
352
376
                this.channel = channel;
353
377
        }
354
 
        
 
378
 
355
379
        def WalrusDataGetRequestType() {}
356
 
        
 
380
 
357
381
        def WalrusDataGetRequestType(String bucket, String key) {
358
382
                super(bucket, key);
359
383
        }
385
409
        String storageClass;
386
410
        String contentType;
387
411
        String contentDisposition;
388
 
        
 
412
 
389
413
        def PutObjectType() {}
390
414
}
391
415
 
432
456
}
433
457
 
434
458
public class DeleteObjectType extends WalrusDeleteType {
435
 
        String bucket;
436
 
        String key;
437
459
}
438
460
 
439
461
public class DeleteObjectResponseType extends WalrusDeleteResponseType {
442
464
}
443
465
 
444
466
public class ListBucketType extends WalrusRequestType {
445
 
        String bucket;
446
467
        String prefix;
447
468
        String marker;
448
469
        String maxKeys;
473
494
 
474
495
public class PrefixEntry extends EucalyptusData {
475
496
        String prefix;
476
 
        
 
497
 
477
498
        def PrefixEntry() {}
478
 
        
 
499
 
479
500
        def PrefixEntry(String prefix) {
480
501
                this.prefix = prefix;
481
502
        }
482
503
}
483
504
 
484
505
public class SetBucketAccessControlPolicyType extends WalrusRequestType {
485
 
        String bucket;
486
506
        AccessControlListType accessControlList;
487
507
}
488
508
 
492
512
}
493
513
 
494
514
public class SetObjectAccessControlPolicyType extends WalrusRequestType {
495
 
        String bucket;
496
 
        String key;
497
515
        AccessControlListType accessControlList;
498
516
}
499
517
 
503
521
}
504
522
 
505
523
public class SetRESTBucketAccessControlPolicyType extends WalrusRequestType {
506
 
        String bucket;
507
524
        AccessControlPolicyType accessControlPolicy;
508
525
}
509
526
 
513
530
}
514
531
 
515
532
public class SetRESTObjectAccessControlPolicyType extends WalrusRequestType {
516
 
        String bucket;
517
 
        String key;
518
533
        AccessControlPolicyType accessControlPolicy;
519
534
}
520
535
 
530
545
        Boolean inlineData;
531
546
        Boolean deleteAfterGet;
532
547
        Boolean getTorrent;
533
 
        
 
548
 
534
549
        def GetObjectType() {
535
550
        }
536
 
        
 
551
 
537
552
        def GetObjectType(final String bucketName, final String key, final Boolean getData, final Boolean getMetaData, final Boolean inlineData) {
538
553
                super( bucketName, key );
539
554
                this.getData = getData;
565
580
}
566
581
 
567
582
public class GetBucketLocationType extends WalrusRequestType {
568
 
        String bucket;
569
583
}
570
584
 
571
585
public class GetBucketLocationResponseType extends WalrusResponseType {
572
586
        String locationConstraint;
573
587
}
574
588
 
 
589
public class TargetGrants extends EucalyptusData {
 
590
        ArrayList<Grant> grants = new ArrayList<Grant>();
 
591
 
 
592
        def TargetGrants() {}
 
593
        def TargetGrants(List<Grant> grants) {
 
594
                this.grants = grants;
 
595
        }
 
596
}
 
597
 
 
598
public class LoggingEnabled extends EucalyptusData {
 
599
        String targetBucket;
 
600
        String targetPrefix;
 
601
        TargetGrants targetGrants;
 
602
 
 
603
        def LoggingEnabled() {}
 
604
        def LoggingEnabled(TargetGrants grants) {
 
605
                targetGrants = grants;
 
606
        }
 
607
        def LoggingEnabled(String bucket, String prefix, TargetGrants grants) {
 
608
                targetBucket = bucket;
 
609
                targetPrefix = prefix;
 
610
                targetGrants = grants;
 
611
        }
 
612
}
 
613
 
575
614
public class GetBucketLoggingStatusType extends WalrusRequestType {
576
 
        String bucket;
577
615
}
578
616
 
579
617
public class GetBucketLoggingStatusResponseType extends WalrusResponseType {
 
618
        LoggingEnabled loggingEnabled = new LoggingEnabled();
580
619
}
581
620
 
582
621
public class SetBucketLoggingStatusType extends WalrusRequestType {
583
 
        String bucket;
 
622
        LoggingEnabled loggingEnabled;
584
623
}
585
624
 
586
625
public class SetBucketLoggingStatusResponseType extends WalrusResponseType {
587
626
}
588
627
 
 
628
public class AddObjectResponseType extends WalrusDataResponseType {
 
629
 
 
630
}
 
631
 
 
632
public class AddObjectType extends WalrusDataRequestType {
 
633
        String objectName;
 
634
        String etag;
 
635
        AccessControlListType accessControlList = new AccessControlListType();  
 
636
}
 
637
 
589
638
public class UpdateWalrusConfigurationType extends WalrusRequestType {
590
639
        String name;
591
640
        String bucketRootDirectory;
665
714
}
666
715
 
667
716
public class FlushCachedImageType extends WalrusDataRequestType {
668
 
        
 
717
 
669
718
        def FlushCachedImageType(final String bucket, final String key) {
670
719
                super(bucket, key);
671
720
        }
672
 
        
 
721
 
673
722
        def FlushCachedImageType() {}
674
723
}
675
724
public class FlushCachedImageResponseType extends WalrusDataResponseType {
683
732
}
684
733
 
685
734
public class DeleteWalrusSnapshotType extends WalrusRequestType {
686
 
        String bucket;
687
 
        String key;
688
735
}
689
736
 
690
737
public class DeleteWalrusSnapshotResponseType extends WalrusResponseType {
701
748
        Long bytesOut;
702
749
        Integer numberOfBuckets;
703
750
        Long totalSpaceUsed;
704
 
        
 
751
 
705
752
        def WalrusUsageStatsRecord() {}
706
753
 
707
754
        def WalrusUsageStatsRecord(Long bytesIn, 
724
771
                                numberOfBuckets, 
725
772
                                totalSpaceUsed);
726
773
        }
727
 
        
 
774
 
728
775
        public static WalrusUsageStatsRecord create(Long bytesIn, Long bytesOut, Integer numberOfBuckets, Long totalSpaceUsed) {
729
776
                return new WalrusUsageStatsRecord(bytesIn, bytesOut, numberOfBuckets, totalSpaceUsed);
730
777
        }