1 package com.proalpha.pds.templates.controller;
3 import com.openedge.pdt.core.template.TemplateGenerationException;
4 import com.proalpha.pds.templates.jet.IpaTemplateGenerator;
8 import org.eclipse.core.runtime.Platform;
9 import org.osgi.framework.Bundle;
10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory;
15 private static final Logger logger = LoggerFactory.getLogger(
pAGenerateCode.class);
16 private static final String COM_PROALPHA_PDS_TEMPLATES =
"com.proalpha.pds.templates";
17 private static final String JET_FOLDER =
"jet.trunk";
19 private boolean classloaded =
false;
21 private String templatename;
24 this.templatename = templatename;
28 public void setTemplateGenerator() {
32 Bundle bundle = Platform.getBundle(COM_PROALPHA_PDS_TEMPLATES);
33 templatepath = COM_PROALPHA_PDS_TEMPLATES +
"." + JET_FOLDER +
"." + this.templatename;
34 logger.debug(
"Templatepath is: {}", templatepath);
36 Class<?> templateClass = bundle.loadClass(templatepath);
40 }
catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
41 logger.error(e.getMessage(), e);
46 public String generateFile(Map<String, Object> wizardSettings) {
49 this.setTemplateGenerator();
53 return this.
template.generate(wizardSettings);
54 }
catch (TemplateGenerationException e) {
55 logger.error(e.getMessage(), e);