public StandardLabel(final String identifier, final String value) { this(identifier, new Position(0D, 0D), new HashMap<String, String>(), value, null); }
public StandardProcessGroup(final String id, final ControllerServiceProvider serviceProvider, final StandardProcessScheduler scheduler, final NiFiProperties nifiProps, final StringEncryptor encryptor, final FlowController flowController, final MutableVariableRegistry variableRegistry) { this.id = id; this.controllerServiceProvider = serviceProvider; this.parent = new AtomicReference<>(); this.scheduler = scheduler; this.comments = new AtomicReference<>(""); this.encryptor = encryptor; this.flowController = flowController; this.variableRegistry = variableRegistry; this.flowManager = flowController.getFlowManager(); name = new AtomicReference<>(); position = new AtomicReference<>(new Position(0D, 0D)); }
public StandardFunnel(final String identifier, final ProcessGroup processGroup, final ProcessScheduler scheduler) { this.identifier = identifier; this.processGroupRef = new AtomicReference<>(processGroup); outgoingConnections = new HashSet<>(); incomingConnections = new ArrayList<>(); final List<Relationship> relationships = new ArrayList<>(); relationships.add(Relationship.ANONYMOUS); this.relationships = Collections.unmodifiableList(relationships); lossTolerant = new AtomicBoolean(false); position = new AtomicReference<>(new Position(0D, 0D)); scheduledState = new AtomicReference<>(ScheduledState.STOPPED); penalizationPeriod = new AtomicReference<>("30 sec"); yieldPeriod = new AtomicReference<>("250 millis"); yieldExpiration = new AtomicLong(0L); schedulingPeriod = new AtomicReference<>("0 millis"); schedulingNanos = new AtomicLong(MINIMUM_SCHEDULING_NANOS); name = new AtomicReference<>("Funnel"); }
public AbstractPort(final String id, final String name, final ProcessGroup processGroup, final ConnectableType type, final ProcessScheduler scheduler) { this.id = requireNonNull(id); this.name = new AtomicReference<>(requireNonNull(name)); position = new AtomicReference<>(new Position(0D, 0D)); outgoingConnections = new HashSet<>(); incomingConnections = new ArrayList<>(); comments = new AtomicReference<>(); lossTolerant = new AtomicBoolean(false); concurrentTaskCount = new AtomicInteger(1); processScheduler = scheduler; final List<Relationship> relationshipList = new ArrayList<>(); relationshipList.add(PORT_RELATIONSHIP); relationships = Collections.unmodifiableList(relationshipList); this.processGroup = new AtomicReference<>(processGroup); this.type = type; penalizationPeriod = new AtomicReference<>("30 sec"); yieldPeriod = new AtomicReference<>("1 sec"); yieldExpiration = new AtomicLong(0L); schedulingPeriod = new AtomicReference<>("0 millis"); schedulingNanos = new AtomicLong(MINIMUM_SCHEDULING_NANOS); scheduledState = new AtomicReference<>(ScheduledState.STOPPED); }
private Position toPosition(final PositionDTO dto) { return new Position(dto.getX(), dto.getY()); }
private Position toPosition(final PositionDTO dto) { return new Position(dto.getX(), dto.getY()); }
private static Position scalePosition(Position position, double factorX, double factorY) { return new Position(position.getX() * factorX, position.getY() * factorY); }
private Position toPosition(final PositionDTO dto) { return new Position(dto.getX(), dto.getY()); }
private void updateFunnel(final Funnel funnel, final VersionedFunnel proposed) { funnel.setPosition(new Position(proposed.getPosition().getX(), proposed.getPosition().getY())); }
private void updateRemoteProcessGroup(final RemoteProcessGroup rpg, final VersionedRemoteProcessGroup proposed, final String componentIdSeed) { rpg.setComments(proposed.getComments()); rpg.setCommunicationsTimeout(proposed.getCommunicationsTimeout()); rpg.setInputPorts(proposed.getInputPorts() == null ? Collections.emptySet() : proposed.getInputPorts().stream() .map(port -> createPortDescriptor(port, componentIdSeed, rpg.getIdentifier())) .collect(Collectors.toSet()), false); rpg.setName(proposed.getName()); rpg.setNetworkInterface(proposed.getLocalNetworkInterface()); rpg.setOutputPorts(proposed.getOutputPorts() == null ? Collections.emptySet() : proposed.getOutputPorts().stream() .map(port -> createPortDescriptor(port, componentIdSeed, rpg.getIdentifier())) .collect(Collectors.toSet()), false); rpg.setPosition(new Position(proposed.getPosition().getX(), proposed.getPosition().getY())); rpg.setProxyHost(proposed.getProxyHost()); rpg.setProxyPort(proposed.getProxyPort()); rpg.setProxyUser(proposed.getProxyUser()); rpg.setTransportProtocol(SiteToSiteTransportProtocol.valueOf(proposed.getTransportProtocol())); rpg.setYieldDuration(proposed.getYieldDuration()); }
private void updatePort(final Port port, final VersionedPort proposed) { port.setComments(proposed.getComments()); port.setName(proposed.getName()); port.setPosition(new Position(proposed.getPosition().getX(), proposed.getPosition().getY())); }
@Override public Funnel updateFunnel(FunnelDTO funnelDTO) { // get the funnel being updated Funnel funnel = locateFunnel(funnelDTO.getId()); // update the label state if (isNotNull(funnelDTO.getPosition())) { if (funnelDTO.getPosition() != null) { funnel.setPosition(new Position(funnelDTO.getPosition().getX(), funnelDTO.getPosition().getY())); } } funnel.getProcessGroup().onComponentModified(); return funnel; }
private void updateLabel(final Label label, final VersionedLabel proposed) { label.setPosition(new Position(proposed.getPosition().getX(), proposed.getPosition().getY())); label.setSize(new Size(proposed.getWidth(), proposed.getHeight())); label.setStyle(proposed.getStyle()); label.setValue(proposed.getLabel()); }
@Override public Funnel createFunnel(String groupId, FunnelDTO funnelDTO) { if (funnelDTO.getParentGroupId() != null && !flowController.getFlowManager().areGroupsSame(groupId, funnelDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Funnel is being added."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // create the funnel Funnel funnel = flowController.getFlowManager().createFunnel(funnelDTO.getId()); if (funnelDTO.getPosition() != null) { funnel.setPosition(new Position(funnelDTO.getPosition().getX(), funnelDTO.getPosition().getY())); } // add the funnel group.addFunnel(funnel); group.startFunnel(funnel); return funnel; }
@Override public ProcessGroup createProcessGroup(String parentGroupId, ProcessGroupDTO processGroup) { final FlowManager flowManager = flowController.getFlowManager(); if (processGroup.getParentGroupId() != null && !flowManager.areGroupsSame(processGroup.getParentGroupId(), parentGroupId)) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Process Group is being added."); } // get the parent group ProcessGroup parentGroup = locateProcessGroup(flowController, parentGroupId); // create the process group ProcessGroup group = flowManager.createProcessGroup(processGroup.getId()); if (processGroup.getName() != null) { group.setName(processGroup.getName()); } if (processGroup.getPosition() != null) { group.setPosition(new Position(processGroup.getPosition().getX(), processGroup.getPosition().getY())); } // add the process group group.setParent(parentGroup); parentGroup.addProcessGroup(group); return group; }
@Override public Port createPort(String groupId, PortDTO portDTO) { if (isNotNull(portDTO.getParentGroupId()) && !flowController.getFlowManager().areGroupsSame(groupId, portDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the OutputPort is being added."); } // ensure the name has been specified if (portDTO.getName() == null) { throw new IllegalArgumentException("Port name must be specified."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // determine if this is the root group Port port; if (group.getParent() == null) { port = flowController.getFlowManager().createRemoteOutputPort(portDTO.getId(), portDTO.getName()); } else { port = flowController.getFlowManager().createLocalOutputPort(portDTO.getId(), portDTO.getName()); } // ensure we can perform the update before we add the processor to the flow verifyUpdate(port, portDTO); // configure if (portDTO.getPosition() != null) { port.setPosition(new Position(portDTO.getPosition().getX(), portDTO.getPosition().getY())); } port.setComments(portDTO.getComments()); // add the port group.addOutputPort(port); return port; }
@Override public Label createLabel(String groupId, LabelDTO labelDTO) { if (labelDTO.getParentGroupId() != null && !flowController.getFlowManager().areGroupsSame(groupId, labelDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Label is being added."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // create the label Label label = flowController.getFlowManager().createLabel(labelDTO.getId(), labelDTO.getLabel()); if (labelDTO.getPosition() != null) { label.setPosition(new Position(labelDTO.getPosition().getX(), labelDTO.getPosition().getY())); } if (labelDTO.getWidth() != null && labelDTO.getHeight() != null) { label.setSize(new Size(labelDTO.getWidth(), labelDTO.getHeight())); } label.setStyle(labelDTO.getStyle()); // add the label group.addLabel(label); return label; }
@Override public ProcessGroup updateProcessGroup(ProcessGroupDTO processGroupDTO) { final ProcessGroup group = locateProcessGroup(flowController, processGroupDTO.getId()); final String name = processGroupDTO.getName(); final String comments = processGroupDTO.getComments(); if (isNotNull(name)) { group.setName(name); } if (isNotNull(processGroupDTO.getPosition())) { group.setPosition(new Position(processGroupDTO.getPosition().getX(), processGroupDTO.getPosition().getY())); final ProcessGroup parent = group.getParent(); if (parent != null) { parent.onComponentModified(); } } if (isNotNull(comments)) { group.setComments(comments); } group.onComponentModified(); return group; }
@Override public Label updateLabel(LabelDTO labelDTO) { // get the label being updated Label label = locateLabel(labelDTO.getId()); // update the label state if (labelDTO.getPosition() != null) { label.setPosition(new Position(labelDTO.getPosition().getX(), labelDTO.getPosition().getY())); } if (labelDTO.getStyle() != null) { label.setStyle(labelDTO.getStyle()); } if (labelDTO.getLabel() != null) { label.setValue(labelDTO.getLabel()); } if (labelDTO.getWidth() != null && labelDTO.getHeight() != null) { label.setSize(new Size(labelDTO.getWidth(), labelDTO.getHeight())); } label.getProcessGroup().onComponentModified(); return label; }
private void updateProcessor(final ProcessorNode processor, final VersionedProcessor proposed) throws ProcessorInstantiationException { processor.pauseValidationTrigger(); try { processor.setAnnotationData(proposed.getAnnotationData()); processor.setBulletinLevel(LogLevel.valueOf(proposed.getBulletinLevel())); processor.setComments(proposed.getComments()); processor.setName(proposed.getName()); processor.setPenalizationPeriod(proposed.getPenaltyDuration()); final Map<String, String> properties = populatePropertiesMap(processor.getProperties(), proposed.getProperties(), proposed.getPropertyDescriptors(), processor.getProcessGroup()); processor.setProperties(properties, true); processor.setRunDuration(proposed.getRunDurationMillis(), TimeUnit.MILLISECONDS); processor.setSchedulingStrategy(SchedulingStrategy.valueOf(proposed.getSchedulingStrategy())); processor.setScheduldingPeriod(proposed.getSchedulingPeriod()); processor.setMaxConcurrentTasks(proposed.getConcurrentlySchedulableTaskCount()); processor.setExecutionNode(ExecutionNode.valueOf(proposed.getExecutionNode())); processor.setStyle(proposed.getStyle()); processor.setYieldPeriod(proposed.getYieldDuration()); processor.setPosition(new Position(proposed.getPosition().getX(), proposed.getPosition().getY())); if (!isEqual(processor.getBundleCoordinate(), proposed.getBundle())) { final BundleCoordinate newBundleCoordinate = toCoordinate(proposed.getBundle()); final List<PropertyDescriptor> descriptors = new ArrayList<>(processor.getProperties().keySet()); final Set<URL> additionalUrls = processor.getAdditionalClasspathResources(descriptors); flowController.getReloadComponent().reload(processor, proposed.getType(), newBundleCoordinate, additionalUrls); } } finally { processor.resumeValidationTrigger(); } }