Example #1
0
 public SchemaConfig(string name,
                     string dataNode,
                     string group,
                     bool keepSqlSchema,
                     IDictionary<string, TableConfig> tables)
 {
     Name = name;
     DataNode = dataNode;
     Group = group;
     Tables = tables;
     IsNoSharding = tables == null || tables.IsEmpty();
     MetaDataNodes = BuildMetaDataNodes();
     AllDataNodes = BuildAllDataNodes();
     IsKeepSqlSchema = keepSqlSchema;
 }
Example #2
0
        public void InstallPackagesFromVSExtensionRepository(string extensionId, bool isPreUnzipped, bool skipAssemblyReferences, bool ignoreDependencies, Project project, IDictionary<string, string> packageVersions)
        {
            if (String.IsNullOrEmpty(extensionId))
            {
                throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "extensionId");
            }

            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (packageVersions.IsEmpty())
            {
                throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "packageVersions");
            }

            var preinstalledPackageInstaller = new PreinstalledPackageInstaller(_websiteHandler, _packageServices, _vsCommonOperations, _solutionManager);
            var repositoryPath = preinstalledPackageInstaller.GetExtensionRepositoryPath(extensionId, _vsExtensionManager, ThrowError);

            var config = GetPreinstalledPackageConfiguration(isPreUnzipped, skipAssemblyReferences, ignoreDependencies, packageVersions, repositoryPath);
            preinstalledPackageInstaller.PerformPackageInstall(this, project, config, RepositorySettings, ShowWarning, ThrowError);
        }
 /// <param name="extFuncPrototypeMap">
 ///     funcName -&gt; extFunctionPrototype. funcName
 ///     MUST NOT be the same as predefined function of MySql 5.5
 /// </param>
 /// <exception cref="System.ArgumentException" />
 public virtual void AddExtendFunction(IDictionary<string, FunctionExpression> extFuncPrototypeMap)
 {
     if (extFuncPrototypeMap == null || extFuncPrototypeMap.IsEmpty())
     {
         return;
     }
     if (!allowFuncDefChange)
     {
         throw new NotSupportedException("function define is not allowed to be changed");
     }
     lock (this)
     {
         var toPut = new Dictionary<string, FunctionExpression>();
         // check extFuncPrototypeMap
         foreach (var en in extFuncPrototypeMap)
         {
             var funcName = en.Key;
             if (funcName == null)
             {
                 continue;
             }
             var funcNameUp = funcName.ToUpper();
             if (functionPrototype.ContainsKey(funcNameUp))
             {
                 throw new ArgumentException("ext-function '" + funcName + "' is MySql's predefined function!");
             }
             var func = en.Value;
             if (func == null)
             {
                 throw new ArgumentException("ext-function '" + funcName + "' is null!");
             }
             toPut[funcNameUp] = func;
         }
         functionPrototype.AddRange(toPut);
     }
 }
Example #4
0
		/// <exception cref="System.IO.IOException"></exception>
		private HttpURLConnection Open(string method, string bucket, string key, IDictionary
			<string, string> args)
		{
			StringBuilder urlstr = new StringBuilder();
			urlstr.Append("http://");
			urlstr.Append(bucket);
			urlstr.Append('.');
			urlstr.Append(DOMAIN);
			urlstr.Append('/');
			if (key.Length > 0)
			{
				HttpSupport.Encode(urlstr, key);
			}
			if (!args.IsEmpty())
			{
				Iterator<KeyValuePair<string, string>> i;
				urlstr.Append('?');
				i = args.EntrySet().Iterator();
				while (i.HasNext())
				{
					KeyValuePair<string, string> e = i.Next();
					urlstr.Append(e.Key);
					urlstr.Append('=');
					HttpSupport.Encode(urlstr, e.Value);
					if (i.HasNext())
					{
						urlstr.Append('&');
					}
				}
			}
			Uri url = new Uri(urlstr.ToString());
			Proxy proxy = HttpSupport.ProxyFor(proxySelector, url);
			HttpURLConnection c;
			c = (HttpURLConnection)url.OpenConnection(proxy);
			c.SetRequestMethod(method);
			c.SetRequestProperty("User-Agent", "jgit/1.0");
			c.SetRequestProperty("Date", HttpNow());
			return c;
		}
Example #5
0
		private string ReplaceUri(string uri, IDictionary<string, string> replacements)
		{
			if (replacements.IsEmpty())
			{
				return uri;
			}
			KeyValuePair<string, string>? match = null;
			foreach (KeyValuePair<string, string> replacement in replacements.EntrySet())
			{
				// Ignore current entry if not longer than previous match
				if (match != null && match.Value.Key.Length > replacement.Key.Length)
				{
					continue;
				}
				if (!uri.StartsWith(replacement.Key))
				{
					continue;
				}
				match = replacement;
			}
			if (match != null)
			{
				return match.Value.Value + Sharpen.Runtime.Substring(uri, match.Value.Key.Length);
			}
			else
			{
				return uri;
			}
		}