Revision 23bc5e75

b/res/layout/activity_choser.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" android:background="@drawable/rack_bg_main">
3
  <ImageView  android:id="@+id/headerimage" android:layout_width="wrap_content" android:layout_height="75dip"></ImageView>
4
     <LinearLayout android:layout_weight="1" android:layout_height="300dip" android:layout_width="fill_parent">
5
        <LinearLayout android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="fill_parent">
6
          <ImageButton android:layout_height="fill_parent"  android:src="@drawable/serverbuttonmed" android:id="@+id/serverbutton" android:background="@android:color/transparent" android:layout_width="fill_parent"></ImageButton>
7
        </LinearLayout>
8
        <LinearLayout android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="fill_parent">
9
           <ImageButton android:layout_height="fill_parent" android:src="@drawable/filebuttonmed" android:id="@+id/filesbutton" android:background="@android:color/transparent" android:layout_width="fill_parent"></ImageButton>        
10
        </LinearLayout>
11
        <LinearLayout android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="fill_parent">
12
           <ImageButton android:layout_height="fill_parent" android:src="@drawable/lbbuttonmed" android:id="@+id/loadbalancersbutton" android:background="@android:color/transparent" android:layout_width="fill_parent"></ImageButton>
13
        </LinearLayout>      
14
    </LinearLayout>
15
    <LinearLayout  android:layout_weight="1" android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent">
16
        <TextView android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="TextView" android:layout_width="wrap_content" android:id="@+id/textView1"></TextView>
17
    </LinearLayout>
18
</LinearLayout>
b/res/layout/list_loadbalancer_item.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="64dip">
3
	<ImageView android:id="@+id/icon" android:layout_width="37px" android:paddingLeft="0px" android:paddingRight="0px" android:paddingTop="0px" android:layout_marginRight="10px" android:layout_marginLeft="10px" android:layout_marginTop="13px" android:layout_height="37px" android:src="@drawable/icon" />
4
	<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"	android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
5
		<TableRow>
6
			<TextView android:id="@+id/label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5px" android:textColor="#000" android:textSize="24sp" />
7
		</TableRow>
8
		<TableRow>
9
			<TextView android:id="@+id/sublabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="0px" android:textColor="#000" android:text="MyLoadBalancers" android:textSize="12sp" />
10
		</TableRow>
11
	</TableLayout>
12
</LinearLayout>
b/res/layout/list_loadbalancers.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
	android:orientation="vertical" android:layout_width="fill_parent"
4
	android:layout_height="fill_parent" android:background="@drawable/rack_bg_transparent">
5
	<ImageView android:id="@+id/headerimage"
6
		android:layout_width="wrap_content" android:layout_height="80dip"></ImageView>
7
	<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
8
		android:layout_width="fill_parent" android:layout_height="fill_parent">
9
		<ListView android:id="@+id/android:list"
10
			android:layout_width="fill_parent" android:layout_height="fill_parent"
11
			android:cacheColorHint="@android:color/transparent" />
12
	</ScrollView>
13
	<ImageView android:id="@+id/headerimage"
14
		android:layout_width="wrap_content" android:layout_height="25dip"></ImageView>
15
</LinearLayout>
16

  
17
  
b/res/layout/loadbalancers_activity.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" android:background="@drawable/rack_bg_main">
3
  <ImageView  android:id="@+id/headerimage" android:layout_width="wrap_content" android:layout_height="75dip"></ImageView>
4
     <LinearLayout android:layout_weight="1" android:layout_height="300dip" android:layout_width="fill_parent">
5
        <LinearLayout android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="fill_parent">
6
          <ImageButton android:layout_height="fill_parent"  android:src="@drawable/serverbuttonmed" android:id="@+id/serverbuttonmed" android:background="@android:color/transparent" android:layout_width="fill_parent"></ImageButton>
7
        </LinearLayout>
8
        <LinearLayout android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="fill_parent">
9
           <ImageButton android:layout_height="fill_parent" android:src="@drawable/filebuttonmed" android:id="@+id/filebuttonmed" android:background="@android:color/transparent" android:layout_width="fill_parent"></ImageButton>        
10
        </LinearLayout>
11
        <LinearLayout android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="fill_parent">
12
           <ImageButton android:layout_height="fill_parent" android:src="@drawable/lbbuttonmed" android:id="@+id/lbbuttonmed" android:background="@android:color/transparent" android:layout_width="fill_parent"></ImageButton>
13
        </LinearLayout>      
14
    </LinearLayout>
15
    <LinearLayout  android:layout_weight="1" android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent">
16
        <TextView android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="TextView" android:layout_width="wrap_content" android:id="@+id/textView1"></TextView>
17
    </LinearLayout>
18
</LinearLayout>
b/res/layout/view_loadbalancer.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
	android:id="@+id/view_loadbalncer_layout" android:orientation="vertical"
4
	android:layout_width="fill_parent" android:layout_height="fill_parent"
5
	android:background="@drawable/rack_bg_transparent">
6
	<ImageView android:id="@+id/headerimage"
7
		android:layout_width="wrap_content" android:layout_height="80dip"/>
8
	<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
9
		android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1">
10
		<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
11
			android:id="@+id/view_layout_layout" android:orientation="vertical"
12
			android:layout_width="fill_parent" android:layout_height="fill_parent">
13
			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
14
				android:id="@+id/view_loadbalancer_layout" android:orientation="vertical"
15
				android:layout_width="fill_parent" android:layout_height="wrap_content"
16
				android:paddingLeft="5dip" android:background="@drawable/itemsbox">
17
				<TextView android:layout_height="wrap_content"
18
					android:layout_width="fill_parent" android:layout_marginLeft="22dip"
19
					android:layout_marginRight="30dip" android:scrollHorizontally="true"
20
					android:gravity="fill_horizontal" android:textSize="20.0sp"
21
					android:textColor="#fff" android:layout_marginTop="30dip"
22
					android:paddingBottom="10dip" android:text="LoadBalancer" />
23

  
24
				<!-- ID -->
25
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
26
					android:id="@+id/view_lb_id_layout" android:orientation="horizontal"
27
					android:layout_width="fill_parent" android:layout_height="wrap_content">
28
					<TextView android:layout_width="wrap_content"
29
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
30
						android:paddingLeft="5dip" android:text="ID: " android:singleLine="false"
31
						android:textStyle="bold" />
32
					<TextView android:id="@+id/view_lb_id"
33
						android:layout_height="wrap_content" android:layout_width="fill_parent"
34
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
35
						android:gravity="fill_horizontal" android:textColor="#fff" />
36
				</LinearLayout>
37
				<!-- Name -->
38
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
39
					android:id="@+id/view_name_layout" android:orientation="horizontal"
40
					android:layout_width="fill_parent" android:layout_height="wrap_content">
41
					<TextView android:layout_width="wrap_content"
42
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
43
						android:paddingLeft="5dip" android:text="ID: " android:singleLine="false"
44
						android:textStyle="bold" />
45
					<TextView android:id="@+id/view_name"
46
						android:layout_height="wrap_content" android:layout_width="fill_parent"
47
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
48
						android:gravity="fill_horizontal" android:textColor="#fff" />
49
				</LinearLayout>
50
				<!-- Protocol -->
51
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
52
					android:id="@+id/view_protocol_layout" android:orientation="horizontal"
53
					android:layout_width="fill_parent" android:layout_height="wrap_content">
54
					<TextView android:layout_width="wrap_content"
55
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
56
						android:paddingLeft="5dip" android:text="Protocol: "
57
						android:singleLine="false" android:textStyle="bold" />
58
					<TextView android:id="@+id/view_protocol"
59
						android:layout_height="wrap_content" android:layout_width="fill_parent"
60
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
61
						android:gravity="fill_horizontal" android:textColor="#fff" />
62
				</LinearLayout>
63
				<!-- Port -->
64
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
65
					android:id="@+id/view_port_layout" android:orientation="horizontal"
66
					android:layout_width="fill_parent" android:layout_height="wrap_content">
67
					<TextView android:layout_width="wrap_content"
68
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
69
						android:paddingLeft="5dip" android:text="Port: "
70
						android:singleLine="false" android:textStyle="bold" />
71
					<TextView android:id="@+id/view_port"
72
						android:layout_height="wrap_content" android:layout_width="fill_parent"
73
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
74
						android:gravity="fill_horizontal" android:textColor="#fff" />
75
				</LinearLayout>
76
				<!-- Algorithm -->
77
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
78
					android:id="@+id/view_algorithm_layout" android:orientation="horizontal"
79
					android:layout_width="fill_parent" android:layout_height="wrap_content">
80
					<TextView android:layout_width="wrap_content"
81
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
82
						android:paddingLeft="5dip" android:text="Algorithm: "
83
						android:singleLine="false" android:textStyle="bold" />
84
					<TextView android:id="@+id/view_algorithm"
85
						android:layout_height="wrap_content" android:layout_width="fill_parent"
86
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
87
						android:gravity="fill_horizontal" android:textColor="#fff" />
88
				</LinearLayout>
89
				<!-- Status -->
90
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
91
					android:id="@+id/view_status_layout" android:orientation="horizontal"
92
					android:layout_width="fill_parent" android:layout_height="wrap_content">
93
					<TextView android:layout_width="wrap_content"
94
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
95
						android:paddingLeft="5dip" android:text="Status: "
96
						android:singleLine="false" android:textStyle="bold" />
97
					<TextView android:id="@+id/view_status"
98
						android:layout_height="wrap_content" android:layout_width="fill_parent"
99
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
100
						android:gravity="fill_horizontal" android:textColor="#fff" />
101
				</LinearLayout>
102
				<!-- ConnectionLogging -->
103
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
104
					android:id="@+id/view_islogging_layout" android:orientation="horizontal"
105
					android:layout_width="fill_parent" android:layout_height="wrap_content">
106
					<TextView android:layout_width="wrap_content"
107
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
108
						android:paddingLeft="5dip" android:text="Connection Logging: "
109
						android:singleLine="false" android:textStyle="bold" />
110
					<TextView android:id="@+id/view_islogging"
111
						android:layout_height="wrap_content" android:layout_width="fill_parent"
112
						android:layout_marginRight="30dip" android:paddingBottom="30dip"
113
						android:scrollHorizontally="true" android:gravity="fill_horizontal"
114
						android:textColor="#fff" />
115
				</LinearLayout>
116
			</LinearLayout>
117
			<!-- VirtualIps -->
118
			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
119
				android:id="@+id/view_loadbalancer_layout" android:orientation="vertical"
120
				android:layout_width="fill_parent" android:layout_height="wrap_content"
121
				android:paddingLeft="5dip" android:background="@drawable/itemsbox">
122
				<TextView android:layout_height="wrap_content"
123
					android:layout_width="fill_parent" android:layout_marginLeft="22dip"
124
					android:layout_marginRight="30dip" android:scrollHorizontally="true"
125
					android:gravity="fill_horizontal" android:textSize="20.0sp"
126
					android:textColor="#fff" android:layout_marginTop="30dip"
127
					android:paddingBottom="10dip" android:text="VirtualIps" />
128
				<!-- ID -->
129
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
130
					android:id="@+id/view_vip_id_layout" android:orientation="horizontal"
131
					android:layout_width="fill_parent" android:layout_height="wrap_content">
132
					<TextView android:layout_width="wrap_content"
133
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
134
						android:paddingLeft="5dip" android:text="ID: " android:singleLine="false"
135
						android:textStyle="bold" />
136
					<TextView android:id="@+id/view_vip_id"
137
						android:layout_height="wrap_content" android:layout_width="fill_parent"
138
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
139
						android:gravity="fill_horizontal" android:textColor="#fff" />
140
				</LinearLayout>
141
				<!-- Ip Address -->
142
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
143
					android:id="@+id/view_vip_address_layout" android:orientation="horizontal"
144
					android:layout_width="fill_parent" android:layout_height="wrap_content">
145
					<TextView android:layout_width="wrap_content"
146
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
147
						android:paddingLeft="5dip" android:text="IpAddress: "
148
						android:singleLine="false" android:textStyle="bold" />
149
					<TextView android:id="@+id/view_vip_address"
150
						android:layout_height="wrap_content" android:layout_width="fill_parent"
151
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
152
						android:gravity="fill_horizontal" android:textColor="#fff" />
153
				</LinearLayout>
154
				<!-- IpVersion -->
155
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
156
					android:id="@+id/view_ipversion_layout" android:orientation="horizontal"
157
					android:layout_width="fill_parent" android:layout_height="wrap_content">
158
					<TextView android:layout_width="wrap_content"
159
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
160
						android:paddingLeft="5dip" android:text="IpVersion: "
161
						android:singleLine="false" android:textStyle="bold" />
162
					<TextView android:id="@+id/view_ipversion"
163
						android:layout_height="wrap_content" android:layout_width="fill_parent"
164
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
165
						android:gravity="fill_horizontal" android:textColor="#fff" />
166
				</LinearLayout>
167
				<!-- Type -->
168
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
169
					android:id="@+id/view_vip_type_layout" android:orientation="horizontal"
170
					android:layout_width="fill_parent" android:layout_height="wrap_content">
171
					<TextView android:layout_width="wrap_content"
172
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
173
						android:paddingLeft="5dip" android:text="Type: "
174
						android:singleLine="false" android:textStyle="bold" />
175
					<TextView android:id="@+id/view_vip_type"
176
						android:layout_height="wrap_content" android:layout_width="fill_parent"
177
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
178
						android:gravity="fill_horizontal" android:textColor="#fff" />
179
				</LinearLayout>
180
			</LinearLayout>
181
			<!-- Nodes -->
182
			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
183
				android:id="@+id/view_loadbalancer_layout" android:orientation="vertical"
184
				android:layout_width="fill_parent" android:layout_height="wrap_content"
185
				android:paddingLeft="5dip" android:background="@drawable/itemsbox">
186
				<TextView android:layout_height="wrap_content"
187
					android:layout_width="fill_parent" android:layout_marginLeft="22dip"
188
					android:layout_marginRight="30dip" android:scrollHorizontally="true"
189
					android:gravity="fill_horizontal" android:textSize="20.0sp"
190
					android:textColor="#fff" android:layout_marginTop="30dip"
191
					android:paddingBottom="10dip" android:text="Nodes" />
192
				<!-- ID -->
193
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
194
					android:id="@+id/view_node_id_layout" android:orientation="horizontal"
195
					android:layout_width="fill_parent" android:layout_height="wrap_content">
196
					<TextView android:layout_width="wrap_content"
197
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
198
						android:paddingLeft="5dip" android:text="ID: " android:singleLine="false"
199
						android:textStyle="bold" />
200
					<TextView android:id="@+id/view_node_id"
201
						android:layout_height="wrap_content" android:layout_width="fill_parent"
202
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
203
						android:gravity="fill_horizontal" android:textColor="#fff" />
204
				</LinearLayout>
205
				<!-- Address -->
206
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
207
					android:id="@+id/view_node_address_layout" android:orientation="horizontal"
208
					android:layout_width="fill_parent" android:layout_height="wrap_content">
209
					<TextView android:layout_width="wrap_content"
210
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
211
						android:paddingLeft="5dip" android:text="Address: "
212
						android:singleLine="false" android:textStyle="bold" />
213
					<TextView android:id="@+id/view_node_address"
214
						android:layout_height="wrap_content" android:layout_width="fill_parent"
215
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
216
						android:gravity="fill_horizontal" android:textColor="#fff" />
217
				</LinearLayout>
218
				<!-- Port -->
219
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
220
					android:id="@+id/view_node_port_layout" android:orientation="horizontal"
221
					android:layout_width="fill_parent" android:layout_height="wrap_content">
222
					<TextView android:layout_width="wrap_content"
223
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
224
						android:paddingLeft="5dip" android:text="Port: "
225
						android:singleLine="false" android:textStyle="bold" />
226
					<TextView android:id="@+id/view_node_port"
227
						android:layout_height="wrap_content" android:layout_width="fill_parent"
228
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
229
						android:gravity="fill_horizontal" android:textColor="#fff" />
230
				</LinearLayout>
231
				<!-- Condition -->
232
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
233
					android:id="@+id/view_node_condition_layout" android:orientation="horizontal"
234
					android:layout_width="fill_parent" android:layout_height="wrap_content">
235
					<TextView android:layout_width="wrap_content"
236
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
237
						android:paddingLeft="5dip" android:text="Condition: "
238
						android:singleLine="false" android:textStyle="bold" />
239
					<TextView android:id="@+id/view_node_condition"
240
						android:layout_height="wrap_content" android:layout_width="fill_parent"
241
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
242
						android:gravity="fill_horizontal" android:textColor="#fff" />
243
				</LinearLayout>
244
				<!-- Status -->
245
				<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
246
					android:id="@+id/view_node_status_layout" android:orientation="horizontal"
247
					android:layout_width="fill_parent" android:layout_height="wrap_content">
248
					<TextView android:layout_width="wrap_content"
249
						android:layout_height="wrap_content" android:layout_marginLeft="22dip"
250
						android:paddingLeft="5dip" android:text="Status: "
251
						android:singleLine="false" android:textStyle="bold" />
252
					<TextView android:id="@+id/view_node_status"
253
						android:layout_height="wrap_content" android:layout_width="fill_parent"
254
						android:layout_marginRight="30dip" android:scrollHorizontally="true"
255
						android:gravity="fill_horizontal" android:textColor="#fff" />
256
				</LinearLayout>
257
			</LinearLayout>
258
		</LinearLayout>
259
	</ScrollView>
260
	<ImageView android:id="@+id/footerimage" android:layout_width="wrap_content" android:layout_height="25dip"/>
261
</LinearLayout>
b/res/values/style.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<resources>
3
<style name="NewDialog">
4
    <item name="android:windowFrame">@null</item>
5
    <item name="android:windowBackground">@android:color/transparent</item>
6
    <item name="android:windowIsFloating">true</item>
7
    <item name="android:windowContentOverlay">@null</item>
8
    <item name="android:windowTitleStyle">@null</item>
9
    <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
10
    <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
11
    <item name="android:backgroundDimEnabled">false</item>
12
    <item name="android:background">@android:color/transparent</item>
13
</style>
14
</resources>
b/src/com/rackspace/cloud/loadbalancer/api/client/ConnectionLogging.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.client;
5

  
6
public class ConnectionLogging extends Entity {
7

  
8
	private static final long serialVersionUID = 5994739895998309675L;
9
	private String id;
10
	private String address;
11
	private String ipVersion;
12
	private String type;
13
	public String getId() {
14
		return id;
15
	}
16
	public void setId(String id) {
17
		this.id = id;
18
	}
19
	public String getAddress() {
20
		return address;
21
	}
22
	public void setAddress(String address) {
23
		this.address = address;
24
	}
25
	public String getIpVersion() {
26
		return ipVersion;
27
	}
28
	public void setIpVersion(String ipVersion) {
29
		this.ipVersion = ipVersion;
30
	}
31
	public String getType() {
32
		return type;
33
	}
34
	public void setType(String type) {
35
		this.type = type;
36
	}
37
}
b/src/com/rackspace/cloud/loadbalancer/api/client/ConnectionThrottle.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.client;
5

  
6
public class ConnectionThrottle extends Entity {
7

  
8
	private static final long serialVersionUID = 5994739895998309675L;
9
	private String minConnections;
10
	private String maxConnections;
11
	private String maxConnectionRate;
12
	private String rateInterval;
13
	public String getMinConnections() {
14
		return minConnections;
15
	}
16
	public void setMinConnections(String minConnections) {
17
		this.minConnections = minConnections;
18
	}
19
	public String getMaxConnections() {
20
		return maxConnections;
21
	}
22
	public void setMaxConnections(String maxConnections) {
23
		this.maxConnections = maxConnections;
24
	}
25
	public String getMaxConnectionRate() {
26
		return maxConnectionRate;
27
	}
28
	public void setMaxConnectionRate(String maxConnectionRate) {
29
		this.maxConnectionRate = maxConnectionRate;
30
	}
31
	public String getRateInterval() {
32
		return rateInterval;
33
	}
34
	public void setRateInterval(String rateInterval) {
35
		this.rateInterval = rateInterval;
36
	}
37
	public static long getSerialversionuid() {
38
		return serialVersionUID;
39
	}
40
}
b/src/com/rackspace/cloud/loadbalancer/api/client/Entity.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.client;
5

  
6
import java.io.Serializable;
7

  
8
public class Entity implements Serializable {
9
	
10
	private static final long serialVersionUID = 6865922063268248789L;
11
	private String id;
12
	private String name;
13

  
14
	/**
15
	 * @return the id
16
	 */
17
	public String getId() {
18
		return id;
19
	}
20

  
21
	/**
22
	 * @param id the id to set
23
	 */
24
	public void setId(String id) {
25
		this.id = id;
26
	}
27

  
28
	/**
29
	 * @return the name
30
	 */
31
	public String getName() {
32
		return name;
33
	}
34

  
35
	/**
36
	 * @param name the name to set
37
	 */
38
	public void setName(String name) {
39
		this.name = name;
40
	}
41

  
42
}
b/src/com/rackspace/cloud/loadbalancer/api/client/EntityManager.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.client;
5

  
6
import java.util.Calendar;
7

  
8
import com.rackspace.cloud.loadbalancers.api.client.http.LoadBalancersException;
9

  
10
public class EntityManager {
11
	
12
	protected String cacheBuster() {
13
		Calendar calendar = Calendar.getInstance();
14
		java.util.Date now = calendar.getTime();
15
		java.sql.Timestamp currentTimestamp = new java.sql.Timestamp(now.getTime());		
16
		return "?now=" + currentTimestamp.getTime();
17
	}
18
		
19
	//
20
	// CRUD Operations
21
	//
22
	
23
	public void create(Entity entity) throws LoadBalancersException {		
24
	}
25
	
26
	public void remove(Entity e) {
27
		
28
	}
29
	
30
	public void update(Entity e) {
31
		
32
	}
33
	
34
	public void refresh(Entity e) {
35
		
36
	}
37
	
38
	public Entity find(long id) throws Exception {
39
		return null;
40
	}
41
	
42
	//
43
	// Polling Operations
44
	//
45
	public void wait(Entity e) {
46
		
47
	}
48
	
49
	public void wait(Entity e, long timeout) {
50
	
51
	}
52
	/*
53
	public void notify(Entity e, ChangeListener ch) {
54
		
55
	}
56
	
57
	public void stopNotify(Entity e, ChangeListener ch) {
58
		
59
	}
60
	*/
61
	
62
	//
63
	// Lists
64
	//
65
	/*
66
	public ArrayList createList(boolean detail) throws LoadBalancersException {
67
		return null;
68
	}
69
	public EntityList createDeltaList(boolean detail, long changesSince) {
70
		return null;
71
	}	
72
	public EntityList createList(boolean detail, long offset, long limit) {
73
		return null;
74
	}
75
	public EntityList createDeltaList(boolean detail, long changesSince, long offset, long limit) {
76
		return null;
77
	}
78
	*/
79
}
b/src/com/rackspace/cloud/loadbalancer/api/client/LoadBalancer.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.client;
5

  
6
import java.util.ArrayList;
7

  
8
public class LoadBalancer extends Entity {
9

  
10
	private static final long serialVersionUID = 5994739895998309675L;
11
	private String id;
12
	private String name;
13
	private String protocol;
14
	private String port;
15
	private String algorithm;
16
	private String status;
17
	private String isConnectionLoggingEnabled;
18
	private String created;
19
	private String updated;
20
	private String sessionPersistence;
21
	private String clusterName;
22
	private ConnectionThrottle connectionThrottle;
23
	private ArrayList<VirtualIp> virtualIps;
24
	private ArrayList<Node> nodes;
25
	
26

  
27
	public String getId() {
28
		return id;
29
	}
30

  
31
	public void setId(String id) {
32
		this.id = id;
33
	}
34

  
35
	public String getName() {
36
		return name;
37
	}
38

  
39
	public void setName(String name) {
40
		this.name = name;
41
	}
42

  
43
	public String getProtocol() {
44
		return protocol;
45
	}
46

  
47
	public void setProtocol(String protocol) {
48
		this.protocol = protocol;
49
	}
50

  
51
	public String getPort() {
52
		return port;
53
	}
54

  
55
	public void setPort(String port) {
56
		this.port = port;
57
	}
58

  
59
	public String getAlgorithm() {
60
		return algorithm;
61
	}
62

  
63
	public void setAlgorithm(String algorithm) {
64
		this.algorithm = algorithm;
65
	}
66

  
67
	public String getStatus() {
68
		return status;
69
	}
70

  
71
	public void setStatus(String status) {
72
		this.status = status;
73
	}
74

  
75
	public String getIsConnectionLoggingEnabled() {
76
		return isConnectionLoggingEnabled;
77
	}
78

  
79
	public void setIsConnectionLoggingEnabled(String isConnectionLoggingEnabled) {
80
		this.isConnectionLoggingEnabled = isConnectionLoggingEnabled;
81
	}
82
	
83
	public String getCreated() {
84
		return created;
85
	}
86

  
87
	public void setCreated(String created) {
88
		this.created = created;
89
	}
90

  
91
	public String getUpdated() {
92
		return updated;
93
	}
94

  
95
	public void setUpdated(String updated) {
96
		this.updated = updated;
97
	}
98

  
99
	public String getSessionPersistence() {
100
		return sessionPersistence;
101
	}
102

  
103
	public void setSessionPersistence(String sessionPersistence) {
104
		this.sessionPersistence = sessionPersistence;
105
	}
106

  
107
	public String getClusterName() {
108
		return clusterName;
109
	}
110

  
111
	public void setClusterName(String clusterName) {
112
		this.clusterName = clusterName;
113
	}
114

  
115
	public ConnectionThrottle getConnectionThrottle() {
116
		return connectionThrottle;
117
	}
118

  
119
	public void setConnectionThrottle(ConnectionThrottle connectionThrottle) {
120
		this.connectionThrottle = connectionThrottle;
121
	}
122

  
123
	public ArrayList<VirtualIp> getVirtualIps() {
124
		return virtualIps;
125
	}
126

  
127
	public void setVirtualIps(ArrayList<VirtualIp> virtualIps) {
128
		this.virtualIps = virtualIps;
129
	}
130

  
131
	public ArrayList<Node> getNodes() {
132
		return nodes;
133
	}
134

  
135
	public void setNodes(ArrayList<Node> nodes) {
136
		this.nodes = nodes;
137
	}
138

  
139
	public static long getSerialversionuid() {
140
		return serialVersionUID;
141
	}
142
	
143
	public String toXML() {
144
		String xml = "";
145
		xml = "<loadBalancer xmlns=\"http://docs.rackspacecloud.com/loadbalancers/api/v1.0\" name=\""
146
				+ getName() + "\" id=\"" + getId() + "</loadBalancer>";
147
		return xml;
148
	}
149

  
150
}
b/src/com/rackspace/cloud/loadbalancer/api/client/LoadBalancerManager.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.client;
5

  
6
import java.io.IOException;
7
import java.io.StringReader;
8
import java.util.ArrayList;
9

  
10
import javax.xml.parsers.FactoryConfigurationError;
11
import javax.xml.parsers.ParserConfigurationException;
12
import javax.xml.parsers.SAXParser;
13
import javax.xml.parsers.SAXParserFactory;
14

  
15
import org.apache.http.HttpResponse;
16
import org.apache.http.client.ClientProtocolException;
17
import org.apache.http.client.methods.HttpGet;
18
import org.apache.http.impl.client.BasicResponseHandler;
19
import org.apache.http.impl.client.DefaultHttpClient;
20
import org.xml.sax.InputSource;
21
import org.xml.sax.SAXException;
22
import org.xml.sax.XMLReader;
23

  
24
import android.util.Log;
25

  
26
import com.rackspace.cloud.loadbalancer.api.parsers.CloudLoadBalancersFaultXMLParser;
27
import com.rackspace.cloud.loadbalancer.api.parsers.LoadBalancersXmlParser;
28
import com.rackspace.cloud.loadbalancers.api.client.http.LoadBalancersException;
29
import com.rackspace.cloud.servers.api.client.Account;
30

  
31
public class LoadBalancerManager extends EntityManager {
32
		
33
	public LoadBalancer getLoadBalncerById(long id) throws  LoadBalancersException {
34
		//TODO:grab from ord and combine list
35
		DefaultHttpClient httpclient = new DefaultHttpClient();
36
		//TODO: check for uk or us
37
		HttpGet get = new HttpGet(Account.getAccount().getLoadBalancerDFWUrl() + Account.getAccount().getAccountId() + "/loadbalancers/" + id);
38
		LoadBalancer loadBalancer = new LoadBalancer();
39
		
40
		get.addHeader("X-Auth-Token", Account.getAccount().getAuthToken());
41
		get.addHeader("Accept", "application/xml");
42
		
43
		try {			
44
			HttpResponse resp = httpclient.execute(get);		    
45
		    BasicResponseHandler responseHandler = new BasicResponseHandler();
46
		    String body = responseHandler.handleResponse(resp);
47
		    Log.i("LB PARSE", body);
48
		    if (resp.getStatusLine().getStatusCode() == 200 || resp.getStatusLine().getStatusCode() == 202) {		    	
49
		    	LoadBalancersXmlParser loadBalancersXMLParser = new LoadBalancersXmlParser();
50
		    	SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
51
		    	XMLReader xmlReader = saxParser.getXMLReader();
52
		    	xmlReader.setContentHandler(loadBalancersXMLParser);
53
		    	xmlReader.parse(new InputSource(new StringReader(body)));		    	
54
		    	loadBalancer = loadBalancersXMLParser.getLoadBalancer();		    	
55
		    } else {
56
		    	CloudLoadBalancersFaultXMLParser parser = new CloudLoadBalancersFaultXMLParser();
57
		    	SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
58
		    	XMLReader xmlReader = saxParser.getXMLReader();
59
		    	xmlReader.setContentHandler(parser);
60
		    	xmlReader.parse(new InputSource(new StringReader(body)));		    	
61
		    	LoadBalancersException cse = parser.getException();		    	
62
		    	throw cse;
63
		    }
64
		} catch (ClientProtocolException e) {
65
			LoadBalancersException cse = new LoadBalancersException();
66
			cse.setMessage(e.getLocalizedMessage());
67
			throw cse;
68
		} catch (IOException e) {
69
			LoadBalancersException cse = new LoadBalancersException();
70
			cse.setMessage(e.getLocalizedMessage());
71
			throw cse;
72
		} catch (ParserConfigurationException e) {
73
			LoadBalancersException cse = new LoadBalancersException();
74
			cse.setMessage(e.getLocalizedMessage());
75
			throw cse;
76
		} catch (SAXException e) {
77
			LoadBalancersException cse = new LoadBalancersException();
78
			cse.setMessage(e.getLocalizedMessage());
79
			throw cse;
80
		} catch (FactoryConfigurationError e) {
81
			LoadBalancersException cse = new LoadBalancersException();
82
			cse.setMessage(e.getLocalizedMessage());
83
			throw cse;
84
		}
85
		
86
		return loadBalancer;
87
	}
88
	
89
public ArrayList<LoadBalancer> createList() throws LoadBalancersException {
90
		//TODO:grab from ord and combine list
91
		DefaultHttpClient httpclient = new DefaultHttpClient();
92
		//TODO:check for uk or us
93
		HttpGet get = new HttpGet(Account.getAccount().getLoadBalancerDFWUrl() + Account.getAccount().getAccountId() + "/loadbalancers");
94
		ArrayList<LoadBalancer> loadBalancers = new ArrayList<LoadBalancer>();
95
		
96
		get.addHeader("X-Auth-Token", Account.getAccount().getAuthToken());
97
		get.addHeader("Accept", "application/xml");
98
		
99
		try {			
100
			HttpResponse resp = httpclient.execute(get);		    
101
		    BasicResponseHandler responseHandler = new BasicResponseHandler();
102
		    String body = responseHandler.handleResponse(resp);
103
		    Log.i("LB PARSE", body);
104
		    if (resp.getStatusLine().getStatusCode() == 200 || resp.getStatusLine().getStatusCode() == 202) {		    	
105
		    	LoadBalancersXmlParser loadBalancersXMLParser = new LoadBalancersXmlParser();
106
		    	SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
107
		    	XMLReader xmlReader = saxParser.getXMLReader();
108
		    	xmlReader.setContentHandler(loadBalancersXMLParser);
109
		    	xmlReader.parse(new InputSource(new StringReader(body)));		    	
110
		    	loadBalancers = loadBalancersXMLParser.getLoadBalancers();		    	
111
		    } else {
112
		    	CloudLoadBalancersFaultXMLParser parser = new CloudLoadBalancersFaultXMLParser();
113
		    	SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
114
		    	XMLReader xmlReader = saxParser.getXMLReader();
115
		    	xmlReader.setContentHandler(parser);
116
		    	xmlReader.parse(new InputSource(new StringReader(body)));		    	
117
		    	LoadBalancersException cse = parser.getException();		    	
118
		    	throw cse;
119
		    }
120
		} catch (ClientProtocolException e) {
121
			LoadBalancersException cse = new LoadBalancersException();
122
			cse.setMessage(e.getLocalizedMessage());
123
			throw cse;
124
		} catch (IOException e) {
125
			LoadBalancersException cse = new LoadBalancersException();
126
			cse.setMessage(e.getLocalizedMessage());
127
			throw cse;
128
		} catch (ParserConfigurationException e) {
129
			LoadBalancersException cse = new LoadBalancersException();
130
			cse.setMessage(e.getLocalizedMessage());
131
			throw cse;
132
		} catch (SAXException e) {
133
			LoadBalancersException cse = new LoadBalancersException();
134
			cse.setMessage(e.getLocalizedMessage());
135
			throw cse;
136
		} catch (FactoryConfigurationError e) {
137
			LoadBalancersException cse = new LoadBalancersException();
138
			cse.setMessage(e.getLocalizedMessage());
139
			throw cse;
140
		}
141
		return loadBalancers;
142
	}
143
}
b/src/com/rackspace/cloud/loadbalancer/api/client/Node.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.client;
5

  
6
public class Node extends Entity {
7
	private static final long serialVersionUID = 5994739895998309675L;
8
	private String id;
9
	private String address;
10
	private String port;
11
	private String condition;
12
	private String status;
13
	public String getId() {
14
		return id;
15
	}
16
	public void setId(String id) {
17
		this.id = id;
18
	}
19
	public String getAddress() {
20
		return address;
21
	}
22
	public void setAddress(String address) {
23
		this.address = address;
24
	}
25
	public String getPort() {
26
		return port;
27
	}
28
	public void setPort(String port) {
29
		this.port = port;
30
	}
31
	public String getCondition() {
32
		return condition;
33
	}
34
	public void setCondition(String condition) {
35
		this.condition = condition;
36
	}
37
	public String getStatus() {
38
		return status;
39
	}
40
	public void setStatus(String status) {
41
		this.status = status;
42
	}
43
	public static long getSerialversionuid() {
44
		return serialVersionUID;
45
	}
46
}
b/src/com/rackspace/cloud/loadbalancer/api/client/VirtualIp.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.client;
5

  
6
public class VirtualIp extends Entity {
7

  
8
	private static final long serialVersionUID = 5994739895998309675L;
9
	private String id;
10
	private String address;
11
	private String ipVersion;
12
	private String type;
13
	public String getId() {
14
		return id;
15
	}
16
	public void setId(String id) {
17
		this.id = id;
18
	}
19
	public String getAddress() {
20
		return address;
21
	}
22
	public void setAddress(String address) {
23
		this.address = address;
24
	}
25
	public String getIpVersion() {
26
		return ipVersion;
27
	}
28
	public void setIpVersion(String ipVersion) {
29
		this.ipVersion = ipVersion;
30
	}
31
	public String getType() {
32
		return type;
33
	}
34
	public void setType(String type) {
35
		this.type = type;
36
	}
37
}
b/src/com/rackspace/cloud/loadbalancer/api/parsers/CloudLoadBalancersFaultXMLParser.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.parsers;
5

  
6
import org.xml.sax.Attributes;
7
import org.xml.sax.helpers.DefaultHandler;
8

  
9
import com.rackspace.cloud.loadbalancers.api.client.http.LoadBalancersException;
10

  
11
import android.util.Log;
12

  
13
public class CloudLoadBalancersFaultXMLParser extends DefaultHandler {
14

  
15
	private LoadBalancersException exception;
16
	private StringBuffer currentData;
17

  
18
	public void startDocument() {
19
		exception = new LoadBalancersException();
20
	}
21

  
22
	public void endDocument() {
23
	}
24

  
25
	public void startElement(String uri, String name, String qName, Attributes atts) {
26

  
27
		currentData = new StringBuffer();
28
		if ("cloudServersFault".equals(name)) {
29
			exception.setCode(Integer.parseInt(atts.getValue("code")));
30
		}
31
	}
32

  
33
	public void endElement(String uri, String name, String qName) {
34
		if ("message".equals(name)) {
35
			exception.setMessage(currentData.toString());
36
		} else if ("details".equals(name)) {
37
			exception.setDetails(currentData.toString());
38
		}
39
	}
40

  
41
	public void characters(char ch[], int start, int length) {
42
		Log.d("Rackspace-Cloud", "Characters:    \"");
43
		for (int i = start; i < start + length; i++) {
44
			switch (ch[i]) {
45
			case '\\':
46
				Log.d("Rackspace-Cloud", "\\\\");
47
				break;
48
			case '"':
49
				Log.d("Rackspace-Cloud", "\\\"");
50
				break;
51
			case '\n':
52
				Log.d("Rackspace-Cloud", "\\n");
53
				break;
54
			case '\r':
55
				Log.d("Rackspace-Cloud", "\\r");
56
				break;
57
			case '\t':
58
				Log.d("Rackspace-Cloud", "\\t");
59
				break;
60
			default:
61
				Log.d("Rackspace-Cloud", String.valueOf(ch[i]));
62
				break;
63
			}
64
		}
65
		Log.d("Rackspace-Cloud", "\"\n");
66
		
67
		
68
		for (int i = start; i < (start + length); i++) {
69
			currentData.append(ch[i]);
70
		}
71
	}
72

  
73
	/**
74
	 * @return the exception
75
	 */
76
	public LoadBalancersException getException() {
77
		return exception;
78
	}
79

  
80
	/**
81
	 * @param exception the exception to set
82
	 */
83
	public void setException(LoadBalancersException exception) {
84
		this.exception = exception;
85
	}
86

  
87
	
88
}
b/src/com/rackspace/cloud/loadbalancer/api/parsers/LoadBalancersXmlParser.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancer.api.parsers;
5

  
6
import java.util.ArrayList;
7
import org.xml.sax.Attributes;
8
import org.xml.sax.helpers.DefaultHandler;
9
import android.util.Log;
10

  
11
import com.rackspace.cloud.loadbalancer.api.client.ConnectionThrottle;
12
import com.rackspace.cloud.loadbalancer.api.client.LoadBalancer;
13
import com.rackspace.cloud.loadbalancer.api.client.Node;
14
import com.rackspace.cloud.loadbalancer.api.client.VirtualIp;
15

  
16
public class LoadBalancersXmlParser extends DefaultHandler {
17

  
18
	private LoadBalancer loadBalancer;
19
	private ArrayList<LoadBalancer> loadBalancers;
20
	private ConnectionThrottle connectionThrottle;
21
	private VirtualIp virtualIp;
22
	private ArrayList<VirtualIp> virtualIps;
23
	private Node node;
24
	private ArrayList<Node> nodes;
25
	private StringBuffer currentData;
26

  
27
	public void startDocument() {
28
	}
29

  
30
	public void endDocument() {
31
	}
32

  
33
	public void startElement(String uri, String name, String qName,
34
			Attributes atts) {
35

  
36
		currentData = new StringBuffer();
37
		if ("loadBalancers".equals(name)) {
38
			loadBalancers = new ArrayList<LoadBalancer>();
39
		} else if ("loadBalancer".equals(name)) {
40
			loadBalancer = new LoadBalancer();
41
			loadBalancer.setId(atts.getValue("id"));
42
			loadBalancer.setName(atts.getValue("name"));
43
			loadBalancer.setProtocol(atts.getValue("protocol"));
44
			loadBalancer.setPort(atts.getValue("port"));
45
			loadBalancer.setAlgorithm(atts.getValue("algorithm"));
46
			loadBalancer.setStatus(atts.getValue("status"));
47
		} else if ("connectionLogging".equalsIgnoreCase(name)) {
48
			loadBalancer.setIsConnectionLoggingEnabled(atts.getValue("enabled"));
49
		} else if ("created".equalsIgnoreCase(name)) {
50
			loadBalancer.setCreated(atts.getValue("time"));
51
		} else if ("updated".equalsIgnoreCase(name)) {
52
			loadBalancer.setCreated(atts.getValue("time"));
53
		} else if ("sessionPersistence".equalsIgnoreCase(name)) {
54
			loadBalancer.setSessionPersistence(atts.getValue("sessionPersistence"));
55
		} else if ("clusterName".equalsIgnoreCase(name)) {
56
			loadBalancer.setClusterName(atts.getValue("clusterName"));
57
		} else if ("connectionThrottle".equalsIgnoreCase(name)) {
58
			connectionThrottle = new ConnectionThrottle();
59
			connectionThrottle.setMaxConnectionRate(atts.getValue("maxConnectionRate"));
60
			connectionThrottle.setMinConnections(atts.getValue("minConnections"));
61
			connectionThrottle.setMaxConnections(atts.getValue("maxConnections"));
62
			connectionThrottle.setRateInterval(atts.getValue("rateInterval"));
63
			loadBalancer.setConnectionThrottle(connectionThrottle);
64
		} else if ("virtualIps".equalsIgnoreCase(name)) {
65
			virtualIps = new ArrayList<VirtualIp>();
66
		} else if ("virtualIp".equalsIgnoreCase(name)) {
67
			virtualIp = new VirtualIp();
68
			virtualIp.setId(atts.getValue("id"));
69
			virtualIp.setAddress(atts.getValue("address"));
70
			virtualIp.setIpVersion(atts.getValue("ipVersion"));
71
			virtualIp.setType(atts.getValue("type"));
72
		} else if ("nodes".equalsIgnoreCase(name)) {
73
			nodes = new ArrayList<Node>();
74
		} else if ("node".equalsIgnoreCase(name)) {
75
			node = new Node();
76
			node.setId(atts.getValue("id"));
77
			node.setAddress(atts.getValue("address"));
78
			node.setPort(atts.getValue("port"));
79
			node.setCondition(atts.getValue("condition"));
80
			node.setStatus(atts.getValue("status"));
81
		} 
82
	}
83

  
84
	public void endElement(String uri, String name, String qName) {
85
		if ("loadBalancers".equals(name)) {
86
			// Do nothing
87
		} else if ("loadBalancer".equals(name)) {
88
			if (loadBalancers != null) {
89
				loadBalancers.add(loadBalancer);
90
			}
91
		}  else if ("virtualIps".equalsIgnoreCase(name)) {
92
			loadBalancer.setVirtualIps(virtualIps);
93
		} else if ("virtualIp".equalsIgnoreCase(name)) {
94
			if (virtualIps != null) {
95
				virtualIps.add(virtualIp);
96
			}
97
		} else if ("nodes".equalsIgnoreCase(name)) {
98
			loadBalancer.setNodes(nodes);
99
		} else if ("node".equalsIgnoreCase(name)) {
100
			if (nodes != null) {
101
				nodes.add(node);
102
			}
103
		}
104
	}
105

  
106
	public void characters(char ch[], int start, int length) {
107
		Log.d("Rackspace-Cloud", "Characters:    \"");
108
		for (int i = start; i < start + length; i++) {
109
			switch (ch[i]) {
110
			case '\\':
111
				Log.d("Rackspace-Cloud", "\\\\");
112
				break;
113
			case '"':
114
				Log.d("Rackspace-Cloud", "\\\"");
115
				break;
116
			case '\n':
117
				Log.d("Rackspace-Cloud", "\\n");
118
				break;
119
			case '\r':
120
				Log.d("Rackspace-Cloud", "\\r");
121
				break;
122
			case '\t':
123
				Log.d("Rackspace-Cloud", "\\t");
124
				break;
125
			default:
126
				Log.d("Rackspace-Cloud", String.valueOf(ch[i]));
127
				break;
128
			}
129
		}
130
		Log.d("Rackspace-Cloud", "\"\n");
131

  
132
		for (int i = start; i < (start + length); i++) {
133
			currentData.append(ch[i]);
134
		}
135
	}
136

  
137
	public LoadBalancer getLoadBalancer() {
138
		return loadBalancer;
139
	}
140

  
141
	public void setLoadBalancer(LoadBalancer loadBalancer) {
142
		this.loadBalancer = loadBalancer;
143
	}
144

  
145
	public ArrayList<LoadBalancer> getLoadBalancers() {
146
		return loadBalancers;
147
	}
148

  
149
	public void setLoadBalancers(ArrayList<LoadBalancer> loadBalancers) {
150
		this.loadBalancers = loadBalancers;
151
	}
152

  
153
	public VirtualIp getVirtualIp() {
154
		return virtualIp;
155
	}
156

  
157
	public void setVirtualIp(VirtualIp virtualIp) {
158
		this.virtualIp = virtualIp;
159
	}
160

  
161
	public ArrayList<VirtualIp> getVirtualIps() {
162
		return virtualIps;
163
	}
164

  
165
	public void setVirtualIps(ArrayList<VirtualIp> virtualIps) {
166
		this.virtualIps = virtualIps;
167
	}
168

  
169
	public Node getNode() {
170
		return node;
171
	}
172

  
173
	public void setNode(Node node) {
174
		this.node = node;
175
	}
176

  
177
	public ArrayList<Node> getNodes() {
178
		return nodes;
179
	}
180

  
181
	public void setNodes(ArrayList<Node> nodes) {
182
		this.nodes = nodes;
183
	}
184

  
185
	public StringBuffer getCurrentData() {
186
		return currentData;
187
	}
188

  
189
	public void setCurrentData(StringBuffer currentData) {
190
		this.currentData = currentData;
191
	}
192
}
b/src/com/rackspace/cloud/loadbalancers/api/client/http/LoadBalancersException.java
1
/**
2
 * 
3
 */
4
package com.rackspace.cloud.loadbalancers.api.client.http;
5

  
6
public class LoadBalancersException extends Exception {
7

  
8
	private static final long serialVersionUID = -4788874449651935081L;
9
	private int code;
10
	private String message;
11
	private String details;
12
	
13
	/**
14
	 * @return the code
15
	 */
16
	public int getCode() {
17
		return code;
18
	}
19
	/**
20
	 * @param code the code to set
21
	 */
22
	public void setCode(int code) {
23
		this.code = code;
24
	}
25
	/**
26
	 * @return the message
27
	 */
28
	public String getMessage() {
29
		return message;
30
	}
31
	/**
32
	 * @param message the message to set
33
	 */
34
	public void setMessage(String message) {
35
		this.message = message;
36
	}
37
	/**
38
	 * @return the details
39
	 */
40
	public String getDetails() {
41
		return details;
42
	}
43
	/**
44
	 * @param details the details to set
45
	 */
46
	public void setDetails(String details) {
47
		this.details = details;
48
	}
49
	
50
	
51
}
b/src/com/rackspace/cloud/utils/StringUtils.java
1
package com.rackspace.cloud.utils;
2

  
3
public class StringUtils {
4
	public static String splitByDelemiter(String stringToSplit, String delemiter, int indexToReturn) {
5
		String[] splitString = stringToSplit.split(delemiter); 
6
		return splitString[indexToReturn];
7
	}
8
}
b/src/com/rackspacecloud/android/ActivityChooser.java
1
/**
2
 * 
3
 */
4
package com.rackspacecloud.android;
5

  
6
import android.app.Activity;
7
import android.app.ProgressDialog;
8
import android.app.TabActivity;
9
import android.content.Context;
10
import android.content.DialogInterface;
11
import android.content.DialogInterface.OnClickListener;
12
import android.content.Intent;
13
import android.util.Log;
14
import android.view.Gravity;
15
import android.view.View;
16
import android.view.WindowManager;
17
import android.view.ViewGroup.LayoutParams;
18
import android.widget.ArrayAdapter;
19
import android.widget.Button;
20
import android.widget.ImageButton;
21
import android.widget.LinearLayout;
22
import android.widget.ListView;
23
import android.widget.ProgressBar;
24
import android.widget.TabHost;
25
import android.os.Bundle;
26

  
27
public class ActivityChooser extends Activity {
28
	private Context context;
29
	ProgressDialog pDialog;
30

  
31

  
32
	@Override
33
	public void onCreate(Bundle savedInstanceState) {
34
		super.onCreate(savedInstanceState);
35
		setContentView(R.layout.activity_choser);
36
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
37

  
38
		context = this;
39
		// Set up buttons
40
		ImageButton button1 = (ImageButton) findViewById(R.id.serverbutton);
41
		ImageButton button2 = (ImageButton) findViewById(R.id.filesbutton);
42
		ImageButton button3 = (ImageButton) findViewById(R.id.loadbalancersbutton);
43
		
44
		button1.setOnClickListener(myListener);
45
		button2.setOnClickListener(myListener);
46
		button3.setOnClickListener(myListener);
47
	}
48

  
49
	View.OnClickListener myListener = new View.OnClickListener() {
50
		public void onClick(View v) {
51
			switch (v.getId()) {
52
			case R.id.serverbutton:
53
				//
54
			case R.id.filesbutton:
55
				//
56
			case R.id.loadbalancersbutton:
57
				Intent loadBalancersActivityIntent = new Intent(context, LoadBalancersActivity.class);
58
				startActivity(loadBalancersActivityIntent);
59
			default:
60
				// Nothing
61
				break;
62
			}
63
		}
64
	};
65
	
66
	protected void showDialog() {
67
    	pDialog = new ProgressDialog(context, R.style.NewDialog);
68
//		// Set blur to background
69
		WindowManager.LayoutParams lp = pDialog.getWindow().getAttributes();
70
		lp.dimAmount = 0.0f;
71
		pDialog.getWindow().setAttributes(lp);
72
		pDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
73
        pDialog.show();
74
        pDialog.setContentView(new ProgressBar(context), new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));    
75
    }
76
}
b/src/com/rackspacecloud/android/ListLoadBalancersActivity.java
1
package com.rackspacecloud.android;
2

  
3
import java.util.ArrayList;
4

  
5
import android.app.AlertDialog;
6
import android.app.ListActivity;
7
import android.app.ProgressDialog;
8
import android.content.DialogInterface;
9
import android.content.Intent;
10
import android.os.AsyncTask;
11
import android.os.Bundle;
12
import android.util.Log;
13
import android.view.LayoutInflater;
14
import android.view.View;
15
import android.view.ViewGroup;
16
import android.view.WindowManager;
17
import android.view.ViewGroup.LayoutParams;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff