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