コード例 #1
0
        public override void PostProcessReadXml(Components.IComponentsLibrary library, string experimentLocationRoot)
        {
            GetDefinitionAndSet(library, experimentLocationRoot);

            IsInitialized = true;
            IsModified    = false;
        }
コード例 #2
0
        public void PostProcessReadXml(Components.IComponentsLibrary library, string experimentLocationRoot)
        {
            if (Metadata != null)
            {
                Metadata.PostProcessReadXml(library, experimentLocationRoot);
            }

            m_isInitialized = true;
            IsModified      = false;
        }
コード例 #3
0
        /// <summary>
        /// Process excuted once xml deserialization was completed.
        /// </summary>
        /// <param name="library">The library.</param>
        /// <param name="experimentLocationRoot">The experiment location root.</param>
        public override void PostProcessReadXml(Components.IComponentsLibrary library, string experimentLocationRoot)
        {
            m_experimentLocationRoot = experimentLocationRoot;

            if (m_experimentXml != null)
            {
                using (XmlReader reader = XmlReader.Create(new System.IO.StringReader(m_experimentXml)))
                {
                    var experiment = TraceLab.Core.Experiments.ExperimentSerializer.DeserializeExperiment(reader, library);
                    m_compositeComponentGraph = new Experiments.CompositeComponentEditableGraph(experiment);
                }
                //clear variable
                m_experimentXml = null;
            }

            IsInitialized = true;
            IsModified    = false;
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExperimentFactoryReader"/> class.
        /// </summary>
        /// <param name="library">The library.</param>
        /// <param name="experimentLocationRoot">The experiment location root - it can be null in case the experiment belongs to composite component.</param>
        public ExperimentFactoryReader(Components.IComponentsLibrary library, IEnumerable<IPackageReference> references, string experimentLocationRoot)
        {
            if (library == null)
                throw new ArgumentNullException("library");

            m_library = library.GetPackageAwareLibrary(references);
            m_experimentLocationRoot = experimentLocationRoot;

            //Create our own namespaces for the output
            var ns = new System.Xml.Serialization.XmlSerializerNamespaces();

            //Add an empty namespace and empty value
            ns.Add("", "");

            m_nodeSerializer = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(SerializedVertexData), null);
            m_nodeSerializerWithSize = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(SerializedVertexDataWithSize), null);

        }
コード例 #5
0
        /// <summary>
        /// Gets the definition for this Metadata and sets up the configuration based on it.
        /// </summary>
        /// <param name="library">The library.</param>
        /// <param name="experimentLocationRoot">The experiment location root.</param>
        private void GetDefinitionAndSet(Components.IComponentsLibrary library, string experimentLocationRoot)
        {
            m_experimentLocationRoot = experimentLocationRoot;

            //reload component metadata definition
            MetadataDefinition metadataDefinition;

            if (library.TryGetComponentDefinition(ComponentMetadataDefinitionID, out metadataDefinition))
            {
                ComponentMetadataDefinition = metadataDefinition as CompositeComponentMetadataDefinition;
            }

            //if definition has been found override matching parameters (but don't override definition)
            if (ComponentMetadataDefinition != null)
            {
                InitDefaultComponentMetadata(true);
                IOSpec.UpdateMappingsBasedOn(m_tempIoSpec);
                ConfigWrapper.UpdateConfigValuesBasedOn(m_tempConfigWrapper);
                Label = m_tempLabel;
                WaitsForAllPredecessors = m_tempWaitsForAllPredecessors;
                //clear error - there might have been errors regarding existence of composite component, but referencing new package might fix this problem.
                DeserializationErrorMessage = null;
                HasDeserializationError     = false;
            }
            else
            {
                //otherwise set values to temporary IOSpec and configWrapper (just not to lose data in case user resave experiment), and rethrow exception
                IOSpec                  = m_tempIoSpec;
                ConfigWrapper           = m_tempConfigWrapper;
                HasDeserializationError = true;
                Label = m_tempLabel;
                WaitsForAllPredecessors     = m_tempWaitsForAllPredecessors;
                DeserializationErrorMessage = String.Format(System.Globalization.CultureInfo.CurrentCulture, "Component library does not contain any Composite Component of the given ID {0}", ComponentMetadataDefinitionID);
            }

            if (experimentLocationRoot != null) //it may be null if it is a component residing in the graph of composite component that is the library (was not added to any experiment)
            {
                ConfigWrapper.SetExperimentLocationRoot(experimentLocationRoot, true);
            }

            m_tempConfigWrapper = null;
            m_tempIoSpec        = null;
            m_tempLabel         = null;
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExperimentFactoryReader"/> class.
        /// </summary>
        /// <param name="library">The library.</param>
        /// <param name="experimentLocationRoot">The experiment location root - it can be null in case the experiment belongs to composite component.</param>
        public ExperimentFactoryReader(Components.IComponentsLibrary library, IEnumerable <IPackageReference> references, string experimentLocationRoot)
        {
            if (library == null)
            {
                throw new ArgumentNullException("library");
            }

            m_library = library.GetPackageAwareLibrary(references);
            m_experimentLocationRoot = experimentLocationRoot;

            //Create our own namespaces for the output
            var ns = new System.Xml.Serialization.XmlSerializerNamespaces();

            //Add an empty namespace and empty value
            ns.Add("", "");

            m_nodeSerializer         = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(SerializedVertexData), null);
            m_nodeSerializerWithSize = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(SerializedVertexDataWithSize), null);
        }
コード例 #7
0
 public virtual void UpdateFromDefinition(Components.IComponentsLibrary library)
 {
 }
コード例 #8
0
 public virtual void PostProcessReadXml(Components.IComponentsLibrary library, string experimentLocationRoot)
 {
     IsInitialized = true;
     IsModified    = false;
 }