use of com.sun.jdo.api.persistence.enhancer.generator.Main in project Payara by payara.
the class JDOCodeGenerator method generatePC.
/**
* Generate PC class for the ConcreteImpl bean.
* @see CMPGenerator#generate(IASEjbCMPEntityDescriptor, File, File)
*/
private Collection<File> generatePC(IASEjbCMPEntityDescriptor ejbcmp, File srcout, File classout) throws IOException {
ArrayList<File> fileList = new ArrayList<File>();
Main gen = new Main(ejbModel, srcout);
String className = nameMapper.getPersistenceClassForEjbName(ejbcmp.getName());
if (className != null) {
// generate PC class
// @olsen, 4653156: the enhancer-generator deals with class names
// in JVM format, i.e., with '/' for '.' as separator
String jvmClassName = className.replace('.', '/');
File file = gen.generate(jvmClassName);
fileList.add(file);
// write mapping file
MappingClassElement mappingClass = model.getMappingClass(className);
BufferedOutputStream mapOut = null;
try {
String mapPath = className.replace('.', File.separatorChar);
String mappingFile = mapPath + MAPPING_EXTENSION;
mapOut = new BufferedOutputStream(new FileOutputStream(new File(classout, mappingFile)));
// "touch" need to create the output stream first since the
// classout directory is not in the classpath and
// therefore the standard storeMappingClass can't be used
model.storeMappingClass(mappingClass, mapOut);
} finally {
if (mapOut != null) {
try {
mapOut.close();
} catch (Exception ex) {
if (logger.isLoggable(Logger.FINE))
logger.fine(ex.getMessage());
}
}
}
}
return fileList;
}
Aggregations