| 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.cim; |
| 20 | |
| 21 | import org.jclouds.compute.domain.OsFamily; |
| 22 | |
| 23 | /** |
| 24 | * Operating system based on DMTF CIM model. |
| 25 | * |
| 26 | * @author Adrian Cole |
| 27 | * @see <a |
| 28 | * href="http://dmtf.org/sites/default/files/cim/cim_schema_v2280/cim_schema_2.28.0Final-Doc.zip" |
| 29 | * /> |
| 30 | */ |
| 31 | public enum OSType { |
| 32 | /** |
| 33 | * Other |
| 34 | */ |
| 35 | OTHER(1, "Other", OsFamily.UNRECOGNIZED, false), |
| 36 | /** |
| 37 | * MACOS |
| 38 | */ |
| 39 | MACOS(2, "MACOS", OsFamily.DARWIN, false), |
| 40 | /** |
| 41 | * Solaris |
| 42 | */ |
| 43 | SOLARIS(29, "Solaris", OsFamily.SOLARIS, false), |
| 44 | /** |
| 45 | * LINUX |
| 46 | */ |
| 47 | LINUX(36, "LINUX", OsFamily.LINUX, false), |
| 48 | /** |
| 49 | * FreeBSD |
| 50 | */ |
| 51 | FREEBSD(42, "FreeBSD", OsFamily.FREEBSD, false), |
| 52 | /** |
| 53 | * NetBSD |
| 54 | */ |
| 55 | NETBSD(43, "NetBSD", OsFamily.NETBSD, false), |
| 56 | /** |
| 57 | * OpenBSD |
| 58 | */ |
| 59 | OPENBSD(65, "OpenBSD", OsFamily.OPENBSD, false), |
| 60 | /** |
| 61 | * Not Applicable |
| 62 | */ |
| 63 | NOT_APPLICABLE(66, "Not Applicable", OsFamily.UNRECOGNIZED, false), |
| 64 | /** |
| 65 | * Microsoft Windows Server 2003 |
| 66 | */ |
| 67 | WINDOWS_SERVER_2003(69, "Microsoft Windows Server 2003", OsFamily.WINDOWS, false), |
| 68 | /** |
| 69 | * Microsoft Windows Server 2003 64-Bit |
| 70 | */ |
| 71 | WINDOWS_SERVER_2003_64(70, "Microsoft Windows Server 2003 64-Bit", OsFamily.WINDOWS, true), |
| 72 | /** |
| 73 | * Microsoft Windows Server 2008 |
| 74 | */ |
| 75 | WINDOWS_SERVER_2008(76, "Microsoft Windows Server 2008", OsFamily.WINDOWS, false), |
| 76 | /** |
| 77 | * Microsoft Windows Server 2008 64-Bit |
| 78 | */ |
| 79 | WINDOWS_SERVER_2008_64(77, "Microsoft Windows Server 2008 64-Bit", OsFamily.WINDOWS, true), |
| 80 | /** |
| 81 | * FreeBSD 64-Bit |
| 82 | */ |
| 83 | FREEBSD_64(78, "FreeBSD 64-Bit", OsFamily.FREEBSD, true), |
| 84 | /** |
| 85 | * RedHat Enterprise Linux |
| 86 | */ |
| 87 | RHEL(79, "RedHat Enterprise Linux", OsFamily.RHEL, false), |
| 88 | /** |
| 89 | * RedHat Enterprise Linux 64-Bit |
| 90 | */ |
| 91 | RHEL_64(80, "RedHat Enterprise Linux 64-Bit", OsFamily.RHEL, true), |
| 92 | /** |
| 93 | * Solaris 64-Bit |
| 94 | */ |
| 95 | SOLARIS_64(81, "Solaris 64-Bit", OsFamily.SOLARIS, true), |
| 96 | /** |
| 97 | * SUSE |
| 98 | */ |
| 99 | SUSE(82, "SUSE", OsFamily.SUSE, false), |
| 100 | /** |
| 101 | * SUSE 64-Bit |
| 102 | */ |
| 103 | SUSE_64(83, "SUSE 64-Bit", OsFamily.SUSE, true), |
| 104 | /** |
| 105 | * SLES |
| 106 | */ |
| 107 | SLES(84, "SLES", OsFamily.SUSE, false), |
| 108 | /** |
| 109 | * SLES 64-Bit |
| 110 | */ |
| 111 | SLES_64(85, "SLES 64-Bit", OsFamily.SUSE, true), |
| 112 | /** |
| 113 | * Novell OES |
| 114 | */ |
| 115 | NOVELL_OES(86, "Novell OES", OsFamily.SUSE, true), |
| 116 | /** |
| 117 | * Mandriva |
| 118 | */ |
| 119 | MANDRIVA(89, "Mandriva", OsFamily.MANDRIVA, false), |
| 120 | /** |
| 121 | * Mandriva 64-Bit |
| 122 | */ |
| 123 | MANDRIVA_64(90, "Mandriva 64-Bit", OsFamily.MANDRIVA, true), |
| 124 | /** |
| 125 | * TurboLinux |
| 126 | */ |
| 127 | TURBOLINUX(91, "TurboLinux", OsFamily.TURBOLINUX, false), |
| 128 | /** |
| 129 | * TurboLinux 64-Bit |
| 130 | */ |
| 131 | TURBOLINUX_64(92, "TurboLinux 64-Bit", OsFamily.TURBOLINUX, true), |
| 132 | /** |
| 133 | * Ubuntu |
| 134 | */ |
| 135 | UBUNTU(93, "Ubuntu", OsFamily.UBUNTU, false), |
| 136 | /** |
| 137 | * Ubuntu 64-Bit |
| 138 | */ |
| 139 | UBUNTU_64(94, "Ubuntu 64-Bit", OsFamily.UBUNTU, true), |
| 140 | /** |
| 141 | * Debian |
| 142 | */ |
| 143 | DEBIAN(95, "Debian", OsFamily.DEBIAN, false), |
| 144 | /** |
| 145 | * Debian 64-Bit |
| 146 | */ |
| 147 | DEBIAN_64(96, "Debian 64-Bit", OsFamily.DEBIAN, false), |
| 148 | /** |
| 149 | * Linux 2.4.x |
| 150 | */ |
| 151 | LINUX_2_4(97, "Linux 2.4.x", OsFamily.LINUX, false), |
| 152 | /** |
| 153 | * Linux 2.4.x 64-Bi |
| 154 | */ |
| 155 | LINUX_2_4_64(98, "Linux 2.4.x 64-Bit", OsFamily.LINUX, true), |
| 156 | /** |
| 157 | * Linux 2.6.x |
| 158 | */ |
| 159 | LINUX_2_6(99, "Linux 2.6.x", OsFamily.LINUX, false), |
| 160 | /** |
| 161 | * Linux 2.6.x 64-Bit |
| 162 | */ |
| 163 | LINUX_2_6_64(100, "Linux 2.6.x 64-Bit", OsFamily.LINUX, true), |
| 164 | /** |
| 165 | * Linux 64-Bit |
| 166 | */ |
| 167 | LINUX_64(101, "Linux 64-Bit", OsFamily.LINUX, true), |
| 168 | /** |
| 169 | * Other 64-Bit |
| 170 | */ |
| 171 | OTHER_64(102, "Other 64-Bit", OsFamily.UNRECOGNIZED, true), |
| 172 | /** |
| 173 | * Microsoft Windows Server 2008 R2 |
| 174 | */ |
| 175 | WINDOWS_SERVER_2008_R2(103, "Microsoft Windows Server 2008 R2", OsFamily.WINDOWS, true), |
| 176 | /** |
| 177 | * VMware ESXi |
| 178 | */ |
| 179 | ESXI(104, "VMware ESXi", OsFamily.ESX, true), |
| 180 | /** |
| 181 | * Microsoft Windows 7 |
| 182 | */ |
| 183 | WINDOWS_7(105, "Microsoft Windows 7", OsFamily.WINDOWS, false), |
| 184 | /** |
| 185 | * CentOS 32-bit |
| 186 | */ |
| 187 | CENTOS(106, "CentOS 32-bit", OsFamily.CENTOS, false), |
| 188 | /** |
| 189 | * CentOS 64-bit |
| 190 | */ |
| 191 | CENTOS_64(107, "CentOS 64-bit", OsFamily.CENTOS, true), |
| 192 | /** |
| 193 | * Oracle Enterprise Linux 32-bit |
| 194 | */ |
| 195 | ORACLE_ENTERPRISE_LINUX(108, "Oracle Enterprise Linux 32-bit", OsFamily.OEL, false), |
| 196 | /** |
| 197 | * Oracle Enterprise Linux 64-bit |
| 198 | */ |
| 199 | ORACLE_ENTERPRISE_LINUX_64(109, "Oracle Enterprise Linux 64-bit", OsFamily.OEL, true), |
| 200 | /** |
| 201 | * eComStation 32-bitx |
| 202 | */ |
| 203 | ECOMSTATION_32(109, "eComStation 32-bitx", OsFamily.UNRECOGNIZED, false), UNRECOGNIZED(Integer.MAX_VALUE, |
| 204 | "UNRECOGNIZED", null, true); |
| 205 | private final int code; |
| 206 | |
| 207 | public int getCode() { |
| 208 | return code; |
| 209 | } |
| 210 | |
| 211 | public String getValue() { |
| 212 | return value; |
| 213 | } |
| 214 | |
| 215 | public OsFamily getFamily() { |
| 216 | return family; |
| 217 | } |
| 218 | |
| 219 | public boolean is64Bit() { |
| 220 | return is64Bit; |
| 221 | } |
| 222 | |
| 223 | private final String value; |
| 224 | private final OsFamily family; |
| 225 | private final boolean is64Bit; |
| 226 | |
| 227 | OSType(int code, String value, OsFamily family, boolean is64Bit) { |
| 228 | this.code = code; |
| 229 | this.value = value; |
| 230 | this.family = family; |
| 231 | this.is64Bit = is64Bit; |
| 232 | } |
| 233 | |
| 234 | public static OSType fromValue(int code) { |
| 235 | for (OSType type : values()) { |
| 236 | if (type.code == code) |
| 237 | return type; |
| 238 | } |
| 239 | return UNRECOGNIZED; |
| 240 | } |
| 241 | |
| 242 | } |