Skip to content

Commit 08b7bcf

Browse files
committed
chore: init
0 parents  commit 08b7bcf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2488
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.yaml]
12+
indent_size = 2

.gitattributes

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# This file is inspired by https://github.com/alexkaratarakis/gitattributes
2+
#
3+
# Auto detect text files and perform LF normalization
4+
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
5+
* text=auto
6+
7+
# The above will handle all files NOT found below
8+
# These files are text and should be normalized (Convert crlf => lf)
9+
10+
*.bat text eol=crlf
11+
*.coffee text
12+
*.css text
13+
*.cql text
14+
*.df text
15+
*.ejs text
16+
*.html text
17+
*.java text
18+
*.js text
19+
*.json text
20+
*.less text
21+
*.properties text
22+
*.sass text
23+
*.scss text
24+
*.sh text eol=lf
25+
*.sql text
26+
*.txt text
27+
*.ts text
28+
*.xml text
29+
*.yaml text
30+
*.yml text
31+
32+
# Documents
33+
*.doc diff=astextplain
34+
*.DOC diff=astextplain
35+
*.docx diff=astextplain
36+
*.DOCX diff=astextplain
37+
*.dot diff=astextplain
38+
*.DOT diff=astextplain
39+
*.pdf diff=astextplain
40+
*.PDF diff=astextplain
41+
*.rtf diff=astextplain
42+
*.RTF diff=astextplain
43+
*.markdown text
44+
*.md text
45+
*.adoc text
46+
*.textile text
47+
*.mustache text
48+
*.csv text
49+
*.tab text
50+
*.tsv text
51+
*.txt text
52+
AUTHORS text
53+
CHANGELOG text
54+
CHANGES text
55+
CONTRIBUTING text
56+
COPYING text
57+
copyright text
58+
*COPYRIGHT* text
59+
INSTALL text
60+
license text
61+
LICENSE text
62+
NEWS text
63+
readme text
64+
*README* text
65+
TODO text
66+
67+
# Graphics
68+
*.png binary
69+
*.jpg binary
70+
*.jpeg binary
71+
*.gif binary
72+
*.tif binary
73+
*.tiff binary
74+
*.ico binary
75+
# SVG treated as an asset (binary) by default. If you want to treat it as text,
76+
# comment-out the following line and uncomment the line after.
77+
*.svg binary
78+
#*.svg text
79+
*.eps binary
80+
*.keystore binary
81+
*.cer binary
82+
83+
# These files are binary and should be left untouched
84+
# (binary is a macro for -text -diff)
85+
*.class binary
86+
*.jar binary
87+
*.war binary
88+
89+
## LINTERS
90+
.csslintrc text
91+
.eslintrc text
92+
.jscsrc text
93+
.jshintrc text
94+
.jshintignore text
95+
.stylelintrc text
96+
97+
## CONFIGS
98+
*.conf text
99+
*.config text
100+
.editorconfig text
101+
.gitattributes text
102+
.gitconfig text
103+
.gitignore text
104+
.htaccess text
105+
*.npmignore text
106+
107+
## HEROKU
108+
Procfile text
109+
.slugignore text
110+
111+
112+
Earthfile text
113+
114+
## AUDIO
115+
*.kar binary
116+
*.m4a binary
117+
*.mid binary
118+
*.midi binary
119+
*.mp3 binary
120+
*.ogg binary
121+
*.ra binary
122+
123+
## VIDEO
124+
*.3gpp binary
125+
*.3gp binary
126+
*.as binary
127+
*.asf binary
128+
*.asx binary
129+
*.fla binary
130+
*.flv binary
131+
*.m4v binary
132+
*.mng binary
133+
*.mov binary
134+
*.mp4 binary
135+
*.mpeg binary
136+
*.mpg binary
137+
*.swc binary
138+
*.swf binary
139+
*.webm binary
140+
141+
## ARCHIVES
142+
*.7z binary
143+
*.gz binary
144+
*.rar binary
145+
*.tar binary
146+
*.zip binary
147+
148+
## FONTS
149+
*.ttf binary
150+
*.eot binary
151+
*.otf binary
152+
*.woff binary
153+
*.woff2 binary

.github/workflows/publication.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publication
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
8+
env:
9+
COMMIT_OWNER: ${{ github.event.pusher.name }}
10+
COMMIT_SHA: ${{ github.sha }}
11+
PIPELINE_ID: ${{ github.run_number }}
12+
13+
jobs:
14+
deploy_artifacts:
15+
name: Deploy Artifacts
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up JDK
20+
uses: actions/setup-java@v1
21+
with:
22+
java-version: '11'
23+
- name: Deploy artifacts
24+
run: |
25+
export VERSION_HEADER=$'Version: GnuPG v2\n\n'
26+
export ORG_GRADLE_PROJECT_signingKey=${GPG_PRIVATE_KEY#"$VERSION_HEADER"}
27+
export ORG_GRADLE_PROJECT_signingPassword="$GPG_PASSPHRASE"
28+
./gradlew publish --stacktrace --no-parallel
29+
env:
30+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
31+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
32+
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
33+
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
34+
- name: Track error step
35+
uses: spring-projects/track-build-errors-action@v1
36+
if: ${{ failure() }}
37+
with:
38+
job-name: ${{ github.job }}
39+
- name: Export errors file
40+
uses: actions/upload-artifact@v2
41+
if: ${{ failure() }}
42+
with:
43+
name: errors
44+
path: job-${{ github.job }}.txt

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
6+
.idea

.sdkmanrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Enable auto-env through the sdkman_auto_env config
2+
# Add key=value pairs of SDKs to use below
3+
java=11.0.2-open
4+
gradle=7.6

.version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1

build.gradle

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
mavenLocal()
5+
}
6+
}
7+
8+
plugins {
9+
id 'org.ajoberstar.grgit' apply false
10+
}
11+
12+
subprojects {
13+
apply plugin: 'java-library'
14+
apply from: "${rootProject.rootDir}/gradle/version.gradle"
15+
apply from: "${rootProject.rootDir}/gradle/reversion.gradle"
16+
apply from: "${rootProject.rootDir}/gradle/bom.gradle"
17+
apply from: "${rootProject.rootDir}/gradle/lombok.gradle"
18+
apply from: "${rootProject.rootDir}/gradle/publication.gradle"
19+
20+
repositories {
21+
mavenCentral()
22+
mavenLocal()
23+
}
24+
25+
compileJava {
26+
options.encoding = 'UTF-8'
27+
options.compilerArgs << '-parameters'
28+
}
29+
30+
compileTestJava {
31+
options.encoding = 'UTF-8'
32+
}
33+
34+
java {
35+
sourceCompatibility = JavaVersion.VERSION_11
36+
targetCompatibility = JavaVersion.VERSION_11
37+
}
38+
39+
dependencies {
40+
testImplementation "org.mockito:mockito-junit-jupiter"
41+
}
42+
43+
testing {
44+
suites {
45+
test {
46+
useJUnitJupiter("${jUnitVersion}")
47+
}
48+
}
49+
}
50+
}

dataflow-core/build.gradle

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
dependencies {
2+
api "org.apache.flink:flink-java"
3+
api "org.apache.flink:flink-shaded-guava"
4+
api "org.apache.flink:flink-table-api-java"
5+
api "org.apache.flink:flink-streaming-java"
6+
api "org.apache.flink:flink-table-api-java-bridge"
7+
api "org.apache.flink:flink-table-planner-loader"
8+
api "org.apache.flink:flink-table-runtime"
9+
api "org.apache.flink:flink-clients"
10+
api "org.apache.logging.log4j:log4j-api"
11+
api "org.apache.logging.log4j:log4j-core"
12+
api "org.apache.logging.log4j:log4j-slf4j-impl"
13+
api "org.slf4j:slf4j-log4j12"
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.qwlabs.dataflow;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
import org.apache.flink.api.java.utils.ParameterTool;
5+
6+
import java.util.Arrays;
7+
8+
@Slf4j
9+
public class Args {
10+
private static final String CONFIG_KEY = "config";
11+
private static final String PROFILE_KEY = "profile";
12+
private final ParameterTool pt;
13+
14+
public Args(String[] args) {
15+
LOGGER.info("Args is: {}", Arrays.toString(args));
16+
this.pt = ParameterTool.fromArgs(args);
17+
}
18+
19+
public String configPath() {
20+
return pt.get(CONFIG_KEY);
21+
}
22+
23+
public String profile() {
24+
return pt.get(PROFILE_KEY);
25+
}
26+
27+
public String get(String key) {
28+
return pt.get(key);
29+
}
30+
31+
public static Args of(String[] args) {
32+
return new Args(args);
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.qwlabs.dataflow;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
import org.apache.flink.api.java.utils.ParameterTool;
5+
import org.apache.flink.shaded.guava30.com.google.common.base.Suppliers;
6+
7+
import java.io.IOException;
8+
import java.util.function.Supplier;
9+
10+
@Slf4j
11+
public class ConfigFile {
12+
private static final String DEFAULT_CONFIG_PATH = "application.properties";
13+
private final String configPath;
14+
private final Supplier<ParameterTool> ptSupplier = Suppliers.memoize(this::load);
15+
16+
17+
public ConfigFile(String configPath) {
18+
this.configPath = configPath;
19+
}
20+
21+
public static ConfigFile of(String configPath) {
22+
return new ConfigFile(configPath);
23+
}
24+
25+
public ParameterTool get() {
26+
return ptSupplier.get();
27+
}
28+
29+
private ParameterTool load() {
30+
if (configPath == null) {
31+
return getDefault();
32+
}
33+
try {
34+
return ParameterTool.fromPropertiesFile(configPath);
35+
} catch (IOException e) {
36+
LOGGER.error("Load config from file '{}' error.", configPath, e);
37+
throw new RuntimeException(e);
38+
}
39+
}
40+
41+
private ParameterTool getDefault() {
42+
try {
43+
return ParameterTool.fromPropertiesFile(ConfigFile.class.getClassLoader().getResourceAsStream(DEFAULT_CONFIG_PATH));
44+
} catch (IOException e) {
45+
LOGGER.error("Load default config file error.", e);
46+
throw new RuntimeException(e);
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)