Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

NIFIREG-242 Two-way synchronization of git repository backed flows #166

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4e1290d
rebuild registry metadata database by replaying git commits
Aug 2, 2018
fc735ae
integrate SyncResource
Aug 3, 2018
5c7d2c0
create interface to sync git repo two-way
Jan 18, 2019
f2278fc
make path separator compatible with windows environment
Feb 26, 2019
9c2b333
change file separator to be compatible with windows env in order to
Feb 27, 2019
d1aa2c5
reset metadata according to current status of remote repository
Feb 27, 2019
66e6d71
rename synchronizeRepositoryRemotely to
Feb 27, 2019
4a52b87
reload git repository after pulling changes
Feb 27, 2019
20362e9
change exception message
Feb 27, 2019
0837e1a
attach ProviderSynchronization to FlowPersistenceProvider- Interface
Mar 1, 2019
a45eff6
return existing buckets when git repository provider is inactive
Mar 19, 2019
5f5f6e3
run tests with and without git provider
Mar 19, 2019
350acd0
sync with simulated git repository
Mar 21, 2019
5e4e0e8
document sync and reset git repository
Mar 21, 2019
5590111
verify exception is thrown when provider does not support
Mar 21, 2019
32b97a7
get latest changes from remote repository
Mar 21, 2019
7a424e0
document resetting of git repository
Mar 22, 2019
9c96973
document pull changes
Mar 22, 2019
c0e0c3b
introduce GET- method to query status of synchronization
Mar 22, 2019
289cca3
get current repository status
Mar 25, 2019
de2725a
replace bucket metadata mapping with FlowMetadataSynchronizer
Mar 26, 2019
d3b9069
adapt tests to use getMetadata
Mar 26, 2019
540911e
renaming factory methods
Mar 26, 2019
2a1a2ce
refactor description of sync endpoints
Mar 27, 2019
ad29869
auto-wire GitFlowPersistenceProvider without static field
Mar 27, 2019
c32562f
extend documentation of sync rest api
Mar 27, 2019
6c50b6d
backup & restore current git project dir if reset process has been
Mar 27, 2019
7ccca08
reset repository without providing a repository uri
Mar 27, 2019
fb9afc4
Delete .dockerignore because it is not needed for NiFi contribution
Apr 1, 2019
a2314d3
Update .gitignore to exclude changes made by us for NiFi contribution
Apr 1, 2019
e50dc16
fix errors introduced by interactive rebase
Apr 1, 2019
f9c5241
prevent execution of this test on windows systems because of incompat…
Apr 1, 2019
848a31d
extract author, comment and created timestamp from git commit
Apr 1, 2019
14ad196
remove duplicate Synchronization interface
Apr 1, 2019
16b1460
change code as a result of the contrib check
Apr 2, 2019
9c0e5e1
replace instanceOf check with canBeSynchronized check
Apr 5, 2019
69f2d1c
rename createBucketsFromGitProvider to createBucketsFromProvider
Apr 5, 2019
637510c
Merge remote-tracking branch 'apache/master' into NIFIREG-242
Apr 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.sh text eol=lf
*.py text eol=lf
*.yml text eol=lf
*.conf text eol=lf
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ nb-configuration.xml
*.iml
*.iws
*~

/bin/
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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.sync;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.xml.bind.annotation.XmlRootElement;
import java.util.Collection;

@XmlRootElement
@ApiModel(value = "RepositorySyncStatus")
public class RepositorySyncStatus {
private boolean isClean;
private boolean hasChanges;
private Collection<String> changes;

public RepositorySyncStatus(boolean isClean, boolean hasChanges, Collection<String> changes) {
this.isClean = isClean;
this.hasChanges = hasChanges;
this.changes = changes;
}

public RepositorySyncStatus(){}

@ApiModelProperty(value = "Repository is in sync with registry.", required = true)
public boolean getIsClean() {
return isClean;
}
public void setIsClean(boolean isClean) {
this.isClean = isClean;
}

@ApiModelProperty(value = "The repository contains changes not reflected in registry.", required = true)
public boolean getHasChanges() {
return this.hasChanges;
}
public void setHasChanges(boolean hasChanges) {
this.hasChanges = hasChanges;
}

@ApiModelProperty(value = "List of changes in the repository which should be synchronized with registry.", required = true)
public Collection<String> getChanges() {
return this.changes;
}
public void setChanges(Collection<String> changes) {
this.changes = changes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.nifi.registry.flow.FlowSnapshotContext;
import org.apache.nifi.registry.provider.ProviderConfigurationContext;
import org.apache.nifi.registry.provider.ProviderCreationException;
import org.apache.nifi.registry.provider.sync.RepositorySyncStatus;
import org.apache.nifi.registry.util.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -183,4 +184,23 @@ protected File getSnapshotFile(final String bucketId, final String flowId, final
return new File(flowStorageDir, snapshotFilename);
}

@Override
public Boolean canBeSynchronized() {
return false;
}

@Override
public void getLatestChangesOfRemoteRepository() {

}

@Override
public void resetRepository() {

}

@Override
public RepositorySyncStatus getStatus() {
return RepositorySyncStatus.SuccessfulSynchronizedRepository();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.nifi.registry.provider.flow.git;

import org.apache.nifi.registry.util.FileUtils;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
Expand All @@ -39,10 +41,14 @@ public boolean hasVersion(int version) {
return versions.containsKey(version);
}

public FlowPointer getFlowVersion(int version) {
public FlowPointer getFlowVersion(int version){
return versions.get(version);
}

public String getFlowId(){
return this.flowId;
}

public void putVersion(int version, FlowPointer pointer) {
versions.put(version, pointer);
}
Expand All @@ -65,7 +71,7 @@ public static class FlowPointer {

/**
* Create new FlowPointer instance.
* @param fileName The filename must be sanitized, use {@link org.apache.nifi.registry.util.FileUtils#sanitizeFilename(String)} to do so.
* @param fileName The filename must be sanitized, use {@link FileUtils#sanitizeFilename(String)} to do so.
*/
public FlowPointer(String fileName) {
this.fileName = fileName;
Expand Down
Loading