View Javadoc

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.vcloud.domain;
20  
21  /**
22   * The creation status of the vDC
23   * 
24   * @see VDC#getStatus
25   */
26  public enum VDCStatus {
27  
28     CREATION_FAILED, NOT_READY, READY, UNKNOWN, UNRECOGNIZED;
29  
30     public int value() {
31        switch (this) {
32           case CREATION_FAILED:
33              return -1;
34           case NOT_READY:
35              return 0;
36           case READY:
37              return 1;
38           case UNKNOWN:
39              return 2;
40           default:
41              return 3;
42        }
43     }
44  
45     public static VDCStatus fromValue(int status) {
46        switch (status) {
47           case -1:
48              return CREATION_FAILED;
49           case 0:
50              return NOT_READY;
51           case 1:
52              return READY;
53           case 2:
54              return UNKNOWN;
55           default:
56              return UNRECOGNIZED;
57        }
58     }
59  }