View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2010 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.support.editor.inspectors.jms.header;
14  
15  import java.beans.PropertyChangeEvent;
16  import java.beans.PropertyChangeListener;
17  
18  import com.eviware.soapui.config.JMSDeliveryModeTypeConfig;
19  import com.eviware.soapui.impl.support.AbstractHttpRequest;
20  import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint;
21  import com.eviware.soapui.support.components.SimpleBindingForm;
22  import com.eviware.soapui.support.editor.xml.XmlInspector;
23  
24  public class RequestJMSHeaderInspector extends AbstractJMSHeaderInspector implements XmlInspector,
25  		PropertyChangeListener
26  {
27  
28  	private SimpleBindingForm simpleform;
29  	AbstractHttpRequest<?> request;
30  
31  	public RequestJMSHeaderInspector( AbstractHttpRequest<?> request )
32  	{
33  		super( request );
34  		this.request = request;
35  		request.addPropertyChangeListener( this );
36  	}
37  
38  	public void propertyChange( PropertyChangeEvent evt )
39  	{
40  		if( request.getEndpoint() != null && evt.getPropertyName().equals( AbstractHttpRequest.ENDPOINT_PROPERTY ) )
41  		{
42  			this.setEnabled( request.getEndpoint().startsWith( JMSEndpoint.JMS_ENDPIONT_PREFIX ) );
43  		}
44  	}
45  
46  	@Override
47  	public void release()
48  	{
49  		super.release();
50  		request.removePropertyChangeListener( this );
51  	}
52  
53  	public void buildContent( SimpleBindingForm form )
54  	{
55  		this.simpleform = form;
56  		simpleform.addSpace( 5 );
57  		simpleform.appendTextField( "JMSCorrelationID", "JMSCorrelationID",
58  				"JMSCorrelationID header property of JMS message" );
59  		simpleform.appendTextField( "JMSReplyTo", "JMSReplyTo", "JMSReplyTo header property of JMS message" );
60  		simpleform.appendTextField( "JMSType", "JMSType", "JMSType header property of JMS message" );
61  		simpleform.appendTextField( "JMSPriority", "JMSPriority", "JMSPriority header property of JMS message" );
62  		simpleform.appendComboBox( "JMSDeliveryMode", "JMSDeliveryMode", new String[] {
63  				JMSDeliveryModeTypeConfig.PERSISTENT.toString(), JMSDeliveryModeTypeConfig.NON_PERSISTENT.toString() },
64  				"Choose between NON PERSISTENT and PERSISTENT (default) message" );
65  		simpleform.appendTextField( "timeToLive", "TimeToLive",
66  				"specify 'time to live' of JMS message , zero means never expire which is default" );
67  
68  		simpleform.appendCheckBox( "sendAsBytesMessage", "Send As Bytes Message", "" ).setToolTipText(
69  				"if selected message will be sent as BytesMessage" );
70  
71  		if( request.getOperation() != null )
72  		{
73  			simpleform.appendCheckBox( "soapActionAdd", "Add SoapAction as property", "" ).setToolTipText(
74  					"Add properties SOAPJMS_soapAction=" + request.getOperation().getName() + "\n and " + "SoapAction="
75  							+ request.getOperation().getName() + " to outgoing message" );
76  		}
77  
78  		simpleform
79  				.appendTextField(
80  						"durableSubscriptionName",
81  						"Durable Subscription Name",
82  						"specify 'Durable Subscription Name' for subscribing to topic , if not specified automatic name is 'durableSubscription' + 'topic name'" );
83  		simpleform.appendTextField( "clientID", "ClientID", "specify optional 'ClientID' for of JMS connection" );
84  		simpleform.appendTextField( "messageSelector", "Message Selector",
85  				"specify message selector string to determine which messages you want to receive" );
86  		simpleform.addSpace( 5 );
87  	}
88  
89  }