1 17 package org.apache.servicemix.components.mps; 18 19 import java.util.ArrayList ; 20 import java.util.Iterator ; 21 22 import javax.jbi.JBIException; 23 import javax.jbi.messaging.NormalizedMessage; 24 25 import org.w3c.dom.Element ; 26 import org.w3c.dom.NodeList ; 27 28 public class PropertySet { 29 30 31 public final static String XML_ELEMENT_NAME = "property-set"; 32 33 public final static String XML_ATTR_NAME_NAME = "name"; 34 35 38 private String propertySetName; 39 40 43 private ArrayList pvrs = new ArrayList (); 44 45 51 public PropertySet(String name, Element self) throws ConfigNotSupportedException{ 52 this.propertySetName = name; 53 NodeList properties = self.getElementsByTagName(PropertyValueResolver.XML_ELEMENT_NAME); 54 for (int i=0; i < properties.getLength();i++) { 55 Element property = (Element )properties.item(i); 56 this.pvrs.add((new PropertyValueResolver(property.getAttribute(XML_ATTR_NAME_NAME),property))); 57 } 58 } 59 60 66 public void applyProperties(NormalizedMessage in, NormalizedMessage out) throws JBIException { 67 68 for (Iterator iter = pvrs.iterator(); iter.hasNext();) { 70 ((PropertyValueResolver)iter.next()).setProperty(in,out); 71 } 72 } 73 74 public String getName() { 75 return propertySetName; 76 } 77 } 78 | Popular Tags |