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   
9   
10  package it.imolinfo.jbi4cics.jbi.wsdl;
11  
12  import it.imolinfo.jbi4cics.Logger;
13  import it.imolinfo.jbi4cics.LoggerFactory;
14  import javax.wsdl.Binding;
15  import javax.wsdl.Port;
16  import javax.wsdl.extensions.ExtensionRegistry;
17  import javax.xml.namespace.QName;
18  
19  /**
20   * JWSDL Extension class. See JSR 110.
21   *
22   * @author amedeocannone
23   * @author marcopiraccini
24   * @author <a href="mailto:mcimatti@imolinfo.it">Marco Cimatti</a>
25   */
26  public final class Jbi4CicsExtension {
27  
28      /**
29       * The namespace used for Jbi4Cics WSDL elements.
30       */
31      public static final String NS_URI_JBI4CICS
32              = "uri://schemas.imola.it/jbi/wsdl-extensions/cics/";
33  
34      public static final String DEFAULT_PREFIX = "imolacics";
35      public static final String BINDING_ELEMENT = "binding";
36      public static final String ADDRESS_ELEMENT = "address";
37      public static final String COPY_COBOL_ELEMENT = "copyCobol";
38      public static final String OUTPUT_COPY_COBOL_ELEMENT = "outputCopyCobol";
39      public static final String SERVICE_PACKAGE_NAME_ATTRIBUTE = "servicePackageName";
40      public static final String CODE_PAGE_NAME_ATTRIBUTE = "codePage";
41      public static final String SAME_COPY_COBOL_ATTRIBUTE = "sameCopyCobol";
42      public static final String USERNAME_ATTRIBUTE = "username";
43      public static final String PASSWORD_ATTRIBUTE = "password";
44      public static final String CONNECTION_TYPE_ATTRIBUTE = "connectionType";
45      public static final String JNDI_CONNECTION_NAME_ATTRIBUTE = "JNDIConnectionName";
46      public static final String PROGRAM_NAME_ATTRIBUTE = "programName";
47      public static final String TRANSACTION_NAME_ATTRIBUTE = "transactionName";
48      public static final String TPN_ATTRIBUTE = "tpn";
49  
50      /**
51       * The qualified name of Jbi4Cics extension binding element.
52       */
53      public static final QName Q_ELEM_JBI4CICS_BINDING
54              = new QName(NS_URI_JBI4CICS, BINDING_ELEMENT);
55  
56      /**
57       * The qualified name of Jbi4Cics extension address element.
58       */
59      public static final QName Q_ELEM_JBI4CICS_ADDRESS
60              = new QName(NS_URI_JBI4CICS, ADDRESS_ELEMENT);
61  
62      /**
63       * The qualified name of the copy Cobol used for input and, optionally, also
64       * for output.
65       */
66      public static final QName Q_ELEM_JBI4CICS_COPY_COBOL
67              = new QName(NS_URI_JBI4CICS, COPY_COBOL_ELEMENT);
68  
69      /**
70       * The qualified name of the output copy Cobol.
71       */
72      public static final QName Q_ELEM_JBI4CICS_OUTPUT_COPY_COBOL
73              = new QName(NS_URI_JBI4CICS, OUTPUT_COPY_COBOL_ELEMENT);
74  
75      /**
76       * The logger for this class and its instances.
77       */
78      private static final Logger LOG
79              = LoggerFactory.getLogger(Jbi4CicsExtension.class);
80  
81      /**
82       * Constructor. It's declared <code>private</code> to prevent instance
83       * creation for this class.
84       */
85      private Jbi4CicsExtension() {
86      }
87  
88      /**
89       * Registers the Jbi4Cics WSDL extensions into the specified registry.
90       *
91       * @param  registry  the extensions registry to register the Jbi4Cics WSDL
92       *                   extensions.
93       */
94      public static void register(ExtensionRegistry registry) {
95          LOG.debug("Start ExtensionRegistry registration");
96  
97          // Address
98          registry.mapExtensionTypes(
99                  Port.class, Q_ELEM_JBI4CICS_ADDRESS, Jbi4CicsAddress.class);
100         registry.registerDeserializer(Port.class, Q_ELEM_JBI4CICS_ADDRESS,
101                                       new Jbi4CicsAddressDeserializer());
102         registry.registerSerializer(Port.class, Q_ELEM_JBI4CICS_ADDRESS,
103                                     new Jbi4CicsAddressSerializer());
104 
105         // Binding
106         registry.mapExtensionTypes(Binding.class,
107                 Q_ELEM_JBI4CICS_BINDING, Jbi4CicsBinding.class);
108         registry.registerDeserializer(Binding.class,
109                 Q_ELEM_JBI4CICS_BINDING, new Jbi4CicsBindingDeserializer());
110         registry.registerSerializer(Binding.class,
111                 Q_ELEM_JBI4CICS_BINDING, new Jbi4CicsBindingSerializer());
112     }
113 }