@Override public JSON getDescriptor(ModuleMetaModel metaModel) { JSON json = new JSON(); for (ApplicationMetaModel application : metaModel.getChildren(ApplicationMetaModel.class)) { json.set(application.getHandle().getPackage().toString(), new JSON()); } return json; }
@Override public void postActivate(ModuleMetaModel metaModel) { for (ApplicationMetaModelPlugin plugin : context.getPlugins()) { plugin.postActivate(metaModel); } // context.postActivate(metaModel.processingContext); for (ApplicationMetaModel application : metaModel.getChildren(ApplicationMetaModel.class)) { for (ApplicationMetaModelPlugin plugin : context.getPlugins()) { plugin.postActivate(application); } } }
@Override public void postProcessAnnotations(ModuleMetaModel metaModel) { // Resolve applications for (ApplicationMetaModel application : metaModel.getChildren(ApplicationMetaModel.class)) { if (application.modified) { metaModel.queue(MetaModelEvent.createUpdated(application)); application.modified = false; } } // context.postProcessAnnotations(); }
private void emitConfig(ModuleMetaModel metaModel) { JSON descriptor = new JSON(); // Application configs for (ApplicationMetaModel application : metaModel.getChildren(ApplicationMetaModel.class)) { // metaModel.processingContext.log( "Emitting application " + application.getHandle() + " config"); // Recycle descriptor.clear(); // Emit config for (ApplicationMetaModelPlugin plugin : context.getPlugins()) { JSON pluginDescriptor = plugin.getDescriptor(application); if (pluginDescriptor != null) { descriptor.set(plugin.getName(), pluginDescriptor); } } // Writer writer = null; try { FileObject fo = metaModel.processingContext.createResource( StandardLocation.CLASS_OUTPUT, application.getName(), "config.json"); writer = fo.openWriter(); descriptor.toString(writer, 2); } catch (IOException e) { throw ApplicationMetaModel.CANNOT_WRITE_APPLICATION_CONFIG.failure( e, metaModel.processingContext.get(application.getHandle()), application.getName()); } finally { Tools.safeClose(writer); } } }