public InternalSqliteConnectionDialog(MsSqlAuditorModel model) { this._model = model; this._storage = model.DefaultVaultProcessor.CurrentStorage; this._connectionsManager = new ConnectionsManager(model); this._loginManager = new LoginManager(this._storage); this._templateManager = new TemplateManager(this._storage); this._templates = TemplateNodesLoader.GetTemplates(); InitializeComponent(); List <BindingWrapper <ConnectionType> > connectionTypes = this._model.ConnectionTypes; this.dataTypeBindingSource.DataSource = connectionTypes; this.dataTypeBindingSource.DataMember = "Item"; this.cmbDataType.DataSource = dataTypeBindingSource.DataSource; this.cmbDataType.SelectionChangeCommitted += this.cmbDataType_SelectedIndexChanged; this.cmbConnectionGroup.SelectionChangeCommitted += this.cmbConnectionGroup_SelectedIndexChanged; this.cmbServerInstance.SelectionChangeCommitted += this.cmbServerInstance_SelectedIndexChanged; this.cmbTemplate.SelectionChangeCommitted += this.cmbTemplate_SelectedIndexChanged; this.cmbLogin.SelectionChangeCommitted += this.cmbLogin_SelectedIndexChanged; if (connectionTypes.Count > 0) { UpdateConnectionGroupList(); } UpdateButtonsState(); }
public ScheduleSettingsTable(CurrentStorage storage) : base( storage, GetTableDefinition() ) { }
/// <summary> /// Initialize wrapper /// </summary> public static void Initialize() { _model = new MsSqlAuditorModel(); _model.Initialize(); _storage = _model.DefaultVaultProcessor.CurrentStorage; _serviceDataUpdateTimeout = _model.Settings.SystemSettings.ServiceDataUpdateTimeout; _serviceRunJobsTimeout = _model.Settings.SystemSettings.ServiceRunJobsTimeout; _serviceStarted = DateTime.Now; _scheduleJobProcessor = new ScheduleJobProcessor(_storage); _connectionsManager = new ConnectionsManager(_model); _scheduleSettingsManager = new ScheduleSettingsManager(_storage); _runningTasks = new ConcurrentDictionary <string, string>(); _databaseNodeInstances = new ConcurrentDictionary <long, NodeInstanceRow>(); _serviceNodeInstances = new ConcurrentDictionary <long, NodeInstanceRow>(); _serviceSchedules = new ConcurrentDictionary <long, ScheduleSettingsRow>(); _databaseSchedules = new ConcurrentDictionary <long, ScheduleSettingsRow>(); _connectionGroups = new List <ConnectionGroupInfo>(); LoadFromDB(true); log.DebugFormat( @"Active scheduled Instances:'{0}' Active schedules: '{1}'", _serviceNodeInstances.Count, _serviceSchedules.Count ); }
public void Init() { IStorageManager storageManager = Program.Model.GetVaultProcessor(this._ctNodeDefinition.Connection); CurrentStorage storage = storageManager.CurrentStorage; this._ctNodeDefinition.TemplateNode.LoadUserParameters(storage); ParseNode(this._ctNodeDefinition.TemplateNode); if (this._dicParameters.Any()) { Queries.RaiseListChangedEvents = false; Queries.Clear(); foreach (var query in this._dicParameters.Keys) { Queries.Add(query); } Queries.RaiseListChangedEvents = true; var fquery = Queries.FirstOrDefault(); if (fquery != null) { SelectedQuery = fquery; } } }
public ConnectionsManager(MsSqlAuditorModel model) { CurrentStorage storage = model.DefaultVaultProcessor.CurrentStorage; this._groupManager = new ConnectionGroupManager(storage); this._instanceManager = new ServerInstanceManager(storage); this._loginManager = new LoginManager(storage); }
public SqliteInternalQueryConnection( CurrentStorage currentStorage, InstanceInfo instance ) : base(ConnectionFactory.CreateSQLiteConnection(currentStorage.FileName, false)) { this._instance = instance; this._currentScope = currentStorage; }
public TemplateNodeQueryGroupDirectory( CurrentStorage storage ) : base( storage, CreateTableDefinition() ) { }
public ServerInstanceDirectory( CurrentStorage storage ) : base( storage, CreateTableDefinition() ) { }
public QueryParameterDirectory( CurrentStorage storage ) : base( storage, CreateTableDefinition() ) { }
public QueryResultsDirectory( CurrentStorage storage ) : base( storage, CreateTableDefinition() ) { }
public TemplateDirectory( CurrentStorage storage ) : base( storage, CreateTableDefinition() ) { }
public DynamicConnectionDirectory( CurrentStorage storage ) : base( storage, CreateTableDefinition() ) { }
public SqliteInternalQueryCommand( SQLiteCommand command, CurrentStorage currentScope, InstanceInfo instanceInfo ) : base(command) { this._instanceInfo = instanceInfo; this._currentStorage = currentScope; }
/// <summary> /// Constructor /// </summary> /// <param name="connection"></param> /// <param name="tableDefinition"></param> /// <param name="readOnly">Is table read-only?</param> /// <param name="tableName">Table name</param> protected TableDirectory( CurrentStorage storage, TableDefinition tableDefinition ) : base( storage, tableDefinition ) { }
protected QueryDirectoryBase( CurrentStorage storage, TableDefinition tableDefinition ) : base( storage, tableDefinition ) { }
public void LoadUserParameters(CurrentStorage storage) { QueryDirectories queryDirectories = QueryDirectories.GetInstance(storage, false); LoadUserParameters(Queries, queryDirectories); QueryDirectories groupQueryDirectories = QueryDirectories.GetInstance(storage, true); LoadUserParameters(GroupQueries, groupQueryDirectories); }
public static ServerProperties Load( InstanceInfo instance, CurrentStorage storage ) { ServerProperties storedProps = storage.ServerInstanceDirectory .GetServerProperties(instance); return(storedProps); }
public ServerProperties LoadServerProperties(CurrentStorage storage) { ServerProperties storedProps = ServerProperties.Load(this, storage); if (storedProps != null) { this._serverProperties = storedProps; } return(this._serverProperties); }
public CreateDirectConnectionDialog(MsSqlAuditorModel model) { this._model = model; this._storage = this._model.DefaultVaultProcessor.CurrentStorage; this._connectionsManager = new ConnectionsManager(model); SetLocale(); InitializeComponent(); InitializeEventHandlers(); InitializeBindings(); }
public static QueryDirectories GetInstance(CurrentStorage storage, bool isGroupQuery) { if (isGroupQuery) { return(new QueryDirectories( storage.QueryGroupDirectory, storage.QueryGroupParameterDirectory )); } return(new QueryDirectories( storage.QueryDirectory, storage.QueryParameterDirectory )); }
public bool?IsAvailableForDatabase(MsSqlAuditorModel sqlAuditor) { if (TemplateNode.ConnectionQueries.Count > 0) { return(true); } CurrentStorage storage = sqlAuditor.GetVaultProcessor(Connection).CurrentStorage; int timeout = sqlAuditor.Settings.SqlTimeout; List <InstanceVersion> versions = Connection.Connections.Select(cnn => { try { return(cnn.InitServerProperties(storage, timeout).Version); } catch (Exception ex) { log.Error("Error in get version.", ex); return(new InstanceVersion()); } } ).ToList(); List <QuerySource> queriesTypes = Connection.Connections.Select(x => x.Type).ToList(); if (TemplateNode.Queries.Count == 0) { return(true); } return(TemplateNode.Queries.Any(x => { List <QueryInfo> queries = sqlAuditor.GetQueryByTemplateNodeQueryInfo(x) .Where(y => queriesTypes.Contains(y.Source) || y.Source == QuerySource.SQLite) .ToList(); return versions.Distinct().Any( version => queries.Any( queryInfo => queryInfo.Items.GetQueryItemForVersion(version) != null)); })); }
private int?LoadNodeCounterValue(TreeNode treeNode) { if (treeNode == null) { return(null); } ConcreteTemplateNodeDefinition nodeDefinition = treeNode.Tag as ConcreteTemplateNodeDefinition; if (nodeDefinition == null) { return(null); } long handle = nodeDefinition.ComputeHandle(); lock (this._lockObj) { if (this._nodeCountMap.ContainsKey(handle)) { return(this._nodeCountMap[handle]); } } TemplateNodeInfo templateNode = nodeDefinition.TemplateNode; CurrentStorage storage = GetStorage(templateNode.ConnectionGroup); int? count = storage.GetTreeNodeCounterValue(templateNode); lock (this._lockObj) { if (this._nodeCountMap.ContainsKey(handle)) { this._nodeCountMap[handle] = count; } else { this._nodeCountMap.Add(handle, count); } } return(count); }
public SqliteInnerQueryConnection( CurrentStorage currentStorage, SqliteConnectionParameters connectionParameters ) : base( ConnectionFactory.CreateSQLiteConnection(currentStorage.FileName, true) ) { SqliteConnectionParameters.Values paramValues = connectionParameters.Resolve(currentStorage); if (paramValues == null) { const string errorMessage = "Can not resolve SQLite internal connection parameters"; Log.Error(errorMessage); throw new ArgumentException(errorMessage, "connectionParameters"); } this._paramValues = paramValues; }
public EditDirectConnectionDialog( MsSqlAuditorModel model, ConnectionGroupInfo connectionGroup ) { this._model = model; CurrentStorage storage = this._model.DefaultVaultProcessor.CurrentStorage; this._connectionsManager = new ConnectionsManager(model); this._connectionGroup = connectionGroup; this._updatesMade = false; SetLocale(); InitializeComponent(); InitializeEventHandlers(); InitializeBindings(); UpdateControlsState(); }
public ServerProperties InitServerProperties(CurrentStorage storage, int timeout = 0) { if (this._serverProperties == null) { try { this._serverProperties = ServerProperties.Query(this, timeout); storage.ServerInstanceDirectory.GetId(this.ConnectionGroup, this); // Save properties } catch (Exception exc) { log.WarnFormat( "Unable to retrieve instance version from remote server. Instance:'{0}';Authentication:'{1}';Exception:'{2}'", Instance, Authentication, exc ); ServerProperties storedProps = LoadServerProperties(storage); if (storedProps == null) { log.WarnFormat( "Instance version is not available. Instance:'{0}';Authentication:'{1}';Exception:'{2}'", Instance, Authentication, exc ); throw; } } } return(this._serverProperties); }
public UserSettingsManager() { this._currentStorage = Program.Model.DefaultVaultProcessor.CurrentStorage; }
private void RefreshNode( TreeTask treeTask, TreeJob parentJob, TreeNode treeNode, ProgressItem progress ) { ConcreteTemplateNodeDefinition nodeDefinition = treeNode.Tag as ConcreteTemplateNodeDefinition; if (treeTask.CancellationSource.IsCancellationRequested) { return; } if (nodeDefinition == null) { return; } TreeJob treeJob = new TreeJob(nodeDefinition); if (parentJob != null) { parentJob.AddChildJob(treeJob); treeJob.Parent = parentJob; } WeakReference treeNodeRef = new WeakReference(treeNode); treeTask.JobCompleted += (sender, args) => { TreeTask task = sender as TreeTask; if (task != null && treeNodeRef.IsAlive) { if (!task.CancellationSource.IsCancellationRequested) { TreeNode targetNode = (TreeNode)treeNodeRef.Target; UpdateTreeCounts(targetNode, task.Info.Mode); } } }; bool refreshChildren = treeTask.Info.Hierarchically; Action refreshNodeAction = () => { try { TemplateNodeInfo templateNode = nodeDefinition.TemplateNode; if (templateNode == null || !nodeDefinition.NodeAvailable) { return; } templateNode.LastUpdateNode = DateTime.Now; CurrentStorage storage = GetStorage(templateNode.ConnectionGroup); templateNode.LoadUserParameters(storage); if (nodeDefinition.NodeActivated) { RefreshQueries(treeTask, nodeDefinition, progress); } if (templateNode.IsLeaf()) { return; } AddLoadingNode(treeNode); templateNode.UpdateChildren(treeTask.Info.Mode, treeTask.CancellationSource); FillTreeNodes(templateNode, treeNode.Nodes); if (refreshChildren) { treeJob.PromisedChildCount = treeNode.Nodes.Count; foreach (TreeNode node in treeNode.Nodes) { if (node != null) { RefreshNode(treeTask, treeJob, node, progress); } } } } catch (Exception exc) { log.Error("MSSQLServerAuditor.Managers:RefreshNode:subTask (Exception)", exc); } }; treeJob.Action = refreshNodeAction; lock (this._schedulingLock) { treeTask.Schedule(treeJob); } }
public LoginManager(CurrentStorage storage) { this._storage = storage; this._cryptoService = storage.CryptoService; }
protected CurrentStorageTable(CurrentStorage storage, TableDefinition tableDefinition) : base(storage.Connection, tableDefinition) { Storage = storage; }
public ScheduleJobProcessor(CurrentStorage storage) { this._storage = storage; }