You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/10/28 16:37:00 UTC
[plc4x] 02/02: - Replaced the auto-generated config files with ones
written by me (Resolving the need to reference in the LICENSE or other
resources)
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch rel/0.5
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit e409376a68518e335e8a66a8bbd88004fe9351dd
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Oct 28 17:36:51 2019 +0100
- Replaced the auto-generated config files with ones written by me (Resolving the need to reference in the LICENSE or other resources)
---
.../java/streampipes/bacnetip/BacNetIpAdapter.java | 6 +-
.../streampipes/bacnetip/config/ConfigKeys.java | 45 ++++++-----
.../bacnetip/config/ConnectWorkerConfig.java | 94 +++++++++-------------
3 files changed, 63 insertions(+), 82 deletions(-)
diff --git a/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/BacNetIpAdapter.java b/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/BacNetIpAdapter.java
index aa9a2d8..7ba09d6 100644
--- a/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/BacNetIpAdapter.java
+++ b/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/BacNetIpAdapter.java
@@ -326,9 +326,9 @@ public class BacNetIpAdapter extends SpecificDataStreamAdapter {
.getInstance()
.add(new BacNetIpAdapter());
- String workerUrl = ConnectWorkerConfig.INSTANCE.getConnectContainerWorkerUrl();
- String masterUrl = ConnectWorkerConfig.INSTANCE.getConnectContainerMasterUrl();
- Integer workerPort = ConnectWorkerConfig.INSTANCE.getConnectContainerWorkerPort();
+ String workerUrl = ConnectWorkerConfig.getInstance().getConnectContainerWorkerUrl();
+ String masterUrl = ConnectWorkerConfig.getInstance().getConnectContainerMasterUrl();
+ Integer workerPort = ConnectWorkerConfig.getInstance().getConnectContainerWorkerPort();
new BacNetIpAdapterInit().init(workerUrl, masterUrl, workerPort);
}
diff --git a/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/config/ConfigKeys.java b/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/config/ConfigKeys.java
index ecce008..832c8a6 100644
--- a/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/config/ConfigKeys.java
+++ b/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/config/ConfigKeys.java
@@ -1,31 +1,32 @@
/*
- * Copyright 2019 FZI Forschungszentrum Informatik
- *
- * 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.
- *
- */
+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.plc4x.java.streampipes.bacnetip.config;
-public class ConfigKeys {
+public interface ConfigKeys {
- final static String KAFKA_HOST = "SP_KAFKA_HOST";
- final static String KAFKA_PORT = "SP_KAFKA_PORT";
+ String SP_KAFKA_HOST = "SP_KAFKA_HOST";
+ String SP_KAFKA_PORT = "SP_KAFKA_PORT";
- final static String CONNECT_CONTAINER_WORKER_HOST = "SP_CONNECT_CONTAINER_WORKER_HOST";
- final static String CONNECT_CONTAINER_WORKER_PORT = "SP_CONNECT_CONTAINER_WORKER_PORT";
+ String SP_CONNECT_CONTAINER_MASTER_HOST = "SP_CONNECT_CONTAINER_MASTER_HOST";
+ String SP_CONNECT_CONTAINER_MASTER_PORT = "SP_CONNECT_CONTAINER_MASTER_PORT";
- final static String CONNECT_CONTAINER_MASTER_HOST = "SP_CONNECT_CONTAINER_MASTER_HOST";
- final static String CONNECT_CONTAINER_MASTER_PORT = "SP_CONNECT_CONTAINER_MASTER_PORT";
+ String SP_CONNECT_CONTAINER_WORKER_HOST = "SP_CONNECT_CONTAINER_WORKER_HOST";
+ String SP_CONNECT_CONTAINER_WORKER_PORT = "SP_CONNECT_CONTAINER_WORKER_PORT";
}
diff --git a/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/config/ConnectWorkerConfig.java b/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/config/ConnectWorkerConfig.java
index 2892a94..ba64541 100644
--- a/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/config/ConnectWorkerConfig.java
+++ b/sandbox/streampipes-connectors/src/main/java/org/apache/plc4x/java/streampipes/bacnetip/config/ConnectWorkerConfig.java
@@ -1,83 +1,63 @@
/*
- * Copyright 2019 FZI Forschungszentrum Informatik
- *
- * 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.
- *
- */
-
+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.plc4x.java.streampipes.bacnetip.config;
import org.streampipes.config.SpConfig;
import org.streampipes.connect.init.Config;
-public enum ConnectWorkerConfig {
+public class ConnectWorkerConfig {
- INSTANCE;
+ private static ConnectWorkerConfig instance = new ConnectWorkerConfig();
+ public static ConnectWorkerConfig getInstance() {
+ return instance;
+ }
private SpConfig config;
- ConnectWorkerConfig() {
+ private ConnectWorkerConfig() {
String name = "bacnetip-connect-worker-main";
+
config = SpConfig.getSpConfig(name);
- config.register(ConfigKeys.KAFKA_HOST, "kafka", "Hostname for backend service for kafka");
- config.register(ConfigKeys.KAFKA_PORT, 9092, "Port for backend service for kafka");
+ config.register(ConfigKeys.SP_KAFKA_HOST, "kafka", "");
+ config.register(ConfigKeys.SP_KAFKA_PORT, 9092, "");
- config.register(ConfigKeys.CONNECT_CONTAINER_WORKER_PORT, Config.WORKER_PORT, "The port of the connect container");
- config.register(ConfigKeys.CONNECT_CONTAINER_WORKER_HOST, name, "The hostname of the connect container");
+ config.register(ConfigKeys.SP_CONNECT_CONTAINER_MASTER_HOST, name, "");
+ config.register(ConfigKeys.SP_CONNECT_CONTAINER_MASTER_PORT, Config.WORKER_PORT, "");
- config.register(ConfigKeys.CONNECT_CONTAINER_MASTER_PORT, Config.MASTER_PORT, "The port of the connect container");
- config.register(ConfigKeys.CONNECT_CONTAINER_MASTER_HOST, Config.MASTER_HOST, "The hostname of the connect container");
- }
+ config.register(ConfigKeys.SP_CONNECT_CONTAINER_WORKER_HOST, Config.MASTER_HOST, "");
+ config.register(ConfigKeys.SP_CONNECT_CONTAINER_WORKER_PORT, Config.MASTER_PORT, "");
- public String getConnectContainerWorkerUrl() {
- return "http://" + config.getString(ConfigKeys.CONNECT_CONTAINER_WORKER_HOST) + ":" + config.getInteger(ConfigKeys.CONNECT_CONTAINER_WORKER_PORT) + "/";
}
public String getConnectContainerMasterUrl() {
- return "http://" + config.getString(ConfigKeys.CONNECT_CONTAINER_MASTER_HOST) + ":" + config.getInteger(ConfigKeys.CONNECT_CONTAINER_MASTER_PORT) + "/";
- }
-
- public String getKafkaHost() {
- return config.getString(ConfigKeys.KAFKA_HOST);
- }
-
- public void setKafkaHost(String s) {
- config.setString(ConfigKeys.KAFKA_HOST, s);
+ return "http://" + config.getString(ConfigKeys.SP_CONNECT_CONTAINER_MASTER_HOST) + ":" +
+ config.getInteger(ConfigKeys.SP_CONNECT_CONTAINER_MASTER_PORT) + "/";
}
- public int getKafkaPort() {
- return config.getInteger(ConfigKeys.KAFKA_PORT);
- }
-
- public String getKafkaUrl() {
- return getKafkaHost() + ":" + getKafkaPort();
- }
-
- public String getConnectContainerWorkerHost() {
- return config.getString(ConfigKeys.CONNECT_CONTAINER_WORKER_HOST);
- }
-
- public Integer getConnectContainerWorkerPort() {
- return config.getInteger(ConfigKeys.CONNECT_CONTAINER_WORKER_PORT);
- }
-
- public String getConnectContainerMasterHost() {
- return config.getString(ConfigKeys.CONNECT_CONTAINER_MASTER_HOST);
+ public String getConnectContainerWorkerUrl() {
+ return "http://" + config.getString(ConfigKeys.SP_CONNECT_CONTAINER_WORKER_HOST) + ":" +
+ config.getInteger(ConfigKeys.SP_CONNECT_CONTAINER_WORKER_PORT) + "/";
}
- public Integer getConnectContainerMasterPort() {
- return config.getInteger(ConfigKeys.CONNECT_CONTAINER_MASTER_PORT);
+ public int getConnectContainerWorkerPort() {
+ return config.getInteger(ConfigKeys.SP_CONNECT_CONTAINER_WORKER_PORT);
}
}