Skip to content

Commit

Permalink
[Api] Supports FLIP-27 Source
Browse files Browse the repository at this point in the history
  • Loading branch information
reswqa committed Feb 21, 2024
1 parent 27c8899 commit a8f32b4
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<T> {}
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.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 <T> Source<T> wrapSource(
org.apache.flink.api.connector.source.Source<T, ?, ?> source) {
return new WrappedSource<>(source);
}
}
Original file line number Diff line number Diff line change
@@ -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<T> implements Source<T> {
org.apache.flink.api.connector.source.Source<T, ?, ?> wrappedSource;

public WrappedSource(org.apache.flink.api.connector.source.Source<T, ?, ?> wrappedSource) {
this.wrappedSource = wrappedSource;
}

public org.apache.flink.api.connector.source.Source<T, ?, ?> getWrappedSource() {
return wrappedSource;
}
}

0 comments on commit a8f32b4

Please sign in to comment.