// GeneratorException message if any
StringBuffer generatorExceptionMsg = null;
try {
CMPGenerator gen = new JDOCodeGenerator();
// stubs dir for the current deployment (generated/ejb)
File stubsDir = ctx.getScratchDir("ejb"); //NOI18N
application = ctx.getModuleMetaData(Application.class);
if (_logger.isLoggable(Logger.FINE)) {
_logger.fine( "cmpc.processing_cmp", //NOI18N
application.getRegistrationName());
}
List<File> cmpFiles = new ArrayList<File>();
final ClassLoader jcl = application.getClassLoader();
bundle = ctx.getModuleMetaData(EjbBundleDescriptorImpl.class);
// This gives the dir where application is exploded
String archiveUri = ctx.getSource().getURI().getSchemeSpecificPart();
if (_logger.isLoggable(Logger.FINE)) {
_logger.fine("[CMPC] Module Dir name is " //NOI18N
+ archiveUri);
}
// xml dir for the current deployment (generated/xml)
String generatedXmlsPath = ctx.getScratchDir("xml").getCanonicalPath();
if (_logger.isLoggable(Logger.FINE)) {
_logger.fine("[CMPC] Generated XML Dir name is " //NOI18N
+ generatedXmlsPath);
}
try {
long start = System.currentTimeMillis();
gen.init(bundle, ctx, archiveUri, generatedXmlsPath);
Iterator ejbs=bundle.getEjbs().iterator();
while ( ejbs.hasNext() ) {
EjbDescriptor desc = (EjbDescriptor) ejbs.next();
beanName = desc.getName();
if (_logger.isLoggable(Logger.FINE)) {
_logger.fine("[CMPC] Ejb Class Name: " //NOI18N
+ desc.getEjbClassName());
}
if ( desc instanceof IASEjbCMPEntityDescriptor) {
// generate concrete CMP class implementation
IASEjbCMPEntityDescriptor entd =
(IASEjbCMPEntityDescriptor)desc;
if (_logger.isLoggable(Logger.FINE)) {
_logger.fine(
"[CMPC] Home Object Impl name is " //NOI18N
+ entd.getLocalHomeImplClassName());
}
// The classloader needs to be set else we fail down the road.
ClassLoader ocl = entd.getClassLoader();
entd.setClassLoader(jcl);
try {
gen.generate(entd, stubsDir, stubsDir);
} catch (GeneratorException e) {
String msg = e.getMessage();
_logger.warning(msg);
generatorExceptionMsg = addGeneratorExceptionMessage(
msg, generatorExceptionMsg);
} finally {
entd.setClassLoader(ocl);
}
/* WARNING: IASRI 4683195
* JDO Code failed when there was a relationship involved
* because it depends upon the orginal ejbclasname and hence
* this code is shifted to just before the Remote Impl is
* generated.Remote/Home Impl generation depends upon this
* value
*/
}
} // end while ejbs.hasNext()
beanName = null;
cmpFiles.addAll(gen.cleanup());
long end = System.currentTimeMillis();
_logger.fine("CMP Generation: " + (end - start) + " msec");
} catch (GeneratorException e) {