1
2
3
4
5
6
7
8 package it.imolinfo.jbi4corba.jbi.wsdl;
9
10 import it.imolinfo.jbi4corba.Logger;
11 import it.imolinfo.jbi4corba.LoggerFactory;
12
13 import javax.wsdl.Definition;
14 import javax.wsdl.WSDLException;
15 import javax.wsdl.extensions.ExtensibilityElement;
16 import javax.wsdl.extensions.ExtensionDeserializer;
17 import javax.wsdl.extensions.ExtensionRegistry;
18 import javax.xml.namespace.QName;
19
20 import org.w3c.dom.Element;
21
22 import com.ibm.wsdl.util.xml.DOMUtils;
23 import com.ibm.wsdl.util.xml.QNameUtils;
24
25
26
27
28
29
30
31
32 public class Jbi4CorbaBindingDeserializer implements ExtensionDeserializer {
33
34
35
36
37 private static final Logger LOG
38 = LoggerFactory.getLogger(Jbi4CorbaBindingDeserializer.class);
39
40
41
42
43 public Jbi4CorbaBindingDeserializer(){
44 }
45
46
47
48
49
50
51
52
53
54
55
56 @SuppressWarnings("unchecked")
57 public ExtensibilityElement unmarshall(
58 Class parentType,
59 QName elementType,
60 Element el,
61 Definition def,
62 ExtensionRegistry extReg) throws WSDLException {
63
64 Jbi4CorbaBinding jbi4CorbaBinding = (Jbi4CorbaBinding)
65 extReg.createExtension(parentType, elementType);
66
67
68 Element tempEl = DOMUtils.getFirstChildElement(el);
69 while (tempEl != null) {
70
71
72 if (QNameUtils.matches(Jbi4CorbaExtension.Q_ELEM_JBI4CORBA_IDLENTRY,
73 tempEl)) {
74
75 String idlContent = tempEl.getTextContent();
76 tempEl.getAttributes();
77 String location=tempEl.getAttribute(Jbi4CorbaExtension.RELATIVE_PATH);
78 if ("".equals(location)){
79 location=Jbi4CorbaExtension.DEFAULT_RELATIVE_PATH;
80 }
81 String filename=tempEl.getAttribute(Jbi4CorbaExtension.FILENAME);
82 if ("".equals(filename)){
83 filename=Jbi4CorbaExtension.DEFAULT_FILENAME;
84 }
85 String rootString=tempEl.getAttribute(Jbi4CorbaExtension.ROOT);
86 if ("".equals(rootString)){
87 rootString="true";
88 }
89 boolean root=Boolean.parseBoolean(rootString);
90 Jbi4CorbaIDLEntry jbi4CorbaIDLEntry=new Jbi4CorbaIDLEntry();
91 jbi4CorbaIDLEntry.setIDL(idlContent);
92 jbi4CorbaIDLEntry.setIdlFilename(filename);
93 jbi4CorbaIDLEntry.setRelativePath(location);
94 jbi4CorbaIDLEntry.setRoot(root);
95 jbi4CorbaBinding.getJbi4CorbaDLEntryList().add(jbi4CorbaIDLEntry);
96 LOG.debug("Loaded idl entry: " + jbi4CorbaIDLEntry);
97 }
98
99 tempEl = DOMUtils.getNextSiblingElement(tempEl);
100
101 }
102 LOG.debug("Loaded binding: " + jbi4CorbaBinding);
103 return jbi4CorbaBinding;
104 }
105 }