-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First, `ImportSpecification` is now devoid of any "business" logic. It has instead become a simple target for JSON/Yaml deserialization. This commit introduces `ImportPipeline` which takes care of A LOT of boilerplate when writing an import-spec backend. It wraps sources, actions and targets as tasks and sorts them accordingly. The task classes provide helper functions to resolve key/non-key properties, start/end nodes. BREAKING CHANGE: source names must now be globally unique, since this simplifies the pipeline construction logic quite a bit.
- Loading branch information
Showing
37 changed files
with
1,774 additions
and
1,072 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
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
373 changes: 145 additions & 228 deletions
373
examples/apache-beam/src/test/java/org/neo4j/importer/BeamExampleIT.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
63 changes: 63 additions & 0 deletions
63
src/main/java/org/neo4j/importer/v1/pipeline/ActionStep.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,63 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [https://neo4j.com] | ||
* | ||
* Licensed 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.neo4j.importer.v1.pipeline; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
import org.neo4j.importer.v1.actions.Action; | ||
import org.neo4j.importer.v1.actions.ActionStage; | ||
|
||
public class ActionStep implements ImportStep { | ||
|
||
private final Action action; | ||
private final List<ImportStep> dependencies; | ||
|
||
ActionStep(Action action, List<ImportStep> dependencies) { | ||
this.action = action; | ||
this.dependencies = dependencies; | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return action.getName(); | ||
} | ||
|
||
public ActionStage stage() { | ||
return action().getStage(); | ||
} | ||
|
||
public Action action() { | ||
return action; | ||
} | ||
|
||
@Override | ||
public List<ImportStep> dependencies() { | ||
return dependencies; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (!(o instanceof ActionStep)) return false; | ||
ActionStep that = (ActionStep) o; | ||
return Objects.equals(action, that.action) && Objects.equals(dependencies, that.dependencies); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(action, dependencies); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/org/neo4j/importer/v1/pipeline/CustomQueryTargetStep.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,53 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [https://neo4j.com] | ||
* | ||
* Licensed 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.neo4j.importer.v1.pipeline; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
import org.neo4j.importer.v1.targets.CustomQueryTarget; | ||
|
||
public class CustomQueryTargetStep extends TargetStep { | ||
|
||
private final CustomQueryTarget target; | ||
|
||
CustomQueryTargetStep(CustomQueryTarget target, List<ImportStep> dependencies) { | ||
super(dependencies); | ||
this.target = target; | ||
} | ||
|
||
public String query() { | ||
return target.getQuery(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (!(o instanceof CustomQueryTargetStep)) return false; | ||
if (!super.equals(o)) return false; | ||
CustomQueryTargetStep that = (CustomQueryTargetStep) o; | ||
return Objects.equals(target, that.target); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(super.hashCode(), target); | ||
} | ||
|
||
@Override | ||
protected CustomQueryTarget target() { | ||
return target; | ||
} | ||
} |
Oops, something went wrong.