Java Code Examples for org.apache.nifi.controller.service.ControllerServiceState#ENABLING

The following examples show how to use org.apache.nifi.controller.service.ControllerServiceState#ENABLING . 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: StandardFlowSerializer.java    From nifi with Apache License 2.0 6 votes vote down vote up
public void addControllerService(final Element element, final ControllerServiceNode serviceNode) {
    final Element serviceElement = element.getOwnerDocument().createElement("controllerService");
    addTextElement(serviceElement, "id", serviceNode.getIdentifier());
    addTextElement(serviceElement, "versionedComponentId", serviceNode.getVersionedComponentId());
    addTextElement(serviceElement, "name", serviceNode.getName());
    addTextElement(serviceElement, "comment", serviceNode.getComments());
    addTextElement(serviceElement, "class", serviceNode.getCanonicalClassName());

    addBundle(serviceElement, serviceNode.getBundleCoordinate());

    final ControllerServiceState state = serviceNode.getState();
    final boolean enabled = (state == ControllerServiceState.ENABLED || state == ControllerServiceState.ENABLING);
    addTextElement(serviceElement, "enabled", String.valueOf(enabled));

    addConfiguration(serviceElement, serviceNode.getRawPropertyValues(), serviceNode.getAnnotationData(), encryptor);

    element.appendChild(serviceElement);
}
 
Example 2
Source File: StandardFlowSerializer.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
public void addControllerService(final Element element, final ControllerServiceNode serviceNode) {
    final Element serviceElement = element.getOwnerDocument().createElement("controllerService");
    addTextElement(serviceElement, "id", serviceNode.getIdentifier());
    addTextElement(serviceElement, "name", serviceNode.getName());
    addTextElement(serviceElement, "comment", serviceNode.getComments());
    addTextElement(serviceElement, "class", serviceNode.getCanonicalClassName());

    final ControllerServiceState state = serviceNode.getState();
    final boolean enabled = (state == ControllerServiceState.ENABLED || state == ControllerServiceState.ENABLING);
    addTextElement(serviceElement, "enabled", String.valueOf(enabled));

    addConfiguration(serviceElement, serviceNode.getProperties(), serviceNode.getAnnotationData(), encryptor);

    element.appendChild(serviceElement);
}
 
Example 3
Source File: StandardValidationContext.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isValidationRequired(final ControllerService service) {
    // No need to validate services that are already enabled.
    final ControllerServiceState serviceState = controllerServiceProvider.getControllerServiceNode(service.getIdentifier()).getState();
    if (serviceState == ControllerServiceState.ENABLED || serviceState == ControllerServiceState.ENABLING) {
        return false;
    }

    return true;
}