1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 /***
27 * TModelInfosHandler
28 *
29 * @author Steve Viens (sviens@apache.org)
30 */
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
49 obj.setTModelKey(element.getAttribute("tModelKey"));
50
51
52
53
54
55 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 String generic = getGeneric(null);
71 String namespace = getUDDINamespace(generic);
72 Element element = parent.getOwnerDocument().createElementNS(namespace,TAG_NAME);
73 AbstractHandler handler = null;
74
75 String tModelKey = info.getTModelKey();
76 if (tModelKey != null)
77 element.setAttribute("tModelKey",tModelKey);
78
79 Name name = info.getName();
80 if (name != null)
81 {
82 handler = maker.lookup(NameHandler.TAG_NAME);
83 handler.marshal(name,element);
84 }
85
86 parent.appendChild(element);
87 }
88
89
90 /****************************************************************************/
91 /****************************** TEST DRIVER *********************************/
92 /****************************************************************************/
93
94
95 public static void main(String args[])
96 throws Exception
97 {
98 }
99 }