/// <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;
        }