View Javadoc

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.extensions.ExtensionRegistry;
14  import javax.xml.namespace.QName;
15  
16  /**
17   * JWSDL Extension class. See JSR 110.
18   * 
19   * @author <a href="mailto:mpiraccini@imolinfo.it">Marco Piraccini</a>
20   */
21  public final class Jbi4EjbExtension {
22  
23      /** The Constant NS_URI_JBI4EJB. */
24      public static final String NS_URI_JBI4EJB = "uri://schemas.imola.it/jbi/wsdl-extensions/ejb/";
25  
26      /** The Constant DEFAULT_PREFIX. */
27      public static final String DEFAULT_PREFIX = "imolaejb";    
28  
29      /** The Constant BINDING_ELEMENT. */
30      public static final String BINDING_ELEMENT = "binding";
31  
32      /** The Constant ADDRESS_ELEMENT. */
33      public static final String ADDRESS_ELEMENT = "address";
34      
35      /** The Constant TYPES_ELEMENT. */
36      public static final String TYPES_ELEMENT = "types";
37      
38      /** The Constant SERIAL_VERSION_UID_ELEMENT. */
39      public static final String SERIAL_VERSION_UID_ELEMENT = "serialVersionUID";
40      
41      /** The Constant LOCALIZATION_TYPE_ATTRIBUTE. */
42      public static final String LOCALIZATION_TYPE_ATTRIBUTE = "localizationType";    
43  
44      /** The Constant ORB_ELEMENT. */
45      public static final String ORB_ELEMENT = "orb";
46      
47      /** The Constant JNDI_ELEMENT. */
48      public static final String JNDI_ELEMENT = "jndi";
49  
50      /** The Constant PROPERTY_ELEMENT. */
51      public static final String PROPERTY_ELEMENT = "property";
52  
53      /** The Constant NAME_ATTRIBUTE. */
54      public static final String NAME_ATTRIBUTE = "name";
55  
56      /** The Constant VALUE_ATTRIBUTE. */
57      public static final String VALUE_ATTRIBUTE = "value";
58      
59      /** The Constant CLASSNAME_ATTRIBUTE. */
60      public static final String CLASSNAME_ATTRIBUTE = "className";
61  
62      /** The Constant UID_ATTRIBUTE. */
63      public static final String UID_ATTRIBUTE = "UID";       
64      
65  
66      /** The Constant Q_ELEM_JBI4EJB_BINDING. */
67      public static final QName Q_ELEM_JBI4EJB_BINDING = new QName(NS_URI_JBI4EJB,
68              BINDING_ELEMENT);
69  
70      /** The Constant Q_ELEM_JBI4EJB_ADDRESS. */
71      public static final QName Q_ELEM_JBI4EJB_ADDRESS = new QName(NS_URI_JBI4EJB,
72              ADDRESS_ELEMENT);
73      
74      /** The Constant Q_ELEM_JBI4EJB_TYPES. */
75      public static final QName Q_ELEM_JBI4EJB_TYPES = new QName(NS_URI_JBI4EJB,
76              TYPES_ELEMENT);    
77  
78      /** The Constant Q_ELEM_JBI4EJB_ORB. */
79      public static final QName Q_ELEM_JBI4EJB_ORB = new QName(NS_URI_JBI4EJB,
80              ORB_ELEMENT);
81      
82      /** The Constant Q_ELEM_JBI4EJB_JNDI. */
83      public static final QName Q_ELEM_JBI4EJB_JNDI = new QName(NS_URI_JBI4EJB,
84              JNDI_ELEMENT);
85      
86      /** The Constant Q_ELEM_JBI4EJB_SERIAL_VERSION_UID. */
87      public static final QName Q_ELEM_JBI4EJB_SERIAL_VERSION_UID = new QName(NS_URI_JBI4EJB,
88              SERIAL_VERSION_UID_ELEMENT);    
89  
90          
91      /** The logger for this class and its instances. */
92      private static final Logger LOG
93              = LoggerFactory.getLogger(Jbi4EjbExtension.class);
94      
95      
96      /**
97       * Instantiates a new jbi4 ejb extension.
98       */
99      private Jbi4EjbExtension() {}
100 
101     /**
102      * Register the Jbi4Corba WSDL extension.
103      * 
104      * @param registry the extension registry
105      */
106     public static void register(ExtensionRegistry registry) {
107 
108         LOG.debug("Start ExtensionRegistry registration");
109 
110         // Address
111         registry.mapExtensionTypes(
112                 javax.wsdl.Port.class,
113                 Q_ELEM_JBI4EJB_ADDRESS, Jbi4EjbAddress.class);
114 
115         registry.registerDeserializer(
116                 javax.wsdl.Port.class,
117                 Q_ELEM_JBI4EJB_ADDRESS, new Jbi4EjbAddressDeserializer());
118 
119         registry.registerSerializer(
120                javax.wsdl.Port.class,
121                Q_ELEM_JBI4EJB_ADDRESS, new Jbi4EjbAddressSerializer());
122 
123         // Binding
124         registry.mapExtensionTypes(javax.wsdl.Binding.class,
125                 Q_ELEM_JBI4EJB_BINDING, Jbi4EjbBinding.class);
126 
127         registry.registerDeserializer(javax.wsdl.Binding.class,
128                 Q_ELEM_JBI4EJB_BINDING, new Jbi4EjbBindingDeserializer());
129 
130         registry.registerSerializer(javax.wsdl.Binding.class,
131                 Q_ELEM_JBI4EJB_BINDING, new Jbi4EjbBindingSerializer());
132 
133         // Types (At the definition level!!!!)
134         registry.mapExtensionTypes(javax.wsdl.Definition.class,
135                 Q_ELEM_JBI4EJB_TYPES, Jbi4EjbTypes.class);
136         
137         registry.registerDeserializer(javax.wsdl.Definition.class,
138                 Q_ELEM_JBI4EJB_TYPES, new Jbi4EjbTypesDeserializer());       
139         
140         registry.registerSerializer(javax.wsdl.Definition.class,
141                 Q_ELEM_JBI4EJB_TYPES, new Jbi4EjbTypesSerializer());
142     }
143 }