private static IDocumentCollection <TDocument> GetDocumentCollection <TDocument>(string userSwid, string entityName, IDatabaseDirectoryCreator directoryCreator, byte[] encryptionKey, IDocumentCollectionFactory documentCollectionFactory) where TDocument : AbstractDocument, new()
    {
        string dir  = BuildDocCollectionPath(directoryCreator, userSwid);
        string path = HashedPathGenerator.GetPath(dir, entityName);

        return(documentCollectionFactory.CreateHighSecurityFileSystemCollection <TDocument>(path, encryptionKey));
    }
Beispiel #2
0
    public string CreateUserDirectory(string documentCollectionName)
    {
        string dir  = CreateUserDirectory();
        string path = HashedPathGenerator.GetPath(dir, documentCollectionName);

        EnsureDirectoryExists(path);
        return(path);
    }
Beispiel #3
0
        public IDocumentCollection <TDocument> CreateHighSecurityFileSystemCollection <TDocument>(string dirPath, byte[] key) where TDocument : AbstractDocument, new()
        {
            FileSystem fileSystem = new FileSystem();

            if (!fileSystem.DirectoryExists(dirPath))
            {
                fileSystem.CreateDirectory(dirPath);
            }
            string        path          = HashedPathGenerator.GetPath(dirPath, "_journal");
            JournalPlayer journalPlayer = new JournalPlayer(path, fileSystem);
            JournalWriter journalWriter = new JournalWriter(path, fileSystem);
            string        path2         = HashedPathGenerator.GetPath(dirPath, "_packedFile");
            string        path3         = HashedPathGenerator.GetPath(dirPath, "_packedFileMeta");
            PackedFile    packedFile    = new PackedFile(path2, path3, journalWriter, fileSystem);
            IndexFactory  indexFactory  = new IndexFactory(dirPath, journalWriter, fileSystem);

            return(new DocumentCollection <TDocument>(packedFile, indexFactory, key, journalPlayer, journalWriter));
        }
    private static string BuildDocCollectionPath(IDatabaseDirectoryCreator directoryCreator, string userSwid)
    {
        string dir = directoryCreator.CreateUserDirectory();

        return(HashedPathGenerator.GetPath(dir, userSwid));
    }