/// <summary> /// Creates an instance of InheritDocCopyComponent class. /// </summary> /// <param name="configuration">Configuration section to be parsed.</param> /// <param name="data">A dictionary object with string as key and object as value.</param> public InheritDocCopyComponent(XPathNavigator configuration, Dictionary <string, object> data) : base(configuration, data) { // get the copy commands XPathNodeIterator copy_nodes = configuration.Select("copy"); foreach (XPathNavigator copy_node in copy_nodes) { // get the comments info string source_name = copy_node.GetAttribute("name", string.Empty); if (String.IsNullOrEmpty(source_name)) { throw new ConfigurationErrorsException("Each copy command must specify an index to copy from."); } // get the reflection info string reflection_name = copy_node.GetAttribute("use", String.Empty); if (String.IsNullOrEmpty(reflection_name)) { throw new ConfigurationErrorsException("Each copy command must specify an index to get reflection information from."); } IndexedDocumentController indexController = (IndexedDocumentController)data[source_name]; this.index = indexController[source_name]; IndexedDocumentController reflectController = (IndexedDocumentController)data[reflection_name]; this.reflectionIndex = reflectController[reflection_name]; } this.WriteMessage(MessageLevel.Info, "Initialized."); }
public CopyFromIndexCommand(IndexedDocumentSource sourceIndex, string keyXPath, string sourceXPath, string targetXPath, string attributeValue, string ignoreCaseValue) : this() { BuildComponentExceptions.NotNull(sourceIndex, "sourceIndex"); this.cache = sourceIndex; if (String.IsNullOrEmpty(keyXPath)) { key = XPathExpression.Compile("string($key)"); } else { key = XPathExpression.Compile(keyXPath); } source = XPathExpression.Compile(sourceXPath); target = targetXPath; attribute = attributeValue; ignoreCase = ignoreCaseValue; }