Statistics
| Branch: | Revision:

root / src / com / rackspace / cloud / servers / api / client / Server.java @ 038ac9a4

History | View | Annotate | Download (2.8 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
        /**
29
         * @param status
30
         *            the status to set
31
         */
32
        public void setStatus(String status) {
33
                this.status = status;
34
        }
35

    
36
        /**
37
         * @return the progress
38
         */
39
        public String getProgress() {
40
                return progress;
41
        }
42

    
43
        /**
44
         * @param progress
45
         *            the progress to set
46
         */
47
        public void setProgress(String progress) {
48
                this.progress = progress;
49
        }
50

    
51
        /**
52
         * @return the hostId
53
         */
54
        public String getHostId() {
55
                return hostId;
56
        }
57

    
58
        /**
59
         * @param hostId
60
         *            the hostId to set
61
         */
62
        public void setHostId(String hostId) {
63
                this.hostId = hostId;
64
        }
65

    
66
        /**
67
         * @return the flavorId
68
         */
69
        public String getFlavorId() {
70
                return flavorId;
71
        }
72

    
73
        /**
74
         * @param flavorId
75
         *            the flavorId to set
76
         */
77
        public void setFlavorId(String flavorId) {
78
                this.flavorId = flavorId;
79
        }
80

    
81
        /**
82
         * @return the imageId
83
         */
84
        public String getImageId() {
85
                return imageId;
86
        }
87

    
88
        /**
89
         * @param imageId
90
         *            the imageId to set
91
         */
92
        public void setImageId(String imageId) {
93
                this.imageId = imageId;
94
        }
95

    
96
        /**
97
         * @return the publicIpAddresses
98
         */
99
        public String[] getPublicIpAddresses() {
100
                return publicIpAddresses;
101
        }
102

    
103
        /**
104
         * @param publicIpAddresses
105
         *            the publicIpAddresses to set
106
         */
107
        public void setPublicIpAddresses(String[] publicIpAddresses) {
108
                this.publicIpAddresses = publicIpAddresses;
109
        }
110

    
111
        /**
112
         * @return the privateIpAddresses
113
         */
114
        public String[] getPrivateIpAddresses() {
115
                return privateIpAddresses;
116
        }
117

    
118
        /**
119
         * @param privateIpAddresses
120
         *            the privateIpAddresses to set
121
         */
122
        public void setPrivateIpAddresses(String[] privateIpAddresses) {
123
                this.privateIpAddresses = privateIpAddresses;
124
        }
125

    
126
        /**
127
         * @return the flavor
128
         */
129
        public Flavor getFlavor() {
130
                Flavor flavor = Flavor.getFlavors().get(flavorId);
131
                if (flavor == null) {
132
                        flavor = new Flavor();
133
                }
134
                return flavor;
135
        }
136

    
137
        /**
138
         * @return the image
139
         */
140
        public Image getImage() {
141
                Image image = Image.getImages().get(imageId);
142
                if (image == null) {
143
                        image = new Image();
144
                }
145
                return image;
146
        }
147

    
148
        public String toXML() {
149
                String xml = "";
150
                xml = "<server xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\""
151
                                + getName()
152
                                + "\" imageId=\""
153
                                + imageId
154
                                + "\" flavorId=\""
155
                                + flavorId + "\"></server>";
156
                return xml;
157
        }
158

    
159
}