@Override public void start(Context context) { for (Map.Entry<String, DiagnosticInfoCollector> entry : diagnosticInfoCollectors.entrySet()) { diagnosticManager.registerDiagnosticInfoCollector(entry.getKey(), entry.getValue()); } } }
@Override public InitState initialize(InitContext initContext) { webConfig = getConfiguration(WebConfig.class); if (servletContext != null) { diagnosticManager.registerDiagnosticInfoCollector( "web", new WebDiagnosticCollector(servletContext) ); } return InitState.INITIALIZED; }
private synchronized Kernel createKernel(KernelConfiguration kernelConfiguration, DiagnosticManager diagnosticManager) { // Kernel instantiation Kernel kernel = NuunCore.createKernel(kernelConfiguration); FallbackUrlType fallbackUrlType = new FallbackUrlType(); List<Vfs.UrlType> urlTypes = new ArrayList<>(detectedUrlTypes); urlTypes.add(fallbackUrlType); LOGGER.debug("Registered URL types for classpath scan: " + urlTypes); // Kernel initialization (it is assumed that only this class alter Vfs default url types) Vfs.setDefaultURLTypes(urlTypes); kernel.init(); Vfs.setDefaultURLTypes(savedUrlTypes); // Log if any URL were not scanned int failedUrlCount = fallbackUrlType.getFailedUrls().size(); if (failedUrlCount > 0) { for (String failedUrl : fallbackUrlType.getFailedUrls()) { LOGGER.warn("URL not scanned: {}", failedUrl); } } diagnosticManager.registerDiagnosticInfoCollector("kernel", () -> { Map<String, Object> result = new HashMap<>(); result.put("scannedUrls", kernel.scannedURLs()); result.put("failedUrls", fallbackUrlType.getFailedUrls()); return result; }); return kernel; }
private SeedRuntime(Object context, DiagnosticManager diagnosticManager, Coffig configuration, ValidatorFactory validatorFactory, String seedVersion, String businessVersion) { this.context = context; this.diagnosticManager = diagnosticManager; this.configuration = configuration; this.validatorFactory = validatorFactory; this.seedVersion = seedVersion; this.businessVersion = businessVersion; this.diagnosticManager.registerDiagnosticInfoCollector("seed", new RuntimeDiagnosticCollector()); this.prioritizedProvider = ((CompositeProvider) this.configuration.getProvider()).get( PrioritizedProvider.class); this.inMemoryProvider = new InMemoryProvider(); registerConfigurationProvider(this.inMemoryProvider, ConfigurationPriority.DEFAULT); checkConsistency(); }
@SuppressWarnings("unchecked") @Override public InitState init(InitContext initContext) { detectSystemPropertiesConfig(); detectKernelParamConfig(initContext); detectConfigurationFiles(initContext); CliContext cliContext = seedRuntime.contextAs(CliContext.class); application = new ApplicationImpl(coffig, initContext.kernelParams(), cliContext != null ? cliContext.getArgs() : new String[0]); configConfig = coffig.get(ConfigConfig.class); diagnosticManager.registerDiagnosticInfoCollector("application", new ApplicationDiagnosticCollector(application)); return InitState.INITIALIZED; }