View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2008 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  package com.eviware.soapui.impl.wsdl.support.wsa;
13  
14  import java.beans.PropertyChangeListener;
15  import java.beans.PropertyChangeSupport;
16  
17  import com.eviware.soapui.config.MustUnderstandTypeConfig;
18  import com.eviware.soapui.config.WsaConfigConfig;
19  import com.eviware.soapui.config.WsaVersionTypeConfig;
20  import com.eviware.soapui.support.PropertyChangeNotifier;
21  
22  public class WsaConfig implements PropertyChangeNotifier 
23  {
24  
25  	private final WsaConfigConfig wsaConfig;
26  	
27  	private PropertyChangeSupport propertyChangeSupport;
28  
29  	private final WsaContainer container;
30  
31  	public WsaConfig(WsaConfigConfig wsaConfig, WsaContainer container)
32  	{
33  		this.wsaConfig = wsaConfig;
34  		this.container = container;
35  		propertyChangeSupport = new PropertyChangeSupport(this);
36  		// TODO Auto-generated constructor stub
37  		if (!wsaConfig.isSetMustUnderstand())
38  		{
39  			wsaConfig.setMustUnderstand(MustUnderstandTypeConfig.NONE);
40  		}
41  		if (!wsaConfig.isSetVersion())
42  		{
43  			wsaConfig.setVersion(WsaVersionTypeConfig.X_200508);
44  		}
45  	}
46  
47  	public String getAction()
48  	{
49  		return wsaConfig.getAction();
50  	}
51  
52  	public String getFaultTo()
53  	{
54  		return wsaConfig.getFaultTo();
55  	}
56  
57  	public String getFrom()
58  	{
59  		return wsaConfig.getFrom();
60  	}
61  
62  	public String getTo()
63  	{
64  		return wsaConfig.getTo();
65  	}
66  	public String getRelationshipType()
67  	{
68  		return wsaConfig.getRelationshipType();
69  	}
70  
71  	public String getRelatesTo()
72  	{
73  		return wsaConfig.getRelatesTo();
74  	}
75  
76  	public String getMessageID()
77  	{
78  		return wsaConfig.getMessageID();
79  	}
80  	public String getReplyTo()
81  	{
82  		return wsaConfig.getReplyTo();
83  	}
84  
85  	public String getVersion()
86  	{
87  		return wsaConfig.getVersion().toString();
88  	}
89  	
90  	public boolean isWsaEnabled ()
91  	{
92  		return container.isWsaEnabled();
93  	}
94  
95  
96  	public String getMustUnderstand()
97  	{
98  		return wsaConfig.getMustUnderstand().toString();
99  	}
100 
101 	public void setAction(String arg0)
102 	{
103 		String oldValue = getAction();
104 		wsaConfig.setAction(arg0);
105 		propertyChangeSupport.firePropertyChange("action", oldValue, arg0);
106 	}
107 
108 	public void setFaultTo(String arg0)
109 	{
110 		String oldValue = getFaultTo();
111 		wsaConfig.setFaultTo(arg0);
112 		propertyChangeSupport.firePropertyChange("faultTo", oldValue, arg0);
113 		
114 	}
115 
116 	public void setFrom(String arg0)
117 	{
118 		String oldValue = getFrom();
119 		wsaConfig.setFrom(arg0);
120 		propertyChangeSupport.firePropertyChange("from", oldValue, arg0);
121 	}
122 
123 	public void setTo(String arg0)
124 	{
125 		String oldValue = getTo();
126 		wsaConfig.setTo(arg0);
127 		propertyChangeSupport.firePropertyChange("to", oldValue, arg0);
128 	}
129 
130 	public void setRelationshipType(String arg0)
131 	{
132 		String oldValue = getRelationshipType();
133 		wsaConfig.setRelationshipType(arg0);
134 		propertyChangeSupport.firePropertyChange("relationshipType", oldValue, arg0);
135 	}
136 	public void setRelatesTo(String arg0)
137 	{
138 		String oldValue = getRelatesTo();
139 		wsaConfig.setRelatesTo(arg0);
140 		propertyChangeSupport.firePropertyChange("relatesTo", oldValue, arg0);
141 	}
142 	public void setMessageID(String arg0)
143 	{
144 		String oldValue = getMessageID();
145 		wsaConfig.setMessageID(arg0);
146 		propertyChangeSupport.firePropertyChange("messageID", oldValue, arg0);
147 	}
148 
149 	public void setReplyTo(String arg0)
150 	{
151 		String oldValue = getReplyTo();
152 		wsaConfig.setReplyTo(arg0);
153 		propertyChangeSupport.firePropertyChange("replyTo", oldValue, arg0);
154 	}
155 
156 	public void setMustUnderstand(String arg0)
157 	{
158 		String oldValue = getMustUnderstand();
159 		wsaConfig.setMustUnderstand(MustUnderstandTypeConfig.Enum.forString(arg0));
160 		propertyChangeSupport.firePropertyChange("mustUnderstand", oldValue, arg0);
161 	}
162 
163 	public void setVersion(String arg0)
164 	{
165 		String oldValue = getVersion();
166 		wsaConfig.setVersion(WsaVersionTypeConfig.Enum.forString(arg0));
167 		propertyChangeSupport.firePropertyChange("version", oldValue, arg0);
168 	}
169 
170 	public void setWsaEnabled(boolean arg0)
171 	{
172 		boolean oldValue = isWsaEnabled();
173 		container.setWsaEnabled(arg0);
174 		propertyChangeSupport.firePropertyChange("wsaEnabled", oldValue, arg0);
175 	}
176 
177 	public void addPropertyChangeListener(PropertyChangeListener listener)
178 	{
179 		propertyChangeSupport.addPropertyChangeListener(listener);
180 	}
181 
182 	public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
183 	{
184 		propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
185 	}
186 
187 	public void removePropertyChangeListener(PropertyChangeListener listener)
188 	{
189 		propertyChangeSupport.removePropertyChangeListener(listener);
190 	}
191 
192 	public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
193 	{
194 		propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
195 	}
196 
197 	public WsaContainer getWsaContainer()
198 	{
199 		return container;
200 	}
201 
202 
203 
204 }