Exemplo n.º 1
0
 public ClusterState(IUserConfig csmConfig, IAdminConfig wrpConfig, ClusterNodeConfig nodeConfig, ClusterExternalState externalState)
 {
     this.CSMConfig     = csmConfig;
     this.WRPConfig     = wrpConfig;
     this.NodeConfig    = nodeConfig;
     this.ExternalState = externalState;
 }
Exemplo n.º 2
0
        public virtual ILoginUser RemoteLogin(string username, string password)
        {
            ILoginUser loginUser = null;

            IUserConfig user = SystemContext.UserConfigManager.GetConfig(username);

            if (user != null && user.Password.Equals(password))
            {
                lock (mLoginUserTable.SyncRoot)
                {
                    foreach (ILoginUser curuser in mLoginUserTable.Values)
                    {
                        if (curuser != null && curuser.Name.Equals(username))
                        {
                            if (!user.MultiLogin)
                            {
                                return(null);
                            }
                            break;
                        }
                    }

                    loginUser = new CLoginUser(user);
                    mLoginUserTable.Add(loginUser.LoginKey, loginUser);
                }
                user.RefreshACL();
            }

            return(loginUser);
        }
Exemplo n.º 3
0
        private ICustomConfigAssemblyInspector CreateAppDomain()
        {
            AppDomainSetup setup = new AppDomainSetup();


#if DEBUG
            setup.ApplicationBase = @"E:\db4object\db4o\Trunk\omn\OMADDIN\bin\";
#else
            setup.ApplicationBase = CommonForAppDomain.GetPath() + "\\";
#endif


            setup.ShadowCopyDirectories              = Path.GetTempPath();
            setup.ShadowCopyFiles                    = "true";
            workerAppDomain                          = AppDomain.CreateDomain("CustomConfigWorkerAppDomain", null, setup);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            object anObject = workerAppDomain.CreateInstanceAndUnwrap("OMCustomConfigImplementation",
                                                                      "OMCustomConfigImplementation.CustomConfigAssemblyInfo.CustomConfigAssemblyInspector");
            ICustomConfigAssemblyInspector customConfigAssemblyInspector = anObject as ICustomConfigAssemblyInspector;

            object anObject1 = workerAppDomain.CreateInstanceAndUnwrap("OMCustomConfigImplementation",
                                                                       "OMCustomConfigImplementation.UserCustomConfig.UserConfig");
            IUserConfig conn = anObject1 as IUserConfig;
            CustomConfigInspectorObject.CustomUserConfig = conn;

            return(customConfigAssemblyInspector);
        }
Exemplo n.º 4
0
        public virtual byte[] Convert(IUserConfig document)
        {
            if (!document.GetConfigs().Any())
            {
                throw new ArgumentException("At least one object must be defined.");
            }

            ProcessingDocument = document;

            var result = new byte[0];

            wkHtmlToXService.Load();

            var converter = CreateConverter(document);

            // register events

            wkHtmlToXService.SetPhaseChangedCallback(converter, OnPhaseChanged);
            wkHtmlToXService.SetProgressChangedCallback(converter, OnProgressChanged);
            wkHtmlToXService.SetFinishedCallback(converter, OnFinished);
            wkHtmlToXService.SetWarningCallback(converter, OnWarning);
            wkHtmlToXService.SetErrorCallback(converter, OnError);

            var converted = wkHtmlToXService.DoConversion(converter);

            if (converted)
            {
                result = wkHtmlToXService.GetConversionResult(converter);
            }

            wkHtmlToXService.DestroyConverter(converter);

            return(result);
        }
        protected static List <SettingsTypeSection> GenerateRepairManagerSection(IUserConfig targetCsmConfig)
        {
            List <SettingsTypeSection> result = new List <SettingsTypeSection>();

            bool intendToCreate = targetCsmConfig.AddonFeatures.Contains(AddonFeature.RepairManager);

            if (intendToCreate)
            {
                List <SettingsTypeSectionParameter> parameterList = new List <SettingsTypeSectionParameter>()
                {
                    new SettingsTypeSectionParameter
                    {
                        Name  = StringConstants.ParameterName.EnableHealthChecks,
                        Value = true.ToString()
                    }
                };
                parameterList.AddRange(StandAloneFabricSettingsGenerator.GenerateStatefulSvcReplicaParameters(targetCsmConfig));

                result.Add(
                    new SettingsTypeSection
                {
                    Name      = StringConstants.SectionName.RepairManager,
                    Parameter = parameterList.ToArray(),
                });
            }

            return(result);
        }
Exemplo n.º 6
0
        public override byte[] Convert(IUserConfig document)
        {
            StartThreadIfNotStarted();

            var task = new Task <byte[]>(() => base.Convert(document));

            lock (task)
            {
                // add task to blocking collection

                conversionsQueue.Add(task);

                // wait for task to be processed by conversion thread

                Monitor.Wait(task);
            }

            // throw exception that happened during conversion

            if (task.Exception != null)
            {
                throw task.Exception;
            }

            return(task.Result);
        }
Exemplo n.º 7
0
        public CLoginUser(IUserConfig loginUser, string loginKey)
        {
            mUserConfig = loginUser;
            mLoginKey   = loginKey;

            DoLogin();
        }
Exemplo n.º 8
0
        public MockupCluster(IAdminConfig adminConfig, IUserConfig userConfig, IClusterTopology topology, ITraceLogger traceLogger)
        {
            this.TargetWrpConfig        = adminConfig;
            this.TargetCsmConfig        = userConfig;
            this.Topology               = topology;
            this.ClusterManifestVersion = 0;
            this.SeedNodeSelector       = new SeedNodeSelector(new TimeSpan(0, 1, 0), new MockupTraceLogger());
            this.SetStateMachine(traceLogger);
            this.SetGeneratorSettings();

            this.fabricSettingsActivator = new Lazy <IFabricSettingsActivator>(() =>
            {
                return(new MockupFabricSettingsActivator());
            });

            this.NodeTypeNodeStatusList = new Dictionary <string, SortedList <string, NodeStatus> >();
            this.TargetCsmConfig.NodeTypes.ForEach(nodeType => this.NodeTypeNodeStatusList.Add(nodeType.Name, new SortedList <string, NodeStatus>()));

            foreach (var node in this.Topology.Nodes)
            {
                this.NodeTypeNodeStatusList[node.Value.NodeTypeRef].Add(
                    node.Key,
                    new NodeStatus()
                {
                    NodeName               = node.Value.NodeName,
                    InstanceId             = 0,
                    NodeDeactivationIntent = WrpNodeDeactivationIntent.Invalid,
                    NodeState              = NodeState.Enabled,
                    NodeType               = node.Value.NodeTypeRef
                });
            }
        }
Exemplo n.º 9
0
        public ProcessorVM(
            IAppConfig appConfig,
            IUserConfig userConfig,
            IIndex <ImportType, IImporter> importers,
            IIndex <ExportType, IExporter> exporters,
            IIndex <ProcessorType, IRouteProcessor> snapProcessors,
            IJ4JLogger?logger)
        {
            _logger = logger;
            _logger?.SetLoggedType(GetType());

            _appConfig = appConfig;

            if (_logger != null)
            {
                _logger.LogEvent += DisplayLogEventAsync;
            }

            _userConfig = userConfig;

            _importers      = importers;
            _exporters      = exporters;
            _snapProcessors = snapProcessors;

            AbortCommand        = new RelayCommand <ProcessWindow>(AbortCommandHandler);
            WindowLoadedCommand = new AsyncRelayCommand(WindowLoadedCommandAsync);
        }
        protected static List <SettingsTypeSection> GenerateDnsServiceSection(IUserConfig targetCsmConfig)
        {
            List <SettingsTypeSection> result = new List <SettingsTypeSection>();

            bool intendToCreate = targetCsmConfig.AddonFeatures.Contains(AddonFeature.DnsService);

            if (intendToCreate)
            {
                List <SettingsTypeSectionParameter> parameterList = new List <SettingsTypeSectionParameter>()
                {
                    new SettingsTypeSectionParameter
                    {
                        Name  = StringConstants.ParameterName.IsEnabled,
                        Value = true.ToString(),
                    }
                };

                int instanceCount = targetCsmConfig.IsScaleMin ? 1 : -1;
                parameterList.AddRange(StandAloneFabricSettingsGenerator.GenerateStatelessSvcInstanceParameters(instanceCount));

                result.Add(
                    new SettingsTypeSection
                {
                    Name      = StringConstants.SectionName.DnsService,
                    Parameter = parameterList.ToArray(),
                });
            }

            return(result);
        }
Exemplo n.º 11
0
        protected bool SetConfig()
        {
            if (mConfig == null && mManager != null)
            {
                mConfig = mManager.CreateConfigInstance();
            }

            if (mConfig != null)
            {
                (mConfig as CConfig).Name = textBox_name.Text;
                mConfig.SetValue("Name", textBox_name.Text);
                mConfig.Desc = mConfig.Name;

                mConfig.Password   = mOldPassword.Equals("") ? CommonUtil.ToMD5Str(textBox_password.Text) : mOldPassword;
                mConfig.MultiLogin = checkBox_multiLogin.Checked;
                mConfig.Enabled    = checkBox_enabled.Checked;

                mConfig.RoleList = "";
                if (listBox_role_user.Items.Count > 0)
                {
                    foreach (IRoleConfig config in listBox_role_user.Items)
                    {
                        if (config != null)
                        {
                            mConfig.RoleList += config.Name + ";";
                        }
                    }
                }

                return(true);
            }
            return(false);
        }
 public StandAloneInstallerJSONModelOctober2017(IUserConfig config, IClusterTopology topology, string configurationVersion)
     : base(config, topology, configurationVersion)
 {
     this.ApiVersion = StandAloneInstallerJSONModelOctober2017.ModelApiVersion;
     this.Properties = new PropertyOctober2017();
     this.Properties.UpdateFromUserConfig(config);
 }
Exemplo n.º 13
0
        internal static StandAloneInstallerJsonModelBase ConstructByApiVersion(
            IUserConfig config,
            IClusterTopology topology,
            string configurationVersion,
            string apiVersion)
        {
            Type modelType;

            if (string.IsNullOrWhiteSpace(apiVersion))
            {
                // backward compatibility:
                //      At powershell layer, apiVersion is not required.
                //      At REST layer, apiVersion is not required for api-version prior to 6.0.
                modelType = StandAloneInstallerJsonModelBase.apiVersionTable.Last().Item2;
            }
            else
            {
                var entry = StandAloneInstallerJsonModelBase.apiVersionTable.FirstOrDefault(p => p.Item1 == apiVersion);
                if (entry != null)
                {
                    modelType = entry.Item2;
                }
                else
                {
                    throw new NotSupportedException(apiVersion + " is not supported!");
                }
            }

            return((StandAloneInstallerJsonModelBase)Activator.CreateInstance(modelType, config, topology, configurationVersion));
        }
Exemplo n.º 14
0
 internal virtual void UpdateFromUserConfig(IUserConfig userConfig)
 {
     this.FabricClusterAutoupgradeEnabled = userConfig.AutoupgradeEnabled;
     this.DiagnosticsStore = userConfig.DiagnosticsStoreInformation;
     this.EnableTelemetry  = userConfig.EnableTelemetry;
     this.FabricSettings   = userConfig.FabricSettings;
 }
Exemplo n.º 15
0
        private string GetTargetPath(IUserConfig userConfig, string urlName, int width)
        {
            var filename = PathUtils.SanitizeFileName($"{urlName}_{width}.jpg");
            var filePath = Path.Combine(userConfig.TargetDirectoryReplaced, filename);

            return(PathUtils.MapPath(filePath));
        }
Exemplo n.º 16
0
        // this constructor is intended for use at design-time only
#pragma warning disable 8618
        public OptionsVM()
#pragma warning restore 8618
        {
            _appConfig  = new MockAppConfig();
            _userConfig = new MockUserConfig();

            SettingsChanged = false;
        }
Exemplo n.º 17
0
 internal virtual void UpdateUserConfig(IUserConfig userConfig, List <NodeDescriptionGA> nodes)
 {
     userConfig.EnableTelemetry = this.EnableTelemetry;
     userConfig.FabricSettings  = this.FabricSettings;
     userConfig.DiagnosticsStorageAccountConfig = null;
     userConfig.DiagnosticsStoreInformation     = this.DiagnosticsStore;
     userConfig.AutoupgradeEnabled = this.FabricClusterAutoupgradeEnabled ?? !userConfig.IsScaleMin;
 }
Exemplo n.º 18
0
        internal override void UpdateFromUserConfig(IUserConfig userConfig)
        {
            base.UpdateFromUserConfig(userConfig);

            if (userConfig.AddonFeatures != null)
            {
                this.AddonFeatures = userConfig.AddonFeatures;
            }
        }
 protected GatekeepingClusterUpgradeState(
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     ClusterNodeConfig targetNodeConfig,
     ICluster clusterResource,
     ITraceLogger traceLogger)
     : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger)
 {
 }
 internal override void FromInternal(
     IClusterTopology clusterTopology,
     IUserConfig userConfig,
     string apiVersion)
 {
     base.FromInternal(clusterTopology, userConfig, apiVersion);
     this.Properties = new PropertyOctober2017();
     this.Properties.UpdateFromUserConfig(userConfig);
 }
Exemplo n.º 21
0
 private void GetConfig(XPathNavigator nav)
 {
     _application = new ApplicationConfig(GetChild(nav, "application"), null);
     _constants   = new ConstantsConfig(GetChild(nav, "constants"), null);
     _encryption  = new EncryptionConfig(GetChild(nav, "encryption"), null);
     _email       = new EmailConfig(GetChild(nav, "email"), null);
     _user        = new UserConfig(GetChild(nav, "user"), null);
     _environment = new EnvironmentConfig(GetChild(nav, "environment"), null);
 }
Exemplo n.º 22
0
 public StandAloneAutoScaleClusterUpgradeState(
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     ClusterNodeConfig targetNodeConfig,
     ICluster clusterResource,
     ITraceLogger traceLogger)
     : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger)
 {
 }
Exemplo n.º 23
0
 public MockupSimpleClusterUpgradeState(
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     ClusterNodeConfig targetNodeConfig,
     ICluster clusterResource,
     ITraceLogger traceLogger)
     : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger)
 {
 }
 public GatekeepingClusterUpgradeState CreateGatekeepingClusterUpgradeState(
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     ClusterNodeConfig targetNodeConfig,
     ICluster clusterResource,
     ITraceLogger traceLogger)
 {
     return(new MockupGatekeepingClusterUpgradeState(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, traceLogger));
 }
 public BaselineClusterUpgradeStateBase CreateBaselineUpgradeState(
     IUserConfig csmConfig,
     IAdminConfig wrpConfig,
     ClusterNodeConfig nodeConfig,
     ICluster clusterResource,
     ITraceLogger traceLogger)
 {
     return(new MockupBaselineUpgradeState(csmConfig, wrpConfig, nodeConfig, clusterResource, traceLogger));
 }
Exemplo n.º 26
0
 protected ScaleDownClusterUpgradeStateBase(
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     ClusterNodeConfig targetNodeConfig,
     ICluster clusterResource,
     Dictionary <string, int> nodeDiffList,
     ITraceLogger traceLogger)
     : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, nodeDiffList, traceLogger)
 {
 }
Exemplo n.º 27
0
 public FabricSettingsGeneratorBase CreateLinuxSettingsGenerator(
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     FabricSettingsMetadata settingsMetadata,
     ClusterManifestType existingClusterManifest,
     ClusterManifestGeneratorSettings clusterManifestGeneratorSettings,
     ITraceLogger traceLogger)
 {
     throw new System.NotImplementedException();
 }
 public MockupScaleUpClusterUpgradeState(
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     ClusterNodeConfig targetNodeConfig,
     ICluster clusterResource,
     Dictionary <string, int> nodeDiffCountList,
     ITraceLogger traceLogger)
     : base(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, nodeDiffCountList, traceLogger)
 {
 }
 public ScaleDownClusterUpgradeStateBase CreateScaleDownClusterUpgradeStateBase(
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     ClusterNodeConfig targetNodeConfig,
     ICluster clusterResource,
     Dictionary <string, int> nodeDiffList,
     ITraceLogger traceLogger)
 {
     return(new MockupScaleDownClusterUpgradeState(targetCsmConfig, targetWrpConfig, targetNodeConfig, clusterResource, nodeDiffList, traceLogger));
 }
Exemplo n.º 30
0
        internal void VerifyJsonReplaceCertLists(
            IUserConfig csmConfig,
            string originalThumbprint,
            string newThumbprint)
        {
            string expectedPrimaryThumbprint   = newThumbprint;
            string expectedSecondaryThumbprint = null;

            Assert.AreEqual(expectedPrimaryThumbprint, csmConfig.Security.CertificateInformation.ClusterCertificate.Thumbprint);
            Assert.AreEqual(expectedSecondaryThumbprint, csmConfig.Security.CertificateInformation.ClusterCertificate.ThumbprintSecondary);
        }
Exemplo n.º 31
0
        public static void ClearAll()
        {
            CustomConfigAssemblyInspector = null;
            CustomUserConfig = null;

        }