| 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.blobstore.domain.internal; |
| 20 | |
| 21 | import java.net.URI; |
| 22 | |
| 23 | import org.jclouds.blobstore.domain.Blob; |
| 24 | import org.jclouds.blobstore.domain.BlobMetadata; |
| 25 | import org.jclouds.blobstore.domain.MutableBlobMetadata; |
| 26 | import org.jclouds.blobstore.domain.StorageType; |
| 27 | import org.jclouds.http.HttpUtils; |
| 28 | import org.jclouds.io.MutableContentMetadata; |
| 29 | import org.jclouds.io.payloads.BaseMutableContentMetadata; |
| 30 | |
| 31 | /** |
| 32 | * System and user Metadata for the {@link Blob}. |
| 33 | * |
| 34 | * @author Adrian Cole |
| 35 | */ |
| 36 | public class MutableBlobMetadataImpl extends MutableStorageMetadataImpl implements MutableBlobMetadata { |
| 37 | /** The serialVersionUID */ |
| 38 | private static final long serialVersionUID = -5932618957134612231L; |
| 39 | private MutableContentMetadata contentMetadata; |
| 40 | private URI publicUri; |
| 41 | private String container; |
| 42 | |
| 43 | public MutableBlobMetadataImpl() { |
| 44 | this.setType(StorageType.BLOB); |
| 45 | this.contentMetadata = new BaseMutableContentMetadata(); |
| 46 | } |
| 47 | |
| 48 | public MutableBlobMetadataImpl(BlobMetadata from) { |
| 49 | super(from); |
| 50 | this.contentMetadata = new BaseMutableContentMetadata(); |
| 51 | HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); |
| 52 | this.publicUri = from.getPublicUri(); |
| 53 | this.container = from.getContainer(); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * {@inheritDoc} |
| 58 | */ |
| 59 | @Override |
| 60 | public MutableContentMetadata getContentMetadata() { |
| 61 | return contentMetadata; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * {@inheritDoc} |
| 66 | */ |
| 67 | @Override |
| 68 | public void setContentMetadata(MutableContentMetadata contentMetadata) { |
| 69 | this.contentMetadata = contentMetadata; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * {@inheritDoc} |
| 74 | */ |
| 75 | @Override |
| 76 | public void setPublicUri(URI publicUri) { |
| 77 | this.publicUri = publicUri; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * {@inheritDoc} |
| 82 | */ |
| 83 | @Override |
| 84 | public URI getPublicUri() { |
| 85 | return publicUri; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * {@inheritDoc} |
| 90 | */ |
| 91 | @Override |
| 92 | public String getContainer() { |
| 93 | return container; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * {@inheritDoc} |
| 98 | */ |
| 99 | @Override |
| 100 | public void setContainer(String container) { |
| 101 | this.container = container; |
| 102 | } |
| 103 | |
| 104 | } |