Java Code Examples for org.apache.nifi.processor.Relationship#getName()
The following examples show how to use
org.apache.nifi.processor.Relationship#getName() .
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: MockProcessSession.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public void transfer(final FlowFile flowFile, final Relationship relationship) { if (relationship == Relationship.SELF) { transfer(flowFile); return; } if(!processor.getRelationships().contains(relationship)){ throw new IllegalArgumentException("this relationship " + relationship.getName() + " is not known"); } validateState(flowFile); List<MockFlowFile> list = transferMap.get(relationship); if (list == null) { list = new ArrayList<>(); transferMap.put(relationship, list); } beingProcessed.remove(flowFile.getId()); list.add((MockFlowFile) flowFile); }
Example 2
Source File: MockProcessSession.java From nifi with Apache License 2.0 | 6 votes |
@Override public void transfer(FlowFile flowFile, final Relationship relationship) { if (relationship == Relationship.SELF) { transfer(flowFile); return; } if(!processor.getRelationships().contains(relationship)){ throw new IllegalArgumentException("this relationship " + relationship.getName() + " is not known"); } flowFile = validateState(flowFile); List<MockFlowFile> list = transferMap.computeIfAbsent(relationship, r -> new ArrayList<>()); beingProcessed.remove(flowFile.getId()); list.add((MockFlowFile) flowFile); updateLastQueuedDate((MockFlowFile) flowFile); }
Example 3
Source File: StatelessProcessSession.java From nifi with Apache License 2.0 | 6 votes |
@Override public void transfer(FlowFile flowFile, final Relationship relationship) { if (relationship == Relationship.SELF) { transfer(flowFile); return; } if (!processor.getRelationships().contains(relationship)) { throw new IllegalArgumentException("this relationship " + relationship.getName() + " is not known"); } flowFile = validateState(flowFile); if (outputMap.containsKey(relationship)) { Queue<StatelessFlowFile> queue = this.outputMap.get(relationship); queue.add((StatelessFlowFile) flowFile); } beingProcessed.remove(flowFile.getId()); updateLastQueuedDate((StatelessFlowFile) flowFile); }
Example 4
Source File: StandardProcessorNode.java From nifi with Apache License 2.0 | 6 votes |
@Override public void setAutoTerminatedRelationships(final Set<Relationship> terminate) { if (isRunning()) { throw new IllegalStateException("Cannot modify Processor configuration while the Processor is running"); } for (final Relationship rel : terminate) { if (!getConnections(rel).isEmpty()) { throw new IllegalStateException("Cannot mark relationship '" + rel.getName() + "' as auto-terminated because Connection already exists with this relationship"); } } undefinedRelationshipsToTerminate.set(new HashSet<>(terminate)); LOG.debug("Resetting Validation State of {} due to setting auto-terminated relationships", this); resetValidationState(); }
Example 5
Source File: AbstractPort.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public Set<Connection> getConnections(final Relationship relationship) { readLock.lock(); try { if (relationship.equals(PORT_RELATIONSHIP)) { return Collections.unmodifiableSet(outgoingConnections); } throw new IllegalArgumentException("No relationship with name " + relationship.getName() + " exists for Local Ports"); } finally { readLock.unlock(); } }
Example 6
Source File: StandardFunnel.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public Set<Connection> getConnections(final Relationship relationship) { readLock.lock(); try { if (relationship.equals(Relationship.ANONYMOUS)) { return Collections.unmodifiableSet(outgoingConnections); } throw new IllegalArgumentException("No relationship with name " + relationship.getName() + " exists for Funnels"); } finally { readLock.unlock(); } }
Example 7
Source File: StandardProcessorNode.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public void setAutoTerminatedRelationships(final Set<Relationship> terminate) { if (isRunning()) { throw new IllegalStateException("Cannot modify Processor configuration while the Processor is running"); } for (final Relationship rel : terminate) { if (!getConnections(rel).isEmpty()) { throw new IllegalStateException("Cannot mark relationship '" + rel.getName() + "' as auto-terminated because Connection already exists with this relationship"); } } undefinedRelationshipsToTerminate.set(new HashSet<>(terminate)); }
Example 8
Source File: StandardProcessSession.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public void transfer(final FlowFile flowFile, final Relationship relationship) { validateRecordState(flowFile); final int numDestinations = context.getConnections(relationship).size(); final int multiplier = Math.max(1, numDestinations); boolean autoTerminated = false; boolean selfRelationship = false; if (numDestinations == 0 && context.getConnectable().isAutoTerminated(relationship)) { // auto terminated. autoTerminated = true; } else if (numDestinations == 0 && relationship == Relationship.SELF) { selfRelationship = true; } else if (numDestinations == 0) { // the relationship specified is not known in this session/context throw new IllegalArgumentException("Relationship '" + relationship.getName() + "' is not known"); } final StandardRepositoryRecord record = records.get(flowFile); record.setTransferRelationship(relationship); updateLastQueuedDate(record); if (autoTerminated) { removedCount += multiplier; removedBytes += flowFile.getSize(); } else if (!selfRelationship) { flowFilesOut += multiplier; contentSizeOut += flowFile.getSize() * multiplier; } }
Example 9
Source File: StandardProcessSession.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public void transfer(final Collection<FlowFile> flowFiles, final Relationship relationship) { validateRecordState(flowFiles); boolean autoTerminated = false; boolean selfRelationship = false; final int numDestinations = context.getConnections(relationship).size(); if (numDestinations == 0 && context.getConnectable().isAutoTerminated(relationship)) { // auto terminated. autoTerminated = true; } else if (numDestinations == 0 && relationship == Relationship.SELF) { selfRelationship = true; } else if (numDestinations == 0) { // the relationship specified is not known in this session/context throw new IllegalArgumentException("Relationship '" + relationship.getName() + "' is not known"); } final int multiplier = Math.max(1, numDestinations); long contentSize = 0L; for (final FlowFile flowFile : flowFiles) { final StandardRepositoryRecord record = records.get(flowFile); record.setTransferRelationship(relationship); updateLastQueuedDate(record); contentSize += flowFile.getSize() * multiplier; } if (autoTerminated) { removedCount += multiplier * flowFiles.size(); removedBytes += contentSize; } else if (!selfRelationship) { flowFilesOut += multiplier * flowFiles.size(); contentSizeOut += multiplier * contentSize; } }
Example 10
Source File: AbstractPort.java From nifi with Apache License 2.0 | 5 votes |
@Override public Set<Connection> getConnections(final Relationship relationship) { readLock.lock(); try { if (relationship.equals(PORT_RELATIONSHIP)) { return Collections.unmodifiableSet(outgoingConnections); } throw new IllegalArgumentException("No relationship with name " + relationship.getName() + " exists for Local Ports"); } finally { readLock.unlock(); } }
Example 11
Source File: StandardFunnel.java From nifi with Apache License 2.0 | 5 votes |
@Override public Set<Connection> getConnections(final Relationship relationship) { readLock.lock(); try { if (relationship.equals(Relationship.ANONYMOUS)) { return Collections.unmodifiableSet(outgoingConnections); } throw new IllegalArgumentException("No relationship with name " + relationship.getName() + " exists for Funnels"); } finally { readLock.unlock(); } }
Example 12
Source File: StandardProcessSession.java From nifi with Apache License 2.0 | 5 votes |
@Override public void transfer(FlowFile flowFile, final Relationship relationship) { verifyTaskActive(); flowFile = validateRecordState(flowFile); final int numDestinations = context.getConnections(relationship).size(); final int multiplier = Math.max(1, numDestinations); boolean autoTerminated = false; boolean selfRelationship = false; if (numDestinations == 0 && context.getConnectable().isAutoTerminated(relationship)) { // auto terminated. autoTerminated = true; } else if (numDestinations == 0 && relationship == Relationship.SELF) { selfRelationship = true; } else if (numDestinations == 0) { // the relationship specified is not known in this session/context throw new IllegalArgumentException("Relationship '" + relationship.getName() + "' is not known"); } final StandardRepositoryRecord record = getRecord(flowFile); record.setTransferRelationship(relationship); updateLastQueuedDate(record); if (autoTerminated) { removedCount += multiplier; removedBytes += flowFile.getSize(); } else if (!selfRelationship) { flowFilesOut += multiplier; contentSizeOut += flowFile.getSize() * multiplier; } }
Example 13
Source File: StandardProcessSession.java From nifi with Apache License 2.0 | 5 votes |
@Override public void transfer(Collection<FlowFile> flowFiles, final Relationship relationship) { verifyTaskActive(); flowFiles = validateRecordState(flowFiles); boolean autoTerminated = false; boolean selfRelationship = false; final int numDestinations = context.getConnections(relationship).size(); if (numDestinations == 0 && context.getConnectable().isAutoTerminated(relationship)) { // auto terminated. autoTerminated = true; } else if (numDestinations == 0 && relationship == Relationship.SELF) { selfRelationship = true; } else if (numDestinations == 0) { // the relationship specified is not known in this session/context throw new IllegalArgumentException("Relationship '" + relationship.getName() + "' is not known"); } final int multiplier = Math.max(1, numDestinations); final long queuedTime = System.currentTimeMillis(); long contentSize = 0L; for (final FlowFile flowFile : flowFiles) { final FlowFileRecord flowFileRecord = (FlowFileRecord) flowFile; final StandardRepositoryRecord record = getRecord(flowFileRecord); record.setTransferRelationship(relationship); updateLastQueuedDate(record, queuedTime); contentSize += flowFile.getSize(); } if (autoTerminated) { removedCount += multiplier * flowFiles.size(); removedBytes += multiplier * contentSize; } else if (!selfRelationship) { flowFilesOut += multiplier * flowFiles.size(); contentSizeOut += multiplier * contentSize; } }
Example 14
Source File: StandardProvenanceEventRecord.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public Builder setRelationship(Relationship relationship) { this.relationship = relationship.getName(); return this; }
Example 15
Source File: StandardProvenanceEventRecord.java From nifi with Apache License 2.0 | 4 votes |
@Override public Builder setRelationship(Relationship relationship) { this.relationship = relationship.getName(); return this; }