Revision 4f9d1a69
b/AndroidManifest.xml | ||
---|---|---|
146 | 146 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
147 | 147 |
<activity android:name=".AddNodesActivity"></activity> |
148 | 148 |
<activity android:name=".AddNodeActivity" android:theme="@android:style/Theme.Dialog"></activity> |
149 |
<activity android:name=".EditNodeActivity" android:theme="@android:style/Theme.Dialog"></activity> |
|
150 |
<activity android:name=".EditNodesActivity"></activity> |
|
151 |
<activity android:name=".EditLoadBalancerActivity"></activity> |
|
152 |
<activity android:name=".AddMoreNodesActivity"></activity> |
|
149 | 153 |
|
150 | 154 |
|
151 | 155 |
|
/dev/null | ||
---|---|---|
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/rackbg_land"> |
|
6 |
<ImageView android:id="@+id/headerimage" |
|
7 |
android:layout_width="wrap_content" android:layout_height="80dip"/> |
|
8 |
<LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:background="@drawable/itemsbox_landscape" android:layout_width="fill_parent" android:paddingLeft="5dip" android:id="@+id/view_loadbalancer_layout"> |
|
9 |
<TextView android:text="LoadBalancer" android:textSize="20.0sp" android:gravity="fill_horizontal" android:layout_marginLeft="22dip" android:layout_height="wrap_content" android:scrollHorizontally="true" android:paddingBottom="10dip" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent" android:layout_marginTop="30dip"></TextView> |
|
10 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_lb_id_layout"> |
|
11 |
<TextView android:text="ID: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
12 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_lb_id" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
13 |
</LinearLayout> |
|
14 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_name_layout"> |
|
15 |
<TextView android:text="ID: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
16 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_name" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
17 |
</LinearLayout> |
|
18 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_protocol_layout"> |
|
19 |
<TextView android:text="Protocol: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
20 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_protocol" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
21 |
</LinearLayout> |
|
22 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_port_layout"> |
|
23 |
<TextView android:text="Port: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
24 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_port" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
25 |
</LinearLayout> |
|
26 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_algorithm_layout"> |
|
27 |
<TextView android:text="Algorithm: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
28 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_algorithm" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
29 |
</LinearLayout> |
|
30 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_status_layout"> |
|
31 |
<TextView android:text="Status: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
32 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_status" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
33 |
</LinearLayout> |
|
34 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_islogging_layout"> |
|
35 |
<TextView android:text="Connection Logging: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
36 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_islogging" android:layout_height="wrap_content" android:scrollHorizontally="true" android:paddingBottom="30dip" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
37 |
</LinearLayout> |
|
38 |
</LinearLayout> |
|
39 |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
|
40 |
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> |
|
41 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
42 |
android:id="@+id/view_layout_layout" android:orientation="vertical" |
|
43 |
android:layout_width="fill_parent" android:layout_height="fill_parent"> |
|
44 |
<!-- VirtualIps --> |
|
45 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
46 |
android:id="@+id/view_loadbalancer_layout" android:orientation="vertical" |
|
47 |
android:layout_width="fill_parent" android:layout_height="wrap_content" |
|
48 |
android:paddingLeft="5dip" android:background="@drawable/itemsbox_landscape"> |
|
49 |
<TextView android:layout_height="wrap_content" |
|
50 |
android:layout_width="fill_parent" android:layout_marginLeft="22dip" |
|
51 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
52 |
android:gravity="fill_horizontal" android:textSize="20.0sp" |
|
53 |
android:textColor="#fff" android:layout_marginTop="30dip" |
|
54 |
android:paddingBottom="10dip" android:text="VirtualIps" /> |
|
55 |
<!-- ID --> |
|
56 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
57 |
android:id="@+id/view_vip_id_layout" android:orientation="horizontal" |
|
58 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
59 |
<TextView android:layout_width="wrap_content" |
|
60 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
61 |
android:paddingLeft="5dip" android:text="ID: " android:singleLine="false" |
|
62 |
android:textStyle="bold" /> |
|
63 |
<TextView android:id="@+id/view_vip_id" |
|
64 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
65 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
66 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
67 |
</LinearLayout> |
|
68 |
<!-- Ip Address --> |
|
69 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
70 |
android:id="@+id/view_vip_address_layout" android:orientation="horizontal" |
|
71 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
72 |
<TextView android:layout_width="wrap_content" |
|
73 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
74 |
android:paddingLeft="5dip" android:text="IpAddress: " |
|
75 |
android:singleLine="false" android:textStyle="bold" /> |
|
76 |
<TextView android:id="@+id/view_vip_address" |
|
77 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
78 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
79 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
80 |
</LinearLayout> |
|
81 |
<!-- IpVersion --> |
|
82 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
83 |
android:id="@+id/view_ipversion_layout" android:orientation="horizontal" |
|
84 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
85 |
<TextView android:layout_width="wrap_content" |
|
86 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
87 |
android:paddingLeft="5dip" android:text="IpVersion: " |
|
88 |
android:singleLine="false" android:textStyle="bold" /> |
|
89 |
<TextView android:id="@+id/view_ipversion" |
|
90 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
91 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
92 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
93 |
</LinearLayout> |
|
94 |
<!-- Type --> |
|
95 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
96 |
android:id="@+id/view_vip_type_layout" android:orientation="horizontal" |
|
97 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
98 |
<TextView android:layout_width="wrap_content" |
|
99 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
100 |
android:paddingLeft="5dip" android:text="Type: " |
|
101 |
android:singleLine="false" android:textStyle="bold" /> |
|
102 |
<TextView android:id="@+id/view_vip_type" |
|
103 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
104 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
105 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
106 |
</LinearLayout> |
|
107 |
</LinearLayout> |
|
108 |
<!-- Nodes --> |
|
109 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
110 |
android:id="@+id/view_loadbalancer_layout" android:orientation="vertical" |
|
111 |
android:layout_width="fill_parent" android:layout_height="wrap_content" |
|
112 |
android:paddingLeft="5dip" android:background="@drawable/itemsbox_landscape"> |
|
113 |
<TextView android:layout_height="wrap_content" |
|
114 |
android:layout_width="fill_parent" android:layout_marginLeft="22dip" |
|
115 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
116 |
android:gravity="fill_horizontal" android:textSize="20.0sp" |
|
117 |
android:textColor="#fff" android:layout_marginTop="30dip" |
|
118 |
android:paddingBottom="10dip" android:text="Nodes" /> |
|
119 |
<!-- ID --> |
|
120 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
121 |
android:id="@+id/view_node_id_layout" android:orientation="horizontal" |
|
122 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
123 |
<TextView android:layout_width="wrap_content" |
|
124 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
125 |
android:paddingLeft="5dip" android:text="ID: " android:singleLine="false" |
|
126 |
android:textStyle="bold" /> |
|
127 |
<TextView android:id="@+id/view_node_id" |
|
128 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
129 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
130 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
131 |
</LinearLayout> |
|
132 |
<!-- Address --> |
|
133 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
134 |
android:id="@+id/view_node_address_layout" android:orientation="horizontal" |
|
135 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
136 |
<TextView android:layout_width="wrap_content" |
|
137 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
138 |
android:paddingLeft="5dip" android:text="Address: " |
|
139 |
android:singleLine="false" android:textStyle="bold" /> |
|
140 |
<TextView android:id="@+id/view_node_address" |
|
141 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
142 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
143 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
144 |
</LinearLayout> |
|
145 |
<!-- Port --> |
|
146 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
147 |
android:id="@+id/view_node_port_layout" android:orientation="horizontal" |
|
148 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
149 |
<TextView android:layout_width="wrap_content" |
|
150 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
151 |
android:paddingLeft="5dip" android:text="Port: " |
|
152 |
android:singleLine="false" android:textStyle="bold" /> |
|
153 |
<TextView android:id="@+id/view_node_port" |
|
154 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
155 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
156 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
157 |
</LinearLayout> |
|
158 |
<!-- Condition --> |
|
159 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
160 |
android:id="@+id/view_node_condition_layout" android:orientation="horizontal" |
|
161 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
162 |
<TextView android:layout_width="wrap_content" |
|
163 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
164 |
android:paddingLeft="5dip" android:text="Condition: " |
|
165 |
android:singleLine="false" android:textStyle="bold" /> |
|
166 |
<TextView android:id="@+id/view_node_condition" |
|
167 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
168 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
169 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
170 |
</LinearLayout> |
|
171 |
<!-- Status --> |
|
172 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
173 |
android:id="@+id/view_node_status_layout" android:orientation="horizontal" |
|
174 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
175 |
<TextView android:layout_width="wrap_content" |
|
176 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
177 |
android:paddingLeft="5dip" android:text="Status: " |
|
178 |
android:singleLine="false" android:textStyle="bold" /> |
|
179 |
<TextView android:id="@+id/view_node_status" |
|
180 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
181 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
182 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
183 |
</LinearLayout> |
|
184 |
</LinearLayout> |
|
185 |
</LinearLayout> |
|
186 |
</ScrollView> |
|
187 |
<ImageView android:id="@+id/footerimage" android:layout_width="wrap_content" android:layout_height="25dip"/> |
|
188 |
</LinearLayout> |
b/res/layout/addnodes.xml | ||
---|---|---|
4 | 4 |
android:layout_height="fill_parent" android:background="@drawable/rack_bg_transparent"> |
5 | 5 |
<ImageView android:id="@+id/headerimage" |
6 | 6 |
android:layout_width="wrap_content" android:layout_height="80dip"></ImageView> |
7 |
<LinearLayout 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:cacheColorHint="@android:color/transparent" |
|
11 |
android:layout_height="417dp" /> |
|
12 |
</LinearLayout> |
|
7 |
<RelativeLayout android:layout_width="fill_parent" |
|
8 |
android:id="@+id/nodes_relative" android:layout_height="fill_parent"> |
|
9 |
<ScrollView android:layout_height="wrap_content" |
|
10 |
android:orientation="vertical" android:layout_width="wrap_content" |
|
11 |
android:id="@+id/node_scroll" android:layout_above="@+id/submit_nodes_button"> |
|
12 |
<LinearLayout android:layout_width="fill_parent" |
|
13 |
android:id="@+id/nodes_linear_layout" android:layout_height="fill_parent"> |
|
14 |
<ListView android:layout_weight="1" android:layout_width="fill_parent" |
|
15 |
android:cacheColorHint="@android:color/transparent" |
|
16 |
android:layout_height="417dp" android:id="@android:id/list"></ListView> |
|
17 |
</LinearLayout> |
|
18 |
</ScrollView> |
|
19 |
<Button android:layout_height="wrap_content" android:layout_alignParentBottom="true" |
|
20 |
android:layout_centerInParent="true" android:layout_marginBottom="15dip" |
|
21 |
android:layout_width="120dp" android:text="Add Nodes" |
|
22 |
android:layout_marginTop="5dip" android:id="@+id/submit_nodes_button"></Button> |
|
23 |
</RelativeLayout> |
|
13 | 24 |
<ImageView android:id="@+id/headerimage" |
14 | 25 |
android:layout_width="wrap_content" android:layout_height="25dip"></ImageView> |
15 | 26 |
</LinearLayout> |
b/res/layout/displaynodecell.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
3 |
android:orientation="horizontal" android:layout_width="fill_parent" |
|
4 |
android:layout_height="64dip"> |
|
5 |
<RelativeLayout android:layout_width="wrap_content" android:id="@+id/relativeLayout1" android:paddingBottom="2.5dip" android:layout_height="wrap_content" android:paddingTop="2.5dip"> |
|
6 |
<LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_marginLeft="10dip" android:layout_centerVertical="true"> |
|
7 |
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/ip_address_layout"> |
|
8 |
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/textView1" android:text="IP Address: "></TextView> |
|
9 |
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/ip_address_text"></TextView> |
|
10 |
</LinearLayout> |
|
11 |
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/condition_layout"> |
|
12 |
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/TextView02" android:text="Condition: "></TextView> |
|
13 |
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/condition_text"></TextView> |
|
14 |
</LinearLayout> |
|
15 |
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/port_layout"> |
|
16 |
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/TextView03" android:text="Port:"></TextView> |
|
17 |
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/port_text"></TextView> |
|
18 |
</LinearLayout> |
|
19 |
</LinearLayout> |
|
20 |
</RelativeLayout> |
|
21 |
|
|
22 |
|
|
23 |
</LinearLayout> |
b/res/layout/editnode.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
|
3 |
android:orientation="vertical" android:layout_height="fill_parent" |
|
4 |
android:layout_width="250dip"> |
|
5 |
<LinearLayout android:layout_height="wrap_content" |
|
6 |
android:id="@+id/linearLayout1" android:layout_width="fill_parent" |
|
7 |
android:orientation="vertical"> |
|
8 |
<TextView android:id="@+id/textView1" android:layout_width="wrap_content" |
|
9 |
android:layout_height="wrap_content" android:layout_marginTop="10dip" android:layout_marginLeft="10dip" android:text="IP Address:"></TextView> |
|
10 |
<TextView android:text="TextView" android:layout_height="wrap_content" |
|
11 |
android:layout_width="fill_parent" android:layout_marginLeft="20dip" |
|
12 |
android:layout_marginRight="30dip" android:id="@+id/node_ip_text" android:textAppearance="?android:attr/textAppearanceLarge"></TextView> |
|
13 |
<TextView android:id="@+id/textView2" android:layout_width="wrap_content" |
|
14 |
android:layout_height="wrap_content" android:layout_marginTop="10dip" android:layout_marginLeft="10dip" android:text="Port:"></TextView> |
|
15 |
<TextView android:layout_marginLeft="20dip" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="TextView" android:layout_marginRight="30dip" android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/node_port_text"></TextView> |
|
16 |
<TextView android:layout_width="wrap_content" android:id="@+id/TextView01" |
|
17 |
android:layout_height="wrap_content" |
|
18 |
android:layout_marginTop="10dip" android:layout_marginLeft="10dip" android:text="Condition:"></TextView> |
|
19 |
<Spinner android:layout_marginLeft="20dip" |
|
20 |
android:layout_height="wrap_content" android:layout_marginRight="30dip" android:id="@+id/node_condition_spinner" android:layout_width="fill_parent"></Spinner> |
|
21 |
<TextView android:layout_marginLeft="10dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginTop="10dip" android:text="Weight:" android:id="@+id/node_weight_label"></TextView> |
|
22 |
<EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:inputType="number" android:layout_marginLeft="20dip" android:layout_marginRight="30dip" android:id="@+id/node_weight_text"></EditText> |
|
23 |
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:layout_width="fill_parent" android:layout_marginTop="10dip" android:gravity="center_horizontal"> |
|
24 |
<Button android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:id="@+id/edit_node_button" android:text="Save Changes" android:layout_width="100dip"></Button> |
|
25 |
<Button android:layout_height="wrap_content" android:id="@+id/delete_node_button" android:layout_marginBottom="10dip" android:text="Remove Node" android:layout_width="100dip"></Button> |
|
26 |
</LinearLayout> |
|
27 |
</LinearLayout> |
|
28 |
|
|
29 |
</ScrollView> |
b/res/layout/list_loadbalancers.xml | ||
---|---|---|
9 | 9 |
android:layout_height="fill_parent"> |
10 | 10 |
<ListView android:id="@+id/android:list" |
11 | 11 |
android:layout_width="fill_parent" android:layout_height="fill_parent" |
12 |
android:cacheColorHint="@android:color/transparent" />
|
|
12 |
android:cacheColorHint="@android:color/transparent"/> |
|
13 | 13 |
</LinearLayout> |
14 | 14 |
<ImageView android:id="@+id/headerimage" |
15 | 15 |
android:layout_width="wrap_content" android:layout_height="25dip"></ImageView> |
b/res/layout/updateloadbalancer.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 |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
|
6 |
android:layout_width="fill_parent" android:layout_height="fill_parent"> |
|
7 |
<TableLayout android:layout_width="fill_parent" android:paddingBottom="30dip" |
|
8 |
android:id="@+id/view_loadbalancer_layout" android:paddingLeft="5dip" android:layout_height="fill_parent"> |
|
9 |
<TableRow android:layout_width="fill_parent" |
|
10 |
android:layout_height="wrap_content" android:id="@+id/edit_lb_name_layout" |
|
11 |
android:orientation="horizontal" android:layout_marginTop="10dip"> |
|
12 |
<TextView android:layout_marginLeft="22dip" |
|
13 |
android:textStyle="bold" android:singleLine="false" |
|
14 |
android:layout_height="wrap_content" android:paddingLeft="5dip" |
|
15 |
android:layout_gravity="center_vertical" android:text="Name" |
|
16 |
android:layout_width="wrap_content" android:textColor="#333"></TextView> |
|
17 |
<EditText android:layout_height="wrap_content" android:id="@+id/edit_lb_name_text" |
|
18 |
android:layout_weight="1" android:layout_marginRight="20dip" |
|
19 |
android:layout_width="wrap_content"> |
|
20 |
<requestFocus></requestFocus> |
|
21 |
</EditText> |
|
22 |
</TableRow> |
|
23 |
<TableRow android:layout_width="fill_parent" |
|
24 |
android:layout_height="wrap_content" android:id="@+id/edit_protocol_layout" |
|
25 |
android:orientation="horizontal"> |
|
26 |
<TextView android:layout_marginLeft="22dip" |
|
27 |
android:textStyle="bold" android:singleLine="false" |
|
28 |
android:layout_height="wrap_content" android:paddingLeft="5dip" |
|
29 |
android:layout_gravity="center_vertical" android:text="Protocol" |
|
30 |
android:layout_width="wrap_content" android:textColor="#333"></TextView> |
|
31 |
<Spinner android:id="@+id/edit_protocol_spinner" |
|
32 |
android:layout_weight="1" android:layout_height="wrap_content" |
|
33 |
android:layout_marginRight="20dip" android:layout_width="wrap_content"></Spinner> |
|
34 |
</TableRow> |
|
35 |
<TableRow android:layout_width="fill_parent" |
|
36 |
android:layout_height="wrap_content" android:id="@+id/edit_port_layout" |
|
37 |
android:orientation="horizontal"> |
|
38 |
<TextView android:layout_marginLeft="22dip" |
|
39 |
android:textStyle="bold" android:singleLine="false" |
|
40 |
android:layout_height="wrap_content" android:paddingLeft="5dip" |
|
41 |
android:layout_gravity="center_vertical" android:text="Port" |
|
42 |
android:layout_width="wrap_content" android:textColor="#333"></TextView> |
|
43 |
<EditText android:inputType="number" android:layout_height="wrap_content" |
|
44 |
android:id="@+id/edit_port_text" android:layout_weight="1" |
|
45 |
android:layout_marginRight="20dip" android:layout_width="fill_parent"></EditText> |
|
46 |
</TableRow> |
|
47 |
<TableRow android:layout_width="fill_parent" |
|
48 |
android:layout_height="wrap_content" android:id="@+id/edit_algorithm_layout" |
|
49 |
android:orientation="horizontal"> |
|
50 |
<TextView android:layout_marginLeft="22dip" |
|
51 |
android:textStyle="bold" android:singleLine="false" |
|
52 |
android:layout_height="wrap_content" android:paddingLeft="5dip" |
|
53 |
android:layout_gravity="center_vertical" android:text="Algorithm" |
|
54 |
android:layout_width="wrap_content" android:textColor="#333"></TextView> |
|
55 |
<Spinner android:id="@+id/edit_algorithm_spinner" |
|
56 |
android:layout_weight="1" android:layout_height="wrap_content" |
|
57 |
android:layout_marginRight="20dip" android:layout_width="wrap_content"></Spinner> |
|
58 |
</TableRow> |
|
59 |
<Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:layout_marginTop="10dip" android:layout_marginRight="30dip" android:layout_marginLeft="30dip" android:text="Update Load Balancer" android:id="@+id/update_lb_button"></Button> |
|
60 |
</TableLayout> |
|
61 |
</ScrollView> |
|
62 |
</LinearLayout> |
b/res/layout/view_add_loadbalancer.xml | ||
---|---|---|
6 | 6 |
<ImageView android:id="@+id/headerimage" |
7 | 7 |
android:layout_width="wrap_content" android:layout_height="80dip" /> |
8 | 8 |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
9 |
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
|
10 |
android:layout_weight="1">
|
|
11 |
<TableLayout android:layout_height="wrap_content"
|
|
12 |
android:background="@drawable/itemsbox" android:layout_width="fill_parent"
|
|
13 |
android:paddingLeft="5dip" android:id="@+id/view_loadbalancer_layout"
|
|
14 |
android:paddingBottom="30dip">
|
|
15 |
<TextView android:text="LoadBalancer" android:textSize="20.0sp"
|
|
16 |
android:gravity="fill_horizontal" android:layout_marginLeft="22dip"
|
|
9 |
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
|
10 |
android:layout_marginBottom="75dip">
|
|
11 |
<TableLayout android:background="@drawable/itemsbox"
|
|
12 |
android:layout_width="fill_parent" android:paddingBottom="30dip"
|
|
13 |
android:id="@+id/view_loadbalancer_layout" android:paddingLeft="5dip"
|
|
14 |
android:layout_height="418dip">
|
|
15 |
<TextView android:layout_width="fill_parent"
|
|
16 |
android:layout_marginTop="30dip" android:layout_marginRight="30dip"
|
|
17 | 17 |
android:layout_height="wrap_content" android:scrollHorizontally="true" |
18 |
android:textColor="#fff" android:layout_marginRight="30dip" |
|
19 |
android:layout_width="fill_parent" android:layout_marginTop="30dip" |
|
20 |
android:paddingTop="10dip" android:layout_marginBottom="10dip"></TextView> |
|
21 |
<TableRow android:orientation="horizontal" |
|
22 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
23 |
android:id="@+id/edit_lb_name_layout"> |
|
24 |
<TextView android:singleLine="false" |
|
25 |
android:layout_gravity="center_vertical" android:layout_marginLeft="22dip" |
|
26 |
android:textColor="#333" android:textStyle="bold" |
|
27 |
android:layout_height="wrap_content" android:layout_width="wrap_content" |
|
28 |
android:paddingLeft="5dip" android:text="Name"></TextView> |
|
29 |
<EditText android:layout_weight="1" |
|
30 |
android:layout_marginRight="20dip" android:layout_height="wrap_content" |
|
31 |
android:layout_width="wrap_content" android:id="@+id/edit_lb_name_text"> |
|
18 |
android:layout_marginBottom="10dip" android:paddingTop="10dip" |
|
19 |
android:text="LoadBalancer" android:gravity="fill_horizontal" |
|
20 |
android:layout_marginLeft="22dip" android:textSize="20.0sp" |
|
21 |
android:textColor="#fff"></TextView> |
|
22 |
<TableRow android:layout_width="fill_parent" |
|
23 |
android:layout_height="wrap_content" android:id="@+id/edit_lb_name_layout" |
|
24 |
android:orientation="horizontal"> |
|
25 |
<TextView android:layout_marginLeft="22dip" |
|
26 |
android:textStyle="bold" android:singleLine="false" |
|
27 |
android:layout_height="wrap_content" android:paddingLeft="5dip" |
|
28 |
android:layout_gravity="center_vertical" android:text="Name" |
|
29 |
android:layout_width="wrap_content" android:textColor="#333"></TextView> |
|
30 |
<EditText android:layout_height="wrap_content" android:id="@+id/edit_lb_name_text" |
|
31 |
android:layout_weight="1" android:layout_marginRight="20dip" |
|
32 |
android:layout_width="wrap_content"> |
|
32 | 33 |
<requestFocus></requestFocus> |
33 | 34 |
</EditText> |
34 | 35 |
</TableRow> |
35 |
<TableRow android:orientation="horizontal"
|
|
36 |
android:layout_height="wrap_content" android:layout_width="fill_parent"
|
|
37 |
android:id="@+id/edit_protocol_layout">
|
|
38 |
<TextView android:singleLine="false"
|
|
39 |
android:layout_gravity="center_vertical" android:layout_marginLeft="22dip"
|
|
40 |
android:textColor="#333" android:textStyle="bold"
|
|
41 |
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
|
42 |
android:paddingLeft="5dip" android:text="Protocol"></TextView>
|
|
36 |
<TableRow android:layout_width="fill_parent"
|
|
37 |
android:layout_height="wrap_content" android:id="@+id/edit_protocol_layout"
|
|
38 |
android:orientation="horizontal">
|
|
39 |
<TextView android:layout_marginLeft="22dip"
|
|
40 |
android:textStyle="bold" android:singleLine="false"
|
|
41 |
android:layout_height="wrap_content" android:paddingLeft="5dip"
|
|
42 |
android:layout_gravity="center_vertical" android:text="Protocol"
|
|
43 |
android:layout_width="wrap_content" android:textColor="#333"></TextView>
|
|
43 | 44 |
<Spinner android:id="@+id/edit_protocol_spinner" |
44 |
android:layout_height="wrap_content" android:layout_weight="1"
|
|
45 |
android:layout_width="wrap_content" android:layout_marginRight="20dip"></Spinner>
|
|
45 |
android:layout_weight="1" android:layout_height="wrap_content"
|
|
46 |
android:layout_marginRight="20dip" android:layout_width="wrap_content"></Spinner>
|
|
46 | 47 |
</TableRow> |
47 |
<TableRow android:orientation="horizontal"
|
|
48 |
android:layout_height="wrap_content" android:layout_width="fill_parent"
|
|
49 |
android:id="@+id/edit_port_layout">
|
|
50 |
<TextView android:singleLine="false"
|
|
51 |
android:layout_gravity="center_vertical" android:layout_marginLeft="22dip"
|
|
52 |
android:textColor="#333" android:textStyle="bold"
|
|
53 |
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
|
54 |
android:paddingLeft="5dip" android:text="Port"></TextView>
|
|
48 |
<TableRow android:layout_width="fill_parent"
|
|
49 |
android:layout_height="wrap_content" android:id="@+id/edit_port_layout"
|
|
50 |
android:orientation="horizontal">
|
|
51 |
<TextView android:layout_marginLeft="22dip"
|
|
52 |
android:textStyle="bold" android:singleLine="false"
|
|
53 |
android:layout_height="wrap_content" android:paddingLeft="5dip"
|
|
54 |
android:layout_gravity="center_vertical" android:text="Port"
|
|
55 |
android:layout_width="wrap_content" android:textColor="#333"></TextView>
|
|
55 | 56 |
<EditText android:inputType="number" android:layout_height="wrap_content" |
56 |
android:id="@+id/edit_port_text" android:layout_width="fill_parent"
|
|
57 |
android:layout_marginRight="20dip" android:layout_weight="1"></EditText>
|
|
57 |
android:id="@+id/edit_port_text" android:layout_weight="1"
|
|
58 |
android:layout_marginRight="20dip" android:layout_width="fill_parent"></EditText>
|
|
58 | 59 |
</TableRow> |
59 |
<TableRow android:orientation="horizontal"
|
|
60 |
android:layout_height="wrap_content" android:layout_width="fill_parent"
|
|
61 |
android:id="@+id/edit_vip_layout">
|
|
62 |
<TextView android:text="@string/virtual_ip_type"
|
|
63 |
android:singleLine="false" android:layout_gravity="center_vertical"
|
|
64 |
android:layout_marginLeft="22dip" android:textColor="#333"
|
|
65 |
android:textStyle="bold" android:layout_height="wrap_content"
|
|
66 |
android:layout_width="wrap_content" android:paddingLeft="5dip"></TextView>
|
|
60 |
<TableRow android:layout_width="fill_parent"
|
|
61 |
android:layout_height="wrap_content" android:id="@+id/edit_vip_layout"
|
|
62 |
android:orientation="horizontal">
|
|
63 |
<TextView android:layout_marginLeft="22dip"
|
|
64 |
android:textStyle="bold" android:singleLine="false"
|
|
65 |
android:layout_height="wrap_content" android:paddingLeft="5dip"
|
|
66 |
android:layout_gravity="center_vertical" android:text="@string/virtual_ip_type"
|
|
67 |
android:layout_width="wrap_content" android:textColor="#333"></TextView>
|
|
67 | 68 |
<Spinner android:id="@+id/edit_vip_spinner" |
68 |
android:layout_height="wrap_content" android:layout_weight="1"
|
|
69 |
android:layout_width="wrap_content" android:layout_marginRight="20dip"></Spinner>
|
|
69 |
android:layout_weight="1" android:layout_height="wrap_content"
|
|
70 |
android:layout_marginRight="20dip" android:layout_width="wrap_content"></Spinner>
|
|
70 | 71 |
</TableRow> |
71 |
<TableRow android:orientation="horizontal"
|
|
72 |
android:layout_height="wrap_content" android:layout_width="fill_parent"
|
|
73 |
android:id="@+id/edit_algorithm_layout">
|
|
74 |
<TextView android:text="Algorithm" android:singleLine="false"
|
|
75 |
android:layout_gravity="center_vertical" android:layout_marginLeft="22dip"
|
|
76 |
android:textColor="#333" android:textStyle="bold"
|
|
77 |
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
|
78 |
android:paddingLeft="5dip"></TextView>
|
|
79 |
<Spinner android:layout_height="wrap_content"
|
|
80 |
android:layout_weight="1" android:layout_width="wrap_content"
|
|
81 |
android:layout_marginRight="20dip" android:id="@+id/edit_algorithm_spinner"></Spinner>
|
|
72 |
<TableRow android:layout_width="fill_parent"
|
|
73 |
android:layout_height="wrap_content" android:id="@+id/edit_algorithm_layout"
|
|
74 |
android:orientation="horizontal">
|
|
75 |
<TextView android:layout_marginLeft="22dip"
|
|
76 |
android:textStyle="bold" android:singleLine="false"
|
|
77 |
android:layout_height="wrap_content" android:paddingLeft="5dip"
|
|
78 |
android:layout_gravity="center_vertical" android:text="Algorithm"
|
|
79 |
android:layout_width="wrap_content" android:textColor="#333"></TextView>
|
|
80 |
<Spinner android:id="@+id/edit_algorithm_spinner"
|
|
81 |
android:layout_weight="1" android:layout_height="wrap_content"
|
|
82 |
android:layout_marginRight="20dip" android:layout_width="wrap_content"></Spinner>
|
|
82 | 83 |
</TableRow> |
83 |
<TableRow android:orientation="horizontal"
|
|
84 |
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
|
85 |
android:id="@+id/edit_region_layout">
|
|
86 |
<TextView android:singleLine="false"
|
|
87 |
android:layout_gravity="center_vertical" android:layout_marginLeft="22dip"
|
|
88 |
android:textColor="#333" android:textStyle="bold"
|
|
89 |
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
|
90 |
android:paddingLeft="5dip" android:text="Region"></TextView>
|
|
91 |
<Spinner android:layout_height="wrap_content"
|
|
92 |
android:layout_weight="1" android:layout_width="wrap_content"
|
|
93 |
android:layout_marginRight="20dip" android:id="@+id/edit_region_spinner"></Spinner>
|
|
84 |
<TableRow android:layout_width="fill_parent"
|
|
85 |
android:layout_height="wrap_content" android:id="@+id/edit_region_layout"
|
|
86 |
android:orientation="horizontal">
|
|
87 |
<TextView android:layout_marginLeft="22dip"
|
|
88 |
android:textStyle="bold" android:singleLine="false"
|
|
89 |
android:layout_height="wrap_content" android:paddingLeft="5dip"
|
|
90 |
android:layout_gravity="center_vertical" android:text="Region"
|
|
91 |
android:layout_width="wrap_content" android:textColor="#333"></TextView>
|
|
92 |
<Spinner android:id="@+id/edit_region_spinner"
|
|
93 |
android:layout_weight="1" android:layout_height="wrap_content"
|
|
94 |
android:layout_marginRight="20dip" android:layout_width="wrap_content"></Spinner>
|
|
94 | 95 |
</TableRow> |
95 |
<TableRow android:layout_width="wrap_content" |
|
96 |
android:layout_height="wrap_content" android:id="@+id/add_nodes_layout" |
|
97 |
android:gravity="center"> |
|
98 |
<Button android:layout_height="wrap_content" android:id="@+id/add_nodes_button" |
|
99 |
android:layout_width="wrap_content" android:text="Add Nodes"></Button> |
|
96 |
<TableRow android:layout_width="fill_parent" |
|
97 |
android:layout_height="wrap_content" android:id="@+id/edit_nodes_layout" |
|
98 |
android:orientation="horizontal"> |
|
99 |
<TextView android:layout_marginLeft="22dip" |
|
100 |
android:textStyle="bold" android:singleLine="false" |
|
101 |
android:layout_height="wrap_content" android:paddingLeft="5dip" |
|
102 |
android:layout_gravity="center_vertical" android:text="Nodes" |
|
103 |
android:layout_width="wrap_content" android:textColor="#333"></TextView> |
|
104 |
<Button android:layout_height="wrap_content" |
|
105 |
android:layout_weight="1" android:text="Edit Nodes" |
|
106 |
android:layout_marginRight="20dip" android:layout_width="wrap_content" |
|
107 |
android:id="@+id/add_nodes_button"></Button> |
|
100 | 108 |
</TableRow> |
101 | 109 |
</TableLayout> |
102 | 110 |
</ScrollView> |
111 |
<Button android:layout_width="wrap_content" android:text="Add Load Balancer" |
|
112 |
android:layout_height="wrap_content" android:layout_gravity="center" |
|
113 |
android:layout_marginTop="-70dip" android:id="@+id/add_lb_button"></Button> |
|
103 | 114 |
<ImageView android:id="@+id/footerimage" |
104 | 115 |
android:layout_width="wrap_content" android:layout_height="25dip" /> |
105 | 116 |
</LinearLayout> |
b/res/layout/view_loadbalancer.xml | ||
---|---|---|
115 | 115 |
</LinearLayout> |
116 | 116 |
</LinearLayout> |
117 | 117 |
<!-- VirtualIps --> |
118 |
<Button android:layout_gravity="center" android:id="@+id/edit_loadbalancer_button" android:layout_height="wrap_content" android:text="Edit Load Balancer" android:layout_width="wrap_content"></Button> |
|
118 |
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:id="@+id/load_balancer_buttons"> |
|
119 |
<Button android:layout_height="wrap_content" android:layout_gravity="center" android:layout_width="wrap_content" android:text="Delete Load Balancer" android:id="@+id/delete_loadbalancer_button"></Button> |
|
120 |
<Button android:id="@+id/edit_loadbalancer_button" android:layout_height="wrap_content" android:text="Edit Load Balancer" android:layout_gravity="center" android:layout_width="wrap_content"></Button> |
|
121 |
</LinearLayout> |
|
119 | 122 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
120 | 123 |
android:id="@+id/view_loadbalancer_layout" android:orientation="vertical" |
121 | 124 |
android:layout_width="fill_parent" android:layout_height="wrap_content" |
... | ... | |
256 | 259 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
257 | 260 |
</LinearLayout> |
258 | 261 |
</LinearLayout> |
262 |
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="center" android:id="@+id/node_buttons"> |
|
263 |
<Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:text="Edit Nodes" android:id="@+id/edit_nodes_button"></Button> |
|
264 |
</LinearLayout> |
|
259 | 265 |
</LinearLayout> |
260 | 266 |
</ScrollView> |
261 | 267 |
<ImageView android:id="@+id/footerimage" android:layout_width="wrap_content" android:layout_height="25dip"/> |
b/res/menu/edit_nodes_menu.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<menu xmlns:android="http://schemas.android.com/apk/res/android"> |
|
3 |
<item android:id="@+id/refresh" android:title="Refresh" android:icon="@drawable/refresh_button" /> |
|
4 |
</menu> |
b/res/menu/view_loadbalancer_menu.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<menu |
|
3 |
xmlns:android="http://schemas.android.com/apk/res/android"> |
|
4 |
<item android:title="Refresh" android:id="@+id/refresh_loadbalancer" android:icon="@drawable/refresh_button"/> |
|
5 |
</menu> |
b/src/com/rackspace/cloud/files/api/client/CustomHttpClient.java | ||
---|---|---|
29 | 29 |
public class CustomHttpClient extends DefaultHttpClient { |
30 | 30 |
|
31 | 31 |
final Context context; |
32 |
|
|
32 |
static KeyStore trusted; |
|
33 |
|
|
33 | 34 |
public CustomHttpClient(Context context) { |
34 | 35 |
super(); |
35 | 36 |
this.context = context; |
36 | 37 |
} |
37 |
|
|
38 |
|
|
38 | 39 |
@Override |
39 | 40 |
protected ClientConnectionManager createClientConnectionManager() { |
40 | 41 |
SchemeRegistry registry = new SchemeRegistry(); |
... | ... | |
46 | 47 |
|
47 | 48 |
private SSLSocketFactory newSslSocketFactory() { |
48 | 49 |
try { |
49 |
KeyStore trusted = KeyStore.getInstance("BKS"); |
|
50 |
InputStream in = context.getResources().openRawResource( |
|
51 |
R.raw.android231); |
|
52 |
try { |
|
53 |
trusted.load(in, "changeit".toCharArray()); |
|
54 |
} finally { |
|
55 |
in.close(); |
|
50 |
if(trusted == null){ |
|
51 |
trusted = KeyStore.getInstance("BKS"); |
|
52 |
InputStream in = context.getResources().openRawResource( |
|
53 |
R.raw.android231); |
|
54 |
try { |
|
55 |
trusted.load(in, "changeit".toCharArray()); |
|
56 |
} finally { |
|
57 |
in.close(); |
|
58 |
} |
|
56 | 59 |
} |
57 | 60 |
return new SSLSocketFactory(trusted); |
58 | 61 |
} catch (Exception e) { |
b/src/com/rackspace/cloud/loadbalancer/api/client/LoadBalancer.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import java.util.ArrayList; |
7 | 7 |
|
8 |
import com.rackspace.cloud.servers.api.client.Account; |
|
9 |
|
|
10 |
import android.util.Log; |
|
11 |
|
|
8 | 12 |
|
9 | 13 |
public class LoadBalancer extends Entity { |
10 | 14 |
|
... | ... | |
20 | 24 |
private String updated; |
21 | 25 |
private String sessionPersistence; |
22 | 26 |
private String clusterName; |
27 |
private String virtualIpType; |
|
28 |
private String region; |
|
23 | 29 |
private ConnectionThrottle connectionThrottle; |
24 | 30 |
private ArrayList<VirtualIp> virtualIps; |
25 | 31 |
private ArrayList<Node> nodes; |
26 | 32 |
|
27 |
|
|
33 |
public static String getRegionUrl(String region){ |
|
34 |
if(region.equals("ORD")){ |
|
35 |
return Account.getAccount().getLoadBalancerORDUrl(); |
|
36 |
} |
|
37 |
else if(region.equals("DFW")){ |
|
38 |
return Account.getAccount().getLoadBalancerDFWUrl(); |
|
39 |
} |
|
40 |
else{ |
|
41 |
return ""; |
|
42 |
} |
|
43 |
} |
|
44 |
|
|
28 | 45 |
public String getId() { |
29 | 46 |
return id; |
30 | 47 |
} |
... | ... | |
46 | 63 |
} |
47 | 64 |
|
48 | 65 |
public void setProtocol(String protocol) { |
49 |
this.protocol = protocol; |
|
66 |
this.protocol = protocol.toUpperCase();
|
|
50 | 67 |
} |
51 | 68 |
|
52 | 69 |
public String getPort() { |
... | ... | |
136 | 153 |
public void setNodes(ArrayList<Node> nodes) { |
137 | 154 |
this.nodes = nodes; |
138 | 155 |
} |
156 |
|
|
157 |
public String getVirtualIpType(){ |
|
158 |
return virtualIpType; |
|
159 |
} |
|
160 |
|
|
161 |
public String setVirtualIpType(String virtualIpType){ |
|
162 |
return this.virtualIpType = virtualIpType.toUpperCase(); |
|
163 |
} |
|
164 |
|
|
165 |
public String getRegion(){ |
|
166 |
return region; |
|
167 |
} |
|
168 |
|
|
169 |
public String setRegion(String region){ |
|
170 |
return this.region = region; |
|
171 |
} |
|
139 | 172 |
|
140 | 173 |
public static long getSerialversionuid() { |
141 | 174 |
return serialVersionUID; |
... | ... | |
147 | 180 |
+ getName() + "\" id=\"" + getId() + "</loadBalancer>"; |
148 | 181 |
return xml; |
149 | 182 |
} |
183 |
|
|
184 |
public String toDetailedXML(){ |
|
185 |
String xml = "<loadBalancer xmlns=\"http://docs.openstack.org/loadbalancers/api/v1.0\"" + |
|
186 |
" name=\"" + getName() + "\"" + |
|
187 |
" port=\"" + getPort() + "\"" + |
|
188 |
" protocol=\"" + getProtocol() + "\"" + |
|
189 |
" algorithm=\"" + getAlgorithm() + "\"" + ">" + |
|
190 |
" <virtualIps>" + |
|
191 |
"<virtualIp type=\"" + getVirtualIpType() + "\"" + "/>" + |
|
192 |
" </virtualIps>" + |
|
193 |
" <nodes>"; |
|
194 |
for(Node node : getNodes()){ |
|
195 |
xml += "<node address=\"" + node.getAddress() + "\"" + " port=\"" + node.getPort() + "\"" + |
|
196 |
" condition=\"" + node.getCondition() + "\"" + "/>"; |
|
197 |
} |
|
198 |
xml += " </nodes>" + |
|
199 |
" </loadBalancer>"; |
|
200 |
Log.d("info", xml); |
|
201 |
return xml; |
|
202 |
} |
|
150 | 203 |
} |
b/src/com/rackspace/cloud/loadbalancer/api/client/LoadBalancerManager.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import java.io.IOException; |
7 | 7 |
import java.io.StringReader; |
8 |
import java.io.UnsupportedEncodingException; |
|
8 | 9 |
import java.util.ArrayList; |
9 | 10 |
|
10 | 11 |
import javax.xml.parsers.FactoryConfigurationError; |
... | ... | |
14 | 15 |
|
15 | 16 |
import org.apache.http.HttpResponse; |
16 | 17 |
import org.apache.http.client.ClientProtocolException; |
18 |
import org.apache.http.client.methods.HttpDelete; |
|
17 | 19 |
import org.apache.http.client.methods.HttpGet; |
20 |
import org.apache.http.client.methods.HttpPost; |
|
21 |
import org.apache.http.client.methods.HttpPut; |
|
22 |
import org.apache.http.entity.StringEntity; |
|
18 | 23 |
import org.apache.http.impl.client.BasicResponseHandler; |
24 |
import org.apache.http.protocol.RequestExpectContinue; |
|
19 | 25 |
import org.xml.sax.InputSource; |
20 | 26 |
import org.xml.sax.SAXException; |
21 | 27 |
import org.xml.sax.XMLReader; |
... | ... | |
28 | 34 |
import com.rackspace.cloud.loadbalancer.api.parsers.LoadBalancersXmlParser; |
29 | 35 |
import com.rackspace.cloud.loadbalancers.api.client.http.LoadBalancersException; |
30 | 36 |
import com.rackspace.cloud.servers.api.client.Account; |
37 |
import com.rackspace.cloud.servers.api.client.CloudServersException; |
|
38 |
import com.rackspace.cloud.servers.api.client.http.HttpBundle; |
|
31 | 39 |
|
32 | 40 |
public class LoadBalancerManager extends EntityManager { |
33 | 41 |
private Context context; |
... | ... | |
37 | 45 |
} |
38 | 46 |
|
39 | 47 |
public LoadBalancer getLoadBalancerById(long id) throws LoadBalancersException { |
48 |
LoadBalancer loadBalancer = null; |
|
49 |
//First try DFW |
|
50 |
try{ |
|
51 |
loadBalancer = getLoadBalancerById(id, Account.getAccount().getLoadBalancerDFWUrl()); |
|
52 |
loadBalancer.setRegion("DFW"); |
|
53 |
} catch(LoadBalancersException lbe){ |
|
54 |
//Didn't work |
|
55 |
|
|
56 |
} |
|
57 |
|
|
58 |
//Then try ORD |
|
59 |
if(loadBalancer == null){ |
|
60 |
try{ |
|
61 |
loadBalancer = getLoadBalancerById(id, Account.getAccount().getLoadBalancerORDUrl()); |
|
62 |
loadBalancer.setRegion("ORD"); |
|
63 |
} |
|
64 |
catch(LoadBalancersException lbe){ |
|
65 |
throw lbe; |
|
66 |
} |
|
67 |
} |
|
68 |
return loadBalancer; |
|
69 |
} |
|
70 |
|
|
71 |
private LoadBalancer getLoadBalancerById(long id, String url) throws LoadBalancersException { |
|
40 | 72 |
//TODO:grab from ord and combine list |
41 | 73 |
CustomHttpClient httpclient = new CustomHttpClient(context); |
42 | 74 |
//TODO: check for uk or us |
43 |
HttpGet get = new HttpGet(Account.getAccount().getLoadBalancerDFWUrl() + Account.getAccount().getAccountId() + "/loadbalancers/" + id);
|
|
75 |
HttpGet get = new HttpGet(url + Account.getAccount().getAccountId() + "/loadbalancers/" + id);
|
|
44 | 76 |
LoadBalancer loadBalancer = new LoadBalancer(); |
45 | 77 |
|
46 | 78 |
get.addHeader("X-Auth-Token", Account.getAccount().getAuthToken()); |
... | ... | |
88 | 120 |
cse.setMessage(e.getLocalizedMessage()); |
89 | 121 |
throw cse; |
90 | 122 |
} |
91 |
|
|
123 |
if(loadBalancer != null){ |
|
124 |
Log.d("info", "the name is " + loadBalancer.getName()); |
|
125 |
} |
|
126 |
else{ |
|
127 |
Log.d("info", "the lb is null"); |
|
128 |
} |
|
92 | 129 |
return loadBalancer; |
93 | 130 |
} |
94 |
|
|
131 |
|
|
95 | 132 |
public ArrayList<LoadBalancer> createList() throws LoadBalancersException{ |
96 | 133 |
ArrayList<LoadBalancer> loadBalancers = createSublist(Account.getAccount().getLoadBalancerORDUrl()); |
97 |
loadBalancers.addAll(createSublist(Account.getAccount().getLoadBalancerDFWUrl())); |
|
134 |
for(LoadBalancer loadBalancer: loadBalancers){ |
|
135 |
loadBalancer.setRegion("ORD"); |
|
136 |
} |
|
137 |
ArrayList<LoadBalancer> DFWloadBalancers = createSublist(Account.getAccount().getLoadBalancerDFWUrl()); |
|
138 |
for(LoadBalancer loadBalancer: DFWloadBalancers){ |
|
139 |
loadBalancer.setRegion("DFW"); |
|
140 |
} |
|
141 |
loadBalancers.addAll(DFWloadBalancers); |
|
98 | 142 |
return loadBalancers; |
99 | 143 |
} |
100 | 144 |
|
... | ... | |
152 | 196 |
} |
153 | 197 |
return loadBalancers; |
154 | 198 |
} |
199 |
|
|
200 |
public HttpBundle create(LoadBalancer entity, String regionUrl) throws CloudServersException { |
|
201 |
HttpResponse resp = null; |
|
202 |
CustomHttpClient httpclient = new CustomHttpClient(context); |
|
203 |
|
|
204 |
HttpPost post = new HttpPost(regionUrl + Account.getAccount().getAccountId() + "/loadbalancers"); |
|
205 |
post.addHeader("Content-Type", "application/xml"); |
|
206 |
|
|
207 |
StringEntity tmp = null; |
|
208 |
try { |
|
209 |
tmp = new StringEntity(entity.toDetailedXML()); |
|
210 |
} catch (UnsupportedEncodingException e) { |
|
211 |
CloudServersException cse = new CloudServersException(); |
|
212 |
cse.setMessage(e.getLocalizedMessage()); |
|
213 |
throw cse; |
|
214 |
} |
|
215 |
|
|
216 |
Log.d("info", entity.toDetailedXML()); |
|
217 |
|
|
218 |
post.setEntity(tmp); |
|
219 |
|
|
220 |
post.addHeader("X-Auth-Token", Account.getAccount().getAuthToken()); |
|
221 |
httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class); |
|
222 |
|
|
223 |
HttpBundle bundle = new HttpBundle(); |
|
224 |
bundle.setCurlRequest(post); |
|
225 |
try { |
|
226 |
resp = httpclient.execute(post); |
|
227 |
bundle.setHttpResponse(resp); |
|
228 |
} catch (ClientProtocolException e) { |
|
229 |
CloudServersException cse = new CloudServersException(); |
|
230 |
cse.setMessage(e.getLocalizedMessage()); |
|
231 |
throw cse; |
|
232 |
} catch (IOException e) { |
|
233 |
CloudServersException cse = new CloudServersException(); |
|
234 |
cse.setMessage(e.getLocalizedMessage()); |
|
235 |
throw cse; |
|
236 |
} catch (FactoryConfigurationError e) { |
|
237 |
CloudServersException cse = new CloudServersException(); |
|
238 |
cse.setMessage(e.getLocalizedMessage()); |
|
239 |
throw cse; |
|
240 |
} |
|
241 |
return bundle; |
|
242 |
} |
|
243 |
|
|
244 |
public HttpBundle delete(LoadBalancer loadBalancer) throws CloudServersException { |
|
245 |
HttpResponse resp = null; |
|
246 |
CustomHttpClient httpclient = new CustomHttpClient(context); |
|
247 |
|
|
248 |
HttpDelete delete = new HttpDelete(LoadBalancer.getRegionUrl(loadBalancer.getRegion()) + Account.getAccount().getAccountId() |
|
249 |
+ "/loadbalancers/" + loadBalancer.getId()); |
|
250 |
delete.addHeader("X-Auth-Token", Account.getAccount().getAuthToken()); |
|
251 |
delete.addHeader("Content-Type", "application/xml"); |
|
252 |
httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class); |
|
253 |
|
|
254 |
HttpBundle bundle = new HttpBundle(); |
|
255 |
bundle.setCurlRequest(delete); |
|
256 |
|
|
257 |
try { |
|
258 |
resp = httpclient.execute(delete); |
|
259 |
bundle.setHttpResponse(resp); |
|
260 |
} catch (ClientProtocolException e) { |
|
261 |
CloudServersException cse = new CloudServersException(); |
|
262 |
cse.setMessage(e.getLocalizedMessage()); |
|
263 |
throw cse; |
|
264 |
} catch (IOException e) { |
|
265 |
CloudServersException cse = new CloudServersException(); |
|
266 |
cse.setMessage(e.getLocalizedMessage()); |
|
267 |
throw cse; |
|
268 |
} catch (FactoryConfigurationError e) { |
|
269 |
CloudServersException cse = new CloudServersException(); |
|
270 |
cse.setMessage(e.getLocalizedMessage()); |
|
271 |
throw cse; |
|
272 |
} |
|
273 |
return bundle; |
|
274 |
} |
|
275 |
|
|
276 |
public HttpBundle update(LoadBalancer loadBalancer, String name, String algorithm, String protocol, String port) throws CloudServersException { |
|
277 |
HttpResponse resp = null; |
|
278 |
CustomHttpClient httpclient = new CustomHttpClient(context); |
|
279 |
|
|
280 |
HttpPut put = new HttpPut(LoadBalancer.getRegionUrl(loadBalancer.getRegion()) + Account.getAccount().getAccountId() + "/loadbalancers/" + loadBalancer.getId()); |
|
281 |
|
|
282 |
put.addHeader("X-Auth-Token", Account.getAccount().getAuthToken()); |
|
283 |
put.addHeader("Content-Type", "application/xml"); |
|
284 |
|
|
285 |
String xml = "<loadBalancer xmlns=\"http://docs.openstack.org/loadbalancers/api/v1.0\" " + |
|
286 |
"name=\"" + name + "\" " + |
|
287 |
"algorithm=\"" + algorithm.toUpperCase() + "\" " + |
|
288 |
"protocol=\"" + protocol.toUpperCase() + "\" " + |
|
289 |
"port=\"" + port + "\" />"; |
|
290 |
|
|
291 |
StringEntity tmp = null; |
|
292 |
try { |
|
293 |
tmp = new StringEntity(xml); |
|
294 |
} catch (UnsupportedEncodingException e) { |
|
295 |
CloudServersException cse = new CloudServersException(); |
|
296 |
cse.setMessage(e.getLocalizedMessage()); |
|
297 |
throw cse; |
|
298 |
} |
|
299 |
|
|
300 |
put.setEntity(tmp); |
|
301 |
httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class); |
|
302 |
|
|
303 |
HttpBundle bundle = new HttpBundle(); |
|
304 |
bundle.setCurlRequest(put); |
|
305 |
|
|
306 |
try { |
|
307 |
resp = httpclient.execute(put); |
|
308 |
bundle.setHttpResponse(resp); |
|
309 |
} catch (ClientProtocolException e) { |
|
310 |
CloudServersException cse = new CloudServersException(); |
|
311 |
cse.setMessage(e.getLocalizedMessage()); |
|
312 |
throw cse; |
|
313 |
} catch (IOException e) { |
|
314 |
CloudServersException cse = new CloudServersException(); |
|
315 |
cse.setMessage(e.getLocalizedMessage()); |
|
316 |
throw cse; |
|
317 |
} catch (FactoryConfigurationError e) { |
|
318 |
CloudServersException cse = new CloudServersException(); |
|
319 |
cse.setMessage(e.getLocalizedMessage()); |
|
320 |
throw cse; |
|
321 |
} |
|
322 |
return bundle; |
|
323 |
} |
|
324 |
|
|
325 |
public HttpBundle addNodes(LoadBalancer loadBalancer, ArrayList<Node> nodes) throws CloudServersException { |
|
326 |
HttpResponse resp = null; |
|
327 |
CustomHttpClient httpclient = new CustomHttpClient(context); |
|
328 |
|
|
329 |
HttpPost post = new HttpPost(LoadBalancer.getRegionUrl(loadBalancer.getRegion()) + Account.getAccount().getAccountId() + "/loadbalancers/" + loadBalancer.getId() + "/nodes"); |
|
330 |
|
|
331 |
post.addHeader("X-Auth-Token", Account.getAccount().getAuthToken()); |
|
332 |
post.addHeader("Content-Type", "application/xml"); |
|
333 |
|
|
334 |
String xml = "<nodes xmlns=\"http://docs.openstack.org/loadbalancers/api/v1.0\"> "; |
|
335 |
for(int i = 0;i < nodes.size(); i++){ |
|
336 |
Node node = nodes.get(i); |
|
337 |
if(node.getWeight() == null){ |
|
338 |
xml += "<node address=\"" + node.getAddress() + "\" port=\"" + node.getPort() + "\" condition=\"" + node.getCondition() + "\"/>"; |
|
339 |
} |
|
340 |
else{ |
|
341 |
xml += "<node address=\"" + node.getAddress() + "\" port=\"" + node.getPort() + "\" condition=\"" + node.getCondition() + "\" weight=\"" + node.getWeight() + "\"/>"; |
|
342 |
} |
|
343 |
xml += " </nodes>"; |
|
344 |
} |
|
345 |
|
|
346 |
Log.d("info", xml); |
|
347 |
|
|
348 |
StringEntity tmp = null; |
|
349 |
try { |
|
350 |
tmp = new StringEntity(xml); |
|
351 |
} catch (UnsupportedEncodingException e) { |
|
352 |
CloudServersException cse = new CloudServersException(); |
|
353 |
cse.setMessage(e.getLocalizedMessage()); |
|
354 |
throw cse; |
|
355 |
} |
|
356 |
|
|
357 |
post.setEntity(tmp); |
|
358 |
httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class); |
|
359 |
|
|
360 |
HttpBundle bundle = new HttpBundle(); |
|
361 |
bundle.setCurlRequest(post); |
|
362 |
|
|
363 |
try { |
|
364 |
resp = httpclient.execute(post); |
|
365 |
bundle.setHttpResponse(resp); |
|
366 |
} catch (ClientProtocolException e) { |
|
367 |
CloudServersException cse = new CloudServersException(); |
|
368 |
cse.setMessage(e.getLocalizedMessage()); |
|
369 |
throw cse; |
|
370 |
} catch (IOException e) { |
|
371 |
CloudServersException cse = new CloudServersException(); |
|
372 |
cse.setMessage(e.getLocalizedMessage()); |
|
373 |
throw cse; |
|
374 |
} catch (FactoryConfigurationError e) { |
|
375 |
CloudServersException cse = new CloudServersException(); |
|
376 |
cse.setMessage(e.getLocalizedMessage()); |
|
377 |
throw cse; |
|
378 |
} |
|
379 |
return bundle; |
|
380 |
} |
|
381 |
|
|
382 |
public HttpBundle modifyNode(LoadBalancer loadBalancer, Node node, String condition, String weight) throws CloudServersException { |
|
383 |
HttpResponse resp = null; |
|
384 |
CustomHttpClient httpclient = new CustomHttpClient(context); |
|
385 |
|
|
386 |
HttpPut put = new HttpPut(LoadBalancer.getRegionUrl(loadBalancer.getRegion()) + Account.getAccount().getAccountId() + "/loadbalancers/" + loadBalancer.getId() + "/nodes/" + node.getId()); |
|
387 |
|
|
388 |
put.addHeader("X-Auth-Token", Account.getAccount().getAuthToken()); |
|
389 |
put.addHeader("Content-Type", "application/xml"); |
|
390 |
|
|
391 |
String xml; |
|
392 |
//different request body if the nodes have weight |
|
393 |
if(weight != null){ |
|
394 |
xml = "<node xmlns=\"http://docs.openstack.org/loadbalancers/api/v1.0\" condition=\"" + condition.toUpperCase() + "\" weight=\"" + weight + "\"" + "/>"; |
|
395 |
Log.d("info", "went to first"); |
|
396 |
} |
|
397 |
else{ |
|
398 |
xml = "<node xmlns=\"http://docs.openstack.org/loadbalancers/api/v1.0\" condition=\"" + condition.toUpperCase() + "\"/>"; |
|
399 |
Log.d("info", "went to second"); |
|
400 |
} |
|
401 |
|
|
402 |
StringEntity tmp = null; |
|
403 |
try { |
|
404 |
tmp = new StringEntity(xml); |
|
405 |
} catch (UnsupportedEncodingException e) { |
|
406 |
CloudServersException cse = new CloudServersException(); |
|
407 |
cse.setMessage(e.getLocalizedMessage()); |
|
408 |
throw cse; |
|
409 |
} |
|
410 |
|
|
411 |
Log.d("info", xml); |
|
412 |
|
|
413 |
put.setEntity(tmp); |
|
414 |
httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class); |
|
415 |
|
|
416 |
HttpBundle bundle = new HttpBundle(); |
|
417 |
bundle.setCurlRequest(put); |
|
418 |
|
|
419 |
try { |
|
420 |
resp = httpclient.execute(put); |
|
421 |
bundle.setHttpResponse(resp); |
|
422 |
} catch (ClientProtocolException e) { |
|
423 |
CloudServersException cse = new CloudServersException(); |
|
424 |
cse.setMessage(e.getLocalizedMessage()); |
|
425 |
throw cse; |
|
426 |
} catch (IOException e) { |
|
427 |
CloudServersException cse = new CloudServersException(); |
|
428 |
cse.setMessage(e.getLocalizedMessage()); |
|
429 |
throw cse; |
|
430 |
} catch (FactoryConfigurationError e) { |
|
431 |
CloudServersException cse = new CloudServersException(); |
|
432 |
cse.setMessage(e.getLocalizedMessage()); |
|
433 |
throw cse; |
|
434 |
} |
|
435 |
return bundle; |
|
436 |
} |
|
437 |
|
|
438 |
public HttpBundle removeNode(LoadBalancer loadBalancer, Node node) throws CloudServersException { |
|
439 |
HttpResponse resp = null; |
|
440 |
CustomHttpClient httpclient = new CustomHttpClient(context); |
|
441 |
|
|
442 |
HttpDelete delete = new HttpDelete(LoadBalancer.getRegionUrl(loadBalancer.getRegion()) + Account.getAccount().getAccountId() + "/loadbalancers/" + loadBalancer.getId() + "/nodes/" + node.getId()); |
|
443 |
|
|
444 |
delete.addHeader("X-Auth-Token", Account.getAccount().getAuthToken()); |
|
445 |
|
|
446 |
httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class); |
|
447 |
|
|
448 |
HttpBundle bundle = new HttpBundle(); |
|
449 |
bundle.setCurlRequest(delete); |
|
450 |
|
|
451 |
try { |
|
452 |
resp = httpclient.execute(delete); |
|
453 |
bundle.setHttpResponse(resp); |
|
454 |
} catch (ClientProtocolException e) { |
|
455 |
CloudServersException cse = new CloudServersException(); |
|
456 |
cse.setMessage(e.getLocalizedMessage()); |
|
457 |
throw cse; |
|
458 |
} catch (IOException e) { |
|
459 |
CloudServersException cse = new CloudServersException(); |
|
460 |
cse.setMessage(e.getLocalizedMessage()); |
|
461 |
throw cse; |
|
462 |
} catch (FactoryConfigurationError e) { |
|
463 |
CloudServersException cse = new CloudServersException(); |
|
464 |
cse.setMessage(e.getLocalizedMessage()); |
|
465 |
throw cse; |
|
466 |
} |
|
467 |
return bundle; |
|
468 |
} |
|
155 | 469 |
} |
b/src/com/rackspace/cloud/loadbalancer/api/client/Node.java | ||
---|---|---|
10 | 10 |
private String port; |
11 | 11 |
private String condition; |
12 | 12 |
private String status; |
13 |
private String weight; |
|
14 |
|
|
13 | 15 |
public String getId() { |
14 | 16 |
return id; |
15 | 17 |
} |
18 |
|
|
16 | 19 |
public void setId(String id) { |
17 | 20 |
this.id = id; |
18 | 21 |
} |
22 |
|
|
19 | 23 |
public String getAddress() { |
20 | 24 |
return address; |
21 | 25 |
} |
26 |
|
|
22 | 27 |
public void setAddress(String address) { |
23 | 28 |
this.address = address; |
24 | 29 |
} |
30 |
|
|
25 | 31 |
public String getPort() { |
26 | 32 |
return port; |
27 | 33 |
} |
34 |
|
|
28 | 35 |
public void setPort(String port) { |
29 | 36 |
this.port = port; |
30 | 37 |
} |
38 |
|
|
31 | 39 |
public String getCondition() { |
32 | 40 |
return condition; |
33 | 41 |
} |
42 |
|
|
34 | 43 |
public void setCondition(String condition) { |
35 |
this.condition = condition; |
|
44 |
this.condition = condition.toUpperCase();
|
|
36 | 45 |
} |
46 |
|
|
37 | 47 |
public String getStatus() { |
38 | 48 |
return status; |
39 | 49 |
} |
50 |
|
|
40 | 51 |
public void setStatus(String status) { |
41 | 52 |
this.status = status; |
42 | 53 |
} |
54 |
|
|
55 |
public void setWeight(String weight){ |
|
56 |
this.weight = weight; |
|
57 |
} |
|
58 |
|
|
59 |
public String getWeight(){ |
|
60 |
return weight; |
|
61 |
} |
|
62 |
|
|
43 | 63 |
public static long getSerialversionuid() { |
44 | 64 |
return serialVersionUID; |
45 | 65 |
} |
66 |
|
|
46 | 67 |
} |
b/src/com/rackspace/cloud/loadbalancer/api/client/Protocol.java | ||
---|---|---|
28 | 28 |
/** |
29 | 29 |
* @param port the port to set |
30 | 30 |
*/ |
31 |
public void setPort(String port) { |
|
31 |
public void setDefaultPort(String port) {
|
|
32 | 32 |
this.port = port; |
33 | 33 |
} |
34 | 34 |
/** |
35 | 35 |
* @return the port |
36 | 36 |
*/ |
37 |
public String getPort() { |
|
37 |
public String getDefaultPort() {
|
|
38 | 38 |
return port; |
39 | 39 |
} |
40 | 40 |
|
b/src/com/rackspace/cloud/loadbalancer/api/client/ProtocolManager.java | ||
---|---|---|
21 | 21 |
import org.xml.sax.XMLReader; |
22 | 22 |
|
23 | 23 |
import android.content.Context; |
24 |
import android.util.Log; |
|
25 | 24 |
|
26 | 25 |
import com.rackspace.cloud.files.api.client.CustomHttpClient; |
27 | 26 |
import com.rackspace.cloud.loadbalancer.api.parsers.ProtocolsXMLParser; |
b/src/com/rackspace/cloud/loadbalancer/api/parsers/LoadBalancersXmlParser.java | ||
---|---|---|
78 | 78 |
node.setPort(atts.getValue("port")); |
79 | 79 |
node.setCondition(atts.getValue("condition")); |
80 | 80 |
node.setStatus(atts.getValue("status")); |
81 |
node.setWeight(atts.getValue("weight")); |
|
81 | 82 |
} |
82 | 83 |
} |
83 | 84 |
|
b/src/com/rackspace/cloud/loadbalancer/api/parsers/ProtocolsXMLParser.java | ||
---|---|---|
32 | 32 |
} else if ("protocol".equals(name)) { |
33 | 33 |
protocol = new Protocol(); |
34 | 34 |
protocol.setName(atts.getValue("name")); |
35 |
protocol.setPort(atts.getValue("port")); |
|
35 |
protocol.setDefaultPort(atts.getValue("port"));
|
|
36 | 36 |
} |
37 | 37 |
} |
38 | 38 |
|
b/src/com/rackspacecloud/android/AddContainerActivity.java | ||
---|---|---|
181 | 181 |
startFileError("There was a problem creating your container.", bundle); |
182 | 182 |
} else { |
183 | 183 |
//if container with same name already exists |
184 |
showToast("There was a problem creating your container: " + cse.getMessage() + " Check container name and try again");
|
|
184 |
showToast("There was a problem creating your container: " + cse.getMessage() + " See details for more information.");
|
|
185 | 185 |
} |
186 | 186 |
} |
187 | 187 |
} else if (exception != null) { |
188 |
startFileError("There was a problem creating your container: " + exception.getMessage()+" Check container name and try again", bundle);
|
|
188 |
startFileError("There was a problem creating your container: " + exception.getMessage()+" See details for more information.", bundle);
|
|
189 | 189 |
} |
190 | 190 |
finish(); |
191 | 191 |
} |
b/src/com/rackspacecloud/android/AddFileActivity.java | ||
---|---|---|
178 | 178 |
if ("".equals(cse.getMessage())) { |
179 | 179 |
startFileError("There was a problem creating your file.", bundle); |
180 | 180 |
} else { |
181 |
startFileError("There was a problem creating your file: " + cse.getMessage() + " Check file name and try again", bundle);
|
|
181 |
startFileError("There was a problem creating your file: " + cse.getMessage() + " See details for more information", bundle);
|
|
182 | 182 |
} |
183 | 183 |
} |
184 | 184 |
} else if (exception != null) { |
185 |
startFileError("There was a problem creating your file: " + exception.getMessage()+" Check file name and try again", bundle);
|
|
185 |
startFileError("There was a problem creating your file: " + exception.getMessage()+ " See details for more information", bundle);
|
|
186 | 186 |
} |
187 | 187 |
} |
188 | 188 |
} |
b/src/com/rackspacecloud/android/AddLoadBalancerActivity.java | ||
---|---|---|
1 | 1 |
package com.rackspacecloud.android; |
2 | 2 |
|
3 |
import java.io.IOException; |
|
4 |
import java.io.StringReader; |
|
5 |
import java.util.ArrayList; |
|
6 |
|
|
7 |
import javax.xml.parsers.FactoryConfigurationError; |
|
8 |
import javax.xml.parsers.ParserConfigurationException; |
|
9 |
import javax.xml.parsers.SAXParser; |
|
10 |
import javax.xml.parsers.SAXParserFactory; |
|
11 |
|
|
12 |
import org.apache.http.HttpResponse; |
|
13 |
import org.apache.http.client.ClientProtocolException; |
|
14 |
import org.apache.http.impl.client.BasicResponseHandler; |
|
15 |
import org.xml.sax.InputSource; |
|
16 |
import org.xml.sax.SAXException; |
|
17 |
import org.xml.sax.XMLReader; |
|
18 |
|
|
3 | 19 |
import com.rackspace.cloud.loadbalancer.api.client.Algorithm; |
20 |
import com.rackspace.cloud.loadbalancer.api.client.LoadBalancer; |
|
21 |
import com.rackspace.cloud.loadbalancer.api.client.LoadBalancerManager; |
|
22 |
import com.rackspace.cloud.loadbalancer.api.client.Node; |
|
4 | 23 |
import com.rackspace.cloud.loadbalancer.api.client.Protocol; |
5 |
import com.rackspace.cloud.servers.api.client.Server; |
|
24 |
import com.rackspace.cloud.servers.api.client.Account; |
|
25 |
import com.rackspace.cloud.servers.api.client.CloudServersException; |
|
26 |
import com.rackspace.cloud.servers.api.client.http.HttpBundle; |
|
27 |
import com.rackspace.cloud.servers.api.client.parsers.CloudServersFaultXMLParser; |
|
6 | 28 |
|
7 | 29 |
import android.app.Activity; |
8 | 30 |
import android.app.AlertDialog; |
31 |
import android.app.ProgressDialog; |
|
32 |
import android.content.Context; |
|
9 | 33 |
import android.content.DialogInterface; |
10 | 34 |
import android.content.Intent; |
35 |
import android.os.AsyncTask; |
|
11 | 36 |
import android.os.Bundle; |
37 |
import android.util.Log; |
|
12 | 38 |
import android.view.View; |
39 |
import android.view.WindowManager; |
|
13 | 40 |
import android.view.View.OnClickListener; |
41 |
import android.view.ViewGroup.LayoutParams; |
|
14 | 42 |
import android.widget.AdapterView; |
15 | 43 |
import android.widget.AdapterView.OnItemSelectedListener; |
16 | 44 |
import android.widget.ArrayAdapter; |
17 | 45 |
import android.widget.Button; |
18 | 46 |
import android.widget.EditText; |
47 |
import android.widget.ProgressBar; |
|
19 | 48 |
import android.widget.Spinner; |
20 | 49 |
|
21 | 50 |
public class AddLoadBalancerActivity extends Activity implements OnItemSelectedListener { |
... | ... | |
23 | 52 |
//TODO Shared Virtual IP (not in API though?) |
24 | 53 |
private static final String[] VIP_TYPES = {"Public", "ServiceNet"}; |
25 | 54 |
private static final String[] REGIONS = {"ORD", "DFW"}; |
26 |
|
|
55 |
|
|
56 |
private static final int ADD_NODES_ACTIVITY_CODE = 165; |
|
57 |
|
|
27 | 58 |
private Protocol[] protocols; |
28 | 59 |
private Algorithm[] algorithms; |
29 | 60 |
private Spinner protocolSpinner; |
... | ... | |
37 | 68 |
private String selectedRegion; |
38 | 69 |
private String selectedName; |
39 | 70 |
private String selectedPort; |
71 |
private ArrayList<Node> nodes; |
|
72 |
private Context context; |
|
73 |
private LoadBalancer loadBalancer; |
|
74 |
ProgressDialog pDialog; |
|
40 | 75 |
|
41 | 76 |
@Override |
42 | 77 |
public void onCreate(Bundle savedInstanceState) { |
... | ... | |
45 | 80 |
restoreState(savedInstanceState); |
46 | 81 |
} |
47 | 82 |
|
83 |
@SuppressWarnings("unchecked") |
|
48 | 84 |
private void restoreState(Bundle state) { |
85 |
|
|
86 |
context = getApplicationContext(); |
|
87 |
|
|
49 | 88 |
portText = (EditText)findViewById(R.id.edit_port_text); |
89 |
|
|
90 |
if(state != null && state.containsKey("nodes")){ |
|
91 |
nodes = (ArrayList<Node>) state.getSerializable("nodes"); |
|
92 |
} |
|
93 |
else{ |
|
94 |
nodes = new ArrayList<Node>(); |
|
95 |
} |
|
96 |
|
|
50 | 97 |
loadProtocolSpinner(); |
51 | 98 |
loadAlgorithmSpinner(); |
52 | 99 |
loadVipSpinner(); |
53 | 100 |
loadRegionSpinner(); |
54 |
setUpButton(); |
|
101 |
setUpButtons(); |
|
102 |
} |
|
103 |
|
|
104 |
@Override |
|
105 |
protected void onSaveInstanceState(Bundle outState) { |
|
106 |
super.onSaveInstanceState(outState); |
|
107 |
outState.putSerializable("nodes", nodes); |
|
55 | 108 |
} |
56 | 109 |
|
57 | 110 |
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { |
58 | 111 |
if (parent == protocolSpinner) { |
59 | 112 |
selectedProtocol = protocols[position]; |
60 |
portText.setText(protocols[position].getPort()); |
|
113 |
portText.setText(protocols[position].getDefaultPort());
|
|
61 | 114 |
} |
62 | 115 |
else if (parent == algorithmSpinner){ |
63 | 116 |
selectedAlgorithm = algorithms[position]; |
... | ... | |
73 | 126 |
public void onNothingSelected(AdapterView<?> parent) { |
74 | 127 |
|
75 | 128 |
} |
76 |
|
|
77 |
private void setUpButton(){ |
|
129 |
|
|
130 |
private void setUpButtons(){
|
|
78 | 131 |
Button addNodes = (Button) findViewById(R.id.add_nodes_button); |
79 | 132 |
addNodes.setOnClickListener(new OnClickListener() { |
80 |
|
|
133 |
|
|
134 |
@Override |
|
135 |
public void onClick(View v) { |
|
136 |
/* |
|
137 |
selectedName = ((EditText)findViewById(R.id.edit_lb_name_text)).getText().toString(); |
|
138 |
selectedPort = ((EditText)findViewById(R.id.edit_port_text)).getText().toString(); |
|
139 |
if(!validName()){ |
|
140 |
showAlert("Error", "Load balancer name cannot be blank."); |
|
141 |
} |
|
142 |
else if(!validPort()){ |
|
143 |
showAlert("Error", "Must have a protocol port number that is between 1 and 65535."); |
|
144 |
} |
|
145 |
*/ |
|
146 |
//else{ |
|
147 |
Intent viewIntent = new Intent(getApplicationContext(), AddNodesActivity.class); |
|
148 |
/*viewIntent.putExtra("name", selectedName); |
|
149 |
viewIntent.putExtra("protocol", selectedProtocol); |
|
150 |
viewIntent.putExtra("port", selectedPort); |
|
151 |
viewIntent.putExtra("vip", selectedVipType); |
|
152 |
viewIntent.putExtra("algorithm", selectedAlgorithm); |
|
153 |
viewIntent.putExtra("region", selectedRegion); |
|
154 |
*/ |
|
155 |
viewIntent.putExtra("nodes", nodes); |
|
156 |
startActivityForResult(viewIntent, ADD_NODES_ACTIVITY_CODE); |
|
157 |
//} |
|
158 |
} |
|
159 |
}); |
|
160 |
|
|
161 |
Button addLoadBalancer = (Button) findViewById(R.id.add_lb_button); |
|
162 |
addLoadBalancer.setOnClickListener(new OnClickListener() { |
|
163 |
|
|
81 | 164 |
@Override |
82 | 165 |
public void onClick(View v) { |
83 | 166 |
selectedName = ((EditText)findViewById(R.id.edit_lb_name_text)).getText().toString(); |
... | ... | |
89 | 172 |
showAlert("Error", "Must have a protocol port number that is between 1 and 65535."); |
90 | 173 |
} |
91 | 174 |
else{ |
175 |
/* |
|
92 | 176 |
Intent viewIntent = new Intent(getApplicationContext(), AddNodesActivity.class); |
93 | 177 |
viewIntent.putExtra("name", selectedName); |
94 | 178 |
viewIntent.putExtra("protocol", selectedProtocol); |
... | ... | |
96 | 180 |
viewIntent.putExtra("vip", selectedVipType); |
97 | 181 |
viewIntent.putExtra("algorithm", selectedAlgorithm); |
98 | 182 |
viewIntent.putExtra("region", selectedRegion); |
99 |
startActivity(viewIntent); |
|
183 |
viewIntent.putExtra("nodes", nodes); |
|
184 |
*/ |
|
185 |
loadBalancer = new LoadBalancer(); |
|
186 |
loadBalancer.setName(selectedName); |
|
187 |
loadBalancer.setProtocol(selectedProtocol.getName()); |
|
188 |
loadBalancer.setPort(selectedPort); |
|
189 |
loadBalancer.setVirtualIpType(selectedVipType); |
|
190 |
loadBalancer.setAlgorithm(selectedAlgorithm.getName()); |
|
191 |
loadBalancer.setNodes(nodes); |
|
192 |
|
|
193 |
new AddLoadBalancerTask().execute(); |
|
100 | 194 |
} |
101 | 195 |
} |
102 | 196 |
}); |
103 | 197 |
} |
Also available in: Unified diff