/** * Verified the specified remote port can be updated, if necessary. */ private void verifyUpdatePort(RemoteGroupPort port, RemoteProcessGroupPortDTO remoteProcessGroupPortDto) { // see if the remote process group can start/stop transmitting if (isNotNull(remoteProcessGroupPortDto.isTransmitting())) { if (!port.isRunning() && remoteProcessGroupPortDto.isTransmitting()) { port.verifyCanStart(); } else if (port.isRunning() && !remoteProcessGroupPortDto.isTransmitting()) { port.verifyCanStop(); } } // validate the proposed configuration final List<String> requestValidation = validateProposedRemoteProcessGroupPortConfiguration(port, remoteProcessGroupPortDto); // ensure there was no validation errors if (!requestValidation.isEmpty()) { throw new ValidationException(requestValidation); } // verify update when appropriate if (isAnyNotNull(remoteProcessGroupPortDto.getConcurrentlySchedulableTaskCount(), remoteProcessGroupPortDto.getUseCompression(), remoteProcessGroupPortDto.getBatchSettings())) { port.verifyCanUpdate(); } }
/** * * @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); } } }
descriptor.setConcurrentlySchedulableTaskCount(port.getConcurrentlySchedulableTaskCount()); descriptor.setTransmitting(port.isTransmitting()); descriptor.setUseCompression(port.getUseCompression()); final BatchSettingsDTO batchSettings = port.getBatchSettings(); if (batchSettings != null) {
public RemoteProcessGroupPortDTO copy(final RemoteProcessGroupPortDTO original) { final RemoteProcessGroupPortDTO copy = new RemoteProcessGroupPortDTO(); copy.setId(original.getId()); copy.setTargetId(original.getTargetId()); copy.setGroupId(original.getGroupId()); copy.setName(original.getName()); copy.setComments(original.getComments()); copy.setConnected(original.isConnected()); copy.setTargetRunning(original.isTargetRunning()); copy.setTransmitting(original.isTransmitting()); copy.setConcurrentlySchedulableTaskCount(original.getConcurrentlySchedulableTaskCount()); copy.setUseCompression(original.getUseCompression()); copy.setExists(original.getExists()); copy.setVersionedComponentId(original.getVersionedComponentId()); final BatchSettingsDTO batchOrg = original.getBatchSettings(); if (batchOrg != null) { final BatchSettingsDTO batchCopy = new BatchSettingsDTO(); batchCopy.setCount(batchOrg.getCount()); batchCopy.setSize(batchOrg.getSize()); batchCopy.setDuration(batchOrg.getDuration()); copy.setBatchSettings(batchCopy); } return copy; }
@Override public RemotePortSchema apply(RemoteProcessGroupPortDTO remoteProcessGroupPortDTO) { Map<String, Object> map = new HashMap<>(); // If a targetId is specified, it takes precedence over the original id final String targetId = remoteProcessGroupPortDTO.getTargetId(); map.put(ID_KEY, StringUtils.isNotBlank(targetId) ? targetId : remoteProcessGroupPortDTO.getId()); map.put(NAME_KEY, remoteProcessGroupPortDTO.getName()); map.put(CommonPropertyKeys.COMMENT_KEY, remoteProcessGroupPortDTO.getComments()); map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, remoteProcessGroupPortDTO.getConcurrentlySchedulableTaskCount()); map.put(CommonPropertyKeys.USE_COMPRESSION_KEY, remoteProcessGroupPortDTO.getUseCompression()); return new RemotePortSchema(map); } }
@Override public RemotePortSchema apply(RemoteProcessGroupPortDTO remoteProcessGroupPortDTO) { Map<String, Object> map = new HashMap<>(); // If a targetId is specified, it takes precedence over the original id final String targetId = remoteProcessGroupPortDTO.getTargetId(); map.put(ID_KEY, StringUtils.isNotBlank(targetId) ? targetId : remoteProcessGroupPortDTO.getId()); map.put(NAME_KEY, remoteProcessGroupPortDTO.getName()); map.put(CommonPropertyKeys.COMMENT_KEY, remoteProcessGroupPortDTO.getComments()); map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, remoteProcessGroupPortDTO.getConcurrentlySchedulableTaskCount()); map.put(CommonPropertyKeys.USE_COMPRESSION_KEY, remoteProcessGroupPortDTO.getUseCompression()); return new RemotePortSchema(map); } }