Revision f3d080df
b/trunk/Pithos.Client.Test/Properties/AssemblyInfo.cs | ||
---|---|---|
8 | 8 |
[assembly: AssemblyTitle("Pithos.Client.Test")] |
9 | 9 |
[assembly: AssemblyDescription("")] |
10 | 10 |
[assembly: AssemblyConfiguration("")] |
11 |
[assembly: AssemblyCompany("Microsoft")]
|
|
11 |
[assembly: AssemblyCompany("GRNet")]
|
|
12 | 12 |
[assembly: AssemblyProduct("Pithos.Client.Test")] |
13 |
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
|
|
13 |
[assembly: AssemblyCopyright("Copyright © GRNet 2011")]
|
|
14 | 14 |
[assembly: AssemblyTrademark("")] |
15 | 15 |
[assembly: AssemblyCulture("")] |
16 | 16 |
|
b/trunk/Pithos.Client.WPF/Caliburn/Micro/Logging/DebugLogger.cs | ||
---|---|---|
1 |
using System; |
|
1 |
// ----------------------------------------------------------------------- |
|
2 |
// <copyright file="DebugLogger.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
35 |
// </copyright> |
|
36 |
// ----------------------------------------------------------------------- |
|
37 |
|
|
38 |
using System; |
|
2 | 39 |
using System.Diagnostics; |
3 | 40 |
|
4 | 41 |
namespace Caliburn.Micro.Logging |
b/trunk/Pithos.Client.WPF/Caliburn/Micro/Logging/log4netLogger.cs | ||
---|---|---|
1 |
using System; |
|
1 |
// ----------------------------------------------------------------------- |
|
2 |
// <copyright file="log4netLogger.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
35 |
// </copyright> |
|
36 |
// ----------------------------------------------------------------------- |
|
37 |
|
|
38 |
using System; |
|
2 | 39 |
using System.Collections.Generic; |
3 | 40 |
using System.Linq; |
4 | 41 |
using System.Text; |
b/trunk/Pithos.Client.WPF/Configuration/PithosSettings.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="PithosSettings.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="PithosSettings.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
4 | 35 |
// </copyright> |
5 | 36 |
// ----------------------------------------------------------------------- |
6 | 37 |
|
b/trunk/Pithos.Client.WPF/FileProperties/FilePropertiesViewModel.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="FilePropertiesViewModel.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="FilePropertiesViewModel.cs" company="GRNet"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
4 | 35 |
// </copyright> |
5 | 36 |
// ----------------------------------------------------------------------- |
6 | 37 |
|
b/trunk/Pithos.Client.WPF/PithosAccount.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="PithosAccount.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="PithosAccount.cs" company="GRNet"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
35 |
|
|
4 | 36 |
// </copyright> |
5 | 37 |
// ----------------------------------------------------------------------- |
6 | 38 |
|
b/trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="PreferencesViewModel.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="PreferencesViewModel.cs" company="GRNet"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
35 |
|
|
4 | 36 |
// </copyright> |
5 | 37 |
// ----------------------------------------------------------------------- |
6 | 38 |
|
b/trunk/Pithos.Client.WPF/Services/StatusService.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="StatusService.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="StatusService.cs" company="GRNet"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
4 | 35 |
// </copyright> |
5 | 36 |
// ----------------------------------------------------------------------- |
6 | 37 |
|
7 | 38 |
|
8 | 39 |
using System; |
40 |
using System.Diagnostics; |
|
41 |
using System.Linq; |
|
42 |
using System.ServiceModel.Description; |
|
9 | 43 |
using Caliburn.Micro; |
10 | 44 |
using System.ServiceModel; |
11 | 45 |
using System.ComponentModel.Composition; |
... | ... | |
48 | 82 |
//Monitor. |
49 | 83 |
} |
50 | 84 |
|
85 |
public void GotoSite(string filePath) |
|
86 |
{ |
|
87 |
if (string.IsNullOrWhiteSpace(filePath)) |
|
88 |
return; |
|
89 |
var activeAccount = Settings.Accounts.FirstOrDefault(acc => filePath.StartsWith(acc.RootPath, StringComparison.InvariantCultureIgnoreCase)); |
|
90 |
var address = String.Format("{0}/ui/?token={1}&user={2}", |
|
91 |
activeAccount.ServerUrl, |
|
92 |
activeAccount.ApiKey, |
|
93 |
Uri.EscapeUriString(activeAccount.AccountName)); |
|
94 |
|
|
95 |
Process.Start(address); |
|
96 |
|
|
97 |
} |
|
98 |
|
|
51 | 99 |
public PithosSettingsData GetSettings() |
52 | 100 |
{ |
53 | 101 |
var data = new PithosSettingsData(Settings); |
... | ... | |
74 | 122 |
|
75 | 123 |
//// Add a mex endpoint |
76 | 124 |
/* |
125 |
|
|
77 | 126 |
var smb = new ServiceMetadataBehavior |
78 | 127 |
{ |
79 | 128 |
HttpGetEnabled = true, |
... | ... | |
82 | 131 |
service.Description.Behaviors.Add(smb); |
83 | 132 |
*/ |
84 | 133 |
|
134 |
|
|
85 | 135 |
service.Faulted+=OnError; |
86 | 136 |
service.Open(); |
87 | 137 |
return service; |
b/trunk/Pithos.Client.WPF/Shell/AboutViewModel.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="AboutViewModel.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="AboutViewModel.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
4 | 35 |
// </copyright> |
5 | 36 |
// ----------------------------------------------------------------------- |
6 | 37 |
|
b/trunk/Pithos.Client.WPF/Shell/FeedbackViewModel.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="FeedbackViewModel.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="FeedbackViewModel.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
4 | 35 |
// </copyright> |
5 | 36 |
// ----------------------------------------------------------------------- |
6 | 37 |
|
38 |
|
|
7 | 39 |
using System.Collections.Specialized; |
8 | 40 |
using System.ComponentModel.Composition; |
9 | 41 |
using System.Diagnostics; |
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs | ||
---|---|---|
730 | 730 |
//TODO: Display file properties for non-container folders |
731 | 731 |
if (File.Exists(fileName)) |
732 | 732 |
//Retrieve the full name with exact casing. Pithos names are case sensitive |
733 |
ShowFileProperties(GetProperFilePathCapitalization(fileName)); |
|
733 |
ShowFileProperties(FileInfoExtensions.GetProperFilePathCapitalization(fileName));
|
|
734 | 734 |
else if (Directory.Exists(fileName)) |
735 | 735 |
//Retrieve the full name with exact casing. Pithos names are case sensitive |
736 | 736 |
{ |
737 |
var path = GetProperDirectoryCapitalization(fileName);
|
|
737 |
var path = FileInfoExtensions.GetProperDirectoryCapitalization(fileName);
|
|
738 | 738 |
if (IsContainer(path)) |
739 | 739 |
ShowContainerProperties(path); |
740 | 740 |
else |
... | ... | |
751 | 751 |
return matchingFolders.Any(); |
752 | 752 |
} |
753 | 753 |
|
754 |
static string GetProperDirectoryCapitalization(string fileName) |
|
755 |
{ |
|
756 |
var dirInfo = new DirectoryInfo(fileName); |
|
757 |
var parentDirInfo = dirInfo.Parent; |
|
758 |
if (null == parentDirInfo) |
|
759 |
return dirInfo.Name; |
|
760 |
return Path.Combine(GetProperDirectoryCapitalization(parentDirInfo.FullName), |
|
761 |
parentDirInfo.GetDirectories(dirInfo.Name)[0].Name); |
|
762 |
} |
|
763 |
|
|
764 |
static string GetProperFilePathCapitalization(string fileName) |
|
765 |
{ |
|
766 |
if (String.IsNullOrWhiteSpace(fileName)) |
|
767 |
throw new ArgumentNullException("fileName"); |
|
768 |
if (!Path.IsPathRooted(fileName)) |
|
769 |
throw new ArgumentException("fileName must be an absolute path","fileName"); |
|
770 |
Contract.EndContractBlock(); |
|
771 |
|
|
772 |
|
|
773 |
var fileInfo = new FileInfo(fileName); |
|
774 |
var dirInfo = fileInfo.Directory; |
|
775 |
|
|
776 |
//Directory will not be null for an absolute path |
|
777 |
Contract.Assume(dirInfo!=null); |
|
778 |
|
|
779 |
return Path.Combine(GetProperDirectoryCapitalization(dirInfo.FullName), |
|
780 |
dirInfo.GetFiles(fileInfo.Name)[0].Name); |
|
781 |
} |
|
782 | 754 |
} |
783 | 755 |
} |
b/trunk/Pithos.Core.Test/Pithos.Core.Test.csproj | ||
---|---|---|
47 | 47 |
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel> |
48 | 48 |
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly> |
49 | 49 |
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel> |
50 |
<PlatformTarget>x86</PlatformTarget> |
|
50 | 51 |
</PropertyGroup> |
51 | 52 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
52 | 53 |
<DebugType>pdbonly</DebugType> |
... | ... | |
202 | 203 |
</ItemGroup> |
203 | 204 |
<ItemGroup> |
204 | 205 |
<Compile Include="EnumerableExtensionsTest.cs" /> |
206 |
<Compile Include="ExtensionTests.cs" /> |
|
205 | 207 |
<Compile Include="NetworkAgentTest.cs" /> |
206 | 208 |
<Compile Include="PithosWorkflowTest.cs" /> |
207 | 209 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
b/trunk/Pithos.Core.Test/Properties/AssemblyInfo.cs | ||
---|---|---|
8 | 8 |
[assembly: AssemblyTitle("Pithos.Core.Test")] |
9 | 9 |
[assembly: AssemblyDescription("")] |
10 | 10 |
[assembly: AssemblyConfiguration("")] |
11 |
[assembly: AssemblyCompany("Microsoft")]
|
|
11 |
[assembly: AssemblyCompany("GRNet")]
|
|
12 | 12 |
[assembly: AssemblyProduct("Pithos.Core.Test")] |
13 |
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
|
|
13 |
[assembly: AssemblyCopyright("Copyright © GRNet 2011")]
|
|
14 | 14 |
[assembly: AssemblyTrademark("")] |
15 | 15 |
[assembly: AssemblyCulture("")] |
16 | 16 |
|
b/trunk/Pithos.Core/Agents/Agent.cs | ||
---|---|---|
6 | 6 |
using System.Text; |
7 | 7 |
using System.Threading; |
8 | 8 |
using System.Threading.Tasks; |
9 |
using Pithos.Core.Agents; |
|
9 | 10 |
|
10 | 11 |
namespace Pithos.Core |
11 | 12 |
{ |
12 | 13 |
public class Agent<TMessage> : IDisposable |
13 |
{ |
|
14 |
private readonly BlockingCollection<TMessage> _messages = new BlockingCollection<TMessage>(); |
|
14 |
{ |
|
15 |
private readonly ConcurrentQueue<TMessage> _queue; |
|
16 |
private readonly BlockingCollection<TMessage> _messages; |
|
15 | 17 |
private readonly CancellationTokenSource _cancelSource = new CancellationTokenSource(); |
16 | 18 |
public CancellationToken CancellationToken; |
17 | 19 |
|
... | ... | |
20 | 22 |
|
21 | 23 |
public Agent(Action<Agent<TMessage>> action) |
22 | 24 |
{ |
25 |
_queue=new ConcurrentQueue<TMessage>(); |
|
26 |
_messages = new BlockingCollection<TMessage>(_queue); |
|
23 | 27 |
_process = action; |
24 | 28 |
CancellationToken = _cancelSource.Token; |
25 | 29 |
} |
... | ... | |
132 | 136 |
return _messages; |
133 | 137 |
} |
134 | 138 |
|
139 |
/// <summary> |
|
140 |
/// Remove the first message that matches the predicate |
|
141 |
/// </summary> |
|
142 |
/// <param name="predicate">The condition to match</param> |
|
143 |
/// <remarks>Removes the first message that matches the predicate by dequeing all |
|
144 |
/// messages and re-enqueing all except the first matching message</remarks> |
|
145 |
public void Remove(Func<TMessage,bool> predicate) |
|
146 |
{ |
|
147 |
//Can this work? Dequeue all items |
|
148 |
//and then enqueue everything except the filtered items |
|
149 |
|
|
150 |
_queue.RemoveFirst(predicate); |
|
151 |
} |
|
135 | 152 |
|
136 | 153 |
public Task LoopAsync(Task process, Action loop,Action<Exception> onError=null) |
137 | 154 |
{ |
b/trunk/Pithos.Core/Agents/CloudTransferAction.cs | ||
---|---|---|
55 | 55 |
public CloudAction(AccountInfo accountInfo, CloudActionType action, FileSystemInfo localFile, ObjectInfo cloudFile, FileState state, int blockSize, string algorithm) |
56 | 56 |
: this(accountInfo,action) |
57 | 57 |
{ |
58 |
LocalFile = localFile; |
|
58 |
LocalFile = localFile.WithProperCapitalization();
|
|
59 | 59 |
CloudFile = cloudFile; |
60 | 60 |
FileState = state; |
61 | 61 |
if (LocalFile != null) |
b/trunk/Pithos.Core/Agents/FileAgent.cs | ||
---|---|---|
348 | 348 |
return false; |
349 | 349 |
} |
350 | 350 |
|
351 |
public FileSystemInfo GetFileInfo(string relativePath) |
|
351 |
public FileSystemInfo GetFileSystemInfo(string relativePath)
|
|
352 | 352 |
{ |
353 | 353 |
if (String.IsNullOrWhiteSpace(relativePath)) |
354 | 354 |
throw new ArgumentNullException("relativePath"); |
... | ... | |
360 | 360 |
var absolutePath = Path.Combine(RootPath, relativePath); |
361 | 361 |
|
362 | 362 |
if (Directory.Exists(absolutePath)) |
363 |
return new DirectoryInfo(absolutePath); |
|
363 |
return new DirectoryInfo(absolutePath).WithProperCapitalization();
|
|
364 | 364 |
else |
365 |
return new FileInfo(absolutePath); |
|
365 |
return new FileInfo(absolutePath).WithProperCapitalization();
|
|
366 | 366 |
|
367 | 367 |
} |
368 | 368 |
|
b/trunk/Pithos.Core/Agents/FileInfoExtensions.cs | ||
---|---|---|
1 |
using System; |
|
1 |
// ----------------------------------------------------------------------- |
|
2 |
// <copyright file="FileInfoExtensions.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
35 |
// </copyright> |
|
36 |
// ----------------------------------------------------------------------- |
|
37 |
|
|
38 |
|
|
39 |
using System; |
|
2 | 40 |
using System.Collections.Generic; |
3 | 41 |
using System.Diagnostics.Contracts; |
4 | 42 |
using System.Linq; |
... | ... | |
47 | 85 |
return Signature.CalculateTreeHash(info.FullName, blockSize, algorithm).TopHash.ToHashString(); |
48 | 86 |
|
49 | 87 |
} |
50 |
|
|
51 |
|
|
52 |
|
|
53 | 88 |
} |
54 | 89 |
} |
b/trunk/Pithos.Core/Agents/NetworkAgent.cs | ||
---|---|---|
1 |
using System; |
|
1 |
// ----------------------------------------------------------------------- |
|
2 |
// <copyright file="NetworkAgent.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
35 |
// </copyright> |
|
36 |
// ----------------------------------------------------------------------- |
|
37 |
|
|
38 |
using System; |
|
2 | 39 |
using System.Collections.Concurrent; |
3 | 40 |
using System.Collections.Generic; |
4 | 41 |
using System.ComponentModel.Composition; |
... | ... | |
14 | 51 |
|
15 | 52 |
namespace Pithos.Core.Agents |
16 | 53 |
{ |
54 |
//TODO: Ensure all network operations use exact casing. Pithos is case sensitive |
|
17 | 55 |
[Export] |
18 | 56 |
public class NetworkAgent |
19 | 57 |
{ |
20 | 58 |
private Agent<CloudAction> _agent; |
21 | 59 |
|
60 |
//A separate agent is used to execute delete actions immediatelly; |
|
61 |
private Agent<CloudDeleteAction> _deleteAgent; |
|
62 |
|
|
22 | 63 |
|
23 | 64 |
[Import] |
24 | 65 |
public IStatusKeeper StatusKeeper { get; set; } |
... | ... | |
42 | 83 |
inbox.LoopAsync(process, loop); |
43 | 84 |
}; |
44 | 85 |
loop(); |
45 |
}); |
|
86 |
}); |
|
87 |
|
|
88 |
_deleteAgent = Agent<CloudDeleteAction>.Start(inbox => |
|
89 |
{ |
|
90 |
Action loop = null; |
|
91 |
loop = () => |
|
92 |
{ |
|
93 |
var message = inbox.Receive(); |
|
94 |
var process = message.Then(ProcessDelete,inbox.CancellationToken); |
|
95 |
inbox.LoopAsync(process, loop); |
|
96 |
}; |
|
97 |
loop(); |
|
98 |
|
|
99 |
}); |
|
46 | 100 |
} |
47 | 101 |
|
48 | 102 |
private async Task Process(CloudAction action) |
... | ... | |
75 | 129 |
await DownloadCloudFile(accountInfo, cloudFile, downloadPath); |
76 | 130 |
break; |
77 | 131 |
case CloudActionType.DeleteCloud: |
78 |
DeleteCloudFile(accountInfo, cloudFile); |
|
132 |
//Redirect deletes to the delete agent |
|
133 |
_deleteAgent.Post((CloudDeleteAction)action); |
|
79 | 134 |
break; |
80 | 135 |
case CloudActionType.RenameCloud: |
81 | 136 |
var moveAction = (CloudMoveAction)action; |
... | ... | |
127 | 182 |
} |
128 | 183 |
} |
129 | 184 |
|
185 |
/// <summary> |
|
186 |
/// Processes cloud delete actions |
|
187 |
/// </summary> |
|
188 |
/// <param name="action">The delete action to execute</param> |
|
189 |
/// <returns></returns> |
|
190 |
/// <remarks> |
|
191 |
/// When a file/folder is deleted locally, we must delete it ASAP from the server and block any download |
|
192 |
/// operations that may be in progress. |
|
193 |
/// <para> |
|
194 |
/// A separate agent is used to process deletes because the main agent may be busy with a long operation. |
|
195 |
/// </para> |
|
196 |
/// </remarks> |
|
197 |
private async Task ProcessDelete(CloudDeleteAction action) |
|
198 |
{ |
|
199 |
if (action == null) |
|
200 |
throw new ArgumentNullException("action"); |
|
201 |
if (action.AccountInfo==null) |
|
202 |
throw new ArgumentException("The action.AccountInfo is empty","action"); |
|
203 |
Contract.EndContractBlock(); |
|
204 |
|
|
205 |
var accountInfo = action.AccountInfo; |
|
206 |
|
|
207 |
using (log4net.ThreadContext.Stacks["NETWORK"].Push("PROCESS")) |
|
208 |
{ |
|
209 |
Log.InfoFormat("[ACTION] Start Processing {0}", action); |
|
210 |
|
|
211 |
var cloudFile = action.CloudFile; |
|
212 |
|
|
213 |
try |
|
214 |
{ |
|
215 |
//Acquire a lock on the deleted file to prevent uploading/downloading operations from the normal |
|
216 |
//agent |
|
217 |
using (var gate = NetworkGate.Acquire(action.LocalFile.FullName, NetworkOperation.Deleting)) |
|
218 |
{ |
|
219 |
// Remove any related actions from the normal agent |
|
220 |
_agent.Remove(queuedAction => |
|
221 |
queuedAction.CloudFile.Container == action.CloudFile.Container && |
|
222 |
queuedAction.CloudFile.Name == action.CloudFile.Name); |
|
223 |
// and then delete the file from the server |
|
224 |
DeleteCloudFile(accountInfo, cloudFile); |
|
225 |
Log.InfoFormat("[ACTION] End Delete {0}:{1}->{2}", action.Action, action.LocalFile, |
|
226 |
action.CloudFile.Name); |
|
227 |
} |
|
228 |
} |
|
229 |
catch (WebException exc) |
|
230 |
{ |
|
231 |
Log.ErrorFormat("[WEB ERROR] {0} : {1} -> {2} due to exception\r\n{3}", action.Action, action.LocalFile, action.CloudFile, exc); |
|
232 |
} |
|
233 |
catch (OperationCanceledException) |
|
234 |
{ |
|
235 |
throw; |
|
236 |
} |
|
237 |
catch (DirectoryNotFoundException) |
|
238 |
{ |
|
239 |
Log.ErrorFormat("{0} : {1} -> {2} failed because the directory was not found.\n Rescheduling a delete", |
|
240 |
action.Action, action.LocalFile, action.CloudFile); |
|
241 |
//Repost a delete action for the missing file |
|
242 |
_deleteAgent.Post(action); |
|
243 |
} |
|
244 |
catch (FileNotFoundException) |
|
245 |
{ |
|
246 |
Log.ErrorFormat("{0} : {1} -> {2} failed because the file was not found.\n Rescheduling a delete", |
|
247 |
action.Action, action.LocalFile, action.CloudFile); |
|
248 |
//Post a delete action for the missing file |
|
249 |
_deleteAgent.Post(action); |
|
250 |
} |
|
251 |
catch (Exception exc) |
|
252 |
{ |
|
253 |
Log.ErrorFormat("[REQUEUE] {0} : {1} -> {2} due to exception\r\n{3}", |
|
254 |
action.Action, action.LocalFile, action.CloudFile, exc); |
|
255 |
|
|
256 |
_deleteAgent.Post(action); |
|
257 |
} |
|
258 |
} |
|
259 |
} |
|
260 |
|
|
130 | 261 |
private async Task SyncFiles(AccountInfo accountInfo,CloudAction action) |
131 | 262 |
{ |
132 | 263 |
if (accountInfo == null) |
... | ... | |
143 | 274 |
|
144 | 275 |
var localFile = action.LocalFile; |
145 | 276 |
var cloudFile = action.CloudFile; |
146 |
var downloadPath=action.LocalFile.FullName.ToLower();
|
|
277 |
var downloadPath=action.LocalFile.GetProperCapitalization();
|
|
147 | 278 |
|
148 | 279 |
var cloudHash = cloudFile.Hash.ToLower(); |
149 | 280 |
var localHash = action.LocalHash.Value.ToLower(); |
... | ... | |
219 | 350 |
if (cloudAction.AccountInfo==null) |
220 | 351 |
throw new ArgumentException("The CloudAction.AccountInfo is empty","cloudAction"); |
221 | 352 |
Contract.EndContractBlock(); |
222 |
|
|
353 |
|
|
223 | 354 |
//If the action targets a local file, add a treehash calculation |
224 | 355 |
if (cloudAction.LocalFile as FileInfo != null) |
225 | 356 |
{ |
... | ... | |
241 | 372 |
//The hash for a directory is the empty string |
242 | 373 |
cloudAction.TopHash = new Lazy<string>(() => String.Empty); |
243 | 374 |
} |
244 |
_agent.Post(cloudAction); |
|
375 |
|
|
376 |
if (cloudAction is CloudDeleteAction) |
|
377 |
_deleteAgent.Post((CloudDeleteAction)cloudAction); |
|
378 |
else |
|
379 |
_agent.Post(cloudAction); |
|
245 | 380 |
} |
246 | 381 |
|
247 | 382 |
/* class ObjectInfoByNameComparer:IEqualityComparer<ObjectInfo> |
... | ... | |
410 | 545 |
if (fileAgent.Exists(relativePath)) |
411 | 546 |
{ |
412 | 547 |
//If a directory object already exists, we don't need to perform any other action |
413 |
var localFile = fileAgent.GetFileInfo(relativePath); |
|
548 |
var localFile = fileAgent.GetFileSystemInfo(relativePath);
|
|
414 | 549 |
if (objectInfo.Content_Type == @"application/directory" && localFile is DirectoryInfo) |
415 | 550 |
continue; |
416 | 551 |
var state = FileState.FindByFilePath(localFile.FullName); |
... | ... | |
470 | 605 |
throw new ArgumentException("OldCloudFile","action"); |
471 | 606 |
Contract.EndContractBlock(); |
472 | 607 |
|
473 |
var newFilePath = action.LocalFile.FullName; |
|
608 |
|
|
609 |
var newFilePath = action.LocalFile.FullName; |
|
610 |
|
|
611 |
//How do we handle concurrent renames and deletes/uploads/downloads? |
|
612 |
//* A conflicting upload means that a file was renamed before it had a chance to finish uploading |
|
613 |
// This should never happen as the network agent executes only one action at a time |
|
614 |
//* A conflicting download means that the file was modified on the cloud. While we can go on and complete |
|
615 |
// the rename, there may be a problem if the file is downloaded in blocks, as subsequent block requests for the |
|
616 |
// same name will fail. |
|
617 |
// This should never happen as the network agent executes only one action at a time. |
|
618 |
//* A conflicting delete can happen if the rename was followed by a delete action that didn't have the chance |
|
619 |
// to remove the rename from the queue. |
|
620 |
// We can probably ignore this case. It will result in an error which should be ignored |
|
621 |
|
|
622 |
|
|
474 | 623 |
//The local file is already renamed |
475 | 624 |
StatusKeeper.SetFileOverlayStatus(newFilePath, FileOverlayStatus.Modified); |
476 | 625 |
|
... | ... | |
479 | 628 |
var container = action.CloudFile.Container; |
480 | 629 |
|
481 | 630 |
var client = new CloudFilesClient(accountInfo); |
631 |
//TODO: What code is returned when the source file doesn't exist? |
|
482 | 632 |
client.MoveObject(account, container, action.OldCloudFile.Name, container, action.CloudFile.Name); |
483 | 633 |
|
484 | 634 |
StatusKeeper.SetFileStatus(newFilePath, FileStatus.Unchanged); |
... | ... | |
502 | 652 |
using ( log4net.ThreadContext.Stacks["DeleteCloudFile"].Push("Delete")) |
503 | 653 |
{ |
504 | 654 |
var fileName= cloudFile.RelativeUrlToFilePath(accountInfo.UserName); |
505 |
var info = fileAgent.GetFileInfo(fileName); |
|
655 |
var info = fileAgent.GetFileSystemInfo(fileName);
|
|
506 | 656 |
var fullPath = info.FullName.ToLower(); |
507 | 657 |
|
508 | 658 |
StatusKeeper.SetFileOverlayStatus(fullPath, FileOverlayStatus.Modified); |
... | ... | |
518 | 668 |
} |
519 | 669 |
|
520 | 670 |
//Download a file. |
521 |
private async Task DownloadCloudFile(AccountInfo accountInfo, ObjectInfo cloudFile , string localPath)
|
|
671 |
private async Task DownloadCloudFile(AccountInfo accountInfo, ObjectInfo cloudFile , string filePath)
|
|
522 | 672 |
{ |
523 | 673 |
if (accountInfo == null) |
524 | 674 |
throw new ArgumentNullException("accountInfo"); |
... | ... | |
528 | 678 |
throw new ArgumentNullException("cloudFile"); |
529 | 679 |
if (String.IsNullOrWhiteSpace(cloudFile.Container)) |
530 | 680 |
throw new ArgumentNullException("cloudFile"); |
531 |
if (String.IsNullOrWhiteSpace(localPath))
|
|
532 |
throw new ArgumentNullException("localPath");
|
|
533 |
if (!Path.IsPathRooted(localPath))
|
|
534 |
throw new ArgumentException("The localPath must be rooted", "localPath");
|
|
681 |
if (String.IsNullOrWhiteSpace(filePath))
|
|
682 |
throw new ArgumentNullException("filePath");
|
|
683 |
if (!Path.IsPathRooted(filePath))
|
|
684 |
throw new ArgumentException("The filePath must be rooted", "filePath");
|
|
535 | 685 |
Contract.EndContractBlock(); |
536 |
|
|
686 |
|
|
687 |
var localPath = Interfaces.FileInfoExtensions.GetProperFilePathCapitalization(filePath); |
|
537 | 688 |
var relativeUrl = new Uri(cloudFile.Name, UriKind.Relative); |
538 | 689 |
|
539 | 690 |
var url = relativeUrl.ToString(); |
... | ... | |
584 | 735 |
} |
585 | 736 |
|
586 | 737 |
//Download a small file with a single GET operation |
587 |
private async Task DownloadEntireFileAsync(AccountInfo accountInfo, CloudFilesClient client, ObjectInfo cloudFile, Uri relativeUrl, string localPath,TreeHash serverHash)
|
|
738 |
private async Task DownloadEntireFileAsync(AccountInfo accountInfo, CloudFilesClient client, ObjectInfo cloudFile, Uri relativeUrl, string filePath,TreeHash serverHash)
|
|
588 | 739 |
{ |
589 | 740 |
if (client == null) |
590 | 741 |
throw new ArgumentNullException("client"); |
... | ... | |
592 | 743 |
throw new ArgumentNullException("cloudFile"); |
593 | 744 |
if (relativeUrl == null) |
594 | 745 |
throw new ArgumentNullException("relativeUrl"); |
595 |
if (String.IsNullOrWhiteSpace(localPath))
|
|
596 |
throw new ArgumentNullException("localPath");
|
|
597 |
if (!Path.IsPathRooted(localPath))
|
|
598 |
throw new ArgumentException("The localPath must be rooted", "localPath");
|
|
746 |
if (String.IsNullOrWhiteSpace(filePath))
|
|
747 |
throw new ArgumentNullException("filePath");
|
|
748 |
if (!Path.IsPathRooted(filePath))
|
|
749 |
throw new ArgumentException("The localPath must be rooted", "filePath");
|
|
599 | 750 |
Contract.EndContractBlock(); |
600 | 751 |
|
752 |
var localPath = Pithos.Interfaces.FileInfoExtensions.GetProperFilePathCapitalization(filePath); |
|
601 | 753 |
//If the file already exists |
602 | 754 |
if (File.Exists(localPath)) |
603 | 755 |
{ |
... | ... | |
624 | 776 |
Directory.CreateDirectory(tempFolder); |
625 | 777 |
|
626 | 778 |
//Download the object to the temporary location |
627 |
await client.GetObject(cloudFile.Account, cloudFile.Container, relativeUrl.ToString(), tempPath).ContinueWith(t => |
|
628 |
{ |
|
629 |
t.PropagateExceptions(); |
|
630 |
//Create the local folder if it doesn't exist (necessary for shared objects) |
|
631 |
var localFolder = Path.GetDirectoryName(localPath); |
|
632 |
if (!Directory.Exists(localFolder)) |
|
633 |
Directory.CreateDirectory(localFolder); |
|
634 |
//And move it to its actual location once downloading is finished |
|
635 |
if (File.Exists(localPath)) |
|
636 |
File.Replace(tempPath,localPath,null,true); |
|
637 |
else |
|
638 |
File.Move(tempPath,localPath); |
|
639 |
//Notify listeners that a local file has changed |
|
640 |
StatusNotification.NotifyChangedFile(localPath); |
|
779 |
await client.GetObject(cloudFile.Account, cloudFile.Container, relativeUrl.ToString(), tempPath); |
|
641 | 780 |
|
642 |
}); |
|
781 |
//Create the local folder if it doesn't exist (necessary for shared objects) |
|
782 |
var localFolder = Path.GetDirectoryName(localPath); |
|
783 |
if (!Directory.Exists(localFolder)) |
|
784 |
Directory.CreateDirectory(localFolder); |
|
785 |
//And move it to its actual location once downloading is finished |
|
786 |
if (File.Exists(localPath)) |
|
787 |
File.Replace(tempPath,localPath,null,true); |
|
788 |
else |
|
789 |
File.Move(tempPath,localPath); |
|
790 |
//Notify listeners that a local file has changed |
|
791 |
StatusNotification.NotifyChangedFile(localPath); |
|
792 |
|
|
793 |
|
|
643 | 794 |
} |
644 | 795 |
|
645 | 796 |
//Download a file asynchronously using blocks |
646 |
public async Task DownloadWithBlocks(AccountInfo accountInfo, CloudFilesClient client, ObjectInfo cloudFile, Uri relativeUrl, string localPath, TreeHash serverHash)
|
|
797 |
public async Task DownloadWithBlocks(AccountInfo accountInfo, CloudFilesClient client, ObjectInfo cloudFile, Uri relativeUrl, string filePath, TreeHash serverHash)
|
|
647 | 798 |
{ |
648 | 799 |
if (client == null) |
649 | 800 |
throw new ArgumentNullException("client"); |
... | ... | |
651 | 802 |
throw new ArgumentNullException("cloudFile"); |
652 | 803 |
if (relativeUrl == null) |
653 | 804 |
throw new ArgumentNullException("relativeUrl"); |
654 |
if (String.IsNullOrWhiteSpace(localPath))
|
|
655 |
throw new ArgumentNullException("localPath");
|
|
656 |
if (!Path.IsPathRooted(localPath))
|
|
657 |
throw new ArgumentException("The localPath must be rooted", "localPath");
|
|
805 |
if (String.IsNullOrWhiteSpace(filePath))
|
|
806 |
throw new ArgumentNullException("filePath");
|
|
807 |
if (!Path.IsPathRooted(filePath))
|
|
808 |
throw new ArgumentException("The filePath must be rooted", "filePath");
|
|
658 | 809 |
if (serverHash == null) |
659 | 810 |
throw new ArgumentNullException("serverHash"); |
660 | 811 |
Contract.EndContractBlock(); |
661 | 812 |
|
662 | 813 |
var fileAgent = GetFileAgent(accountInfo); |
814 |
var localPath = Interfaces.FileInfoExtensions.GetProperFilePathCapitalization(filePath); |
|
663 | 815 |
|
664 | 816 |
//Calculate the relative file path for the new file |
665 | 817 |
var relativePath = relativeUrl.RelativeUriToFilePath(); |
... | ... | |
751 | 903 |
} |
752 | 904 |
|
753 | 905 |
|
754 |
var fullFileName = fileInfo.FullName;
|
|
906 |
var fullFileName = fileInfo.GetProperCapitalization();
|
|
755 | 907 |
using (var gate = NetworkGate.Acquire(fullFileName, NetworkOperation.Uploading)) |
756 | 908 |
{ |
757 | 909 |
//Abort if the file is already being uploaded or downloaded |
... | ... | |
768 | 920 |
//If this is a read-only file, do not upload changes |
769 | 921 |
if (info.AllowedTo == "read") |
770 | 922 |
return; |
771 |
|
|
772 |
//WRONG: If this is a directory, there is no hash to check. ???? |
|
773 |
//TODO: Check how a directory hash is calculated |
|
923 |
|
|
924 |
//TODO: Check how a directory hash is calculated -> All dirs seem to have the same hash |
|
774 | 925 |
if (fileInfo is DirectoryInfo) |
775 | 926 |
{ |
776 | 927 |
//If the directory doesn't exist the Hash property will be empty |
777 | 928 |
if (String.IsNullOrWhiteSpace(info.Hash)) |
778 | 929 |
//Go on and create the directory |
779 |
client.PutObject(account, cloudFile.Container, cloudFile.Name, fileInfo.FullName, String.Empty, "application/directory");
|
|
930 |
client.PutObject(account, cloudFile.Container, cloudFile.Name, fullFileName, String.Empty, "application/directory");
|
|
780 | 931 |
} |
781 | 932 |
else |
782 | 933 |
{ |
... | ... | |
804 | 955 |
//the relevant block |
805 | 956 |
|
806 | 957 |
//First, calculate the tree hash |
807 |
var treeHash = await Signature.CalculateTreeHashAsync(fileInfo.FullName, accountInfo.BlockSize,
|
|
958 |
var treeHash = await Signature.CalculateTreeHashAsync(fullFileName, accountInfo.BlockSize,
|
|
808 | 959 |
accountInfo.BlockHash); |
809 | 960 |
|
810 | 961 |
await UploadWithHashMap(accountInfo, cloudFile, fileInfo as FileInfo, cloudFile.Name, treeHash); |
... | ... | |
871 | 1022 |
throw new ArgumentException("Invalid container","cloudFile"); |
872 | 1023 |
Contract.EndContractBlock(); |
873 | 1024 |
|
874 |
var fullFileName = fileInfo.FullName;
|
|
1025 |
var fullFileName = fileInfo.GetProperCapitalization();
|
|
875 | 1026 |
|
876 | 1027 |
var account = cloudFile.Account ?? accountInfo.UserName; |
877 | 1028 |
var container = cloudFile.Container ; |
b/trunk/Pithos.Core/Agents/WorkflowAgent.cs | ||
---|---|---|
1 |
using System; |
|
1 |
// ----------------------------------------------------------------------- |
|
2 |
// <copyright file="WorkflowAgent.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
35 |
// </copyright> |
|
36 |
// ----------------------------------------------------------------------- |
|
37 |
|
|
38 |
using System; |
|
2 | 39 |
using System.Collections.Generic; |
3 | 40 |
using System.ComponentModel.Composition; |
4 | 41 |
using System.Diagnostics; |
b/trunk/Pithos.Core/FileState.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="FileState.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="FileState.cs" company="GRNet"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
4 | 35 |
// </copyright> |
5 | 36 |
// ----------------------------------------------------------------------- |
6 | 37 |
|
... | ... | |
125 | 156 |
.ExecuteUpdate(); |
126 | 157 |
if (updatedEntities == 0) |
127 | 158 |
{ |
128 |
var newState = new FileState { FilePath = absolutePath, Id = Guid.NewGuid(), FileStatus = newStatus }; |
|
159 |
var newState = new FileState { FilePath = absolutePath.ToLower(), Id = Guid.NewGuid(), FileStatus = newStatus };
|
|
129 | 160 |
newState.CreateAndFlush(); |
130 | 161 |
} |
131 | 162 |
return null; |
... | ... | |
288 | 319 |
|
289 | 320 |
var fileState = new FileState |
290 | 321 |
{ |
291 |
FilePath = filePath, |
|
322 |
FilePath = filePath.ToLower(),
|
|
292 | 323 |
OverlayStatus = FileOverlayStatus.Unversioned, |
293 | 324 |
FileStatus = FileStatus.Created, |
294 | 325 |
Id=Guid.NewGuid() |
... | ... | |
298 | 329 |
return fileState.UpdateHashesAsync(blockSize,algorithm); |
299 | 330 |
} |
300 | 331 |
|
301 |
public Task<FileState> UpdateHashesAsync(int blockSize,string algorithm) |
|
332 |
public async Task<FileState> UpdateHashesAsync(int blockSize,string algorithm)
|
|
302 | 333 |
{ |
303 | 334 |
if (blockSize<=0) |
304 | 335 |
throw new ArgumentOutOfRangeException("blockSize"); |
... | ... | |
308 | 339 |
|
309 | 340 |
//Skip updating the hash for folders |
310 | 341 |
if (Directory.Exists(FilePath)) |
311 |
return Task.Factory.FromResult(this);
|
|
342 |
return this;
|
|
312 | 343 |
|
313 |
var results = Task.Factory.StartNew(() =>
|
|
344 |
var hash = await TaskEx.Run(() =>
|
|
314 | 345 |
{ |
315 | 346 |
var info = new FileInfo(FilePath); |
316 | 347 |
return info.CalculateHash(blockSize, algorithm); |
317 | 348 |
}); |
318 | 349 |
|
319 |
var state=results.Then(hash => |
|
320 |
{ |
|
321 |
Checksum = hash; |
|
322 |
return Task.Factory.FromResult(this); |
|
323 |
}); |
|
350 |
Checksum = hash; |
|
324 | 351 |
|
325 |
return state;
|
|
352 |
return this;
|
|
326 | 353 |
} |
327 | 354 |
} |
328 | 355 |
|
b/trunk/Pithos.Core/IStatusService.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="IStatusService.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="IStatusService.cs" company="GRNet"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
4 | 35 |
// </copyright> |
5 | 36 |
// ----------------------------------------------------------------------- |
6 | 37 |
|
... | ... | |
35 | 66 |
{ |
36 | 67 |
[OperationContract(IsOneWay=true)] |
37 | 68 |
void ShowProperties(string fileName); |
69 |
[OperationContract(IsOneWay=true)] |
|
70 |
void GotoSite(string fileName); |
|
71 |
|
|
38 | 72 |
} |
39 | 73 |
} |
b/trunk/Pithos.Core/JobQueue.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="JobQueue.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="JobQueue.cs" company="GRNet"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
4 | 35 |
// </copyright> |
5 | 36 |
// ----------------------------------------------------------------------- |
6 | 37 |
|
b/trunk/Pithos.Core/NetworkGate.cs | ||
---|---|---|
1 |
// ----------------------------------------------------------------------- |
|
2 |
// <copyright file="NetworkGate.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
|
12 |
// |
|
13 |
// 2. Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials |
|
16 |
// provided with the distribution. |
|
17 |
// |
|
18 |
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
19 |
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
21 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
22 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
25 |
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
26 |
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
27 |
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
28 |
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
29 |
// POSSIBILITY OF SUCH DAMAGE. |
|
30 |
// |
|
31 |
// The views and conclusions contained in the software and |
|
32 |
// documentation are those of the authors and should not be |
|
33 |
// interpreted as representing official policies, either expressed |
|
34 |
// or implied, of GRNET S.A. |
|
35 |
// </copyright> |
|
36 |
// ----------------------------------------------------------------------- |
|
37 |
|
|
1 | 38 |
using System; |
2 | 39 |
using System.Collections.Concurrent; |
3 | 40 |
using System.Collections.Generic; |
... | ... | |
10 | 47 |
{ |
11 | 48 |
None, |
12 | 49 |
Uploading, |
13 |
Downloading |
|
50 |
Downloading, |
|
51 |
Deleting, |
|
52 |
Renaming |
|
14 | 53 |
} |
15 | 54 |
|
16 | 55 |
//The NetworkGate prevents starting download/uploads for files that are already in the process of downloading, |
... | ... | |
39 | 78 |
Contract.EndContractBlock(); |
40 | 79 |
|
41 | 80 |
NetworkOperation operation; |
42 |
if (NetworkState.TryGetValue(path.ToLower(), out operation)) |
|
81 |
var lower = path.ToLower(); |
|
82 |
if (NetworkState.TryGetValue(lower, out operation)) |
|
43 | 83 |
return operation; |
44 | 84 |
return NetworkOperation.None; |
45 | 85 |
} |
... | ... | |
74 | 114 |
throw new ArgumentException("path must be a rooted path", "path"); |
75 | 115 |
Contract.EndContractBlock(); |
76 | 116 |
|
77 |
var state = GetNetworkState(path); |
|
117 |
var lower = path.ToLower(); |
|
118 |
var state = GetNetworkState(lower); |
|
78 | 119 |
//If no operation is in progress, return a NetworkGate |
79 | 120 |
return (state == NetworkOperation.None) |
80 |
? new NetworkGate(path, operation)
|
|
121 |
? new NetworkGate(lower, operation)
|
|
81 | 122 |
//otherwise return a gate with Fail flagged |
82 |
: new NetworkGate(path, NetworkOperation.None);
|
|
123 |
: new NetworkGate(lower, NetworkOperation.None);
|
|
83 | 124 |
} |
84 | 125 |
|
85 | 126 |
|
b/trunk/Pithos.Core/Pithos.Core.csproj | ||
---|---|---|
365 | 365 |
<Compile Include="Agents\AgentLocator.cs" /> |
366 | 366 |
<Compile Include="Agents\BlockUpdater.cs" /> |
367 | 367 |
<Compile Include="Agents\CloudTransferAction.cs" /> |
368 |
<Compile Include="Agents\CollectionExtensions.cs" /> |
|
368 | 369 |
<Compile Include="Agents\FileAgent.cs" /> |
369 | 370 |
<Compile Include="Agents\FileInfoExtensions.cs" /> |
370 | 371 |
<Compile Include="Agents\NetworkAgent.cs" /> |
b/trunk/Pithos.Core/Properties/AssemblyInfo.cs | ||
---|---|---|
8 | 8 |
[assembly: AssemblyTitle("Pithos.Core")] |
9 | 9 |
[assembly: AssemblyDescription("")] |
10 | 10 |
[assembly: AssemblyConfiguration("")] |
11 |
[assembly: AssemblyCompany("Microsoft")]
|
|
11 |
[assembly: AssemblyCompany("GRNet")]
|
|
12 | 12 |
[assembly: AssemblyProduct("Pithos.Core")] |
13 |
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
|
|
13 |
[assembly: AssemblyCopyright("Copyright © GRNet 2011")]
|
|
14 | 14 |
[assembly: AssemblyTrademark("")] |
15 | 15 |
[assembly: AssemblyCulture("")] |
16 | 16 |
|
b/trunk/Pithos.Interfaces/AccountSettings.cs | ||
---|---|---|
1 | 1 |
// ----------------------------------------------------------------------- |
2 |
// <copyright file="AccountSettings.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
2 |
// <copyright file="AccountSettings.cs" company="GRNET"> |
|
3 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
// |
|
5 |
// Redistribution and use in source and binary forms, with or |
|
6 |
// without modification, are permitted provided that the following |
|
7 |
// conditions are met: |
|
8 |
// |
|
9 |
// 1. Redistributions of source code must retain the above |
|
10 |
// copyright notice, this list of conditions and the following |
|
11 |
// disclaimer. |
Also available in: Unified diff