Skip to content

Commit dc1aa67

Browse files
authored
Merge pull request #30 from RADAR-base/plugin
Plugin
2 parents 5515af7 + 598f64e commit dc1aa67

Some content is hidden

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

61 files changed

+3268
-1271
lines changed

.travis.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,21 @@ cache:
1212
- $HOME/.gradle/native
1313
- $HOME/.gradle/wrapper
1414

15+
before_install:
16+
- ./gradlew downloadDependencies
17+
1518
deploy:
16-
provider: releases
17-
api_key: ${GH_TOKEN}
18-
file_glob: true
19-
file: "build/libs/*.jar"
20-
skip_cleanup: true
21-
on:
22-
tags: true
19+
- provider: releases
20+
api_key: ${GH_TOKEN}
21+
file_glob: true
22+
file:
23+
- "build/libs/*.jar"
24+
skip_cleanup: true
25+
on:
26+
tags: true
27+
- provider: script
28+
script: ./gradlew bintrayUpload
29+
skip_cleanup: true
30+
on:
31+
tags: true
2332

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ MAINTAINER Joris Borgdorff <[email protected]>
3535

3636
LABEL description="RADAR-base HDFS data restructuring"
3737

38+
ENV JAVA_OPTS -Djava.library.path=${HADOOP_HOME}/lib/native
39+
3840
COPY --from=builder /code/build/third-party/* /usr/lib/
3941
COPY --from=builder /code/build/scripts/* /usr/bin/
4042
COPY --from=builder /code/build/libs/* /usr/lib/
4143

42-
ENV JAVA_OPTS -Djava.library.path=${HADOOP_HOME}/lib/native
43-
4444
ENTRYPOINT ["radar-hdfs-restructure"]

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,16 @@ radar-hdfs-restructure --compression gzip --hdfs-uri <webhdfs_url> --output-dir
5959

6060
By default, files records are not deduplicated after writing. To enable this behaviour, specify the option `--deduplicate` or `-d`. This set to false by default because of an issue with Biovotion data. Please see - [issue #16](https://github.com/RADAR-base/Restructure-HDFS-topic/issues/16) before enabling it.
6161

62-
Finally, while processing, files are staged to a temporary directory and moved to the output directory afterwards. This has the advantage of less chance of data corruption, but it may result in slower performance. Disable staging using the `--no-stage` option.
62+
## Extending the connector
63+
64+
To implement alternative storage paths, storage drivers or storage formats, put your custom JAR in
65+
`$APP_DIR/lib/radar-hdfs-plugins`. To load them, use the following options:
66+
67+
| Option | Class | Behaviour | Default |
68+
| ----------------------- | ------------------------------------------- | ------------------------------------------ | ------------------------- |
69+
| `--path-factory` | `org.radarcns.hdfs.RecordPathFactory` | Factory to create output path names with. | ObservationKeyPathFactory |
70+
| `--storage-driver` | `org.radarcns.hdfs.data.StorageDriver` | Storage driver to use for storing data. | LocalStorageDriver |
71+
| `--format-factory` | `org.radarcns.hdfs.data.FormatFactory` | Factory for output formats. | FormatFactory |
72+
| `--compression-factory` | `org.radarcns.hdfs.data.CompressionFactory` | Factory class to use for data compression. | CompressionFactory |
73+
74+
To pass arguments to self-assigned plugins, use `-p arg1=value1 -p arg2=value2` command-line flags and read those arguments in the `Plugin#init(Map<String, String>)` method.

build.gradle

Lines changed: 150 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
1-
apply plugin: 'java'
2-
apply plugin: 'application'
1+
plugins {
2+
id 'java'
3+
id 'java-library'
4+
id 'application'
5+
id 'com.jfrog.bintray' version '1.8.1'
6+
id 'maven-publish'
7+
}
38

4-
group 'org.radarcns.restructurehdfs'
5-
version '0.4.1-SNAPSHOT'
6-
mainClassName = 'org.radarcns.hdfs.RestructureAvroRecords'
9+
group 'org.radarcns'
10+
version '0.5.0-SNAPSHOT'
11+
mainClassName = 'org.radarcns.hdfs.Application'
712

813
sourceCompatibility = '1.8'
914
targetCompatibility = '1.8'
1015

1116
ext {
17+
moduleDescription = 'RADAR HDFS restructuring'
18+
website = 'https://radar-base.org'
19+
githubRepoName = 'RADAR-base/Restructure-HDFS-topic'
20+
githubUrl = "https://github.com/${githubRepoName}"
21+
issueUrl = "${githubUrl}/issues"
22+
1223
avroVersion = '1.8.2'
1324
jacksonVersion = '2.9.6'
1425
hadoopVersion = '2.7.6'
1526
jCommanderVersion = '1.72'
27+
1628
}
1729

1830
repositories {
1931
jcenter()
2032
}
2133

2234
dependencies {
23-
implementation group: 'org.apache.avro', name: 'avro', version: avroVersion
35+
api group: 'org.apache.avro', name: 'avro', version: avroVersion
2436
implementation group: 'com.fasterxml.jackson.core' , name: 'jackson-databind', version: jacksonVersion
2537
implementation group: 'com.fasterxml.jackson.dataformat' , name: 'jackson-dataformat-csv', version: jacksonVersion
2638
implementation group: 'com.beust', name: 'jcommander', version: jCommanderVersion
@@ -33,10 +45,46 @@ dependencies {
3345
testImplementation group: 'junit', name: 'junit', version: '4.12'
3446
}
3547

48+
def pomConfig = {
49+
licenses {
50+
license {
51+
name = 'The Apache Software License, Version 2.0'
52+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
53+
distribution = 'repo'
54+
}
55+
}
56+
developers {
57+
developer {
58+
id = 'blootsvoets'
59+
name = 'Joris Borgdorff'
60+
61+
organization = 'The Hyve'
62+
}
63+
64+
}
65+
issueManagement {
66+
system = 'GitHub'
67+
url = issueUrl
68+
}
69+
organization {
70+
name = 'RADAR-base'
71+
url = website
72+
}
73+
scm {
74+
connection = 'scm:git:' + githubUrl
75+
url = githubUrl
76+
}
77+
}
78+
ext.sharedManifest = manifest {
79+
attributes(
80+
"Implementation-Title": rootProject.name,
81+
"Implementation-Version": version)
82+
}
83+
3684
jar {
3785
manifest {
38-
attributes 'Implementation-Title': 'RADAR-base HDFS data restructuring',
39-
'Implementation-Version': version
86+
from sharedManifest
87+
attributes 'Main-Class': mainClassName
4088
}
4189
}
4290

@@ -50,6 +98,17 @@ distributions {
5098
}
5199
}
52100

101+
startScripts {
102+
classpath += files('lib/PlaceHolderForPluginPath')
103+
104+
doLast {
105+
def windowsScriptFile = file getWindowsScript()
106+
def unixScriptFile = file getUnixScript()
107+
windowsScriptFile.text = windowsScriptFile.text.replace('PlaceHolderForPluginPath', 'radar-hdfs-plugins\\*')
108+
unixScriptFile.text = unixScriptFile.text.replace('PlaceHolderForPluginPath', 'radar-hdfs-plugins/*')
109+
}
110+
}
111+
53112
tasks.withType(Tar){
54113
compression = Compression.GZIP
55114
extension = 'tar.gz'
@@ -66,6 +125,88 @@ task copyDependencies(type: Copy) {
66125
into "${buildDir}/third-party/"
67126
}
68127

128+
// custom tasks for creating source/javadoc jars
129+
task sourcesJar(type: Jar, dependsOn: classes) {
130+
classifier = 'sources'
131+
from sourceSets.main.allSource
132+
manifest.from sharedManifest
133+
}
134+
135+
task javadocJar(type: Jar, dependsOn: javadoc) {
136+
classifier = 'javadoc'
137+
from javadoc.destinationDir
138+
manifest.from sharedManifest
139+
}
140+
141+
publishing {
142+
publications {
143+
mavenJar(MavenPublication) {
144+
from components.java
145+
artifact sourcesJar
146+
artifact javadocJar
147+
pom {
148+
url = githubUrl as String
149+
description = moduleDescription
150+
151+
licenses {
152+
license {
153+
name = 'The Apache Software License, Version 2.0'
154+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
155+
distribution = 'repo'
156+
}
157+
}
158+
developers {
159+
developer {
160+
id = 'blootsvoets'
161+
name = 'Joris Borgdorff'
162+
163+
organization = 'The Hyve'
164+
}
165+
166+
}
167+
issueManagement {
168+
system = 'GitHub'
169+
url = issueUrl as String
170+
}
171+
organization {
172+
name = 'RADAR-base'
173+
url = website
174+
}
175+
scm {
176+
connection = "scm:git:${githubUrl}" as String
177+
url = githubUrl as String
178+
}
179+
}
180+
}
181+
}
182+
}
183+
184+
185+
bintray {
186+
user project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
187+
key project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
188+
override false
189+
publications 'mavenJar'
190+
pkg {
191+
repo = project.group
192+
name = rootProject.name
193+
userOrg = 'radar-cns'
194+
desc = moduleDescription
195+
licenses = ['Apache-2.0']
196+
websiteUrl = website
197+
issueTrackerUrl = issueUrl
198+
vcsUrl = githubUrl
199+
githubRepo = githubRepoName
200+
githubReleaseNotesFile = 'README.md'
201+
version {
202+
name = project.version
203+
desc = description
204+
vcsTag = System.getenv('TRAVIS_TAG')
205+
released = new Date()
206+
}
207+
}
208+
}
209+
69210
wrapper {
70-
gradleVersion '4.8'
211+
gradleVersion '4.9'
71212
}

gradle/wrapper/gradle-wrapper.jar

0 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
rootProject.name = 'radar-hdfs-restructure'
2+
enableFeaturePreview('STABLE_PUBLISHING')

0 commit comments

Comments
 (0)