Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Implement 'incremental' provision support #553
+ Persistence storage base service + Persistence storage 'file system' implementation, tests
- Loading branch information
1 parent
6c94184
commit fc17cbf
Showing
12 changed files
with
338 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 3 additions & 16 deletions
19
SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/SSOM/SSOMTokenReplacementServiceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
SPMeta2/SPMeta2/Services/Impl/DefaultFileSystemPersistenceStorage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SPMeta2.Services.Impl | ||
{ | ||
public class DefaultFileSystemPersistenceStorage : PersistenceStorageServiceBase | ||
{ | ||
#region constructors | ||
|
||
public DefaultFileSystemPersistenceStorage() | ||
: this(DefaultFolderPath) | ||
{ | ||
|
||
} | ||
|
||
public DefaultFileSystemPersistenceStorage(string folderPath) | ||
{ | ||
CurrentFolderPath = folderPath; | ||
} | ||
|
||
#endregion | ||
|
||
#region static | ||
|
||
static DefaultFileSystemPersistenceStorage() | ||
{ | ||
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SPMeta2"); | ||
DefaultFolderPath = path; | ||
} | ||
|
||
public static string DefaultFolderPath { get; set; } | ||
public string CurrentFolderPath { get; set; } | ||
|
||
#endregion | ||
|
||
#region methods | ||
|
||
public override byte[] LoadObject(string objectId) | ||
{ | ||
var fileName = string.Format("{0}.state", objectId); | ||
var filePath = Path.Combine(CurrentFolderPath, fileName); | ||
|
||
if (File.Exists(filePath)) | ||
return File.ReadAllBytes(filePath); | ||
|
||
return null; | ||
} | ||
|
||
public override void SaveObject(string objectId, byte[] data) | ||
{ | ||
Directory.CreateDirectory(CurrentFolderPath); | ||
|
||
var fileName = string.Format("{0}.state", objectId); | ||
var filePath = Path.Combine(CurrentFolderPath, fileName); | ||
|
||
File.WriteAllBytes(filePath, data); | ||
} | ||
#endregion | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.