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  
47  	public void buildContent( SimpleBindingForm form )
48  	{
49  		this.simpleform = form;
50  		simpleform.addSpace( 5 );
51  		simpleform.appendTextField( "JMSCorrelationID", "JMSCorrelationID",
52  				"JMSCorrelationID header property of JMS message" );
53  		simpleform.appendTextField( "JMSReplyTo", "JMSReplyTo", "JMSReplyTo header property of JMS message" );
54  		simpleform.appendTextField( "JMSType", "JMSType", "JMSType header property of JMS message" );
55  		simpleform.appendTextField( "JMSPriority", "JMSPriority", "JMSPriority header property of JMS message" );
56  		simpleform.appendComboBox( "JMSDeliveryMode", "JMSDeliveryMode", new String[] {
57  				JMSDeliveryModeTypeConfig.PERSISTENT.toString(), JMSDeliveryModeTypeConfig.NON_PERSISTENT.toString() },
58  				"Choose between NON PERSISTENT and PERSISTENT (default) message" );
59  		simpleform.appendTextField( "timeToLive", "TimeToLive",
60  				"specify 'time to live' of JMS message , zero means never expire which is default" );
61  		simpleform
62  				.appendTextField(
63  						"durableSubscriptionName",
64  						"Durable Subscription Name",
65  						"specify 'Durable Subscription Name' for subscribing to topic , if not specified automatic name is 'durableSubscription' + 'topic name'" );
66  		simpleform.appendTextField( "clientID", "ClientID", "specify optional 'ClientID' for of JMS connection" );
67  		simpleform.appendTextField( "messageSelector", "Message Selector", "specify message selector string to determine which messages you want to receive" );
68  		simpleform.addSpace( 5 );
69  	}
70  
71  }