Skip to content

Commit

Permalink
[bugfix][plugin][influxdbreader] Fix incorrect package path, fix #1071
Browse files Browse the repository at this point in the history
  • Loading branch information
wgzhao committed Aug 16, 2024
1 parent 3b1b43a commit fa6bc43
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 105 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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 com.wgzhao.addax.plugin.reader.influxdbreader;

import com.wgzhao.addax.common.base.Key;

public final class InfluxDBKey extends Key
{
public static final String ENDPOINT = "endpoint";
public static final String COLUMN = "column";
public static final String USERNAME = "username";
public static final String PASSWORD = "password";
public static final String DATABASE = "database";
public static final String QUERY_SQL = "querySql";
public static final String CONNECTION = "connection";
public static final String CONNECT_TIMEOUT_SECONDS = "connTimeout";
public static final String SOCKET_TIMEOUT_SECONDS = "socketTimeout";
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/*
* 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
* 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
* 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.
* 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 com.wgzhao.addax.plugin.reader.influxdb2reader;
package com.wgzhao.addax.plugin.reader.influxdbreader;

import com.wgzhao.addax.common.exception.AddaxException;
import com.wgzhao.addax.common.plugin.RecordSender;
Expand Down Expand Up @@ -50,7 +50,7 @@ public void preCheck()
init();
originalConfig.getNecessaryValue(InfluxDBKey.ENDPOINT, InfluxDBReaderErrorCode.REQUIRED_VALUE);
List<String> columns = originalConfig.getList(InfluxDBKey.COLUMN, String.class);
String querySql = originalConfig.getString(InfluxDBKey.QUERY_SQL, null);
String querySql = originalConfig.getNecessaryValue(InfluxDBKey.QUERY_SQL, null);
String database = originalConfig.getString(InfluxDBKey.DATABASE, null);
if (StringUtils.isAllBlank(querySql,database)) {
throw AddaxException.asAddaxException(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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 com.wgzhao.addax.plugin.reader.influxdbreader;

import com.wgzhao.addax.common.spi.ErrorCode;

public enum InfluxDBReaderErrorCode
implements ErrorCode
{
REQUIRED_VALUE("InfluxDBReader-00", "缺失必要的值"),
ILLEGAL_VALUE("InfluxDBReader-01", "值非法");

private final String code;
private final String description;

InfluxDBReaderErrorCode(String code, String description)
{
this.code = code;
this.description = description;
}

@Override
public String getCode()
{
return this.code;
}

@Override
public String getDescription()
{
return this.description;
}

@Override
public String toString()
{
return String.format("Code:[%s], Description:[%s]. ", this.code,
this.description);
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/*
* 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
* 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
* 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.
* 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 com.wgzhao.addax.plugin.reader.influxdb2reader;
package com.wgzhao.addax.plugin.reader.influxdbreader;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
Expand Down Expand Up @@ -59,7 +59,7 @@ public InfluxDBReaderTask(Configuration configuration)
{
List<Object> connList = configuration.getList(InfluxDBKey.CONNECTION);
Configuration conn = Configuration.from(connList.get(0).toString());
this.querySql = configuration.getString(InfluxDBKey.QUERY_SQL, null);
this.querySql = configuration.getString(InfluxDBKey.QUERY_SQL, "");
this.database = conn.getString(InfluxDBKey.DATABASE);
this.endpoint = conn.getString(InfluxDBKey.ENDPOINT);
this.username = configuration.getString(InfluxDBKey.USERNAME);
Expand Down

0 comments on commit fa6bc43

Please sign in to comment.