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.loadtest.strategy;
14:
15: import java.util.HashMap;
16: import java.util.Map;
17:
18: /**
19: * Registry of LoadFactorys
20: *
21: * @author Ole.Matzura
22: */
23:
24: public class LoadStrategyRegistry {
25: private static LoadStrategyRegistry instance;
26: private Map<String, LoadStrategyFactory> factories = new HashMap<String, LoadStrategyFactory>();
27:
28: public LoadStrategyRegistry() {
29: addFactory(new SimpleLoadStrategy.Factory());
30: addFactory(new BurstLoadStrategy.Factory());
31: addFactory(new VarianceLoadStrategy.Factory());
32: addFactory(new ThreadCountChangeLoadStrategy.Factory());
33: }
34:
35: private void addFactory(LoadStrategyFactory factory) {
36: factories.put(factory.getType(), factory);
37: }
38:
39: public Object[] getStrategies() {
40: return factories.keySet().toArray();
41: }
42:
43: public static LoadStrategyRegistry getInstance() {
44: if (instance == null)
45: instance = new LoadStrategyRegistry();
46:
47: return instance;
48: }
49:
50: public LoadStrategyFactory getFactory(String type) {
51: return factories.get(type);
52: }
53: }
|