Java Code Examples for org.apache.nifi.connectable.ConnectableType#INPUT_PORT
The following examples show how to use
org.apache.nifi.connectable.ConnectableType#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: AbstractPort.java From localization_nifi with Apache License 2.0 | 6 votes |
@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: TestStandardRootGroupPort.java From localization_nifi with Apache License 2.0 | 6 votes |
private RootGroupPort createRootGroupPort(NiFiProperties nifiProperties) { final BulletinRepository bulletinRepository = mock(BulletinRepository.class); final ProcessScheduler processScheduler = null; final Authorizer authorizer = mock(Authorizer.class); doAnswer(invocation -> { final AuthorizationRequest request = invocation.getArgumentAt(0, AuthorizationRequest.class); if ("[email protected]".equals(request.getIdentity())) { return AuthorizationResult.approved(); } return AuthorizationResult.denied(); }).when(authorizer).authorize(any(AuthorizationRequest.class)); final ProcessGroup processGroup = mock(ProcessGroup.class); doReturn("process-group-id").when(processGroup).getIdentifier(); return new StandardRootGroupPort("id", "name", processGroup, TransferDirection.SEND, ConnectableType.INPUT_PORT, authorizer, bulletinRepository, processScheduler, true, nifiProperties); }
Example 3
Source File: AbstractPort.java From nifi with Apache License 2.0 | 6 votes |
@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 4
Source File: TestStandardPublicPort.java From nifi with Apache License 2.0 | 6 votes |
private PublicPort createPublicPort(NiFiProperties nifiProperties) { final BulletinRepository bulletinRepository = mock(BulletinRepository.class); final ProcessScheduler processScheduler = null; final Authorizer authorizer = mock(Authorizer.class); doAnswer(invocation -> { final AuthorizationRequest request = invocation.getArgument(0); if ("[email protected]".equals(request.getIdentity())) { return AuthorizationResult.approved(); } else if ("[email protected]".equals(request.getIdentity())) { return AuthorizationResult.approved(); } return AuthorizationResult.denied(); }).when(authorizer).authorize(any(AuthorizationRequest.class)); final ProcessGroup processGroup = mock(ProcessGroup.class); doReturn("process-group-id").when(processGroup).getIdentifier(); final StandardPublicPort port = new StandardPublicPort("id", "name", TransferDirection.SEND, ConnectableType.INPUT_PORT, authorizer, bulletinRepository, processScheduler, true, nifiProperties.getBoredYieldDuration(), IdentityMappingUtil.getIdentityMappings(nifiProperties)); port.setProcessGroup(processGroup); return port; }
Example 5
Source File: StandardConnectionDAO.java From localization_nifi with Apache License 2.0 | 5 votes |
private void verifyUpdate(final Connection connection, final ConnectionDTO connectionDTO) { // determine what the request is attempting if (isAnyNotNull(connectionDTO.getBackPressureDataSizeThreshold(), connectionDTO.getBackPressureObjectThreshold(), connectionDTO.getDestination(), connectionDTO.getFlowFileExpiration(), connectionDTO.getName(), connectionDTO.getPosition(), connectionDTO.getPrioritizers(), connectionDTO.getSelectedRelationships())) { // validate the incoming request final List<String> validationErrors = validateProposedConfiguration(connection.getProcessGroup().getIdentifier(), connectionDTO); // ensure there was no validation errors if (!validationErrors.isEmpty()) { throw new ValidationException(validationErrors); } // If destination is changing, ensure that current destination is not running. This check is done here, rather than // in the Connection object itself because the Connection object itself does not know which updates are to occur and // we don't want to prevent updating things like the connection name or backpressure just because the destination is running final Connectable destination = connection.getDestination(); if (destination != null && destination.isRunning() && destination.getConnectableType() != ConnectableType.FUNNEL && destination.getConnectableType() != ConnectableType.INPUT_PORT) { throw new ValidationException(Collections.singletonList("Cannot change the destination of connection because the current destination is running")); } // verify that this connection supports modification connection.verifyCanUpdate(); } }
Example 6
Source File: PortAuditor.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * Generates an audit record for the creation of the specified port. * * @param port port * @param operation operation * @param actionDetails details * @return action */ public Action generateAuditRecord(Port port, Operation operation, ActionDetails actionDetails) { FlowChangeAction action = null; // get the current user NiFiUser user = NiFiUserUtils.getNiFiUser(); // ensure the user was found if (user != null) { // determine the type of port Component componentType = Component.OutputPort; if (ConnectableType.INPUT_PORT == port.getConnectableType()) { componentType = Component.InputPort; } // create the port action for adding this processor action = new FlowChangeAction(); action.setUserIdentity(user.getIdentity()); action.setOperation(operation); action.setTimestamp(new Date()); action.setSourceId(port.getIdentifier()); action.setSourceName(port.getName()); action.setSourceType(componentType); if (actionDetails != null) { action.setActionDetails(actionDetails); } } return action; }
Example 7
Source File: StandardConnectionDAO.java From nifi with Apache License 2.0 | 5 votes |
private void verifyUpdate(final Connection connection, final ConnectionDTO connectionDTO) { // determine what the request is attempting if (isAnyNotNull(connectionDTO.getBackPressureDataSizeThreshold(), connectionDTO.getBackPressureObjectThreshold(), connectionDTO.getDestination(), connectionDTO.getFlowFileExpiration(), connectionDTO.getName(), connectionDTO.getPosition(), connectionDTO.getPrioritizers(), connectionDTO.getSelectedRelationships())) { // validate the incoming request final List<String> validationErrors = validateProposedConfiguration(connection.getProcessGroup().getIdentifier(), connectionDTO); // ensure there was no validation errors if (!validationErrors.isEmpty()) { throw new ValidationException(validationErrors); } // If destination is changing, ensure that current destination is not running. This check is done here, rather than // in the Connection object itself because the Connection object itself does not know which updates are to occur and // we don't want to prevent updating things like the connection name or backpressure just because the destination is running final Connectable destination = connection.getDestination(); if (destination != null && destination.isRunning() && destination.getConnectableType() != ConnectableType.FUNNEL && destination.getConnectableType() != ConnectableType.INPUT_PORT) { throw new ValidationException(Collections.singletonList("Cannot change the destination of connection because the current destination is running")); } // verify that this connection supports modification connection.verifyCanUpdate(); } }
Example 8
Source File: PortAuditor.java From nifi with Apache License 2.0 | 5 votes |
/** * Generates an audit record for the creation of the specified port. * * @param port port * @param operation operation * @param actionDetails details * @return action */ public Action generateAuditRecord(Port port, Operation operation, ActionDetails actionDetails) { FlowChangeAction action = null; // get the current user NiFiUser user = NiFiUserUtils.getNiFiUser(); // ensure the user was found if (user != null) { // determine the type of port Component componentType = Component.OutputPort; if (ConnectableType.INPUT_PORT == port.getConnectableType()) { componentType = Component.InputPort; } // create the port action for adding this processor action = new FlowChangeAction(); action.setUserIdentity(user.getIdentity()); action.setOperation(operation); action.setTimestamp(new Date()); action.setSourceId(port.getIdentifier()); action.setSourceName(port.getName()); action.setSourceType(componentType); if (actionDetails != null) { action.setActionDetails(actionDetails); } } return action; }
Example 9
Source File: StandardFlowManager.java From nifi with Apache License 2.0 | 5 votes |
public Port createPublicInputPort(String id, String name) { id = requireNonNull(id).intern(); name = requireNonNull(name).intern(); verifyPortIdDoesNotExist(id); return new StandardPublicPort(id, name, TransferDirection.RECEIVE, ConnectableType.INPUT_PORT, authorizer, bulletinRepository, processScheduler, isSiteToSiteSecure, nifiProperties.getBoredYieldDuration(), IdentityMappingUtil.getIdentityMappings(nifiProperties)); }
Example 10
Source File: StandardRootGroupPort.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public boolean isValid() { return getConnectableType() == ConnectableType.INPUT_PORT ? !getConnections(Relationship.ANONYMOUS).isEmpty() : true; }
Example 11
Source File: StandardProcessGroup.java From localization_nifi with Apache License 2.0 | 4 votes |
private boolean isInputPort(final Connectable connectable) { if (connectable.getConnectableType() != ConnectableType.INPUT_PORT) { return false; } return findInputPort(connectable.getIdentifier()) != null; }
Example 12
Source File: StandardPublicPort.java From nifi with Apache License 2.0 | 4 votes |
@Override public boolean isValid() { return getConnectableType() == ConnectableType.INPUT_PORT ? !getConnections(Relationship.ANONYMOUS).isEmpty() : true; }
Example 13
Source File: StandardFlowManager.java From nifi with Apache License 2.0 | 4 votes |
public Port createLocalInputPort(String id, String name) { id = requireNonNull(id).intern(); name = requireNonNull(name).intern(); verifyPortIdDoesNotExist(id); return new LocalPort(id, name, ConnectableType.INPUT_PORT, processScheduler, nifiProperties); }
Example 14
Source File: FlowController.java From localization_nifi with Apache License 2.0 | 3 votes |
/** * Creates a Port to use as an Input Port for a Process Group * * @param id port identifier * @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 createLocalInputPort(String id, String name) { id = requireNonNull(id).intern(); name = requireNonNull(name).intern(); verifyPortIdDoesNotExist(id); return new LocalPort(id, name, null, ConnectableType.INPUT_PORT, processScheduler); }
Example 15
Source File: FlowController.java From localization_nifi with Apache License 2.0 | 3 votes |
/** * Creates a Port to use as an Input Port for the root Process Group, which * is used for Site-to-Site communications * * @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 createRemoteInputPort(String id, String name) { id = requireNonNull(id).intern(); name = requireNonNull(name).intern(); verifyPortIdDoesNotExist(id); return new StandardRootGroupPort(id, name, null, TransferDirection.RECEIVE, ConnectableType.INPUT_PORT, authorizer, getBulletinRepository(), processScheduler, Boolean.TRUE.equals(isSiteToSiteSecure), nifiProperties); }