/// <summary> /// Performs a deep copy of the data in this object to another instance of the Metadata. /// </summary> /// <param name="other">The other.</param> protected override void CopyFrom(Metadata other) { if (other == null) { throw new ArgumentNullException("other"); } base.CopyFrom(other); CompositeComponentMetadata metadata = (CompositeComponentMetadata)other; m_IOSpec = metadata.m_IOSpec.Clone(); m_configWrapper = metadata.m_configWrapper.Clone(); m_experimentLocationRoot = metadata.m_experimentLocationRoot; m_compositeComponentMetadataDefinition = metadata.m_compositeComponentMetadataDefinition; m_componentMetadataDefinitionID = metadata.m_componentMetadataDefinitionID; HasDeserializationError = metadata.HasDeserializationError; if (HasDeserializationError) { DeserializationErrorMessage = metadata.DeserializationErrorMessage; } // if composite component was not present in the library, then corresponding component graph may be null. // the deserialization has already set the corresponding error above, nevertheless subgraph cannot be cloned obviously if (HasDeserializationError == false && metadata.m_compositeComponentGraph != null) { m_compositeComponentGraph = (CompositeComponentGraph)(metadata.m_compositeComponentGraph.Clone()); } m_tempConfigWrapper = metadata.m_tempConfigWrapper; m_tempIoSpec = metadata.m_tempIoSpec; m_tempLabel = metadata.m_tempLabel; }
/// <summary> /// Clones this instance. /// </summary> /// <returns></returns> public override Metadata Clone() { var clone = new CompositeComponentMetadata(); clone.CopyFrom(this); return(clone); }
public static List<Crumb> GatherCrumbs(CompositeComponentMetadata metadata) { List<Crumb> crumbs = new List<Crumb>(); PushParents(metadata.ComponentGraph, crumbs); crumbs.Add(new ExperimentCrumb(metadata.Label, metadata.ComponentGraph)); return crumbs; }
/// <summary> /// Creates the composite component workspace wrapper. /// It is specifc workspace wrapper, that uses the composite node namespace to store and load items. It pass loading and storing to its /// workspace instance, but with added namespace. /// It also has method to setup and teardown iospec and config before executing composite node. /// </summary> /// <param name="compositeComponentMetadata">The composite component metadata.</param> /// <param name="workspaceInstance">The workspace instance.</param> /// <param name="workspaceNamespaceId">The workspace namespace id.</param> /// <returns></returns> public static NestedWorkspaceWrapper CreateCompositeComponentWorkspaceWrapper(CompositeComponentMetadata compositeComponentMetadata, IWorkspaceInternal workspaceInstance, string workspaceNamespaceId, AppDomain componentsAppDomain) { var type = typeof(NestedWorkspaceWrapper); var nestedWorkspaceWrapper = (NestedWorkspaceWrapper)componentsAppDomain.CreateInstanceAndUnwrap( type.Assembly.FullName, type.FullName, false, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.CreateInstance | BindingFlags.Instance, null, new object[] { compositeComponentMetadata.IOSpec, workspaceInstance, workspaceNamespaceId }, System.Globalization.CultureInfo.CurrentCulture, new object[] { }); return nestedWorkspaceWrapper; }
/// <summary> /// Creates the composite component node. /// </summary> /// <param name="id">The id.</param> /// <param name="compositeComponentMetadata">The composite component metadata.</param> /// <param name="loggerNameRoot">The logger name root - needed so that the logs are specific per experiment and experiment window.</param> /// <param name="library">The library of components.</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; The sublevel experiments hold the referance to the same termination event as top level experiment.</param> /// <returns> /// Created composite component node /// </returns> protected RunnableNode CreateCompositeComponentNode(string id, CompositeComponentMetadata compositeComponentMetadata, LoggerNameRoot loggerNameRoot, ComponentsLibrary library, AppDomain componentsAppDomain, System.Threading.ManualResetEvent terminateExperimentExecutionResetEvent) { NestedWorkspaceWrapper workspaceWrapper = WorkspaceWrapperFactory.CreateCompositeComponentWorkspaceWrapper(compositeComponentMetadata, Workspace, id, componentsAppDomain); NodesFactoryOfSubGraph nodesFactoryOfSubGraph = new NodesFactoryOfSubGraph(compositeComponentMetadata, workspaceWrapper); RunnableExperimentBase subExperiment = ConstructSubExperiment(compositeComponentMetadata, loggerNameRoot, library, componentsAppDomain, terminateExperimentExecutionResetEvent, nodesFactoryOfSubGraph); return new RunnableCompositeComponentNode(id, compositeComponentMetadata, subExperiment, workspaceWrapper, library, compositeComponentMetadata.WaitsForAllPredecessors); }
/// <summary> /// Clones this instance. /// </summary> /// <returns></returns> public override Metadata Clone() { var clone = new CompositeComponentMetadata(); clone.CopyFrom(this); return clone; }
// END HERZUM SPRINT 2.0: TLAB-148 internal void DisplaySubgraph(CompositeComponentMetadata metadata) { //always clear crumbs m_experimentCanvasWidget.ExperimentCrumbs.RemoveAll (); List<Crumb> crumbs = ExperimentCrumbGatherer.GatherCrumbs (metadata); m_experimentCanvasWidget.ExperimentCrumbs.ShowAll (); foreach(Crumb crumb in crumbs) { m_experimentCanvasWidget.ExperimentCrumbs.Append(crumb); crumb.Clicked += Redraw; } //set last one active (triggers clicked event) m_experimentCanvasWidget.ExperimentCrumbs.Active = crumbs [crumbs.Count - 1]; //attach handler to the first element so that it hides and removes all crumbs crumbs[0].Clicked += (object sender, EventArgs e) => { m_experimentCanvasWidget.ExperimentCrumbs.HideAll(); // HERZUM SPRINT 2.5 TLAB-157 //always clear crumbs m_experimentCanvasWidget.ExperimentCrumbs.RemoveAll(); // END HERZUM SPRINT 2.5 TLAB-157 }; }
/// <summary> /// Initializes a new s_instance of the <see cref="NodesFactoryOfSubGraph"/> class. /// </summary> /// <param name="compositeComponentMetadata">The composite component metadata, which is going to be used to override config values in subgraph.</param> /// <param name="workspaceWrapper">The workspace wrapper.</param> /// <param name="experimentReverseLookup">The experiment reverse lookup holds information of all predecessor experiments in the path - used to prevent recursion in case subexperiment refers back to any of the previous experiments.</param> public NodesFactoryOfSubGraph(CompositeComponentMetadata compositeComponentMetadata, IWorkspaceInternal workspaceWrapper) : base(workspaceWrapper) //compositeComponentMetadata.SubExperimentFile { m_compositeComponentMetadata = compositeComponentMetadata; }