| 1 | /** |
| 2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
| 3 | * contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. jclouds licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. 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, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.jclouds.openstack.swift.domain.internal; |
| 20 | |
| 21 | import java.net.URI; |
| 22 | import java.util.Date; |
| 23 | import java.util.Map; |
| 24 | |
| 25 | import org.jclouds.io.payloads.BaseMutableContentMetadata; |
| 26 | import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata; |
| 27 | import org.jclouds.openstack.swift.domain.ObjectInfo; |
| 28 | |
| 29 | /** |
| 30 | * |
| 31 | * @author Adrian Cole |
| 32 | * |
| 33 | */ |
| 34 | public class DelegatingMutableObjectInfoWithMetadata extends BaseMutableContentMetadata implements |
| 35 | MutableObjectInfoWithMetadata { |
| 36 | /** The serialVersionUID */ |
| 37 | private static final long serialVersionUID = 5280642704532078500L; |
| 38 | private final MutableObjectInfoWithMetadata delegate; |
| 39 | |
| 40 | public DelegatingMutableObjectInfoWithMetadata(MutableObjectInfoWithMetadata delegate) { |
| 41 | this.delegate = delegate; |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public Long getContentLength() { |
| 46 | return delegate.getBytes(); |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public String getContentType() { |
| 51 | return delegate.getContentType(); |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public byte[] getContentMD5() { |
| 56 | return delegate.getHash(); |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public int hashCode() { |
| 61 | return delegate.hashCode(); |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public void setContentLength(Long bytes) { |
| 66 | if (bytes != null) |
| 67 | delegate.setBytes(bytes); |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public void setContentType(String contentType) { |
| 72 | delegate.setContentType(contentType); |
| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public void setContentMD5(byte[] hash) { |
| 77 | delegate.setHash(hash); |
| 78 | } |
| 79 | |
| 80 | public MutableObjectInfoWithMetadata getDelegate() { |
| 81 | return delegate; |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public Map<String, String> getMetadata() { |
| 86 | return delegate.getMetadata(); |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public void setBytes(Long bytes) { |
| 91 | delegate.setBytes(bytes); |
| 92 | } |
| 93 | |
| 94 | @Override |
| 95 | public void setHash(byte[] hash) { |
| 96 | delegate.setHash(hash); |
| 97 | } |
| 98 | |
| 99 | @Override |
| 100 | public void setLastModified(Date lastModified) { |
| 101 | delegate.setLastModified(lastModified); |
| 102 | } |
| 103 | |
| 104 | @Override |
| 105 | public void setName(String name) { |
| 106 | delegate.setName(name); |
| 107 | } |
| 108 | |
| 109 | @Override |
| 110 | public Long getBytes() { |
| 111 | return delegate.getBytes(); |
| 112 | } |
| 113 | |
| 114 | @Override |
| 115 | public byte[] getHash() { |
| 116 | return delegate.getHash(); |
| 117 | } |
| 118 | |
| 119 | @Override |
| 120 | public Date getLastModified() { |
| 121 | return delegate.getLastModified(); |
| 122 | } |
| 123 | |
| 124 | @Override |
| 125 | public String getName() { |
| 126 | return delegate.getName(); |
| 127 | } |
| 128 | |
| 129 | @Override |
| 130 | public int compareTo(ObjectInfo o) { |
| 131 | return delegate.compareTo(o); |
| 132 | } |
| 133 | |
| 134 | @Override |
| 135 | public void setContainer(String container) { |
| 136 | delegate.setContainer(container); |
| 137 | } |
| 138 | |
| 139 | @Override |
| 140 | public String getContainer() { |
| 141 | return delegate.getContainer(); |
| 142 | } |
| 143 | |
| 144 | @Override |
| 145 | public void setUri(URI uri) { |
| 146 | delegate.setUri(uri); |
| 147 | } |
| 148 | |
| 149 | @Override |
| 150 | public URI getUri() { |
| 151 | return delegate.getUri(); |
| 152 | } |
| 153 | } |