1 57 58 package org.apache.wsif.providers.jms; 59 60 import java.security.AccessController ; 61 import java.security.PrivilegedAction ; 62 import java.util.Iterator ; 63 import java.util.List ; 64 65 import javax.wsdl.Binding; 66 import javax.wsdl.Definition; 67 import javax.wsdl.Port; 68 import javax.wsdl.Service; 69 70 import org.apache.wsif.WSIFException; 71 import org.apache.wsif.WSIFPort; 72 import org.apache.wsif.base.WSIFServiceImpl; 73 import org.apache.wsif.logging.Trc; 74 import org.apache.wsif.providers.WSIFDynamicTypeMap; 75 import org.apache.wsif.spi.WSIFProvider; 76 import org.apache.wsif.wsdl.extensions.jms.JMSBinding; 77 78 83 public class WSIFDynamicProvider_Jms implements WSIFProvider { 84 85 private static final String jms = "http://schemas.xmlsoap.org/wsdl/jms/"; 86 private static String [] bindings = new String [0]; 87 private static String [] addresses = new String [0]; 88 private static boolean setUpBindings = false; 89 private static boolean setUpAddresses = false; 90 91 public WSIFDynamicProvider_Jms() { 92 Trc.entry(this); 93 if (!setUpBindings) { 94 setUpBindingNamespaceURIs(); 95 } 96 if (!setUpAddresses) { 97 setUpAddressNamespaceURIs(); 98 } 99 WSIFServiceImpl.addExtensionRegistry( 101 new org.apache.wsif.wsdl.extensions.jms.JMSExtensionRegistry()); 102 Trc.exit(); 103 } 104 105 108 public WSIFPort createDynamicWSIFPort( 109 Definition def, 110 Service service, 111 Port port, 112 WSIFDynamicTypeMap typeMap) 113 throws WSIFException { 114 115 Trc.entry(this, def, service, port, typeMap); 116 117 Binding binding = port.getBinding(); 119 List exs = binding.getExtensibilityElements(); 120 for (Iterator i = exs.iterator(); i.hasNext();) { 121 Object o = i.next(); 122 123 if (o instanceof JMSBinding) { 124 WSIFPort wp = new WSIFPort_Jms(def, port, typeMap); 126 Trc.exit(wp); 127 return wp; 128 } 129 } 130 131 Trc.exit(); 133 return null; 134 } 135 136 140 public String [] getBindingNamespaceURIs() { 141 Trc.entry(this); 142 Trc.exit(bindings); 143 return bindings; 144 } 145 146 150 public String [] getAddressNamespaceURIs() { 151 Trc.entry(this); 152 Trc.exit(addresses); 153 return addresses; 154 } 155 156 private void setUpBindingNamespaceURIs() { 157 Class cls = 160 (Class ) AccessController.doPrivileged(new PrivilegedAction () { 161 public Object run() { 162 try { 163 return Class.forName( 164 "javax.jms.Queue", 165 true, 166 Thread.currentThread().getContextClassLoader()); 167 } catch (Throwable ignored) { 168 Trc.ignoredException(ignored); 169 } 170 return null; 171 } 172 }); 173 if (cls != null) { 174 bindings = new String [] { jms }; 175 } 176 setUpBindings = true; 177 } 178 179 private void setUpAddressNamespaceURIs() { 180 Class cls = 183 (Class ) AccessController.doPrivileged(new PrivilegedAction () { 184 public Object run() { 185 try { 186 return Class.forName( 187 "javax.jms.Queue", 188 true, 189 Thread.currentThread().getContextClassLoader()); 190 } catch (Throwable ignored) { 191 Trc.ignoredException(ignored); 192 } 193 return null; 194 } 195 }); 196 197 if (cls != null) { 198 addresses = new String [] { jms }; 199 } 200 setUpAddresses = true; 201 } 202 } | Popular Tags |