@Override public Authorizable getSourceAuthorizable() { final Connectable sourceConnectable = getSource(); final Authorizable sourceAuthorizable; // if the source is a remote group port, authorize according to the RPG if (sourceConnectable instanceof RemoteGroupPort) { sourceAuthorizable = ((RemoteGroupPort) sourceConnectable).getRemoteProcessGroup(); } else { sourceAuthorizable = sourceConnectable; } return sourceAuthorizable; }
@Override public Authorizable getDestinationAuthorizable() { final Connectable destinationConnectable = getDestination(); final Authorizable destinationAuthorizable; // if the destination is a remote group port, authorize according to the RPG if (destinationConnectable instanceof RemoteGroupPort) { destinationAuthorizable = ((RemoteGroupPort) destinationConnectable).getRemoteProcessGroup(); } else { destinationAuthorizable = destinationConnectable; } return destinationAuthorizable; }
public void stopTransmitting(final RemoteGroupPort remoteGroupPort) { writeLock.lock(); try { if (initialized.get()) { remoteGroupPort.getRemoteProcessGroup().stopTransmitting(remoteGroupPort); } else { startRemoteGroupPortsAfterInitialization.remove(remoteGroupPort); } } finally { writeLock.unlock("stopTransmitting"); } }
public void startTransmitting(final RemoteGroupPort remoteGroupPort) { writeLock.lock(); try { if (initialized.get()) { remoteGroupPort.getRemoteProcessGroup().startTransmitting(remoteGroupPort); } else { startRemoteGroupPortsAfterInitialization.add(remoteGroupPort); } } finally { writeLock.unlock("startTransmitting"); } }
private Authorizable getAuthorizable(final Connectable connectable) { switch (connectable.getConnectableType()) { case REMOTE_INPUT_PORT: case REMOTE_OUTPUT_PORT: final String rpgId = ((RemoteGroupPort) connectable).getRemoteProcessGroup().getIdentifier(); return authorizableLookup.getRemoteProcessGroup(rpgId); default: return authorizableLookup.getLocalConnectable(connectable.getIdentifier()); } }
@Override public Authorizable createRemoteDataAuthorizable(String remoteGroupPortId) { final DataAuthorizable authorizable; final RemoteGroupPort remoteGroupPort = flowController.getFlowManager().getRootGroup().findRemoteGroupPort(remoteGroupPortId); if (remoteGroupPort == null) { throw new ResourceNotFoundException("The component that generated this event is no longer part of the data flow."); } else { // authorizable for remote group ports should be the remote process group authorizable = new DataAuthorizable(remoteGroupPort.getRemoteProcessGroup()); } return authorizable; }
final RemoteGroupPort remoteGroupPort = (RemoteGroupPort) connectable; if (TransferDirection.RECEIVE.equals(remoteGroupPort.getTransferDirection())) { if (remoteGroupPort.getRemoteProcessGroup() == null) { componentType = Component.InputPort; } else { if (remoteGroupPort.getRemoteProcessGroup() == null) { componentType = Component.OutputPort; } else {
for (final RemoteGroupPort remoteGroupPort : startRemoteGroupPortsAfterInitialization) { try { remoteGroupPort.getRemoteProcessGroup().startTransmitting(remoteGroupPort); startedTransmitting++; } catch (final Throwable t) {
case REMOTE_OUTPUT_PORT: final RemoteGroupPort remotePort = (RemoteGroupPort) connectable; remotePort.getRemoteProcessGroup().startTransmitting(remotePort); break; case REMOTE_OUTPUT_PORT: final RemoteGroupPort remotePort = (RemoteGroupPort) connectable; remotePort.getRemoteProcessGroup().stopTransmitting(remotePort); break;
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; }
if (currentDestination.getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) { RemoteGroupPort remotePort = (RemoteGroupPort) currentDestination; if (!proposedDestination.getGroupId().equals(remotePort.getRemoteProcessGroup().getIdentifier())) { isDifferentRemoteProcessGroup = true;
public ConnectableComponent mapConnectable(final Connectable connectable) { final ConnectableComponent component = new InstantiatedConnectableComponent(connectable.getIdentifier(), connectable.getProcessGroupIdentifier()); final String versionedId = getIdOrThrow(connectable.getVersionedComponentId(), connectable.getIdentifier(), () -> new IllegalArgumentException("Unable to map Connectable Component with identifier " + connectable.getIdentifier() + " to any version-controlled component")); component.setId(versionedId); component.setComments(connectable.getComments()); final String groupId; if (connectable instanceof RemoteGroupPort) { final RemoteGroupPort port = (RemoteGroupPort) connectable; final RemoteProcessGroup rpg = port.getRemoteProcessGroup(); final Optional<String> rpgVersionedId = rpg.getVersionedComponentId(); groupId = getIdOrThrow(rpgVersionedId, rpg.getIdentifier(), () -> new IllegalArgumentException("Unable to find the Versioned Component ID for Remote Process Group that " + connectable + " belongs to")); } else { groupId = getIdOrThrow(connectable.getProcessGroup().getVersionedComponentId(), connectable.getProcessGroupIdentifier(), () -> new IllegalArgumentException("Unable to find the Versioned Component ID for the Process Group that " + connectable + " belongs to")); } component.setGroupId(groupId); component.setName(connectable.getName()); component.setType(ConnectableComponentType.valueOf(connectable.getConnectableType().name())); return component; }
final String sourceGroupId; if (sourceType == ConnectableType.REMOTE_OUTPUT_PORT) { sourceGroupId = ((RemoteGroupPort) connection.getSource()).getRemoteProcessGroup().getIdentifier(); } else { sourceGroupId = connection.getSource().getProcessGroup().getIdentifier(); final String destinationGroupId; if (destinationType == ConnectableType.REMOTE_INPUT_PORT) { destinationGroupId = ((RemoteGroupPort) connection.getDestination()).getRemoteProcessGroup().getIdentifier(); } else { destinationGroupId = connection.getDestination().getProcessGroup().getIdentifier();
private AffectedComponentEntity createAffectedComponentEntity(final Connectable connectable) { final AffectedComponentEntity entity = new AffectedComponentEntity(); entity.setRevision(dtoFactory.createRevisionDTO(revisionManager.getRevision(connectable.getIdentifier()))); entity.setId(connectable.getIdentifier()); final Authorizable authorizable = getAuthorizable(connectable); final PermissionsDTO permissionsDto = dtoFactory.createPermissionsDto(authorizable); entity.setPermissions(permissionsDto); final AffectedComponentDTO dto = new AffectedComponentDTO(); dto.setId(connectable.getIdentifier()); dto.setReferenceType(connectable.getConnectableType().name()); dto.setState(connectable.getScheduledState().name()); final String groupId = connectable instanceof RemoteGroupPort ? ((RemoteGroupPort) connectable).getRemoteProcessGroup().getIdentifier() : connectable.getProcessGroupIdentifier(); dto.setProcessGroupId(groupId); entity.setComponent(dto); return entity; }
public RemoteProcessGroupPortDTO createRemoteProcessGroupPortDto(final RemoteGroupPort port) { if (port == null) { return null; } final RemoteProcessGroupPortDTO dto = new RemoteProcessGroupPortDTO(); dto.setId(port.getIdentifier()); dto.setGroupId(port.getRemoteProcessGroup().getIdentifier()); dto.setTargetId(port.getTargetIdentifier()); dto.setName(port.getName()); dto.setComments(port.getComments()); dto.setTransmitting(port.isRunning()); dto.setTargetRunning(port.isTargetRunning()); dto.setConcurrentlySchedulableTaskCount(port.getMaxConcurrentTasks()); dto.setUseCompression(port.isUseCompression()); dto.setExists(port.getTargetExists()); dto.setVersionedComponentId(port.getVersionedComponentId().orElse(null)); final BatchSettingsDTO batchDTO = new BatchSettingsDTO(); batchDTO.setCount(port.getBatchCount()); batchDTO.setSize(port.getBatchSize()); batchDTO.setDuration(port.getBatchDuration()); dto.setBatchSettings(batchDTO); // determine if this port is currently connected to another component locally if (ConnectableType.REMOTE_OUTPUT_PORT.equals(port.getConnectableType())) { dto.setConnected(!port.getConnections().isEmpty()); } else { dto.setConnected(port.hasIncomingConnection()); } return dto; }
final RemoteProcessGroup remoteGroup = remoteGroupPort.getRemoteProcessGroup(); dto.setGroupId(remoteGroup.getIdentifier()); dto.setRunning(remoteGroupPort.isTargetRunning());