Java Code Examples for org.apache.nifi.connectable.ConnectableType#OUTPUT_PORT

The following examples show how to use org.apache.nifi.connectable.ConnectableType#OUTPUT_PORT . 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: AbstractPort.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Override
public void setName(final String name) {
    if (this.name.get().equals(name)) {
        return;
    }

    final ProcessGroup parentGroup = this.processGroup.get();
    if (getConnectableType() == ConnectableType.INPUT_PORT) {
        if (parentGroup.getInputPortByName(name) != null) {
            throw new IllegalStateException("The requested new port name is not available");
        }
    } else if (getConnectableType() == ConnectableType.OUTPUT_PORT) {
        if (parentGroup.getOutputPortByName(name) != null) {
            throw new IllegalStateException("The requested new port name is not available");
        }
    }

    this.name.set(name);
}
 
Example 2
Source File: AbstractPort.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Override
public void setName(final String name) {
    if (this.name.get().equals(name)) {
        return;
    }

    final ProcessGroup parentGroup = this.processGroup.get();
    if (getConnectableType() == ConnectableType.INPUT_PORT) {
        if (parentGroup.getInputPortByName(name) != null) {
            throw new IllegalStateException("A port with the same name already exists.");
        }
    } else if (getConnectableType() == ConnectableType.OUTPUT_PORT) {
        if (parentGroup.getOutputPortByName(name) != null) {
            throw new IllegalStateException("A port with the same name already exists.");
        }
    }

    this.name.set(name);
}
 
Example 3
Source File: TestStandardRemoteGroupPort.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
private void setupMock(final SiteToSiteTransportProtocol protocol,
        final TransferDirection direction,
        final Transaction transaction) throws Exception {
    processGroup = null;
    remoteGroup = mock(RemoteProcessGroup.class);
    scheduler = null;
    siteToSiteClient = mock(SiteToSiteClient.class);
    this.transaction = transaction;

    eventReporter = mock(EventReporter.class);

    final ConnectableType connectableType;
    switch (direction) {
        case SEND:
            connectableType = ConnectableType.REMOTE_INPUT_PORT;
            break;
        case RECEIVE:
            connectableType = ConnectableType.OUTPUT_PORT;
            break;
        default:
            connectableType = null;
            break;
    }

    port = spy(new StandardRemoteGroupPort(ID, NAME,
            processGroup, remoteGroup, direction, connectableType, null, scheduler, NiFiProperties.createBasicNiFiProperties(null, null)));

    doReturn(true).when(remoteGroup).isTransmitting();
    doReturn(protocol).when(remoteGroup).getTransportProtocol();
    doReturn(REMOTE_CLUSTER_URL).when(remoteGroup).getTargetUri();
    doReturn(siteToSiteClient).when(port).getSiteToSiteClient();
    doReturn(transaction).when(siteToSiteClient).createTransaction(eq(direction));
    doReturn(eventReporter).when(remoteGroup).getEventReporter();

}
 
Example 4
Source File: TestStandardRemoteGroupPort.java    From nifi with Apache License 2.0 5 votes vote down vote up
private void setupMock(final SiteToSiteTransportProtocol protocol,
        final TransferDirection direction,
       final SiteToSiteClientConfig siteToSiteClientConfig) throws Exception {
    processGroup = null;
    remoteGroup = mock(RemoteProcessGroup.class);
    scheduler = null;
    siteToSiteClient = mock(SiteToSiteClient.class);
    this.transaction = mock(Transaction.class);

    eventReporter = mock(EventReporter.class);

    final ConnectableType connectableType;
    switch (direction) {
        case SEND:
            connectableType = ConnectableType.REMOTE_INPUT_PORT;
            break;
        case RECEIVE:
            connectableType = ConnectableType.OUTPUT_PORT;
            break;
        default:
            connectableType = null;
            break;
    }

    port = spy(new StandardRemoteGroupPort(ID, ID, NAME,
            remoteGroup, direction, connectableType, null, scheduler, new StandardNiFiProperties()));

    doReturn(true).when(remoteGroup).isTransmitting();
    doReturn(protocol).when(remoteGroup).getTransportProtocol();
    doReturn(REMOTE_CLUSTER_URL).when(remoteGroup).getTargetUri();
    doReturn(siteToSiteClient).when(port).getSiteToSiteClient();
    doReturn(transaction).when(siteToSiteClient).createTransaction(eq(direction));
    doReturn(siteToSiteClientConfig).when(siteToSiteClient).getConfig();
    doReturn(eventReporter).when(remoteGroup).getEventReporter();

}
 
Example 5
Source File: StandardFlowManager.java    From nifi with Apache License 2.0 5 votes vote down vote up
public Port createPublicOutputPort(String id, String name) {
    id = requireNonNull(id).intern();
    name = requireNonNull(name).intern();
    verifyPortIdDoesNotExist(id);
    return new StandardPublicPort(id, name,
        TransferDirection.SEND, ConnectableType.OUTPUT_PORT, authorizer, bulletinRepository,
        processScheduler, isSiteToSiteSecure, nifiProperties.getBoredYieldDuration(),
        IdentityMappingUtil.getIdentityMappings(nifiProperties));
}
 
Example 6
Source File: StandardProcessGroup.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
private boolean isOutputPort(final Connectable connectable) {
    if (connectable.getConnectableType() != ConnectableType.OUTPUT_PORT) {
        return false;
    }
    return findOutputPort(connectable.getIdentifier()) != null;
}
 
Example 7
Source File: StandardFlowManager.java    From nifi with Apache License 2.0 4 votes vote down vote up
public Port createLocalOutputPort(String id, String name) {
    id = requireNonNull(id).intern();
    name = requireNonNull(name).intern();
    verifyPortIdDoesNotExist(id);
    return new LocalPort(id, name, ConnectableType.OUTPUT_PORT, processScheduler, nifiProperties);
}
 
Example 8
Source File: FlowController.java    From localization_nifi with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a Port to use as an Output Port for a Process Group
 *
 * @param id port id
 * @param name port name
 * @return new port
 * @throws NullPointerException if the ID or name is not unique
 * @throws IllegalStateException if an Input Port already exists with the
 * same name or id.
 */
public Port createLocalOutputPort(String id, String name) {
    id = requireNonNull(id).intern();
    name = requireNonNull(name).intern();
    verifyPortIdDoesNotExist(id);
    return new LocalPort(id, name, null, ConnectableType.OUTPUT_PORT, processScheduler);
}
 
Example 9
Source File: FlowController.java    From localization_nifi with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a Port to use as an Output Port for the root Process Group, which
 * is used for Site-to-Site communications and will queue flow files waiting
 * to be delivered to remote instances
 *
 * @param id port id
 * @param name port name
 * @return new port
 * @throws NullPointerException if the ID or name is not unique
 * @throws IllegalStateException if an Input Port already exists with the
 * same name or id.
 */
public Port createRemoteOutputPort(String id, String name) {
    id = requireNonNull(id).intern();
    name = requireNonNull(name).intern();
    verifyPortIdDoesNotExist(id);
    return new StandardRootGroupPort(id, name, null, TransferDirection.SEND, ConnectableType.OUTPUT_PORT,
            authorizer, getBulletinRepository(), processScheduler, Boolean.TRUE.equals(isSiteToSiteSecure), nifiProperties);
}