View Javadoc

1   /*
2    *  soapUI, copyright (C) 2006 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of the GNU Lesser General Public License as published by the Free Software Foundation; 
6    *  either version 2.1 of the License, or (at your option) any later version.
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.impl.wsdl.teststeps.registry;
14  
15  import java.util.HashMap;
16  import java.util.Map;
17  
18  /***
19   * Registry of WsdlTestStep factories
20   * 
21   * @author Ole.Matzura
22   */
23  
24  public class WsdlTestStepRegistry
25  {
26  	private static WsdlTestStepRegistry instance;
27  	private Map<String,WsdlTestStepFactory> factoryMap = new HashMap<String,WsdlTestStepFactory>();
28  
29  	public WsdlTestStepRegistry()
30  	{
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  	{
41  		return factoryMap.get( type ); 
42  	}
43  
44  	public void addFactory( WsdlTestStepFactory factory )
45  	{
46  		factoryMap.put( factory.getType(), factory );
47  	}
48  
49  	public static synchronized WsdlTestStepRegistry getInstance()
50  	{
51  		if( instance == null )
52  			instance = new WsdlTestStepRegistry();
53  		
54  		return instance;
55  	}
56  
57  	public WsdlTestStepFactory [] getFactories()
58  	{
59  		return factoryMap.values().toArray( new WsdlTestStepFactory[factoryMap.size()] );
60  	}
61  	
62  }