public Set<DataObject> instantiate(TemplateWizard wizard) throws IOException { String targetName = Templates.getTargetName(wizard); FileObject targetDir = Templates.getTargetFolder(wizard); Project project = Templates.getProject(wizard); boolean useCDI11 = true; if (project != null) { J2eeProjectCapabilities cap = J2eeProjectCapabilities.forProject(project); if (cap != null && !cap.isCdi11Supported()) { useCDI11 = false; } } FileObject fo = DDHelper.createBeansXml( useCDI11 ? Profile.JAVA_EE_7_FULL : Profile.JAVA_EE_6_FULL, targetDir, targetName); if (fo != null) { if ( project != null ){ CdiUtil logger = project.getLookup().lookup( CdiUtil.class ); if (logger != null){ logger.log("USG_CDI_BEANS_WIZARD", BeansXmlIterator.class, new Object[]{project.getClass().getName()}, true); } } return Collections.singleton(DataObject.find(fo)); } else { return Collections.EMPTY_SET; } }