Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Struckmann2014-10-20 10:37:26 +0000
committerSebastian Struckmann2014-10-20 10:37:26 +0000
commit4ce8d6a3cc2b591885c9d1f7155ae93decf97f2a (patch)
tree844b01d2223a63ab4d45b51742515bdd7a550791 /org.eclipse.jubula.toolkit.api.gen
parentd82c5d8749af18e3cfe58b5a2c8393744ee229e1 (diff)
downloadorg.eclipse.jubula.core-4ce8d6a3cc2b591885c9d1f7155ae93decf97f2a.tar.gz
org.eclipse.jubula.core-4ce8d6a3cc2b591885c9d1f7155ae93decf97f2a.tar.xz
org.eclipse.jubula.core-4ce8d6a3cc2b591885c9d1f7155ae93decf97f2a.zip
Sprint task - Java API - Part 2: Major structural refactoring in generation information classes, moved toolkit information classes to internal packages
Diffstat (limited to 'org.eclipse.jubula.toolkit.api.gen')
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/APIGenerator.java53
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/CommonGenInfo.java (renamed from org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/GenerationInfo.java)22
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/CompInfoForFactoryGen.java (renamed from org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/FactoryGenInfo.java)10
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/CompInfoForToolkitGen.java (renamed from org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ToolkitGenInfo.java)6
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/ComponentGenInfo.java (renamed from org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ComponentGenInfo.java)5
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/FactoryGenInfo.java61
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/ToolkitGenInfo.java31
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/utils/ConfigLoader.java (renamed from org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ConfigLoader.java)2
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/utils/NameLoader.java (renamed from org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/NameLoader.java)23
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet12
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet35
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet18
12 files changed, 204 insertions, 74 deletions
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/APIGenerator.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/APIGenerator.java
index a7542c7dd..6a3c8f000 100644
--- a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/APIGenerator.java
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/APIGenerator.java
@@ -14,7 +14,6 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.MessageFormat;
-import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.FileUtils;
@@ -22,6 +21,13 @@ import org.apache.commons.io.IOUtils;
import org.eclipse.jubula.toolkit.api.gen.ClassGenerator;
import org.eclipse.jubula.toolkit.api.gen.FactoryGenerator;
import org.eclipse.jubula.toolkit.api.gen.ToolkitInfoGenerator;
+import org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CompInfoForFactoryGen;
+import org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CompInfoForToolkitGen;
+import org.eclipse.jubula.toolkit.api.gen.internal.genmodel.ComponentGenInfo;
+import org.eclipse.jubula.toolkit.api.gen.internal.genmodel.FactoryGenInfo;
+import org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CommonGenInfo;
+import org.eclipse.jubula.toolkit.api.gen.internal.genmodel.ToolkitGenInfo;
+import org.eclipse.jubula.toolkit.api.gen.internal.utils.ConfigLoader;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
import org.eclipse.jubula.tools.internal.utils.generator.CompSystemProcessor;
import org.eclipse.jubula.tools.internal.utils.generator.ComponentInfo;
@@ -50,15 +56,13 @@ public class APIGenerator {
private static ToolkitInfoGenerator toolkitInfoGenerator =
new ToolkitInfoGenerator();
- /** list containing all components with information for factory generation.
+ /** containing information for factory generation.
* will be reseted for each toolkit */
- private static List<FactoryGenInfo> factoryGenInfoList =
- new ArrayList<FactoryGenInfo>();
-
- /** list containing all components with information for toolkit information generation.
+ private static FactoryGenInfo factoryGenInfo;
+
+ /** containing information for toolkit information generation.
* will be reseted for each toolkit */
- private static List<ToolkitGenInfo> toolkitGenInfoList =
- new ArrayList<ToolkitGenInfo>();
+ private static ToolkitGenInfo tookitGenInfo;
/** whether a class containing information about a toolkit needs to be generated */
private static boolean toolkitNeedsInfoClass = false;
@@ -89,8 +93,8 @@ public class APIGenerator {
// Generate classes and interfaces toolkit by toolkit
for (ToolkitInfo tkInfo : toolkitInfos) {
- factoryGenInfoList.clear();
- toolkitGenInfoList.clear();
+ factoryGenInfo = new FactoryGenInfo();
+ tookitGenInfo = new ToolkitGenInfo();
toolkitNeedsInfoClass = false;
List<ComponentInfo> compInfos = processor.getCompInfos(
tkInfo.getType(), tkInfo.getShortType(), false);
@@ -105,14 +109,17 @@ public class APIGenerator {
CompSystem compSystem = processor.getCompSystem();
ToolkitDescriptor toolkitDesriptor = compSystem
.getToolkitDescriptor(tkInfo.getType());
- GenerationInfo factoryGenInfo =
- new GenerationInfo(toolkitDesriptor, true);
- createFactory(factoryGenInfo, generationBaseDir);
+ CommonGenInfo genInfoForFactory =
+ new CommonGenInfo(toolkitDesriptor, false);
if (toolkitNeedsInfoClass) {
- GenerationInfo tkGenInfo =
- new GenerationInfo(toolkitDesriptor, false);
- createToolkitInfo(tkGenInfo, generationBaseDir);
+ CommonGenInfo genInfoForToolkit =
+ new CommonGenInfo(toolkitDesriptor, true);
+ createToolkitInfo(genInfoForToolkit, generationBaseDir);
+ factoryGenInfo.setToolkitInfoName(
+ genInfoForToolkit.getClassName(),
+ genInfoForToolkit.getFqClassName());
}
+ createFactory(genInfoForFactory, generationBaseDir);
}
}
@@ -160,7 +167,7 @@ public class APIGenerator {
*/
private static void createClass(Component component,
String generationBaseDirTemplate, Boolean generateInterface) {
- GenerationInfo genInfo = new GenerationInfo(component);
+ CommonGenInfo genInfo = new CommonGenInfo(component);
ComponentGenInfo compInfo = new ComponentGenInfo(component,
generateInterface, genInfo.getToolkitName(),
genInfo.getClassName());
@@ -194,13 +201,13 @@ public class APIGenerator {
}
}
- factoryGenInfoList.add(new FactoryGenInfo(
+ factoryGenInfo.addCompInformation(new CompInfoForFactoryGen(
genInfo.getClassName(),
genInfo.getFqClassName(),
compInfo.hasDefaultMapping(),
compInfo.getMostSpecificVisibleSuperTypeName()));
- toolkitGenInfoList.add(new ToolkitGenInfo(
+ tookitGenInfo.addCompInformation(new CompInfoForToolkitGen(
componentClass, testerClass));
}
}
@@ -210,9 +217,9 @@ public class APIGenerator {
* @param tkGenInfo the generation information for the toolkit
* @param generationBaseDirTemplate directory for generation
*/
- private static void createFactory(GenerationInfo tkGenInfo,
+ private static void createFactory(CommonGenInfo tkGenInfo,
String generationBaseDirTemplate) {
- tkGenInfo.setSpecificInformation(factoryGenInfoList);
+ tkGenInfo.setSpecificInformation(factoryGenInfo);
String path = tkGenInfo.getClassDirectoryPath();
String className = tkGenInfo.getClassName();
String generationBaseDir = MessageFormat.format(
@@ -230,9 +237,9 @@ public class APIGenerator {
* @param tkGenInfo the generation information for the toolkit
* @param generationBaseDirTemplate directory for generation
*/
- private static void createToolkitInfo(GenerationInfo tkGenInfo,
+ private static void createToolkitInfo(CommonGenInfo tkGenInfo,
String generationBaseDirTemplate) {
- tkGenInfo.setSpecificInformation(toolkitGenInfoList);
+ tkGenInfo.setSpecificInformation(tookitGenInfo);
String path = tkGenInfo.getClassDirectoryPath();
String className = tkGenInfo.getClassName();
String generationBaseDir = MessageFormat.format(
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/GenerationInfo.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/CommonGenInfo.java
index 16e001b33..cc68f0117 100644
--- a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/GenerationInfo.java
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/CommonGenInfo.java
@@ -1,5 +1,6 @@
-package org.eclipse.jubula.toolkit.api.gen.internal;
+package org.eclipse.jubula.toolkit.api.gen.internal.genmodel;
+import org.eclipse.jubula.toolkit.api.gen.internal.utils.NameLoader;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
import org.eclipse.jubula.tools.internal.xml.businessmodell.Component;
import org.eclipse.jubula.tools.internal.xml.businessmodell.ToolkitDescriptor;
@@ -8,7 +9,7 @@ import org.eclipse.jubula.tools.internal.xml.businessmodell.ToolkitDescriptor;
* Contains all necessary information for API generation of a component
* @author BREDEX GmbH
*/
-public class GenerationInfo {
+public class CommonGenInfo {
/** the class name */
private String m_className;
@@ -33,7 +34,7 @@ public class GenerationInfo {
* Supposed to be used for class/interface generation.
* @param component the component
*/
- public GenerationInfo(Component component) {
+ public CommonGenInfo(Component component) {
NameLoader nameLoader = NameLoader.getInstance();
ToolkitDescriptor toolkitDesriptor = component.getToolkitDesriptor();
m_toolkitName = nameLoader.getToolkitName(toolkitDesriptor);
@@ -56,19 +57,20 @@ public class GenerationInfo {
* Contains all necessary information for API generation of a component
* Supposed to be used for toolkit info or factory generation
* @param tkDescriptor the toolkit descriptor
- * @param genFactory whether generation info is for creating factories
+ * @param genToolkitInfo whether generation info is for creating toolkit information
*/
- public GenerationInfo(ToolkitDescriptor tkDescriptor,
- boolean genFactory) {
+ public CommonGenInfo(ToolkitDescriptor tkDescriptor,
+ boolean genToolkitInfo) {
NameLoader nameLoader = NameLoader.getInstance();
m_toolkitName = nameLoader.getToolkitName(tkDescriptor);
- if (genFactory) {
- m_className = nameLoader.getFactoryName(m_toolkitName);
- } else {
+ if (genToolkitInfo) {
m_className = nameLoader.getToolkitComponentClassName(
m_toolkitName);
+ } else {
+ m_className = nameLoader.getFactoryName(m_toolkitName);
}
- m_classPackageName = nameLoader.getToolkitPackageName(m_toolkitName);
+ m_classPackageName = nameLoader.getToolkitPackageName(m_toolkitName,
+ genToolkitInfo);
m_toolkitID = tkDescriptor.getToolkitID();
m_classDirectoryPath = m_classPackageName
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/FactoryGenInfo.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/CompInfoForFactoryGen.java
index d75fc5d7e..4cdac059d 100644
--- a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/FactoryGenInfo.java
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/CompInfoForFactoryGen.java
@@ -1,12 +1,13 @@
-package org.eclipse.jubula.toolkit.api.gen.internal;
+package org.eclipse.jubula.toolkit.api.gen.internal.genmodel;
/**
* Contains all necessary information of a component for factory generation
* @author BREDEX GmbH
+ * @created 20.10.2014
*/
-public class FactoryGenInfo {
+public class CompInfoForFactoryGen {
/** the class name */
private String m_fqClassName;
@@ -16,7 +17,7 @@ public class FactoryGenInfo {
/** name of the component */
private String m_componentName;
-
+
/** the most specific visible super type of a component */
private String m_mostSpecificVisibleSuperTypeName;
@@ -27,7 +28,7 @@ public class FactoryGenInfo {
* @param hasDefaultMapping true if and only if component has default mapping
* @param mostSpecificVisibleSuperTypeName most specific visible super type of a component
*/
- public FactoryGenInfo(String componentName, String fqClassName,
+ public CompInfoForFactoryGen(String componentName, String fqClassName,
boolean hasDefaultMapping,
String mostSpecificVisibleSuperTypeName) {
m_componentName = componentName;
@@ -52,7 +53,6 @@ public class FactoryGenInfo {
return m_componentName;
}
-
/**
* Returns true if and only if component has a default mapping
* @return the toolkit name
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ToolkitGenInfo.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/CompInfoForToolkitGen.java
index 2846ffa39..279bd2ef6 100644
--- a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ToolkitGenInfo.java
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/CompInfoForToolkitGen.java
@@ -1,4 +1,4 @@
-package org.eclipse.jubula.toolkit.api.gen.internal;
+package org.eclipse.jubula.toolkit.api.gen.internal.genmodel;
import org.eclipse.jubula.tools.internal.xml.businessmodell.ComponentClass;
@@ -7,7 +7,7 @@ import org.eclipse.jubula.tools.internal.xml.businessmodell.ComponentClass;
* Contains all necessary information of a component for toolkit info generation
* @author BREDEX GmbH
*/
-public class ToolkitGenInfo {
+public class CompInfoForToolkitGen {
/** the most specific visible super type of a component */
private ComponentClass m_componentClass;
@@ -20,7 +20,7 @@ public class ToolkitGenInfo {
* @param componentClass the component class
* @param testerClass the tester class
*/
- public ToolkitGenInfo(ComponentClass componentClass,
+ public CompInfoForToolkitGen(ComponentClass componentClass,
String testerClass) {
m_componentClass = componentClass;
m_testerClass = testerClass;
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ComponentGenInfo.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/ComponentGenInfo.java
index bf063f101..fb823b204 100644
--- a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/ComponentGenInfo.java
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/ComponentGenInfo.java
@@ -1,5 +1,6 @@
-package org.eclipse.jubula.toolkit.api.gen.internal;
+package org.eclipse.jubula.toolkit.api.gen.internal.genmodel;
+import org.eclipse.jubula.toolkit.api.gen.internal.utils.NameLoader;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
import org.eclipse.jubula.tools.internal.xml.businessmodell.Component;
import org.eclipse.jubula.tools.internal.xml.businessmodell.ConcreteComponent;
@@ -145,7 +146,7 @@ public class ComponentGenInfo {
while (tmp != null && !tmp.isVisible()) {
tmp = tmp.getRealized().get(0);
}
- GenerationInfo visibleSuperType = new GenerationInfo(tmp);
+ CommonGenInfo visibleSuperType = new CommonGenInfo(tmp);
ComponentGenInfo specificInformation = new ComponentGenInfo(tmp, true,
visibleSuperType.getToolkitName(),
visibleSuperType.getClassName());
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/FactoryGenInfo.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/FactoryGenInfo.java
new file mode 100644
index 000000000..345cefc40
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/FactoryGenInfo.java
@@ -0,0 +1,61 @@
+package org.eclipse.jubula.toolkit.api.gen.internal.genmodel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Contains all necessary information for factory generation
+ * @author BREDEX GmbH
+ * @created 17.10.2014
+ */
+public class FactoryGenInfo {
+
+ /** name of the component */
+ private String m_toolkitInfoName;
+
+ /** name of the component */
+ private String m_toolkitInfoFqName;
+
+ /** list with component infos */
+ private List<CompInfoForFactoryGen> m_compInfoList =
+ new ArrayList<CompInfoForFactoryGen>();
+
+ /**
+ * @return list with component infos
+ */
+ public List<CompInfoForFactoryGen> getCompInformation() {
+ return m_compInfoList;
+ }
+
+ /**
+ * adds a component information to the list
+ * @param compInfo the comp info
+ */
+ public void addCompInformation (CompInfoForFactoryGen compInfo) {
+ m_compInfoList.add(compInfo);
+ }
+
+ /**
+ * @return the name of the toolkit information class
+ */
+ public String getToolkitInfoName() {
+ return m_toolkitInfoName;
+ }
+
+ /**
+ * @return the fully qualified name of the toolkit information class
+ */
+ public String getToolkitInfoFqName() {
+ return m_toolkitInfoFqName;
+ }
+
+ /**
+ * @param tkInfoName name of the toolkit information class
+ * @param tkInfoFqName fully qualified name of the toolkit information class
+ */
+ public void setToolkitInfoName(String tkInfoName,
+ String tkInfoFqName) {
+ m_toolkitInfoName = tkInfoName;
+ m_toolkitInfoFqName = tkInfoFqName;
+ }
+}
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/ToolkitGenInfo.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/ToolkitGenInfo.java
new file mode 100644
index 000000000..3c3e0c019
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/genmodel/ToolkitGenInfo.java
@@ -0,0 +1,31 @@
+package org.eclipse.jubula.toolkit.api.gen.internal.genmodel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Contains all necessary information for toolkit information generation
+ * @author BREDEX GmbH
+ * @created 17.10.2014
+ */
+public class ToolkitGenInfo {
+
+ /** list with component infos */
+ private List<CompInfoForToolkitGen> m_compInfoList =
+ new ArrayList<CompInfoForToolkitGen>();
+
+ /**
+ * @return list with component infos
+ */
+ public List<CompInfoForToolkitGen> getCompInformation() {
+ return m_compInfoList;
+ }
+
+ /**
+ * adds a component information to the list
+ * @param compInfo the comp info
+ */
+ public void addCompInformation (CompInfoForToolkitGen compInfo) {
+ m_compInfoList.add(compInfo);
+ }
+}
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/utils/ConfigLoader.java
index 1eee56e1d..2d4aa588e 100644
--- 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/utils/ConfigLoader.java
@@ -8,7 +8,7 @@
* Contributors:
* BREDEX GmbH - initial API and implementation and/or initial documentation
*******************************************************************************/
-package org.eclipse.jubula.toolkit.api.gen.internal;
+package org.eclipse.jubula.toolkit.api.gen.internal.utils;
import java.io.IOException;
import java.net.URL;
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/NameLoader.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/utils/NameLoader.java
index 0466515ea..f0e454a77 100644
--- a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/NameLoader.java
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/utils/NameLoader.java
@@ -8,7 +8,7 @@
* Contributors:
* BREDEX GmbH - initial API and implementation and/or initial documentation
*******************************************************************************/
-package org.eclipse.jubula.toolkit.api.gen.internal;
+package org.eclipse.jubula.toolkit.api.gen.internal.utils;
import java.io.IOException;
import java.net.URL;
@@ -41,6 +41,10 @@ public class NameLoader {
/** package base path */
private static final String PACKAGE_BASE_PATH =
"org.eclipse.jubula.toolkit."; //$NON-NLS-1$
+
+ /** package base path */
+ private static final String INTERNAL =
+ ".internal"; //$NON-NLS-1$
/** specific path for interfaces */
private static final String PACKAGE_SPECIFIC_INTERFACE =
@@ -52,7 +56,7 @@ public class NameLoader {
/** specific path for implementation classes */
private static final String FACTORY_NAME_EXTENSION =
- "ComponentFactory"; //$NON-NLS-1$
+ "Components"; //$NON-NLS-1$
/** specific path for implementation classes */
private static final String TOOLKITINFO_NAME_EXTENSION =
@@ -145,7 +149,8 @@ public class NameLoader {
* @return the name extension of the api package name for the component
*/
public String getClassPackageName(String toolkitName) {
- return getToolkitPackageName(toolkitName) + PACKAGE_SPECIFIC_IMPLCLASS;
+ return getToolkitPackageName(toolkitName, false)
+ + PACKAGE_SPECIFIC_IMPLCLASS;
}
/**
@@ -153,15 +158,21 @@ public class NameLoader {
* @return the name extension of the api package name for the component
*/
public String getInterfacePackageName(String toolkitName) {
- return getToolkitPackageName(toolkitName) + PACKAGE_SPECIFIC_INTERFACE;
+ return getToolkitPackageName(toolkitName, false)
+ + PACKAGE_SPECIFIC_INTERFACE;
}
/**
* @param toolkitName the toolkit name
+ * @param internal whether the package should be internal
* @return the toolkit package base name
*/
- public String getToolkitPackageName(String toolkitName) {
- return PACKAGE_BASE_PATH + toolkitName;
+ public String getToolkitPackageName(String toolkitName, boolean internal) {
+ String basePackageName = PACKAGE_BASE_PATH + toolkitName;
+ if (internal) {
+ basePackageName += INTERNAL;
+ }
+ return basePackageName;
}
/**
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet
index f29fa85dc..0fe02eb38 100644
--- a/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet
+++ b/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet
@@ -1,9 +1,9 @@
<%@ jet
package="org.eclipse.jubula.toolkit.api.gen"
imports="java.util.*
- org.eclipse.jubula.toolkit.api.gen.internal.ComponentGenInfo
- org.eclipse.jubula.toolkit.api.gen.internal.GenerationInfo
- org.eclipse.jubula.toolkit.api.gen.internal.NameLoader
+ org.eclipse.jubula.toolkit.api.gen.internal.genmodel.ComponentGenInfo
+ org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CommonGenInfo
+ org.eclipse.jubula.toolkit.api.gen.internal.utils.NameLoader
org.eclipse.jubula.toolkit.enums.LiteralProvider
org.eclipse.jubula.tools.internal.xml.businessmodell.Action
org.eclipse.jubula.tools.internal.xml.businessmodell.Component
@@ -11,7 +11,7 @@ imports="java.util.*
org.eclipse.jubula.tools.internal.xml.businessmodell.Param"
class="ClassGenerator"%>
<%
-GenerationInfo genInfo = (GenerationInfo)argument;
+CommonGenInfo genInfo = (CommonGenInfo)argument;
Object specInfo = genInfo.getSpecificInformation();
if (specInfo instanceof ComponentGenInfo) {
ComponentGenInfo compGenInfo = (ComponentGenInfo) specInfo;
@@ -34,12 +34,12 @@ if (specInfo instanceof ComponentGenInfo) {
Component realizedComponent = realized.size() > 0 ? realized.get(0) : null;
Boolean hasRealizedType = (realizedComponent != null);
String realizedType = null;
- GenerationInfo superInfo = null;
+ CommonGenInfo superInfo = null;
List<Action> superActions = null;
String realizedTypeFqn = null;
if (hasRealizedType) {
realizedType = realizedComponent.getType();
- superInfo = new GenerationInfo(realizedComponent);
+ superInfo = new CommonGenInfo(realizedComponent);
superActions = realizedComponent.getActions();
if (genInterface) {
ComponentGenInfo superCompGenInfo = new ComponentGenInfo(
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet
index 1018a7a0a..4104db5bd 100644
--- a/org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet
+++ b/org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet
@@ -1,16 +1,20 @@
<%@ jet
package="org.eclipse.jubula.toolkit.api.gen"
imports="java.util.*
- org.eclipse.jubula.toolkit.api.gen.internal.FactoryGenInfo
- org.eclipse.jubula.toolkit.api.gen.internal.GenerationInfo"
+ org.eclipse.jubula.toolkit.api.gen.internal.genmodel.FactoryGenInfo
+ org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CompInfoForFactoryGen
+ org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CommonGenInfo"
class="FactoryGenerator"%>
<%
-GenerationInfo genInfo = (GenerationInfo)argument;
+CommonGenInfo genInfo = (CommonGenInfo)argument;
String factoryName = genInfo.getClassName();
String packageName = genInfo.getClassPackageName();
Object specInfo = genInfo.getSpecificInformation();
-if (specInfo instanceof List) {
- List<FactoryGenInfo> factoryInfoList = (List<FactoryGenInfo>) specInfo;
+if (specInfo instanceof FactoryGenInfo) {
+ FactoryGenInfo factoryInfo = (FactoryGenInfo) specInfo;
+ List<CompInfoForFactoryGen> compInfoList = factoryInfo.getCompInformation();
+ String toolkitInfoName = factoryInfo.getToolkitInfoName();
+ String toolkitInfoFqName = factoryInfo.getToolkitInfoFqName();
%>
/*******************************************************************************
* Copyright (c) 2014 BREDEX GmbH.
@@ -25,6 +29,9 @@ if (specInfo instanceof List) {
package <%=packageName%>;
import org.eclipse.jubula.tools.ComponentIdentifier;
+import org.eclipse.jubula.toolkit.ToolkitInfo;
+
+<%if (toolkitInfoFqName != null) {%>import <%=toolkitInfoFqName%>;<%}%>
/**
* Generated factory for creating components from the <%=genInfo.getToolkitName()%> toolkit.
@@ -32,15 +39,23 @@ import org.eclipse.jubula.tools.ComponentIdentifier;
*/
public final class <%=factoryName%> {
+ private static ToolkitInfo m_toolkitInformation =
+ <%if (toolkitInfoName != null) {%>new <%=toolkitInfoName%>();
+ <%} else {%>null;<%}%>
+
private <%=factoryName%>() {
super();
}
+
+ public static ToolkitInfo getToolkitInformation() {
+ return m_toolkitInformation;
+ }
-<%for (FactoryGenInfo factoryInfo : factoryInfoList) {
- String componentName = factoryInfo.getComponentName();
- String implClassName = factoryInfo.getClassName();
- String returnType = factoryInfo.getMostSpecificVisibleSuperTypeName();
- Boolean hasDefaultMapping = factoryInfo.hasDefaultMapping();%>
+<%for (CompInfoForFactoryGen compInfo : compInfoList) {
+ String componentName = compInfo.getComponentName();
+ String implClassName = compInfo.getClassName();
+ String returnType = compInfo.getMostSpecificVisibleSuperTypeName();
+ Boolean hasDefaultMapping = compInfo.hasDefaultMapping();%>
<%if (hasDefaultMapping) {%>
public static <%=returnType%> create<%=componentName%> () {
return new <%=implClassName%>();
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet
index 06bd24b38..5a611ca5b 100644
--- a/org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet
+++ b/org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet
@@ -1,18 +1,20 @@
<%@ jet
package="org.eclipse.jubula.toolkit.api.gen"
imports="java.util.*
- org.eclipse.jubula.toolkit.api.gen.internal.ToolkitGenInfo
- org.eclipse.jubula.toolkit.api.gen.internal.GenerationInfo
+ org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CompInfoForToolkitGen
+ org.eclipse.jubula.toolkit.api.gen.internal.genmodel.CommonGenInfo
+ org.eclipse.jubula.toolkit.api.gen.internal.genmodel.ToolkitGenInfo
org.eclipse.jubula.tools.internal.xml.businessmodell.ComponentClass
org.eclipse.jubula.tools.internal.xml.businessmodell.Property"
class="ToolkitInfoGenerator"%>
<%
-GenerationInfo genInfo = (GenerationInfo)argument;
+CommonGenInfo genInfo = (CommonGenInfo)argument;
String className = genInfo.getClassName();
String packageName = genInfo.getClassPackageName();
Object specInfo = genInfo.getSpecificInformation();
-if (specInfo instanceof List) {
- List<ToolkitGenInfo> toolkitInfoList = (List<ToolkitGenInfo>) specInfo;
+if (specInfo instanceof ToolkitGenInfo) {
+ ToolkitGenInfo toolkitInfo = (ToolkitGenInfo) specInfo;
+ List<CompInfoForToolkitGen> compInfoList = toolkitInfo.getCompInformation();
%>
/*******************************************************************************
* Copyright (c) 2014 BREDEX GmbH.
@@ -47,9 +49,9 @@ public final class <%=className%> extends AbstractToolkitInfo {
*/
public <%=className%>() {
<%int i = 1;%>
- <%for (ToolkitGenInfo toolkitInfo : toolkitInfoList) {
- ComponentClass componentClass = toolkitInfo.getComponentClass();
- String testerClass = toolkitInfo.getTesterClass();
+ <%for (CompInfoForToolkitGen compInfo : compInfoList) {
+ ComponentClass componentClass = compInfo.getComponentClass();
+ String testerClass = compInfo.getTesterClass();
if (componentClass != null && testerClass != null) {%>
ComponentClass newComponentClass<%=i%> = new ComponentClass("<%=componentClass.getName()%>");
<%List properties = componentClass.getProperties();%>

Back to the top