EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.atmos.blobstore.functions]

COVERAGE SUMMARY FOR SOURCE FILE [BlobMetadataToObject.java]

nameclass, %method, %block, %line, %
BlobMetadataToObject.java100% (1/1)100% (2/2)71%  (42/59)78%  (9.3/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BlobMetadataToObject100% (1/1)100% (2/2)71%  (42/59)78%  (9.3/12)
apply (BlobMetadata): AtmosObject 100% (1/1)64%  (30/47)62%  (4.3/7)
BlobMetadataToObject (AtmosObject$Factory, BlobToContentMetadata, BlobToSyste... 100% (1/1)100% (12/12)100% (5/5)

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 */
19package org.jclouds.atmos.blobstore.functions;
20 
21import java.util.Map.Entry;
22 
23import javax.inject.Inject;
24import javax.inject.Singleton;
25 
26import org.jclouds.atmos.domain.AtmosObject;
27import org.jclouds.atmos.domain.UserMetadata;
28import org.jclouds.blobstore.domain.BlobMetadata;
29 
30import com.google.common.base.Function;
31 
32/**
33 * @author Adrian Cole
34 */
35@Singleton
36public class BlobMetadataToObject implements Function<BlobMetadata, AtmosObject> {
37   private final AtmosObject.Factory factory;
38   private final BlobToContentMetadata blob2ContentMd;
39   private final BlobToSystemMetadata blob2SysMd;
40 
41   @Inject
42   protected BlobMetadataToObject(AtmosObject.Factory factory,
43            BlobToContentMetadata blob2ContentMd, BlobToSystemMetadata blob2SysMd) {
44      this.factory = factory;
45      this.blob2ContentMd = blob2ContentMd;
46      this.blob2SysMd = blob2SysMd;
47   }
48 
49   public AtmosObject apply(BlobMetadata from) {
50      if (from == null)
51         return null;
52      UserMetadata userMd = new UserMetadata();
53      if (from.getUserMetadata() != null) {
54         for (Entry<String, String> entry : from.getUserMetadata().entrySet())
55            userMd.getMetadata().put(entry.getKey().toLowerCase(), entry.getValue());
56      }
57      return factory.create(blob2ContentMd.apply(from), blob2SysMd.apply(from), userMd);
58   }
59 
60}

[all classes][org.jclouds.atmos.blobstore.functions]
EMMA 2.0.5312 (C) Vladimir Roubtsov