Skip to content
Permalink
Browse files
Adding the versioning system for the connector.
  • Loading branch information
nabarunnag committed Mar 3, 2020
1 parent ba8280f commit 78d473c09e81dd97dcfe1e0019660522bc690183
Showing 7 changed files with 76 additions and 8 deletions.
@@ -0,0 +1,48 @@
/*
* 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.geode.kafka;

import java.io.InputStream;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Version {

private static final Logger log = LoggerFactory.getLogger(Version.class);
private static String version = "unknown";

private static final String VERSION_FILE = "/kafka-connect-geode-version.properties";

static {
try {
Properties properties = new Properties();
try (InputStream stream = Version.class.getResourceAsStream(VERSION_FILE)) {
properties.load(stream);
version = properties.getProperty("version", version).trim();
}

} catch (Exception exception) {
log.warn("Error while loading version");
}
}

public static String getVersion() {
return version;
}


}
@@ -25,6 +25,8 @@
import org.apache.kafka.connect.connector.Task;
import org.apache.kafka.connect.sink.SinkConnector;

import org.apache.geode.kafka.Version;

public class GeodeKafkaSink extends SinkConnector {
private Map<String, String> sharedProps;

@@ -65,8 +67,7 @@ public ConfigDef config() {

@Override
public String version() {
// TODO
return "unknown";
return Version.getVersion();
}

}
@@ -30,6 +30,7 @@
import org.apache.geode.cache.RegionExistsException;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.kafka.GeodeContext;
import org.apache.geode.kafka.Version;


/**
@@ -50,8 +51,7 @@ public class GeodeKafkaSinkTask extends SinkTask {
*/
@Override
public String version() {
// TODO
return "unknown";
return Version.getVersion();
}

@Override
@@ -25,12 +25,12 @@
import java.util.Map;

import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.common.utils.AppInfoParser;
import org.apache.kafka.connect.connector.Task;
import org.apache.kafka.connect.source.SourceConnector;
import org.apache.kafka.connect.util.ConnectorUtils;

import org.apache.geode.kafka.GeodeConnectorConfig;
import org.apache.geode.kafka.Version;


public class GeodeKafkaSource extends SourceConnector {
@@ -79,7 +79,6 @@ public void stop() {

@Override
public String version() {
// TODO
return AppInfoParser.getVersion();
return Version.getVersion();
}
}
@@ -35,6 +35,7 @@
import org.apache.geode.cache.query.CqResults;
import org.apache.geode.cache.query.Struct;
import org.apache.geode.kafka.GeodeContext;
import org.apache.geode.kafka.Version;

public class GeodeKafkaSourceTask extends SourceTask {

@@ -61,7 +62,7 @@ private static Map<String, Long> createOffset() {

@Override
public String version() {
return null;
return Version.getVersion();
}

@Override
@@ -0,0 +1,17 @@
#
# 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.
#
version=${project.version}
@@ -0,0 +1,2 @@
##This file must be updated at package time to have a valid package##
invalid

0 comments on commit 78d473c

Please sign in to comment.