/** * The server plugin needs all models to be either merged on annotation-based. * Currently only the web model does a bit of merging, other models don't. So * for web we actually need two models (one for the server plugins and another * for everyone else). Temporary solution until merging is implemented * in all models. */ public synchronized MetadataModel<WebAppMetadata> getAnnotationMetadataModel() { if (webAppAnnMetadataModel == null) { FileObject ddFO = getDeploymentDescriptor(); File ddFile = ddFO != null ? FileUtil.toFile(ddFO) : null; MetadataUnit metadataUnit = MetadataUnit.create( cpProvider.getProjectSourcesClassPath(ClassPath.BOOT), cpProvider.getProjectSourcesClassPath(ClassPath.COMPILE), cpProvider.getProjectSourcesClassPath(ClassPath.SOURCE), // XXX: add listening on deplymentDescriptor ddFile); webAppAnnMetadataModel = WebAppMetadataModelFactory.createMetadataModel(metadataUnit, false); } return webAppAnnMetadataModel; }
public synchronized MetadataModel<WebAppMetadata> getMetadataModel() { if (webAppMetadataModel == null) { FileObject ddFO = getDeploymentDescriptor(); final FileObject webInf = getWebInf(true); if (ddFO == null && webInf != null) { webInf.addFileChangeListener(new FileChangeAdapter() { @Override public void fileDataCreated(FileEvent fe) { if (FILE_DD.equals(fe.getFile().getNameExt())) { webInf.removeFileChangeListener(this); resetMetadataModel(); } } }); } File ddFile = ddFO != null ? FileUtil.toFile(ddFO) : null; MetadataUnit metadataUnit = MetadataUnit.create( cpProvider.getProjectSourcesClassPath(ClassPath.BOOT), cpProvider.getProjectSourcesClassPath(ClassPath.COMPILE), cpProvider.getProjectSourcesClassPath(ClassPath.SOURCE), ddFile); webAppMetadataModel = WebAppMetadataModelFactory.createMetadataModel(metadataUnit, true); } return webAppMetadataModel; }