-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
1 parent
c73b933
commit 10d7a46
Showing
12 changed files
with
43 additions
and
156 deletions.
There are no files selected for viewing
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
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
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
23 changes: 0 additions & 23 deletions
23
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkCommonOptions.java
This file was deleted.
Oops, something went wrong.
68 changes: 6 additions & 62 deletions
68
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SupportDataSaveMode.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 |
---|---|---|
@@ -1,71 +1,15 @@ | ||
/* | ||
* 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.api.sink; | ||
|
||
import org.apache.seatunnel.shade.com.typesafe.config.Config; | ||
|
||
import org.apache.seatunnel.api.common.SeaTunnelAPIErrorCode; | ||
import org.apache.seatunnel.common.exception.SeaTunnelRuntimeException; | ||
|
||
import java.util.List; | ||
import java.util.Locale; | ||
|
||
/** The Sink Connectors which support data SaveMode should implement this interface */ | ||
public interface SupportDataSaveMode { | ||
|
||
/** | ||
* We hope every sink connector use the same option name to config SaveMode, So I add | ||
* checkOptions method to this interface. checkOptions method have a default implement to check | ||
* whether `save_mode` parameter is in config. | ||
* | ||
* @param config config of sink Connector | ||
*/ | ||
default void checkOptions(Config config) { | ||
if (config.hasPath(SinkCommonOptions.DATA_SAVE_MODE)) { | ||
String tableSaveMode = config.getString(SinkCommonOptions.DATA_SAVE_MODE); | ||
DataSaveMode dataSaveMode = | ||
DataSaveMode.valueOf(tableSaveMode.toUpperCase(Locale.ROOT)); | ||
if (!supportedDataSaveModeValues().contains(dataSaveMode)) { | ||
throw new SeaTunnelRuntimeException( | ||
SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED, | ||
"This connector don't support save mode: " + dataSaveMode); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Get the {@link DataSaveMode} that the user configured | ||
* | ||
* @return DataSaveMode | ||
*/ | ||
DataSaveMode getDataSaveMode(); | ||
|
||
String SAVE_MODE_KEY = "savemode"; | ||
/** | ||
* Return the {@link DataSaveMode} list supported by this connector | ||
* Return the value of DataSaveMode configured by user in the job config file. | ||
* | ||
* @return the list of supported data save modes | ||
* @return | ||
*/ | ||
List<DataSaveMode> supportedDataSaveModeValues(); | ||
DataSaveMode getUserConfigSaveMode(); | ||
|
||
/** | ||
* The implementation of specific logic according to different {@link DataSaveMode} | ||
* | ||
* @param saveMode data save mode | ||
*/ | ||
void handleSaveMode(DataSaveMode saveMode); | ||
/** The implementation of specific logic according to different {@link DataSaveMode} */ | ||
void handleSaveMode(DataSaveMode userConfigSaveMode); | ||
} |
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
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
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
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
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
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
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