/// <summary>
        /// Initializes the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (config == "")
            {
                config = Config.GetConnectionString();
            }

            _host = host;
            _wiki = string.IsNullOrEmpty(wiki) ? "root" : wiki.ToLowerInvariant();

            _client = TableStorage.StorageAccount(config).CreateCloudBlobClient();

            CloudBlobContainer       containerRef = _client.GetContainerReference(_wiki + "-themes");
            BlobContainerPermissions permissions  = new BlobContainerPermissions();

            permissions.PublicAccess = BlobContainerPublicAccessType.Blob;
            containerRef.CreateIfNotExists();
            containerRef.SetPermissions(permissions);
        }
Example #2
0
        /// <summary>
        /// Initializes the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.host = host;
            this.wiki = string.IsNullOrEmpty(wiki) ? "root" : wiki;

            // Create directories, if needed
            if (!Directory.Exists(GetFullPath("")))
            {
                Directory.CreateDirectory(GetFullPath(""));
            }

            if (!Directory.Exists(GetFullPath(UploadDirectory)))
            {
                Directory.CreateDirectory(GetFullPath(UploadDirectory));
            }
            if (!Directory.Exists(GetFullPath(AttachmentsDirectory)))
            {
                Directory.CreateDirectory(GetFullPath(AttachmentsDirectory));
            }
        }
Example #3
0
        /// <summary>
        /// Initializes the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (config == "")
            {
                config = Config.GetConnectionString();
            }

            _host = host;
            _wiki = string.IsNullOrEmpty(wiki) ? "root" : wiki.ToLowerInvariant();

            _client = TableStorage.StorageAccount(config).CreateCloudBlobClient();

            CloudBlobContainer containerRef = _client.GetContainerReference(_wiki);

            containerRef.CreateIfNotExists();

            containerRef = _client.GetContainerReference(_wiki + "-attachments");
            containerRef.CreateIfNotExists();
        }
Example #4
0
        /// <summary>
        /// Initializes the Theme Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <b>host</b> or <b>config</b> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <b>config</b> is not valid or is incorrect.</exception>
        public void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.host = host;
            this.wiki = string.IsNullOrEmpty(wiki) ? "root" : wiki;

            if (!LocalProvidersTools.CheckWritePermissions(GetMasterDirectory()))
            {
                throw new InvalidConfigurationException("Cannot write into the public directory - check permissions");
            }

            string pathFolders = GetPath(GetMasterDirectory(), ThemeDirectory);

            if (!Directory.Exists(pathFolders))
            {
                Directory.CreateDirectory(pathFolders);
            }
        }
Example #5
0
        /// <summary>
        /// Sets up the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void SetUp(IHostV50 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (config == "")
            {
                config = Config.GetConnectionString();
            }

            TableStorage.CreateTable(config, GlobalSettingsTable);
            TableStorage.CreateTable(config, LogsTable);

            _client = TableStorage.StorageAccount(config).CreateCloudBlobClient();

            CloudBlobContainer containerRef = _client.GetContainerReference(AssembliesContainer);

            containerRef.CreateIfNotExists();
        }
Example #6
0
 /// <summary>
 /// Sets up the Storage Provider.
 /// </summary>
 /// <param name="host">The Host of the Component.</param>
 /// <param name="config">The Configuration data, if any.</param>
 /// <exception cref="ArgumentNullException">If <b>host</b> or <b>config</b> are <c>null</c>.</exception>
 /// <exception cref="InvalidConfigurationException">If <b>config</b> is not valid or is incorrect.</exception>
 public void SetUp(IHostV50 host, string config)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
 }
        /// <summary>
        /// Initializes the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            _host = host;
            _wiki = string.IsNullOrEmpty(wiki) ? "root" : wiki;

            DirectoryInfo dirInfo = System.IO.Directory.CreateDirectory(GetFullPath(_wiki));

            _directory = FSDirectory.Open(dirInfo);
        }
Example #8
0
        /// <summary>
        /// Initializes the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        public new void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _connString = config.Length == 0 ? BuildDbConnectionString(host) : config;

            base.Init(host, _connString, wiki);
        }
        protected IHostV50 MockHost()
        {
            if (!System.IO.Directory.Exists(testDir))
            {
                System.IO.Directory.CreateDirectory(testDir);
            }

            IHostV50 host = mocks.DynamicMock <IHostV50>();

            Expect.Call(host.GetGlobalSettingValue(GlobalSettingName.PublicDirectory)).Return(testDir).Repeat.AtLeastOnce();

            mocks.Replay(host);

            return(host);
        }
Example #10
0
        /// <summary>
        /// Sets up the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void SetUp(IHostV50 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (config == "")
            {
                config = Config.GetConnectionString();
            }

            _host = host;
        }
Example #11
0
        /// <summary>
        /// Sets up the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void SetUp(IHostV50 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (config == "")
            {
                config = Config.GetConnectionString();
            }

            TableStorage.CreateTable(config, UsersTable);
            TableStorage.CreateTable(config, UserGroupsTable);
            TableStorage.CreateTable(config, UserDataTable);
        }
Example #12
0
        /// <summary>
        /// Initializes the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <b>host</b> or <b>config</b> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <b>config</b> is not valid or is incorrect.</exception>
        public new void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _connString = config.Length == 0 ? BuildDbConnectionString(host) : config;

            base.Init(host, _connString, wiki);

            if (!Directory.Exists(GetFullPath(PluginsDirectory)))
            {
                Directory.CreateDirectory(GetFullPath(PluginsDirectory));
            }
        }
        /// <summary>
        /// Initializes the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (config == "")
            {
                config = Config.GetConnectionString();
            }

            _host = host;
            _wiki = string.IsNullOrEmpty(wiki) ? "root" : wiki;

            _directory = new AzureDirectory(TableStorage.StorageAccount(config), wiki + "-searchindex");
        }
Example #14
0
        /// <summary>
        /// Initializes the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (config == "")
            {
                config = Config.GetConnectionString();
            }

            _host = host;
            _wiki = string.IsNullOrEmpty(wiki) ? "root" : wiki.ToLowerInvariant();

            _cloudTableClient = TableStorage.TableClient(config);
        }
Example #15
0
        /// <summary>
        /// Initializes the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <param name="wiki">The wiki.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void Init(IHostV50 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (config == "")
            {
                config = Config.GetConnectionString();
            }

            _host = host;
            _wiki = wiki;

            _client = TableStorage.StorageAccount(config).CreateCloudBlobClient();

            _cloudTableClient = TableStorage.TableClient(config);
        }
Example #16
0
        /// <summary>
        /// Sets up the Storage Provider.
        /// </summary>
        /// <param name="host">The Host of the Component.</param>
        /// <param name="config">The Configuration data, if any.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
        /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
        public void SetUp(IHostV50 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.host = host;
            var dataDIrectory = GetDataDirectory(host);

            if (!Directory.Exists(dataDIrectory))
            {
                throw new Exception(String.Format("Directory '{0}' does not exist", dataDIrectory));
            }

            if (!LocalProvidersTools.CheckWritePermissions(dataDIrectory))
            {
                throw new InvalidConfigurationException("Cannot write into the public directory - check permissions");
            }
        }
Example #17
0
 /// <summary>
 /// Sets up the Storage Provider.
 /// </summary>
 /// <param name="host">The Host of the Component.</param>
 /// <param name="config">The Configuration data, if any.</param>
 /// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
 /// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
 public void SetUp(IHostV50 host, string config)
 {
     // Nothing to do.
 }
Example #18
0
        public void Init(IHostV50 host, string config, string wiki)
        {
#warning void Init(IHostV50 host, string config, string wiki)
        }
Example #19
0
 private string BuildDbConnectionString(IHostV50 host)
 {
     return("Data Source = '" + Path.Combine(host.GetGlobalSettingValue(GlobalSettingName.PublicDirectory), "ScrewTurnWiki.sdf") + "';");
 }
Example #20
0
 /// <summary>
 /// Gets the data directory.
 /// </summary>
 /// <param name="host">The host object.</param>
 /// <returns>The data directory.</returns>
 protected string GetDataDirectory(IHostV50 host)
 {
     return(host.GetGlobalSettingValue(GlobalSettingName.PublicDirectory));
 }
Example #21
0
        public void Init(IHostV50 host, string config, string wiki)
        {
#warning void Init(IHostV50 host, string config, string wiki)
            //throw new NotImplementedException();
        }
Example #22
0
 public void SetUp(IHostV50 host, string config)
 {
     throw new NotImplementedException();
 }