1 | /** |
2 | * |
3 | * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com> |
4 | * |
5 | * ==================================================================== |
6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | * you may not use this file except in compliance with the License. |
8 | * You may obtain a copy of the License at |
9 | * |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * |
12 | * Unless required by applicable law or agreed to in writing, software |
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | * See the License for the specific language governing permissions and |
16 | * limitations under the License. |
17 | * ==================================================================== |
18 | */ |
19 | package org.jclouds.openstack.swift.domain.internal; |
20 | |
21 | import java.util.Date; |
22 | import java.util.Map; |
23 | |
24 | import org.jclouds.io.payloads.BaseMutableContentMetadata; |
25 | import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata; |
26 | import org.jclouds.openstack.swift.domain.ObjectInfo; |
27 | |
28 | /** |
29 | * |
30 | * @author Adrian Cole |
31 | * |
32 | */ |
33 | public class DelegatingMutableObjectInfoWithMetadata extends BaseMutableContentMetadata implements |
34 | MutableObjectInfoWithMetadata { |
35 | /** The serialVersionUID */ |
36 | private static final long serialVersionUID = 5280642704532078500L; |
37 | private final MutableObjectInfoWithMetadata delegate; |
38 | |
39 | public DelegatingMutableObjectInfoWithMetadata(MutableObjectInfoWithMetadata delegate) { |
40 | this.delegate = delegate; |
41 | } |
42 | |
43 | @Override |
44 | public Long getContentLength() { |
45 | return delegate.getBytes(); |
46 | } |
47 | |
48 | @Override |
49 | public String getContentType() { |
50 | return delegate.getContentType(); |
51 | } |
52 | |
53 | @Override |
54 | public byte[] getContentMD5() { |
55 | return delegate.getHash(); |
56 | } |
57 | |
58 | @Override |
59 | public int hashCode() { |
60 | return delegate.hashCode(); |
61 | } |
62 | |
63 | @Override |
64 | public void setContentLength(Long bytes) { |
65 | delegate.setBytes(bytes); |
66 | } |
67 | |
68 | @Override |
69 | public void setContentType(String contentType) { |
70 | delegate.setContentType(contentType); |
71 | } |
72 | |
73 | @Override |
74 | public void setContentMD5(byte[] hash) { |
75 | delegate.setHash(hash); |
76 | } |
77 | |
78 | public MutableObjectInfoWithMetadata getDelegate() { |
79 | return delegate; |
80 | } |
81 | |
82 | @Override |
83 | public Map<String, String> getMetadata() { |
84 | return delegate.getMetadata(); |
85 | } |
86 | |
87 | @Override |
88 | public void setBytes(Long bytes) { |
89 | delegate.setBytes(bytes); |
90 | } |
91 | |
92 | @Override |
93 | public void setHash(byte[] hash) { |
94 | delegate.setHash(hash); |
95 | } |
96 | |
97 | @Override |
98 | public void setLastModified(Date lastModified) { |
99 | delegate.setLastModified(lastModified); |
100 | } |
101 | |
102 | @Override |
103 | public void setName(String name) { |
104 | delegate.setName(name); |
105 | } |
106 | |
107 | @Override |
108 | public Long getBytes() { |
109 | return delegate.getBytes(); |
110 | } |
111 | |
112 | @Override |
113 | public byte[] getHash() { |
114 | return delegate.getHash(); |
115 | } |
116 | |
117 | @Override |
118 | public Date getLastModified() { |
119 | return delegate.getLastModified(); |
120 | } |
121 | |
122 | @Override |
123 | public String getName() { |
124 | return delegate.getName(); |
125 | } |
126 | |
127 | @Override |
128 | public int compareTo(ObjectInfo o) { |
129 | return delegate.compareTo(o); |
130 | } |
131 | } |