Skip to content

Commit

Permalink
[Feature][Connector-V2][Paimon] Add factory for paimon source & sink
Browse files Browse the repository at this point in the history
  • Loading branch information
TyrantLucifer committed May 17, 2023
1 parent f91d8a1 commit a050b2f
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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.connectors.seatunnel.paimon.sink;

import org.apache.seatunnel.api.configuration.util.OptionRule;
import org.apache.seatunnel.api.table.factory.Factory;
import org.apache.seatunnel.api.table.factory.TableSinkFactory;
import org.apache.seatunnel.connectors.seatunnel.paimon.config.PaimonConfig;

import com.google.auto.service.AutoService;

@AutoService(Factory.class)
public class PaimonSinkFactory implements TableSinkFactory {

@Override
public String factoryIdentifier() {
return "Paimon";
}

@Override
public OptionRule optionRule() {
return OptionRule.builder()
.required(PaimonConfig.WAREHOUSE)
.required(PaimonConfig.DATABASE)
.required(PaimonConfig.TABLE)
.optional(PaimonConfig.HDFS_SITE_PATH)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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.connectors.seatunnel.paimon.source;

import org.apache.seatunnel.api.configuration.util.OptionRule;
import org.apache.seatunnel.api.source.SeaTunnelSource;
import org.apache.seatunnel.api.table.factory.Factory;
import org.apache.seatunnel.api.table.factory.TableSourceFactory;
import org.apache.seatunnel.connectors.seatunnel.paimon.config.PaimonConfig;

import com.google.auto.service.AutoService;

@AutoService(Factory.class)
public class PaimonSourceFactory implements TableSourceFactory {

@Override
public String factoryIdentifier() {
return "Paimon";
}

@Override
public OptionRule optionRule() {
return OptionRule.builder()
.required(PaimonConfig.WAREHOUSE)
.required(PaimonConfig.DATABASE)
.required(PaimonConfig.TABLE)
.optional(PaimonConfig.HDFS_SITE_PATH)
.build();
}

@Override
public Class<? extends SeaTunnelSource> getSourceClass() {
return PaimonSource.class;
}
}

0 comments on commit a050b2f

Please sign in to comment.