1 57 58 package org.apache.wsif.providers.jms; 59 60 import java.util.ArrayList ; 61 import java.util.HashMap ; 62 import java.util.Iterator ; 63 import java.util.List ; 64 import java.util.Map ; 65 66 import javax.wsdl.BindingFault; 67 import javax.wsdl.BindingInput; 68 import javax.wsdl.BindingOperation; 69 import javax.wsdl.BindingOutput; 70 import javax.wsdl.Definition; 71 import javax.wsdl.Input; 72 import javax.wsdl.Message; 73 import javax.wsdl.Operation; 74 import javax.wsdl.Output; 75 import javax.wsdl.Port; 76 import javax.wsdl.Service; 77 import javax.wsdl.extensions.ExtensibilityElement; 78 import javax.xml.namespace.QName ; 79 80 import org.apache.wsif.WSIFConstants; 81 import org.apache.wsif.WSIFCorrelationId; 82 import org.apache.wsif.WSIFCorrelationService; 83 import org.apache.wsif.WSIFException; 84 import org.apache.wsif.WSIFMessage; 85 import org.apache.wsif.WSIFOperation; 86 import org.apache.wsif.WSIFPort; 87 import org.apache.wsif.WSIFRequest; 88 import org.apache.wsif.WSIFResponse; 89 import org.apache.wsif.WSIFResponseHandler; 90 import org.apache.wsif.base.WSIFDefaultOperation; 91 import org.apache.wsif.logging.MessageLogger; 92 import org.apache.wsif.logging.Trc; 93 import org.apache.wsif.util.WSIFCorrelationServiceLocator; 94 import org.apache.wsif.util.WSIFProperties; 95 import org.apache.wsif.util.WSIFUtils; 96 import org.apache.wsif.util.jms.WSIFJMSCorrelationId; 97 import org.apache.wsif.util.jms.WSIFJMSDestination; 98 import org.apache.wsif.wsdl.extensions.jms.JMSAddress; 99 import org.apache.wsif.wsdl.extensions.jms.JMSBinding; 100 import org.apache.wsif.wsdl.extensions.jms.JMSConstants; 101 import org.apache.wsif.wsdl.extensions.jms.JMSFaultIndicator; 102 import org.apache.wsif.wsdl.extensions.jms.JMSFaultProperty; 103 import org.apache.wsif.wsdl.extensions.jms.JMSInput; 104 import org.apache.wsif.wsdl.extensions.jms.JMSOutput; 105 import org.apache.wsif.wsdl.extensions.jms.JMSProperty; 106 import org.apache.wsif.wsdl.extensions.jms.JMSPropertyValue; 107 108 115 public class WSIFOperation_Jms 116 extends WSIFDefaultOperation 117 implements WSIFOperation { 118 119 private static final long serialVersionUID = 1L; 120 121 protected Port fieldBasePort; 122 protected BindingOperation fieldBindingOperation; 123 protected WSIFPort_Jms fieldJmsPort; 124 125 protected Operation fieldOperation; 126 127 private boolean inputOnlyOp = false; 128 129 protected String fieldInputMessageName; 131 protected HashMap fieldInputJmsPropertyValues; 132 protected HashMap fieldInputJmsProperties; 133 protected JMSInput fieldInput; 134 135 protected String fieldOutputMessageName; 137 protected HashMap fieldOutputProperties; 138 protected JMSOutput fieldOutput; 139 140 private WSIFResponseHandler handler; 141 private boolean asyncOperation; 142 private JMSFormatter formatter; 143 144 private long syncTimeout; 145 private long asyncTimeout; 146 147 150 public WSIFOperation_Jms( 151 Port basePort, 152 BindingOperation bindingOperation, 153 WSIFPort_Jms jmsPort) 154 throws WSIFException { 155 156 Trc.entry(this, basePort, bindingOperation, jmsPort); 157 158 fieldBasePort = basePort; 159 fieldBindingOperation = bindingOperation; 160 fieldJmsPort = jmsPort; 161 162 syncTimeout = WSIFProperties.getSyncTimeout(); 163 asyncTimeout = WSIFProperties.getAsyncTimeout(); 164 165 if (Trc.ON) 166 Trc.exit(deep()); 167 } 168 169 173 public WSIFOperation_Jms copy() throws WSIFException { 174 Trc.entry(this); 175 WSIFOperation_Jms woj = 176 new WSIFOperation_Jms( 177 fieldBasePort, 178 fieldBindingOperation, 179 fieldJmsPort); 180 if (Trc.ON) 181 Trc.exit(woj.deep()); 182 return woj; 183 } 184 185 191 public boolean executeRequestResponseOperation( 192 WSIFMessage input, 193 WSIFMessage output, 194 WSIFMessage fault) 195 throws WSIFException { 196 197 Trc.entry(this, input, output, fault); 198 close(); 199 200 if (!fieldJmsPort.supportsSync()) 201 throw new WSIFException("synchronous operations not available"); 202 203 setAsyncOperation(false); 204 205 boolean operationSucceeded = true; 206 try { 207 getOperation(); 208 209 String correlId = sendJmsMessage(input); 211 212 WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); 213 javax.jms.Message response = jmsDest.receive(correlId, syncTimeout); 214 operationSucceeded = receiveJmsMessage(response, output, fault); 215 216 } catch (Exception ex) { 217 Trc.exception(ex); 218 219 MessageLogger.log( 221 "WSIF.0005E", 222 "Jms", 223 fieldBindingOperation.getName()); 224 225 throw new WSIFException( 226 this 227 + " : Could not invoke '" 228 + fieldBindingOperation.getName() 229 + "'", 230 ex); 231 } 232 233 Trc.exit(operationSucceeded); 234 return operationSucceeded; 235 } 236 237 241 public void executeInputOnlyOperation(WSIFMessage input) 242 throws WSIFException { 243 Trc.entry(this, input); 244 inputOnlyOp = true; 245 executeRequestResponseAsync(input, null); 246 Trc.exit(); 247 } 248 249 260 public WSIFCorrelationId executeRequestResponseAsync(WSIFMessage input) 261 throws WSIFException { 262 return executeRequestResponseAsync(input, null); 263 } 264 265 277 public WSIFCorrelationId executeRequestResponseAsync( 278 WSIFMessage input, 279 WSIFResponseHandler handler) 280 throws WSIFException { 281 282 Trc.entry(this, input, handler); 283 close(); 284 285 if (!fieldJmsPort.supportsAsync()) 286 throw new WSIFException("asynchronous operations not available"); 287 288 setAsyncOperation(true); 289 WSIFCorrelationId correlId = null; 290 291 try { 292 293 getOperation(); 294 this.handler = handler; 295 296 if (inputOnlyOp) { 297 sendJmsMessage(input); 298 } else { 299 if (handler == null) { 300 correlId = new WSIFJMSCorrelationId(sendJmsMessage(input)); 301 } else { 302 WSIFCorrelationService cs = 303 WSIFCorrelationServiceLocator.getCorrelationService(); 304 synchronized (cs) { 305 correlId = 306 new WSIFJMSCorrelationId(sendJmsMessage(input)); 307 cs.put(correlId, this, asyncTimeout); 309 } 310 } 311 } 312 } catch (Exception ex) { 313 Trc.exception(ex); 314 315 MessageLogger.log( 317 "WSIF.0005E", 318 "Jms", 319 fieldBindingOperation.getName()); 320 321 throw new WSIFException( 322 this 323 + " : Could not invoke '" 324 + fieldBindingOperation.getName() 325 + "'", 326 ex); 327 } 328 329 Trc.exit(correlId); 330 return correlId; 331 } 332 333 public boolean processAsyncResponse( 334 Object responseObject, 335 WSIFMessage output, 336 WSIFMessage fault) 337 throws WSIFException { 338 339 Trc.entry(this, responseObject, output, fault); 340 341 boolean ok = false; 342 try { 343 344 getOperation(); 345 346 output.setName(fieldBindingOperation.getBindingOutput().getName()); 348 ok = receiveJmsMessage(responseObject, output, fault); 349 350 } catch (Exception ex) { 351 Trc.exception(ex); 352 353 MessageLogger.log( 355 "WSIF.0005E", 356 "Jms", 357 fieldBindingOperation.getName()); 358 359 throw new WSIFException( 360 this 361 + " : Could not invoke '" 362 + fieldBindingOperation.getName() 363 + "'", 364 ex); 365 } 366 367 Trc.exit(ok); 368 return ok; 369 } 370 371 376 377 public void fireAsyncResponse(Object response) throws WSIFException { 378 Trc.entry(this, response); 379 380 WSIFMessage output = createOutputMessage(); 383 WSIFMessage fault = createFaultMessage(); 384 385 receiveJmsMessage(response, output, fault); 386 387 handler.executeAsyncResponse(output, fault); 388 Trc.exit(); 389 } 390 391 395 398 private String sendJmsMessage(WSIFMessage input) throws WSIFException { 399 400 String correlId = null; 401 WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); 402 403 setPropertyValues(); 404 405 408 String partName; 415 ArrayList wsdlInputParts = getWSDLInputPartNames(); 416 HashMap propertyParts = getPropertyParts(); 417 WSIFMessage message = createInputMessage(); 418 for (Iterator i = input.getPartNames(); i.hasNext();) { 419 partName = (String ) i.next(); 420 if (propertyParts.containsKey(partName)) { 421 String name = (String ) propertyParts.get(partName); 422 Object value = input.getObjectPart(partName); 423 if (!timeoutProperty(name, value)) { 424 jmsDest.setProperty(name, value); 425 } 426 } else if (wsdlInputParts.contains(partName)) { 427 wsdlInputParts.remove(partName); 428 if (fieldInput == null) { 429 message.setObjectPart( 430 partName, 431 input.getObjectPart(partName)); 432 } else if (fieldInput.getParts().contains(partName)) { 433 message.setObjectPart( 434 partName, 435 input.getObjectPart(partName)); 436 } 437 } 438 } 439 440 for (Iterator i = wsdlInputParts.iterator(); i.hasNext();) { 442 message.setObjectPart((String ) i.next(), null); 443 } 444 445 setDestinationContext(); 447 448 Service serviceModel = null; 449 Definition def = fieldJmsPort.getDefinition(); 450 Map services = WSIFUtils.getAllItems(def, "Service"); 451 Port port = fieldJmsPort.getPortModel(); 452 for (Iterator i = services.values().iterator(); i.hasNext();) { 453 Service s = (Service) i.next(); 454 if (s.getPorts().values().contains(port)) { 455 serviceModel = s; 456 break; 457 } 458 } 459 if (serviceModel == null) { 460 throw new WSIFException("cannot find service for port: " + port); 461 } 462 463 formatter = (JMSFormatter) fieldJmsPort.getFormatter(); 464 465 WSIFRequest request = new WSIFRequest(serviceModel.getQName()); 466 request.setIncomingMessage(message); 467 request.setOperationName(fieldOperation.getName()); 468 request.setPortName(fieldJmsPort.getPortModel().getName()); 469 request.setInputName(fieldBindingOperation.getBindingInput().getName()); 470 471 javax.jms.Message jmsMessage = 472 jmsDest.createMessage(getJMSMessageType()); 473 474 formatter.formatRequest(request, jmsMessage); 475 476 if (isAsyncOperation() && handler != null) 479 jmsDest.setAsyncMode(true); 480 correlId = jmsDest.send(jmsMessage, null, !inputOnlyOp); 481 482 return correlId; 483 484 } 485 486 489 private boolean receiveJmsMessage( 490 Object responseObject, 491 WSIFMessage output, 492 WSIFMessage fault) 493 throws WSIFException { 494 Trc.entry(this, responseObject, output, fault); 495 496 if (!(responseObject instanceof javax.jms.Message )) 497 throw new WSIFException("Object is not of type javax.jms.Message"); 498 499 fieldJmsPort.getJmsDestination().setLastMessage( 503 (javax.jms.Message ) responseObject); 504 505 WSIFResponse resp = 506 formatter.unformatResponse((javax.jms.Message ) responseObject); 507 508 if (resp.getIsFault()) { 509 formatter.copyTo(resp.getOutgoingMessage(), fault); 510 setFaultProperties(fault, formatter.getLastBindingFault()); 511 512 Trc.exit(false); 513 return false; 514 } else { 515 516 ArrayList wsdlOutputParts = getWSDLOutputPartNames(); 521 WSIFMessage m = resp.getOutgoingMessage(); 522 if (m != null) { 523 String partName; 524 for (Iterator i = m.getPartNames(); i.hasNext();) { 525 partName = (String ) i.next(); 526 output.setObjectPart(partName, m.getObjectPart(partName)); 527 wsdlOutputParts.remove(partName); 528 } 529 } 530 531 for (Iterator i = wsdlOutputParts.iterator(); i.hasNext();) { 532 output.setObjectPart((String ) i.next(), null); 533 } 534 535 setOutProperties(output); 536 Trc.exit(true); 537 return true; 538 } 539 } 540 541 546 private HashMap getPropertyParts() { 547 HashMap propertyParts = new HashMap (); 548 549 if (fieldInputJmsProperties != null) { 551 for (Iterator i = fieldInputJmsProperties.keySet().iterator(); 552 i.hasNext(); 553 ) { 554 String propertyName = (String ) i.next(); 555 propertyParts.put( 556 propertyName, 557 fieldInputJmsProperties.get(propertyName)); 558 } 559 } 560 561 return propertyParts; 562 } 563 564 private void setPropertyValues() throws WSIFException { 565 String value; 566 WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); 567 try { 569 value = fieldOperation.getName(); 570 if (value != null && value.length() > 0) { 571 jmsDest.setProperty( 572 WSIFConstants.JMS_PROP_OPERATION_NAME, 573 value); 574 } 575 } catch (WSIFException ex) { 576 Trc.ignoredException(ex); 577 } 578 579 try { 580 BindingInput bi = fieldBindingOperation.getBindingInput(); 581 value = (bi == null) ? null : bi.getName(); 582 if (value != null && value.length() > 0) { 583 jmsDest.setProperty(WSIFConstants.JMS_PROP_INPUT_NAME, value); 584 } 585 } catch (WSIFException ex) { 586 Trc.ignoredException(ex); 587 } 588 589 try { 590 BindingOutput bo = fieldBindingOperation.getBindingOutput(); 591 value = (bo == null) ? null : bo.getName(); 592 if (value != null && value.length() > 0) { 593 jmsDest.setProperty(WSIFConstants.JMS_PROP_OUTPUT_NAME, value); 594 } 595 } catch (WSIFException ex) { 596 Trc.ignoredException(ex); 597 } 598 599 try { 601 JMSAddress ja = fieldJmsPort.getObjectReference(); 602 if (ja != null) { 603 setJMSPropertyValues(ja.getJMSPropertyValues()); 604 } 605 } catch (WSIFException ex) { 606 Trc.ignoredException(ex); 607 } 608 609 if (fieldInputJmsPropertyValues != null) { 611 try { 612 setJmsPropertyValues(fieldInputJmsPropertyValues); 613 } catch (WSIFException ex) { 614 Trc.ignoredException(ex); 615 } 616 } 617 } 618 619 622 private void setOutProperties(WSIFMessage output) throws WSIFException { 623 624 if (output != null && fieldOutputProperties != null) { 625 WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); 626 for (Iterator i = fieldOutputProperties.keySet().iterator(); 627 i.hasNext(); 628 ) { 629 String partName = (String ) i.next(); 630 String propertyName = 631 (String ) fieldOutputProperties.get(partName); 632 try { 633 Object propertyValue = jmsDest.getProperty(propertyName); 634 output.setObjectPart(partName, propertyValue); 635 } catch (WSIFException ex) { 636 Trc.ignoredException(ex); 637 } 638 } 639 } 640 } 641 642 private void setFaultProperties( 643 WSIFMessage fault, 644 BindingFault bindingFault) throws WSIFException{ 645 646 Trc.entry(this, fault, bindingFault); 647 648 WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); 649 Iterator it = bindingFault.getExtensibilityElements().iterator(); 650 while (it.hasNext()) { 651 Object ele = it.next(); 652 if (ele instanceof JMSFaultIndicator) { 653 JMSFaultIndicator indic = (JMSFaultIndicator) ele; 654 List fProps = indic.getJMSFaultProperties(); 655 Iterator itFProp = fProps.iterator(); 656 while (itFProp.hasNext()) { 657 Object next = itFProp.next(); 658 if (next instanceof JMSFaultProperty) { 659 JMSFaultProperty fProp = (JMSFaultProperty) next; 660 String partName = fProp.getPart(); 661 String propName = fProp.getName(); 662 663 if (partName != null && partName.length() > 0) 664 try { 665 Object propValue = 666 jmsDest.getProperty(propName); 667 fault.setObjectPart(partName, propValue); 668 } catch (WSIFException ex) { 669 Trc.ignoredException(ex); 670 } 671 } 672 } 673 } else if (ele instanceof JMSProperty) { 674 JMSProperty prop = (JMSProperty) ele; 675 String partName = prop.getPart(); 676 String propName = prop.getName(); 677 678 try { 679 Object propValue = jmsDest.getProperty(propName); 680 fault.setObjectPart(partName, propValue); 681 } catch (WSIFException ex) { 682 Trc.ignoredException(ex); 683 } 684 } 685 } 686 687 Trc.exit(); 688 } 689 690 693 private void setJMSPropertyValues(List propertyValues) 694 throws WSIFException { 695 if (propertyValues != null) { 696 WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); 697 for (Iterator i = propertyValues.iterator(); i.hasNext();) { 698 JMSPropertyValue pv = (JMSPropertyValue) i.next(); 699 if (pv != null) { 700 Object o = getObjectValue(pv.getType(), pv.getValue()); 701 if (!timeoutProperty(pv.getName(), o)) { 702 jmsDest.setProperty(pv.getName(), o); 703 } 704 } 705 } 706 } 707 } 708 709 712 private void setJmsPropertyValues(HashMap attr) throws WSIFException { 713 Iterator iter = attr.keySet().iterator(); 716 while (iter.hasNext()) { 717 String attName = (String ) iter.next(); 718 719 JMSPropertyValue value = (JMSPropertyValue) attr.get(attName); 720 721 if (value != null) { 722 Object o = getObjectValue(value.getType(), value.getValue()); 723 if (!timeoutProperty(attName, o)) { 724 WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); 725 jmsDest.setProperty(attName, o); 726 } 727 } 728 } 729 } 730 731 private boolean timeoutProperty(String propertyName, Object value) { 732 boolean isTimeoutProperty = false; 733 if (WSIFConstants.WSIF_PROP_SYNC_TIMEOUT.equals(propertyName)) { 734 isTimeoutProperty = true; 735 try { 736 syncTimeout = Long.parseLong(value.toString()); 737 Trc.event(this, "overridding syncTimeout to " + syncTimeout); 738 } catch (NumberFormatException ex) { 739 Trc.ignoredException(ex); 740 } 741 } else if ( 742 WSIFConstants.WSIF_PROP_ASYNC_TIMEOUT.equals(propertyName)) { 743 isTimeoutProperty = true; 744 try { 745 asyncTimeout = Long.parseLong(value.toString()); 746 Trc.event(this, "overridding asyncTimeout to " + syncTimeout); 747 } catch (NumberFormatException ex) { 748 Trc.ignoredException(ex); 749 } 750 } 751 return isTimeoutProperty; 752 } 753 754 757 protected Operation getOperation() throws Exception { 758 759 if (fieldOperation == null) { 760 if (fieldBindingOperation.getBindingInput() != null) 763 fieldInputMessageName = 764 fieldBindingOperation.getBindingInput().getName(); 765 766 if (fieldBindingOperation.getBindingOutput() != null) 767 fieldOutputMessageName = 768 fieldBindingOperation.getBindingOutput().getName(); 769 770 fieldOperation = 772 fieldBasePort.getBinding().getPortType().getOperation( 773 fieldBindingOperation.getName(), 774 fieldInputMessageName, 775 fieldOutputMessageName); 776 777 if (fieldBindingOperation.getBindingInput() != null) { 781 Iterator inputIterator = 782 fieldBindingOperation 783 .getBindingInput() 784 .getExtensibilityElements() 785 .iterator(); 786 fieldInputJmsProperties = new HashMap (); 787 fieldInputJmsPropertyValues = new HashMap (); 788 while (inputIterator.hasNext()) { 789 ExtensibilityElement ele = 790 (ExtensibilityElement) inputIterator.next(); 791 if (ele instanceof JMSInput) { 792 fieldInput = (JMSInput) ele; 793 } else if (ele instanceof JMSProperty) { 794 fieldInputJmsProperties.put( 795 ((JMSProperty) ele).getPart(), 796 ((JMSProperty) ele).getName()); 797 } else if (ele instanceof JMSPropertyValue) { 798 fieldInputJmsPropertyValues.put( 799 ((JMSPropertyValue) ele).getName(), 800 ele); 801 } 802 } 803 } 804 805 if (fieldBindingOperation.getBindingOutput() != null) { 809 Iterator outputIterator = 810 fieldBindingOperation 811 .getBindingOutput() 812 .getExtensibilityElements() 813 .iterator(); 814 fieldOutputProperties = new HashMap (); 815 while (outputIterator.hasNext()) { 816 ExtensibilityElement ele = 817 (ExtensibilityElement) outputIterator.next(); 818 if (ele instanceof JMSOutput) { 819 fieldOutput = (JMSOutput) ele; 820 } else if (ele instanceof JMSProperty) { 821 fieldOutputProperties.put( 822 ((JMSProperty) ele).getPart(), 823 ((JMSProperty) ele).getName()); 824 } 825 } 826 827 } 828 } 829 830 if (fieldOperation == null) { 831 throw new WSIFException( 832 "Unable to resolve Jms binding for operation '" 833 + fieldBindingOperation.getName() 834 + ":" 835 + fieldInputMessageName 836 + ":" 837 + fieldOutputMessageName 838 + "'"); 839 } 840 841 return fieldOperation; 842 } 843 844 private Object getObjectValue(QName type, String value) 845 throws WSIFException { 846 847 Object primitiveType = null; 848 849 if (JMSMessage.isSchemaNamespace(type.getNamespaceURI()) 850 && JMSMessage.isXSDPrimitiveType(type.getLocalPart())) { 851 Class cls = 852 (Class ) JMSMessage.PRIMITIVE_JAVA_MAPPING.get( 853 type.getLocalPart().toLowerCase()); 854 855 if (cls == String .class) { 856 primitiveType = value; 857 } 858 else if (cls == byte[].class) { 860 primitiveType = value.getBytes(); 861 } 862 else if ( 864 java.util.GregorianCalendar .class.isAssignableFrom(cls) 865 || java.util.Date .class.isAssignableFrom(cls)) { 866 } 868 else { 870 try { 871 java.lang.reflect.Constructor constructor = 872 cls.getConstructor(new Class [] { String .class }); 873 primitiveType = 874 constructor.newInstance(new Object [] { value }); 875 } catch (Exception e) { 876 Trc.ignoredException(e); 877 } 878 } 879 } 880 881 if (primitiveType != null) 882 return primitiveType; 883 else 884 throw new WSIFException( 885 "Unable to create the java object for XSD Type '" 886 + type.toString() 887 + "' using value '" 888 + value 889 + "'"); 890 } 891 892 public int getJMSMessageType() { 894 Trc.entry(this); 895 Iterator bindingIterator = 896 fieldBasePort.getBinding().getExtensibilityElements().iterator(); 897 898 while (bindingIterator.hasNext()) { 899 try { 900 ExtensibilityElement ele = 901 (ExtensibilityElement) bindingIterator.next(); 902 if (JMSConstants 903 .Q_ELEM_JMS_BINDING 904 .equals(ele.getElementType())) { 905 906 int t = ((JMSBinding) ele).getJmsMessageType(); 907 Trc.exit(t); 908 return t; 909 } 910 } catch (ClassCastException exn) { 911 Trc.ignoredException(exn); 912 } 913 } 914 Trc.exit(JMSConstants.MESSAGE_TYPE_NOTSET); 915 return JMSConstants.MESSAGE_TYPE_NOTSET; 916 } 917 918 924 private void setAsyncOperation(boolean b) { 925 asyncOperation = b; 926 } 927 928 934 public boolean isAsyncOperation() { 935 Trc.entry(this); 936 Trc.exit(asyncOperation); 937 return asyncOperation; 938 } 939 940 943 private void setDestinationContext() throws WSIFException{ 944 if (context == null) { 945 return; 946 } 947 HashMap jmsProps = new HashMap (); 948 for (Iterator i = context.getPartNames(); i.hasNext();) { 949 String partName = (String ) i.next(); 950 try { 951 Object value = context.getObjectPart(partName); 952 if (!timeoutProperty(partName, value)) { 953 if (partName 954 .startsWith(WSIFConstants.CONTEXT_JMS_PREFIX)) { 955 jmsProps.put( 956 partName.substring( 957 WSIFConstants.CONTEXT_JMS_PREFIX.length()), 958 value); 959 } 960 } 961 } catch (WSIFException ex) { 962 Trc.ignoredException(ex); 963 } 964 } 965 if (jmsProps.size() > 0) { 966 WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination(); 967 jmsDest.setProperties(jmsProps); 968 } 969 } 970 971 private ArrayList getWSDLInputPartNames() { 972 ArrayList wsdlInputParts = new ArrayList (); 973 Input wsdlInput = fieldOperation.getInput(); 974 if (wsdlInput != null) { 975 Message inputMessage = wsdlInput.getMessage(); 976 String partName; 977 for (Iterator i = inputMessage.getParts().keySet().iterator(); 978 i.hasNext(); 979 ) { 980 partName = (String ) i.next(); 981 if (fieldInputJmsProperties == null 982 || !fieldInputJmsProperties.containsKey(partName)) { 983 wsdlInputParts.add(partName); 984 } 985 } 986 } 987 return wsdlInputParts; 988 } 989 990 private ArrayList getWSDLOutputPartNames() { 991 ArrayList wsdlOutputParts = new ArrayList (); 992 Output wsdlOutput = fieldOperation.getOutput(); 993 if (wsdlOutput != null) { 994 Message outputMessage = wsdlOutput.getMessage(); 995 String partName; 996 for (Iterator i = outputMessage.getParts().keySet().iterator(); 997 i.hasNext(); 998 ) { 999 partName = (String ) i.next(); 1000 if (fieldOutputProperties == null 1001 || !fieldOutputProperties.containsKey(partName)) { 1002 wsdlOutputParts.add(partName); 1003 } 1004 } 1005 } 1006 return wsdlOutputParts; 1007 } 1008 1009 public WSIFPort getWSIFPort() { 1010 Trc.entry(this); 1011 Trc.exit(fieldJmsPort); 1012 return fieldJmsPort; 1013 } 1014 1015 public String deep() { 1016 String buff = ""; 1017 try { 1018 buff = new String (super.toString() + ":\n"); 1019 buff += "basePort:" + Trc.brief(fieldBasePort); 1020 buff += " bindingOperation:" + Trc.brief(fieldBindingOperation); 1021 buff += " wsifPort_Jms:" + fieldJmsPort; 1022 buff += " Operation:" + Trc.brief(fieldOperation); 1023 buff += " InputOnlyOperation:" + inputOnlyOp; 1024 buff += " JmsMessageType:" + getJMSMessageType(); 1025 buff += " inputMessageName:" + fieldInputMessageName; 1026 buff += " InputJmsPropertyValues:" + fieldInputJmsPropertyValues; 1027 buff += " InputProperty:" + fieldInputJmsProperties; 1028 buff += " Input:" + fieldInput; 1029 buff += " outputMessageName:" + fieldOutputMessageName; 1030 buff += " OutputProperties:" + fieldOutputProperties; 1031 buff += " Output:" + fieldOutput; 1032 buff += " Formater:" + formatter; 1033 buff += " handler:" + handler; 1034 buff += " asyncOperation:" + asyncOperation; 1035 } catch (Exception e) { 1036 Trc.exceptionInTrace(e); 1037 } 1038 return buff; 1039 } 1040 1041} | Popular Tags |