EMMA Coverage Report (generated Wed Oct 26 13:47:17 EDT 2011)
[all classes][org.jclouds.compute.domain]

COVERAGE SUMMARY FOR SOURCE FILE [CIMOperatingSystem.java]

nameclass, %method, %block, %line, %
CIMOperatingSystem.java50%  (1/2)10%  (2/21)11%  (25/235)12%  (5/41)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CIMOperatingSystem$Builder0%   (0/1)0%   (0/11)0%   (0/82)0%   (0/12)
CIMOperatingSystem$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
arch (String): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
build (): CIMOperatingSystem 0%   (0/1)0%   (0/18)0%   (0/1)
description (String): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
family (OsFamily): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
fromCIMOperatingSystem (CIMOperatingSystem): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
fromOperatingSystem (OperatingSystem): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
is64Bit (boolean): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
name (String): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
osType (OSType): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/5)0%   (0/2)
version (String): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
     
class CIMOperatingSystem100% (1/1)20%  (2/10)16%  (25/153)17%  (5/29)
CIMOperatingSystem (): void 0%   (0/1)0%   (0/3)0%   (0/2)
builder (): CIMOperatingSystem$Builder 0%   (0/1)0%   (0/4)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/39)0%   (0/13)
getOsType (): OSType 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/20)0%   (0/4)
toComputeOs (Envelope): CIMOperatingSystem 0%   (0/1)0%   (0/6)0%   (0/1)
toComputeOs (OperatingSystemSection): CIMOperatingSystem 0%   (0/1)0%   (0/12)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/41)0%   (0/1)
CIMOperatingSystem (OSType, String, String, String): void 100% (1/1)100% (13/13)100% (2/2)
CIMOperatingSystem (OsFamily, String, String, String, String, boolean, OSType... 100% (1/1)100% (12/12)100% (3/3)

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.compute.domain;
20 
21import org.jclouds.javax.annotation.Nullable;
22 
23import org.jclouds.cim.OSType;
24import org.jclouds.ovf.Envelope;
25 
26import com.google.common.annotations.Beta;
27 
28/**
29 * Operating system based on DMTF CIM model.
30 * 
31 * @author Adrian Cole
32 * @see <a href="http://dmtf.org/standards/cim/cim_schema_v2260">DMTF CIM model</a>
33 */
34@Beta
35public class CIMOperatingSystem extends OperatingSystem {
36   public static Builder builder() {
37      return new Builder();
38   }
39 
40   public static class Builder extends OperatingSystem.Builder {
41      private OSType osType;
42 
43      /**
44       * @see CIMOperatingSystem#getOsType
45       */
46      public Builder osType(@Nullable OSType osType) {
47         this.osType = osType;
48         return this;
49      }
50 
51      /**
52       * {@inheritDoc}
53       */
54      @Override
55      public CIMOperatingSystem build() {
56         return new CIMOperatingSystem(family, name, version, arch, description, is64Bit, osType);
57      }
58 
59      public Builder fromCIMOperatingSystem(CIMOperatingSystem in) {
60         return fromOperatingSystem(in).osType(in.getOsType());
61      }
62 
63      /**
64       * {@inheritDoc}
65       */
66 
67      @Override
68      public Builder arch(String arch) {
69         return Builder.class.cast(super.arch(arch));
70      }
71 
72      /**
73       * {@inheritDoc}
74       */
75      @Override
76      public Builder description(String description) {
77         return Builder.class.cast(super.description(description));
78      }
79 
80      /**
81       * {@inheritDoc}
82       */
83      @Override
84      public Builder family(OsFamily family) {
85         return Builder.class.cast(super.family(family));
86      }
87 
88      /**
89       * {@inheritDoc}
90       */
91      @Override
92      public Builder fromOperatingSystem(OperatingSystem in) {
93         return Builder.class.cast(super.fromOperatingSystem(in));
94      }
95 
96      /**
97       * {@inheritDoc}
98       */
99      @Override
100      public Builder is64Bit(boolean is64Bit) {
101         return Builder.class.cast(super.is64Bit(is64Bit));
102      }
103 
104      /**
105       * {@inheritDoc}
106       */
107      @Override
108      public Builder name(String name) {
109         return Builder.class.cast(super.name(name));
110      }
111 
112      /**
113       * {@inheritDoc}
114       */
115      @Override
116      public Builder version(String version) {
117         return Builder.class.cast(super.version(version));
118      }
119   }
120 
121   public static CIMOperatingSystem toComputeOs(org.jclouds.ovf.OperatingSystemSection os) {
122      return new CIMOperatingSystem(OSType.fromValue(os.getId()), "", null, os.getDescription());
123   }
124 
125   public static CIMOperatingSystem toComputeOs(Envelope ovf) {
126      return toComputeOs(ovf.getVirtualSystem().getOperatingSystemSection());
127   }
128 
129   private OSType osType;
130 
131   protected CIMOperatingSystem() {
132      super();
133   }
134 
135   public CIMOperatingSystem(OSType osType, String version, String arch, String description) {
136      this(osType.getFamily(), osType.getValue(), version, arch, description, osType.is64Bit(), osType);
137   }
138 
139   public CIMOperatingSystem(@Nullable OsFamily family, @Nullable String name, @Nullable String version,
140            @Nullable String arch, String description, boolean is64Bit, OSType osType) {
141      super(family, name, version, arch, description, is64Bit);
142      this.osType = osType;
143 
144   }
145 
146   /**
147    * CIM OSType of the image
148    */
149   public OSType getOsType() {
150      return osType;
151   }
152 
153   @Override
154   public int hashCode() {
155      final int prime = 31;
156      int result = super.hashCode();
157      result = prime * result + ((osType == null) ? 0 : osType.hashCode());
158      return result;
159   }
160 
161   @Override
162   public boolean equals(Object obj) {
163      if (this == obj)
164         return true;
165      if (!super.equals(obj))
166         return false;
167      if (getClass() != obj.getClass())
168         return false;
169      CIMOperatingSystem other = (CIMOperatingSystem) obj;
170      if (osType == null) {
171         if (other.osType != null)
172            return false;
173      } else if (!osType.equals(other.osType))
174         return false;
175      return true;
176   }
177 
178   @Override
179   public String toString() {
180      return String.format("[osType=%s, arch=%s, description=%s, family=%s, is64Bit=%s, name=%s, version=%s]", osType,
181               arch, description, family, is64Bit, name, version);
182   }
183}

[all classes][org.jclouds.compute.domain]
EMMA 2.0.5312 (C) Vladimir Roubtsov