/// <summary> /// Refreshes all experiments... needed when Components Library has been rescanned. /// </summary> /// <param name="experiment">The experiment.</param> /// <param name="library">The library.</param> /// <returns>experiment</returns> public static Experiment ReloadExperiment(Experiment experiment, TraceLab.Core.Components.ComponentsLibrary library) { if (experiment != null) { //cache current experiment file path string currentPath = experiment.ExperimentInfo.FilePath; string tempFile = System.IO.Path.GetTempFileName(); //reload experiment by saving and loading it SerializeExperimentToXml(experiment, tempFile); Experiment refreshedExperiment = ExperimentManager.Load(tempFile, library); //set m_experiment path to the actual path - from temporary path refreshedExperiment.ExperimentInfo.FilePath = currentPath; SetNewRootLocationToReferencedFiles(refreshedExperiment, false); return(refreshedExperiment); } else { return(null); } }
/// <summary> /// Initializes a new instance of the <see cref="RunnableLoopNode"/> class. /// </summary> /// <param name="id">The id.</param> /// <param name="loopDecisionModule">The loop decision module.</param> /// <param name="compositeComponentMetadata">The composite component metadata.</param> /// <param name="templateGraph">The template graph.</param> /// <param name="workspaceWrapper">The composite component workspace wrapper.</param> /// <param name="library">The library.</param> /// <param name="waitForAllPredecessors">if set to <c>true</c> [wait for all predecessors].</param> public RunnableLoopNode(String id, TraceLab.Core.Decisions.ILoopDecisionModule loopDecisionModule, CompositeComponentBaseMetadata compositeComponentMetadata, RunnableExperimentBase templateGraph, NestedWorkspaceWrapper workspaceWrapper, TraceLab.Core.Components.ComponentsLibrary library, bool waitForAllPredecessors) : base(id, compositeComponentMetadata, templateGraph, workspaceWrapper, library, waitForAllPredecessors) { m_loopDecisionModule = loopDecisionModule; }
/// <summary> /// Initializes a new s_instance of the <see cref="RunnableCompositeComponentNode"/> class. /// </summary> /// <param name="id">The id.</param> /// <param name="compositeComponentMetadata">The composite component metadata.</param> /// <param name="templateGraph">The template graph.</param> /// <param name="workspaceWrapper">The composite component workspace wrapper.</param> public RunnableCompositeComponentNode(String id, CompositeComponentBaseMetadata compositeComponentMetadata, RunnableExperimentBase templateGraph, NestedWorkspaceWrapper workspaceWrapper, TraceLab.Core.Components.ComponentsLibrary library, bool waitForAllPredecessors) : base(id, compositeComponentMetadata.Label, new RunnableNodeCollection(), new RunnableNodeCollection(), library, waitForAllPredecessors) { m_compositeComponentMetadata = compositeComponentMetadata; m_subLevelExperiment = templateGraph; m_workspace = workspaceWrapper; }
public ComponentLibraryViewModel(TraceLab.Core.Components.ComponentsLibrary componentsLibraryInstance, IEnumerable<string> workspaceTypeDirectories) { if (componentsLibraryInstance == null) throw new ArgumentNullException("componentsLibraryInstance"); // We'll use this collection to determine which PropertyChanged notifications to pass on. foreach (PropertyInfo prop in typeof(ComponentLibraryViewModel).GetProperties()) { m_validProperties.Add(prop.Name); } m_componentsLibraryInstance = componentsLibraryInstance; m_componentsLibraryInstance.PropertyChanged += m_componentsLibraryInstance_PropertyChanged; m_componentsLibraryInstance.Rescanning += m_componentsLibraryInstance_Rescanning; m_componentsLibraryInstance.Rescanned += m_componentsLibraryInstance_Rescanned; m_workspaceTypeDirectories = workspaceTypeDirectories; }
/// <summary> /// Initializes a new s_instance of the <see cref="RunnableExperiment"/> class. /// </summary> /// <param name="nodesFactory">The nodes factory that is going to be used to create nodes when nodes are added to template graph.</param> /// <param name="library">The library.</param> /// <param name="componentsAppDomain">The components app domain is the app domain which components assemblies are going to be loaded into.</param> /// <param name="terminateExperimentExecutionResetEvent">The event that allows signalling termination of the experiment</param> public RunnableExperiment(IRunnableNodeFactory nodesFactory, TraceLab.Core.Components.ComponentsLibrary library, AppDomain componentsAppDomain, System.Threading.ManualResetEvent terminateExperimentExecutionResetEvent) { if (componentsAppDomain == null) { throw new ArgumentNullException("componentsAppDomain"); } if (terminateExperimentExecutionResetEvent == null) { throw new ArgumentNullException("terminateExperimentExecutionResetEvent"); } m_componentsAppDomain = componentsAppDomain; m_terminateExperimentExecutionResetEvent = terminateExperimentExecutionResetEvent; m_nodes = new RunnableNodeCollection(); m_nodesFactory = nodesFactory; Library = library; }
/// <summary> /// Loads a experiment from the specified file. /// </summary> /// <param name="filename">The filename.</param> /// <exception cref="TraceLab.Core.Exceptions.ExperimentLoadException">throws if experiment load fails</exception> /// <returns> /// Returns loaded m_experiment. If loading failed it returns null. /// </returns> public static Experiment Load(string fileName, TraceLab.Core.Components.ComponentsLibrary library) { Experiment experiment = null; try { using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(fileName)) { experiment = ExperimentSerializer.DeserializeExperiment(reader, library, fileName); } if (experiment != null) { experiment.ResetModifiedFlag(); } } catch (ArgumentException e) { throw new ExperimentLoadException("The experiment file could not be loaded. Filename cannot be empty. ", e); } catch (System.Security.SecurityException e) { throw new ExperimentLoadException("The experiment file could not be loaded.", e); } catch (System.IO.FileNotFoundException e) { throw new ExperimentLoadException("The experiment file has not been found.", e); } catch (System.IO.DirectoryNotFoundException e) { throw new ExperimentLoadException("The directory has not been found.", e); } catch (UriFormatException e) { throw new ExperimentLoadException("The experiment is corrupted and could not be loaded.", e); } catch (System.Xml.XmlException e) { throw new ExperimentLoadException("The experiment is corrupted and could not be loaded.", e); } return(experiment); }
public ComponentLibraryViewModel(TraceLab.Core.Components.ComponentsLibrary componentsLibraryInstance, IEnumerable <string> workspaceTypeDirectories) { if (componentsLibraryInstance == null) { throw new ArgumentNullException("componentsLibraryInstance"); } // We'll use this collection to determine which PropertyChanged notifications to pass on. foreach (PropertyInfo prop in typeof(ComponentLibraryViewModel).GetProperties()) { m_validProperties.Add(prop.Name); } m_componentsLibraryInstance = componentsLibraryInstance; m_componentsLibraryInstance.PropertyChanged += m_componentsLibraryInstance_PropertyChanged; m_componentsLibraryInstance.Rescanning += m_componentsLibraryInstance_Rescanning; m_componentsLibraryInstance.Rescanned += m_componentsLibraryInstance_Rescanned; m_workspaceTypeDirectories = workspaceTypeDirectories; }
public RunnableNode CreateNode(string id, Metadata metadata, LoggerNameRoot loggerNameRoot, TraceLab.Core.Components.ComponentsLibrary library, AppDomain componentsAppDomain, System.Threading.ManualResetEvent terminateExperimentExecutionResetEvent) { return(CreateNode(id, metadata, terminateExperimentExecutionResetEvent)); }