private Map<String, String> mapProperties(final ComponentNode component, final ControllerServiceProvider serviceProvider) { final Map<String, String> mapped = new HashMap<>(); component.getProperties().keySet().stream() .filter(property -> !property.isSensitive()) .forEach(property -> { String value = component.getProperty(property); if (value == null) { value = property.getDefaultValue(); } if (value != null && property.getControllerServiceDefinition() != null) { // Property references a Controller Service. Instead of storing the existing value, we want // to store the Versioned Component ID of the service. final ControllerServiceNode controllerService = serviceProvider.getControllerServiceNode(value); if (controllerService != null) { value = getId(controllerService.getVersionedComponentId(), controllerService.getIdentifier()); } } mapped.put(property.getName(), value); }); return mapped; }
versionedGroup.setIdentifier(getId(group.getVersionedComponentId(), group.getIdentifier())); versionedGroup.setGroupIdentifier(getGroupId(group.getProcessGroupIdentifier())); versionedGroup.setName(group.getName()); getId(port.getVersionedComponentId(), port.getIdentifier()); getId(port.getVersionedComponentId(), port.getIdentifier());
public VersionedConnection mapConnection(final Connection connection) { final FlowFileQueue queue = connection.getFlowFileQueue(); final VersionedConnection versionedConnection = new InstantiatedVersionedConnection(connection.getIdentifier(), connection.getProcessGroup().getIdentifier()); versionedConnection.setIdentifier(getId(connection.getVersionedComponentId(), connection.getIdentifier())); versionedConnection.setGroupIdentifier(getGroupId(connection.getProcessGroup().getIdentifier())); versionedConnection.setName(connection.getName()); versionedConnection.setBackPressureDataSizeThreshold(queue.getBackPressureDataSizeThreshold()); versionedConnection.setBackPressureObjectThreshold(queue.getBackPressureObjectThreshold()); versionedConnection.setFlowFileExpiration(queue.getFlowFileExpiration()); versionedConnection.setLabelIndex(connection.getLabelIndex()); versionedConnection.setPrioritizers(queue.getPriorities().stream().map(p -> p.getClass().getName()).collect(Collectors.toList())); versionedConnection.setSelectedRelationships(connection.getRelationships().stream().map(Relationship::getName).collect(Collectors.toSet())); versionedConnection.setzIndex(connection.getZIndex()); final FlowFileQueue flowFileQueue = connection.getFlowFileQueue(); versionedConnection.setLoadBalanceStrategy(flowFileQueue.getLoadBalanceStrategy().name()); versionedConnection.setPartitioningAttribute(flowFileQueue.getPartitioningAttribute()); versionedConnection.setLoadBalanceCompression(flowFileQueue.getLoadBalanceCompression().name()); versionedConnection.setBends(connection.getBendPoints().stream() .map(this::mapPosition) .collect(Collectors.toList())); versionedConnection.setSource(mapConnectable(connection.getSource())); versionedConnection.setDestination(mapConnectable(connection.getDestination())); return versionedConnection; }
public VersionedFunnel mapFunnel(final Funnel funnel) { final VersionedFunnel versionedFunnel = new InstantiatedVersionedFunnel(funnel.getIdentifier(), funnel.getProcessGroupIdentifier()); versionedFunnel.setIdentifier(getId(funnel.getVersionedComponentId(), funnel.getIdentifier())); versionedFunnel.setGroupIdentifier(getGroupId(funnel.getProcessGroupIdentifier())); versionedFunnel.setPosition(mapPosition(funnel.getPosition())); return versionedFunnel; }
public VersionedRemoteProcessGroup mapRemoteProcessGroup(final RemoteProcessGroup remoteGroup) { final VersionedRemoteProcessGroup rpg = new InstantiatedVersionedRemoteProcessGroup(remoteGroup.getIdentifier(), remoteGroup.getProcessGroupIdentifier()); rpg.setIdentifier(getId(remoteGroup.getVersionedComponentId(), remoteGroup.getIdentifier())); rpg.setGroupIdentifier(getGroupId(remoteGroup.getProcessGroupIdentifier())); rpg.setComments(remoteGroup.getComments()); rpg.setCommunicationsTimeout(remoteGroup.getCommunicationsTimeout()); rpg.setLocalNetworkInterface(remoteGroup.getNetworkInterface()); rpg.setName(remoteGroup.getName()); rpg.setInputPorts(remoteGroup.getInputPorts().stream() .map(port -> mapRemotePort(port, ComponentType.REMOTE_INPUT_PORT)) .collect(Collectors.toSet())); rpg.setOutputPorts(remoteGroup.getOutputPorts().stream() .map(port -> mapRemotePort(port, ComponentType.REMOTE_OUTPUT_PORT)) .collect(Collectors.toSet())); rpg.setPosition(mapPosition(remoteGroup.getPosition())); rpg.setProxyHost(remoteGroup.getProxyHost()); rpg.setProxyPort(remoteGroup.getProxyPort()); rpg.setProxyUser(remoteGroup.getProxyUser()); rpg.setTargetUri(remoteGroup.getTargetUri()); rpg.setTargetUris(remoteGroup.getTargetUris()); rpg.setTransportProtocol(remoteGroup.getTransportProtocol().name()); rpg.setYieldDuration(remoteGroup.getYieldDuration()); return rpg; }
public VersionedLabel mapLabel(final Label label) { final VersionedLabel versionedLabel = new InstantiatedVersionedLabel(label.getIdentifier(), label.getProcessGroupIdentifier()); versionedLabel.setIdentifier(getId(label.getVersionedComponentId(), label.getIdentifier())); versionedLabel.setGroupIdentifier(getGroupId(label.getProcessGroupIdentifier())); versionedLabel.setHeight(label.getSize().getHeight()); versionedLabel.setWidth(label.getSize().getWidth()); versionedLabel.setLabel(label.getValue()); versionedLabel.setPosition(mapPosition(label.getPosition())); versionedLabel.setStyle(label.getStyle()); return versionedLabel; }
public VersionedPort mapPort(final Port port) { final VersionedPort versionedPort = new InstantiatedVersionedPort(port.getIdentifier(), port.getProcessGroupIdentifier()); versionedPort.setIdentifier(getId(port.getVersionedComponentId(), port.getIdentifier())); versionedPort.setGroupIdentifier(getGroupId(port.getProcessGroupIdentifier())); versionedPort.setComments(port.getComments()); versionedPort.setConcurrentlySchedulableTaskCount(port.getMaxConcurrentTasks()); versionedPort.setName(port.getName()); versionedPort.setPosition(mapPosition(port.getPosition())); versionedPort.setType(PortType.valueOf(port.getConnectableType().name())); return versionedPort; }
public VersionedProcessor mapProcessor(final ProcessorNode procNode, final ControllerServiceProvider serviceProvider) { final VersionedProcessor processor = new InstantiatedVersionedProcessor(procNode.getIdentifier(), procNode.getProcessGroupIdentifier()); processor.setIdentifier(getId(procNode.getVersionedComponentId(), procNode.getIdentifier())); processor.setGroupIdentifier(getGroupId(procNode.getProcessGroupIdentifier())); processor.setType(procNode.getCanonicalClassName()); processor.setAnnotationData(procNode.getAnnotationData()); processor.setAutoTerminatedRelationships(procNode.getAutoTerminatedRelationships().stream().map(Relationship::getName).collect(Collectors.toSet())); processor.setBulletinLevel(procNode.getBulletinLevel().name()); processor.setBundle(mapBundle(procNode.getBundleCoordinate())); processor.setComments(procNode.getComments()); processor.setConcurrentlySchedulableTaskCount(procNode.getMaxConcurrentTasks()); processor.setExecutionNode(procNode.getExecutionNode().name()); processor.setName(procNode.getName()); processor.setPenaltyDuration(procNode.getPenalizationPeriod()); processor.setPosition(mapPosition(procNode.getPosition())); processor.setProperties(mapProperties(procNode, serviceProvider)); processor.setPropertyDescriptors(mapPropertyDescriptors(procNode)); processor.setRunDurationMillis(procNode.getRunDuration(TimeUnit.MILLISECONDS)); processor.setSchedulingPeriod(procNode.getSchedulingPeriod()); processor.setSchedulingStrategy(procNode.getSchedulingStrategy().name()); processor.setStyle(procNode.getStyle()); processor.setYieldDuration(procNode.getYieldPeriod()); return processor; }
public VersionedControllerService mapControllerService(final ControllerServiceNode controllerService, final ControllerServiceProvider serviceProvider) { final VersionedControllerService versionedService = new InstantiatedVersionedControllerService(controllerService.getIdentifier(), controllerService.getProcessGroupIdentifier()); versionedService.setIdentifier(getId(controllerService.getVersionedComponentId(), controllerService.getIdentifier())); versionedService.setGroupIdentifier(getGroupId(controllerService.getProcessGroupIdentifier())); versionedService.setName(controllerService.getName()); versionedService.setAnnotationData(controllerService.getAnnotationData()); versionedService.setBundle(mapBundle(controllerService.getBundleCoordinate())); versionedService.setComments(controllerService.getComments()); versionedService.setControllerServiceApis(mapControllerServiceApis(controllerService)); versionedService.setProperties(mapProperties(controllerService, serviceProvider)); versionedService.setPropertyDescriptors(mapPropertyDescriptors(controllerService)); versionedService.setType(controllerService.getCanonicalClassName()); return versionedService; }
public VersionedRemoteGroupPort mapRemotePort(final RemoteGroupPort remotePort, final ComponentType componentType) { final VersionedRemoteGroupPort port = new InstantiatedVersionedRemoteGroupPort(remotePort.getIdentifier(), remotePort.getRemoteProcessGroup().getIdentifier()); port.setIdentifier(getId(remotePort.getVersionedComponentId(), remotePort.getIdentifier())); port.setGroupIdentifier(getGroupId(remotePort.getRemoteProcessGroup().getIdentifier())); port.setComments(remotePort.getComments()); port.setConcurrentlySchedulableTaskCount(remotePort.getMaxConcurrentTasks()); port.setRemoteGroupId(getGroupId(remotePort.getRemoteProcessGroup().getIdentifier())); port.setName(remotePort.getName()); port.setUseCompression(remotePort.isUseCompression()); port.setBatchSize(mapBatchSettings(remotePort)); port.setTargetId(remotePort.getTargetIdentifier()); port.setComponentType(componentType); return port; }