use of org.eclipse.kura.core.configuration.XmlConfigPropertiesAdapter in project kura by eclipse.
the class XmlJavaComponentConfigurationsMapper method parseConfiguration.
//
// Unmarshaller's private methods
//
private ComponentConfigurationImpl parseConfiguration(Element configuration) throws Exception {
XmlConfigPropertiesAdapter xmlPropAdapter = new XmlConfigPropertiesAdapter();
// get configuration's properties
NodeList propertiesList = configuration.getChildNodes();
// get effective elements
Element[] propertiesArray = getElementNodes(propertiesList);
XmlConfigPropertiesAdapted xmlPropertiesAdapted = new XmlConfigPropertiesAdapted();
for (Element element : propertiesArray) {
// parse property elements
NodeList propertyList = element.getChildNodes();
Element[] propertyArray = getElementNodes(propertyList);
XmlConfigPropertyAdapted[] xmlConfigProperties = new XmlConfigPropertyAdapted[propertyArray.length];
for (int propertyIndex = 0; propertyIndex < propertyArray.length; propertyIndex++) {
XmlConfigPropertyAdapted xmlProperty = parseProperty(propertyArray[propertyIndex]);
xmlConfigProperties[propertyIndex] = xmlProperty;
}
xmlPropertiesAdapted.setProperties(xmlConfigProperties);
}
Map<String, Object> propertiesMap = xmlPropAdapter.unmarshal(xmlPropertiesAdapted);
String pid = configuration.getAttribute(CONFIGURATION_PID);
return new ComponentConfigurationImpl(pid, null, propertiesMap);
}
use of org.eclipse.kura.core.configuration.XmlConfigPropertiesAdapter in project kura by eclipse.
the class XmlJavaComponentConfigurationsMapper method marshallProperties.
private void marshallProperties(Map<String, Object> propertyMap, Element properties) throws Exception {
XmlConfigPropertiesAdapter xmlPropAdapter = new XmlConfigPropertiesAdapter();
XmlConfigPropertiesAdapted configPropAdapted = xmlPropAdapter.marshal(propertyMap);
XmlConfigPropertyAdapted[] propArray = configPropAdapted.getProperties();
for (XmlConfigPropertyAdapted propertyObj : propArray) {
Element property = marshallProperty(propertyObj);
if (property != null) {
properties.appendChild(property);
}
}
}
Aggregations