| 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.blobstore.domain.internal; |
| 20 | |
| 21 | import static com.google.common.base.Preconditions.checkNotNull; |
| 22 | |
| 23 | import java.io.Serializable; |
| 24 | import java.net.URI; |
| 25 | import java.util.Date; |
| 26 | import java.util.Map; |
| 27 | |
| 28 | import javax.annotation.Nullable; |
| 29 | |
| 30 | import org.jclouds.blobstore.domain.Blob; |
| 31 | import org.jclouds.blobstore.domain.BlobMetadata; |
| 32 | import org.jclouds.blobstore.domain.StorageType; |
| 33 | import org.jclouds.domain.Location; |
| 34 | import org.jclouds.io.ContentMetadata; |
| 35 | |
| 36 | /** |
| 37 | * System and user Metadata for the {@link Blob}. |
| 38 | * |
| 39 | * @author Adrian Cole |
| 40 | */ |
| 41 | public class BlobMetadataImpl extends StorageMetadataImpl implements Serializable, BlobMetadata { |
| 42 | /** The serialVersionUID */ |
| 43 | private static final long serialVersionUID = -5932618957134612231L; |
| 44 | private final URI publicUri; |
| 45 | private final String container; |
| 46 | private final ContentMetadata contentMetadata; |
| 47 | |
| 48 | public BlobMetadataImpl(String id, String name, @Nullable Location location, URI uri, String eTag, |
| 49 | Date lastModified, Map<String, String> userMetadata, @Nullable URI publicUri, @Nullable String container, |
| 50 | ContentMetadata contentMetadata) { |
| 51 | super(StorageType.BLOB, id, name, location, uri, eTag, lastModified, userMetadata); |
| 52 | this.publicUri = publicUri; |
| 53 | this.container = container; |
| 54 | this.contentMetadata = checkNotNull(contentMetadata, "contentMetadata"); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * {@inheritDoc} |
| 59 | */ |
| 60 | @Override |
| 61 | public URI getPublicUri() { |
| 62 | return publicUri; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * {@inheritDoc} |
| 67 | */ |
| 68 | @Override |
| 69 | public String getContainer() { |
| 70 | return container; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * {@inheritDoc} |
| 75 | */ |
| 76 | @Override |
| 77 | public ContentMetadata getContentMetadata() { |
| 78 | return contentMetadata; |
| 79 | } |
| 80 | |
| 81 | } |