public RemoteActorRegistryBuilder(RegistryBuilder builder, Uri listenUri, FiberFactory fiberFactory,
		                                  Func<Serializer> serializerFactory)
		{
			_builder = builder;
			_serializerFactory = serializerFactory;
			_listenUri = listenUri;
			_fiberFactory = fiberFactory;
		}
示例#2
0
 public RemoteActorRegistryBuilder(RegistryBuilder builder, Uri listenUri, FiberFactory fiberFactory,
                                   Func <Serializer> serializerFactory)
 {
     _builder           = builder;
     _serializerFactory = serializerFactory;
     _listenUri         = listenUri;
     _fiberFactory      = fiberFactory;
 }
 public ContractConfigurationBuilder UnionOf(IEnumerable <string> contractNames)
 {
     if (contracts.Count != 1)
     {
         const string messageFormat = "UnionOf can be applied to single contract, current contracts [{0}]";
         throw new SimpleContainerException(string.Format(messageFormat, contracts.JoinStrings(", ")));
     }
     RegistryBuilder.DefineContractsUnion(contracts[0], contractNames.ToList());
     return(this);
 }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JobbrServer"/> class.
        /// </summary>
        public JobbrServer(IJobScheduler scheduler, IJobExecutor jobExecutor, IJobStorageProvider jobStorageProvider, List <IJobbrComponent> components, MessageDispatcher messageDispatcher, ConfigurationManager configurationManager, RegistryBuilder registryBuilder)
        {
            Logger.Debug("A new instance of a a JobbrServer has been created.");

            this.scheduler = scheduler;
            this.executor  = jobExecutor;

            this.components           = components;
            this.configurationManager = configurationManager;
            this.registryBuilder      = registryBuilder;
            this.jobStorageProvider   = jobStorageProvider;

            messageDispatcher.WireUp();
        }
示例#5
0
        public ActorRegistry CreateRegistry()
        {
            ValidateConfiguration();

            FiberFactory fiberFactory = GetConfiguredFiberFactory();
            Fiber        fiber        = fiberFactory();

            Scheduler scheduler = GetConfiguredScheduler();

            RegistryBuilder builder = _builderFactory(fiber, scheduler);

            return(_configurators
                   .Aggregate(builder, (current, configurator) => configurator.Configure(current))
                   .Build());
        }
        public TypeRegistry([NotNull] Compilation compilation)
        {
            var builder = new RegistryBuilder(compilation);

            builder.IncludePair("System.IO.Directory", "TestableFileSystem.Interfaces.IDirectory");
            builder.IncludePair("System.IO.DirectoryInfo", "TestableFileSystem.Interfaces.IDirectoryInfo");
            builder.IncludePair("System.IO.File", "TestableFileSystem.Interfaces.IFile");
            builder.IncludePair("System.IO.FileInfo", "TestableFileSystem.Interfaces.IFileInfo");
            builder.IncludePair("System.IO.FileSystemInfo", "TestableFileSystem.Interfaces.IFileSystemInfo");
            builder.IncludePair("System.IO.FileStream", "TestableFileSystem.Interfaces.IFileStream");

            typeMap = builder.Build();

            TestableExtensionTypes = new List <INamedTypeSymbol>
            {
                compilation.GetTypeByMetadataName("TestableFileSystem.Interfaces.FileExtensions"),
                compilation.GetTypeByMetadataName("TestableFileSystem.Interfaces.FileInfoExtensions")
            };

            IsComplete = builder.FoundAll && TestableExtensionTypes.All(x => x != null);
        }
        public TypeRegistry([NotNull] Compilation compilation)
        {
            var builder = new RegistryBuilder(compilation);

            builder.IncludePair("File", "IFile");
            builder.IncludePair("Directory", "IDirectory");
            builder.IncludePair("Path", "IPath");
            builder.IncludePair("FileInfo", "IFileInfo");
            builder.IncludePair("DirectoryInfo", "IDirectoryInfo");
            builder.IncludePair("FileSystemInfo", "IFileSystemInfo");
            builder.IncludePair("DriveInfo", "IDriveInfo");
            builder.IncludePair("FileStream", "IFileStream");
            builder.IncludePair("FileSystemWatcher", "IFileSystemWatcher");

            typeMap = builder.Build();

            TestableExtensionTypes = new List <INamedTypeSymbol>
            {
                compilation.GetTypeByMetadataName(CodeNamespace.Combine(CodeNamespace.TestableInterfaces, "FileExtensions")),
                compilation.GetTypeByMetadataName(CodeNamespace.Combine(CodeNamespace.TestableInterfaces, "FileInfoExtensions"))
            };

            IsComplete = typeMap.Any() && TestableExtensionTypes.All(x => x != null);
        }
示例#8
0
 public static string GetRegistryString(string sKey, string sPath, string sDefault)
 {
     return(RegistryBuilder.GetRegistryString(sKey, sPath, sDefault));
 }
示例#9
0
 public static bool SetRegistryString(string sKey, string sValue, string sPath)
 {
     return(RegistryBuilder.SetRegistryString(sKey, sValue, sPath));
 }
示例#10
0
 public static string EncryptExchangeConnectionHex()
 {
     return(RegistryBuilder.EncryptExchangeConnectionHex());
 }
示例#11
0
 public static string EncryptPCConnection()
 {
     return(RegistryBuilder.EncryptPCConnection());
 }
示例#12
0
        //public static Dictionary<string, string> GetRegistryEntries(string Registrypath)
        //            {

        //               string[] strOuterValueNames=null;

        //                //ConfigManager.SetConfigurationMode(ConfigManager.ConfigurationMode.AppConfig);
        //               try
        //               {
        //                   if (!String.IsNullOrEmpty(Registrypath))
        //                   {
        //                       RegKey = Registry.LocalMachine.OpenSubKey(Registrypath);
        //                       //cashmaster or odbc.ini settings
        //                       if (RegKey != null)
        //                       {
        //                           strOuterValueNames = RegKey.GetValueNames();
        //                           RegistryEntries.Clear();
        //                           foreach (string strOuterValues in strOuterValueNames)
        //                           {
        //                               // RegistryEntries.Add(Registrypath.Substring(Registrypath.LastIndexOf("\\") + 1) + '\\' + strOuterValues, RegKey.GetValue(strOuterValues).ToString());
        //                               RegistryEntries.Add(Registrypath + '\\' + strOuterValues, RegKey.GetValue(strOuterValues).ToString());

        //                           }
        //                           //inside cashmaster or odbc.ini
        //                           GetRegistryEntries(RegKey, Registrypath);
        //                       }

        //                   }
        //               }

        //               catch (Exception ex)
        //               {
        //                   LogManager.WriteLog("GetRegistryEntries" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
        //                   ExceptionManager.Publish(ex);
        //               }
        //                return RegistryEntries;
        //            }
        //private static void GetRegistryEntries(RegistryKey regKey,string strRegpath)
        //{
        //    try
        //    {
        //        strSubKeyNames = RegKey.GetSubKeyNames();
        //        foreach (string sKey in strSubKeyNames)
        //        {
        //            if (!String.IsNullOrEmpty(sKey))
        //            {
        //                strRegPath = strRegpath + "\\" + sKey;
        //                RegKey = Registry.LocalMachine.OpenSubKey(strRegPath);
        //                strValueNames = RegKey.GetValueNames();

        //                foreach (string sValue in strValueNames)
        //                {
        //                    //RegistryEntries.Add(sKey + "\\" + sValue, RegKey.GetValue(sValue).ToString());
        //                    RegistryEntries.Add(strRegPath + "\\" + sValue, RegKey.GetValue(sValue).ToString());
        //                }

        //                if (RegKey.SubKeyCount > 0)
        //                {
        //                    GetRegistryEntries(RegKey, strRegPath);
        //                }
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        LogManager.WriteLog("GetRegistryEntries" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
        //        ExceptionManager.Publish(ex);
        //    }
        //}
        #endregion

        public static bool SetRegistryEntries(Dictionary <string, string> dictSetregistry, string strPath)
        {
            return(RegistryBuilder.SetRegistryEntries(dictSetregistry, strPath));
        }
 public ContainerConfigurationBuilder ForAll(string description,
                                             Action <Type, ServiceConfigurationBuilder <object> > configure)
 {
     RegistryBuilder.Filtered(description, null, configure);
     return(this);
 }
 public ContainerConfigurationBuilder InheritorsOf(string description, Type baseType,
                                                   Action <Type, ServiceConfigurationBuilder <object> > configure)
 {
     RegistryBuilder.Filtered(description, baseType, configure);
     return(this);
 }
 public ContainerConfigurationBuilder RegisterImplementationSelector(ImplementationSelector s)
 {
     RegistryBuilder.RegisterImplementationSelector(s);
     return(this);
 }
示例#16
0
        public virtual CloseableHttpClient Build()
        {
            // Create main request executor
            HttpRequestExecutor requestExec = this.requestExec;

            if (requestExec == null)
            {
                requestExec = new HttpRequestExecutor();
            }
            HttpClientConnectionManager connManager = this.connManager;

            if (connManager == null)
            {
                LayeredConnectionSocketFactory sslSocketFactory = this.sslSocketFactory;
                if (sslSocketFactory == null)
                {
                    string[] supportedProtocols = systemProperties ? Split(Runtime.GetProperty("https.protocols"
                                                                                               )) : null;
                    string[] supportedCipherSuites = systemProperties ? Split(Runtime.GetProperty("https.cipherSuites"
                                                                                                  )) : null;
                    X509HostnameVerifier hostnameVerifier = this.hostnameVerifier;
                    if (hostnameVerifier == null)
                    {
                        hostnameVerifier = SSLConnectionSocketFactory.BrowserCompatibleHostnameVerifier;
                    }
                    if (sslcontext != null)
                    {
                        sslSocketFactory = new SSLConnectionSocketFactory(sslcontext, supportedProtocols,
                                                                          supportedCipherSuites, hostnameVerifier);
                    }
                    else
                    {
                        if (systemProperties)
                        {
                            sslSocketFactory = new SSLConnectionSocketFactory((SSLSocketFactory)SSLSocketFactory
                                                                              .GetDefault(), supportedProtocols, supportedCipherSuites, hostnameVerifier);
                        }
                        else
                        {
                            sslSocketFactory = new SSLConnectionSocketFactory(SSLContexts.CreateDefault(), hostnameVerifier
                                                                              );
                        }
                    }
                }
                PoolingHttpClientConnectionManager poolingmgr = new PoolingHttpClientConnectionManager
                                                                    (RegistryBuilder.Create <ConnectionSocketFactory>().Register("http", PlainConnectionSocketFactory
                                                                                                                                 .GetSocketFactory()).Register("https", sslSocketFactory).Build());
                if (defaultSocketConfig != null)
                {
                    poolingmgr.SetDefaultSocketConfig(defaultSocketConfig);
                }
                if (defaultConnectionConfig != null)
                {
                    poolingmgr.SetDefaultConnectionConfig(defaultConnectionConfig);
                }
                if (systemProperties)
                {
                    string s = Runtime.GetProperty("http.keepAlive", "true");
                    if (Sharpen.Runtime.EqualsIgnoreCase("true", s))
                    {
                        s = Runtime.GetProperty("http.maxConnections", "5");
                        int max = System.Convert.ToInt32(s);
                        poolingmgr.SetDefaultMaxPerRoute(max);
                        poolingmgr.SetMaxTotal(2 * max);
                    }
                }
                if (maxConnTotal > 0)
                {
                    poolingmgr.SetMaxTotal(maxConnTotal);
                }
                if (maxConnPerRoute > 0)
                {
                    poolingmgr.SetDefaultMaxPerRoute(maxConnPerRoute);
                }
                connManager = poolingmgr;
            }
            ConnectionReuseStrategy reuseStrategy = this.reuseStrategy;

            if (reuseStrategy == null)
            {
                if (systemProperties)
                {
                    string s = Runtime.GetProperty("http.keepAlive", "true");
                    if (Sharpen.Runtime.EqualsIgnoreCase("true", s))
                    {
                        reuseStrategy = DefaultConnectionReuseStrategy.Instance;
                    }
                    else
                    {
                        reuseStrategy = NoConnectionReuseStrategy.Instance;
                    }
                }
                else
                {
                    reuseStrategy = DefaultConnectionReuseStrategy.Instance;
                }
            }
            ConnectionKeepAliveStrategy keepAliveStrategy = this.keepAliveStrategy;

            if (keepAliveStrategy == null)
            {
                keepAliveStrategy = DefaultConnectionKeepAliveStrategy.Instance;
            }
            AuthenticationStrategy targetAuthStrategy = this.targetAuthStrategy;

            if (targetAuthStrategy == null)
            {
                targetAuthStrategy = TargetAuthenticationStrategy.Instance;
            }
            AuthenticationStrategy proxyAuthStrategy = this.proxyAuthStrategy;

            if (proxyAuthStrategy == null)
            {
                proxyAuthStrategy = ProxyAuthenticationStrategy.Instance;
            }
            UserTokenHandler userTokenHandler = this.userTokenHandler;

            if (userTokenHandler == null)
            {
                if (!connectionStateDisabled)
                {
                    userTokenHandler = DefaultUserTokenHandler.Instance;
                }
                else
                {
                    userTokenHandler = NoopUserTokenHandler.Instance;
                }
            }
            ClientExecChain execChain = new MainClientExec(requestExec, connManager, reuseStrategy
                                                           , keepAliveStrategy, targetAuthStrategy, proxyAuthStrategy, userTokenHandler);

            execChain = DecorateMainExec(execChain);
            HttpProcessor httpprocessor = this.httpprocessor;

            if (httpprocessor == null)
            {
                string userAgent = this.userAgent;
                if (userAgent == null)
                {
                    if (systemProperties)
                    {
                        userAgent = Runtime.GetProperty("http.agent");
                    }
                    if (userAgent == null)
                    {
                        userAgent = DefaultUserAgent;
                    }
                }
                HttpProcessorBuilder b = HttpProcessorBuilder.Create();
                if (requestFirst != null)
                {
                    foreach (IHttpRequestInterceptor i in requestFirst)
                    {
                        b.AddFirst(i);
                    }
                }
                if (responseFirst != null)
                {
                    foreach (HttpResponseInterceptor i in responseFirst)
                    {
                        b.AddFirst(i);
                    }
                }
                b.AddAll(new RequestDefaultHeaders(defaultHeaders), new RequestContent(), new RequestTargetHost
                             (), new RequestClientConnControl(), new RequestUserAgent(userAgent), new RequestExpectContinue
                             ());
                if (!cookieManagementDisabled)
                {
                    b.Add(new RequestAddCookies());
                }
                if (!contentCompressionDisabled)
                {
                    b.Add(new RequestAcceptEncoding());
                }
                if (!authCachingDisabled)
                {
                    b.Add(new RequestAuthCache());
                }
                if (!cookieManagementDisabled)
                {
                    b.Add(new ResponseProcessCookies());
                }
                if (!contentCompressionDisabled)
                {
                    b.Add(new ResponseContentEncoding());
                }
                if (requestLast != null)
                {
                    foreach (IHttpRequestInterceptor i in requestLast)
                    {
                        b.AddLast(i);
                    }
                }
                if (responseLast != null)
                {
                    foreach (HttpResponseInterceptor i in responseLast)
                    {
                        b.AddLast(i);
                    }
                }
                httpprocessor = b.Build();
            }
            execChain = new ProtocolExec(execChain, httpprocessor);
            execChain = DecorateProtocolExec(execChain);
            // Add request retry executor, if not disabled
            if (!automaticRetriesDisabled)
            {
                HttpRequestRetryHandler retryHandler = this.retryHandler;
                if (retryHandler == null)
                {
                    retryHandler = DefaultHttpRequestRetryHandler.Instance;
                }
                execChain = new RetryExec(execChain, retryHandler);
            }
            HttpRoutePlanner routePlanner = this.routePlanner;

            if (routePlanner == null)
            {
                SchemePortResolver schemePortResolver = this.schemePortResolver;
                if (schemePortResolver == null)
                {
                    schemePortResolver = DefaultSchemePortResolver.Instance;
                }
                if (proxy != null)
                {
                    routePlanner = new DefaultProxyRoutePlanner(proxy, schemePortResolver);
                }
                else
                {
                    if (systemProperties)
                    {
                        routePlanner = new SystemDefaultRoutePlanner(schemePortResolver, ProxySelector.GetDefault
                                                                         ());
                    }
                    else
                    {
                        routePlanner = new DefaultRoutePlanner(schemePortResolver);
                    }
                }
            }
            // Add redirect executor, if not disabled
            if (!redirectHandlingDisabled)
            {
                RedirectStrategy redirectStrategy = this.redirectStrategy;
                if (redirectStrategy == null)
                {
                    redirectStrategy = DefaultRedirectStrategy.Instance;
                }
                execChain = new RedirectExec(execChain, routePlanner, redirectStrategy);
            }
            // Optionally, add service unavailable retry executor
            ServiceUnavailableRetryStrategy serviceUnavailStrategy = this.serviceUnavailStrategy;

            if (serviceUnavailStrategy != null)
            {
                execChain = new ServiceUnavailableRetryExec(execChain, serviceUnavailStrategy);
            }
            // Optionally, add connection back-off executor
            BackoffManager            backoffManager            = this.backoffManager;
            ConnectionBackoffStrategy connectionBackoffStrategy = this.connectionBackoffStrategy;

            if (backoffManager != null && connectionBackoffStrategy != null)
            {
                execChain = new BackoffStrategyExec(execChain, connectionBackoffStrategy, backoffManager
                                                    );
            }
            Lookup <AuthSchemeProvider> authSchemeRegistry = this.authSchemeRegistry;

            if (authSchemeRegistry == null)
            {
                authSchemeRegistry = RegistryBuilder.Create <AuthSchemeProvider>().Register(AuthSchemes
                                                                                            .Basic, new BasicSchemeFactory()).Register(AuthSchemes.Digest, new DigestSchemeFactory
                                                                                                                                           ()).Register(AuthSchemes.Ntlm, new NTLMSchemeFactory()).Register(AuthSchemes.Spnego
                                                                                                                                                                                                            , new SPNegoSchemeFactory()).Register(AuthSchemes.Kerberos, new KerberosSchemeFactory
                                                                                                                                                                                                                                                      ()).Build();
            }
            Lookup <CookieSpecProvider> cookieSpecRegistry = this.cookieSpecRegistry;

            if (cookieSpecRegistry == null)
            {
                cookieSpecRegistry = RegistryBuilder.Create <CookieSpecProvider>().Register(CookieSpecs
                                                                                            .BestMatch, new BestMatchSpecFactory()).Register(CookieSpecs.Standard, new RFC2965SpecFactory
                                                                                                                                                 ()).Register(CookieSpecs.BrowserCompatibility, new BrowserCompatSpecFactory()).Register
                                         (CookieSpecs.Netscape, new NetscapeDraftSpecFactory()).Register(CookieSpecs.IgnoreCookies
                                                                                                         , new IgnoreSpecFactory()).Register("rfc2109", new RFC2109SpecFactory()).Register
                                         ("rfc2965", new RFC2965SpecFactory()).Build();
            }
            CookieStore defaultCookieStore = this.cookieStore;

            if (defaultCookieStore == null)
            {
                defaultCookieStore = new BasicCookieStore();
            }
            CredentialsProvider defaultCredentialsProvider = this.credentialsProvider;

            if (defaultCredentialsProvider == null)
            {
                if (systemProperties)
                {
                    defaultCredentialsProvider = new SystemDefaultCredentialsProvider();
                }
                else
                {
                    defaultCredentialsProvider = new BasicCredentialsProvider();
                }
            }
            return(new InternalHttpClient(execChain, connManager, routePlanner, cookieSpecRegistry
                                          , authSchemeRegistry, defaultCookieStore, defaultCredentialsProvider, defaultRequestConfig
                                          != null ? defaultRequestConfig : RequestConfig.Default, closeables != null ? new
                                          AList <IDisposable>(closeables) : null));
        }
示例#17
0
 private static Registry <ConnectionSocketFactory> GetDefaultRegistry()
 {
     return(RegistryBuilder.Create <ConnectionSocketFactory>().Register("http", PlainConnectionSocketFactory
                                                                        .GetSocketFactory()).Register("https", SSLConnectionSocketFactory.GetSocketFactory
                                                                                                          ()).Build());
 }
        public RegistryBuilder Configure(RegistryBuilder builder)
        {
            var remoteBuilder = new RemoteActorRegistryBuilder(builder, _listenUri, GetConfiguredFiberFactory(), _serializerFactory);

            return(remoteBuilder);
        }