forked from apache/seatunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xiaofan2022
committed
Nov 2, 2023
1 parent
bdbc66a
commit b5db948
Showing
15 changed files
with
591 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
seatunnel-connectors-v2/connector-http/connector-http-plus/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.apache.seatunnel</groupId> | ||
<artifactId>seatunnel-connectors-v2</artifactId> | ||
<version>2.3.2-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>connector-http-plus</artifactId> | ||
<name>SeaTunnel : Connectors V2 : Http : Plus</name> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.seatunnel</groupId> | ||
<artifactId>connector-http-base</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
17 changes: 17 additions & 0 deletions
17
...ctor-http-plus/src/main/java/org/apache/seatunnel/plus/source/AbstractRequestHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.apache.seatunnel.plus.source; | ||
|
||
import org.apache.seatunnel.connectors.seatunnel.http.config.HttpParameter; | ||
import org.apache.seatunnel.shade.com.typesafe.config.Config; | ||
|
||
public abstract class AbstractRequestHandler { | ||
|
||
public void before(Config pluginConfig){ | ||
|
||
} | ||
|
||
public void after(Config pluginConfig){ | ||
|
||
} | ||
|
||
abstract public void request(Config pluginConfig, HttpParameter httpParameter); | ||
} |
83 changes: 83 additions & 0 deletions
83
...tp/connector-http-plus/src/main/java/org/apache/seatunnel/plus/source/HttpPlusSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* 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.seatunnel.plus.source; | ||
|
||
import org.apache.seatunnel.api.common.PrepareFailException; | ||
import org.apache.seatunnel.api.source.Boundedness; | ||
import org.apache.seatunnel.api.source.SeaTunnelSource; | ||
import org.apache.seatunnel.api.table.catalog.CatalogTableUtil; | ||
import org.apache.seatunnel.api.table.type.SeaTunnelRow; | ||
import org.apache.seatunnel.common.constants.JobMode; | ||
|
||
|
||
import org.apache.seatunnel.common.exception.CommonErrorCode; | ||
import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitReader; | ||
import org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext; | ||
import org.apache.seatunnel.connectors.seatunnel.http.config.HttpConfig; | ||
import org.apache.seatunnel.connectors.seatunnel.http.exception.HttpConnectorException; | ||
import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSource; | ||
import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSourceReader; | ||
import org.apache.seatunnel.connectors.seatunnel.http.source.SimpleTextDeserializationSchema; | ||
import org.apache.seatunnel.format.json.JsonDeserializationSchema; | ||
import org.apache.seatunnel.plus.source.config.HttpPlusSourceParameter; | ||
import org.apache.seatunnel.shade.com.typesafe.config.Config; | ||
|
||
import java.util.Locale; | ||
|
||
import com.google.auto.service.AutoService; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@AutoService(SeaTunnelSource.class) | ||
public class HttpPlusSource extends HttpSource { | ||
|
||
private Config pluginConfig; | ||
private HttpPlusSourceParameter plusSourceParameter=new HttpPlusSourceParameter(); | ||
|
||
@Override | ||
public String getPluginName() { | ||
return "Plus"; | ||
} | ||
|
||
@Override | ||
public void prepare(Config pluginConfig) throws PrepareFailException { | ||
//如果配置包名那么校验内容 | ||
buildSchemaWithConfig(pluginConfig); | ||
this.pluginConfig=pluginConfig; | ||
} | ||
|
||
@Override | ||
public AbstractSingleSplitReader<SeaTunnelRow> createReader(SingleSplitReaderContext readerContext) throws Exception { | ||
return new HttpPlusSourceReader(plusSourceParameter, | ||
readerContext, | ||
this.deserializationSchema, | ||
jsonField, | ||
contentField,pluginConfig); | ||
} | ||
|
||
@Override | ||
public Boundedness getBoundedness() { | ||
if (JobMode.BATCH.equals(jobContext.getJobMode())) { | ||
return Boundedness.BOUNDED; | ||
} | ||
throw new UnsupportedOperationException( | ||
"http-plus source connector not support unbounded operation"); | ||
} | ||
|
||
|
||
} |
39 changes: 39 additions & 0 deletions
39
...ector-http-plus/src/main/java/org/apache/seatunnel/plus/source/HttpPlusSourceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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.seatunnel.auth.source; | ||
import org.apache.seatunnel.api.configuration.util.OptionRule; | ||
import org.apache.seatunnel.api.table.factory.Factory; | ||
import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSourceFactory; | ||
import com.google.auto.service.AutoService; | ||
@AutoService(Factory.class) | ||
public class AuthSourceFactory extends HttpSourceFactory { | ||
@Override | ||
public String factoryIdentifier() { | ||
return "Gitlab"; | ||
} | ||
@Override | ||
public OptionRule optionRule() { | ||
return getHttpBuilder().required(GitlabSourceConfig.ACCESS_TOKEN).build(); | ||
} | ||
} | ||
*/ |
Oops, something went wrong.