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.support.scripting;
14:
15: import java.util.HashMap;
16: import java.util.Map;
17:
18: import com.eviware.soapui.model.ModelItem;
19: import com.eviware.soapui.support.scripting.groovy.GroovyScriptEngineFactory;
20:
21: /**
22: * Registry of available script engines
23: *
24: * @author ole.matzura
25: */
26:
27: public class SoapUIScriptEngineRegistry {
28: public static final String GROOVY_ID = GroovyScriptEngineFactory.ID;
29:
30: private static Map<String, SoapUIScriptEngineFactory> factories = new HashMap<String, SoapUIScriptEngineFactory>();
31:
32: public static void registerScriptEngine(String id,
33: SoapUIScriptEngineFactory factory) {
34: factories.put(id, factory);
35: }
36:
37: public static SoapUIScriptEngineFactory getFactory(String id) {
38: return factories.get(id);
39: }
40:
41: public static SoapUIScriptEngine create(String id,
42: ModelItem modelItem) {
43: return factories.get(id).createScriptEngine(modelItem);
44: }
45:
46: static {
47: registerScriptEngine(GroovyScriptEngineFactory.ID,
48: new GroovyScriptEngineFactory());
49: }
50: }
|