Java Code Examples for org.apache.nifi.nar.ExtensionManager#getExtensions()

The following examples show how to use org.apache.nifi.nar.ExtensionManager#getExtensions() . 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 File: HtmlDocumentationWriter.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
/**
 * Uses the {@link ExtensionManager} to discover any {@link ControllerService} implementations that implement a specific
 * ControllerService API.
 *
 * @param parent the controller service API
 * @return a list of controller services that implement the controller service API
 */
private List<Class<? extends ControllerService>> lookupControllerServiceImpls(
        final Class<? extends ControllerService> parent) {

    final List<Class<? extends ControllerService>> implementations = new ArrayList<>();

    // first get all ControllerService implementations
    final Set<Class> controllerServices = ExtensionManager.getExtensions(ControllerService.class);

    // then iterate over all controller services looking for any that is a child of the parent
    // ControllerService API that was passed in as a parameter
    for (final Class<? extends ControllerService> controllerServiceClass : controllerServices) {
        if (parent.isAssignableFrom(controllerServiceClass)) {
            implementations.add(controllerServiceClass);
        }
    }

    return implementations;
}
 
Example 2
Source File: ControllerFacade.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the ControllerService types that this controller supports.
 *
 * @param serviceType type
 * @return the ControllerService types that this controller supports
 */
public Set<DocumentedTypeDTO> getControllerServiceTypes(final String serviceType) {
    final Set<Class> serviceImplementations = ExtensionManager.getExtensions(ControllerService.class);

    // identify the controller services that implement the specified serviceType if applicable
    final Set<Class> matchingServiceImplementions;
    if (serviceType != null) {
        matchingServiceImplementions = new HashSet<>();

        // check each type and remove those that aren't in the specified ancestry
        for (final Class type : serviceImplementations) {
            if (implementsServiceType(serviceType, type)) {
                matchingServiceImplementions.add(type);
            }
        }
    } else {
        matchingServiceImplementions = serviceImplementations;
    }

    return dtoFactory.fromDocumentedTypes(matchingServiceImplementions);
}
 
Example 3
Source File: FlowController.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public List<String> getComponentTypes() {
    final Set<Class> procClasses = ExtensionManager.getExtensions(Processor.class);
    final List<String> componentTypes = new ArrayList<>(procClasses.size() + 2);
    componentTypes.add(ProvenanceEventRecord.REMOTE_INPUT_PORT_TYPE);
    componentTypes.add(ProvenanceEventRecord.REMOTE_OUTPUT_PORT_TYPE);
    procClasses.stream()
        .map(procClass -> procClass.getSimpleName())
        .forEach(componentType -> componentTypes.add(componentType));
    return componentTypes;
}
 
Example 4
Source File: FlowController.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public Set<Class> getFlowFileProcessorClasses() {
    return ExtensionManager.getExtensions(Processor.class);
}
 
Example 5
Source File: FlowController.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public Set<Class> getFlowFileComparatorClasses() {
    return ExtensionManager.getExtensions(FlowFilePrioritizer.class);
}