Java Code Examples for org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO#getBatchSettings()
The following examples show how to use
org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO#getBatchSettings() .
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: StandardRemoteProcessGroupDAO.java From nifi with Apache License 2.0 | 6 votes |
/** * * @param port Port instance to be updated. * @param remoteProcessGroupPortDto DTO containing updated remote process group port settings. * @param remoteProcessGroup If remoteProcessGroupPortDto has updated isTransmitting input, * this method will start or stop the port in this remoteProcessGroup as necessary. */ private void updatePort(RemoteGroupPort port, RemoteProcessGroupPortDTO remoteProcessGroupPortDto, RemoteProcessGroup remoteProcessGroup) { if (isNotNull(remoteProcessGroupPortDto.getConcurrentlySchedulableTaskCount())) { port.setMaxConcurrentTasks(remoteProcessGroupPortDto.getConcurrentlySchedulableTaskCount()); } if (isNotNull(remoteProcessGroupPortDto.getUseCompression())) { port.setUseCompression(remoteProcessGroupPortDto.getUseCompression()); } final BatchSettingsDTO batchSettingsDTO = remoteProcessGroupPortDto.getBatchSettings(); if (isNotNull(batchSettingsDTO)) { port.setBatchCount(batchSettingsDTO.getCount()); port.setBatchSize(batchSettingsDTO.getSize()); port.setBatchDuration(batchSettingsDTO.getDuration()); } final Boolean isTransmitting = remoteProcessGroupPortDto.isTransmitting(); if (isNotNull(isTransmitting)) { // start or stop as necessary if (!port.isRunning() && isTransmitting) { remoteProcessGroup.startTransmitting(port); } else if (port.isRunning() && !isTransmitting) { remoteProcessGroup.stopTransmitting(port); } } }
Example 2
Source File: StandardRemoteProcessGroupDAO.java From nifi with Apache License 2.0 | 5 votes |
/** * Validates the proposed configuration for the specified remote port. */ private List<String> validateProposedRemoteProcessGroupPortConfiguration(RemoteGroupPort remoteGroupPort, RemoteProcessGroupPortDTO remoteProcessGroupPortDTO) { final List<String> validationErrors = new ArrayList<>(); // ensure the proposed port configuration is valid if (isNotNull(remoteProcessGroupPortDTO.getConcurrentlySchedulableTaskCount()) && remoteProcessGroupPortDTO.getConcurrentlySchedulableTaskCount() <= 0) { validationErrors.add(String.format("Concurrent tasks for port '%s' must be a positive integer.", remoteGroupPort.getName())); } final BatchSettingsDTO batchSettingsDTO = remoteProcessGroupPortDTO.getBatchSettings(); if (batchSettingsDTO != null) { final Integer batchCount = batchSettingsDTO.getCount(); if (isNotNull(batchCount) && batchCount < 0) { validationErrors.add(String.format("Batch count for port '%s' must be a positive integer.", remoteGroupPort.getName())); } final String batchSize = batchSettingsDTO.getSize(); if (isNotNull(batchSize) && batchSize.length() > 0 && !DataUnit.DATA_SIZE_PATTERN.matcher(batchSize.trim().toUpperCase()).matches()) { validationErrors.add(String.format("Batch size for port '%s' must be of format <Data Size> <Data Unit>" + " where <Data Size> is a non-negative integer and <Data Unit> is a supported Data" + " Unit, such as: B, KB, MB, GB, TB", remoteGroupPort.getName())); } final String batchDuration = batchSettingsDTO.getDuration(); if (isNotNull(batchDuration) && batchDuration.length() > 0 && !FormatUtils.TIME_DURATION_PATTERN.matcher(batchDuration.trim().toLowerCase()).matches()) { validationErrors.add(String.format("Batch duration for port '%s' must be of format <duration> <TimeUnit>" + " where <duration> is a non-negative integer and TimeUnit is a supported Time Unit, such " + "as: nanos, millis, secs, mins, hrs, days", remoteGroupPort.getName())); } } return validationErrors; }
Example 3
Source File: StandardFlowSnippet.java From nifi with Apache License 2.0 | 5 votes |
/** * Converts a set of ports into a set of remote process group ports. * * @param ports ports * @return group descriptors */ private Set<RemoteProcessGroupPortDescriptor> convertRemotePort(final Set<RemoteProcessGroupPortDTO> ports) { Set<RemoteProcessGroupPortDescriptor> remotePorts = null; if (ports != null) { remotePorts = new LinkedHashSet<>(ports.size()); for (final RemoteProcessGroupPortDTO port : ports) { final StandardRemoteProcessGroupPortDescriptor descriptor = new StandardRemoteProcessGroupPortDescriptor(); descriptor.setId(port.getId()); descriptor.setVersionedComponentId(port.getVersionedComponentId()); descriptor.setTargetId(port.getTargetId()); descriptor.setName(port.getName()); descriptor.setComments(port.getComments()); descriptor.setTargetRunning(port.isTargetRunning()); descriptor.setConnected(port.isConnected()); descriptor.setConcurrentlySchedulableTaskCount(port.getConcurrentlySchedulableTaskCount()); descriptor.setTransmitting(port.isTransmitting()); descriptor.setUseCompression(port.getUseCompression()); final BatchSettingsDTO batchSettings = port.getBatchSettings(); if (batchSettings != null) { descriptor.setBatchCount(batchSettings.getCount()); descriptor.setBatchSize(batchSettings.getSize()); descriptor.setBatchDuration(batchSettings.getDuration()); } remotePorts.add(descriptor); } } return remotePorts; }