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.RegistryObject;
19 import org.apache.juddi.datatype.subscription.SubscriptionKey;
20 import org.apache.juddi.util.xml.XMLUtils;
21 import org.w3c.dom.Element;
22
23 /***
24 * "Knows about the creation and populating of SubscriptionKey objects.
25 * Returns SubscriptionKey."
26 *
27 * @author Steve Viens (sviens@apache.org)
28 */
29 public class SubscriptionKeyHandler extends AbstractHandler
30 {
31 public static final String TAG_NAME = "subscriptionKey";
32
33 protected SubscriptionKeyHandler(HandlerMaker maker)
34 {
35 }
36
37 public RegistryObject unmarshal(Element element)
38 {
39 org.apache.juddi.datatype.subscription.SubscriptionKey obj = new org.apache.juddi.datatype.subscription.SubscriptionKey();
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 SubscriptionKey key = (SubscriptionKey)object;
56 String generic = getGeneric(null);
57 String namespace = getUDDINamespace(generic);
58 Element element = parent.getOwnerDocument().createElementNS(namespace,TAG_NAME);
59
60 String keyValue = key.getValue();
61 if (keyValue != null)
62 element.appendChild(parent.getOwnerDocument().createTextNode(keyValue));
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 }