Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jubula.toolkit.api.gen')
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/META-INF/MANIFEST.MF16
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/build.properties3
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/gen.api.xml2
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/generateClasses.xml15
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/pom.xml62
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/resources/apigen.properties18
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/resources/nameMappings.properties9
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/.keep0
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ClassGenerator.java99
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ConfigLoader.java139
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/NameMappingLoader.java81
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/compGen.javajet48
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet71
13 files changed, 477 insertions, 86 deletions
diff --git a/org.eclipse.jubula.toolkit.api.gen/META-INF/MANIFEST.MF b/org.eclipse.jubula.toolkit.api.gen/META-INF/MANIFEST.MF
index 3fb248e9c..b874e95c5 100644
--- a/org.eclipse.jubula.toolkit.api.gen/META-INF/MANIFEST.MF
+++ b/org.eclipse.jubula.toolkit.api.gen/META-INF/MANIFEST.MF
@@ -7,29 +7,19 @@ Bundle-Vendor: Eclipse Jubula
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
-Require-Bundle: org.eclipse.jubula.tools;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.base.api;bundle-version="[2.4.0,2.5.0)",
+Require-Bundle: org.apache.commons.logging;bundle-version="[1.0.0,2.0.0)",
+ org.apache.commons.lang;bundle-version="[2.4.0,3.0.0)",
+ org.eclipse.jubula.tools;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.base.provider;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.common;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.concrete.api;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.concrete.provider;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.html.api;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.html.provider;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.javafx.api;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.javafx.provider;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.mobile.api;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.mobile.ios.api;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.mobile.ios.provider;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.mobile.provider;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.rcp.api;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.rcp.gef.api;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.rcp.gef.provider;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.rcp.provider;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.swing.api;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.swing.provider;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.swt.api;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.swt.provider;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.win.api;bundle-version="[2.4.0,2.5.0)",
- org.eclipse.jubula.toolkit.win.apps.api;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.win.apps.provider;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.toolkit.win.provider;bundle-version="[2.4.0,2.5.0)"
diff --git a/org.eclipse.jubula.toolkit.api.gen/build.properties b/org.eclipse.jubula.toolkit.api.gen/build.properties
index 6c35bc414..000f317bd 100644
--- a/org.eclipse.jubula.toolkit.api.gen/build.properties
+++ b/org.eclipse.jubula.toolkit.api.gen/build.properties
@@ -11,7 +11,8 @@ output.. = bin/
jars.compile.order = .
bin.includes = about.html,\
META-INF/,\
- .
+ .,\
+ resources/
javacSource = 1.7
javacTarget = 1.7
javacErrors.. = -assertIdentifier
diff --git a/org.eclipse.jubula.toolkit.api.gen/gen.api.xml b/org.eclipse.jubula.toolkit.api.gen/gen.api.xml
index c6dcdd57d..a39d0be2c 100644
--- a/org.eclipse.jubula.toolkit.api.gen/gen.api.xml
+++ b/org.eclipse.jubula.toolkit.api.gen/gen.api.xml
@@ -7,7 +7,7 @@
-->
<project name="org.eclipse.jubula.toolkit.base.provider" default="gen">
<target name="gen">
- <emf.JETCompiler templateFile="./templates/compGen.javajet"
+ <emf.JETCompiler templateFile="./templates/componentGenerator.javajet"
sourceDirectory="src-gen"/>
</target>
</project> \ No newline at end of file
diff --git a/org.eclipse.jubula.toolkit.api.gen/generateClasses.xml b/org.eclipse.jubula.toolkit.api.gen/generateClasses.xml
new file mode 100644
index 000000000..008d9f9db
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/generateClasses.xml
@@ -0,0 +1,15 @@
+<project name="generateClasses" default="execute">
+ <property name="lib.dir" value="target" />
+
+ <target name="execute">
+ <java classname="org.eclipse.jubula.toolkit.api.gen.internal.ClassGenerator" failonerror="true">
+ <classpath>
+ <fileset dir="${lib.dir}">
+ <include name="org.eclipse.jubula.toolkit.api*.jar" />
+ <include name="dependent-libs/**/*.jar" />
+ </fileset>
+ </classpath>
+ </java>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/org.eclipse.jubula.toolkit.api.gen/pom.xml b/org.eclipse.jubula.toolkit.api.gen/pom.xml
index 534038727..1db7e2500 100644
--- a/org.eclipse.jubula.toolkit.api.gen/pom.xml
+++ b/org.eclipse.jubula.toolkit.api.gen/pom.xml
@@ -22,28 +22,6 @@
<extensions>true</extensions>
</plugin>
<plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>target-platform-configuration</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <dependency-resolution>
- <extraRequirements>
- <!-- prefer RCP to RAP for compilation -->
- <requirement>
- <type>eclipse-plugin</type>
- <id>org.eclipse.swt</id>
- <versionRange>[3.6,4.0)</versionRange>
- </requirement>
- <requirement>
- <type>eclipse-plugin</type>
- <id>org.eclipse.ui</id>
- <versionRange>[3.6,4.0)</versionRange>
- </requirement>
- </extraRequirements>
- </dependency-resolution>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-eclipserun-plugin</artifactId>
<version>${tycho-version}</version>
@@ -97,7 +75,45 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>lib</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>target/dependent-libs</outputDirectory>
+ <overWriteReleases>true</overWriteReleases>
+ <overWriteSnapshots>false</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <excludeTransitive>false</excludeTransitive>
+ <stripVersion>true</stripVersion>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <id>gen-classes</id>
+ <phase>verify</phase>
+ <configuration>
+ <target>
+ <ant antfile="generateClasses.xml" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
-
+
</project>
diff --git a/org.eclipse.jubula.toolkit.api.gen/resources/apigen.properties b/org.eclipse.jubula.toolkit.api.gen/resources/apigen.properties
new file mode 100644
index 000000000..790944a25
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/resources/apigen.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2014 BREDEX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+# Comma-separated list of toolkits to generate
+api.gen.toolkit.names=base, concrete, swing, swt, rcp, rcp.gef, html, javafx
+api.gen.toolkit.name.scheme=../org.eclipse.jubula.toolkit.{0}.provider
+# name of the xml file used to describe a toolkit
+api.gen.toolkit.xml.conf=resources/xml/ComponentConfiguration.xml
+# name of the (base) file containing the resource bundle for each toolkit
+api.gen.toolkit.resourcebundle.path=src
+# fully-qualified name of resource bundle
+api.gen.toolkit.resourcebundle.fqn=org.eclipse.jubula.toolkit.{0}.provider.I18nStrings
+api.gen.toolkit.output={0}
+api.gen.toolkit.generation.dir=../org.eclipse.jubula.toolkit.base.api/src-gen/org/eclipse/jubula/toolkit/base/internal/
diff --git a/org.eclipse.jubula.toolkit.api.gen/resources/nameMappings.properties b/org.eclipse.jubula.toolkit.api.gen/resources/nameMappings.properties
new file mode 100644
index 000000000..ed2ceb067
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/resources/nameMappings.properties
@@ -0,0 +1,9 @@
+###############################################################################
+# Copyright (c) 2014 BREDEX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+# Comma-separated list of toolkits to generate
+guidancer.datatype.Variable=org.eclipse.jubula.toolkit.api.datatype.Variable
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/.keep b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/.keep
deleted file mode 100644
index e69de29bb..000000000
--- a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/.keep
+++ /dev/null
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ClassGenerator.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ClassGenerator.java
new file mode 100644
index 000000000..f62cf615b
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ClassGenerator.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2014 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.toolkit.api.gen.internal;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.jubula.toolkit.api.gen.ComponentGenerator;
+import org.eclipse.jubula.tools.constants.StringConstants;
+import org.eclipse.jubula.tools.utils.generator.CompSystemProcessor;
+import org.eclipse.jubula.tools.utils.generator.ComponentInfo;
+import org.eclipse.jubula.tools.utils.generator.ToolkitConfig;
+import org.eclipse.jubula.tools.xml.businessmodell.Component;
+
+/**
+ * Generates classes for components from comp system
+ */
+public class ClassGenerator {
+
+ /** component generator */
+ private static ComponentGenerator componentGenerator =
+ new ComponentGenerator();
+
+ /**
+ * Constructor
+ */
+ private ClassGenerator() {
+
+ }
+
+ /**
+ * main
+ * @param args args
+ */
+ public static void main(String[] args) {
+ ConfigLoader loader = ConfigLoader.getInstance();
+ String generationDir = loader.getGenerationDir();
+ ToolkitConfig config = loader.getToolkitConfig();
+ CompSystemProcessor processor = new CompSystemProcessor(config);
+
+ List<ComponentInfo> compInfos = processor.getCompInfos(false);
+ for (ComponentInfo compInfo : compInfos) {
+ createClass(compInfo.getComponent(), generationDir);
+ }
+ }
+
+ /**
+ * creates class for component
+ * @param component the component
+ * @param generationDir directory for generation
+ */
+ private static void createClass(Component component, String generationDir) {
+ NameMappingLoader nameLoader = NameMappingLoader.getInstance();
+ String[] splitName = splitName(component.getType());
+ String path = nameLoader.getDesiredName(splitName[0]
+ .replace(StringConstants.DOT, StringConstants.SLASH));
+ String className = nameLoader.getDesiredName(splitName[1]);
+ File dir = new File(generationDir + path);
+ File file = new File(dir, className + ".java"); //$NON-NLS-1$
+ String content = componentGenerator.generate(component);
+
+ if (!file.exists()) {
+ try {
+ dir.mkdirs();
+ file.createNewFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ try {
+ FileOutputStream fop = new FileOutputStream(file);
+ byte[] contentInBytes = content.getBytes();
+ fop.write(contentInBytes);
+ fop.flush();
+ fop.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * splits the class name of the full qualified name
+ * @param fullQualifiedName the full qualified name
+ * @return the class name
+ */
+ public static String[] splitName(String fullQualifiedName) {
+ return fullQualifiedName.split("\\.(?=[^\\.]+$)"); //$NON-NLS-1$
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ConfigLoader.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ConfigLoader.java
new file mode 100644
index 000000000..9fbd8a33a
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ConfigLoader.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.toolkit.api.gen.internal;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jubula.tools.utils.generator.ToolkitConfig;
+
+
+/**
+ * Loads the configuration for the API generation from the properties file. It
+ * is expected that the properties reside in
+ * <code>resources/apigen.properties</code>.
+ *
+ * @author BREDEX GmbH
+ * @created 16.09.2005
+ * @version $Revision: 12986 $
+ */
+public class ConfigLoader {
+ /**
+ * <code>TOOLKIT_LOCATIONS</code>
+ */
+ private static final String TOOLKIT_NAMES =
+ "api.gen.toolkit.names"; //$NON-NLS-1$
+ /**
+ * <code>RESOURCES_APIGEN_PROPERTIES</code>
+ */
+ private static final String RESOURCES_APIGEN_PROPERTIES =
+ "resources/apigen.properties"; //$NON-NLS-1$
+ /**
+ * <code>XML_FILENAME</code>
+ */
+ private static final String XML_PATH =
+ "api.gen.toolkit.xml.conf"; //$NON-NLS-1$
+ /**
+ * <code>RESOURCE_BUNDLE_FILENAME</code>
+ */
+ private static final String RESOURCE_BUNDLE_PATH =
+ "api.gen.toolkit.resourcebundle.path"; //$NON-NLS-1$
+ /**
+ * <code>RESOURCE_BUNDLE_FQN</code>
+ */
+ private static final String RESOURCE_BUNDLE_FQN =
+ "api.gen.toolkit.resourcebundle.fqn"; //$NON-NLS-1$
+ /**
+ * <code>BASEDIR</code>
+ */
+ private static final String BASEDIR = "api.gen.toolkit.name.scheme"; //$NON-NLS-1$
+ /**
+ * <code>OUTPUTDIR</code>
+ */
+ private static final String OUTPUTDIR = "api.gen.toolkit.output"; //$NON-NLS-1$
+ /**
+ * <code>OUTPUTDIR</code>
+ */
+ private static final String GENERATIONDIR = "api.gen.toolkit.generation.dir"; //$NON-NLS-1$
+ /**
+ * <code>instance</code> the singleton instance
+ */
+ private static ConfigLoader instance = null;
+ /**
+ * toolkit filename and path information
+ */
+ private ToolkitConfig m_toolkitConfig;
+ /**
+ * directory for the generation
+ */
+ private String m_generationDir;
+ /**
+ * The constructor.
+ */
+ private ConfigLoader() {
+ try {
+ URL resourceURL = ConfigLoader.class.getClassLoader()
+ .getResource(RESOURCES_APIGEN_PROPERTIES);
+
+ Properties p = new Properties();
+ p.load(resourceURL.openStream());
+
+ String toolkitIDs = p.getProperty(TOOLKIT_NAMES);
+
+ List<String> toolkitIDList = new ArrayList<String>(
+ Arrays.asList(StringUtils.stripAll(
+ StringUtils.split(toolkitIDs, ','))));
+
+ m_toolkitConfig = new ToolkitConfig(
+ p.getProperty(BASEDIR),
+ p.getProperty(XML_PATH),
+ p.getProperty(RESOURCE_BUNDLE_PATH),
+ p.getProperty(RESOURCE_BUNDLE_FQN),
+ p.getProperty(OUTPUTDIR),
+ toolkitIDList);
+
+ m_generationDir = p.getProperty(GENERATIONDIR);
+
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ /**
+ * @return the singleton instance
+ */
+ public static ConfigLoader getInstance() {
+ if (instance == null) {
+ instance = new ConfigLoader();
+ }
+ return instance;
+ }
+
+ /**
+ *
+ * @return a list of toolkit plugin names
+ */
+ public ToolkitConfig getToolkitConfig() {
+ return m_toolkitConfig;
+ }
+
+ /**
+ * @return the generationDir
+ */
+ public String getGenerationDir() {
+ return m_generationDir;
+ }
+}
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/NameMappingLoader.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/NameMappingLoader.java
new file mode 100644
index 000000000..a025e739e
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/NameMappingLoader.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2014 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.toolkit.api.gen.internal;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+
+/**
+ * Loads the configuration for the API generation from the properties file. It
+ * is expected that the properties reside in
+ * <code>resources/apigen.properties</code>.
+ *
+ * @author BREDEX GmbH
+ * @created 16.09.2005
+ * @version $Revision: 12986 $
+ */
+public class NameMappingLoader {
+ /**
+ * <code>RESOURCES_APIGEN_PROPERTIES</code>
+ */
+ private static final String RESOURCES_NAMEMAPPINGS_PROPERTIES =
+ "resources/nameMappings.properties"; //$NON-NLS-1$
+ /**
+ * <code>instance</code> the singleton instance
+ */
+ private static NameMappingLoader instance = null;
+ /**
+ * the mapping properties
+ */
+ private Properties m_mappingProperties;
+
+ /**
+ * The constructor.
+ */
+ private NameMappingLoader() {
+ try {
+ URL resourceURL = NameMappingLoader.class.getClassLoader()
+ .getResource(RESOURCES_NAMEMAPPINGS_PROPERTIES);
+
+ m_mappingProperties = new Properties();
+ m_mappingProperties.load(resourceURL.openStream());
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ /**
+ * @return the singleton instance
+ */
+ public static NameMappingLoader getInstance() {
+ if (instance == null) {
+ instance = new NameMappingLoader();
+ }
+ return instance;
+ }
+
+ /**
+ * Checks in the name mappings property file whether there is a mapping for a
+ * given string and returns it and if not, returns the original string
+ * @param name original name
+ * @return the name which should be used in api
+ */
+ public String getDesiredName(String name) {
+ String mapEntry = m_mappingProperties.getProperty(name);
+ if (mapEntry != null) {
+ return mapEntry;
+ }
+ String desiredName = name.replace("abstract", "base");
+ return desiredName;
+ }
+}
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/compGen.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/compGen.javajet
deleted file mode 100644
index 84220b517..000000000
--- a/org.eclipse.jubula.toolkit.api.gen/templates/compGen.javajet
+++ /dev/null
@@ -1,48 +0,0 @@
-<%@ jet
-package="org.eclipse.jubula.toolkit.api.gen"
-imports="java.util.*
- org.eclipse.jubula.tools.xml.businessmodell.*"
-class="ComponentGenerator"%>
-<%
- Component component = (Component)argument;
- String name = component.getType();
- List<Action> actions = component.getActions();
- %>
-/**
- * Copyright (c) 2014 BREDEX GmbH.
- * All rights reserved.
- */
-package <%="org.eclipse.jubula.toolkit.base"%>;
-
-public class <%=name%> extends {
- Object m_component;
-
- public <%=name%>(Object component) {
- m_component = component;
- }
- <%
- Iterator<Action> actionsIterator = actions.iterator();
- while (actionsIterator.hasNext()) {
- Action action = actionsIterator.next();
- String actionName = action.getName();
- List<Param> params = action.getParams();
- %>
- public void rc<%=actionName%>(
- <%
- Iterator<Param> paramIterator = params.iterator();
- while (paramIterator.hasNext()) {
- Param param = paramIterator.next();
- String paramType = param.getType();
- String paramName = param.getName();
- %>
- <%=paramType%> <%=paramName%><%if(paramIterator.hasNext()){%>,<%}%>
- <%
- }
- %>
- ) {
-
- }
- <%
- }
- %>
-} \ No newline at end of file
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet
new file mode 100644
index 000000000..49addf3a9
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet
@@ -0,0 +1,71 @@
+<%@ jet
+package="org.eclipse.jubula.toolkit.api.gen"
+imports="java.util.*
+ org.eclipse.jubula.toolkit.api.gen.internal.ClassGenerator
+ org.eclipse.jubula.toolkit.api.gen.internal.NameMappingLoader
+ org.eclipse.jubula.tools.xml.businessmodell.*"
+class="ComponentGenerator"%>
+<%
+ Component component = (Component)argument;
+ NameMappingLoader nameLoader = NameMappingLoader.getInstance();
+ List<Action> actions = component.getActions();
+ String[] splitName = ClassGenerator.splitName(component.getType());
+ String path = nameLoader.getDesiredName(splitName[0]);
+ String name = nameLoader.getDesiredName(splitName[1]);
+ List<String> realizedTypes = component.getRealizedTypes();
+ String realizedType = realizedTypes.size() > 0 ? realizedTypes.get(0) : null;
+ String testerClass = "";
+ if (component instanceof ConcreteComponent) {
+ testerClass = ((ConcreteComponent)component).getTesterClass();
+ }
+ %>
+/*******************************************************************************
+ * Copyright (c) 2014 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package <%="org.eclipse.jubula.toolkit.base.internal." + path%>;
+
+import org.eclipse.jubula.toolkit.base.api.internal.annotations.RealizedType;
+import org.eclipse.jubula.toolkit.base.api.internal.annotations.TesterClass;
+
+@RealizedType(realizedType="<%=realizedType%>")
+@TesterClass(testerClass="<%=testerClass%>")
+public class <%=name%> {
+ Object m_component;
+
+ public <%=name%>(Object component) {
+ m_component = component;
+ }
+ <%
+ Iterator<Action> actionsIterator = actions.iterator();
+ while (actionsIterator.hasNext()) {
+ Action action = actionsIterator.next();
+ String actionName = nameLoader.getDesiredName(action.getMethod());
+ List<Param> params = action.getParams();
+ %>
+ <%if (action.isDeprecated()) {%>@Deprecated<%}%>
+ public void <%=actionName%>(
+ <%
+ Iterator<Param> paramIterator = params.iterator();
+ while (paramIterator.hasNext()) {
+ Param param = paramIterator.next();
+ String paramType = nameLoader.getDesiredName(param.getType());
+ String paramName = nameLoader.getDesiredName(param.getName().replace(".",""));
+ %>
+ <%=paramType%> <%=paramName%><%if(paramIterator.hasNext()){%>,<%}%>
+ <%
+ }
+ %>
+ ) {
+
+ }
+ <%
+ }
+ %>
+} \ No newline at end of file

Back to the top