Java Code Examples for org.apache.nifi.connectable.ConnectableType#REMOTE_INPUT_PORT
The following examples show how to use
org.apache.nifi.connectable.ConnectableType#REMOTE_INPUT_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: StandardRemoteGroupPort.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public void verifyCanStart() { super.verifyCanStart(); if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && getIncomingConnections().isEmpty()) { throw new IllegalStateException("Port " + getName() + " has no incoming connections"); } final Optional<ValidationResult> resultOption = remoteGroup.validate().stream() .filter(result -> !result.isValid()) .findFirst(); if (resultOption.isPresent()) { throw new IllegalStateException("Remote Process Group is not valid: " + resultOption.get().toString()); } }
Example 2
Source File: StandardRemoteProcessGroup.java From localization_nifi with Apache License 2.0 | 6 votes |
/** * Adds an InputPort to this ProcessGroup that is described by the given * DTO. * * @param descriptor port descriptor * * @throws IllegalStateException if an Input Port already exists with the ID * given by the ID of the DTO. */ private void addInputPort(final RemoteProcessGroupPortDescriptor descriptor) { writeLock.lock(); try { if (inputPorts.containsKey(descriptor.getId())) { throw new IllegalStateException("Input Port with ID " + descriptor.getId() + " already exists"); } final StandardRemoteGroupPort port = new StandardRemoteGroupPort(descriptor.getId(), descriptor.getName(), getProcessGroup(), this, TransferDirection.SEND, ConnectableType.REMOTE_INPUT_PORT, sslContext, scheduler, nifiProperties); if (descriptor.getConcurrentlySchedulableTaskCount() != null) { port.setMaxConcurrentTasks(descriptor.getConcurrentlySchedulableTaskCount()); } if (descriptor.getUseCompression() != null) { port.setUseCompression(descriptor.getUseCompression()); } inputPorts.put(descriptor.getId(), port); } finally { writeLock.unlock(); } }
Example 3
Source File: StandardRemoteGroupPort.java From nifi with Apache License 2.0 | 6 votes |
@Override public void verifyCanStart() { super.verifyCanStart(); if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && getIncomingConnections().isEmpty()) { throw new IllegalStateException("Port " + getName() + " has no incoming connections"); } final Optional<ValidationResult> resultOption = remoteGroup.validate().stream() .filter(result -> !result.isValid()) .findFirst(); if (resultOption.isPresent()) { throw new IllegalStateException("Remote Process Group is not valid: " + resultOption.get().toString()); } }
Example 4
Source File: TestStandardRemoteGroupPort.java From localization_nifi with Apache License 2.0 | 5 votes |
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 5
Source File: TestStandardRemoteGroupPort.java From nifi with Apache License 2.0 | 5 votes |
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 6
Source File: StandardRemoteProcessGroup.java From nifi with Apache License 2.0 | 5 votes |
/** * Adds an InputPort to this ProcessGroup that is described by the given * DTO. * * @param descriptor port descriptor * @throws IllegalStateException if an Input Port already exists with the ID * given by the ID of the DTO. */ private StandardRemoteGroupPort addInputPort(final RemoteProcessGroupPortDescriptor descriptor) { writeLock.lock(); try { if (inputPorts.containsKey(descriptor.getId())) { throw new IllegalStateException("Input Port with ID " + descriptor.getId() + " already exists"); } // We need to generate the port's UUID deterministically because we need // all nodes in a cluster to use the same UUID. However, we want the ID to be // unique for each Remote Group Port, so that if we have multiple RPG's pointing // to the same target, we have unique ID's for each of those ports. final StandardRemoteGroupPort port = new StandardRemoteGroupPort(descriptor.getId(), descriptor.getTargetId(), descriptor.getName(), this, TransferDirection.SEND, ConnectableType.REMOTE_INPUT_PORT, sslContext, scheduler, nifiProperties); port.setProcessGroup(getProcessGroup()); if (descriptor.getConcurrentlySchedulableTaskCount() != null) { port.setMaxConcurrentTasks(descriptor.getConcurrentlySchedulableTaskCount()); } if (descriptor.getUseCompression() != null) { port.setUseCompression(descriptor.getUseCompression()); } if (descriptor.getBatchCount() != null && descriptor.getBatchCount() > 0) { port.setBatchCount(descriptor.getBatchCount()); } if (!StringUtils.isBlank(descriptor.getBatchSize())) { port.setBatchSize(descriptor.getBatchSize()); } if (!StringUtils.isBlank(descriptor.getBatchDuration())) { port.setBatchDuration(descriptor.getBatchDuration()); } port.setVersionedComponentId(descriptor.getVersionedComponentId()); inputPorts.put(descriptor.getId(), port); return port; } finally { writeLock.unlock(); } }
Example 7
Source File: StandardRemoteGroupPort.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public TransferDirection getTransferDirection() { return (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) ? TransferDirection.SEND : TransferDirection.RECEIVE; }
Example 8
Source File: StandardFlowSerializer.java From localization_nifi with Apache License 2.0 | 4 votes |
private void addConnection(final Element parentElement, final Connection connection) { final Document doc = parentElement.getOwnerDocument(); final Element element = doc.createElement("connection"); parentElement.appendChild(element); addTextElement(element, "id", connection.getIdentifier()); addTextElement(element, "name", connection.getName()); final Element bendPointsElement = doc.createElement("bendPoints"); element.appendChild(bendPointsElement); for (final Position bendPoint : connection.getBendPoints()) { addPosition(bendPointsElement, bendPoint, "bendPoint"); } addTextElement(element, "labelIndex", connection.getLabelIndex()); addTextElement(element, "zIndex", connection.getZIndex()); final String sourceId = connection.getSource().getIdentifier(); final ConnectableType sourceType = connection.getSource().getConnectableType(); final String sourceGroupId; if (sourceType == ConnectableType.REMOTE_OUTPUT_PORT) { sourceGroupId = ((RemoteGroupPort) connection.getSource()).getRemoteProcessGroup().getIdentifier(); } else { sourceGroupId = connection.getSource().getProcessGroup().getIdentifier(); } final ConnectableType destinationType = connection.getDestination().getConnectableType(); final String destinationId = connection.getDestination().getIdentifier(); final String destinationGroupId; if (destinationType == ConnectableType.REMOTE_INPUT_PORT) { destinationGroupId = ((RemoteGroupPort) connection.getDestination()).getRemoteProcessGroup().getIdentifier(); } else { destinationGroupId = connection.getDestination().getProcessGroup().getIdentifier(); } addTextElement(element, "sourceId", sourceId); addTextElement(element, "sourceGroupId", sourceGroupId); addTextElement(element, "sourceType", sourceType.toString()); addTextElement(element, "destinationId", destinationId); addTextElement(element, "destinationGroupId", destinationGroupId); addTextElement(element, "destinationType", destinationType.toString()); for (final Relationship relationship : connection.getRelationships()) { addTextElement(element, "relationship", relationship.getName()); } addTextElement(element, "maxWorkQueueSize", connection.getFlowFileQueue().getBackPressureObjectThreshold()); addTextElement(element, "maxWorkQueueDataSize", connection.getFlowFileQueue().getBackPressureDataSizeThreshold()); addTextElement(element, "flowFileExpiration", connection.getFlowFileQueue().getFlowFileExpiration()); for (final FlowFilePrioritizer comparator : connection.getFlowFileQueue().getPriorities()) { final String className = comparator.getClass().getCanonicalName(); addTextElement(element, "queuePrioritizerClass", className); } parentElement.appendChild(element); }
Example 9
Source File: StandardRemoteGroupPort.java From nifi with Apache License 2.0 | 4 votes |
@Override public TransferDirection getTransferDirection() { return (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) ? TransferDirection.SEND : TransferDirection.RECEIVE; }
Example 10
Source File: StandardFlowSerializer.java From nifi with Apache License 2.0 | 4 votes |
private void addConnection(final Element parentElement, final Connection connection) { final Document doc = parentElement.getOwnerDocument(); final Element element = doc.createElement("connection"); parentElement.appendChild(element); addTextElement(element, "id", connection.getIdentifier()); addTextElement(element, "versionedComponentId", connection.getVersionedComponentId()); addTextElement(element, "name", connection.getName()); final Element bendPointsElement = doc.createElement("bendPoints"); element.appendChild(bendPointsElement); for (final Position bendPoint : connection.getBendPoints()) { addPosition(bendPointsElement, bendPoint, "bendPoint"); } addTextElement(element, "labelIndex", connection.getLabelIndex()); addTextElement(element, "zIndex", connection.getZIndex()); final String sourceId = connection.getSource().getIdentifier(); final ConnectableType sourceType = connection.getSource().getConnectableType(); final String sourceGroupId; if (sourceType == ConnectableType.REMOTE_OUTPUT_PORT) { sourceGroupId = ((RemoteGroupPort) connection.getSource()).getRemoteProcessGroup().getIdentifier(); } else { sourceGroupId = connection.getSource().getProcessGroup().getIdentifier(); } final ConnectableType destinationType = connection.getDestination().getConnectableType(); final String destinationId = connection.getDestination().getIdentifier(); final String destinationGroupId; if (destinationType == ConnectableType.REMOTE_INPUT_PORT) { destinationGroupId = ((RemoteGroupPort) connection.getDestination()).getRemoteProcessGroup().getIdentifier(); } else { destinationGroupId = connection.getDestination().getProcessGroup().getIdentifier(); } addTextElement(element, "sourceId", sourceId); addTextElement(element, "sourceGroupId", sourceGroupId); addTextElement(element, "sourceType", sourceType.toString()); addTextElement(element, "destinationId", destinationId); addTextElement(element, "destinationGroupId", destinationGroupId); addTextElement(element, "destinationType", destinationType.toString()); for (final Relationship relationship : connection.getRelationships()) { addTextElement(element, "relationship", relationship.getName()); } addTextElement(element, "maxWorkQueueSize", connection.getFlowFileQueue().getBackPressureObjectThreshold()); addTextElement(element, "maxWorkQueueDataSize", connection.getFlowFileQueue().getBackPressureDataSizeThreshold()); addTextElement(element, "flowFileExpiration", connection.getFlowFileQueue().getFlowFileExpiration()); for (final FlowFilePrioritizer comparator : connection.getFlowFileQueue().getPriorities()) { final String className = comparator.getClass().getCanonicalName(); addTextElement(element, "queuePrioritizerClass", className); } addTextElement(element, "loadBalanceStrategy", connection.getFlowFileQueue().getLoadBalanceStrategy().name()); addTextElement(element, "partitioningAttribute", connection.getFlowFileQueue().getPartitioningAttribute()); addTextElement(element, "loadBalanceCompression", connection.getFlowFileQueue().getLoadBalanceCompression().name()); parentElement.appendChild(element); }