internal IPlugin CreatePlugin(PomXmlElement element) { var plugin = new Plugin(); plugin.LoadFromElement(element); return(plugin); }
internal protected virtual void LoadFromElement(PomXmlElement element) { //load project properties var propertiesNode = element.ReadElement("properties"); if (propertiesNode != null) { Properties = propertiesNode.Elements .Select(e => (IProperty) new Property(e)).ToList(); } //load modules Modules = element.ReadElements("modules", "module") .Select(e => (IModule) new Module(e)).ToList(); //load dependencies Dependencies = element.ReadElements("dependencies", "dependency") .Select(e => _dataFactory.CreateDependency(e)).ToList(); // load plugins Plugins = element.ReadElements("build", "plugins", "plugin") .Select(e => _dataFactory.CreatePlugin(e)).ToList(); // load pluginManagement PluginManagement = element.ReadElements("build", "pluginManagement", "plugins", "plugin") .Select(e => _dataFactory.CreatePlugin(e)).ToList(); }
internal IProfile CreateProfile(PomXmlElement element) { var profile = new Profile(); profile.LoadFromElement(element); return(profile); }
internal IDependency CreateDependency(PomXmlElement element) { var dependency = new Dependency(); dependency.LoadFromElement(element); return(dependency); }
// TODO: factory internal IParentReference CreateParentReference(PomXmlElement parentNode) { var parent = new ParentReference(); parent.LoadFromElement(parentNode); return(parent); }
internal protected override void LoadFromElement(PomXmlElement element) { base.LoadFromElement(element); Scope = element.ReadElementValue("scope"); Type = element.ReadElementValue("type"); Classifier = element.ReadElementValue("classifier"); bool optional; Optional = bool.TryParse(element.ReadElementValue("optional"), out optional) && optional; }
internal protected override void SaveToElement(PomXmlElement element) { base.SaveToElement(element); element.SetElementValue("type", Type); element.SetElementValue("classifier", Classifier); element.SetElementValue("scope", Scope); if (Optional) { element.SetElementValue("optional", "true"); } }
protected internal override void SaveToElement(PomXmlElement element) { base.SaveToElement(element); if (Executions != null) { element.AddElement(Executions); } if (Configuration != null) { element.AddElement(Configuration); } }
protected internal override void SaveToElement(PomXmlElement profileElem) { var idElem = profileElem.ReadOrCreateElement("id"); if (string.IsNullOrEmpty(Id)) { idElem.Remove(); } else { idElem.Value = Id; } base.SaveToElement(profileElem); }
protected internal override void LoadFromElement(PomXmlElement element) { base.LoadFromElement(element); Packaging = element.ReadElementValue("packaging"); Name = element.ReadElementValue("name"); ModelVersion = element.ReadElementValue("modelVersion"); //read parent var parentNode = element.ReadElement("parent"); Parent = parentNode == null ? null : _dataFactory.CreateParentReference(parentNode); _container.LoadFromElement(element); //load profiles Profiles = element.ReadElements("profiles", "profile") .Select(e => _dataFactory.CreateProfile(e)).ToList(); }
internal protected virtual void LoadFromElement(PomXmlElement element) { ArtifactId = element.ReadElementValue("artifactId"); GroupId = element.ReadElementValue("groupId"); Version = element.ReadElementValue("version"); }
internal protected override void LoadFromElement(PomXmlElement element) { base.LoadFromElement(element); Executions = element.ReadElement("executions"); Configuration = element.ReadElement("configuration"); }
public void SaveTo(PomXmlElement externalModuleNode) { externalModuleNode.SetElementValue("artifactId", ArtifactId); externalModuleNode.SetElementValue("groupId", GroupId); externalModuleNode.SetElementValue("version", Version); }
internal protected override void LoadFromElement(PomXmlElement element) { Id = element.ReadElementValue("id"); base.LoadFromElement(element); }
public Property(PomXmlElement e) { Name = e.LocalName; Value = e.Value; }
public void SaveTo(PomXmlElement propertiesNode) { propertiesNode.SetElementValue(Name, Value); }
internal protected virtual void SaveToElement(PomXmlElement element) { //writing modules var modulesNode = element.ReadOrCreateElement("modules"); if (!Modules.Any()) { modulesNode.Remove(); } else { modulesNode.RemoveAllChildElements(); foreach (Module module in Modules) { if (!string.IsNullOrEmpty(module.Path)) { var moduleNode = modulesNode.CreateElement("module"); module.SaveTo(moduleNode); } } } //writing dependencies var dependenciesNode = element.ReadOrCreateElement("dependencies"); if (!Dependencies.Any()) { dependenciesNode.Remove(); } else { dependenciesNode.RemoveAllChildElements(); foreach (Dependency dependency in Dependencies) { var dependencyNode = dependenciesNode.CreateElement("dependency"); dependency.SaveToElement(dependencyNode); } } //writing properties var propertiesNode = element.ReadOrCreateElement("properties"); if (!Properties.Any()) { propertiesNode.Remove(); } else { propertiesNode.RemoveAllChildElements(); foreach (Property prop in Properties) { prop.SaveTo(propertiesNode); } } var buildNode = element.ReadOrCreateElement("build"); if (!Plugins.Any() && !PluginManagement.Any()) // empty build section { buildNode.Remove(); } else { var pluginsNode = buildNode.ReadOrCreateElement("plugins"); if (!Plugins.Any()) { pluginsNode.Remove(); } else { pluginsNode.RemoveAllChildElements(); foreach (Plugin plugin in Plugins) { var pluginNode = pluginsNode.CreateElement("plugin"); plugin.SaveToElement(pluginNode); } } var pluginManagementNode = buildNode.ReadOrCreateElement("pluginManagement"); var pluginManagementPluginsNode = pluginManagementNode.ReadOrCreateElement("plugins"); if (!PluginManagement.Any()) { pluginManagementNode.Remove(); } else { pluginManagementPluginsNode.RemoveAllChildElements(); foreach (Plugin plugin in PluginManagement) { var pluginNode = pluginManagementPluginsNode.CreateElement("plugin"); plugin.SaveToElement(pluginNode); } } } }
internal protected override void LoadFromElement(PomXmlElement element) { base.LoadFromElement(element); RelativePath = element.ReadElementValue("relativePath"); }
protected internal override void SaveToElement(PomXmlElement parentNode) { base.SaveToElement(parentNode); parentNode.SetElementValue("relativePath", RelativePath); }
internal protected virtual void SaveToElement(PomXmlElement element) { element.SetElementValue("groupId", GroupId); element.SetElementValue("artifactId", ArtifactId); element.SetElementValue("version", Version); }