1 /*******************************************************************************
2 * Copyright (c) 2005, 2006, 2007 Imola Informatica.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the LGPL License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/lgpl.html
7 *******************************************************************************/
8 package it.imolinfo.jbi4ejb.jbi.wsdl;
9
10 import it.imolinfo.jbi4ejb.Logger;
11 import it.imolinfo.jbi4ejb.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
24 /**
25 * Deserializer for the Jbi4Ejb WSDL Extension (addess element), according with JWSDL specs.
26 * See JSR 110.
27 *
28 * @author <a href="mailto:mpiraccini@imolinfo.it">Marco Piraccini</a>
29 */
30 public class Jbi4EjbAddressDeserializer implements ExtensionDeserializer {
31
32 private static final Logger LOG
33 = LoggerFactory.getLogger(Jbi4EjbAddressDeserializer.class);
34
35
36 /**
37 * Instantiates a new jbi4 ejb address deserializer.
38 */
39 public Jbi4EjbAddressDeserializer() {}
40
41
42 /**
43 * Deserialize the jbi4ejb address from the WSDL.
44 *
45 * @param parentType the parten type
46 * @param elementType the elemnt type
47 * @param el the element
48 * @param def the whole WSDL definition
49 * @param extReg the extension registry
50 *
51 * @return the <code>Jbi4EjbAddress</code> extensibility element
52 *
53 * @throws WSDLException if some problem occurs in unmarshalling
54 *
55 * @see javax.wsdl.extensions.ExtensionDeserializer#unmarshall(java.lang.Class,
56 * javax.xml.namespace.QName, org.w3c.dom.Element,
57 * javax.wsdl.Definition, javax.wsdl.extensions.ExtensionRegistry)
58 */
59 @SuppressWarnings("unchecked")
60 public ExtensibilityElement unmarshall(Class parentType, QName elementType,
61 Element el, Definition def, ExtensionRegistry extReg)
62 throws WSDLException {
63
64 Jbi4EjbAddress jbi4EjbAddress = (Jbi4EjbAddress) extReg
65 .createExtension(parentType, elementType);
66
67 jbi4EjbAddress.setName(DOMUtils.getAttribute(el,
68 Jbi4EjbExtension.NAME_ATTRIBUTE));
69
70 jbi4EjbAddress.setLocalizationType(DOMUtils.getAttribute(el,
71 Jbi4EjbExtension.LOCALIZATION_TYPE_ATTRIBUTE));
72
73 LOG.debug("Loaded from address extension the name: " + jbi4EjbAddress.getName());
74
75 return jbi4EjbAddress;
76 }
77
78 }