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.
[Feature][core] base interface. (apache#1608)
- Loading branch information
Showing
9 changed files
with
264 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...nnel-apis/seatunnel-api-base/src/main/java/org/apache/seatunnel/catalog/CatalogTable.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,20 @@ | ||
/* | ||
* 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.catalog; | ||
|
||
public class CatalogTable {} |
47 changes: 47 additions & 0 deletions
47
...seatunnel-api-base/src/main/java/org/apache/seatunnel/factories/MultipleTableFactory.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,47 @@ | ||
/* | ||
* 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.factories; | ||
|
||
import org.apache.seatunnel.catalog.CatalogTable; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* This factory is used with Java's Service Provider Interfaces (SPI) for discovering. | ||
* | ||
* <p>Classes that implement this interface can be added to the | ||
* "META_INF/services/org.apache.seatunnel.factories.TableFactory" file of a JAR file in the current | ||
* classpath to be found. | ||
* | ||
* @since 2022/03/29 | ||
*/ | ||
public interface MultipleTableFactory { | ||
|
||
/** Returns a unique identifier among same factory interfaces. */ | ||
String identifier(); | ||
|
||
/** Provides information describing the multi-table to be accessed. */ | ||
interface Context { | ||
|
||
List<CatalogTable> getMultipleCatalogTable(); | ||
|
||
/** Gives read-only access to the options of the current session. */ | ||
Map<String, String> getOptions(); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...unnel-api-base/src/main/java/org/apache/seatunnel/factories/MultipleTableSinkFactory.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,37 @@ | ||
/* | ||
* 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.factories; | ||
|
||
import org.apache.seatunnel.sink.Sink; | ||
|
||
/** | ||
* A factory to create configured multi-table sink instances. | ||
* | ||
* @since 2022/03/29 | ||
*/ | ||
public interface MultipleTableSinkFactory extends MultipleTableFactory { | ||
|
||
/** | ||
* Creates a {@link Sink} instance from multi-table {@link | ||
* org.apache.seatunnel.catalog.CatalogTable} and additional context information. | ||
* | ||
* <p>An implementation should perform validation and the discovery of further (nested) | ||
* factories in this method. | ||
*/ | ||
Sink<?> createMultipleTableSink(Context context); | ||
} |
39 changes: 39 additions & 0 deletions
39
...nel-api-base/src/main/java/org/apache/seatunnel/factories/MultipleTableSourceFactory.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.factories; | ||
|
||
import org.apache.seatunnel.source.Source; | ||
import org.apache.seatunnel.source.SourceSplit; | ||
|
||
/** | ||
* A factory to create configured multi-table source instances. | ||
* | ||
* @since 2022/03/29 | ||
*/ | ||
public interface MultipleTableSourceFactory extends MultipleTableFactory { | ||
|
||
/** | ||
* Creates a {@link Source} instance from multi-table {@link | ||
* org.apache.seatunnel.catalog.CatalogTable} and additional context information. | ||
* | ||
* <p>An implementation should perform validation and the discovery of further (nested) | ||
* factories in this method. | ||
*/ | ||
Source<?, ? extends SourceSplit, ?> createMultipleTableSource( | ||
MultipleTableFactory.Context context); | ||
} |
22 changes: 22 additions & 0 deletions
22
seatunnel-apis/seatunnel-api-base/src/main/java/org/apache/seatunnel/sink/Sink.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,22 @@ | ||
/* | ||
* 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.sink; | ||
|
||
import java.io.Serializable; | ||
|
||
public interface Sink<IN> extends Serializable {} |
30 changes: 30 additions & 0 deletions
30
seatunnel-apis/seatunnel-api-base/src/main/java/org/apache/seatunnel/source/Source.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,30 @@ | ||
/* | ||
* 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.source; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* The interface for Source. It acts like a factory class that helps construct the {@link | ||
* SourceSplitEnumerator} and {@link SourceReader} and corresponding serializers. | ||
* | ||
* @param <T> The type of records produced by the source. | ||
* @param <SplitT> The type of splits handled by the source. | ||
* @param <StateT> The type of state to store. | ||
*/ | ||
public interface Source<T, SplitT extends SourceSplit, StateT> extends Serializable {} |
20 changes: 20 additions & 0 deletions
20
...unnel-apis/seatunnel-api-base/src/main/java/org/apache/seatunnel/source/SourceReader.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,20 @@ | ||
/* | ||
* 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.source; | ||
|
||
public interface SourceReader {} |
29 changes: 29 additions & 0 deletions
29
seatunnel-apis/seatunnel-api-base/src/main/java/org/apache/seatunnel/source/SourceSplit.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,29 @@ | ||
/* | ||
* 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.source; | ||
|
||
/** An interface for all the Split types to extend. */ | ||
public interface SourceSplit { | ||
|
||
/** | ||
* Get the split id of this source split. | ||
* | ||
* @return id of this source split. | ||
*/ | ||
String splitId(); | ||
} |
20 changes: 20 additions & 0 deletions
20
...s/seatunnel-api-base/src/main/java/org/apache/seatunnel/source/SourceSplitEnumerator.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,20 @@ | ||
/* | ||
* 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.source; | ||
|
||
public interface SourceSplitEnumerator {} |