Beispiel #1
0
        /// <summary>
        /// Initialize Maime with Options
        /// </summary>
        /// <param name="options">Options used for reparation</param>
        public static void Init(Options.Options options)
        {
            Logger.Common("Maime initializing");
            _options = options;

            // If debugger attached, then locate folders in solution folder.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                _projectPathFolder = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory()));
                _dataFolder        = Path.GetFullPath(Path.Combine(_projectPathFolder, "..\\", "Data"));
            }
            else // Else locate in same folder as .exe file
            {
                _projectPathFolder = AppDomain.CurrentDomain.BaseDirectory;
                _dataFolder        = Path.GetFullPath(Path.Combine(_projectPathFolder, "Data"));
            }

            Logger.Common($"Settings stored at {_projectPathFolder}");
            Logger.Common($"Data folder location {_dataFolder}");

            // ======== Settings ======== //
            Logger.Common("Loading settings");
            SettingsStore.Init(
                new JsonSettingsProvider(_dataFolder),
                new JsonEDSProvider()
                );
            Logger.Common("Settings loaded");

            // ======== Metadata store ======== //
            Logger.Common("Initializing metadata store");
            MetaDataStore.Init(new JSONSnapshotProvider());
            Logger.Common("Metadata store initialized");

            _application = new Application();

            // ======== Fetch Changes ======== //
            Logger.Common("Fetching latest metadata changes");
            _latestChanges = MetaDataStore.GetLatestChanges(SettingsStore.EDSSettings);

            if (_latestChanges.Count == 0)
            {
                Logger.Error("No database(s) or change(s) found. Please create a snapshot and rerun the program.");
                _databaseMetaChange = null;
                return;
            }

            _databaseMetaChange = _latestChanges.Values.First();
            Logger.Common("Finished fetching metadata changes");

            Logger.Common("Maime initialized");
        }
Beispiel #2
0
        /// <summary>
        /// Construct a graph
        /// </summary>
        /// <param name="application">Application in which the graph is loaded</param>
        /// <param name="package">Package which this graph corresponds to</param>
        /// <param name="fileName">Filename of graph</param>
        public Graph(Application application, Package package, string fileName, Options.Options options)
        {
            Application = application;
            Package     = package;
            FileName    = fileName;
            Options     = options;

            // TODO: Future implementation should work with multiple executables
            TaskHost th = (TaskHost)package.Executables[0]; //pick specific task

            // MainPipe equals a Data Flow Task
            if (th.InnerObject is MainPipe)
            {
                MainPipe dataFlowTask = (MainPipe)th.InnerObject;

                _pipe          = dataFlowTask;
                Vertices       = new List <Vertex>();
                Edges          = new List <Edge>();
                AttributeTable = new AttrTable();

                //=======================
                //     1st iteration
                //=======================
                // Iteration of vertices/components and edges/paths

                // Instanciate all vertexes
                foreach (IDTSComponentMetaData100 dfComponent in dataFlowTask.ComponentMetaDataCollection)
                {
                    // Vertex is given a transformation type
                    string componentName = application.PipelineComponentInfos[dfComponent.ComponentClassID].Name;
                    Vertex vertex        = CreateClass(componentName);

                    // Reference to SSIS component + name
                    vertex.ComponentRef = dfComponent;
                    vertex.Name         = dfComponent.Name;

                    // Add vertex to graph
                    Vertices.Add(vertex);
                }

                // Get all the edges
                foreach (IDTSPath100 path in dataFlowTask.PathCollection)
                {
                    Edge edge = new Edge(path)
                    {
                        //Find the source + destination vertex
                        Source      = Vertices.Find(v => v.ComponentRef.ID == path.StartPoint.Component.ID),
                        Destination = Vertices.Find(v => v.ComponentRef.ID == path.EndPoint.Component.ID)
                    };

                    // Add edge to graph, which connects two vertices
                    Edges.Add(edge);
                }

                //=======================
                //     2nd iteration
                //=======================
                // Iterate through every single vertex in topological order, and set their dependencies and properties
                Vertices = TopologicalSort(ColumnChanges.None);
                Vertices.ForEach(v => v.MapDependenciesAndProperties());

                //VisualizeGraph();
                //Program.VisualGraph.Draw(fileName);
                //Program.VisualGraph.Open();
            }
        }
Beispiel #3
0
 public VerticesComparer(Options.Options options, ColumnChanges columnChange)
 {
     _options      = options;
     _columnChange = columnChange;
 }