1 17 package org.apache.servicemix.wsn.spring; 18 19 import javax.xml.parsers.DocumentBuilderFactory ; 20 21 import org.oasis_open.docs.wsn.b_2.CreatePullPoint; 22 import org.springframework.beans.factory.FactoryBean; 23 import org.w3c.dom.Document ; 24 import org.w3c.dom.Element ; 25 import org.w3c.dom.Text ; 26 27 33 public class CreatePullPointFactoryBean implements FactoryBean { 34 35 private String address; 36 37 40 public String getAddress() { 41 return address; 42 } 43 44 47 public void setAddress(String address) { 48 this.address = address; 49 } 50 51 public Object getObject() throws Exception { 52 CreatePullPoint createPullPoint = new CreatePullPoint(); 53 if (address != null) { 54 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 55 factory.setNamespaceAware(true); 56 Document doc = factory.newDocumentBuilder().newDocument(); 57 Element el = doc.createElementNS("http://servicemix.apache.org/wsn2005/1.0", "address"); 58 Text txt = doc.createTextNode(address); 59 el.appendChild(txt); 60 doc.appendChild(el); 61 createPullPoint.getAny().add(el); 62 } 63 return createPullPoint; 64 } 65 66 public Class getObjectType() { 67 return CreatePullPoint.class; 68 } 69 70 public boolean isSingleton() { 71 return false; 72 } 73 74 } 75 | Popular Tags |