Exemplo n.º 1
0
 public void Initialize(string componentName, string self = null, string baseComponentKeyName = null, IDxStoreEventLogger eventLogger = null, bool isZeroboxMode = false)
 {
     this.componentName = componentName;
     this.Self          = ((!string.IsNullOrEmpty(self)) ? self : Environment.MachineName);
     this.isZeroboxMode = isZeroboxMode;
     if (string.IsNullOrEmpty(this.DefaultStorageBaseDir))
     {
         this.DefaultStorageBaseDir = Utils.CombinePathNullSafe(isZeroboxMode ? "C:\\Exchange" : ExchangeSetupContext.InstallPath, string.Format("DxStore\\Database\\{0}", this.componentName));
         if (isZeroboxMode)
         {
             this.DefaultStorageBaseDir = this.DefaultStorageBaseDir + "\\ZeroBox\\" + this.Self;
         }
     }
     if (string.IsNullOrEmpty(baseComponentKeyName))
     {
         baseComponentKeyName = string.Format("SOFTWARE\\Microsoft\\ExchangeServer\\{0}\\DxStore\\{1}", "v15", this.componentName);
         if (isZeroboxMode)
         {
             baseComponentKeyName = baseComponentKeyName + "\\Zerobox\\" + this.Self;
         }
     }
     this.eventLogger          = eventLogger;
     this.ManagerConfigKeyName = baseComponentKeyName;
     this.ManagerConfig        = this.GetManagerConfig();
 }
Exemplo n.º 2
0
        public static ServiceEndpoint GetStoreManagerEndpoint(InstanceManagerConfig cfg, string target, bool isServerBinding, WcfTimeout timeout = null)
        {
            string endPointAddress = cfg.GetEndPointAddress(target);
            string bindingName     = cfg.ConstructUniqueBindingName(target);

            timeout = (timeout ?? cfg.DefaultTimeout);
            return(EndpointBuilder.ConstructAndInitializeEndpoint(typeof(IDxStoreManager), endPointAddress, bindingName, timeout, isServerBinding));
        }
Exemplo n.º 3
0
        public InstanceManagerConfig GetManagerConfig()
        {
            InstanceManagerConfig instanceManagerConfig = new InstanceManagerConfig();

            instanceManagerConfig.NameResolver   = this;
            instanceManagerConfig.Self           = this.Self;
            instanceManagerConfig.ComponentName  = this.componentName;
            instanceManagerConfig.IsZeroboxMode  = this.isZeroboxMode;
            instanceManagerConfig.NetworkAddress = instanceManagerConfig.NameResolver.ResolveNameBestEffort(this.Self);
            instanceManagerConfig.DefaultTimeout = new WcfTimeout();
            using (RegistryKey registryKey = this.OpenManagerConfigKey(false))
            {
                instanceManagerConfig.BaseStorageDir          = Environment.ExpandEnvironmentVariables(RegUtils.GetProperty <string>(registryKey, "BaseStorageDir", this.DefaultStorageBaseDir));
                instanceManagerConfig.InstanceMonitorInterval = RegUtils.GetLongPropertyAsTimeSpan(registryKey, "InstanceMonitorIntervalInMSec", TimeSpan.FromSeconds(15.0));
                instanceManagerConfig.EndpointPortNumber      = RegUtils.GetProperty <int>(registryKey, "EndpointPortNumber", 808);
                instanceManagerConfig.EndpointProtocolName    = RegUtils.GetProperty <string>(registryKey, "EndpointProtocolName", "net.tcp");
                instanceManagerConfig.DefaultTimeout          = RegUtils.GetWcfTimeoutProperty(registryKey, "DefaultTimeout", new WcfTimeout());
                instanceManagerConfig.ManagerStopTimeout      = RegUtils.GetLongPropertyAsTimeSpan(registryKey, "ManagerStopTimeoutInMSec", TimeSpan.FromMinutes(1.0));
                CommonSettings defaultSettings = this.CreateDefaultCommonSettings(instanceManagerConfig.EndpointPortNumber, instanceManagerConfig.EndpointProtocolName, instanceManagerConfig.DefaultTimeout);
                instanceManagerConfig.Settings = new CommonSettings();
                this.GetInheritableSettings(this.GetManagerSettingsKeyName(), instanceManagerConfig.Settings, defaultSettings);
            }
            return(instanceManagerConfig);
        }
 public ManagerClientFactory(InstanceManagerConfig managerConfig, WcfTimeout timeout = null)
 {
     this.FactoryByTarget = new ConcurrentDictionary <string, Tuple <CachedChannelFactory <IDxStoreManager>, DxStoreManagerClient> >();
     this.managerConfig   = managerConfig;
     this.DefaultTimeout  = timeout;
 }
Exemplo n.º 5
0
 public static string ConstructUniqueBindingName(this InstanceManagerConfig cfg, string target)
 {
     target = ExtensionMethods.ResolveTarget(cfg.Self, target);
     return(EndpointBuilder.ConstructUniqueBindingName(target, cfg.ComponentName, cfg.EndpointProtocolName, "Manager", null, cfg.IsZeroboxMode));
 }
Exemplo n.º 6
0
        public static string GetEndPointAddress(this InstanceManagerConfig cfg, string target)
        {
            string networkAddress = EndpointBuilder.GetNetworkAddress(cfg.Self, target, cfg.NetworkAddress, cfg.NameResolver, false);

            return(EndpointBuilder.ConstructEndpointAddress("Manager", cfg.ComponentName, cfg.Self, target, networkAddress, null, cfg.IsZeroboxMode, cfg.EndpointPortNumber, cfg.EndpointProtocolName));
        }