1 16 package org.apache.juddi.handler; 17 18 import java.util.Vector ; 19 20 import org.apache.juddi.datatype.Name; 21 import org.apache.juddi.datatype.RegistryObject; 22 import org.apache.juddi.datatype.response.PublisherInfo; 23 import org.apache.juddi.util.xml.XMLUtils; 24 import org.w3c.dom.Element ; 25 26 32 public class PublisherInfoHandler extends AbstractHandler 33 { 34 public static final String TAG_NAME = "publisherInfo"; 35 36 private HandlerMaker maker = null; 37 38 protected PublisherInfoHandler(HandlerMaker maker) 39 { 40 this.maker = maker; 41 } 42 43 public RegistryObject unmarshal(Element element) 44 { 45 PublisherInfo obj = new PublisherInfo(); 46 Vector nodeList = null; 47 AbstractHandler handler = null; 48 49 obj.setPublisherID(element.getAttribute("publisherID")); 51 52 55 nodeList = XMLUtils.getChildElementsByTagName(element,NameHandler.TAG_NAME); 57 if (nodeList.size() > 0) 58 { 59 handler = maker.lookup(NameHandler.TAG_NAME); 60 Name name = (Name )handler.unmarshal((Element )nodeList.elementAt(0)); 61 if (name != null) 62 obj.setName(name); 63 } 64 65 return obj; 66 } 67 68 public void marshal(RegistryObject object,Element parent) 69 { 70 PublisherInfo info = (PublisherInfo)object; 71 Element element = parent.getOwnerDocument().createElementNS(null,TAG_NAME); 72 AbstractHandler handler = null; 73 74 String publisherID = info.getPublisherID(); 75 if (publisherID != null) 76 element.setAttribute("publisherID",publisherID); 77 78 Name name = info.getName(); 79 if (name != null) 80 { 81 handler = maker.lookup(NameHandler.TAG_NAME); 82 handler.marshal(name,element); 83 } 84 85 parent.appendChild(element); 86 } 87 88 89 90 91 92 93 94 public static void main(String args[]) 95 throws Exception 96 { 97 } 98 } | Popular Tags |