// // 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 (int propIndex = 0; propIndex < propertiesArray.length; propIndex++) { // parse property elements NodeList propertyList = propertiesArray[propIndex].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); }
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); } } }