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.ui.desktop;
14:
15: import java.util.HashMap;
16: import java.util.Map;
17:
18: import com.eviware.soapui.model.workspace.Workspace;
19:
20: /**
21: * Registry of available desktops
22: *
23: * @author ole.matzura
24: */
25:
26: public class DesktopRegistry {
27: private static DesktopRegistry instance;
28: private Map<String, DesktopFactory> factories = new HashMap<String, DesktopFactory>();
29:
30: public static DesktopRegistry getInstance() {
31: if (instance == null)
32: instance = new DesktopRegistry();
33:
34: return instance;
35: }
36:
37: public void addDesktop(String name, DesktopFactory factory) {
38: factories.put(name, factory);
39: }
40:
41: public String[] getNames() {
42: return factories.keySet().toArray(new String[factories.size()]);
43: }
44:
45: public SoapUIDesktop createDesktop(String desktopType,
46: Workspace workspace) {
47: if (factories.containsKey(desktopType))
48: return factories.get(desktopType).createDesktop(workspace);
49:
50: return null;
51: }
52: }
|