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.TModelInfo; 23 import org.apache.juddi.util.xml.XMLUtils; 24 import org.w3c.dom.Element ; 25 26 31 public class TModelInfoHandler extends AbstractHandler 32 { 33 public static final String TAG_NAME = "tModelInfo"; 34 35 private HandlerMaker maker = null; 36 37 protected TModelInfoHandler(HandlerMaker maker) 38 { 39 this.maker = maker; 40 } 41 42 public RegistryObject unmarshal(Element element) 43 { 44 TModelInfo obj = new TModelInfo(); 45 Vector nodeList = null; 46 AbstractHandler handler = null; 47 48 obj.setTModelKey(element.getAttribute("tModelKey")); 50 51 54 nodeList = XMLUtils.getChildElementsByTagName(element,NameHandler.TAG_NAME); 56 if (nodeList.size() > 0) 57 { 58 handler = maker.lookup(NameHandler.TAG_NAME); 59 Name name = (Name )handler.unmarshal((Element )nodeList.elementAt(0)); 60 if (name != null) 61 obj.setName(name); 62 } 63 64 return obj; 65 } 66 67 public void marshal(RegistryObject object,Element parent) 68 { 69 TModelInfo info = (TModelInfo)object; 70 Element element = parent.getOwnerDocument().createElementNS(null,TAG_NAME); 71 AbstractHandler handler = null; 72 73 String tModelKey = info.getTModelKey(); 74 if (tModelKey != null) 75 element.setAttribute("tModelKey",tModelKey); 76 77 Name name = info.getName(); 78 if (name != null) 79 { 80 handler = maker.lookup(NameHandler.TAG_NAME); 81 handler.marshal(name,element); 82 } 83 84 parent.appendChild(element); 85 } 86 87 88 89 90 91 92 93 public static void main(String args[]) 94 throws Exception 95 { 96 } 97 } | Popular Tags |