forked from apache/nifi
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring to create base class for other git-based flow registry cl…
…ients Working GitLab client Fix bug where frontend not submitting branch on Change Flow Version dialog
- Loading branch information
Showing
23 changed files
with
1,615 additions
and
611 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
33 changes: 33 additions & 0 deletions
33
nifi-extension-bundles/nifi-extension-utils/nifi-git-flow-registry/pom.xml
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,33 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.apache.nifi</groupId> | ||
<artifactId>nifi-extension-utils</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>nifi-git-flow-registry</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.module</groupId> | ||
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
644 changes: 644 additions & 0 deletions
644
...gistry/src/main/java/org/apache/nifi/registry/flow/git/AbstractGitFlowRegistryClient.java
Large diffs are not rendered by default.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
...i-git-flow-registry/src/main/java/org/apache/nifi/registry/flow/git/client/GitCommit.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,87 @@ | ||
/* | ||
* 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.registry.flow.git.client; | ||
|
||
import java.util.Date; | ||
import java.util.Objects; | ||
|
||
public class GitCommit { | ||
|
||
private final String id; | ||
private final String author; | ||
private final String message; | ||
private final Date commitDate; | ||
|
||
private GitCommit(final Builder builder) { | ||
this.id = Objects.requireNonNull(builder.id, "Id is required"); | ||
this.author = Objects.requireNonNull(builder.author, "Author is required"); | ||
this.commitDate = Objects.requireNonNull(builder.commitDate, "Commit Date is required"); | ||
this.message = builder.message; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getAuthor() { | ||
return author; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public Date getCommitDate() { | ||
return commitDate; | ||
} | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
public static final class Builder { | ||
private String id; | ||
private String author; | ||
private String message; | ||
private Date commitDate; | ||
|
||
public Builder id(final String id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public Builder author(final String author) { | ||
this.author = author; | ||
return this; | ||
} | ||
|
||
public Builder message(final String message) { | ||
this.message = message; | ||
return this; | ||
} | ||
|
||
public Builder commitDate(final Date commitDate) { | ||
this.commitDate = commitDate; | ||
return this; | ||
} | ||
|
||
public GitCommit build() { | ||
return new GitCommit(this); | ||
} | ||
} | ||
} |
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
58 changes: 58 additions & 0 deletions
58
...-registry/src/main/java/org/apache/nifi/registry/flow/git/client/GitRepositoryClient.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,58 @@ | ||
/* | ||
* 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.registry.flow.git.client; | ||
|
||
import org.apache.nifi.registry.flow.FlowRegistryException; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
/** | ||
* Client for git repository. | ||
*/ | ||
public interface GitRepositoryClient { | ||
|
||
boolean getCanRead(); | ||
|
||
boolean getCanWrite(); | ||
|
||
Set<String> getBranches() throws IOException, FlowRegistryException; | ||
|
||
Set<String> getTopLevelDirectoryNames(String branch) throws IOException, FlowRegistryException; | ||
|
||
Set<String> getFileNames(String directory, String branch) throws IOException, FlowRegistryException; | ||
|
||
List<GitCommit> getCommits(String path, String branch) throws IOException, FlowRegistryException; | ||
|
||
InputStream getContentFromBranch(String path, String branch) throws IOException, FlowRegistryException; | ||
|
||
InputStream getContentFromCommit(String path, String commitSha) throws IOException, FlowRegistryException; | ||
|
||
Optional<String> getContentSha(String path, String branch) throws IOException, FlowRegistryException; | ||
|
||
String createContent(GitCreateContentRequest request) throws IOException, FlowRegistryException; | ||
|
||
InputStream deleteContent(String filePath, String commitMessage, String branch) throws FlowRegistryException, IOException; | ||
|
||
default void close() throws IOException { | ||
|
||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.