1 57 58 package org.apache.wsif.base; 59 60 import java.util.ArrayList ; 61 import java.util.HashMap ; 62 import java.util.Hashtable ; 63 import java.util.Iterator ; 64 import java.util.List ; 65 import java.util.Map ; 66 67 import javax.wsdl.Binding; 68 import javax.wsdl.Definition; 69 import javax.wsdl.Input; 70 import javax.wsdl.Message; 71 import javax.wsdl.Operation; 72 import javax.wsdl.OperationType; 73 import javax.wsdl.Output; 74 import javax.wsdl.Port; 75 import javax.wsdl.PortType; 76 import javax.wsdl.Service; 77 import javax.wsdl.WSDLException; 78 import javax.wsdl.extensions.ExtensibilityElement; 79 import javax.wsdl.extensions.ExtensionRegistry; 80 import javax.wsdl.extensions.UnknownExtensibilityElement; 81 import javax.xml.namespace.QName ; 82 83 import org.apache.wsif.WSIFConstants; 84 import org.apache.wsif.WSIFException; 85 import org.apache.wsif.WSIFMessage; 86 import org.apache.wsif.WSIFPort; 87 import org.apache.wsif.WSIFService; 88 import org.apache.wsif.compiler.schema.tools.Schema2Java; 89 import org.apache.wsif.compiler.util.TypeMapping; 90 import org.apache.wsif.compiler.util.Utils; 91 import org.apache.wsif.logging.MessageLogger; 92 import org.apache.wsif.logging.Trc; 93 import org.apache.wsif.providers.WSIFDynamicTypeMap; 94 import org.apache.wsif.spi.WSIFProvider; 95 import org.apache.wsif.util.WSIFPluggableProviders; 96 import org.apache.wsif.util.WSIFUtils; 97 import org.w3c.dom.Element ; 98 99 import com.ibm.wsdl.util.xml.QNameUtils; 100 101 102 112 public class WSIFServiceImpl implements WSIFService { 113 private static PrivateCompositeExtensionRegistry providersExtRegs = 114 new PrivateCompositeExtensionRegistry(); 115 private Definition def = null; 116 private Service service; 117 private PortType portType; 118 private Port[] myPortsArr; 119 private Map myPortsMap; 120 private WSIFDynamicTypeMap typeMap = new WSIFDynamicTypeMap(); 121 private boolean typeMapInitialised = false; 122 private String preferredPort = null; 123 private Map typeReg = null; 124 private Port chosenPort = null; 125 private WSIFMessage context; 126 127 139 WSIFServiceImpl( 140 String wsdlLoc, 141 String serviceNS, 142 String serviceName, 143 String portTypeNS, 144 String portTypeName) 145 throws WSIFException { 146 Trc.entry(this, wsdlLoc, serviceNS, serviceName, portTypeNS, portTypeName); 147 148 Definition def = null; 150 try { 151 def = WSIFUtils.readWSDL(null, wsdlLoc); 152 checkWSDL(def); 153 } catch (WSDLException ex) { 154 Trc.exception(ex); 155 throw new WSIFException("could not load " + wsdlLoc, ex); 156 } 157 158 Service service = WSIFUtils.selectService(def, serviceNS, serviceName); 160 161 PortType portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName); 163 164 init(def, service, portType); 165 if (Trc.ON) 166 Trc.exit(deep()); 167 } 168 169 182 WSIFServiceImpl( 183 String wsdlLoc, 184 ClassLoader cl, 185 String serviceNS, 186 String serviceName, 187 String portTypeNS, 188 String portTypeName) 189 throws WSIFException { 190 Trc.entry(this, wsdlLoc, cl, serviceNS, serviceName, portTypeNS, portTypeName); 191 192 Definition def = null; 194 try { 195 def = WSIFUtils.readWSDL(null, wsdlLoc, cl); 196 checkWSDL(def); 197 } catch (WSDLException ex) { 198 Trc.exception(ex); 199 throw new WSIFException("could not load " + wsdlLoc, ex); 200 } 201 202 Service service = WSIFUtils.selectService(def, serviceNS, serviceName); 204 205 PortType portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName); 207 208 init(def, service, portType); 209 if (Trc.ON) 210 Trc.exit(deep()); 211 } 212 213 219 WSIFServiceImpl(Definition def) throws WSIFException { 220 this(def, null); 221 } 222 223 229 WSIFServiceImpl(Definition def, Service service) throws WSIFException { 230 this(def, service, null); 231 } 232 233 239 WSIFServiceImpl(Definition def, Service service, PortType portType) 240 throws WSIFException { 241 Trc.entry(this, def, service, portType); 242 243 init(def, service, portType); 244 if (Trc.ON) 245 Trc.exit(deep()); 246 } 247 248 254 WSIFServiceImpl(Definition def, String serviceNS, String serviceName) 255 throws WSIFException { 256 Trc.entry(this, def, serviceNS, serviceName); 257 258 Service service = WSIFUtils.selectService(def, serviceNS, serviceName); 260 init(def, service, null); 261 if (Trc.ON) 262 Trc.exit(deep()); 263 } 264 265 271 WSIFServiceImpl( 272 Definition def, 273 String serviceNS, 274 String serviceName, 275 String portTypeNS, 276 String portTypeName) 277 throws WSIFException { 278 Trc.entry(this, def, serviceNS, serviceName, portTypeNS, portTypeName); 279 280 checkWSDLForWSIF(def); 281 282 Service service = WSIFUtils.selectService(def, serviceNS, serviceName); 284 285 PortType portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName); 287 288 init(def, service, portType); 289 if (Trc.ON) 290 Trc.exit(deep()); 291 } 292 293 297 WSIFServiceImpl(WSIFServiceImpl wsi) 298 throws WSIFException { 299 Trc.entry(this, wsi); 300 copyInitializedService(wsi); 301 if (Trc.ON) 302 Trc.exit(deep()); 303 } 304 305 308 private void copyInitializedService(WSIFServiceImpl svc) { 309 this.def = svc.def; 310 this.service = svc.service; 311 this.portType = svc.portType; 312 this.myPortsArr = new Port[svc.myPortsArr.length]; 313 System.arraycopy(svc.myPortsArr, 0, this.myPortsArr, 0, svc.myPortsArr.length); 314 this.myPortsMap = (Map ) ((Hashtable ) svc.myPortsMap).clone(); 315 this.typeMap = svc.typeMap.copy(); 316 } 317 318 322 public void setPreferredPort(String portName) throws WSIFException { 323 Trc.entry(this, portName); 324 325 if (portName == null) { 326 throw new WSIFException("Preferred port name cannot be null"); 327 } 328 PortType pt = getPortTypeFromPortName(portName); 329 if (pt.getQName().equals(this.portType.getQName())) { 330 this.preferredPort = portName; 331 } else { 332 throw new WSIFException( 333 "Preferred port " 334 + portName 335 + "is not available for the port type " 336 + this.portType.getQName()); 337 } 338 Trc.exit(); 339 } 340 341 347 private PortType getPortTypeFromPortName(String portName) 348 throws WSIFException { 349 if (portName == null) { 350 throw new WSIFException("Unable to find port type from a null port name"); 351 } 352 Port port = (Port) service.getPort(portName); 353 if (port == null) { 354 throw new WSIFException( 355 "Port '" + portName + "' cannot be found in the service"); 356 } 357 Binding binding = port.getBinding(); 358 if (binding == null) { 359 throw new WSIFException("No binding found for port '" + portName + "'"); 360 } 361 PortType pt = binding.getPortType(); 362 if (pt == null) { 363 throw new WSIFException( 364 "No port type found for binding '" + binding.getQName() + "'"); 365 } 366 checkPortTypeInformation(def, pt); 367 return pt; 368 } 369 370 374 public Iterator getAvailablePortNames() throws WSIFException { 375 Trc.entry(this); 376 Iterator it = null; 377 try { 378 it = this.myPortsMap.keySet().iterator(); 379 } catch (NullPointerException ne) { 380 Trc.exception(ne); 381 it = null; 382 } 383 Trc.exit(); 384 return it; 385 } 386 387 390 private WSIFPort createDynamicWSIFPort( 391 Definition def, 392 Service service, 393 Port port) 394 throws WSIFException { 395 checkWSDLForWSIF(def); 396 List bindingExList = port.getBinding().getExtensibilityElements(); 397 ExtensibilityElement bindingFirstEx = 398 (ExtensibilityElement) bindingExList.get(0); 399 String bindingNS = bindingFirstEx.getElementType().getNamespaceURI(); 400 WSIFProvider provider = WSIFPluggableProviders.getProvider(bindingNS); 401 if (provider == null) { 402 throw new WSIFException( 403 "could not find suitable provider for binding namespace '" + bindingNS + "'"); 404 } 405 WSIFPort wsifPort = 406 provider.createDynamicWSIFPort(def, service, port, typeMap); 407 wsifPort.setContext(getContext()); 408 return wsifPort; 409 } 410 411 public WSIFPort getPort() throws WSIFException { 412 Trc.entry(this); 413 WSIFPort wp = null; 414 if (preferredPort != null && myPortsMap.get(preferredPort) != null) { 415 wp = getPort(this.preferredPort); 416 } else { 417 if (preferredPort != null) 418 MessageLogger.log("WSIF.0011I",preferredPort); 419 wp = getPort(null); 420 } 421 Trc.exit(wp); 422 return wp; 423 } 424 425 428 public WSIFPort getPort(String portName) throws WSIFException { 429 Trc.entry(this, portName); 430 Port port = null; 431 432 if (portName == null) { 433 if (myPortsArr.length > 0) { 435 port = myPortsArr[0]; 436 } 437 } else { 438 port = (Port) myPortsMap.get(portName); 439 } 440 if (port == null) { 441 if (portName == null) { 442 throw new WSIFException("Unable to find an available port"); 443 } else { 444 throw new WSIFException( 445 "Port '" 446 + portName 447 + "' is not available and " 448 + " no alternative can be found"); 449 } 450 } 451 452 portName = port.getName(); 453 WSIFPort portInstance = createDynamicWSIFPort(def, service, port); 454 if (portInstance == null) { 455 throw new WSIFException( 456 "Provider was unable to create WSIFPort for port " + portName); 457 } 458 chosenPort = port; 460 461 Trc.exit(portInstance); 462 return portInstance; 463 } 464 465 470 public void mapType(QName xmlType, Class javaType) throws WSIFException { 471 Trc.entry(this, xmlType, javaType); 472 typeMap.mapType(xmlType, javaType); 473 Trc.exit(); 474 } 475 476 483 private void mapType(QName xmlType, Class javaType, boolean force) 484 throws WSIFException { 485 Trc.entry(this, xmlType, javaType, new Boolean (force)); 486 typeMap.mapType(xmlType, javaType, force); 487 Trc.exit(); 488 } 489 490 495 public void mapPackage(String namespace, String packageName) 496 throws WSIFException { 497 Trc.entry(namespace, packageName); 498 typeMap.mapPackage(namespace, packageName); 499 Trc.exit(); 500 } 501 502 506 public static WSIFProvider getDynamicWSIFProvider(String namespaceURI) { 507 Trc.entry(null, namespaceURI); 508 WSIFProvider p = 509 WSIFPluggableProviders.getProvider( namespaceURI ); 510 Trc.exit( p ); 511 return p; 512 } 513 514 518 public static void setDynamicWSIFProvider( 519 String providerNamespaceURI, 520 WSIFProvider provider) { 521 Trc.entry(null, providerNamespaceURI, provider); 522 523 WSIFPluggableProviders.overrideDefaultProvider( 524 providerNamespaceURI, provider ); 525 526 Trc.exit(); 527 } 528 529 533 public static void setAutoLoadProviders(boolean b) { 534 Trc.entry(null, b); 535 WSIFPluggableProviders.setAutoLoadProviders( b ); 536 Trc.exit(); 537 } 538 539 543 public Object getStub(String portName, Class iface) throws WSIFException { 544 Trc.entry(this, portName, iface); 545 546 if (!typeMapInitialised) { 554 initialiseTypeMappings(); 555 typeMapInitialised = true; 556 } 557 558 WSIFPort wsifPort = getPort(portName); 561 562 PortType pt = getPortTypeFromPortName(portName); 564 565 WSIFClientProxy clientProxy = 570 WSIFClientProxy.newInstance( 571 iface, 572 def, 573 service.getQName().getNamespaceURI(), 574 service.getQName().getLocalPart(), 575 portType.getQName().getNamespaceURI(), 576 portType.getQName().getLocalPart(), 577 typeMap); 578 579 clientProxy.setPort(wsifPort); 580 Object proxy = clientProxy.getProxy(); 581 582 Trc.exit(); 584 return proxy; 585 } 586 587 590 public Object getStub(Class iface) throws WSIFException { 591 Trc.entry(this, iface); 592 593 if (!typeMapInitialised) { 601 initialiseTypeMappings(); 602 typeMapInitialised = true; 603 } 604 605 WSIFPort wsifPort = getPort(); 608 609 String portName = chosenPort.getName(); 611 PortType pt = getPortTypeFromPortName(portName); 612 613 WSIFClientProxy clientProxy = 618 WSIFClientProxy.newInstance( 619 iface, 620 def, 621 service.getQName().getNamespaceURI(), 622 service.getQName().getLocalPart(), 623 pt.getQName().getNamespaceURI(), 624 pt.getQName().getLocalPart(), 625 typeMap); 626 627 clientProxy.setPort(wsifPort); 628 Object proxy = clientProxy.getProxy(); 629 630 Trc.exit(); 632 return proxy; 633 } 634 635 639 public static void addExtensionRegistry(ExtensionRegistry reg) { 640 Trc.entry(null, reg); 641 providersExtRegs.addExtensionRegistry(reg); 642 Trc.exit(); 643 } 644 645 653 public static ExtensionRegistry getCompositeExtensionRegistry() { 654 Trc.entry(null); 655 Trc.exit(providersExtRegs); 656 return providersExtRegs; 657 } 658 659 private void init(Definition def, Service service, PortType portType) 660 throws WSIFException { 661 if (def == null) 662 throw new IllegalArgumentException ("WSDL definition can not be null"); 663 checkWSDLForWSIF(def); 664 665 if (service == null) { 666 Map services = WSIFUtils.getAllItems(def, "Service"); 667 668 service = (Service) WSIFUtils.getNamedItem(services, null, "Service"); 669 } 670 671 if (portType == null) { 672 Map ports = service.getPorts(); 674 if (ports.size() == 0) { 675 throw new WSIFException( 676 "WSDL must contain at least one port in " + service.getQName()); 677 } 678 679 for (Iterator i = ports.values().iterator(); i.hasNext();) { 680 Port port = (Port) i.next(); 681 if (portType == null) { 682 portType = port.getBinding().getPortType(); 683 } else { 684 PortType pt = port.getBinding().getPortType(); 685 if (!pt.getQName().equals(portType.getQName())) { 686 throw new WSIFException( 687 "when no port type was specified all ports " 688 + "must have the same port type in WSDL service " 689 + service.getQName()); 690 } 691 } 692 } 693 if (portType == null) { 694 throw new IllegalArgumentException ( 695 "WSDL more than one portType in service " + service); 696 697 } 698 } 699 this.def = def; 700 this.service = service; 701 this.portType = portType; 702 703 checkPortTypeInformation(def, portType); 707 708 710 Map ports = service.getPorts(); 711 if (ports.size() == 0) { 713 throw new WSIFException( 714 "WSDL must contain at least one port in " + service.getQName()); 715 } 716 717 myPortsMap = new Hashtable (); 718 for (Iterator i = ports.values().iterator(); i.hasNext();) { 719 Port port = (Port) i.next(); 720 721 Binding binding = port.getBinding(); 722 if (binding == null) 723 continue; 725 try { 726 List bindingExList = port.getBinding().getExtensibilityElements(); 728 ExtensibilityElement bindingFirstEx = 729 (ExtensibilityElement) bindingExList.get(0); 730 String bindingNS = bindingFirstEx.getElementType().getNamespaceURI(); 731 String addressNS = bindingNS; 732 try { 733 List addressExList = port.getExtensibilityElements(); 734 ExtensibilityElement addressFirstEx = 735 (ExtensibilityElement) addressExList.get(0); 736 addressNS = addressFirstEx.getElementType().getNamespaceURI(); 737 } catch (NullPointerException npe) { 738 Trc.ignoredException(npe); 739 } catch (ArrayIndexOutOfBoundsException aie) { 741 Trc.ignoredException(aie); 742 } 745 if (WSIFPluggableProviders.isProviderAvailable(bindingNS, addressNS) ) { 747 if (binding.getPortType().getQName().equals(portType.getQName())) { 749 String portName = port.getName(); 750 myPortsMap.put(portName, port); 751 } 752 } 753 } catch (NullPointerException e) { 754 Trc.ignoredException(e); 755 } catch (ArrayIndexOutOfBoundsException aie) { 759 Trc.ignoredException(aie); 760 } 762 } 763 int size = myPortsMap.size(); 764 myPortsArr = new Port[size]; 765 int count = 0; 766 for (Iterator i = myPortsMap.values().iterator(); i.hasNext();) { 767 Port port = (Port) i.next(); 769 myPortsArr[count++] = port; 770 } 771 772 typeMap.setAllTypes(getAllCustomTypes()); 775 } 776 777 780 private ArrayList getAllCustomTypes() { 781 ArrayList types = new ArrayList (); 782 Iterator typeMappingIterator = getDefaultTypeMappings(); 783 if (typeMappingIterator != null) { 784 while (typeMappingIterator.hasNext()) { 785 TypeMapping tm = (TypeMapping) typeMappingIterator.next(); 786 if (tm != null) { 787 String namespaceURI = tm.elementType.getNamespaceURI(); 788 if (!namespaceURI.equals(WSIFConstants.NS_URI_1999_SCHEMA_XSD) 789 && !namespaceURI.equals(WSIFConstants.NS_URI_2000_SCHEMA_XSD) 790 && !namespaceURI.equals(WSIFConstants.NS_URI_2001_SCHEMA_XSD)) { 791 QName element = tm.elementType; 792 if (element != null) { 793 types.add(element); 794 } 795 } 796 } 797 } 798 } 799 return types; 800 } 801 802 806 private Iterator getDefaultTypeMappings() { 807 if (typeReg != null) { 808 return typeReg.values().iterator(); 809 } 810 typeReg = new HashMap (); 811 List typesElList = Utils.getAllTypesElements(def); 812 if (typesElList.size() > 0) { 813 String schemaURI1999 = WSIFConstants.NS_URI_1999_SCHEMA_XSD; 814 Schema2Java s2j1999 = new Schema2Java(schemaURI1999); 815 QName qElemSchema1999 = new QName (schemaURI1999, "schema"); 816 String schemaURI2000 = WSIFConstants.NS_URI_2000_SCHEMA_XSD; 817 Schema2Java s2j2000 = new Schema2Java(schemaURI2000); 818 QName qElemSchema2000 = new QName (schemaURI2000, "schema"); 819 String schemaURI2001 = WSIFConstants.NS_URI_2001_SCHEMA_XSD; 820 Schema2Java s2j2001 = new Schema2Java(schemaURI2001); 821 QName qElemSchema2001 = new QName (schemaURI2001, "schema"); 822 823 Iterator typesElIterator = typesElList.iterator(); 824 while (typesElIterator.hasNext()) { 825 UnknownExtensibilityElement unknExEl = 826 (UnknownExtensibilityElement) typesElIterator.next(); 827 Element schemaEl = unknExEl.getElement(); 828 try { 829 if (QNameUtils.matches(qElemSchema1999, schemaEl) 830 || QNameUtils.matches(qElemSchema2000, schemaEl) 831 || QNameUtils.matches(qElemSchema2001, schemaEl)) { 832 if (QNameUtils.matches(qElemSchema1999, schemaEl)) 834 s2j1999.createJavaMapping(schemaEl, typeReg); 835 else if (QNameUtils.matches(qElemSchema2000, schemaEl)) 836 s2j2000.createJavaMapping(schemaEl, typeReg); 837 else 838 s2j2001.createJavaMapping(schemaEl, typeReg); 839 } 840 } catch (Exception e) { 841 Trc.ignoredException(e); 842 } 844 } 845 } 846 return typeReg.values().iterator(); 847 } 848 849 853 private void initialiseTypeMappings() throws WSIFException { 854 Iterator typeMappingIterator = getDefaultTypeMappings(); 855 if (typeMappingIterator != null) { 856 while (typeMappingIterator.hasNext()) { 857 TypeMapping tm = (TypeMapping) typeMappingIterator.next(); 858 859 if (tm.elementType != null && tm.elementType.getNamespaceURI() != null) { 860 String namespaceURI = tm.elementType.getNamespaceURI(); 861 if (namespaceURI != null 862 && !namespaceURI.equals(WSIFConstants.NS_URI_1999_SCHEMA_XSD) 863 && !namespaceURI.equals(WSIFConstants.NS_URI_2000_SCHEMA_XSD) 864 && !namespaceURI.equals(WSIFConstants.NS_URI_2001_SCHEMA_XSD) 865 && !namespaceURI.equals(WSIFConstants.NS_URI_SOAP_ENC) 866 && tm.javaType != null) { 867 String packageName = Utils.getPackageName(tm.javaType); 868 if (packageName != null && !packageName.equals("")) { 869 packageName += "."; 870 } 871 String className = packageName + Utils.getClassName(tm.javaType); 872 Class clazz = null; 873 874 try { 875 clazz = 876 Class.forName(className, true, Thread.currentThread().getContextClassLoader()); 877 } catch (ClassNotFoundException e) { 878 Trc.ignoredException(e); 880 } 881 if (clazz != null) { 883 mapType(tm.elementType, clazz, false); 884 } 885 } 886 } 887 } } 889 } 890 891 895 private void checkPortTypeInformation(Definition def, PortType portType) 896 throws WSIFException { 897 List operationList = portType.getOperations(); 898 899 for (Iterator i = operationList.iterator(); i.hasNext();) { 901 Operation op = (Operation) i.next(); 902 String name = op.getName(); 903 if (op.isUndefined()) { 904 throw new WSIFException("operation " + name + " is undefined!"); 905 } 906 OperationType opType = op.getStyle(); 907 if (opType == null) { 908 throw new WSIFException("operation " + name + " has no type!"); 909 } 910 if (opType.equals(OperationType.REQUEST_RESPONSE)) { 911 Input input = op.getInput(); 912 Output output = op.getOutput(); 913 if (input == null) { 914 throw new WSIFException("missing input message for operation " + name); 915 } 916 if (output == null) { 917 throw new WSIFException("missing output message for operation " + name); 918 } 919 } else if (opType.equals(OperationType.ONE_WAY)) { 920 Input input = op.getInput(); 921 if (input == null) { 922 throw new WSIFException("missing input message for operation " + name); 923 } 924 } else { 925 MessageLogger.log( 927 "WSIF.0004E", 928 opType, 929 portType.getQName().getLocalPart()); 930 931 throw new WSIFException( 933 "operation type " 934 + opType 935 + " is not supported in port instance for " 936 + portType.getQName()); 937 } 938 } 939 } 940 941 private void checkWSDLForWSIF(Definition def) throws WSIFException { 942 try { 943 checkWSDL(def); 944 } catch (WSDLException ex) { 945 Trc.exception(ex); 946 throw new WSIFException("invalid WSDL defintion " + def.getQName(), ex); 947 } 948 } 949 950 957 private void checkWSDL(Definition def) throws WSDLException { 958 for (Iterator i = def.getMessages().values().iterator(); i.hasNext();) { 959 Message v = (Message) i.next(); 960 if (v.isUndefined()) { 961 throw new WSDLException( 962 WSDLException.INVALID_WSDL, 963 "referencing undefined message " + v); 964 } 965 } 966 for (Iterator i = def.getPortTypes().values().iterator(); i.hasNext();) { 967 PortType v = (PortType) i.next(); 968 if (v.isUndefined()) { 969 throw new WSDLException( 970 WSDLException.INVALID_WSDL, 971 "referencing undefined portType " + v); 972 } 973 } 974 for (Iterator i = def.getBindings().values().iterator(); i.hasNext();) { 975 Binding v = (Binding) i.next(); 976 if (v.isUndefined()) { 977 throw new WSDLException( 978 WSDLException.INVALID_WSDL, 979 "referencing undefined binding " + v); 980 } 981 } 982 } 983 984 988 public Definition getDefinition() { 989 Trc.entry(this); 990 Trc.exit(def); 991 return def; 992 } 993 994 998 public WSIFMessage getContext() throws WSIFException { 999 Trc.entry(this); 1000 WSIFMessage contextCopy; 1001 if (this.context == null) { 1002 contextCopy = new WSIFDefaultMessage(); 1003 } else { 1004 try { 1005 contextCopy = (WSIFMessage) this.context.clone(); 1006 } catch (CloneNotSupportedException e) { 1007 throw new WSIFException( 1008 "CloneNotSupportedException cloning context", e); 1009 } 1010 } 1011 Trc.exit(contextCopy); 1012 return contextCopy; 1013 } 1014 1015 1019 public void setContext(WSIFMessage context) { 1020 Trc.entry(this, context); 1021 if (context == null) { 1022 throw new IllegalArgumentException ("context must not be null"); 1023 } 1024 this.context = context; 1025 Trc.exit(); 1026 } 1027 1028 public String deep() { 1029 String buff = ""; 1030 try { 1031 buff = new String (this.toString()); 1032 buff += "\nprovidersExtRegs:" 1033 + (providersExtRegs == null ? "null" : providersExtRegs.toString()); 1034 buff += "\ndef:" + Trc.brief(def); 1035 buff += "\nservice:" + Trc.brief(service); 1036 buff += "\nportType:" + Trc.brief(portType); 1037 buff += "\nmyPortsArr:" + (myPortsArr == null ? "null" : myPortsArr.toString()); 1038 buff += "\nmyPortsMap:" + Trc.brief(myPortsMap); 1039 buff += "\ntypeMap:" + (typeMap == null ? "null" : typeMap.toString()); 1040 buff += "\ntypeMapInitialised:" + typeMapInitialised; 1041 buff += "\npreferredPort:" + (preferredPort == null ? "null" : preferredPort); 1042 buff += "\nchosenPort:" + Trc.brief(chosenPort); 1043 buff += "\ncontext:" + context; 1044 } catch (Exception e) { 1045 Trc.exceptionInTrace(e); 1046 } 1047 return buff; 1048 } 1049} 1050 1051 | Popular Tags |