Merge lp:~spacefish/syncany/minor-wizzard-fixes into lp:~syncany-team/syncany/trunk

Proposed by Timo Witte
Status: Needs review
Proposed branch: lp:~spacefish/syncany/minor-wizzard-fixes
Merge into: lp:~syncany-team/syncany/trunk
Diff against target: 295 lines (+117/-12)
4 files modified
syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConfigPanel.form (+48/-3)
syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConfigPanel.java (+51/-7)
syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConnection.java (+11/-0)
syncany/src/org/syncany/connection/plugins/rackspace/RackspaceTransferManager.java (+7/-2)
To merge this branch: bzr merge lp:~spacefish/syncany/minor-wizzard-fixes
Reviewer Review Type Date Requested Status
Syncany Team Pending
Review via email: mp+66052@code.launchpad.net

Description of the change

have added radio boxes to rackspace storage for selection between us and uk auth server

To post a comment you must log in.
Revision history for this message
Timo Witte (spacefish) wrote :

Unmerged revisions

61. By Timo Witte

added radio boxes to select between different rackspace auth servers

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConfigPanel.form'
2--- syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConfigPanel.form 2011-05-23 16:50:04 +0000
3+++ syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConfigPanel.form 2011-06-27 21:11:14 +0000
4@@ -1,6 +1,10 @@
5 <?xml version="1.1" encoding="UTF-8" ?>
6
7-<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
8+<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
9+ <NonVisualComponents>
10+ <Component class="javax.swing.ButtonGroup" name="txtAuthServer">
11+ </Component>
12+ </NonVisualComponents>
13 <AuxValues>
14 <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
15 <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
16@@ -16,17 +20,23 @@
17 <Layout>
18 <DimensionLayout dim="0">
19 <Group type="103" groupAlignment="0" attributes="0">
20- <Group type="102" alignment="0" attributes="0">
21+ <Group type="102" attributes="0">
22 <Group type="103" groupAlignment="0" attributes="0">
23 <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
24 <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
25 <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
26+ <Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/>
27 </Group>
28 <EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
29 <Group type="103" groupAlignment="0" attributes="0">
30 <Component id="txtUsername" alignment="0" pref="314" max="32767" attributes="0"/>
31 <Component id="txtApiKey" alignment="0" pref="314" max="32767" attributes="0"/>
32 <Component id="txtContainerName" alignment="0" pref="314" max="32767" attributes="0"/>
33+ <Group type="102" alignment="0" attributes="0">
34+ <Component id="authUs" min="-2" max="-2" attributes="0"/>
35+ <EmptySpace type="separate" max="-2" attributes="0"/>
36+ <Component id="authUk" min="-2" max="-2" attributes="0"/>
37+ </Group>
38 </Group>
39 <EmptySpace max="-2" attributes="0"/>
40 </Group>
41@@ -49,7 +59,13 @@
42 <Component id="txtContainerName" alignment="3" min="-2" max="-2" attributes="0"/>
43 <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
44 </Group>
45- <EmptySpace pref="52" max="32767" attributes="0"/>
46+ <EmptySpace type="separate" max="-2" attributes="0"/>
47+ <Group type="103" groupAlignment="3" attributes="0">
48+ <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
49+ <Component id="authUs" alignment="3" min="-2" max="-2" attributes="0"/>
50+ <Component id="authUk" alignment="3" min="-2" max="-2" attributes="0"/>
51+ </Group>
52+ <EmptySpace max="32767" attributes="0"/>
53 </Group>
54 </Group>
55 </DimensionLayout>
56@@ -91,5 +107,34 @@
57 <Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/>
58 </Properties>
59 </Component>
60+ <Component class="javax.swing.JLabel" name="jLabel4">
61+ <Properties>
62+ <Property name="horizontalAlignment" type="int" value="2"/>
63+ <Property name="text" type="java.lang.String" value="Auth Server:"/>
64+ <Property name="name" type="java.lang.String" value="jLabel4" noResource="true"/>
65+ </Properties>
66+ </Component>
67+ <Component class="javax.swing.JRadioButton" name="authUs">
68+ <Properties>
69+ <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
70+ <ComponentRef name="txtAuthServer"/>
71+ </Property>
72+ <Property name="selected" type="boolean" value="true"/>
73+ <Property name="text" type="java.lang.String" value="US"/>
74+ <Property name="name" type="java.lang.String" value="authUs" noResource="true"/>
75+ </Properties>
76+ <AuxValues>
77+ <AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="RackspaceConfigPanel_authUs"/>
78+ </AuxValues>
79+ </Component>
80+ <Component class="javax.swing.JRadioButton" name="authUk">
81+ <Properties>
82+ <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
83+ <ComponentRef name="txtAuthServer"/>
84+ </Property>
85+ <Property name="text" type="java.lang.String" value="UK"/>
86+ <Property name="name" type="java.lang.String" value="authUk" noResource="true"/>
87+ </Properties>
88+ </Component>
89 </SubComponents>
90 </Form>
91
92=== modified file 'syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConfigPanel.java'
93--- syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConfigPanel.java 2011-06-05 21:26:56 +0000
94+++ syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConfigPanel.java 2011-06-27 21:11:14 +0000
95@@ -18,6 +18,7 @@
96 package org.syncany.connection.plugins.rackspace;
97
98 import java.util.ResourceBundle;
99+import org.jdesktop.application.Action;
100
101 import org.syncany.config.Config;
102 import org.syncany.connection.plugins.ConfigPanel;
103@@ -40,7 +41,11 @@
104 public void load() {
105 txtUsername.setText(getConnection().getUsername());
106 txtApiKey.setText(getConnection().getApiKey());
107- txtContainerName.setText(getConnection().getContainer());
108+ txtContainerName.setText(getConnection().getContainer());
109+ if(getConnection().getAuthServer().equals("US"))
110+ txtAuthServer.setSelected(authUs.getModel(), true);
111+ else
112+ txtAuthServer.setSelected(authUk.getModel(), true);
113 }
114
115 @Override
116@@ -48,6 +53,13 @@
117 getConnection().setUsername(txtUsername.getText());
118 getConnection().setApiKey(new String(txtApiKey.getPassword()));
119 getConnection().setContainer(txtContainerName.getText());
120+
121+ String authServer;
122+ if(txtAuthServer.getSelection() == authUs.getModel())
123+ authServer = "US";
124+ else
125+ authServer = "UK";
126+ getConnection().setAuthServer(authServer);
127 }
128
129 @Override
130@@ -64,12 +76,16 @@
131 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
132 private void initComponents() {
133
134+ txtAuthServer = new javax.swing.ButtonGroup();
135 txtUsername = new javax.swing.JTextField();
136 txtApiKey = new javax.swing.JPasswordField();
137 txtContainerName = new javax.swing.JTextField();
138 jLabel3 = new javax.swing.JLabel();
139 jLabel1 = new javax.swing.JLabel();
140 jLabel2 = new javax.swing.JLabel();
141+ jLabel4 = new javax.swing.JLabel();
142+ authUs = new javax.swing.JRadioButton();
143+ authUk = new javax.swing.JRadioButton();
144
145 txtUsername.setName("txtUsername"); // NOI18N
146
147@@ -78,17 +94,30 @@
148 txtContainerName.setName("txtContainerName"); // NOI18N
149
150 jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
151- jLabel3.setText(resourceBundle.getString("rackspace_container_name"));
152+ jLabel3.setText("Container Name:");
153 jLabel3.setName("jLabel3"); // NOI18N
154
155 jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
156- jLabel1.setText(resourceBundle.getString("rackspace_username"));
157+ jLabel1.setText("Username:");
158 jLabel1.setName("jLabel1"); // NOI18N
159
160 jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
161- jLabel2.setText(resourceBundle.getString("rackspace_apiKey"));
162+ jLabel2.setText("API Key:");
163 jLabel2.setName("jLabel2"); // NOI18N
164
165+ jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
166+ jLabel4.setText("Auth Server:");
167+ jLabel4.setName("jLabel4"); // NOI18N
168+
169+ txtAuthServer.add(authUs);
170+ authUs.setSelected(true);
171+ authUs.setText("US");
172+ authUs.setName("authUs"); // NOI18N
173+
174+ txtAuthServer.add(authUk);
175+ authUk.setText("UK");
176+ authUk.setName("authUk"); // NOI18N
177+
178 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
179 this.setLayout(layout);
180 layout.setHorizontalGroup(
181@@ -97,12 +126,17 @@
182 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
183 .addComponent(jLabel1)
184 .addComponent(jLabel2)
185- .addComponent(jLabel3))
186+ .addComponent(jLabel3)
187+ .addComponent(jLabel4))
188 .addGap(33, 33, 33)
189 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
190 .addComponent(txtUsername, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
191 .addComponent(txtApiKey, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
192- .addComponent(txtContainerName, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE))
193+ .addComponent(txtContainerName, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
194+ .addGroup(layout.createSequentialGroup()
195+ .addComponent(authUs)
196+ .addGap(18, 18, 18)
197+ .addComponent(authUk)))
198 .addContainerGap())
199 );
200 layout.setVerticalGroup(
201@@ -119,14 +153,24 @@
202 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
203 .addComponent(txtContainerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
204 .addComponent(jLabel3))
205- .addContainerGap(52, Short.MAX_VALUE))
206+ .addGap(18, 18, 18)
207+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
208+ .addComponent(jLabel4)
209+ .addComponent(authUs)
210+ .addComponent(authUk))
211+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
212 );
213 }// </editor-fold>//GEN-END:initComponents
214+
215 // Variables declaration - do not modify//GEN-BEGIN:variables
216+ private javax.swing.JRadioButton authUk;
217+ private javax.swing.JRadioButton authUs;
218 private javax.swing.JLabel jLabel1;
219 private javax.swing.JLabel jLabel2;
220 private javax.swing.JLabel jLabel3;
221+ private javax.swing.JLabel jLabel4;
222 private javax.swing.JPasswordField txtApiKey;
223+ private javax.swing.ButtonGroup txtAuthServer;
224 private javax.swing.JTextField txtContainerName;
225 private javax.swing.JTextField txtUsername;
226 // End of variables declaration//GEN-END:variables
227
228=== modified file 'syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConnection.java'
229--- syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConnection.java 2011-06-05 21:26:56 +0000
230+++ syncany/src/org/syncany/connection/plugins/rackspace/RackspaceConnection.java 2011-06-27 21:11:14 +0000
231@@ -35,6 +35,7 @@
232 public class RackspaceConnection implements Connection {
233 private String username;
234 private String apiKey;
235+ private String authServer;
236 private String container;
237 private ResourceBundle resourceBundle;
238
239@@ -66,6 +67,14 @@
240 this.apiKey = apiKey;
241 }
242
243+ public String getAuthServer() {
244+ return authServer;
245+ }
246+
247+ public void setAuthServer(String authServer) {
248+ this.authServer = authServer;
249+ }
250+
251 public String getContainer() {
252 return container;
253 }
254@@ -87,6 +96,7 @@
255 // Mandatory
256 username = node.getProperty("username");
257 apiKey = node.getProperty("apikey");
258+ authServer = node.getProperty("authServer");
259 container = node.getProperty("container");
260
261 if (username == null || apiKey == null || container == null) {
262@@ -99,6 +109,7 @@
263 node.setAttribute("type", getPluginInfo().getId());
264 node.setProperty("username", username);
265 node.setProperty("apikey", apiKey);
266+ node.setProperty("authServer", authServer);
267 node.setProperty("container", container);
268 }
269
270
271=== modified file 'syncany/src/org/syncany/connection/plugins/rackspace/RackspaceTransferManager.java'
272--- syncany/src/org/syncany/connection/plugins/rackspace/RackspaceTransferManager.java 2011-05-23 16:50:04 +0000
273+++ syncany/src/org/syncany/connection/plugins/rackspace/RackspaceTransferManager.java 2011-06-27 21:11:14 +0000
274@@ -38,7 +38,8 @@
275 * @author oubou68, pheckel
276 */
277 public class RackspaceTransferManager extends AbstractTransferManager {
278- private static final String AUTH_URL = "https://auth.api.rackspacecloud.com/v1.0";
279+ private static final String AUTH_URL_US = "https://auth.api.rackspacecloud.com/v1.0";
280+ private static final String AUTH_URL_UK = "https://lon.auth.api.rackspacecloud.com/v1.0";
281 private static final int CONNECTION_TIMEOUT = 5000;
282
283 private FilesClient client;
284@@ -47,7 +48,11 @@
285 super(connection);
286
287 client = new FilesClient(connection.getUsername(), connection.getApiKey());
288- client.setAuthenticationURL(AUTH_URL);
289+ if(connection.getAuthServer().equals("US"))
290+ client.setAuthenticationURL(AUTH_URL_US);
291+ else
292+ client.setAuthenticationURL(AUTH_URL_UK);
293+
294 client.setConnectionTimeOut(CONNECTION_TIMEOUT);
295 }
296