001: /*
002: * soapUI, copyright (C) 2004-2007 eviware.com
003: *
004: * soapUI is free software; you can redistribute it and/or modify it under the
005: * terms of version 2.1 of the GNU Lesser General Public License as published by
006: * the Free Software Foundation.
007: *
008: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
009: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
010: * See the GNU Lesser General Public License for more details at gnu.org.
011: */
012:
013: package com.eviware.soapui.model.util;
014:
015: import java.util.HashMap;
016: import java.util.Map;
017:
018: import com.eviware.soapui.impl.WorkspaceImpl;
019: import com.eviware.soapui.impl.WorkspaceImplPanelBuilder;
020: import com.eviware.soapui.impl.wsdl.WsdlInterface;
021: import com.eviware.soapui.impl.wsdl.WsdlOperation;
022: import com.eviware.soapui.impl.wsdl.WsdlProject;
023: import com.eviware.soapui.impl.wsdl.WsdlRequest;
024: import com.eviware.soapui.impl.wsdl.WsdlTestSuite;
025: import com.eviware.soapui.impl.wsdl.loadtest.WsdlLoadTest;
026: import com.eviware.soapui.impl.wsdl.mock.WsdlMockOperation;
027: import com.eviware.soapui.impl.wsdl.mock.WsdlMockResponse;
028: import com.eviware.soapui.impl.wsdl.mock.WsdlMockService;
029: import com.eviware.soapui.impl.wsdl.panels.iface.WsdlInterfacePanelBuilder;
030: import com.eviware.soapui.impl.wsdl.panels.loadtest.WsdlLoadTestPanelBuilder;
031: import com.eviware.soapui.impl.wsdl.panels.mock.WsdlMockServicePanelBuilder;
032: import com.eviware.soapui.impl.wsdl.panels.mockoperation.WsdlMockOperationPanelBuilder;
033: import com.eviware.soapui.impl.wsdl.panels.mockoperation.WsdlMockResponsePanelBuilder;
034: import com.eviware.soapui.impl.wsdl.panels.operation.WsdlOperationPanelBuilder;
035: import com.eviware.soapui.impl.wsdl.panels.project.WsdlProjectPanelBuilder;
036: import com.eviware.soapui.impl.wsdl.panels.request.WsdlRequestPanelBuilder;
037: import com.eviware.soapui.impl.wsdl.panels.testcase.WsdlTestCasePanelBuilder;
038: import com.eviware.soapui.impl.wsdl.panels.teststeps.DelayTestStepPanelBuilder;
039: import com.eviware.soapui.impl.wsdl.panels.teststeps.GotoStepPanelBuilder;
040: import com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepPanelBuilder;
041: import com.eviware.soapui.impl.wsdl.panels.teststeps.PropertiesStepPanelBuilder;
042: import com.eviware.soapui.impl.wsdl.panels.teststeps.TransferResponseValuesTestStepPanelBuilder;
043: import com.eviware.soapui.impl.wsdl.panels.teststeps.WsdlTestRequestPanelBuilder;
044: import com.eviware.soapui.impl.wsdl.panels.testsuite.WsdlTestSuitePanelBuilder;
045: import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
046: import com.eviware.soapui.impl.wsdl.teststeps.TransferResponseValuesTestStep;
047: import com.eviware.soapui.impl.wsdl.teststeps.WsdlDelayTestStep;
048: import com.eviware.soapui.impl.wsdl.teststeps.WsdlGotoTestStep;
049: import com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep;
050: import com.eviware.soapui.impl.wsdl.teststeps.WsdlPropertiesTestStep;
051: import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep;
052: import com.eviware.soapui.model.ModelItem;
053: import com.eviware.soapui.model.PanelBuilder;
054:
055: /**
056: * Registry of PanelBuilders
057: *
058: * @author ole.matzura
059: */
060:
061: public class PanelBuilderRegistry {
062: private static Map<Class<? extends ModelItem>, PanelBuilder<? extends ModelItem>> builders = new HashMap<Class<? extends ModelItem>, PanelBuilder<? extends ModelItem>>();
063:
064: @SuppressWarnings("unchecked")
065: public static <T extends ModelItem> PanelBuilder<T> getPanelBuilder(
066: T modelItem) {
067: return (PanelBuilder<T>) builders.get(modelItem.getClass());
068: }
069:
070: public static <T extends ModelItem> void register(
071: Class<T> modelItemClass, PanelBuilder<T> panelBuilder) {
072: builders.put(modelItemClass, panelBuilder);
073: }
074:
075: static {
076: register(WorkspaceImpl.class, new WorkspaceImplPanelBuilder());
077: register(WsdlProject.class, new WsdlProjectPanelBuilder());
078: register(WsdlInterface.class, new WsdlInterfacePanelBuilder());
079: register(WsdlOperation.class, new WsdlOperationPanelBuilder());
080: register(WsdlRequest.class, new WsdlRequestPanelBuilder());
081: register(WsdlTestSuite.class, new WsdlTestSuitePanelBuilder());
082: register(WsdlTestCase.class, new WsdlTestCasePanelBuilder());
083: register(WsdlLoadTest.class, new WsdlLoadTestPanelBuilder());
084: register(WsdlMockService.class,
085: new WsdlMockServicePanelBuilder());
086: register(WsdlMockOperation.class,
087: new WsdlMockOperationPanelBuilder());
088: register(WsdlMockResponse.class,
089: new WsdlMockResponsePanelBuilder());
090: register(WsdlGotoTestStep.class, new GotoStepPanelBuilder());
091: register(WsdlDelayTestStep.class,
092: new DelayTestStepPanelBuilder());
093: register(WsdlTestRequestStep.class,
094: new WsdlTestRequestPanelBuilder());
095: register(WsdlPropertiesTestStep.class,
096: new PropertiesStepPanelBuilder());
097: register(WsdlGroovyScriptTestStep.class,
098: new GroovyScriptStepPanelBuilder());
099: register(TransferResponseValuesTestStep.class,
100: new TransferResponseValuesTestStepPanelBuilder());
101: }
102: }
|