1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.juddi.handler;
17
18 import org.apache.juddi.datatype.PersonName;
19 import org.apache.juddi.datatype.RegistryObject;
20 import org.apache.juddi.util.xml.XMLUtils;
21 import org.w3c.dom.Element;
22
23 /***
24 * "Knows about the creation and populating of BindingKey objects.
25 * Returns BindingKey."
26 *
27 * @author Steve Viens (sviens@apache.org)
28 */
29 public class PersonNameHandler extends AbstractHandler
30 {
31 public static final String TAG_NAME = "personName";
32
33 protected PersonNameHandler(HandlerMaker maker)
34 {
35 }
36
37 public RegistryObject unmarshal(Element element)
38 {
39 PersonName obj = new PersonName();
40
41
42
43
44
45 obj.setValue(XMLUtils.getText(element));
46
47
48
49
50 return obj;
51 }
52
53 public void marshal(RegistryObject object,Element parent)
54 {
55 PersonName name = (PersonName)object;
56 String generic = getGeneric(null);
57 String namespace = getUDDINamespace(generic);
58 Element element = parent.getOwnerDocument().createElementNS(namespace,TAG_NAME);
59
60 String nameValue = name.getValue();
61 if ((nameValue != null) && (nameValue.trim().length() > 0))
62 element.appendChild(parent.getOwnerDocument().createTextNode(nameValue));
63
64 parent.appendChild(element);
65 }
66
67
68 /****************************************************************************/
69 /****************************** TEST DRIVER *********************************/
70 /****************************************************************************/
71
72
73 public static void main(String args[])
74 throws Exception
75 {
76 }
77 }