/// <summary>
        /// Creates the scope nested 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 workspace units from and to nested workspace.
        /// </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 ScopeNestedWorkspaceWrapper CreateCompositeComponentWorkspaceWrapper(ScopeBaseMetadata scopeMetadata, IWorkspaceInternal workspaceInstance, string workspaceNamespaceId, AppDomain componentsAppDomain)
        {
            var type = typeof(ScopeNestedWorkspaceWrapper);

            var scopeNestedWorkspaceWrapper = (ScopeNestedWorkspaceWrapper)componentsAppDomain.CreateInstanceAndUnwrap(
                type.Assembly.FullName, type.FullName, false,
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.CreateInstance | BindingFlags.Instance, null,
                new object[] { workspaceInstance, workspaceNamespaceId },
                System.Globalization.CultureInfo.CurrentCulture, new object[] { });

            return scopeNestedWorkspaceWrapper;
        }
示例#2
0
        /// <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);

            ScopeBaseMetadata metadata = (ScopeBaseMetadata)other;

            m_experimentLocationRoot  = metadata.m_experimentLocationRoot;
            m_compositeComponentGraph = (CompositeComponentEditableGraph)(metadata.m_compositeComponentGraph.Clone());

            HasDeserializationError = metadata.HasDeserializationError;
            if (HasDeserializationError)
            {
                DeserializationErrorMessage = metadata.DeserializationErrorMessage;
            }
        }
示例#3
0
        /// <summary>
        /// Creates the scope composite component node. It actually returns the composite component, but with different nested workspace wrapper.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="scopeMetadata">The scope metadata.</param>
        /// <param name="loggerNameRoot">The logger name root.</param>
        /// <param name="library">The library.</param>
        /// <param name="componentsAppDomain">The components app domain.</param>
        /// <param name="terminateExperimentExecutionResetEvent">The terminate experiment execution reset event.</param>
        /// <returns></returns>
        protected RunnableNode CreateScopeCompositeComponentNode(string id, ScopeBaseMetadata scopeMetadata, LoggerNameRoot loggerNameRoot,
                                                                 ComponentsLibrary library, AppDomain componentsAppDomain,
                                                                 System.Threading.ManualResetEvent terminateExperimentExecutionResetEvent)
        {
            ScopeNestedWorkspaceWrapper workspaceWrapper = WorkspaceWrapperFactory.CreateCompositeComponentWorkspaceWrapper(scopeMetadata, Workspace, id, componentsAppDomain);

            //scope can standard runnable factory, unlike the composite component
            IRunnableNodeFactory nodesFactory = new RunnableNodeFactory(workspaceWrapper);

            RunnableExperimentBase subExperiment = ConstructSubExperiment(scopeMetadata, loggerNameRoot, library, componentsAppDomain, terminateExperimentExecutionResetEvent, nodesFactory);

            return new RunnableCompositeComponentNode(id, scopeMetadata, subExperiment, workspaceWrapper, library, scopeMetadata.WaitsForAllPredecessors);
        }