Search in sources :

Example 1 with StandardRemoteProcessGroupPortDescriptor

use of org.apache.nifi.remote.StandardRemoteProcessGroupPortDescriptor in project nifi by apache.

the class FlowController method convertRemotePort.

/**
 * 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;
}
Also used : BatchSettingsDTO(org.apache.nifi.web.api.dto.BatchSettingsDTO) StandardRemoteProcessGroupPortDescriptor(org.apache.nifi.remote.StandardRemoteProcessGroupPortDescriptor) RemoteProcessGroupPortDescriptor(org.apache.nifi.groups.RemoteProcessGroupPortDescriptor) StandardRemoteProcessGroupPortDescriptor(org.apache.nifi.remote.StandardRemoteProcessGroupPortDescriptor) RemoteProcessGroupPortDTO(org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO)

Example 2 with StandardRemoteProcessGroupPortDescriptor

use of org.apache.nifi.remote.StandardRemoteProcessGroupPortDescriptor in project nifi by apache.

the class StandardProcessGroup method createPortDescriptor.

private RemoteProcessGroupPortDescriptor createPortDescriptor(final VersionedRemoteGroupPort proposed, final String componentIdSeed, final String rpgId) {
    final StandardRemoteProcessGroupPortDescriptor descriptor = new StandardRemoteProcessGroupPortDescriptor();
    descriptor.setVersionedComponentId(proposed.getIdentifier());
    final BatchSize batchSize = proposed.getBatchSize();
    if (batchSize != null) {
        descriptor.setBatchCount(batchSize.getCount());
        descriptor.setBatchDuration(batchSize.getDuration());
        descriptor.setBatchSize(batchSize.getSize());
    }
    descriptor.setComments(proposed.getComments());
    descriptor.setConcurrentlySchedulableTaskCount(proposed.getConcurrentlySchedulableTaskCount());
    descriptor.setGroupId(proposed.getRemoteGroupId());
    descriptor.setTargetId(proposed.getTargetId());
    descriptor.setId(generateUuid(proposed.getIdentifier(), rpgId, componentIdSeed));
    descriptor.setName(proposed.getName());
    descriptor.setUseCompression(proposed.isUseCompression());
    return descriptor;
}
Also used : StandardRemoteProcessGroupPortDescriptor(org.apache.nifi.remote.StandardRemoteProcessGroupPortDescriptor) BatchSize(org.apache.nifi.registry.flow.BatchSize)

Example 3 with StandardRemoteProcessGroupPortDescriptor

use of org.apache.nifi.remote.StandardRemoteProcessGroupPortDescriptor in project nifi by apache.

the class FlowFromDOMFactory method getRemoteProcessGroupPort.

public static RemoteProcessGroupPortDescriptor getRemoteProcessGroupPort(final Element element) {
    final StandardRemoteProcessGroupPortDescriptor descriptor = new StandardRemoteProcessGroupPortDescriptor();
    // What we have serialized is the ID of the Remote Process Group, followed by a dash ('-'), followed by
    // the actual ID of the port; we want to get rid of the remote process group id.
    String id = getString(element, "id");
    if (id.length() > 37) {
        id = id.substring(37);
    }
    descriptor.setId(id);
    final String targetId = getString(element, "targetId");
    descriptor.setTargetId(targetId == null ? id : targetId);
    descriptor.setVersionedComponentId(getString(element, "versionedComponentId"));
    descriptor.setName(getString(element, "name"));
    descriptor.setComments(getString(element, "comments"));
    descriptor.setConcurrentlySchedulableTaskCount(getInt(element, "maxConcurrentTasks"));
    descriptor.setUseCompression(getBoolean(element, "useCompression"));
    descriptor.setBatchCount(getOptionalInt(element, "batchCount"));
    descriptor.setBatchSize(getString(element, "batchSize"));
    descriptor.setBatchDuration(getString(element, "batchDuration"));
    descriptor.setTransmitting("RUNNING".equalsIgnoreCase(getString(element, "scheduledState")));
    return descriptor;
}
Also used : StandardRemoteProcessGroupPortDescriptor(org.apache.nifi.remote.StandardRemoteProcessGroupPortDescriptor)

Aggregations

StandardRemoteProcessGroupPortDescriptor (org.apache.nifi.remote.StandardRemoteProcessGroupPortDescriptor)3 RemoteProcessGroupPortDescriptor (org.apache.nifi.groups.RemoteProcessGroupPortDescriptor)1 BatchSize (org.apache.nifi.registry.flow.BatchSize)1 BatchSettingsDTO (org.apache.nifi.web.api.dto.BatchSettingsDTO)1 RemoteProcessGroupPortDTO (org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO)1