|
1 /* |
|
2 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * A Super class for pluggable connectors used by |
|
26 * nsk/jdi/PlugConnectors tests |
|
27 */ |
|
28 |
|
29 package nsk.share.jdi; |
|
30 |
|
31 import com.sun.jdi.*; |
|
32 import com.sun.jdi.connect.*; |
|
33 import java.io.*; |
|
34 import java.util.*; |
|
35 |
|
36 public class PlugConnectors implements Connector { |
|
37 |
|
38 String plugConnectorName = "Undefined_PlugConnector_Name"; |
|
39 String plugConnectorDescription = "Undefined_PlugConnector_Description"; |
|
40 Transport plugConnectorTransport = new PlugConnectorsTransport(); |
|
41 Map<java.lang.String,com.sun.jdi.connect.Connector.Argument> plugConnectorDefaultArguments = new HashMap<java.lang.String,com.sun.jdi.connect.Connector.Argument>(); |
|
42 |
|
43 /* |
|
44 * Simple implementation of Connector.Argument |
|
45 */ |
|
46 public static class TestArgument implements Connector.Argument { |
|
47 String argName; |
|
48 String argLabel; |
|
49 String argDescription; |
|
50 String argStringValue; |
|
51 boolean argMustSpecify; |
|
52 |
|
53 public TestArgument( |
|
54 String argName, |
|
55 String argLabel, |
|
56 String argDescription, |
|
57 String argValue, |
|
58 boolean argMustSpecify) { |
|
59 |
|
60 this.argName = argName; |
|
61 this.argLabel = argLabel; |
|
62 this.argDescription = argDescription; |
|
63 this.argStringValue = argValue; |
|
64 this.argMustSpecify = argMustSpecify; |
|
65 } |
|
66 |
|
67 public String name() { |
|
68 return argName; |
|
69 } |
|
70 |
|
71 public String label() { |
|
72 return argLabel; |
|
73 } |
|
74 |
|
75 public String description() { |
|
76 return argDescription; |
|
77 } |
|
78 |
|
79 public String value() { |
|
80 return argStringValue; |
|
81 } |
|
82 |
|
83 public void setValue(String argValue) { |
|
84 this.argStringValue = argValue; |
|
85 } |
|
86 |
|
87 public boolean isValid(String argValue) { |
|
88 if ( argValue != null ) { |
|
89 if (argValue.length() > 0) { |
|
90 return true; |
|
91 } |
|
92 } |
|
93 return false; |
|
94 } |
|
95 |
|
96 public boolean mustSpecify() { |
|
97 return argMustSpecify; |
|
98 } |
|
99 } // end of TestArgument static class |
|
100 |
|
101 /* |
|
102 * Simple implementation of Connector.StringArgument |
|
103 */ |
|
104 public static class TestStringArgument extends TestArgument implements Connector.StringArgument { |
|
105 |
|
106 public TestStringArgument( String argName, |
|
107 String argLabel, |
|
108 String argDescription, |
|
109 String argValue, |
|
110 boolean argMustSpecify) { |
|
111 |
|
112 super(argName, argLabel, argDescription, argValue, argMustSpecify); |
|
113 } |
|
114 |
|
115 } // end of TestStringArgument static class |
|
116 |
|
117 /* |
|
118 * Simple implementation of Connector.IntegerArgument |
|
119 */ |
|
120 public static class TestIntegerArgument extends TestArgument implements Connector.IntegerArgument { |
|
121 |
|
122 int argIntValue; |
|
123 int minArgIntValue; |
|
124 int maxArgIntValue; |
|
125 |
|
126 public TestIntegerArgument(String argName, |
|
127 String argLabel, |
|
128 String argDescription, |
|
129 int argValue, |
|
130 int minArgIntValue, |
|
131 int maxArgIntValue, |
|
132 boolean argMustSpecify) { |
|
133 |
|
134 super(argName, argLabel, argDescription, "" + argValue, argMustSpecify); |
|
135 this.argIntValue = argValue; |
|
136 this.minArgIntValue = minArgIntValue; |
|
137 this.maxArgIntValue = maxArgIntValue; |
|
138 |
|
139 } |
|
140 |
|
141 public int intValue() { |
|
142 return argIntValue; |
|
143 } |
|
144 |
|
145 public boolean isValid(int value) { |
|
146 if ( value >= minArgIntValue && value <= maxArgIntValue ) { |
|
147 return true; |
|
148 } |
|
149 return false; |
|
150 } |
|
151 |
|
152 public boolean isValid(String stringValue) { |
|
153 int intValue; |
|
154 try { |
|
155 intValue = Integer.parseInt(stringValue); |
|
156 } catch (NumberFormatException exception) { |
|
157 return false; |
|
158 } |
|
159 return isValid(intValue); |
|
160 } |
|
161 |
|
162 public int max() { |
|
163 return maxArgIntValue; |
|
164 } |
|
165 |
|
166 public int min() { |
|
167 return minArgIntValue; |
|
168 } |
|
169 |
|
170 public void setValue(int value) { |
|
171 argIntValue = value; |
|
172 } |
|
173 |
|
174 public String stringValueOf(int value) { |
|
175 return "" + value; |
|
176 } |
|
177 |
|
178 } // end of TestIntegerArgument static class |
|
179 |
|
180 /* |
|
181 * Simple implementation of Connector.BooleanArgument |
|
182 */ |
|
183 public static class TestBooleanArgument extends TestArgument implements Connector.BooleanArgument { |
|
184 |
|
185 static final String argStringValueTrue = "true"; |
|
186 static final String argStringValueFalse = "false"; |
|
187 boolean argBooleanValue; |
|
188 |
|
189 public TestBooleanArgument(String argName, |
|
190 String argLabel, |
|
191 String argDescription, |
|
192 boolean argValue, |
|
193 boolean argMustSpecify) { |
|
194 |
|
195 super(argName, argLabel, argDescription, |
|
196 argValue ? argStringValueTrue : argStringValueFalse, |
|
197 argMustSpecify); |
|
198 this.argBooleanValue = argValue; |
|
199 |
|
200 } |
|
201 |
|
202 public boolean booleanValue() { |
|
203 return argBooleanValue; |
|
204 } |
|
205 |
|
206 public boolean isValid(String stringValue) { |
|
207 if ( argStringValueTrue.equals(stringValue) || argStringValueFalse.equals(stringValue) ) { |
|
208 return true; |
|
209 } |
|
210 return false; |
|
211 } |
|
212 |
|
213 public void setValue(boolean value) { |
|
214 argBooleanValue = value; |
|
215 } |
|
216 |
|
217 public String stringValueOf(boolean value) { |
|
218 if ( value ) { |
|
219 return argStringValueTrue; |
|
220 } |
|
221 return argStringValueFalse; |
|
222 } |
|
223 |
|
224 } // end of TestBooleanArgument static class |
|
225 |
|
226 /* |
|
227 * Simple implementation of Connector.SelectedArgument |
|
228 */ |
|
229 public static class TestSelectedArgument extends TestArgument implements Connector.SelectedArgument { |
|
230 |
|
231 List<String> acceptableArgsList; |
|
232 |
|
233 public TestSelectedArgument( String argName, |
|
234 String argLabel, |
|
235 String argDescription, |
|
236 String argValue, |
|
237 List<String> acceptableArgsList, |
|
238 boolean argMustSpecify) { |
|
239 |
|
240 super(argName, argLabel, argDescription, argValue, argMustSpecify); |
|
241 this.acceptableArgsList = acceptableArgsList; |
|
242 } |
|
243 |
|
244 public List<String> choices() { |
|
245 return acceptableArgsList; |
|
246 } |
|
247 |
|
248 public boolean isValid(String stringValue) { |
|
249 |
|
250 return acceptableArgsList.contains(stringValue); |
|
251 } |
|
252 |
|
253 } // end of TestSelectedArgument static class |
|
254 |
|
255 public PlugConnectors( |
|
256 String plugConnectorName, |
|
257 String plugConnectorDescription, |
|
258 Transport plugConnectorTransport, |
|
259 Map<java.lang.String,com.sun.jdi.connect.Connector.Argument> plugConnectorDefaultArguments |
|
260 ) { |
|
261 |
|
262 this.plugConnectorName = plugConnectorName; |
|
263 this.plugConnectorDescription = plugConnectorDescription; |
|
264 this.plugConnectorTransport = plugConnectorTransport; |
|
265 this.plugConnectorDefaultArguments = plugConnectorDefaultArguments; |
|
266 } |
|
267 |
|
268 public String name() { |
|
269 return plugConnectorName; |
|
270 } |
|
271 |
|
272 public String description() { |
|
273 return plugConnectorDescription; |
|
274 } |
|
275 |
|
276 public Transport transport() { |
|
277 return plugConnectorTransport; |
|
278 } |
|
279 |
|
280 public Map<java.lang.String,com.sun.jdi.connect.Connector.Argument> defaultArguments() { |
|
281 return plugConnectorDefaultArguments; |
|
282 } |
|
283 |
|
284 public VirtualMachine launch(Map<String,? extends Connector.Argument> arguments) throws |
|
285 IOException, |
|
286 IllegalConnectorArgumentsException, |
|
287 VMStartException { |
|
288 |
|
289 String exceptionMessage = "## PlugConnectors: Connector name = '" + |
|
290 plugConnectorName + "';\nNon-authorized call of launch(...) method!"; |
|
291 |
|
292 if ( true ) { |
|
293 throw new RuntimeException(exceptionMessage); |
|
294 } |
|
295 |
|
296 return null; |
|
297 } |
|
298 |
|
299 public VirtualMachine attach(Map<String,? extends Connector.Argument> arguments) throws |
|
300 java.io.IOException, |
|
301 IllegalConnectorArgumentsException { |
|
302 |
|
303 String exceptionMessage = "## PlugConnectors: Connector name = '" + |
|
304 plugConnectorName + "';\nNon-authorized call of attach(...) method!"; |
|
305 |
|
306 if ( true ) { |
|
307 throw new RuntimeException(exceptionMessage); |
|
308 } |
|
309 |
|
310 return null; |
|
311 } |
|
312 |
|
313 public String startListening(Map<String,? extends Connector.Argument> arguments) throws |
|
314 java.io.IOException, |
|
315 IllegalConnectorArgumentsException { |
|
316 |
|
317 String exceptionMessage = "## PlugConnectors: Connector name = '" + |
|
318 plugConnectorName + "';\nNon-authorized call of startListening(...) method!"; |
|
319 |
|
320 if ( true ) { |
|
321 throw new RuntimeException(exceptionMessage); |
|
322 } |
|
323 |
|
324 return null; |
|
325 } |
|
326 |
|
327 public void stopListening(Map<String,? extends Connector.Argument> arguments) throws |
|
328 java.io.IOException, |
|
329 IllegalConnectorArgumentsException { |
|
330 |
|
331 String exceptionMessage = "## PlugConnectors: Connector name = '" + |
|
332 plugConnectorName + "';\nNon-authorized call of stopListening(...) method!"; |
|
333 |
|
334 if ( true ) { |
|
335 throw new RuntimeException(exceptionMessage); |
|
336 } |
|
337 } |
|
338 |
|
339 public VirtualMachine accept(Map<String,? extends Connector.Argument> arguments) throws |
|
340 java.io.IOException, |
|
341 IllegalConnectorArgumentsException { |
|
342 |
|
343 String exceptionMessage = "## PlugConnectors: Connector name = '" + |
|
344 plugConnectorName + "';\nNon-authorized call of accept(...) method!"; |
|
345 |
|
346 if ( true ) { |
|
347 throw new RuntimeException(exceptionMessage); |
|
348 } |
|
349 |
|
350 return null; |
|
351 } |
|
352 |
|
353 public boolean supportsMultipleConnections() { |
|
354 |
|
355 String exceptionMessage = "## PlugConnectors: Connector name = '" + |
|
356 plugConnectorName + "';\nNon-authorized call of supportsMultipleConnections() method!"; |
|
357 |
|
358 if ( true ) { |
|
359 throw new RuntimeException(exceptionMessage); |
|
360 } |
|
361 |
|
362 return false; |
|
363 } |
|
364 |
|
365 public static class PlugConnectorsTransport implements Transport { |
|
366 |
|
367 String transportName = "Undefined_Transport_Name"; |
|
368 |
|
369 public PlugConnectorsTransport() { |
|
370 } |
|
371 |
|
372 public PlugConnectorsTransport(String transportName) { |
|
373 this.transportName = transportName; |
|
374 } |
|
375 |
|
376 public String name() { |
|
377 return transportName; |
|
378 } |
|
379 |
|
380 } // end of PlugConnectorsTransport class |
|
381 |
|
382 // Auxiliary general purpose methods for pluggable connectors' tests. |
|
383 |
|
384 public static String compareConnectors( |
|
385 String errorLogPrefixHead, |
|
386 String errorLogPrefix, |
|
387 Connector referenceConnector, |
|
388 Connector checkedConnector) { |
|
389 |
|
390 String emptyString = ""; |
|
391 String errorMessage = emptyString; |
|
392 |
|
393 // check that connectors have the same name |
|
394 String referenceConnectorName = referenceConnector.name(); |
|
395 String checkedConnectorName = checkedConnector.name(); |
|
396 if ( ! referenceConnectorName.equals(checkedConnectorName) ) { |
|
397 errorMessage = errorMessage + |
|
398 errorLogPrefixHead + "Checked pluggable Connector has unexpected name:\n" |
|
399 + errorLogPrefix + "Expected Connector's name = '" + referenceConnectorName + "'\n" |
|
400 + errorLogPrefix + "Actual Connector's name = '" + checkedConnectorName + "'\n"; |
|
401 } |
|
402 |
|
403 // check that connectors have the same description |
|
404 String referenceConnectorDescription = referenceConnector.description(); |
|
405 String checkedConnectorDescription = checkedConnector.description(); |
|
406 if ( ! referenceConnectorDescription.equals(checkedConnectorDescription) ) { |
|
407 errorMessage = errorMessage + |
|
408 errorLogPrefixHead + "Checked pluggable Connector has unexpected description:\n" |
|
409 + errorLogPrefix + "Expected Connector's description = '" + referenceConnectorDescription + "'\n" |
|
410 + errorLogPrefix + "Actual Connector's description = '" + checkedConnectorDescription + "'\n"; |
|
411 } |
|
412 |
|
413 // check that connectors have the same transport name |
|
414 String referenceConnectorTransportName = referenceConnector.transport().name(); |
|
415 String checkedConnectorTransportName = checkedConnector.transport().name(); |
|
416 if ( ! referenceConnectorTransportName.equals(checkedConnectorTransportName) ) { |
|
417 errorMessage = errorMessage + |
|
418 errorLogPrefixHead + "Checked pluggable Connector has unexpected transport name:\n" |
|
419 + errorLogPrefix + "Expected Connector's transport name = '" + referenceConnectorTransportName + "'\n" |
|
420 + errorLogPrefix + "Actual Connector's transport name = '" + checkedConnectorTransportName + "'\n"; |
|
421 } |
|
422 |
|
423 // check that connectors have the same number of default arguments |
|
424 int referenceConnectorArgumentsNumber = referenceConnector.defaultArguments().size(); |
|
425 int checkedConnectorArgumentsNumber = checkedConnector.defaultArguments().size(); |
|
426 if ( referenceConnectorArgumentsNumber != checkedConnectorArgumentsNumber ) { |
|
427 errorMessage = errorMessage + |
|
428 errorLogPrefixHead + "Checked pluggable Connector has unexpected number of default arguments:\n" |
|
429 + errorLogPrefix + "Expected number of default arguments = '" + referenceConnectorArgumentsNumber + "'\n" |
|
430 + errorLogPrefix + "Actual number of default arguments = '" + checkedConnectorArgumentsNumber + "'\n"; |
|
431 } |
|
432 |
|
433 |
|
434 return errorMessage; |
|
435 } // end of compareConnectors(...) method |
|
436 |
|
437 public static String compareConnectorArguments( |
|
438 String errorLogPrefixHead, |
|
439 String errorLogPrefix, |
|
440 Connector.Argument referenceArgument, |
|
441 Connector.Argument checkedArgument) { |
|
442 |
|
443 String emptyString = ""; |
|
444 String errorMessage = emptyString; |
|
445 |
|
446 if ( referenceArgument == null ) { |
|
447 errorMessage = |
|
448 errorLogPrefixHead + "Reference connector's argument is null!\n"; |
|
449 } |
|
450 |
|
451 if ( checkedArgument == null ) { |
|
452 errorMessage = errorMessage + |
|
453 errorLogPrefixHead + "Checked connector's argument is null!\n"; |
|
454 } |
|
455 |
|
456 if ( ! errorMessage.equals(emptyString) ) { |
|
457 return errorMessage; |
|
458 } |
|
459 |
|
460 String referenceArgumentName = referenceArgument.name(); |
|
461 String checkedArgumentName = checkedArgument.name(); |
|
462 if ( ! referenceArgumentName.equals(checkedArgumentName) ) { |
|
463 errorMessage = |
|
464 errorLogPrefixHead + "Checked connector's argument has unexpected name:\n" |
|
465 + errorLogPrefix + "Expected connector's argument name = '" + referenceArgumentName + "'\n" |
|
466 + errorLogPrefix + "Actual connector's argument name = '" + checkedArgumentName + "'"; |
|
467 return errorMessage; |
|
468 } |
|
469 |
|
470 String referenceArgumentLabel = referenceArgument.label(); |
|
471 String checkedArgumentLabel = checkedArgument.label(); |
|
472 if ( ! referenceArgumentLabel.equals(checkedArgumentLabel) ) { |
|
473 errorMessage = |
|
474 errorLogPrefixHead + "Checked connector's argument has unexpected label:\n" |
|
475 + errorLogPrefix + "Expected connector's argument label = '" + referenceArgumentLabel + "'\n" |
|
476 + errorLogPrefix + "Actual connector's argument label = '" + checkedArgumentLabel + "'"; |
|
477 return errorMessage; |
|
478 } |
|
479 |
|
480 String referenceArgumentDescription = referenceArgument.description(); |
|
481 String checkedArgumentDescription = checkedArgument.description(); |
|
482 if ( ! referenceArgumentDescription.equals(checkedArgumentDescription) ) { |
|
483 errorMessage = |
|
484 errorLogPrefixHead + "Checked connector's argument has unexpected description:\n" |
|
485 + errorLogPrefix + "Expected connector's argument description = '" + referenceArgumentDescription + "'\n" |
|
486 + errorLogPrefix + "Actual connector's argument description = '" + checkedArgumentDescription + "'"; |
|
487 return errorMessage; |
|
488 } |
|
489 |
|
490 String referenceArgumentValue = referenceArgument.value(); |
|
491 String checkedArgumentValue = checkedArgument.value(); |
|
492 if ( ! referenceArgumentValue.equals(checkedArgumentValue) ) { |
|
493 errorMessage = |
|
494 errorLogPrefixHead + "Checked connector's argument has unexpected value:\n" |
|
495 + errorLogPrefix + "Expected connector's argument value = '" + referenceArgumentValue + "'\n" |
|
496 + errorLogPrefix + "Actual connector's argument value = '" + checkedArgumentValue + "'"; |
|
497 return errorMessage; |
|
498 } |
|
499 |
|
500 boolean referenceArgumentMustSpecify = referenceArgument.mustSpecify(); |
|
501 boolean checkedArgumentMustSpecify = checkedArgument.mustSpecify(); |
|
502 if ( referenceArgumentMustSpecify != checkedArgumentMustSpecify ) { |
|
503 errorMessage = |
|
504 errorLogPrefixHead + "Checked connector's argument has unexpected 'mustSpecify' property:\n" |
|
505 + errorLogPrefix + "Expected connector's argument 'mustSpecify' property = '" |
|
506 + referenceArgumentMustSpecify + "'\n" |
|
507 + errorLogPrefix + "Actual connector's argument 'mustSpecify' property = '" |
|
508 + checkedArgumentMustSpecify + "'"; |
|
509 return errorMessage; |
|
510 } |
|
511 |
|
512 if ( referenceArgument instanceof Connector.IntegerArgument ) { |
|
513 |
|
514 int referenceArgumentMin = ((Connector.IntegerArgument)referenceArgument).min(); |
|
515 int checkedArgumentMin = ((Connector.IntegerArgument)checkedArgument).min(); |
|
516 if ( referenceArgumentMin != checkedArgumentMin ) { |
|
517 errorMessage = |
|
518 errorLogPrefixHead + "Checked connector's integer argument has unexpected min value:\n" |
|
519 + errorLogPrefix + "Expected connector's argument min value = " |
|
520 + referenceArgumentMin + "\n" |
|
521 + errorLogPrefix + "Actual connector's argument min value = " |
|
522 + checkedArgumentMin + "\n"; |
|
523 } |
|
524 |
|
525 int referenceArgumentMax = ((Connector.IntegerArgument)referenceArgument).max(); |
|
526 int checkedArgumentMax = ((Connector.IntegerArgument)checkedArgument).max(); |
|
527 if ( referenceArgumentMax != checkedArgumentMax ) { |
|
528 errorMessage = errorMessage + |
|
529 errorLogPrefixHead + "Checked connector's integer argument has unexpected max value:\n" |
|
530 + errorLogPrefix + "Expected connector's argument max value = " |
|
531 + referenceArgumentMax + "\n" |
|
532 + errorLogPrefix + "Actual connector's argument max value = " |
|
533 + checkedArgumentMax + "\n"; |
|
534 } |
|
535 |
|
536 } |
|
537 |
|
538 if ( referenceArgument instanceof Connector.SelectedArgument ) { |
|
539 |
|
540 List referenceArgumentChoices = ((Connector.SelectedArgument)referenceArgument).choices(); |
|
541 List checkedArgumentChoices = ((Connector.SelectedArgument)checkedArgument).choices(); |
|
542 |
|
543 int referenceArgumentChoicesSize = referenceArgumentChoices.size(); |
|
544 int checkedArgumentChoicesSize = checkedArgumentChoices.size(); |
|
545 |
|
546 if ( referenceArgumentChoicesSize != checkedArgumentChoicesSize) { |
|
547 errorMessage = errorMessage + |
|
548 errorLogPrefixHead + "Checked connector's Selected argument has unexpected choices' size:\n" |
|
549 + errorLogPrefix + "Expected size = '" |
|
550 + referenceArgumentChoicesSize + "'\n" |
|
551 + errorLogPrefix + "Actual size = " |
|
552 + checkedArgumentChoicesSize; |
|
553 return errorMessage; |
|
554 } |
|
555 |
|
556 for (int i=0; i < referenceArgumentChoicesSize; i++) { |
|
557 String referenceArgumentChoice = (String)(referenceArgumentChoices.get(i)); |
|
558 if ( ! checkedArgumentChoices.contains(referenceArgumentChoice) ) { |
|
559 errorMessage = errorMessage + |
|
560 errorLogPrefixHead + "Checked connector's Selected argument has NOT expected choices' element:\n" |
|
561 + errorLogPrefix + "Expected choices' element = '" |
|
562 + referenceArgumentChoice + "'\n"; |
|
563 } |
|
564 |
|
565 String checkedArgumentChoice = (String)(checkedArgumentChoices.get(i)); |
|
566 if ( ! referenceArgumentChoices.contains(checkedArgumentChoice) ) { |
|
567 errorMessage = errorMessage + |
|
568 errorLogPrefixHead + "Checked connector's Selected argument has unexpected choices' element:\n" |
|
569 + errorLogPrefix + "Unexpected choices' element = '" |
|
570 + checkedArgumentChoice + "'\n"; |
|
571 } |
|
572 } |
|
573 } |
|
574 return errorMessage; |
|
575 } // end of compareConnectorArguments(...) method |
|
576 |
|
577 public static Connector.Argument getConnectorDefaultArgument( |
|
578 Connector connector, |
|
579 String argumentName) { |
|
580 |
|
581 Connector.Argument foundArgument = null; |
|
582 |
|
583 Map connectorDefaultArguments = connector.defaultArguments(); |
|
584 Object[] defaultArgumentsArray = connectorDefaultArguments.values().toArray(); |
|
585 |
|
586 for (int i=0; i < defaultArgumentsArray.length; i++) { |
|
587 Connector.Argument connectorArgument = (Connector.Argument)defaultArgumentsArray[i]; |
|
588 if ( argumentName.equals(connectorArgument.name()) ) { |
|
589 foundArgument = connectorArgument; |
|
590 break; |
|
591 } |
|
592 } |
|
593 return foundArgument; |
|
594 } |
|
595 |
|
596 } // end of PlugConnectors class |