Java Code Examples for org.apache.nifi.util.NiFiProperties#isSiteToSiteSecure()

The following examples show how to use org.apache.nifi.util.NiFiProperties#isSiteToSiteSecure() . 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: StandardFlowService.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
private StandardFlowService(
        final FlowController controller,
        final NiFiProperties nifiProperties,
        final NodeProtocolSenderListener senderListener,
        final StringEncryptor encryptor,
        final boolean configuredForClustering,
        final ClusterCoordinator clusterCoordinator,
        final RevisionManager revisionManager,
        final Authorizer authorizer) throws IOException {

    this.nifiProperties = nifiProperties;
    this.controller = controller;
    flowXml = Paths.get(nifiProperties.getProperty(NiFiProperties.FLOW_CONFIGURATION_FILE));

    gracefulShutdownSeconds = (int) FormatUtils.getTimeDuration(nifiProperties.getProperty(NiFiProperties.FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD), TimeUnit.SECONDS);
    autoResumeState = nifiProperties.getAutoResumeState();

    dao = new StandardXMLFlowConfigurationDAO(flowXml, encryptor, nifiProperties);
    this.clusterCoordinator = clusterCoordinator;
    if (clusterCoordinator != null) {
        clusterCoordinator.setFlowService(this);
    }
    this.revisionManager = revisionManager;
    this.authorizer = authorizer;

    if (configuredForClustering) {
        this.configuredForClustering = configuredForClustering;

        this.senderListener = senderListener;
        senderListener.addHandler(this);

        final InetSocketAddress nodeApiAddress = nifiProperties.getNodeApiAddress();
        final InetSocketAddress nodeSocketAddress = nifiProperties.getClusterNodeProtocolAddress();

        String nodeUuid = null;
        final StateManager stateManager = controller.getStateManagerProvider().getStateManager(CLUSTER_NODE_CONFIG);
        if (stateManager != null) {
            nodeUuid = stateManager.getState(Scope.LOCAL).get(NODE_UUID);
        }

        if (nodeUuid == null) {
            nodeUuid = UUID.randomUUID().toString();
        }

        // use a random UUID as the proposed node identifier
        this.nodeId = new NodeIdentifier(nodeUuid,
                nodeApiAddress.getHostName(), nodeApiAddress.getPort(),
                nodeSocketAddress.getHostName(), nodeSocketAddress.getPort(),
                nifiProperties.getRemoteInputHost(), nifiProperties.getRemoteInputPort(),
                nifiProperties.getRemoteInputHttpPort(), nifiProperties.isSiteToSiteSecure());

    } else {
        this.configuredForClustering = false;
        this.senderListener = null;
    }

}
 
Example 2
Source File: StandardFlowService.java    From nifi with Apache License 2.0 4 votes vote down vote up
private StandardFlowService(
        final FlowController controller,
        final NiFiProperties nifiProperties,
        final NodeProtocolSenderListener senderListener,
        final StringEncryptor encryptor,
        final boolean configuredForClustering,
        final ClusterCoordinator clusterCoordinator,
        final RevisionManager revisionManager,
        final Authorizer authorizer) throws IOException {

    this.nifiProperties = nifiProperties;
    this.controller = controller;
    flowXml = Paths.get(nifiProperties.getProperty(NiFiProperties.FLOW_CONFIGURATION_FILE));

    gracefulShutdownSeconds = (int) FormatUtils.getTimeDuration(nifiProperties.getProperty(NiFiProperties.FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD), TimeUnit.SECONDS);
    autoResumeState = nifiProperties.getAutoResumeState();

    dao = new StandardXMLFlowConfigurationDAO(flowXml, encryptor, nifiProperties, controller.getExtensionManager());
    this.clusterCoordinator = clusterCoordinator;
    if (clusterCoordinator != null) {
        clusterCoordinator.setFlowService(this);
    }
    this.revisionManager = revisionManager;
    this.authorizer = authorizer;

    if (configuredForClustering) {
        this.configuredForClustering = configuredForClustering;

        this.senderListener = senderListener;
        senderListener.addHandler(this);

        final InetSocketAddress nodeApiAddress = nifiProperties.getNodeApiAddress();
        final InetSocketAddress nodeSocketAddress = nifiProperties.getClusterNodeProtocolAddress();
        final InetSocketAddress loadBalanceAddress = nifiProperties.getClusterLoadBalanceAddress();

        String nodeUuid = null;
        final StateManager stateManager = controller.getStateManagerProvider().getStateManager(CLUSTER_NODE_CONFIG);
        if (stateManager != null) {
            nodeUuid = stateManager.getState(Scope.LOCAL).get(NODE_UUID);
        }

        if (nodeUuid == null) {
            nodeUuid = UUID.randomUUID().toString();
        }

        // use a random UUID as the proposed node identifier
        this.nodeId = new NodeIdentifier(nodeUuid,
                nodeApiAddress.getHostName(), nodeApiAddress.getPort(),
                nodeSocketAddress.getHostName(), nodeSocketAddress.getPort(),
                loadBalanceAddress.getHostName(), loadBalanceAddress.getPort(),
                nifiProperties.getRemoteInputHost(), nifiProperties.getRemoteInputPort(),
                nifiProperties.getRemoteInputHttpPort(), nifiProperties.isSiteToSiteSecure());

    } else {
        this.configuredForClustering = false;
        this.senderListener = null;
    }

}