View Javadoc

1   /****************************************************************************
2    * Copyright (c) 2005, 2006, 2007, 2008, 2009 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.jbi4corba.jbi.wsdl;
9   
10  import it.imolinfo.jbi4corba.Logger;
11  import it.imolinfo.jbi4corba.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 class Jbi4CorbaExtension {
22  
23      /**
24       * The namespace of the jbi4corba extensibility element.
25       */
26      public static final String NS_URI_JBI4CORBA = "uri://schemas.imola.it/jbi/wsdl-extensions/corba/";
27      /**
28       * The conventional prefix for the XML element of the extensibility element.
29       */
30      public static final String DEFAULT_PREFIX = "imolacorba";
31      /**
32       * An element name.
33       */
34      public static final String BINDING_ELEMENT = "binding";
35      /**
36       * An element name.
37       */
38      public static final String ADDRESS_ELEMENT = "address";
39      /**
40       * The localization types are: NameService, corbaloc, corbaname, IOR.
41       */
42      public static final String LOCALIZATION_TYPE_ATTRIBUTE = "localizationType";
43      /**
44       * The peristent attribute.
45       */
46      public static final String PERSISTENT_ATTRIBUTE = "persistent";
47      /**
48       * An element name.
49       */
50      public static final String ORB_ELEMENT = "orb";
51      /**
52       * An element name.
53       */
54      public static final String PROPERTY_ELEMENT = "property";
55      /**
56       * An attribute name.
57       */
58      public static final String NAME_ATTRIBUTE = "name";
59      /**
60       * An attribute name.
61       */
62      public static final String VALUE_ATTRIBUTE = "value";
63      /**
64       * An element name.
65       */
66      //public static final String IDL_ELEMENT = "idl";
67      public static final String IDL_ENTRY = "idl";
68      public static final String FILENAME = "filename";
69      public static final String RELATIVE_PATH = "relativepath";
70      public static final String ROOT = "root";
71      public static final String DEFAULT_FILENAME = "root.idl";
72      public static final String DEFAULT_RELATIVE_PATH = ".";
73      public static final boolean DEFAULT_ROOT = true;
74      public static final QName Q_ELEM_JBI4CORBA_BINDING = new QName(
75              NS_URI_JBI4CORBA, BINDING_ELEMENT);
76      public static final QName Q_ELEM_JBI4CORBA_ADDRESS = new QName(
77              NS_URI_JBI4CORBA, ADDRESS_ELEMENT);
78      public static final QName Q_ELEM_JBI4CORBA_IDLENTRY = new QName(
79              NS_URI_JBI4CORBA, IDL_ENTRY);
80      public static final QName Q_ELEM_JBI4CORBA_ORB = new QName(
81              NS_URI_JBI4CORBA, ORB_ELEMENT);
82      /**
83       * The logger for this class and its instances.
84       */
85      private static final transient Logger LOG = LoggerFactory.getLogger(Jbi4CorbaExtension.class);
86  
87      /**
88       * Default constructor.
89       * 
90       */
91      public Jbi4CorbaExtension() {
92      }
93  
94      /**
95       * Register the Jbi4Corba WSDL extension.
96       * 
97       * @param registry
98       *            The registry
99       */
100     public static void register(ExtensionRegistry registry) {
101 
102         LOG.debug("Start ExtensionRegistry registration");
103 
104         // Address
105         registry.mapExtensionTypes(javax.wsdl.Port.class,
106                 Q_ELEM_JBI4CORBA_ADDRESS, Jbi4CorbaAddress.class);
107 
108         registry.registerDeserializer(javax.wsdl.Port.class,
109                 Q_ELEM_JBI4CORBA_ADDRESS, new Jbi4CorbaAddressDeserializer());
110 
111         registry.registerSerializer(javax.wsdl.Port.class,
112                 Q_ELEM_JBI4CORBA_ADDRESS, new Jbi4CorbaAddressSerializer());
113 
114         // Binding
115         registry.mapExtensionTypes(javax.wsdl.Binding.class,
116                 Q_ELEM_JBI4CORBA_BINDING, Jbi4CorbaBinding.class);
117 
118         registry.registerDeserializer(javax.wsdl.Binding.class,
119                 Q_ELEM_JBI4CORBA_BINDING, new Jbi4CorbaBindingDeserializer());
120 
121         registry.registerSerializer(javax.wsdl.Binding.class,
122                 Q_ELEM_JBI4CORBA_BINDING, new Jbi4CorbaBindingSerializer());
123 
124     }
125 
126     public static void overrideAddressDeserializer(ExtensionRegistry registry,
127             Jbi4CorbaAddressDeserializer addressDeserializer) {
128         registry.registerDeserializer(javax.wsdl.Port.class,
129                 Q_ELEM_JBI4CORBA_ADDRESS, addressDeserializer);
130 
131     }
132 }