Statistics
| Branch: | Revision:

root / src / com / rackspace / cloud / servers / api / client / Server.java @ 23cc0515

History | View | Annotate | Download (2.6 kB)

1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.servers.api.client;
5

    
6
/**
7
 * @author Mike Mayo - mike.mayo@rackspace.com - twitter.com/greenisus
8
 *
9
 */
10
public class Server extends Entity {
11

    
12
        private static final long serialVersionUID = 5994739895998309675L;
13
        private String status;
14
        private String progress;
15
        private String hostId;
16
        private String flavorId;
17
        private String imageId;
18
        private String[] publicIpAddresses;
19
        private String[] privateIpAddresses;
20
        
21
        /**
22
         * @return the status
23
         */
24
        public String getStatus() {
25
                return status;
26
        }
27
        /**
28
         * @param status the status to set
29
         */
30
        public void setStatus(String status) {
31
                this.status = status;
32
        }
33
        /**
34
         * @return the progress
35
         */
36
        public String getProgress() {
37
                return progress;
38
        }
39
        /**
40
         * @param progress the progress to set
41
         */
42
        public void setProgress(String progress) {
43
                this.progress = progress;
44
        }
45
        /**
46
         * @return the hostId
47
         */
48
        public String getHostId() {
49
                return hostId;
50
        }
51
        /**
52
         * @param hostId the hostId to set
53
         */
54
        public void setHostId(String hostId) {
55
                this.hostId = hostId;
56
        }
57
        /**
58
         * @return the flavorId
59
         */
60
        public String getFlavorId() {
61
                return flavorId;
62
        }
63
        /**
64
         * @param flavorId the flavorId to set
65
         */
66
        public void setFlavorId(String flavorId) {
67
                this.flavorId = flavorId;
68
        }
69
        /**
70
         * @return the imageId
71
         */
72
        public String getImageId() {
73
                return imageId;
74
        }
75
        /**
76
         * @param imageId the imageId to set
77
         */
78
        public void setImageId(String imageId) {
79
                this.imageId = imageId;
80
        }
81
        /**
82
         * @return the publicIpAddresses
83
         */
84
        public String[] getPublicIpAddresses() {
85
                return publicIpAddresses;
86
        }
87
        /**
88
         * @param publicIpAddresses the publicIpAddresses to set
89
         */
90
        public void setPublicIpAddresses(String[] publicIpAddresses) {
91
                this.publicIpAddresses = publicIpAddresses;
92
        }
93
        /**
94
         * @return the privateIpAddresses
95
         */
96
        public String[] getPrivateIpAddresses() {
97
                return privateIpAddresses;
98
        }
99
        /**
100
         * @param privateIpAddresses the privateIpAddresses to set
101
         */
102
        public void setPrivateIpAddresses(String[] privateIpAddresses) {
103
                this.privateIpAddresses = privateIpAddresses;
104
        }
105
        /**
106
         * @return the flavor
107
         */
108
        public Flavor getFlavor() {
109
                Flavor flavor = Flavor.getFlavors().get(flavorId);
110
                if (flavor == null) {
111
                        flavor = new Flavor();
112
                }
113
                return flavor;
114
        }
115
        
116
        /**
117
         * @return the image
118
         */
119
        public Image getImage() {
120
                Image tempImage = Image.getImages().get(imageId);
121
                if (tempImage == null) {
122
                        tempImage = new Image();
123
                }
124
                return tempImage;
125

    
126
        }
127
        
128
        public String toXML() {
129
                String xml = "";
130
                xml = "<server xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"" + getName() 
131
                        + "\" imageId=\"" + imageId + "\" flavorId=\"" + flavorId + "\"></server>";
132
                return xml;
133
        }
134
        
135
}