Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: 257ef4e08729a6cd5088a480f1ef7353a928ae25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*******************************************************************************
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 * yyyymmdd bug      Email and other contact information
 * -------- -------- -----------------------------------------------------------
 * 20060816   104870 kathy@ca.ibm.com - Kathy Chan
 * 20060821   153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime
 * 20070314   154543 makandre@ca.ibm.com - Andrew Mak, WebServiceTestRegistry is tracking extensions using label attribute instead of ID
 * 20080325   184761 gilberta@ca.ibm.com - Gilbert Andrews
 *******************************************************************************/

package org.eclipse.jst.ws.internal.ext.test;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jst.ws.internal.ext.WebServiceExtensionImpl;




/**
* This represents an extension in the plugin registry 
* It job is to act as a proxy to the iconfigelement
* In particular it holds a client test extension element 
*/
public class WebServiceTestExtension extends WebServiceExtensionImpl
{
  // Copyright
  public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";

  private List supportedRuntimes_ = new ArrayList();
  
  public WebServiceTestExtension(IConfigurationElement configElement)
  {
    super(configElement);
       
    String runtimesList = getConfigElement().getAttribute("supportedClientRuntimes");  
   
    addRuntimes(runtimesList);
  }
  
  /**
   * Adds a list of space delimited runtime IDs.
   * 
   * @param runtimesList The list of runtime IDs.
   */
  public void addRuntimes(String runtimesList) {
	  
	  if (runtimesList == null)
		  return;
	  
	  String[] runtimes = runtimesList.split("\\s+");
	    
	  for (int i = 0; i < runtimes.length; i++) {	    	
		  if (runtimes[i].length() > 0)
			  supportedRuntimes_.add(runtimes[i]);   
	  }
  }
  
  /**
  * Will this testClient generate code
  * @return boolean true if codegen needed
  */
  public boolean isCodeGenNeeded()
  {
    return Boolean.valueOf(getConfigElement().getAttribute( "codeGenerated" )).booleanValue();
  }
  
  /**
  * Use the default Folder Provided by us
  * @return boolean true if no special folder requires
  */
  public boolean useDefaultCodeGenFolder()
  {
    return Boolean.valueOf(getConfigElement().getAttribute( "defaultcodegenfolder" )).booleanValue();
  }

  /**
  * Use Special Folder for generated code
  * @return String special folder name
  */
  public String getCodeGenFolder()
  {
    return getConfigElement().getAttribute( "codegenfolder" );
  }

  public boolean isDefaultJAXRPC()
  {
	  return Boolean.valueOf(getConfigElement().getAttribute( "isdefaultjaxrpc" )).booleanValue();
  }
   
  /**
  * Do we need to launch something
  * @return Boolean if true launch codegen
  */
  public boolean isLaunchRequired()
  {
    return Boolean.valueOf(getConfigElement().getAttribute( "launchRequired" )).booleanValue();
  }

  /**
  * Do we need the methods for the proxy
  * @return boolean true if proxy methods needed
  */
  public boolean areMethodsNeeded()
  {
    return Boolean.valueOf(getConfigElement().getAttribute( "methodsneeded" )).booleanValue();
  }

  /**
  * Does this test machine need a server
  * @return boolean true if a server is required
  */
  public boolean isServerNeeded()
  {
    return Boolean.valueOf(getConfigElement().getAttribute( "serverRequired" )).booleanValue();
  }

  /**
  * Use the Default Server chosen by the wizard
  * @return boolean true if the default server is wanted
  */
  public boolean useDefaultServer()
  {
    return Boolean.valueOf(getConfigElement().getAttribute( "defaultserver" )).booleanValue();
  }

  /**
  * Use the Default Server chosen by the wizard
  * @return boolean true if the default server is wanted
  */
  public String useServer()
  {
    return getConfigElement().getAttribute( "useserver" );
  }

  public boolean testWSDL()
  {
  	String wsdl = getConfigElement().getAttribute( "testWSDL" );
    if(wsdl.equals("yes") || wsdl.equals("true"))
	  return true;
	 
	return false;  
  }
  
  public boolean testJavaProxy()
  {
  	String javaProxy = getConfigElement().getAttribute( "testJavaProxy" );
    if(javaProxy == null) return false;
  	if(javaProxy.equals("yes") || javaProxy.equals("true"))
	  return true;
	 
	return false;  
  }
  	
  /**
   * Returns the id attribute of this WebServiceTestExtension
   * 
   * @return The value of the id attribute.
   */
  public String getId() {
	return getConfigElement().getAttribute( "id" ); 
  }
   
  /**
   * Returns the label attribute of this WebServiceTestExtension
   * 
   * @return The value of the label attribute.
   */
  public String getLabel() {
    return getConfigElement().getAttribute( "label" );
  }
  
  /**
   * Does this extension allow extenders to restrict the runtimes that are supported?
   *  
   * @return The value of the allowRunimesRestriction attribute, false if not present.
   */
  public boolean allowClientRuntimesRestriction() {
	  return Boolean.valueOf(getConfigElement().getAttribute( "allowClientRuntimesRestriction" )).booleanValue();
  }  
       
  /**
   * Determines if this WebServiceTestExtension supports the give client runtime ID.
   * 
   * @return true if the client runtime ID is supported, false otherwise.
   */
  public boolean supportsRuntime(String runtimeId) {
	  
	 if (!allowClientRuntimesRestriction() || supportedRuntimes_.isEmpty())
		 return true;
	  
	 return supportedRuntimes_.contains(runtimeId);
  }
}


Back to the top