forked from apache/nifi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NIFI-6873: Added support for replacing a process group
- decoupled flow update request behavior from VersionsResource into new abstract FlowUpdateResource - added replace process group functionality in ProcessGroupResource - parameterized FlowUpdateResource and created entity hierarchies to allow for maximum code sharing across different update types - refactored flow update methods to make use of commonality across different update types whenever possible - fixed issues in StandardProcessGroup verify update methods where same components existed in different ancestry chains but were considered a match when they shouldn't be - improved StandardProcessGroup to properly match up components on update using generated versioned component ids, when necessary to allow for update flow to efficiently match common components on flow import This closes apache#4023. Signed-off-by: Mark Payne <[email protected]>
- Loading branch information
Showing
25 changed files
with
1,757 additions
and
1,110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
...ework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowUpdateRequestDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.nifi.web.api.dto; | ||
|
||
import io.swagger.annotations.ApiModelProperty; | ||
import org.apache.nifi.web.api.dto.util.TimestampAdapter; | ||
|
||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | ||
import java.util.Date; | ||
|
||
public abstract class FlowUpdateRequestDTO { | ||
protected String requestId; | ||
protected String processGroupId; | ||
protected String uri; | ||
protected Date lastUpdated; | ||
protected boolean complete = false; | ||
protected String failureReason; | ||
protected int percentCompleted; | ||
protected String state; | ||
|
||
@ApiModelProperty("The unique ID of the Process Group being updated") | ||
public String getProcessGroupId() { | ||
return processGroupId; | ||
} | ||
|
||
public void setProcessGroupId(String processGroupId) { | ||
this.processGroupId = processGroupId; | ||
} | ||
|
||
@ApiModelProperty(value = "The unique ID of this request.", readOnly = true) | ||
public String getRequestId() { | ||
return requestId; | ||
} | ||
|
||
public void setRequestId(String requestId) { | ||
this.requestId = requestId; | ||
} | ||
|
||
@ApiModelProperty(value = "The URI for future requests to this drop request.", readOnly = true) | ||
public String getUri() { | ||
return uri; | ||
} | ||
|
||
public void setUri(String uri) { | ||
this.uri = uri; | ||
} | ||
|
||
@XmlJavaTypeAdapter(TimestampAdapter.class) | ||
@ApiModelProperty(value = "The last time this request was updated.", dataType = "string", readOnly = true) | ||
public Date getLastUpdated() { | ||
return lastUpdated; | ||
} | ||
|
||
public void setLastUpdated(Date lastUpdated) { | ||
this.lastUpdated = lastUpdated; | ||
} | ||
|
||
@ApiModelProperty(value = "Whether or not this request has completed", readOnly = true) | ||
public boolean isComplete() { | ||
return complete; | ||
} | ||
|
||
public void setComplete(boolean complete) { | ||
this.complete = complete; | ||
} | ||
|
||
@ApiModelProperty(value = "An explanation of why this request failed, or null if this request has not failed", readOnly = true) | ||
public String getFailureReason() { | ||
return failureReason; | ||
} | ||
|
||
public void setFailureReason(String reason) { | ||
this.failureReason = reason; | ||
} | ||
|
||
@ApiModelProperty(value = "The state of the request", readOnly = true) | ||
public String getState() { | ||
return state; | ||
} | ||
|
||
public void setState(String state) { | ||
this.state = state; | ||
} | ||
|
||
@ApiModelProperty(value = "The percentage complete for the request, between 0 and 100", readOnly = true) | ||
public int getPercentCompleted() { | ||
return percentCompleted; | ||
} | ||
|
||
public void setPercentCompleted(int percentCompleted) { | ||
this.percentCompleted = percentCompleted; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...i-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupReplaceRequestDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.nifi.web.api.dto; | ||
|
||
import javax.xml.bind.annotation.XmlType; | ||
|
||
@XmlType(name = "processGroupReplaceRequest") | ||
public class ProcessGroupReplaceRequestDTO extends FlowUpdateRequestDTO { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowUpdateRequestEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.nifi.web.api.entity; | ||
|
||
import io.swagger.annotations.ApiModelProperty; | ||
import org.apache.nifi.web.api.dto.FlowUpdateRequestDTO; | ||
import org.apache.nifi.web.api.dto.RevisionDTO; | ||
|
||
public abstract class FlowUpdateRequestEntity<T extends FlowUpdateRequestDTO> extends Entity { | ||
protected RevisionDTO processGroupRevision; | ||
protected T request; | ||
|
||
@ApiModelProperty("The revision for the Process Group being updated.") | ||
public RevisionDTO getProcessGroupRevision() { | ||
return processGroupRevision; | ||
} | ||
|
||
public void setProcessGroupRevision(RevisionDTO revision) { | ||
this.processGroupRevision = revision; | ||
} | ||
|
||
@ApiModelProperty("The Process Group Update Request") | ||
public abstract T getRequest(); | ||
|
||
public abstract void setRequest(T request); | ||
} |
50 changes: 50 additions & 0 deletions
50
...client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupDescriptorEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.nifi.web.api.entity; | ||
|
||
import io.swagger.annotations.ApiModelProperty; | ||
import org.apache.nifi.web.api.dto.RevisionDTO; | ||
|
||
/** | ||
* Common abstract entity shared by VersionControlInformationEntity and ProcessGroupImportEntity for | ||
* generically processing/replicating process group update requests | ||
*/ | ||
public abstract class ProcessGroupDescriptorEntity extends Entity { | ||
private RevisionDTO processGroupRevision; | ||
private Boolean disconnectedNodeAcknowledged; | ||
|
||
@ApiModelProperty("The Revision for the Process Group") | ||
public RevisionDTO getProcessGroupRevision() { | ||
return processGroupRevision; | ||
} | ||
|
||
public void setProcessGroupRevision(RevisionDTO revision) { | ||
this.processGroupRevision = revision; | ||
} | ||
|
||
@ApiModelProperty( | ||
value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed." | ||
) | ||
public Boolean isDisconnectedNodeAcknowledged() { | ||
return disconnectedNodeAcknowledged; | ||
} | ||
|
||
public void setDisconnectedNodeAcknowledged(Boolean disconnectedNodeAcknowledged) { | ||
this.disconnectedNodeAcknowledged = disconnectedNodeAcknowledged; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...ifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupImportEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.nifi.web.api.entity; | ||
|
||
import io.swagger.annotations.ApiModelProperty; | ||
import org.apache.nifi.registry.flow.VersionedFlowSnapshot; | ||
|
||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
/** | ||
* Entity for importing a process group that has been previously downloaded | ||
*/ | ||
@XmlRootElement(name = "processGroupImportEntity") | ||
public class ProcessGroupImportEntity extends ProcessGroupDescriptorEntity { | ||
private VersionedFlowSnapshot versionedFlowSnapshot; | ||
|
||
@ApiModelProperty("The Versioned Flow Snapshot to import") | ||
public VersionedFlowSnapshot getVersionedFlowSnapshot() { | ||
return versionedFlowSnapshot; | ||
} | ||
|
||
public void setVersionedFlowSnapshot(VersionedFlowSnapshot versionedFlowSnapshot) { | ||
this.versionedFlowSnapshot = versionedFlowSnapshot; | ||
} | ||
} |
Oops, something went wrong.