Merge lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:~syncany-team/syncany/trunk
- syncany-remote-watch-interval
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~isak-karlsson/syncany/syncany-remote-watch-interval |
Merge into: | lp:~syncany-team/syncany/trunk |
Diff against target: |
1264 lines (+451/-353) 7 files modified
syncany/src/org/syncany/config/Profile.java (+5/-0) syncany/src/org/syncany/gui/settings/ProfilePanel.form (+2/-2) syncany/src/org/syncany/gui/settings/ProfilePanel.java (+60/-60) syncany/src/org/syncany/gui/settings/RepositoryPanel.form (+73/-27) syncany/src/org/syncany/gui/settings/RepositoryPanel.java (+137/-115) syncany/src/org/syncany/i18n/I18n_en_US.properties (+2/-0) syncany/src/org/syncany/watch/remote/RemoteWatcher.java (+172/-149) |
To merge this branch: | bzr merge lp:~isak-karlsson/syncany/syncany-remote-watch-interval |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Philipp C. Heckel | Approve | ||
Review via email: mp+64850@code.launchpad.net |
Commit message
Description of the change
Added the ability to change the remote checking inverval.
Philipp C. Heckel (binwiederhier) wrote : | # |
isakkarlsson (isak-karlsson) wrote : | # |
I'll fix the native.py script first..
On 06/16/2011 05:13 PM, Philipp C. Heckel wrote:
> I'll review this tonight and then merge it :-D
>
> On Thu, Jun 16, 2011 at 4:58 PM, isakkarlsson<email address hidden> wrote:
>> isakkarlsson has proposed merging lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>
>> Requested reviews:
>> Syncany Team (syncany-team)
>>
>> For more details, see:
>> https:/
>>
>> Added the ability to change the remote checking inverval.
>> --
>> https:/
>> Your team Syncany Team is requested to review the proposed merge of lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>
>> === modified file 'syncany/
>> --- syncany/
>> +++ syncany/
>> @@ -1,4 +1,4 @@
>> -#!/usr/bin/python
>> +#!/usr/bin/python2
>> #
>> # Syncany Linux Native Functions
>> # Copyright (C) 2011 Philipp C. Heckel<email address hidden>
>>
>> === modified file 'syncany/
>> --- syncany/
>> +++ syncany/
>> @@ -149,6 +149,8 @@
>> // Repo
>> repository = new Repository();
>> repository.
>> +
>> + remoteWatcher.
>>
>> // Folders
>> folders = new Folders(this);
>> @@ -175,5 +177,8 @@
>>
>> // Folders
>> folders.
>> +
>> + // Watcher
>> + remoteWatcher.
>> }
>> }
>>
>> === modified file 'syncany/
>> --- syncany/
>> +++ syncany/
>> @@ -28,8 +28,8 @@
>> <Component id="cbActive" alignment="0" min="-2" max="-2" attributes="0"/>
>> <Group type="102" alignment="0" attributes="0">
>> <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
>> -<EmptySpace max="-2" attributes="0"/>
>> -<Component id="txtProfileName" pref="344" max="32767" attributes="0"/>
>> +<EmptySpace min="-2" pref="62" max="-2" attributes="0"/>
>> +<Component id="txtProfileName" pref="294" max="32767" attributes="0"/>
>> </Group>
>> </Group>
>> <EmptySpace max="-2" attributes="0"/>
>>
>> === modified file 'syncany/
>> --- syncany/
>> +++ syncany/
>> @@ -69,65 +69,65 @@
>> * always regenerated by the F...
Philipp C. Heckel (binwiederhier) wrote : | # |
While you're at it: I noticed that due to your chanes in the GUI, the
internationaliz
was in the Netbeans-
overwritten it.
Could you by any chance try to make it work again? Maybe just
overwrite the values in the constructor of the frame:
lblXYZ.
On Thu, Jun 16, 2011 at 7:16 PM, isakkarlsson <email address hidden> wrote:
> I'll fix the native.py script first..
>
> On 06/16/2011 05:13 PM, Philipp C. Heckel wrote:
>> I'll review this tonight and then merge it :-D
>>
>> On Thu, Jun 16, 2011 at 4:58 PM, isakkarlsson<email address hidden> wrote:
>>> isakkarlsson has proposed merging lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>
>>> Requested reviews:
>>> Syncany Team (syncany-team)
>>>
>>> For more details, see:
>>> https:/
>>>
>>> Added the ability to change the remote checking inverval.
>>> --
>>> https:/
>>> Your team Syncany Team is requested to review the proposed merge of lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>
>>> === modified file 'syncany/
>>> --- syncany/
>>> +++ syncany/
>>> @@ -1,4 +1,4 @@
>>> -#!/usr/bin/python
>>> +#!/usr/bin/python2
>>> #
>>> # Syncany Linux Native Functions
>>> # Copyright (C) 2011 Philipp C. Heckel<email address hidden>
>>>
>>> === modified file 'syncany/
>>> --- syncany/
>>> +++ syncany/
>>> @@ -149,6 +149,8 @@
>>> // Repo
>>> repository = new Repository();
>>> repository.
>>> +
>>> + remoteWatcher.
>>>
>>> // Folders
>>> folders = new Folders(this);
>>> @@ -175,5 +177,8 @@
>>>
>>> // Folders
>>> folders.
>>> +
>>> + // Watcher
>>> + remoteWatcher.
>>> }
>>> }
>>>
>>> === modified file 'syncany/
>>> --- syncany/
>>> +++ syncany/
>>> @@ -28,8 +28,8 @@
>>> <Component id="cbActive" alignment="0" min="-2" max="-2" attributes="0"/>
>>> <Group type="102" alignment="0" attributes="0">
>>> <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
>>> -<EmptySpace max="-2" attributes="0"/>
>>> -<Component id="txtProfileName" pref="344" max="32767" attributes="0"/>
>>> +<EmptySpace min="-2" pref="62" max="-2" attributes="0"/>
>...
isakkarlsson (isak-karlsson) wrote : | # |
I've fixed it now.
On 06/16/2011 07:31 PM, Philipp C. Heckel wrote:
> While you're at it: I noticed that due to your chanes in the GUI, the
> internationaliz
> was in the Netbeans-
> overwritten it.
>
> Could you by any chance try to make it work again? Maybe just
> overwrite the values in the constructor of the frame:
> lblXYZ.
>
> On Thu, Jun 16, 2011 at 7:16 PM, isakkarlsson<email address hidden> wrote:
>> I'll fix the native.py script first..
>>
>> On 06/16/2011 05:13 PM, Philipp C. Heckel wrote:
>>> I'll review this tonight and then merge it :-D
>>>
>>> On Thu, Jun 16, 2011 at 4:58 PM, isakkarlsson<email address hidden> wrote:
>>>> isakkarlsson has proposed merging lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>>
>>>> Requested reviews:
>>>> Syncany Team (syncany-team)
>>>>
>>>> For more details, see:
>>>> https:/
>>>>
>>>> Added the ability to change the remote checking inverval.
>>>> --
>>>> https:/
>>>> Your team Syncany Team is requested to review the proposed merge of lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>>
>>>> === modified file 'syncany/
>>>> --- syncany/
>>>> +++ syncany/
>>>> @@ -1,4 +1,4 @@
>>>> -#!/usr/bin/python
>>>> +#!/usr/bin/python2
>>>> #
>>>> # Syncany Linux Native Functions
>>>> # Copyright (C) 2011 Philipp C. Heckel<email address hidden>
>>>>
>>>> === modified file 'syncany/
>>>> --- syncany/
>>>> +++ syncany/
>>>> @@ -149,6 +149,8 @@
>>>> // Repo
>>>> repository = new Repository();
>>>> repository.
>>>> +
>>>> + remoteWatcher.
>>>>
>>>> // Folders
>>>> folders = new Folders(this);
>>>> @@ -175,5 +177,8 @@
>>>>
>>>> // Folders
>>>> folders.
>>>> +
>>>> + // Watcher
>>>> + remoteWatcher.
>>>> }
>>>> }
>>>>
>>>> === modified file 'syncany/
>>>> --- syncany/
>>>> +++ syncany/
>>>> @@ -28,8 +28,8 @@
>>>> <Component id="cbActive" alignment="0" min="-2" max="-2" attributes="0"/>
>>>> <Group type="102" alignment="0" attributes="0">
>>>> <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
>>>> -<EmptySpace m...
Philipp C. Heckel (binwiederhier) wrote : | # |
Hi Isak,
Just so you know; I reviewed the code and it looks good. However, I
did not yet merge it into the trunk, but I already merged it in my
local version. It'll be in the branch with the new sync algorithm (not
yet published).
Cheers,
Philipp
On Thu, Jun 16, 2011 at 8:12 PM, isakkarlsson <email address hidden> wrote:
> I've fixed it now.
>
> On 06/16/2011 07:31 PM, Philipp C. Heckel wrote:
>> While you're at it: I noticed that due to your chanes in the GUI, the
>> internationaliz
>> was in the Netbeans-
>> overwritten it.
>>
>> Could you by any chance try to make it work again? Maybe just
>> overwrite the values in the constructor of the frame:
>> lblXYZ.
>>
>> On Thu, Jun 16, 2011 at 7:16 PM, isakkarlsson<email address hidden> wrote:
>>> I'll fix the native.py script first..
>>>
>>> On 06/16/2011 05:13 PM, Philipp C. Heckel wrote:
>>>> I'll review this tonight and then merge it :-D
>>>>
>>>> On Thu, Jun 16, 2011 at 4:58 PM, isakkarlsson<email address hidden> wrote:
>>>>> isakkarlsson has proposed merging lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>>>
>>>>> Requested reviews:
>>>>> Syncany Team (syncany-team)
>>>>>
>>>>> For more details, see:
>>>>> https:/
>>>>>
>>>>> Added the ability to change the remote checking inverval.
>>>>> --
>>>>> https:/
>>>>> Your team Syncany Team is requested to review the proposed merge of lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>>>
>>>>> === modified file 'syncany/
>>>>> --- syncany/
>>>>> +++ syncany/
>>>>> @@ -1,4 +1,4 @@
>>>>> -#!/usr/bin/python
>>>>> +#!/usr/bin/python2
>>>>> #
>>>>> # Syncany Linux Native Functions
>>>>> # Copyright (C) 2011 Philipp C. Heckel<email address hidden>
>>>>>
>>>>> === modified file 'syncany/
>>>>> --- syncany/
>>>>> +++ syncany/
>>>>> @@ -149,6 +149,8 @@
>>>>> // Repo
>>>>> repository = new Repository();
>>>>> repository.
>>>>> +
>>>>> + remoteWatcher.
>>>>>
>>>>> // Folders
>>>>> folders = new Folders(this);
>>>>> @@ -175,5 +177,8 @@
>>>>>
>>>>> // Folders
>>>>> folders.
>>>>> +
>>>>> + // Watcher
>>>>> + remoteWatcher.
>>>>> }
>>>>> }
>>>>>
>>>>> === modified file 'syncany/
>>>>> --- syncany/
...
isakkarlsson (isak-karlsson) wrote : | # |
Hi,
Sounds like a plan. When will the thesis (on the algorithm) be publised?
Sounds like an interesting read.
Regards
On 06/17/2011 09:27 PM, Philipp C. Heckel wrote:
> Hi Isak,
>
> Just so you know; I reviewed the code and it looks good. However, I
> did not yet merge it into the trunk, but I already merged it in my
> local version. It'll be in the branch with the new sync algorithm (not
> yet published).
>
> Cheers,
> Philipp
>
> On Thu, Jun 16, 2011 at 8:12 PM, isakkarlsson<email address hidden> wrote:
>> I've fixed it now.
>>
>> On 06/16/2011 07:31 PM, Philipp C. Heckel wrote:
>>> While you're at it: I noticed that due to your chanes in the GUI, the
>>> internationaliz
>>> was in the Netbeans-
>>> overwritten it.
>>>
>>> Could you by any chance try to make it work again? Maybe just
>>> overwrite the values in the constructor of the frame:
>>> lblXYZ.
>>>
>>> On Thu, Jun 16, 2011 at 7:16 PM, isakkarlsson<email address hidden> wrote:
>>>> I'll fix the native.py script first..
>>>>
>>>> On 06/16/2011 05:13 PM, Philipp C. Heckel wrote:
>>>>> I'll review this tonight and then merge it :-D
>>>>>
>>>>> On Thu, Jun 16, 2011 at 4:58 PM, isakkarlsson<email address hidden> wrote:
>>>>>> isakkarlsson has proposed merging lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>>>>
>>>>>> Requested reviews:
>>>>>> Syncany Team (syncany-team)
>>>>>>
>>>>>> For more details, see:
>>>>>> https:/
>>>>>>
>>>>>> Added the ability to change the remote checking inverval.
>>>>>> --
>>>>>> https:/
>>>>>> Your team Syncany Team is requested to review the proposed merge of lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>>>>
>>>>>> === modified file 'syncany/
>>>>>> --- syncany/
>>>>>> +++ syncany/
>>>>>> @@ -1,4 +1,4 @@
>>>>>> -#!/usr/bin/python
>>>>>> +#!/usr/bin/python2
>>>>>> #
>>>>>> # Syncany Linux Native Functions
>>>>>> # Copyright (C) 2011 Philipp C. Heckel<email address hidden>
>>>>>>
>>>>>> === modified file 'syncany/
>>>>>> --- syncany/
>>>>>> +++ syncany/
>>>>>> @@ -149,6 +149,8 @@
>>>>>> // Repo
>>>>>> repository = new Repository();
>>>>>> repository.
>>>>>> +
>>>>>> + remoteWatcher.
>>>>>>
>>>>>> // Folders
>>>>>> folders = new Folders(this);
>>>>>> @@ -175,5 +177,8 @@
>>>>>>
>>>>>> // Folders
>>>>>> folders.
>>>>>> +
>>>>>> + // Watcher
>>>>>> + remoteWatcher.s...
Philipp C. Heckel (binwiederhier) wrote : | # |
Hi Isak,
Although the syncing stuff will be briefly described in the thesis, is
not really the core of my thesis -- I'm doing that just for fun :-D
The thesis is more about optimizing the bandwidth and storage
utilization.
I'll push the code as soon as it's working. Hopefully today or tomorrow :-D
Cheers
Philipp
On Sat, Jun 18, 2011 at 1:34 AM, isakkarlsson <email address hidden> wrote:
> Hi,
>
> Sounds like a plan. When will the thesis (on the algorithm) be publised?
> Sounds like an interesting read.
>
> Regards
>
> On 06/17/2011 09:27 PM, Philipp C. Heckel wrote:
>> Hi Isak,
>>
>> Just so you know; I reviewed the code and it looks good. However, I
>> did not yet merge it into the trunk, but I already merged it in my
>> local version. It'll be in the branch with the new sync algorithm (not
>> yet published).
>>
>> Cheers,
>> Philipp
>>
>> On Thu, Jun 16, 2011 at 8:12 PM, isakkarlsson<email address hidden> wrote:
>>> I've fixed it now.
>>>
>>> On 06/16/2011 07:31 PM, Philipp C. Heckel wrote:
>>>> While you're at it: I noticed that due to your chanes in the GUI, the
>>>> internationaliz
>>>> was in the Netbeans-
>>>> overwritten it.
>>>>
>>>> Could you by any chance try to make it work again? Maybe just
>>>> overwrite the values in the constructor of the frame:
>>>> lblXYZ.
>>>>
>>>> On Thu, Jun 16, 2011 at 7:16 PM, isakkarlsson<email address hidden> wrote:
>>>>> I'll fix the native.py script first..
>>>>>
>>>>> On 06/16/2011 05:13 PM, Philipp C. Heckel wrote:
>>>>>> I'll review this tonight and then merge it :-D
>>>>>>
>>>>>> On Thu, Jun 16, 2011 at 4:58 PM, isakkarlsson<email address hidden> wrote:
>>>>>>> isakkarlsson has proposed merging lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>>>>>
>>>>>>> Requested reviews:
>>>>>>> Syncany Team (syncany-team)
>>>>>>>
>>>>>>> For more details, see:
>>>>>>> https:/
>>>>>>>
>>>>>>> Added the ability to change the remote checking inverval.
>>>>>>> --
>>>>>>> https:/
>>>>>>> Your team Syncany Team is requested to review the proposed merge of lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>>>>>>>
>>>>>>> === modified file 'syncany/
>>>>>>> --- syncany/
>>>>>>> +++ syncany/
>>>>>>> @@ -1,4 +1,4 @@
>>>>>>> -#!/usr/bin/python
>>>>>>> +#!/usr/bin/python2
>>>>>>> #
>>>>>>> # Syncany Linux Native Functions
>>>>>>> # Copyright (C) 2011 Philipp C. Heckel<email address hidden>
>>>>>>>
>>>>>>> === modified file 'syncany/
>>>>>>> --- syncany/
>>>>>>> +++ syncany/
>>>>>>> @@ -149,6 +149,8 @@
>>>>>>> // Repo
>>>>>>> repository = new Repositor...
Philipp C. Heckel (binwiederhier) wrote : | # |
changes have been merged in my newsync branch; and will be in the trunk soon.
Unmerged revisions
- 48. By isakkarlsson
-
fix resourceBundle
- 47. By isakkarlsson
-
fix native.py
- 46. By isakkarlsson
-
merge trunk
- 45. By isakkarlsson
-
moved the gui to RepositoryPanel seemed more fitting there..
- 44. By isakkarlsson
-
merge trunk
- 43. By isakkarlsson
-
Added possibility to change the remote watch check interval (to lower costs for i.e. google storage)
Preview Diff
1 | === modified file 'syncany/src/org/syncany/config/Profile.java' |
2 | --- syncany/src/org/syncany/config/Profile.java 2011-05-23 16:50:04 +0000 |
3 | +++ syncany/src/org/syncany/config/Profile.java 2011-06-16 18:12:48 +0000 |
4 | @@ -149,6 +149,8 @@ |
5 | // Repo |
6 | repository = new Repository(); |
7 | repository.load(node.findChildByName("repository")); |
8 | + |
9 | + remoteWatcher.load(node.findChildByName("watcher")); |
10 | |
11 | // Folders |
12 | folders = new Folders(this); |
13 | @@ -175,5 +177,8 @@ |
14 | |
15 | // Folders |
16 | folders.save(node.findOrCreateChildByXpath("folders", "folders")); |
17 | + |
18 | + // Watcher |
19 | + remoteWatcher.save(node.findOrCreateChildByXpath("watcher", "watcher")); |
20 | } |
21 | } |
22 | |
23 | === modified file 'syncany/src/org/syncany/gui/settings/ProfilePanel.form' |
24 | --- syncany/src/org/syncany/gui/settings/ProfilePanel.form 2011-05-23 16:50:04 +0000 |
25 | +++ syncany/src/org/syncany/gui/settings/ProfilePanel.form 2011-06-16 18:12:48 +0000 |
26 | @@ -28,8 +28,8 @@ |
27 | <Component id="cbActive" alignment="0" min="-2" max="-2" attributes="0"/> |
28 | <Group type="102" alignment="0" attributes="0"> |
29 | <Component id="jLabel1" min="-2" max="-2" attributes="0"/> |
30 | - <EmptySpace max="-2" attributes="0"/> |
31 | - <Component id="txtProfileName" pref="344" max="32767" attributes="0"/> |
32 | + <EmptySpace min="-2" pref="62" max="-2" attributes="0"/> |
33 | + <Component id="txtProfileName" pref="294" max="32767" attributes="0"/> |
34 | </Group> |
35 | </Group> |
36 | <EmptySpace max="-2" attributes="0"/> |
37 | |
38 | === modified file 'syncany/src/org/syncany/gui/settings/ProfilePanel.java' |
39 | --- syncany/src/org/syncany/gui/settings/ProfilePanel.java 2011-06-05 21:26:56 +0000 |
40 | +++ syncany/src/org/syncany/gui/settings/ProfilePanel.java 2011-06-16 18:12:48 +0000 |
41 | @@ -69,65 +69,65 @@ |
42 | * always regenerated by the Form Editor. |
43 | */ |
44 | @SuppressWarnings("unchecked") |
45 | - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
46 | - private void initComponents() { |
47 | - |
48 | - jLabel1 = new javax.swing.JLabel(); |
49 | - txtProfileName = new javax.swing.JTextField(); |
50 | - cbActive = new javax.swing.JCheckBox(); |
51 | - jLabel2 = new javax.swing.JLabel(); |
52 | - |
53 | - setBorder(null); |
54 | - |
55 | - jLabel1.setLabelFor(txtProfileName); |
56 | - jLabel1.setText(resourceBundle.getString("profp_name")); |
57 | - jLabel1.setName("jLabel1"); // NOI18N |
58 | - |
59 | - txtProfileName.setName("txtProfileName"); // NOI18N |
60 | - |
61 | - cbActive.setText(resourceBundle.getString("profp_activate")); |
62 | - cbActive.setName("cbActive"); // NOI18N |
63 | - |
64 | - jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | java.awt.Font.BOLD)); |
65 | - jLabel2.setText(resourceBundle.getString("profp_settings")); |
66 | - jLabel2.setName("jLabel2"); // NOI18N |
67 | - |
68 | - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
69 | - this.setLayout(layout); |
70 | - layout.setHorizontalGroup( |
71 | - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
72 | - .addGroup(layout.createSequentialGroup() |
73 | - .addContainerGap() |
74 | - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
75 | - .addComponent(jLabel2) |
76 | - .addComponent(cbActive) |
77 | - .addGroup(layout.createSequentialGroup() |
78 | - .addComponent(jLabel1) |
79 | - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
80 | - .addComponent(txtProfileName, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE))) |
81 | - .addContainerGap()) |
82 | - ); |
83 | - layout.setVerticalGroup( |
84 | - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
85 | - .addGroup(layout.createSequentialGroup() |
86 | - .addGap(10, 10, 10) |
87 | - .addComponent(jLabel2) |
88 | - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
89 | - .addComponent(cbActive) |
90 | - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
91 | - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
92 | - .addComponent(txtProfileName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
93 | - .addComponent(jLabel1)) |
94 | - .addContainerGap(213, Short.MAX_VALUE)) |
95 | - ); |
96 | - }// </editor-fold>//GEN-END:initComponents |
97 | - |
98 | - |
99 | - // Variables declaration - do not modify//GEN-BEGIN:variables |
100 | - private javax.swing.JCheckBox cbActive; |
101 | - private javax.swing.JLabel jLabel1; |
102 | - private javax.swing.JLabel jLabel2; |
103 | - private javax.swing.JTextField txtProfileName; |
104 | - // End of variables declaration//GEN-END:variables |
105 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
106 | + private void initComponents() { |
107 | + |
108 | + jLabel1 = new javax.swing.JLabel(); |
109 | + txtProfileName = new javax.swing.JTextField(); |
110 | + cbActive = new javax.swing.JCheckBox(); |
111 | + jLabel2 = new javax.swing.JLabel(); |
112 | + |
113 | + setBorder(null); |
114 | + |
115 | + jLabel1.setLabelFor(txtProfileName); |
116 | + jLabel1.setText("Profile Name:"); |
117 | + jLabel1.setName("jLabel1"); // NOI18N |
118 | + |
119 | + txtProfileName.setName("txtProfileName"); // NOI18N |
120 | + |
121 | + cbActive.setText("Activate Profile"); |
122 | + cbActive.setName("cbActive"); // NOI18N |
123 | + |
124 | + jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | java.awt.Font.BOLD)); |
125 | + jLabel2.setText("Profile Settings"); |
126 | + jLabel2.setName("jLabel2"); // NOI18N |
127 | + |
128 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
129 | + this.setLayout(layout); |
130 | + layout.setHorizontalGroup( |
131 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
132 | + .addGroup(layout.createSequentialGroup() |
133 | + .addContainerGap() |
134 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
135 | + .addComponent(jLabel2) |
136 | + .addComponent(cbActive) |
137 | + .addGroup(layout.createSequentialGroup() |
138 | + .addComponent(jLabel1) |
139 | + .addGap(62, 62, 62) |
140 | + .addComponent(txtProfileName, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE))) |
141 | + .addContainerGap()) |
142 | + ); |
143 | + layout.setVerticalGroup( |
144 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
145 | + .addGroup(layout.createSequentialGroup() |
146 | + .addGap(10, 10, 10) |
147 | + .addComponent(jLabel2) |
148 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
149 | + .addComponent(cbActive) |
150 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
151 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
152 | + .addComponent(txtProfileName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
153 | + .addComponent(jLabel1)) |
154 | + .addContainerGap(213, Short.MAX_VALUE)) |
155 | + ); |
156 | + }// </editor-fold>//GEN-END:initComponents |
157 | + |
158 | + |
159 | + // Variables declaration - do not modify//GEN-BEGIN:variables |
160 | + private javax.swing.JCheckBox cbActive; |
161 | + private javax.swing.JLabel jLabel1; |
162 | + private javax.swing.JLabel jLabel2; |
163 | + private javax.swing.JTextField txtProfileName; |
164 | + // End of variables declaration//GEN-END:variables |
165 | |
166 | } |
167 | |
168 | === modified file 'syncany/src/org/syncany/gui/settings/RepositoryPanel.form' |
169 | --- syncany/src/org/syncany/gui/settings/RepositoryPanel.form 2011-05-23 16:50:04 +0000 |
170 | +++ syncany/src/org/syncany/gui/settings/RepositoryPanel.form 2011-06-16 18:12:48 +0000 |
171 | @@ -23,22 +23,29 @@ |
172 | <EmptySpace pref="2" max="-2" attributes="0"/> |
173 | <Component id="jLabel1" min="-2" max="-2" attributes="0"/> |
174 | </Group> |
175 | + <Component id="scrConnection" alignment="0" min="-2" pref="499" max="-2" attributes="0"/> |
176 | + <Component id="lblConnection" alignment="0" min="-2" max="-2" attributes="0"/> |
177 | + <Group type="102" alignment="0" attributes="0"> |
178 | + <Group type="103" groupAlignment="0" attributes="0"> |
179 | + <Component id="jLabel4" min="-2" max="-2" attributes="0"/> |
180 | + <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/> |
181 | + </Group> |
182 | + <EmptySpace min="-2" pref="50" max="-2" attributes="0"/> |
183 | + <Group type="103" groupAlignment="0" max="-2" attributes="0"> |
184 | + <Component id="jspRemoteInterval" max="32767" attributes="1"/> |
185 | + <Component id="lblEncryption" alignment="0" max="32767" attributes="1"/> |
186 | + </Group> |
187 | + <EmptySpace max="-2" attributes="0"/> |
188 | + <Component id="jLabel5" min="-2" max="-2" attributes="0"/> |
189 | + </Group> |
190 | <Group type="102" alignment="0" attributes="0"> |
191 | <Component id="jLabel3" min="-2" max="-2" attributes="0"/> |
192 | - <EmptySpace min="12" pref="12" max="12" attributes="0"/> |
193 | - <Component id="lblStorageType" min="-2" max="-2" attributes="0"/> |
194 | - </Group> |
195 | - <Group type="102" alignment="0" attributes="0"> |
196 | - <EmptySpace min="-2" pref="120" max="-2" attributes="0"/> |
197 | - <Component id="lblStorageDescription" min="-2" max="-2" attributes="0"/> |
198 | - </Group> |
199 | - <Group type="102" alignment="0" attributes="0"> |
200 | - <Component id="jLabel4" min="-2" max="-2" attributes="0"/> |
201 | - <EmptySpace min="50" pref="50" max="50" attributes="0"/> |
202 | - <Component id="lblEncryption" min="-2" max="-2" attributes="0"/> |
203 | - </Group> |
204 | - <Component id="lblConnection" alignment="0" min="-2" max="-2" attributes="0"/> |
205 | - <Component id="scrConnection" alignment="0" min="-2" pref="499" max="-2" attributes="0"/> |
206 | + <EmptySpace min="-2" pref="30" max="-2" attributes="0"/> |
207 | + <Group type="103" groupAlignment="0" attributes="0"> |
208 | + <Component id="lblStorageType" min="-2" max="-2" attributes="0"/> |
209 | + <Component id="lblStorageDescription" alignment="0" min="-2" max="-2" attributes="0"/> |
210 | + </Group> |
211 | + </Group> |
212 | </Group> |
213 | <EmptySpace max="32767" attributes="0"/> |
214 | </Group> |
215 | @@ -50,20 +57,26 @@ |
216 | <EmptySpace max="-2" attributes="0"/> |
217 | <Component id="jLabel1" min="-2" max="-2" attributes="0"/> |
218 | <EmptySpace type="unrelated" max="-2" attributes="0"/> |
219 | - <Group type="103" groupAlignment="0" attributes="0"> |
220 | - <Component id="jLabel3" min="-2" max="-2" attributes="0"/> |
221 | - <Component id="lblStorageType" min="-2" max="-2" attributes="0"/> |
222 | + <Group type="103" groupAlignment="3" attributes="0"> |
223 | + <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> |
224 | + <Component id="lblStorageType" alignment="3" min="-2" max="-2" attributes="0"/> |
225 | </Group> |
226 | - <EmptySpace min="5" pref="5" max="5" attributes="0"/> |
227 | + <EmptySpace min="-2" pref="2" max="-2" attributes="0"/> |
228 | <Component id="lblStorageDescription" min="-2" max="-2" attributes="0"/> |
229 | - <EmptySpace min="-2" pref="15" max="-2" attributes="0"/> |
230 | + <EmptySpace type="separate" max="-2" attributes="0"/> |
231 | <Group type="103" groupAlignment="0" attributes="0"> |
232 | <Component id="jLabel4" min="-2" max="-2" attributes="0"/> |
233 | <Component id="lblEncryption" min="-2" max="-2" attributes="0"/> |
234 | </Group> |
235 | - <EmptySpace min="-2" pref="30" max="-2" attributes="0"/> |
236 | + <EmptySpace type="unrelated" max="-2" attributes="0"/> |
237 | + <Group type="103" groupAlignment="3" attributes="0"> |
238 | + <Component id="jspRemoteInterval" alignment="3" min="-2" max="-2" attributes="0"/> |
239 | + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> |
240 | + <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/> |
241 | + </Group> |
242 | + <EmptySpace pref="28" max="32767" attributes="0"/> |
243 | <Component id="lblConnection" min="-2" max="-2" attributes="0"/> |
244 | - <EmptySpace pref="12" max="32767" attributes="0"/> |
245 | + <EmptySpace type="unrelated" max="-2" attributes="0"/> |
246 | <Component id="scrConnection" min="-2" pref="237" max="-2" attributes="0"/> |
247 | <EmptySpace max="-2" attributes="0"/> |
248 | </Group> |
249 | @@ -89,7 +102,9 @@ |
250 | <Font bold="true" component="lblConnection" property="font" relativeSize="true" size="0"/> |
251 | </FontInfo> |
252 | </Property> |
253 | - <Property name="text" type="java.lang.String" value="(xyz) Connection"/> |
254 | + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> |
255 | + <Connection code="resourceBundle.getString("reposp_connection")" type="code"/> |
256 | + </Property> |
257 | <Property name="name" type="java.lang.String" value="lblConnection" noResource="true"/> |
258 | </Properties> |
259 | </Component> |
260 | @@ -112,33 +127,64 @@ |
261 | </Container> |
262 | <Component class="javax.swing.JLabel" name="jLabel3"> |
263 | <Properties> |
264 | - <Property name="text" type="java.lang.String" value="Connection Type:"/> |
265 | + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> |
266 | + <Connection code="resourceBundle.getString("reposp_connection_type")" type="code"/> |
267 | + </Property> |
268 | <Property name="name" type="java.lang.String" value="jLabel3" noResource="true"/> |
269 | </Properties> |
270 | </Component> |
271 | <Component class="javax.swing.JLabel" name="jLabel4"> |
272 | <Properties> |
273 | - <Property name="text" type="java.lang.String" value="Encryption:"/> |
274 | + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> |
275 | + <Connection code="resourceBundle.getString("reposp_encryption")" type="code"/> |
276 | + </Property> |
277 | <Property name="name" type="java.lang.String" value="jLabel4" noResource="true"/> |
278 | </Properties> |
279 | </Component> |
280 | <Component class="javax.swing.JLabel" name="lblStorageType"> |
281 | <Properties> |
282 | - <Property name="text" type="java.lang.String" value="(type)"/> |
283 | + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> |
284 | + <Connection code="resourceBundle.getString("reposp_temp_type")" type="code"/> |
285 | + </Property> |
286 | <Property name="name" type="java.lang.String" value="lblStorageType" noResource="true"/> |
287 | </Properties> |
288 | </Component> |
289 | <Component class="javax.swing.JLabel" name="lblEncryption"> |
290 | <Properties> |
291 | - <Property name="text" type="java.lang.String" value="(encryption)"/> |
292 | + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> |
293 | + <Connection code="resourceBundle.getString("reposp_temp_encryption")" type="code"/> |
294 | + </Property> |
295 | <Property name="name" type="java.lang.String" value="lblEncryption" noResource="true"/> |
296 | </Properties> |
297 | </Component> |
298 | <Component class="javax.swing.JLabel" name="lblStorageDescription"> |
299 | <Properties> |
300 | - <Property name="text" type="java.lang.String" value="(description)"/> |
301 | + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> |
302 | + <Connection code="resourceBundle.getString("reposp_temp_description")" type="code"/> |
303 | + </Property> |
304 | <Property name="name" type="java.lang.String" value="lblStorageDescription" noResource="true"/> |
305 | </Properties> |
306 | </Component> |
307 | + <Component class="javax.swing.JSpinner" name="jspRemoteInterval"> |
308 | + <Properties> |
309 | + <Property name="name" type="java.lang.String" value="jspRemoteInterval" noResource="true"/> |
310 | + </Properties> |
311 | + </Component> |
312 | + <Component class="javax.swing.JLabel" name="jLabel2"> |
313 | + <Properties> |
314 | + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> |
315 | + <Connection code="resourceBundle.getString("reposp_watch_interval")" type="code"/> |
316 | + </Property> |
317 | + <Property name="name" type="java.lang.String" value="lblWatchInterval" noResource="true"/> |
318 | + </Properties> |
319 | + </Component> |
320 | + <Component class="javax.swing.JLabel" name="jLabel5"> |
321 | + <Properties> |
322 | + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> |
323 | + <Connection code="resourceBundle.getString("reposp_watch_ms")" type="code"/> |
324 | + </Property> |
325 | + <Property name="name" type="java.lang.String" value="lblMiliSeconds" noResource="true"/> |
326 | + </Properties> |
327 | + </Component> |
328 | </SubComponents> |
329 | </Form> |
330 | |
331 | === modified file 'syncany/src/org/syncany/gui/settings/RepositoryPanel.java' |
332 | --- syncany/src/org/syncany/gui/settings/RepositoryPanel.java 2011-06-05 21:26:56 +0000 |
333 | +++ syncany/src/org/syncany/gui/settings/RepositoryPanel.java 2011-06-16 18:12:48 +0000 |
334 | @@ -21,7 +21,6 @@ |
335 | * |
336 | * Created on Mar 27, 2011, 12:51:42 AM |
337 | */ |
338 | - |
339 | package org.syncany.gui.settings; |
340 | |
341 | import java.util.ResourceBundle; |
342 | @@ -37,146 +36,169 @@ |
343 | * @author Philipp C. Heckel <philipp.heckel@gmail.com> |
344 | */ |
345 | public class RepositoryPanel extends SettingsPanel { |
346 | + |
347 | private Profile profile; |
348 | private ConfigPanel pnlConnection; |
349 | private ResourceBundle resourceBundle; |
350 | |
351 | /** Creates new form ProxyPanel */ |
352 | public RepositoryPanel(Profile profile) { |
353 | - resourceBundle = Config.getInstance().getResourceBundle(); |
354 | - initComponents(); |
355 | + resourceBundle = Config.getInstance().getResourceBundle(); |
356 | + initComponents(); |
357 | |
358 | this.profile = profile; |
359 | this.pnlConnection = profile.getRepository().getConnection().createConfigPanel(); |
360 | |
361 | scrConnection.setViewportView(pnlConnection); |
362 | - //scrConnection.getViewport().setViewPosition(new Point(0, 0)); |
363 | - |
364 | + //scrConnection.getViewport().setViewPosition(new Point(0, 0)); |
365 | + |
366 | } |
367 | - |
368 | + |
369 | @Override |
370 | - public void load() { |
371 | - Repository repo = profile.getRepository(); |
372 | - Connection connection = repo.getConnection(); |
373 | - |
374 | - lblStorageType.setText(connection.getPluginInfo().getName() + ", " + resourceBundle.getString("reposp_version") + " " + repo.getConnection().getPluginInfo().getVersionStr()); |
375 | - lblStorageDescription.setText(connection.getPluginInfo().getDescripton()); |
376 | - lblEncryption.setText(repo.getEncryption().getCipherStr() + ", " + repo.getEncryption().getKeylength() + " bit"); |
377 | - |
378 | - lblConnection.setText(connection.getPluginInfo().getName()+ resourceBundle.getString("reposp_connection_details")); |
379 | + public void load() { |
380 | + Repository repo = profile.getRepository(); |
381 | + Connection connection = repo.getConnection(); |
382 | + |
383 | + lblStorageType.setText(connection.getPluginInfo().getName() + ", " + resourceBundle.getString("reposp_version") + " " + repo.getConnection().getPluginInfo().getVersionStr()); |
384 | + lblStorageDescription.setText(connection.getPluginInfo().getDescripton()); |
385 | + lblEncryption.setText(repo.getEncryption().getCipherStr() + ", " + repo.getEncryption().getKeylength() + " bit"); |
386 | + |
387 | + lblConnection.setText(connection.getPluginInfo().getName() + resourceBundle.getString("reposp_connection_details")); |
388 | pnlConnection.load(); |
389 | + jspRemoteInterval.setValue(profile.getRemoteWatcher().getInterval()); |
390 | } |
391 | |
392 | @Override |
393 | public void save() { |
394 | // TODO |
395 | pnlConnection.save(); |
396 | + profile.getRemoteWatcher().setInterval((Integer) jspRemoteInterval.getValue()); |
397 | } |
398 | |
399 | - |
400 | /** This method is called from within the constructor to |
401 | * initialize the form. |
402 | * WARNING: Do NOT modify this code. The content of this method is |
403 | * always regenerated by the Form Editor. |
404 | */ |
405 | @SuppressWarnings("unchecked") |
406 | - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
407 | - private void initComponents() { |
408 | - |
409 | - jLabel1 = new javax.swing.JLabel(); |
410 | - lblConnection = new javax.swing.JLabel(); |
411 | - scrConnection = new javax.swing.JScrollPane(); |
412 | - jLabel3 = new javax.swing.JLabel(); |
413 | - jLabel4 = new javax.swing.JLabel(); |
414 | - lblStorageType = new javax.swing.JLabel(); |
415 | - lblEncryption = new javax.swing.JLabel(); |
416 | - lblStorageDescription = new javax.swing.JLabel(); |
417 | - |
418 | - jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD)); |
419 | - jLabel1.setText(resourceBundle.getString("reposp_remote_storage")); |
420 | - jLabel1.setName("jLabel1"); // NOI18N |
421 | - |
422 | - lblConnection.setFont(lblConnection.getFont().deriveFont(lblConnection.getFont().getStyle() | java.awt.Font.BOLD)); |
423 | - lblConnection.setText(resourceBundle.getString("reposp_connection")); |
424 | - lblConnection.setName("lblConnection"); // NOI18N |
425 | - |
426 | - scrConnection.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
427 | - scrConnection.setViewportBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
428 | - scrConnection.setName("scrConnection"); // NOI18N |
429 | - |
430 | - jLabel3.setText(resourceBundle.getString("reposp_connection_type")); |
431 | - jLabel3.setName("jLabel3"); // NOI18N |
432 | - |
433 | - jLabel4.setText(resourceBundle.getString("reposp_encryption")); |
434 | - jLabel4.setName("jLabel4"); // NOI18N |
435 | - |
436 | - lblStorageType.setText(resourceBundle.getString("reposp_temp_type")); |
437 | - lblStorageType.setName("lblStorageType"); // NOI18N |
438 | - |
439 | - lblEncryption.setText(resourceBundle.getString("reposp_temp_encryption")); |
440 | - lblEncryption.setName("lblEncryption"); // NOI18N |
441 | - |
442 | - lblStorageDescription.setText(resourceBundle.getString("reposp_temp_description")); |
443 | - lblStorageDescription.setName("lblStorageDescription"); // NOI18N |
444 | - |
445 | - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
446 | - this.setLayout(layout); |
447 | - layout.setHorizontalGroup( |
448 | - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
449 | - .addGroup(layout.createSequentialGroup() |
450 | - .addContainerGap() |
451 | - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
452 | - .addGroup(layout.createSequentialGroup() |
453 | - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 2, javax.swing.GroupLayout.PREFERRED_SIZE) |
454 | - .addComponent(jLabel1)) |
455 | - .addGroup(layout.createSequentialGroup() |
456 | - .addComponent(jLabel3) |
457 | - .addGap(12, 12, 12) |
458 | - .addComponent(lblStorageType)) |
459 | - .addGroup(layout.createSequentialGroup() |
460 | - .addGap(120, 120, 120) |
461 | - .addComponent(lblStorageDescription)) |
462 | - .addGroup(layout.createSequentialGroup() |
463 | - .addComponent(jLabel4) |
464 | - .addGap(50, 50, 50) |
465 | - .addComponent(lblEncryption)) |
466 | - .addComponent(lblConnection) |
467 | - .addComponent(scrConnection, javax.swing.GroupLayout.PREFERRED_SIZE, 499, javax.swing.GroupLayout.PREFERRED_SIZE)) |
468 | - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
469 | - ); |
470 | - layout.setVerticalGroup( |
471 | - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
472 | - .addGroup(layout.createSequentialGroup() |
473 | - .addContainerGap() |
474 | - .addComponent(jLabel1) |
475 | - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
476 | - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
477 | - .addComponent(jLabel3) |
478 | - .addComponent(lblStorageType)) |
479 | - .addGap(5, 5, 5) |
480 | - .addComponent(lblStorageDescription) |
481 | - .addGap(15, 15, 15) |
482 | - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
483 | - .addComponent(jLabel4) |
484 | - .addComponent(lblEncryption)) |
485 | - .addGap(30, 30, 30) |
486 | - .addComponent(lblConnection) |
487 | - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE) |
488 | - .addComponent(scrConnection, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) |
489 | - .addContainerGap()) |
490 | - ); |
491 | - }// </editor-fold>//GEN-END:initComponents |
492 | - |
493 | - |
494 | - // Variables declaration - do not modify//GEN-BEGIN:variables |
495 | - private javax.swing.JLabel jLabel1; |
496 | - private javax.swing.JLabel jLabel3; |
497 | - private javax.swing.JLabel jLabel4; |
498 | - private javax.swing.JLabel lblConnection; |
499 | - private javax.swing.JLabel lblEncryption; |
500 | - private javax.swing.JLabel lblStorageDescription; |
501 | - private javax.swing.JLabel lblStorageType; |
502 | - private javax.swing.JScrollPane scrConnection; |
503 | - // End of variables declaration//GEN-END:variables |
504 | - |
505 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
506 | + private void initComponents() { |
507 | + |
508 | + jLabel1 = new javax.swing.JLabel(); |
509 | + lblConnection = new javax.swing.JLabel(); |
510 | + scrConnection = new javax.swing.JScrollPane(); |
511 | + jLabel3 = new javax.swing.JLabel(); |
512 | + jLabel4 = new javax.swing.JLabel(); |
513 | + lblStorageType = new javax.swing.JLabel(); |
514 | + lblEncryption = new javax.swing.JLabel(); |
515 | + lblStorageDescription = new javax.swing.JLabel(); |
516 | + jspRemoteInterval = new javax.swing.JSpinner(); |
517 | + jLabel2 = new javax.swing.JLabel(); |
518 | + jLabel5 = new javax.swing.JLabel(); |
519 | + |
520 | + jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD)); |
521 | + jLabel1.setText("Remote Storage"); |
522 | + jLabel1.setName("jLabel1"); // NOI18N |
523 | + |
524 | + lblConnection.setFont(lblConnection.getFont().deriveFont(lblConnection.getFont().getStyle() | java.awt.Font.BOLD)); |
525 | + lblConnection.setText(resourceBundle.getString("reposp_connection")); |
526 | + lblConnection.setName("lblConnection"); // NOI18N |
527 | + |
528 | + scrConnection.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
529 | + scrConnection.setViewportBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
530 | + scrConnection.setName("scrConnection"); // NOI18N |
531 | + |
532 | + jLabel3.setText(resourceBundle.getString("reposp_connection_type")); |
533 | + jLabel3.setName("jLabel3"); // NOI18N |
534 | + |
535 | + jLabel4.setText(resourceBundle.getString("reposp_encryption")); |
536 | + jLabel4.setName("jLabel4"); // NOI18N |
537 | + |
538 | + lblStorageType.setText(resourceBundle.getString("reposp_temp_type")); |
539 | + lblStorageType.setName("lblStorageType"); // NOI18N |
540 | + |
541 | + lblEncryption.setText(resourceBundle.getString("reposp_temp_encryption")); |
542 | + lblEncryption.setName("lblEncryption"); // NOI18N |
543 | + |
544 | + lblStorageDescription.setText(resourceBundle.getString("reposp_temp_description")); |
545 | + lblStorageDescription.setName("lblStorageDescription"); // NOI18N |
546 | + |
547 | + jspRemoteInterval.setName("jspRemoteInterval"); // NOI18N |
548 | + |
549 | + jLabel2.setText(resourceBundle.getString("reposp_watch_interval")); |
550 | + jLabel2.setName("lblWatchInterval"); // NOI18N |
551 | + |
552 | + jLabel5.setText(resourceBundle.getString("reposp_watch_ms")); |
553 | + jLabel5.setName("lblMiliSeconds"); // NOI18N |
554 | + |
555 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
556 | + this.setLayout(layout); |
557 | + layout.setHorizontalGroup( |
558 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
559 | + .addGroup(layout.createSequentialGroup() |
560 | + .addContainerGap() |
561 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
562 | + .addGroup(layout.createSequentialGroup() |
563 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 2, javax.swing.GroupLayout.PREFERRED_SIZE) |
564 | + .addComponent(jLabel1)) |
565 | + .addComponent(scrConnection, javax.swing.GroupLayout.PREFERRED_SIZE, 499, javax.swing.GroupLayout.PREFERRED_SIZE) |
566 | + .addComponent(lblConnection) |
567 | + .addGroup(layout.createSequentialGroup() |
568 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
569 | + .addComponent(jLabel4) |
570 | + .addComponent(jLabel2)) |
571 | + .addGap(50, 50, 50) |
572 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) |
573 | + .addComponent(jspRemoteInterval) |
574 | + .addComponent(lblEncryption, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
575 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
576 | + .addComponent(jLabel5)) |
577 | + .addGroup(layout.createSequentialGroup() |
578 | + .addComponent(jLabel3) |
579 | + .addGap(30, 30, 30) |
580 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
581 | + .addComponent(lblStorageType) |
582 | + .addComponent(lblStorageDescription)))) |
583 | + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
584 | + ); |
585 | + layout.setVerticalGroup( |
586 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
587 | + .addGroup(layout.createSequentialGroup() |
588 | + .addContainerGap() |
589 | + .addComponent(jLabel1) |
590 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
591 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
592 | + .addComponent(jLabel3) |
593 | + .addComponent(lblStorageType)) |
594 | + .addGap(2, 2, 2) |
595 | + .addComponent(lblStorageDescription) |
596 | + .addGap(18, 18, 18) |
597 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
598 | + .addComponent(jLabel4) |
599 | + .addComponent(lblEncryption)) |
600 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
601 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
602 | + .addComponent(jspRemoteInterval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
603 | + .addComponent(jLabel2) |
604 | + .addComponent(jLabel5)) |
605 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE) |
606 | + .addComponent(lblConnection) |
607 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
608 | + .addComponent(scrConnection, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) |
609 | + .addContainerGap()) |
610 | + ); |
611 | + }// </editor-fold>//GEN-END:initComponents |
612 | + // Variables declaration - do not modify//GEN-BEGIN:variables |
613 | + private javax.swing.JLabel jLabel1; |
614 | + private javax.swing.JLabel jLabel2; |
615 | + private javax.swing.JLabel jLabel3; |
616 | + private javax.swing.JLabel jLabel4; |
617 | + private javax.swing.JLabel jLabel5; |
618 | + private javax.swing.JSpinner jspRemoteInterval; |
619 | + private javax.swing.JLabel lblConnection; |
620 | + private javax.swing.JLabel lblEncryption; |
621 | + private javax.swing.JLabel lblStorageDescription; |
622 | + private javax.swing.JLabel lblStorageType; |
623 | + private javax.swing.JScrollPane scrConnection; |
624 | + // End of variables declaration//GEN-END:variables |
625 | } |
626 | |
627 | === modified file 'syncany/src/org/syncany/i18n/I18n_en_US.properties' |
628 | --- syncany/src/org/syncany/i18n/I18n_en_US.properties 2011-06-04 00:29:53 +0000 |
629 | +++ syncany/src/org/syncany/i18n/I18n_en_US.properties 2011-06-16 18:12:48 +0000 |
630 | @@ -116,6 +116,8 @@ |
631 | reposp_temp_type = (type) |
632 | reposp_temp_encryption = (encryption) |
633 | reposp_temp_description = (description) |
634 | +reposp_watch_interval = Watch Interval: |
635 | +reposp_watch_ms = ms |
636 | |
637 | ## SETTINGS DIALOG |
638 | sd_app_settings = Application Settings |
639 | |
640 | === modified file 'syncany/src/org/syncany/watch/remote/RemoteWatcher.java' |
641 | --- syncany/src/org/syncany/watch/remote/RemoteWatcher.java 2011-05-23 16:50:04 +0000 |
642 | +++ syncany/src/org/syncany/watch/remote/RemoteWatcher.java 2011-06-16 18:12:48 +0000 |
643 | @@ -19,11 +19,13 @@ |
644 | |
645 | import java.util.Map.Entry; |
646 | import org.syncany.config.Config; |
647 | +import org.syncany.config.ConfigNode; |
648 | import org.syncany.config.Profile; |
649 | import org.syncany.connection.plugins.TransferManager; |
650 | import org.syncany.db.CloneClient; |
651 | import org.syncany.db.CloneFile; |
652 | import org.syncany.db.DatabaseHelper; |
653 | +import org.syncany.exceptions.ConfigException; |
654 | import org.syncany.exceptions.RemoteFileNotFoundException; |
655 | import org.syncany.repository.files.RemoteFile; |
656 | import org.syncany.exceptions.StorageException; |
657 | @@ -63,42 +65,33 @@ |
658 | * |
659 | * @author Philipp C. Heckel <philipp.heckel@gmail.com> |
660 | */ |
661 | -public class RemoteWatcher { |
662 | +public class RemoteWatcher implements org.syncany.config.Configurable { |
663 | + |
664 | private static final Logger logger = Logger.getLogger(RemoteWatcher.class.getSimpleName()); |
665 | - |
666 | - private static final int INTERVAL = 10000; |
667 | + private static final int DEFAULT_INTERVAL = 10000; |
668 | private static final boolean DEBUG_GZIP_AND_ENCRYPT_UPDATE_FILES = false; |
669 | - |
670 | private Config config; |
671 | - private DatabaseHelper db; |
672 | - |
673 | - private Profile profile; |
674 | - |
675 | + private DatabaseHelper db; |
676 | + private int interval = DEFAULT_INTERVAL; |
677 | + private Profile profile; |
678 | private ChangeManager changeManager; |
679 | private Timer timer; |
680 | - |
681 | private Map<String, RemoteFile> remoteFileList; |
682 | private StructuredFileList fileList; |
683 | private UpdateList updateList; |
684 | private TransferManager transfer; |
685 | - |
686 | // TODO this should be in the DB cached somewhere. |
687 | private Long lastFileVersionCount; |
688 | - |
689 | // TODO this should be in the DB cached somewhere. |
690 | private Date lastRepoFileUpdate; |
691 | - |
692 | // TODO this should be in the DB cached somewhere. |
693 | private Date lastUpdateFileDate; |
694 | - |
695 | // TODO this should be in the DB cached somewhere. |
696 | private Date lastLocalProfileFileUpdate; |
697 | - |
698 | // TODO this should be in the DB cached somewhere. |
699 | private Date lastLocalImageFileUpdate; |
700 | |
701 | - |
702 | - public RemoteWatcher(Profile profile) { |
703 | + public RemoteWatcher(Profile profile) { |
704 | this.profile = profile; |
705 | |
706 | this.changeManager = new ChangeManager(profile); |
707 | @@ -108,27 +101,34 @@ |
708 | // cp. start() |
709 | this.config = null; |
710 | this.db = null; |
711 | - |
712 | + |
713 | // cp. doUpdateCheck() |
714 | this.remoteFileList = null; |
715 | this.updateList = null; |
716 | this.transfer = null; |
717 | } |
718 | |
719 | - public synchronized void start() { |
720 | + public synchronized void setInterval(int interval) { |
721 | + if (interval >= 1000) { |
722 | + this.interval = interval; |
723 | + } |
724 | + startUpdateCheck(); |
725 | + } |
726 | + |
727 | + public int getInterval() { |
728 | + return this.interval; |
729 | + } |
730 | + |
731 | + public synchronized void start() { |
732 | // Dependencies |
733 | if (config == null) { |
734 | config = Config.getInstance(); |
735 | db = DatabaseHelper.getInstance(); |
736 | } |
737 | - |
738 | + |
739 | // Reset connection |
740 | reset(); |
741 | - |
742 | - timer = new Timer("RemoteWatcher"); |
743 | - timer.scheduleAtFixedRate(new TimerTask() { |
744 | - @Override public void run() { doUpdateCheck(); } }, 0, INTERVAL); |
745 | - |
746 | + startUpdateCheck(); |
747 | changeManager.start(); |
748 | } |
749 | |
750 | @@ -143,8 +143,27 @@ |
751 | timer = null; |
752 | } |
753 | |
754 | + private void startUpdateCheck() { |
755 | + logger.log(Level.INFO, "Staring remote watcher..."); |
756 | + if (timer != null) { |
757 | + try { |
758 | + timer.cancel(); |
759 | + } catch (IllegalStateException ex) { |
760 | + logger.log(Level.SEVERE, ex.getMessage()); |
761 | + } |
762 | + } |
763 | + timer = new Timer("RemoteWatcher"); |
764 | + timer.scheduleAtFixedRate(new TimerTask() { |
765 | + @Override |
766 | + public void run() { |
767 | + logger.log(Level.INFO, "Do Update Check Interval = " + interval); |
768 | + doUpdateCheck(); |
769 | + } |
770 | + }, 0, interval); |
771 | + } |
772 | + |
773 | private void reset() { |
774 | - |
775 | + |
776 | transfer = profile.getRepository().getConnection().createTransferManager(); |
777 | updateList = new UpdateList(profile); |
778 | } |
779 | @@ -158,10 +177,10 @@ |
780 | |
781 | try { |
782 | updateFileList(); |
783 | - |
784 | + |
785 | updateRepository(); |
786 | commitRepository(); |
787 | - |
788 | + |
789 | // 1. download update files |
790 | downloadUpdates(); |
791 | |
792 | @@ -170,112 +189,108 @@ |
793 | |
794 | // 4. Create and upload local updates /////// |
795 | commitLocalUpdateFile(); |
796 | - |
797 | + |
798 | // Profiles |
799 | commitLocalProfile(); |
800 | updateRemoteProfiles(); |
801 | |
802 | // Images |
803 | - commitLocalImage(); |
804 | + commitLocalImage(); |
805 | updateRemoteImages(); |
806 | |
807 | // 5. Delete old updates (only mine!) /////// |
808 | deleteOldUpdateFiles(); |
809 | deleteOldProfileFiles(); |
810 | deleteOldImageFiles(); |
811 | - } |
812 | - catch (StorageException ex) { |
813 | + } catch (StorageException ex) { |
814 | logger.log(Level.WARNING, "Update check failed. Trying again in a couple of seconds.", ex); |
815 | - } |
816 | - finally { |
817 | + } finally { |
818 | if (logger.isLoggable(Level.INFO)) { |
819 | logger.info("DONE WITH PERIODIC UPDATE CHECK ..."); |
820 | } |
821 | |
822 | - try { transfer.disconnect(); } |
823 | - catch (StorageException ex) { /* Fressen! */ } |
824 | + try { |
825 | + transfer.disconnect(); |
826 | + } catch (StorageException ex) { /* Fressen! */ } |
827 | } |
828 | - |
829 | + |
830 | } |
831 | |
832 | private void updateFileList() throws StorageException { |
833 | remoteFileList = transfer.list(); |
834 | fileList = new StructuredFileList(profile.getRepository(), remoteFileList); |
835 | } |
836 | - |
837 | - |
838 | + |
839 | private void updateRepository() throws StorageException { |
840 | RepositoryFile repoFile = fileList.getNewestRepositoryFile(); |
841 | - |
842 | + |
843 | if (repoFile == null) { |
844 | throw new StorageException("Unable to find repository-* file."); |
845 | } |
846 | - |
847 | + |
848 | // Are we already up-to-date? |
849 | if (lastRepoFileUpdate != null && !repoFile.getLastUpdate().after(lastRepoFileUpdate)) { |
850 | return; |
851 | } |
852 | - |
853 | + |
854 | // Do download and read it! |
855 | - try { |
856 | + try { |
857 | profile.getRepository().update(transfer, fileList); |
858 | lastRepoFileUpdate = repoFile.getLastUpdate(); |
859 | - } |
860 | - catch (Exception e) { |
861 | + } catch (Exception e) { |
862 | throw new StorageException(e); |
863 | } |
864 | - } |
865 | - |
866 | + } |
867 | + |
868 | private void commitRepository() throws StorageException { |
869 | RepositoryFile repoFile = fileList.getNewestRepositoryFile(); |
870 | - |
871 | + |
872 | if (repoFile == null) { |
873 | throw new StorageException("Unable to find repository-* file."); |
874 | } |
875 | - |
876 | + |
877 | // Are we already up-to-date? |
878 | if (!profile.getRepository().isChanged()) { |
879 | if (logger.isLoggable(Level.INFO)) { |
880 | logger.info("repository has not changed locally. No need to upload."); |
881 | } |
882 | - |
883 | + |
884 | return; |
885 | } |
886 | - |
887 | + |
888 | // Upload |
889 | if (logger.isLoggable(Level.INFO)) { |
890 | logger.info("Uploading changed repository file ..."); |
891 | } |
892 | - |
893 | - try { |
894 | + |
895 | + try { |
896 | profile.getRepository().commit(transfer, fileList, false); |
897 | - } |
898 | - catch (Exception e) { |
899 | + } catch (Exception e) { |
900 | throw new StorageException(e); |
901 | } |
902 | - } |
903 | + } |
904 | |
905 | private void downloadUpdates() throws StorageException { |
906 | if (logger.isLoggable(Level.INFO)) { |
907 | logger.info("2. Downloading update lists ..."); |
908 | } |
909 | - |
910 | + |
911 | // Find newest client update files |
912 | Collection<UpdateFile> newestUpdateFiles = fileList.getRemoteUpdateFiles().values(); |
913 | - |
914 | + |
915 | for (UpdateFile updateFile : newestUpdateFiles) { |
916 | // Get client from DB (or create it!) |
917 | - CloneClient client = db.getClient(profile, updateFile.getMachineName(), true); |
918 | - |
919 | + CloneClient client = db.getClient(profile, updateFile.getMachineName(), true); |
920 | + |
921 | // Ignore if we are up-to-date |
922 | if (client.getLastUpdate() != null && !updateFile.getLastUpdate().after(client.getLastUpdate())) { |
923 | if (logger.isLoggable(Level.INFO)) { |
924 | logger.log(Level.INFO, " - Client ''{0}'' is up-to-date", updateFile.getMachineName()); |
925 | } |
926 | - |
927 | + |
928 | continue; |
929 | } |
930 | - |
931 | + |
932 | try { |
933 | // Download update file |
934 | if (logger.isLoggable(Level.INFO)) { |
935 | @@ -295,12 +310,11 @@ |
936 | |
937 | // Add to update manager |
938 | updateList.addRemoteUpdateFile(client, updateFile); |
939 | - } |
940 | - catch (Exception ex) { |
941 | + } catch (Exception ex) { |
942 | if (logger.isLoggable(Level.WARNING)) { |
943 | logger.log(Level.WARNING, "Reading update file of client {0} failed. Skipping update check.", client.getMachineName()); |
944 | } |
945 | - |
946 | + |
947 | throw new StorageException(ex); |
948 | } |
949 | } |
950 | @@ -317,15 +331,15 @@ |
951 | |
952 | // TODO should the changes be synchronous? |
953 | // TODO because setting the clients' lastUpdate value assumes that the change mgr doesnt crash |
954 | - |
955 | + |
956 | // Update last-updated date of clients |
957 | if (logger.isLoggable(Level.INFO)) { |
958 | logger.info("3b. Updating client DB entries ..."); |
959 | } |
960 | |
961 | for (Map.Entry<CloneClient, UpdateFile> e : updateList.getRemoteUpdateFiles().entrySet()) { |
962 | - CloneClient client = e.getKey(); |
963 | - UpdateFile updateFile = e.getValue(); |
964 | + CloneClient client = e.getKey(); |
965 | + UpdateFile updateFile = e.getValue(); |
966 | |
967 | client.setLastUpdate(updateFile.getLastUpdate()); |
968 | client.merge(); |
969 | @@ -350,25 +364,24 @@ |
970 | lastUpdateFileDate = new Date(); |
971 | lastFileVersionCount = fileVersionCount; |
972 | |
973 | - File localUpdateFile = null; |
974 | + File localUpdateFile = null; |
975 | UpdateFile remoteUpdateFile = new UpdateFile(profile.getRepository(), config.getMachineName(), lastUpdateFileDate); |
976 | |
977 | try { |
978 | // Make temp. update file |
979 | - localUpdateFile = config.getCache().createTempFile("update-"+config.getMachineName()); |
980 | - logger.info("4. Writing local changes to '"+localUpdateFile+"' ..."); |
981 | + localUpdateFile = config.getCache().createTempFile("update-" + config.getMachineName()); |
982 | + logger.info("4. Writing local changes to '" + localUpdateFile + "' ..."); |
983 | |
984 | List<CloneFile> updatedFiles = db.getHistory(profile); |
985 | remoteUpdateFile.setVersions(updatedFiles); |
986 | remoteUpdateFile.write(localUpdateFile, DEBUG_GZIP_AND_ENCRYPT_UPDATE_FILES); |
987 | |
988 | // Upload |
989 | - logger.info(" - Uploading file to temp. file '"+remoteUpdateFile.getName()+"' ..."); |
990 | + logger.info(" - Uploading file to temp. file '" + remoteUpdateFile.getName() + "' ..."); |
991 | transfer.upload(localUpdateFile, remoteUpdateFile); |
992 | |
993 | localUpdateFile.delete(); |
994 | - } |
995 | - catch (IOException ex) { |
996 | + } catch (IOException ex) { |
997 | if (localUpdateFile != null) { |
998 | localUpdateFile.delete(); |
999 | } |
1000 | @@ -376,18 +389,18 @@ |
1001 | logger.log(Level.SEVERE, null, ex); |
1002 | } |
1003 | } |
1004 | - |
1005 | + |
1006 | // Upload new local profile (if changed) |
1007 | - private void commitLocalProfile() throws StorageException { |
1008 | + private void commitLocalProfile() throws StorageException { |
1009 | ProfileFile localNewestProfileFile = fileList.getNewestProfileFile(); |
1010 | - |
1011 | + |
1012 | // Skip if no update needed |
1013 | - if (!(localNewestProfileFile == null || lastLocalProfileFileUpdate == null || |
1014 | - localNewestProfileFile.getLastUpdate().after(lastLocalProfileFileUpdate))) { |
1015 | - |
1016 | + if (!(localNewestProfileFile == null || lastLocalProfileFileUpdate == null |
1017 | + || localNewestProfileFile.getLastUpdate().after(lastLocalProfileFileUpdate))) { |
1018 | + |
1019 | return; |
1020 | } |
1021 | - |
1022 | + |
1023 | Date newDate = new Date(); |
1024 | ProfileFile localProfileFile = new ProfileFile(profile.getRepository(), config.getMachineName(), newDate); |
1025 | |
1026 | @@ -408,13 +421,12 @@ |
1027 | |
1028 | // Update |
1029 | lastLocalProfileFileUpdate = newDate; |
1030 | - } |
1031 | - catch (IOException e) { |
1032 | + } catch (IOException e) { |
1033 | logger.log(Level.SEVERE, "ERROR while uploading local profile.", e); |
1034 | // TODO do something |
1035 | } |
1036 | } |
1037 | - |
1038 | + |
1039 | private void updateRemoteProfiles() throws RemoteFileNotFoundException, StorageException { |
1040 | /// Download new user profiles |
1041 | Collection<ProfileFile> remoteProfileFiles = fileList.getRemoteProfileFiles().values(); |
1042 | @@ -426,7 +438,7 @@ |
1043 | if (client.getLastProfileUpdate() != null && !f.getLastUpdate().after(client.getLastProfileUpdate())) { |
1044 | continue; |
1045 | } |
1046 | - |
1047 | + |
1048 | if (logger.isLoggable(Level.INFO)) { |
1049 | logger.log(Level.INFO, "Downloading profile of client ''{0}'' ...", client.getMachineName()); |
1050 | } |
1051 | @@ -440,68 +452,67 @@ |
1052 | client.setLastProfileUpdate(new Date()); |
1053 | client.setUserName(f.getUserName()); |
1054 | client.merge(); |
1055 | - } |
1056 | - catch (IOException e) { |
1057 | + } catch (IOException e) { |
1058 | logger.log(Level.SEVERE, "ERROR while downloading remote profile of " + client.getMachineName() + ".", e); |
1059 | // TODO do something |
1060 | - } |
1061 | + } |
1062 | } |
1063 | } |
1064 | - |
1065 | + |
1066 | private void commitLocalImage() throws RemoteFileNotFoundException, StorageException { |
1067 | // Upload local image (if updated) |
1068 | ImageFile localNewestImageFile = fileList.getNewestImageFile(); |
1069 | - |
1070 | + |
1071 | // Skip if no update needed |
1072 | - if (!(localNewestImageFile == null || lastLocalImageFileUpdate == null || |
1073 | - localNewestImageFile.getLastUpdate().after(lastLocalImageFileUpdate))) { |
1074 | - |
1075 | + if (!(localNewestImageFile == null || lastLocalImageFileUpdate == null |
1076 | + || localNewestImageFile.getLastUpdate().after(lastLocalImageFileUpdate))) { |
1077 | + |
1078 | return; |
1079 | } |
1080 | - |
1081 | + |
1082 | return; |
1083 | /* |
1084 | Date newDate = new Date(); |
1085 | ImageFile localImageFile = new ImageFile(profile.getRepository(), config.getMachineName(), newDate); |
1086 | |
1087 | if (lastLocalImageFileUpdate == null || localNewestImageFile == null || localNewestImageFile.getLastUpdate().after(lastLocalImageFileUpdate)) { |
1088 | - // If 'No Image' is selected, OR (!) if the local image file is not there |
1089 | - if (config.getUserImageType() == Config.UserImageType.None |
1090 | - || config.getUserImageFile() == null || !config.getUserImageFile().exists()) { |
1091 | - |
1092 | - if (localNewestImageFile != null) { |
1093 | - transfer.delete(localNewestImageFile); |
1094 | - } |
1095 | - |
1096 | - lastLocalImageFileUpdate = new Date(); |
1097 | - } else { |
1098 | - try { |
1099 | - File originalImageFile = null; |
1100 | - |
1101 | - if (config.getUserImageType() == Config.UserImageType.System) { |
1102 | - originalImageFile = config.getCache().createTempFile("image-" + config.getMachineName()); |
1103 | - Image image = ImageUtil.getScaledImage(config.getUserImage(), Constants.PROFILE_IMAGE_MAX_WIDTH, Constants.PROFILE_IMAGE_MAX_HEIGHT); |
1104 | - ImageIO.write(ImageUtil.toBufferedImage(image), "png", originalImageFile); |
1105 | - } |
1106 | - else if (config.getUserImageType() == Config.UserImageType.Other) { |
1107 | - originalImageFile = config.getUserImageFile(); |
1108 | - } |
1109 | - |
1110 | - // TODO encrypt |
1111 | - |
1112 | - Date newDate = new Date(); |
1113 | - transfer.upload(originalImageFile, new ImageFile(profile.getRepository(), config.getMachineName(), newDate)); |
1114 | - |
1115 | - // Update cached value |
1116 | - lastLocalImageFileUpdate = newDate; |
1117 | - } catch (IOException e) { |
1118 | - // TODO do something |
1119 | - logger.log(Level.WARNING, "Error while uploading local image.", e); |
1120 | - } |
1121 | - } |
1122 | + // If 'No Image' is selected, OR (!) if the local image file is not there |
1123 | + if (config.getUserImageType() == Config.UserImageType.None |
1124 | + || config.getUserImageFile() == null || !config.getUserImageFile().exists()) { |
1125 | + |
1126 | + if (localNewestImageFile != null) { |
1127 | + transfer.delete(localNewestImageFile); |
1128 | + } |
1129 | + |
1130 | + lastLocalImageFileUpdate = new Date(); |
1131 | + } else { |
1132 | + try { |
1133 | + File originalImageFile = null; |
1134 | + |
1135 | + if (config.getUserImageType() == Config.UserImageType.System) { |
1136 | + originalImageFile = config.getCache().createTempFile("image-" + config.getMachineName()); |
1137 | + Image image = ImageUtil.getScaledImage(config.getUserImage(), Constants.PROFILE_IMAGE_MAX_WIDTH, Constants.PROFILE_IMAGE_MAX_HEIGHT); |
1138 | + ImageIO.write(ImageUtil.toBufferedImage(image), "png", originalImageFile); |
1139 | + } |
1140 | + else if (config.getUserImageType() == Config.UserImageType.Other) { |
1141 | + originalImageFile = config.getUserImageFile(); |
1142 | + } |
1143 | + |
1144 | + // TODO encrypt |
1145 | + |
1146 | + Date newDate = new Date(); |
1147 | + transfer.upload(originalImageFile, new ImageFile(profile.getRepository(), config.getMachineName(), newDate)); |
1148 | + |
1149 | + // Update cached value |
1150 | + lastLocalImageFileUpdate = newDate; |
1151 | + } catch (IOException e) { |
1152 | + // TODO do something |
1153 | + logger.log(Level.WARNING, "Error while uploading local image.", e); |
1154 | + } |
1155 | + } |
1156 | }*/ |
1157 | } |
1158 | - |
1159 | + |
1160 | private void updateRemoteImages() { |
1161 | // Download new user images (if changed) |
1162 | Map<String, ImageFile> remoteImageFiles = fileList.getRemoteImageFiles(); |
1163 | @@ -513,11 +524,11 @@ |
1164 | if (client.getLastImageUpdate() != null && !f.getLastUpdate().after(client.getLastImageUpdate())) { |
1165 | continue; |
1166 | } |
1167 | - |
1168 | + |
1169 | if (logger.isLoggable(Level.INFO)) { |
1170 | logger.log(Level.INFO, "Downloading image of client ''{0}'' ...", client.getMachineName()); |
1171 | } |
1172 | - |
1173 | + |
1174 | // Download |
1175 | try { |
1176 | File tempRemoteImage = config.getCache().createTempFile(f.getName()); |
1177 | @@ -530,8 +541,7 @@ |
1178 | // Apply and persist |
1179 | client.setLastImageUpdate(new Date()); |
1180 | client.merge(); |
1181 | - } |
1182 | - catch (Exception e) { |
1183 | + } catch (Exception e) { |
1184 | if (logger.isLoggable(Level.SEVERE)) { |
1185 | logger.log(Level.SEVERE, "ERROR while downloading remote image of " + client.getMachineName() + ".", e); |
1186 | } |
1187 | @@ -541,47 +551,60 @@ |
1188 | |
1189 | private void deleteOldUpdateFiles() { |
1190 | TreeMap<Long, UpdateFile> localUpdatesMap = fileList.getLocalUpdateFiles(); |
1191 | - |
1192 | + |
1193 | while (localUpdatesMap.size() > 1) { |
1194 | - Entry<Long, UpdateFile> firstEntry = localUpdatesMap.pollFirstEntry(); |
1195 | + Entry<Long, UpdateFile> firstEntry = localUpdatesMap.pollFirstEntry(); |
1196 | |
1197 | try { |
1198 | - transfer.delete(firstEntry.getValue()); |
1199 | - } |
1200 | - catch (Exception e) { |
1201 | + transfer.delete(firstEntry.getValue()); |
1202 | + } catch (Exception e) { |
1203 | logger.log(Level.WARNING, "Could not delete old update file", e); |
1204 | } |
1205 | } |
1206 | } |
1207 | - |
1208 | + |
1209 | private void deleteOldProfileFiles() { |
1210 | TreeMap<Long, ProfileFile> localUpdatesMap = fileList.getLocalProfileFiles(); |
1211 | - |
1212 | + |
1213 | while (localUpdatesMap.size() > 1) { |
1214 | - Entry<Long, ProfileFile> firstEntry = localUpdatesMap.pollFirstEntry(); |
1215 | + Entry<Long, ProfileFile> firstEntry = localUpdatesMap.pollFirstEntry(); |
1216 | |
1217 | try { |
1218 | - transfer.delete(firstEntry.getValue()); |
1219 | - } |
1220 | - catch (Exception e) { |
1221 | + transfer.delete(firstEntry.getValue()); |
1222 | + } catch (Exception e) { |
1223 | logger.log(Level.WARNING, "Could not delete old profile file", e); |
1224 | } |
1225 | } |
1226 | } |
1227 | - |
1228 | + |
1229 | private void deleteOldImageFiles() { |
1230 | TreeMap<Long, ImageFile> localUpdatesMap = fileList.getLocalImageFiles(); |
1231 | - |
1232 | + |
1233 | while (localUpdatesMap.size() > 1) { |
1234 | - Entry<Long, ImageFile> firstEntry = localUpdatesMap.pollFirstEntry(); |
1235 | + Entry<Long, ImageFile> firstEntry = localUpdatesMap.pollFirstEntry(); |
1236 | |
1237 | try { |
1238 | - transfer.delete(firstEntry.getValue()); |
1239 | - } |
1240 | - catch (Exception e) { |
1241 | + transfer.delete(firstEntry.getValue()); |
1242 | + } catch (Exception e) { |
1243 | logger.log(Level.WARNING, "Could not delete old image file", e); |
1244 | } |
1245 | } |
1246 | } |
1247 | |
1248 | + @Override |
1249 | + public void load(ConfigNode node) throws ConfigException { |
1250 | + if (node != null) { |
1251 | + ConfigNode remote = node.findChildByName("remote"); |
1252 | + Integer inter = remote.getInteger("interval"); |
1253 | + if (inter != null) { |
1254 | + interval = inter; |
1255 | + } |
1256 | + } |
1257 | + } |
1258 | + |
1259 | + @Override |
1260 | + public void save(ConfigNode node) { |
1261 | + ConfigNode remote = node.findOrCreateChildByXpath("remote", "remote"); |
1262 | + remote.setProperty("interval", interval); |
1263 | + } |
1264 | } |
I'll review this tonight and then merge it :-D
On Thu, Jun 16, 2011 at 4:58 PM, isakkarlsson <email address hidden> wrote: /code.launchpad .net/~isak- karlsson/ syncany/ syncany- remote- watch-interval/ +merge/ 64850 /code.launchpad .net/~isak- karlsson/ syncany/ syncany- remote- watch-interval/ +merge/ 64850 bin/native. py' bin/native. py 2011-06-11 12:47:02 +0000 bin/native. py 2011-06-16 14:58:24 +0000 src/org/ syncany/ config/ Profile. java' src/org/ syncany/ config/ Profile. java 2011-05-23 16:50:04 +0000 src/org/ syncany/ config/ Profile. java 2011-06-16 14:58:24 +0000 load(node. findChildByName ("repository" )); load(node. findChildByName ("watcher" )); save(node. findOrCreateChi ldByXpath( "folders" , "folders")); save(node. findOrCreateChi ldByXpath( "watcher" , "watcher")); src/org/ syncany/ gui/settings/ ProfilePanel. form' src/org/ syncany/ gui/settings/ ProfilePanel. form 2011-05-23 16:50:04 +0000 src/org/ syncany/ gui/settings/ ProfilePanel. form 2011-06-16 14:58:24 +0000 src/org/ syncany/ gui/settings/ ProfilePanel. java' src/org/ syncany/ gui/settings/ ProfilePanel. java 2011-06-05 21:26:56 +0000 src/org/ syncany/ gui/settings/ ProfilePanel. java 2011-06-16 14:58:24 +0000 gs("unchecked" )
> isakkarlsson has proposed merging lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>
> Requested reviews:
> Syncany Team (syncany-team)
>
> For more details, see:
> https:/
>
> Added the ability to change the remote checking inverval.
> --
> https:/
> Your team Syncany Team is requested to review the proposed merge of lp:~isak-karlsson/syncany/syncany-remote-watch-interval into lp:syncany.
>
> === modified file 'syncany/
> --- syncany/
> +++ syncany/
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python
> +#!/usr/bin/python2
> #
> # Syncany Linux Native Functions
> # Copyright (C) 2011 Philipp C. Heckel <email address hidden>
>
> === modified file 'syncany/
> --- syncany/
> +++ syncany/
> @@ -149,6 +149,8 @@
> // Repo
> repository = new Repository();
> repository.
> +
> + remoteWatcher.
>
> // Folders
> folders = new Folders(this);
> @@ -175,5 +177,8 @@
>
> // Folders
> folders.
> +
> + // Watcher
> + remoteWatcher.
> }
> }
>
> === modified file 'syncany/
> --- syncany/
> +++ syncany/
> @@ -28,8 +28,8 @@
> <Component id="cbActive" alignment="0" min="-2" max="-2" attributes="0"/>
> <Group type="102" alignment="0" attributes="0">
> <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
> - <EmptySpace max="-2" attributes="0"/>
> - <Component id="txtProfileName" pref="344" max="32767" attributes="0"/>
> + <EmptySpace min="-2" pref="62" max="-2" attributes="0"/>
> + <Component id="txtProfileName" pref="294" max="32767" attributes="0"/>
> </Group>
> </Group>
> <EmptySpace max="-2" attributes="0"/>
>
> === modified file 'syncany/
> --- syncany/
> +++ syncany/
> @@ -69,65 +69,65 @@
> * always regenerated by the Form Editor.
> */
> @SuppressWarnin
> - // <editor-fold def...