01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * 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.impl.wsdl.teststeps.registry;
14:
15: import java.util.HashMap;
16: import java.util.Map;
17:
18: import com.eviware.soapui.config.TestStepConfig;
19:
20: /**
21: * Registry of WsdlTestStep factories
22: *
23: * @author Ole.Matzura
24: */
25:
26: public class WsdlTestStepRegistry {
27: private static WsdlTestStepRegistry instance;
28: private Map<String, WsdlTestStepFactory> factoryMap = new HashMap<String, WsdlTestStepFactory>();
29:
30: public WsdlTestStepRegistry() {
31: addFactory(new WsdlTestRequestStepFactory());
32: addFactory(new TransferValuesStepFactory());
33: addFactory(new GotoStepFactory());
34: addFactory(new DelayStepFactory());
35: addFactory(new PropertiesStepFactory());
36: addFactory(new GroovyScriptStepFactory());
37: }
38:
39: public WsdlTestStepFactory getFactory(String type) {
40: return factoryMap.get(type);
41: }
42:
43: public void addFactory(WsdlTestStepFactory factory) {
44: factoryMap.put(factory.getType(), factory);
45: }
46:
47: public static synchronized WsdlTestStepRegistry getInstance() {
48: if (instance == null)
49: instance = new WsdlTestStepRegistry();
50:
51: return instance;
52: }
53:
54: public WsdlTestStepFactory[] getFactories() {
55: return factoryMap.values().toArray(
56: new WsdlTestStepFactory[factoryMap.size()]);
57: }
58:
59: public boolean hasFactory(TestStepConfig config) {
60: return getFactory(config.getType()) != null;
61: }
62:
63: }
|