1 /**********************************************************************
2 * WSIFDynamicProvider_EJOE.java
3 * created on 13.07.2006 by netseeker
4 * $Source$
5 * $Date$
6 * $Revision$
7 *
8 * ====================================================================
9 *
10 * Copyright 2006 netseeker aka Michael Manske
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 * ====================================================================
24 *
25 * This file is part of the EJOE framework.
26 * For more information on the author, please see
27 * <http://www.manskes.de/>.
28 *
29 *********************************************************************/
30
31 package de.netseeker.ejoe.ext.wsif;
32
33 import java.util.Iterator;
34 import java.util.List;
35
36 import javax.wsdl.Binding;
37 import javax.wsdl.Definition;
38 import javax.wsdl.Port;
39 import javax.wsdl.Service;
40
41 import org.apache.wsif.WSIFException;
42 import org.apache.wsif.WSIFPort;
43 import org.apache.wsif.logging.Trc;
44 import org.apache.wsif.providers.WSIFDynamicTypeMap;
45 import org.apache.wsif.spi.WSIFProvider;
46
47 import de.netseeker.ejoe.ext.wsif.wsdl.EJOEBinding;
48
49 /***
50 * WSIF dynamic provider for EJOE To set it manuelly in your WSIF client code use:
51 *
52 * <pre>
53 * // create a service factory
54 * WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
55 *
56 * WSIFServiceImpl.setDynamicWSIFProvider( "http://schemas.xmlsoap.org/wsdl/ejoe/", new WSIFDynamicProvider_EJOE() );
57 *
58 * WSIFServiceImpl.addExtensionRegistry( new EJOEExtensionsRegistry() );
59 * </pre>
60 *
61 * @author netseeker
62 * @since 0.3.9.1
63 */
64 public class WSIFDynamicProvider_EJOE implements WSIFProvider
65 {
66 private static final String[] supportedBindingNamespaceURIs = { "http://schemas.xmlsoap.org/wsdl/ejoe/" };
67
68 private static final String[] supportedAddressNamespaceURIs = { "http://schemas.xmlsoap.org/wsdl/ejoe/" };
69
70 public WSIFDynamicProvider_EJOE()
71 {
72 Trc.entry( this );
73 Trc.exit();
74 }
75
76 /***
77 * Check if WSDL port has EJOE binding and if successful try to create EJOE port instance.
78 */
79 public WSIFPort createDynamicWSIFPort( Definition def, Service service, Port port, WSIFDynamicTypeMap typeMap )
80 throws WSIFException
81 {
82 Trc.entry( this, def, service, port, typeMap );
83
84
85 Binding binding = port.getBinding();
86 List exs = binding.getExtensibilityElements();
87 for ( Iterator i = exs.iterator(); i.hasNext(); )
88 {
89 Object o = i.next();
90 if ( o instanceof EJOEBinding )
91 {
92
93 WSIFPort wp = new WSIFPort_EJOE( def, port, typeMap );
94 Trc.exit( wp );
95 return wp;
96 }
97 }
98
99
100 Trc.exit();
101 return null;
102 }
103
104 /***
105 * Returns the WSDL namespace URIs of any bindings this provider supports.
106 *
107 * @return an array of all binding namespaces supported by this provider
108 */
109 public String[] getBindingNamespaceURIs()
110 {
111 Trc.entry( this );
112 Trc.exit( supportedBindingNamespaceURIs );
113 return supportedBindingNamespaceURIs;
114 }
115
116 /***
117 * Returns the WSDL namespace URIs of any port addresses this provider supports.
118 *
119 * @return an array of all address namespaces supported by this provider
120 */
121 public String[] getAddressNamespaceURIs()
122 {
123 Trc.entry( this );
124 Trc.exit( supportedAddressNamespaceURIs );
125 return supportedAddressNamespaceURIs;
126 }
127 }