- for (final File file : generated) {
- final Element configfile = document.createElement("configfile");
- configfile.setTextContent("file:" + ETC_OPENDAYLIGHT_KARAF_PATH + file.getName());
- configfile.setAttribute("finalname", ETC_OPENDAYLIGHT_KARAF_PATH + file.getName());
- ncAllFeatureDefinition.appendChild(configfile);
+
+ if (NETCONF_CONNECTOR_ALL_FEATURE
+ .equals(((Element) item).getAttribute("name"))) {
+ final Element ncAllFeatureDefinition = (Element) item;
+ // Clean previous generated files
+ for (final XmlElement configfile : XmlElement
+ .fromDomElement(ncAllFeatureDefinition)
+ .getChildElements("configfile")) {
+ ncAllFeatureDefinition.removeChild(configfile.getDomElement());
+ }
+ for (final File file : generated) {
+ final Element configfile = document.createElement("configfile");
+ configfile.setTextContent("file:"
+ + ETC_OPENDAYLIGHT_KARAF_PATH
+ + file.getName());
+ configfile.setAttribute(
+ "finalname",
+ ETC_OPENDAYLIGHT_KARAF_PATH
+ + file.getName());
+ ncAllFeatureDefinition.appendChild(configfile);
+ }