@Override public ConfigurableComponent getTempComponent(String classType, BundleCoordinate bundleCoordinate) { return controllerFacade.getExtensionManager().getTempComponent(classType, bundleCoordinate); }
/** * Gets the cached temporary instance of the component for the given type and bundle. * * @param type type of the component * @param bundle the bundle of the component * @return the temporary component * @throws IllegalStateException if no temporary component exists for the given type and bundle */ public ConfigurableComponent getTemporaryComponent(final String type, final BundleDTO bundle) { final ExtensionManager extensionManager = getExtensionManager(); final BundleCoordinate bundleCoordinate = BundleUtils.getBundle(extensionManager, type, bundle); final ConfigurableComponent configurableComponent = extensionManager.getTempComponent(type, bundleCoordinate); if (configurableComponent == null) { throw new IllegalStateException("Unable to obtain temporary component for " + type); } return configurableComponent; }
/** * Generates the documentation for a particular configurable component. Will * check to see if an "additionalDetails.html" file exists and will link * that from the generated documentation. * * @param componentDocsDir the component documentation directory * @param componentClass the class to document * @throws InstantiationException ie * @throws IllegalAccessException iae * @throws IOException ioe * @throws InitializationException ie */ private static void document(final ExtensionManager extensionManager, final File componentDocsDir, final Class<? extends ConfigurableComponent> componentClass, final BundleCoordinate bundleCoordinate) throws InstantiationException, IllegalAccessException, IOException, InitializationException { // use temp components from ExtensionManager which should always be populated before doc generation final String classType = componentClass.getCanonicalName(); final ConfigurableComponent component = extensionManager.getTempComponent(classType, bundleCoordinate); final DocumentationWriter writer = getDocumentWriter(extensionManager, componentClass); final File baseDocumentationFile = new File(componentDocsDir, "index.html"); if (baseDocumentationFile.exists()) { logger.warn(baseDocumentationFile + " already exists, overwriting!"); } try (final OutputStream output = new BufferedOutputStream(new FileOutputStream(baseDocumentationFile))) { writer.write(component, output, hasAdditionalInfo(componentDocsDir)); } }
private void addControllerServiceFingerprint(final StringBuilder builder, final ControllerServiceDTO dto) { builder.append(dto.getId()); builder.append(dto.getVersionedComponentId()); builder.append(dto.getType()); builder.append(dto.getName()); addBundleFingerprint(builder, dto.getBundle()); builder.append(dto.getComments()); builder.append(dto.getAnnotationData()); builder.append(dto.getState()); // get the temp instance of the ControllerService so that we know the default property values final BundleCoordinate coordinate = getCoordinate(dto.getType(), dto.getBundle()); final ConfigurableComponent configurableComponent = extensionManager.getTempComponent(dto.getType(), coordinate); if (configurableComponent == null) { logger.warn("Unable to get ControllerService of type {}; its default properties will be fingerprinted instead of being ignored.", dto.getType()); } addPropertiesFingerprint(builder, configurableComponent, dto.getProperties()); }
private void addReportingTaskFingerprint(final StringBuilder builder, final ReportingTaskDTO dto) { builder.append(dto.getId()); builder.append(dto.getType()); builder.append(dto.getName()); addBundleFingerprint(builder, dto.getBundle()); builder.append(dto.getComments()); builder.append(dto.getSchedulingPeriod()); builder.append(dto.getSchedulingStrategy()); builder.append(dto.getAnnotationData()); // get the temp instance of the ReportingTask so that we know the default property values final BundleCoordinate coordinate = getCoordinate(dto.getType(), dto.getBundle()); final ConfigurableComponent configurableComponent = extensionManager.getTempComponent(dto.getType(), coordinate); if (configurableComponent == null) { logger.warn("Unable to get ReportingTask of type {}; its default properties will be fingerprinted instead of being ignored.", dto.getType()); } addPropertiesFingerprint(builder, configurableComponent, dto.getProperties()); }
private void updateBundle(ReportingTaskNode reportingTask, ReportingTaskDTO reportingTaskDTO) { final BundleDTO bundleDTO = reportingTaskDTO.getBundle(); if (bundleDTO != null) { final ExtensionManager extensionManager = reportingTaskProvider.getExtensionManager(); final BundleCoordinate incomingCoordinate = BundleUtils.getBundle(extensionManager, reportingTask.getCanonicalClassName(), bundleDTO); final BundleCoordinate existingCoordinate = reportingTask.getBundleCoordinate(); if (!existingCoordinate.getCoordinate().equals(incomingCoordinate.getCoordinate())) { try { // we need to use the property descriptors from the temp component here in case we are changing from a ghost component to a real component final ConfigurableComponent tempComponent = extensionManager.getTempComponent(reportingTask.getCanonicalClassName(), incomingCoordinate); final Set<URL> additionalUrls = reportingTask.getAdditionalClasspathResources(tempComponent.getPropertyDescriptors()); reloadComponent.reload(reportingTask, reportingTask.getCanonicalClassName(), incomingCoordinate, additionalUrls); } catch (ReportingTaskInstantiationException e) { throw new NiFiCoreException(String.format("Unable to update reporting task %s from %s to %s due to: %s", reportingTaskDTO.getId(), reportingTask.getBundleCoordinate().getCoordinate(), incomingCoordinate.getCoordinate(), e.getMessage()), e); } } } }
private void updateBundle(final ControllerServiceNode controllerService, final ControllerServiceDTO controllerServiceDTO) { final BundleDTO bundleDTO = controllerServiceDTO.getBundle(); if (bundleDTO != null) { final ExtensionManager extensionManager = serviceProvider.getExtensionManager(); final BundleCoordinate incomingCoordinate = BundleUtils.getBundle(extensionManager, controllerService.getCanonicalClassName(), bundleDTO); final BundleCoordinate existingCoordinate = controllerService.getBundleCoordinate(); if (!existingCoordinate.getCoordinate().equals(incomingCoordinate.getCoordinate())) { try { // we need to use the property descriptors from the temp component here in case we are changing from a ghost component to a real component final ConfigurableComponent tempComponent = extensionManager.getTempComponent(controllerService.getCanonicalClassName(), incomingCoordinate); final Set<URL> additionalUrls = controllerService.getAdditionalClasspathResources(tempComponent.getPropertyDescriptors()); flowController.getReloadComponent().reload(controllerService, controllerService.getCanonicalClassName(), incomingCoordinate, additionalUrls); } catch (ControllerServiceInstantiationException e) { throw new NiFiCoreException(String.format("Unable to update controller service %s from %s to %s due to: %s", controllerServiceDTO.getId(), controllerService.getBundleCoordinate().getCoordinate(), incomingCoordinate.getCoordinate(), e.getMessage()), e); } } } }
private void updateBundle(ProcessorNode processor, ProcessorDTO processorDTO) { final BundleDTO bundleDTO = processorDTO.getBundle(); if (bundleDTO != null) { final ExtensionManager extensionManager = flowController.getExtensionManager(); final BundleCoordinate incomingCoordinate = BundleUtils.getBundle(extensionManager, processor.getCanonicalClassName(), bundleDTO); final BundleCoordinate existingCoordinate = processor.getBundleCoordinate(); if (!existingCoordinate.getCoordinate().equals(incomingCoordinate.getCoordinate())) { try { // we need to use the property descriptors from the temp component here in case we are changing from a ghost component to a real component final ConfigurableComponent tempComponent = extensionManager.getTempComponent(processor.getCanonicalClassName(), incomingCoordinate); final Set<URL> additionalUrls = processor.getAdditionalClasspathResources(tempComponent.getPropertyDescriptors()); flowController.getReloadComponent().reload(processor, processor.getCanonicalClassName(), incomingCoordinate, additionalUrls); } catch (ProcessorInstantiationException e) { throw new NiFiCoreException(String.format("Unable to update processor %s from %s to %s due to: %s", processorDTO.getId(), processor.getBundleCoordinate().getCoordinate(), incomingCoordinate.getCoordinate(), e.getMessage()), e); } } } }
final ConfigurableComponent configurableComponent = extensionManager.getTempComponent(className, coordinate); if (configurableComponent == null) { logger.warn("Unable to get Processor of type {}; its default properties will be fingerprinted instead of being ignored.", className);
final ConfigurableComponent component = getTempComponent(classType, bundle.getBundleDetails().getCoordinate()); final Set<BundleCoordinate> reachableApiBundles = findReachableApiBundles(component);
final ConfigurableComponent component = getTempComponent(classType, bundle.getBundleDetails().getCoordinate()); final Set<BundleCoordinate> reachableApiBundles = findReachableApiBundles(component);