diff --git a/flink-core-api/src/main/java/org/apache/flink/api/connector/v2/Source.java b/flink-core-api/src/main/java/org/apache/flink/api/connector/v2/Source.java new file mode 100644 index 00000000000000..f4093ca736878b --- /dev/null +++ b/flink-core-api/src/main/java/org/apache/flink/api/connector/v2/Source.java @@ -0,0 +1,25 @@ +/* + * 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.flink.api.connector.v2; + +/** + * Source interface for DataStream api v2. Note that this is a temporary approach, will be removed + * in the future. + */ +public interface Source {} diff --git a/flink-core/src/main/java/org/apache/flink/api/connector/v2/SourceUtils.java b/flink-core/src/main/java/org/apache/flink/api/connector/v2/SourceUtils.java new file mode 100644 index 00000000000000..bf728f728b46b8 --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/connector/v2/SourceUtils.java @@ -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.flink.api.connector.v2; + +import org.apache.flink.annotation.Experimental; + +/** Utils to convert a FLIP-27 based source to a DataStream V2 Source. */ +@Experimental +public final class SourceUtils { + public static Source wrapSource( + org.apache.flink.api.connector.source.Source source) { + return new WrappedSource<>(source); + } +} diff --git a/flink-core/src/main/java/org/apache/flink/api/connector/v2/WrappedSource.java b/flink-core/src/main/java/org/apache/flink/api/connector/v2/WrappedSource.java new file mode 100644 index 00000000000000..b7e2ab21da9122 --- /dev/null +++ b/flink-core/src/main/java/org/apache/flink/api/connector/v2/WrappedSource.java @@ -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 org.apache.flink.api.connector.v2; + +import org.apache.flink.annotation.Internal; + +/** A simple {@link Source} implementation that wrap a FLIP-27 source. */ +@Internal +public class WrappedSource implements Source { + org.apache.flink.api.connector.source.Source wrappedSource; + + public WrappedSource(org.apache.flink.api.connector.source.Source wrappedSource) { + this.wrappedSource = wrappedSource; + } + + public org.apache.flink.api.connector.source.Source getWrappedSource() { + return wrappedSource; + } +}