Java Code Examples for io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem
The following examples show how to use
io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem.
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: camel-k-runtime Author: apache File: HotDeploymentProcessor.java License: Apache License 2.0 | 6 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> routes() { final Config config = ConfigProvider.getConfig(); final Optional<String> value = config.getOptionalValue(Constants.PROPERTY_CAMEL_K_ROUTES, String.class); List<HotDeploymentWatchedFileBuildItem> items = new ArrayList<>(); if (value.isPresent()) { for (String source : value.get().split(",", -1)) { String path = StringHelper.after(source, ":"); if (path == null) { path = source; } Path p = Paths.get(path); if (Files.exists(p)) { LOGGER.info("Register source for hot deployment: {}", p.toAbsolutePath()); items.add(new HotDeploymentWatchedFileBuildItem(p.toAbsolutePath().toString())); } } } return items; }
Example #2
Source Project: quarkus Author: quarkusio File: QuteProcessor.java License: Apache License 2.0 | 6 votes |
private void scan(Path root, Path directory, String basePath, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths, BuildProducer<TemplatePathBuildItem> templatePaths, BuildProducer<NativeImageResourceBuildItem> nativeImageResources) throws IOException { try (Stream<Path> files = Files.list(directory)) { Iterator<Path> iter = files.iterator(); while (iter.hasNext()) { Path filePath = iter.next(); if (Files.isRegularFile(filePath)) { LOGGER.debugf("Found template: %s", filePath); String templatePath = root.relativize(filePath).toString(); if (File.separatorChar != '/') { templatePath = templatePath.replace(File.separatorChar, '/'); } produceTemplateBuildItems(templatePaths, watchedPaths, nativeImageResources, basePath, templatePath, filePath); } else if (Files.isDirectory(filePath)) { LOGGER.debugf("Scan directory: %s", filePath); scan(root, filePath, basePath, watchedPaths, templatePaths, nativeImageResources); } } } }
Example #3
Source Project: quarkus Author: quarkusio File: UndertowBuildStep.java License: Apache License 2.0 | 6 votes |
/** * Register the undertow-handlers.conf file */ @BuildStep public void registerUndertowHandlersConf(BuildProducer<ServletExtensionBuildItem> producer, ApplicationArchivesBuildItem applicationArchivesBuildItem, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedFile, BuildProducer<NativeImageResourceBuildItem> nativeImageResourceBuildItemBuildProducer) { //we always watch the file, so if it gets added we restart watchedFile.produce( new HotDeploymentWatchedFileBuildItem(UndertowHandlersConfServletExtension.META_INF_UNDERTOW_HANDLERS_CONF)); //check for the file in the handlers dir Path handlerPath = applicationArchivesBuildItem.getRootArchive() .getChildPath(UndertowHandlersConfServletExtension.META_INF_UNDERTOW_HANDLERS_CONF); if (handlerPath != null) { producer.produce(new ServletExtensionBuildItem(new UndertowHandlersConfServletExtension())); nativeImageResourceBuildItemBuildProducer.produce( new NativeImageResourceBuildItem(UndertowHandlersConfServletExtension.META_INF_UNDERTOW_HANDLERS_CONF)); } }
Example #4
Source Project: quarkus Author: quarkusio File: QuteProcessor.java License: Apache License 2.0 | 5 votes |
@BuildStep void collectTemplates(ApplicationArchivesBuildItem applicationArchivesBuildItem, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths, BuildProducer<TemplatePathBuildItem> templatePaths, BuildProducer<NativeImageResourceBuildItem> nativeImageResources) throws IOException { ApplicationArchive applicationArchive = applicationArchivesBuildItem.getRootArchive(); String basePath = "templates"; Path templatesPath = applicationArchive.getChildPath(basePath); if (templatesPath != null) { scan(templatesPath, templatesPath, basePath + "/", watchedPaths, templatePaths, nativeImageResources); } }
Example #5
Source Project: quarkus Author: quarkusio File: QuteProcessor.java License: Apache License 2.0 | 5 votes |
private static void produceTemplateBuildItems(BuildProducer<TemplatePathBuildItem> templatePaths, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths, BuildProducer<NativeImageResourceBuildItem> nativeImageResources, String basePath, String filePath, Path originalPath) { if (filePath.isEmpty()) { return; } String fullPath = basePath + filePath; LOGGER.debugf("Produce template build items [filePath: %s, fullPath: %s, originalPath: %s", filePath, fullPath, originalPath); // NOTE: we cannot just drop the template because a template param can be added watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(fullPath, true)); nativeImageResources.produce(new NativeImageResourceBuildItem(fullPath)); templatePaths.produce(new TemplatePathBuildItem(filePath, originalPath)); }
Example #6
Source Project: quarkus Author: quarkusio File: HibernateOrmProcessor.java License: Apache License 2.0 | 5 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> hotDeploymentWatchedFiles(LaunchModeBuildItem launchMode) { List<HotDeploymentWatchedFileBuildItem> watchedFiles = new ArrayList<>(); if (shouldIgnorePersistenceXmlResources()) { watchedFiles.add(new HotDeploymentWatchedFileBuildItem("META-INF/persistence.xml")); } watchedFiles.add(new HotDeploymentWatchedFileBuildItem(INTEGRATOR_SERVICE_FILE)); getSqlLoadScript(launchMode.getLaunchMode()).ifPresent(script -> { watchedFiles.add(new HotDeploymentWatchedFileBuildItem(script)); }); return watchedFiles; }
Example #7
Source Project: quarkus Author: quarkusio File: SmallRyeOpenApiProcessor.java License: Apache License 2.0 | 5 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> configFiles() { return Stream.of(META_INF_OPENAPI_YAML, WEB_INF_CLASSES_META_INF_OPENAPI_YAML, META_INF_OPENAPI_YML, WEB_INF_CLASSES_META_INF_OPENAPI_YML, META_INF_OPENAPI_JSON, WEB_INF_CLASSES_META_INF_OPENAPI_JSON).map(HotDeploymentWatchedFileBuildItem::new) .collect(Collectors.toList()); }
Example #8
Source Project: quarkus Author: quarkusio File: HotDeploymentConfigFileBuildStep.java License: Apache License 2.0 | 5 votes |
@BuildStep ServiceStartBuildItem setupConfigFileHotDeployment(List<HotDeploymentWatchedFileBuildItem> files) { // TODO: this should really be an output of the RuntimeRunner RuntimeUpdatesProcessor processor = IsolatedDevModeMain.runtimeUpdatesProcessor; if (processor != null) { Map<String, Boolean> watchedFilePaths = files.stream() .collect(Collectors.toMap(HotDeploymentWatchedFileBuildItem::getLocation, HotDeploymentWatchedFileBuildItem::isRestartNeeded)); processor.setWatchedFilePaths(watchedFilePaths); } return null; }
Example #9
Source Project: camel-quarkus Author: apache File: CamelMainHotDeploymentProcessor.java License: Apache License 2.0 | 4 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> xmlRoutes() { return locations("camel.main.xml-routes"); }
Example #10
Source Project: camel-quarkus Author: apache File: CamelMainHotDeploymentProcessor.java License: Apache License 2.0 | 4 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> xmlRests() { return locations("camel.main.xml-rests"); }
Example #11
Source Project: quarkus Author: quarkusio File: HibernateValidatorProcessor.java License: Apache License 2.0 | 4 votes |
@BuildStep HotDeploymentWatchedFileBuildItem configFile() { return new HotDeploymentWatchedFileBuildItem(META_INF_VALIDATION_XML); }
Example #12
Source Project: quarkus Author: quarkusio File: HotDeploymentConfigBuildStep.java License: Apache License 2.0 | 4 votes |
@BuildStep HotDeploymentWatchedFileBuildItem configFile() { return new HotDeploymentWatchedFileBuildItem("META-INF/beans.xml"); }
Example #13
Source Project: quarkus Author: quarkusio File: ConfigYamlProcessor.java License: Apache License 2.0 | 4 votes |
@BuildStep void watchYamlConfig(BuildProducer<HotDeploymentWatchedFileBuildItem> items) { items.produce(new HotDeploymentWatchedFileBuildItem(ApplicationYamlProvider.APPLICATION_YAML)); items.produce(new HotDeploymentWatchedFileBuildItem(ApplicationYamlProvider.APPLICATION_YML)); }
Example #14
Source Project: quarkus Author: quarkusio File: WebXmlParsingBuildStep.java License: Apache License 2.0 | 4 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> configFile() { return Arrays.asList(new HotDeploymentWatchedFileBuildItem(WEB_XML), new HotDeploymentWatchedFileBuildItem(WEB_FRAGMENT_XML)); }
Example #15
Source Project: quarkus Author: quarkusio File: DevModeBuildStep.java License: Apache License 2.0 | 4 votes |
@BuildStep List<HotDeploymentWatchedFileBuildItem> config() { return Arrays.asList(new HotDeploymentWatchedFileBuildItem("META-INF/microprofile-config.properties"), new HotDeploymentWatchedFileBuildItem("application.properties"), new HotDeploymentWatchedFileBuildItem( Paths.get(".env").toAbsolutePath().toAbsolutePath().toString())); }
Example #16
Source Project: quarkus Author: quarkusio File: BannerProcessor.java License: Apache License 2.0 | 4 votes |
@BuildStep HotDeploymentWatchedFileBuildItem watchBannerChanges(BannerConfig config) { return new HotDeploymentWatchedFileBuildItem(config.path); }