Skip to content

Commit

Permalink
Merge pull request #71 from RADAR-base/release-0.12.2
Browse files Browse the repository at this point in the history
Release 0.12.2
  • Loading branch information
blootsvoets authored Jul 23, 2019
2 parents 672d99a + 9cbafcc commit b61a2ba
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ deploy:
on:
tags: true
- provider: script
script: ./gradlew artifactoryPublish
script: ./gradlew publish
skip_cleanup: true
on:
branch: dev
Expand Down
47 changes: 45 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,49 @@ dependencies {
}
```

Example use, after adding [`radar-schemas`](https://github.com/radar-base/radar-schemas) to classpath:
```kotlin
// Set URLs for RADAR-base installation
val baseUrl = "..."
val kafkaUrl = "$baseUrl/kafka/"
val schemaUrl = "$baseUrl/schema/"
val oauthHeaders = ...
val key = ObservationKey("myProject", "myUser", "mySource")

// Configure RADAR-base clients
val client = RestClient.global().apply {
server(ServerConfig(kafkaUrl))
gzipCompression(true)
}.build()

val schemaRetriever = SchemaRetriever(ServerConfig(schemaUrl), 30)

val restSender = RestSender.Builder().apply {
httpClient(client)
schemaRetriever(schemaRetriever)
useBinaryContent(true)
headers(oauthHeaders)
}.build()

val sender = BatchedKafkaSender(restSender, 60_000L, 1000L)

// Configure topic to send data over
val topic = AvroTopic("linux_raspberry_temperature",
ObservationKey.getClassSchema(), RaspberryTemperature.getClassSchema(),
ObservationKey::class.java, RaspberryTemperature::class.java)

// Send data to topic. Be sure to close
// the sender after use. Preferably, a sender is reused
// for many observations so that requests are efficiently
// batched.
sender.sender(topic).use { topicSender ->
readValuesFromSystem() { value ->
topicSender.send(key, value)
}
}
```
Note that this code above does not include any flows for registering a source with the managmentportal.

For server utilities, include `radar-commons-server`:
```gradle
repositories {
Expand Down Expand Up @@ -69,7 +112,7 @@ For latest code use `dev` branch. This is released on JFrog's OSS Artifactory. T

```gradle
repositories {
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
maven { url 'https://repo.thehyve.nl/content/repositories/snapshots' }
}
configurations.all {
Expand All @@ -78,7 +121,7 @@ configurations.all {
}
dependencies {
compile group: 'org.radarbase', name: 'radar-commons', version: '0.12.1-SNAPSHOT'
compile group: 'org.radarbase', name: 'radar-commons', version: '0.12.2-SNAPSHOT'
}
```

Expand Down
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
plugins {
// Get bintray version
id 'com.jfrog.bintray' version '1.8.4' apply false
id 'com.jfrog.artifactory' version '4.9.6' apply false
id 'com.commercehub.gradle.plugin.avro' version '0.16.0'
}

Expand All @@ -30,21 +29,22 @@ subprojects {
// Configuration //
//---------------------------------------------------------------------------//

version = '0.12.1'
version = '0.12.2'
group = 'org.radarbase'
ext.githubRepoName = 'RADAR-base/radar-commons'

ext.slf4jVersion = '1.7.26'
ext.kafkaVersion = '2.2.0-cp2'
ext.kafkaVersion = '2.3.0'
ext.avroVersion = '1.8.2'
ext.confluentVersion = '5.2.1'
ext.jacksonVersion = '2.9.9'
ext.okhttpVersion = '3.14.1'
ext.confluentVersion = '5.3.0'
ext.jacksonVersion = '2.9.9.1'
ext.jacksonYamlVersion = '2.9.9'
ext.okhttpVersion = '4.0.1'
ext.junitVersion = '4.12'
ext.mockitoVersion = '2.27.0'
ext.mockitoVersion = '2.28.2'
ext.hamcrestVersion = '1.3'
ext.codacyVersion = '6.0.0'
ext.radarSchemasVersion = '0.5.0'
ext.radarSchemasVersion = '0.5.1'
ext.orgJsonVersion = '20180813'

ext.githubUrl = "https://github.com/$githubRepoName"
Expand Down Expand Up @@ -111,5 +111,5 @@ subprojects {
}

wrapper {
gradleVersion '5.4.1'
gradleVersion '5.5.1'
}
31 changes: 13 additions & 18 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'

def sharedManifest = manifest {
attributes("Implementation-Title": project.name,
Expand All @@ -27,6 +26,8 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
manifest.from sharedManifest
}

ext.nexusRepoBase = 'https://repo.thehyve.nl/content/repositories'

// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar, javadocJar
Expand Down Expand Up @@ -79,6 +80,17 @@ publishing {
}
}
}
repositories {
maven {
def releasesRepoUrl = "$nexusRepoBase/releases"
def snapshotsRepoUrl = "$nexusRepoBase/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = project.hasProperty('nexusUser') ? project.property('nexusUser') : System.getenv('NEXUS_USER')
password = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : System.getenv('NEXUS_PASSWORD')
}
}
}
}

bintray {
Expand All @@ -105,20 +117,3 @@ bintray {
}
}
}


artifactory {
contextUrl = 'https://oss.jfrog.org/artifactory'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
maven = true
}
}
}

artifactoryPublish {
publications('mavenJar')
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 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
# https://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,
Expand Down
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
4 changes: 1 addition & 3 deletions radar-commons-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import com.commercehub.gradle.plugin.avro.GenerateAvroJavaTask

/*
* Copyright 2017 The Hyve and King's College London
*
Expand Down Expand Up @@ -32,7 +30,7 @@ dependencies {

// For POJO classes and ConfigLoader
implementation group: 'com.fasterxml.jackson.core' , name: 'jackson-databind' , version: jacksonVersion
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: jacksonYamlVersion

api group: 'org.apache.avro', name: 'avro', version: avroVersion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.avro.specific.SpecificData;
import org.apache.avro.specific.SpecificDatumReader;
import org.apache.avro.specific.SpecificRecord;
import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.common.errors.SerializationException;

import java.io.IOException;
Expand Down Expand Up @@ -61,19 +60,11 @@ protected void configure(KafkaAvroDeserializerConfig config) {
}

protected KafkaAvroDeserializerConfig deserializerConfig(Map<String, ?> props) {
try {
return new KafkaAvroDeserializerConfig(props);
} catch (io.confluent.common.config.ConfigException e) {
throw new ConfigException(e.getMessage());
}
return new KafkaAvroDeserializerConfig(props);
}

protected KafkaAvroDeserializerConfig deserializerConfig(VerifiableProperties props) {
try {
return new KafkaAvroDeserializerConfig(props.props());
} catch (io.confluent.common.config.ConfigException e) {
throw new ConfigException(e.getMessage());
}
return new KafkaAvroDeserializerConfig(props.props());
}

private ByteBuffer getByteBuffer(byte[] payload) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static X509TrustManager systemDefaultTrustManager() {
*/
public static SSLSocketFactory systemDefaultSslSocketFactory(X509TrustManager trustManager) {
try {
SSLContext sslContext = Platform.get().getSSLContext();
SSLContext sslContext = Platform.get().newSSLContext();
sslContext.init(null, new TrustManager[] { trustManager }, null);
return sslContext.getSocketFactory();
} catch (GeneralSecurityException e) {
Expand Down

0 comments on commit b61a2ba

Please sign in to comment.