Ejemplo n.º 1
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(IHostV40 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);
            }
        }
Ejemplo n.º 2
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(IHostV40 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _host = host;
            if (string.IsNullOrEmpty(config))
            {
                throw new InvalidConfigurationException("Configuration is missing required parameters");
            }

            var settings = new XsltSettings {
                EnableScript           = true,
                EnableDocumentFunction = true
            };

            _xslTransform = new XslCompiledTransform(true);
            using (var reader = XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("ScrewTurn.Wiki.Plugins.PluginPack.Resources.UnfuddleTickets.xsl"))) {
                _xslTransform.Load(reader, settings, new XmlUrlResolver());
            }
        }
        /// <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(IHostV40 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.CreateIfNotExist();

            containerRef = _client.GetContainerReference(_wiki + "-attachments");
            containerRef.CreateIfNotExist();
        }
        /// <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(IHostV40 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.CreateIfNotExist();
        }
Ejemplo n.º 5
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>
        /// <remarks>If the configuration string is not valid, the methoud should throw a <see cref="InvalidConfigurationException"/>.</remarks>
        public void Init(IHostV40 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _host   = host;
            _config = config ?? string.Empty;
            _wiki   = string.IsNullOrEmpty(wiki) ? "root" : wiki;
            var configEntries = _config.Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);

            if (configEntries.Length != 3)
            {
                throw new InvalidConfigurationException("Configuration is missing required parameters");
            }

            _baseUrl = configEntries[0];

            if (_baseUrl.EndsWith("/"))
            {
                _baseUrl = _baseUrl.Substring(0, _baseUrl.Length - 1);
            }

            _username = configEntries[1];
            _password = configEntries[2];
        }
Ejemplo n.º 6
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(IHostV40 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));
            }
        }
Ejemplo n.º 7
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(IHostV40 host, string config, string wiki)
        {
            m_Host   = host;
            m_wiki   = wiki;
            m_Random = new Random();

            InitConfig(config);
        }
		/// <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(IHostV40 host, string config) {
			if(host == null) throw new ArgumentNullException("host");
			if(config == null) throw new ArgumentNullException("config");

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

			// Nothing to do
		}
 /// <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>
 /// <remarks>If the configuration string is not valid, the methoud should throw a <see cref="InvalidConfigurationException"/>.</remarks>
 public void Init(IHostV40 host, string config, string wiki)
 {
     this.host       = host;
     this.config     = config != null ? config : "";
     this.wiki       = string.IsNullOrEmpty(wiki) ? "root" : wiki;
     defaultLanguage = host.GetSettingValue(SettingName.DefaultLanguage);
     displayWarning  = config.ToLowerInvariant().Equals("display warning");
 }
Ejemplo n.º 10
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>
        /// <remarks>If the configuration string is not valid, the methoud should throw a <see cref="InvalidConfigurationException"/>.</remarks>
        public void Init(IHostV40 host, string config, string wiki)
        {
            this._host   = host;
            this._config = config != null ? config : "";
            this._wiki   = string.IsNullOrEmpty(wiki) ? "root" : wiki;

            if (this._config.ToLowerInvariant() == "nolog")
            {
                _enableLogging = false;
            }
        }
Ejemplo n.º 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 <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(IHostV40 host, string config)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
 }
Ejemplo n.º 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 <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(IHostV40 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);
        }
        /// <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 new void SetUp(IHostV40 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

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

            base.SetUp(host, _connString);
        }
Ejemplo n.º 14
0
        protected IHostV40 MockHost()
        {
            if (!Directory.Exists(testDir))
            {
                Directory.CreateDirectory(testDir);
            }

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

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

            mocks.Replay(host);

            return(host);
        }
Ejemplo n.º 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 <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(IHostV40 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;

            connString = 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(IHostV40 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.CreateIfNotExist();
			containerRef.SetPermissions(permissions);
		}
Ejemplo n.º 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(IHostV40 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.host = host;

            if (!LocalProvidersTools.CheckWritePermissions(GetDataDirectory(host)))
            {
                throw new InvalidConfigurationException("Cannot write into the public directory - check permissions");
            }
        }
        /// <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(IHostV40 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

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

            _host = host;
        }
Ejemplo n.º 19
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(IHostV40 host, string config, string wiki)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _host = host;
            _wiki = wiki;

            IFilesStorageProviderV40 filesStorageProvider = GetDefaultFilesStorageProvider();

            if (!DirectoryExists(filesStorageProvider, DefaultDirectoryName()))
            {
                filesStorageProvider.CreateDirectory("/", DefaultDirectoryName().Trim('/'));
            }

            string[] configEntries = config.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < configEntries.Length; i++)
            {
                string[] configEntryDetails = configEntries[i].Split(new string[] { "=" }, 2, StringSplitOptions.None);
                switch (configEntryDetails[0].ToLowerInvariant())
                {
                case "logoptions":
                    if (configEntryDetails[1] == "nolog")
                    {
                        _enableLogging = false;
                    }
                    else
                    {
                        LogWarning("Unknown value in 'logOptions' configuration string: " + configEntries[i] + "; supported values are: 'nolog'.");
                    }
                    break;

                default:
                    LogWarning("Unknown value in configuration string: " + configEntries[i]);
                    break;
                }
            }
        }
        protected IHostV40 MockHost()
        {
            if (!Directory.Exists(testDir))
            {
                Directory.CreateDirectory(testDir);
            }
            //Console.WriteLine("Temp dir: " + testDir);

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

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

            Expect.Call(host.GetGlobalSettingValue(GlobalSettingName.LoggingLevel)).Return("3").Repeat.Any();
            Expect.Call(host.GetGlobalSettingValue(GlobalSettingName.MaxLogSize)).Return(MaxLogSize.ToString()).Repeat.Any();
            Expect.Call(host.GetSettingValue(SettingName.MaxRecentChanges)).Constraints(Rhino.Mocks.Constraints.Is.Equal(SettingName.MaxRecentChanges)).Return(MaxRecentChanges.ToString()).Repeat.Any();

            mocks.Replay(host);

            return(host);
        }
Ejemplo n.º 21
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(IHostV40 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);
        }
        /// <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(IHostV40 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));
            }
        }
Ejemplo n.º 23
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(IHostV40 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");
        }
Ejemplo n.º 24
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(IHostV40 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();

            _context = TableStorage.GetContext(config);
        }
Ejemplo n.º 25
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(IHostV40 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            // Setup request handlers

            host.RegisterRequestHandler(this, @"(star\.gif\.ashx)|(javascript\.js\.ashx)|(styles\.css\.ashx)|(rating\.js\.ashx)", new[] { "GET", "HEAD" });

            host.RegisterRequestHandler(this, @"_setrating\.ashx", new[] { "POST" });

            host.AddHtmlHeadContent(this,
                                    @"<script type=""text/javascript"" src=""javascript.js.ashx""></script>
<link rel=""StyleSheet"" href=""styles.css.ashx"" type=""text/css"" />
<script type=""text/javascript"" src=""rating.js.ashx""></script>");
        }
        /// <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(IHostV40 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;

            _context = TableStorage.GetContext(config);

            _client = TableStorage.StorageAccount(config).CreateCloudBlobClient();
        }
        /// <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(IHostV40 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, SettingsTable);
            TableStorage.CreateTable(config, MetadataTable);
            TableStorage.CreateTable(config, RecentChangesTable);
            TableStorage.CreateTable(config, OutgoingLinksTable);
            TableStorage.CreateTable(config, AclEntriesTable);
            TableStorage.CreateTable(config, PluginsTable);
        }
        /// <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(IHostV40 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();

            _context = TableStorage.GetContext(config);

            _aclManager = new AzureTableStorageAclManager(StoreEntry, DeleteEntries, RenameAclResource, RetrieveAllAclEntries, RetrieveAclEntriesForResource, RetrieveAclEntriesForSubject);
        }
Ejemplo n.º 29
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(IHostV40 host, string config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            this.host = host;

            if (config == null)
            {
                config = "";
            }

            ValidateConnectionString(config);

            connString = config;

            CreateOrUpdateDatabaseIfNecessary();
        }
Ejemplo n.º 30
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(IHostV40 host, string config)
 {
     // Nothing to do.
 }